Loading lib/ftp.c +6 −8 Original line number Original line Diff line number Diff line Loading @@ -1366,18 +1366,16 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn, else { else { curl_off_t passed=0; curl_off_t passed=0; do { do { curl_off_t readthisamountnow = (data->state.resume_from - passed); size_t readthisamountnow = curl_off_t actuallyread; (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? BUFSIZE : curlx_sotouz(data->state.resume_from - passed); if(readthisamountnow > BUFSIZE) size_t actuallyread = readthisamountnow = BUFSIZE; conn->fread_func(data->state.buffer, 1, readthisamountnow, actuallyread = (curl_off_t) conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow, conn->fread_in); conn->fread_in); passed += actuallyread; passed += actuallyread; if((actuallyread <= 0) || (actuallyread > readthisamountnow)) { if((actuallyread == 0) || (actuallyread > readthisamountnow)) { /* this checks for greater-than only to make sure that the /* this checks for greater-than only to make sure that the CURL_READFUNC_ABORT return code still aborts */ CURL_READFUNC_ABORT return code still aborts */ failf(data, "Failed to read data"); failf(data, "Failed to read data"); Loading lib/http.c +11 −12 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ #include "rawstr.h" #include "rawstr.h" #include "content_encoding.h" #include "content_encoding.h" #include "rtsp.h" #include "rtsp.h" #include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> #include <curl/mprintf.h> Loading Loading @@ -2424,27 +2425,25 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ else { else { curl_off_t passed=0; curl_off_t passed=0; do { do { size_t readthisamountnow = (size_t)(data->state.resume_from - size_t readthisamountnow = passed); (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? size_t actuallyread; BUFSIZE : curlx_sotouz(data->state.resume_from - passed); if(readthisamountnow > BUFSIZE) readthisamountnow = BUFSIZE; actuallyread = data->set.fread_func(data->state.buffer, 1, size_t actuallyread = (size_t)readthisamountnow, data->set.fread_func(data->state.buffer, 1, readthisamountnow, data->set.in); data->set.in); passed += actuallyread; passed += actuallyread; if(actuallyread != readthisamountnow) { if((actuallyread == 0) || (actuallyread > readthisamountnow)) { /* this checks for greater-than only to make sure that the CURL_READFUNC_ABORT return code still aborts */ failf(data, "Could only read %" FORMAT_OFF_T failf(data, "Could only read %" FORMAT_OFF_T " bytes from the input", " bytes from the input", passed); passed); return CURLE_READ_ERROR; return CURLE_READ_ERROR; } } } while(passed != data->state.resume_from); /* loop until done */ } while(passed < data->state.resume_from); } } } } Loading lib/ssh.c +8 −11 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,7 @@ #include "strtoofft.h" #include "strtoofft.h" #include "multiif.h" #include "multiif.h" #include "select.h" #include "select.h" #include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> #include <curl/mprintf.h> Loading Loading @@ -1541,21 +1542,17 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ else { else { curl_off_t passed=0; curl_off_t passed=0; curl_off_t readthisamountnow; curl_off_t actuallyread; do { do { readthisamountnow = (data->state.resume_from - passed); size_t readthisamountnow = (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? BUFSIZE : curlx_sotouz(data->state.resume_from - passed); if(readthisamountnow > BUFSIZE) size_t actuallyread = readthisamountnow = BUFSIZE; conn->fread_func(data->state.buffer, 1, readthisamountnow, actuallyread = (curl_off_t) conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow, conn->fread_in); conn->fread_in); passed += actuallyread; passed += actuallyread; if((actuallyread <= 0) || (actuallyread > readthisamountnow)) { if((actuallyread == 0) || (actuallyread > readthisamountnow)) { /* this checks for greater-than only to make sure that the /* this checks for greater-than only to make sure that the CURL_READFUNC_ABORT return code still aborts */ CURL_READFUNC_ABORT return code still aborts */ failf(data, "Failed to read data"); failf(data, "Failed to read data"); Loading lib/warnless.c +23 −1 Original line number Original line Diff line number Diff line Loading @@ -141,7 +141,7 @@ unsigned char curlx_ultouc(unsigned long ulnum) } } /* /* ** size_t to signed int ** unsigned size_t to signed int */ */ int curlx_uztosi(size_t uznum) int curlx_uztosi(size_t uznum) Loading Loading @@ -169,6 +169,7 @@ int curlx_sltosi(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ # pragma warning(disable:810) /* conversion may lose significant bits */ #endif #endif DEBUGASSERT(slnum >= 0); return (int)(slnum & (long) CURL_MASK_SINT); return (int)(slnum & (long) CURL_MASK_SINT); #ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER Loading @@ -187,6 +188,7 @@ unsigned int curlx_sltoui(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ # pragma warning(disable:810) /* conversion may lose significant bits */ #endif #endif DEBUGASSERT(slnum >= 0); return (unsigned int)(slnum & (long) CURL_MASK_UINT); return (unsigned int)(slnum & (long) CURL_MASK_UINT); #ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER Loading @@ -205,6 +207,7 @@ unsigned short curlx_sltous(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ # pragma warning(disable:810) /* conversion may lose significant bits */ #endif #endif DEBUGASSERT(slnum >= 0); return (unsigned short)(slnum & (long) CURL_MASK_USHORT); return (unsigned short)(slnum & (long) CURL_MASK_USHORT); #ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER Loading @@ -229,3 +232,22 @@ ssize_t curlx_uztosz(size_t uznum) # pragma warning(pop) # pragma warning(pop) #endif #endif } } /* ** signed curl_off_t to unsigned size_t */ size_t curlx_sotouz(curl_off_t sonum) { #ifdef __INTEL_COMPILER # pragma warning(push) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif DEBUGASSERT(sonum >= 0); return (size_t)(sonum & (curl_off_t) CURL_MASK_USIZE_T); #ifdef __INTEL_COMPILER # pragma warning(pop) #endif } lib/warnless.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -36,4 +36,6 @@ unsigned short curlx_sltous(long slnum); ssize_t curlx_uztosz(size_t uznum); ssize_t curlx_uztosz(size_t uznum); size_t curlx_sotouz(curl_off_t sonum); #endif /* HEADER_CURL_WARNLESS_H */ #endif /* HEADER_CURL_WARNLESS_H */ Loading
lib/ftp.c +6 −8 Original line number Original line Diff line number Diff line Loading @@ -1366,18 +1366,16 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn, else { else { curl_off_t passed=0; curl_off_t passed=0; do { do { curl_off_t readthisamountnow = (data->state.resume_from - passed); size_t readthisamountnow = curl_off_t actuallyread; (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? BUFSIZE : curlx_sotouz(data->state.resume_from - passed); if(readthisamountnow > BUFSIZE) size_t actuallyread = readthisamountnow = BUFSIZE; conn->fread_func(data->state.buffer, 1, readthisamountnow, actuallyread = (curl_off_t) conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow, conn->fread_in); conn->fread_in); passed += actuallyread; passed += actuallyread; if((actuallyread <= 0) || (actuallyread > readthisamountnow)) { if((actuallyread == 0) || (actuallyread > readthisamountnow)) { /* this checks for greater-than only to make sure that the /* this checks for greater-than only to make sure that the CURL_READFUNC_ABORT return code still aborts */ CURL_READFUNC_ABORT return code still aborts */ failf(data, "Failed to read data"); failf(data, "Failed to read data"); Loading
lib/http.c +11 −12 Original line number Original line Diff line number Diff line Loading @@ -98,6 +98,7 @@ #include "rawstr.h" #include "rawstr.h" #include "content_encoding.h" #include "content_encoding.h" #include "rtsp.h" #include "rtsp.h" #include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> #include <curl/mprintf.h> Loading Loading @@ -2424,27 +2425,25 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ else { else { curl_off_t passed=0; curl_off_t passed=0; do { do { size_t readthisamountnow = (size_t)(data->state.resume_from - size_t readthisamountnow = passed); (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? size_t actuallyread; BUFSIZE : curlx_sotouz(data->state.resume_from - passed); if(readthisamountnow > BUFSIZE) readthisamountnow = BUFSIZE; actuallyread = data->set.fread_func(data->state.buffer, 1, size_t actuallyread = (size_t)readthisamountnow, data->set.fread_func(data->state.buffer, 1, readthisamountnow, data->set.in); data->set.in); passed += actuallyread; passed += actuallyread; if(actuallyread != readthisamountnow) { if((actuallyread == 0) || (actuallyread > readthisamountnow)) { /* this checks for greater-than only to make sure that the CURL_READFUNC_ABORT return code still aborts */ failf(data, "Could only read %" FORMAT_OFF_T failf(data, "Could only read %" FORMAT_OFF_T " bytes from the input", " bytes from the input", passed); passed); return CURLE_READ_ERROR; return CURLE_READ_ERROR; } } } while(passed != data->state.resume_from); /* loop until done */ } while(passed < data->state.resume_from); } } } } Loading
lib/ssh.c +8 −11 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,7 @@ #include "strtoofft.h" #include "strtoofft.h" #include "multiif.h" #include "multiif.h" #include "select.h" #include "select.h" #include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> #include <curl/mprintf.h> Loading Loading @@ -1541,21 +1542,17 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ else { else { curl_off_t passed=0; curl_off_t passed=0; curl_off_t readthisamountnow; curl_off_t actuallyread; do { do { readthisamountnow = (data->state.resume_from - passed); size_t readthisamountnow = (data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ? BUFSIZE : curlx_sotouz(data->state.resume_from - passed); if(readthisamountnow > BUFSIZE) size_t actuallyread = readthisamountnow = BUFSIZE; conn->fread_func(data->state.buffer, 1, readthisamountnow, actuallyread = (curl_off_t) conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow, conn->fread_in); conn->fread_in); passed += actuallyread; passed += actuallyread; if((actuallyread <= 0) || (actuallyread > readthisamountnow)) { if((actuallyread == 0) || (actuallyread > readthisamountnow)) { /* this checks for greater-than only to make sure that the /* this checks for greater-than only to make sure that the CURL_READFUNC_ABORT return code still aborts */ CURL_READFUNC_ABORT return code still aborts */ failf(data, "Failed to read data"); failf(data, "Failed to read data"); Loading
lib/warnless.c +23 −1 Original line number Original line Diff line number Diff line Loading @@ -141,7 +141,7 @@ unsigned char curlx_ultouc(unsigned long ulnum) } } /* /* ** size_t to signed int ** unsigned size_t to signed int */ */ int curlx_uztosi(size_t uznum) int curlx_uztosi(size_t uznum) Loading Loading @@ -169,6 +169,7 @@ int curlx_sltosi(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ # pragma warning(disable:810) /* conversion may lose significant bits */ #endif #endif DEBUGASSERT(slnum >= 0); return (int)(slnum & (long) CURL_MASK_SINT); return (int)(slnum & (long) CURL_MASK_SINT); #ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER Loading @@ -187,6 +188,7 @@ unsigned int curlx_sltoui(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ # pragma warning(disable:810) /* conversion may lose significant bits */ #endif #endif DEBUGASSERT(slnum >= 0); return (unsigned int)(slnum & (long) CURL_MASK_UINT); return (unsigned int)(slnum & (long) CURL_MASK_UINT); #ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER Loading @@ -205,6 +207,7 @@ unsigned short curlx_sltous(long slnum) # pragma warning(disable:810) /* conversion may lose significant bits */ # pragma warning(disable:810) /* conversion may lose significant bits */ #endif #endif DEBUGASSERT(slnum >= 0); return (unsigned short)(slnum & (long) CURL_MASK_USHORT); return (unsigned short)(slnum & (long) CURL_MASK_USHORT); #ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER Loading @@ -229,3 +232,22 @@ ssize_t curlx_uztosz(size_t uznum) # pragma warning(pop) # pragma warning(pop) #endif #endif } } /* ** signed curl_off_t to unsigned size_t */ size_t curlx_sotouz(curl_off_t sonum) { #ifdef __INTEL_COMPILER # pragma warning(push) # pragma warning(disable:810) /* conversion may lose significant bits */ #endif DEBUGASSERT(sonum >= 0); return (size_t)(sonum & (curl_off_t) CURL_MASK_USIZE_T); #ifdef __INTEL_COMPILER # pragma warning(pop) #endif }
lib/warnless.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -36,4 +36,6 @@ unsigned short curlx_sltous(long slnum); ssize_t curlx_uztosz(size_t uznum); ssize_t curlx_uztosz(size_t uznum); size_t curlx_sotouz(curl_off_t sonum); #endif /* HEADER_CURL_WARNLESS_H */ #endif /* HEADER_CURL_WARNLESS_H */