opusfile
opusfile copied to clipboard
http: Avoid undefined behavior in va_arg conversion
Compiling under Clang 13 with -Wextra resulted in the following warning:
src/http.c:3470:31: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
request=va_arg(_ap,char *)-(char *)NULL;
It seems subtracting a null pointer is undefined behavior, which we can avoid by casting to intptr_t instead.
Request macros (e.g. OP_GET_SERVER_INFO) already do a simple cast ((char*)_request)
rather than addition with null pointer (_request+(char*)NULL)
so nothing needs to be changed on that end.