Loading lib/gopher.c +2 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ #include "rawstr.h" #include "select.h" #include "url.h" #include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> Loading Loading @@ -156,7 +157,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done) /* We use Curl_write instead of Curl_sendf to make sure the entire buffer is sent, which could be sizeable with long selectors. */ k = strlen(sel); k = curlx_uztosz(strlen(sel)); for(;;) { result = Curl_write(conn, sockfd, sel, k, &amount); Loading lib/warnless.c +53 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,39 @@ # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL #else # error "SIZEOF_LONG not defined" # error "CURL_SIZEOF_LONG not defined" #endif #if (CURL_SIZEOF_CURL_OFF_T == 2) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFF) #elif (CURL_SIZEOF_CURL_OFF_T == 4) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFF) #elif (CURL_SIZEOF_CURL_OFF_T == 8) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFF) #elif (CURL_SIZEOF_CURL_OFF_T == 16) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) #else # error "CURL_SIZEOF_CURL_OFF_T not defined" #endif #if (SIZEOF_SIZE_T == SIZEOF_SHORT) # define CURL_MASK_SSIZE_T CURL_MASK_SSHORT # define CURL_MASK_USIZE_T CURL_MASK_USHORT #elif (SIZEOF_SIZE_T == SIZEOF_INT) # define CURL_MASK_SSIZE_T CURL_MASK_SINT # define CURL_MASK_USIZE_T CURL_MASK_UINT #elif (SIZEOF_SIZE_T == CURL_SIZEOF_LONG) # define CURL_MASK_SSIZE_T CURL_MASK_SLONG # define CURL_MASK_USIZE_T CURL_MASK_ULONG #elif (SIZEOF_SIZE_T == CURL_SIZEOF_CURL_OFF_T) # define CURL_MASK_SSIZE_T CURL_MASK_SCOFFT # define CURL_MASK_USIZE_T CURL_MASK_UCOFFT #else # error "SIZEOF_SIZE_T not defined" #endif /* Loading Loading @@ -179,3 +211,21 @@ unsigned short curlx_sltous(long slnum) # pragma warning(pop) #endif } /* ** unsigned size_t to signed ssize_t */ ssize_t curlx_uztosz(size_t uznum) { #ifdef __INTEL_COMPILER # pragma warning(push) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T); #ifdef __INTEL_COMPILER # pragma warning(pop) #endif } lib/warnless.h +2 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,6 @@ unsigned int curlx_sltoui(long slnum); unsigned short curlx_sltous(long slnum); ssize_t curlx_uztosz(size_t uznum); #endif /* HEADER_CURL_WARNLESS_H */ tests/server/rtspd.c +1 −1 Original line number Diff line number Diff line Loading @@ -798,7 +798,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req) while(!done_processing && (req->offset < REQBUFSIZ-1)) { if(pipereq_length && pipereq) { memmove(reqbuf, pipereq, pipereq_length); got = pipereq_length; got = curlx_uztosz(pipereq_length); pipereq_length = 0; } else { Loading tests/server/sws.c +1 −1 Original line number Diff line number Diff line Loading @@ -762,7 +762,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req) while(!done_processing && (req->offset < REQBUFSIZ-1)) { if(pipereq_length && pipereq) { memmove(reqbuf, pipereq, pipereq_length); got = pipereq_length; got = curlx_uztosz(pipereq_length); pipereq_length = 0; } else { Loading Loading
lib/gopher.c +2 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ #include "rawstr.h" #include "select.h" #include "url.h" #include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> Loading Loading @@ -156,7 +157,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done) /* We use Curl_write instead of Curl_sendf to make sure the entire buffer is sent, which could be sizeable with long selectors. */ k = strlen(sel); k = curlx_uztosz(strlen(sel)); for(;;) { result = Curl_write(conn, sockfd, sel, k, &amount); Loading
lib/warnless.c +53 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,39 @@ # define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL # define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL #else # error "SIZEOF_LONG not defined" # error "CURL_SIZEOF_LONG not defined" #endif #if (CURL_SIZEOF_CURL_OFF_T == 2) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFF) #elif (CURL_SIZEOF_CURL_OFF_T == 4) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFF) #elif (CURL_SIZEOF_CURL_OFF_T == 8) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFF) #elif (CURL_SIZEOF_CURL_OFF_T == 16) # define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) # define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) #else # error "CURL_SIZEOF_CURL_OFF_T not defined" #endif #if (SIZEOF_SIZE_T == SIZEOF_SHORT) # define CURL_MASK_SSIZE_T CURL_MASK_SSHORT # define CURL_MASK_USIZE_T CURL_MASK_USHORT #elif (SIZEOF_SIZE_T == SIZEOF_INT) # define CURL_MASK_SSIZE_T CURL_MASK_SINT # define CURL_MASK_USIZE_T CURL_MASK_UINT #elif (SIZEOF_SIZE_T == CURL_SIZEOF_LONG) # define CURL_MASK_SSIZE_T CURL_MASK_SLONG # define CURL_MASK_USIZE_T CURL_MASK_ULONG #elif (SIZEOF_SIZE_T == CURL_SIZEOF_CURL_OFF_T) # define CURL_MASK_SSIZE_T CURL_MASK_SCOFFT # define CURL_MASK_USIZE_T CURL_MASK_UCOFFT #else # error "SIZEOF_SIZE_T not defined" #endif /* Loading Loading @@ -179,3 +211,21 @@ unsigned short curlx_sltous(long slnum) # pragma warning(pop) #endif } /* ** unsigned size_t to signed ssize_t */ ssize_t curlx_uztosz(size_t uznum) { #ifdef __INTEL_COMPILER # pragma warning(push) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T); #ifdef __INTEL_COMPILER # pragma warning(pop) #endif }
lib/warnless.h +2 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,6 @@ unsigned int curlx_sltoui(long slnum); unsigned short curlx_sltous(long slnum); ssize_t curlx_uztosz(size_t uznum); #endif /* HEADER_CURL_WARNLESS_H */
tests/server/rtspd.c +1 −1 Original line number Diff line number Diff line Loading @@ -798,7 +798,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req) while(!done_processing && (req->offset < REQBUFSIZ-1)) { if(pipereq_length && pipereq) { memmove(reqbuf, pipereq, pipereq_length); got = pipereq_length; got = curlx_uztosz(pipereq_length); pipereq_length = 0; } else { Loading
tests/server/sws.c +1 −1 Original line number Diff line number Diff line Loading @@ -762,7 +762,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req) while(!done_processing && (req->offset < REQBUFSIZ-1)) { if(pipereq_length && pipereq) { memmove(reqbuf, pipereq, pipereq_length); got = pipereq_length; got = curlx_uztosz(pipereq_length); pipereq_length = 0; } else { Loading