curl_setup: use SIZE_MAX instead of SIZE_T_MAX
No binary (build failed)
—
(log yok)
| @@ -541,7 +541,7 @@ static ssize_t on_session_send(nghttp2_session *h2, | |
| if(!nwritten) | |
| return NGHTTP2_ERR_WOULDBLOCK; | |
| - | return (nwritten > SSIZE_T_MAX) ? |
| + | return (nwritten > SSIZE_MAX) ? |
| NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nwritten; | |
| } | |
| @@ -817,7 +817,7 @@ static ssize_t tunnel_send_callback(nghttp2_session *session, | |
| CURL_TRC_CF(data, cf, "[%d] tunnel_send_callback -> %zd", | |
| ts->stream_id, nread); | |
| - | return (nread > SSIZE_T_MAX) ? |
| + | return (nread > SSIZE_MAX) ? |
| NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nread; | |
| } | |
| @@ -399,7 +399,7 @@ CURLcode Curl_ntlm_core_mk_nt_hash(const char *password, | |
| size_t len = strlen(password); | |
| unsigned char *pw; | |
| CURLcode result; | |
| - | if(len > SIZE_T_MAX/2) /* avoid integer overflow */ |
| + | if(len > SIZE_MAX/2) /* avoid integer overflow */ |
| return CURLE_OUT_OF_MEMORY; | |
| pw = len ? malloc(len * 2) : (unsigned char *)strdup(""); | |
| if(!pw) | |
| @@ -618,21 +618,21 @@ | |
| # endif | |
| #endif | |
| - | #ifndef SIZE_T_MAX |
| + | #ifndef SIZE_MAX |
| /* some limits.h headers have this defined, some do not */ | |
| #if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4) | |
| - | #define SIZE_T_MAX 18446744073709551615U |
| + | #define SIZE_MAX 18446744073709551615U |
| #else | |
| - | #define SIZE_T_MAX 4294967295U |
| + | #define SIZE_MAX 4294967295U |
| #endif | |
| #endif | |
| - | #ifndef SSIZE_T_MAX |
| + | #ifndef SSIZE_MAX |
| /* some limits.h headers have this defined, some do not */ | |
| #if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4) | |
| - | #define SSIZE_T_MAX 9223372036854775807 |
| + | #define SSIZE_MAX 9223372036854775807 |
| #else | |
| - | #define SSIZE_T_MAX 2147483647 |
| + | #define SSIZE_MAX 2147483647 |
| #endif | |
| #endif | |
| @@ -62,7 +62,7 @@ int curlx_dyn_vprintf(struct dynbuf *dyn, const char *format, va_list ap_save); | |
| char *curlx_dyn_take(struct dynbuf *s, size_t *plen); | |
| /* Dynamic buffer max sizes */ | |
| - | #define MAX_DYNBUF_SIZE (SIZE_T_MAX/2) |
| + | #define MAX_DYNBUF_SIZE (SIZE_MAX/2) |
| #define DYN_DOH_RESPONSE 3000 | |
| #define DYN_DOH_CNAME 256 | |
| @@ -165,7 +165,7 @@ static int str_num_base(const char **linep, curl_off_t *nump, curl_off_t max, | |
| (base == 16) ? 'f' : '7'; | |
| DEBUGASSERT(linep && *linep && nump); | |
| DEBUGASSERT((base == 8) || (base == 10) || (base == 16)); | |
| - | DEBUGASSERT(max >= 0); /* mostly to catch SIZE_T_MAX, which is too large */ |
| + | DEBUGASSERT(max >= 0); /* mostly to catch SIZE_MAX, which is too large */ |
| *nump = 0; | |
| p = *linep; | |
| if(!valid_digit(*p, m)) | |
| @@ -98,7 +98,7 @@ unsigned long curlx_uztoul(size_t uznum) | |
| # pragma warning(disable:810) /* conversion may lose significant bits */ | |
| #endif | |
| - | #if ULONG_MAX < SIZE_T_MAX |
| + | #if ULONG_MAX < SIZE_MAX |
| DEBUGASSERT(uznum <= (size_t) CURL_MASK_ULONG); | |
| #endif | |
| return (unsigned long)(uznum & (size_t) CURL_MASK_ULONG); | |
| @@ -119,7 +119,7 @@ unsigned int curlx_uztoui(size_t uznum) | |
| # pragma warning(disable:810) /* conversion may lose significant bits */ | |
| #endif | |
| - | #if UINT_MAX < SIZE_T_MAX |
| + | #if UINT_MAX < SIZE_MAX |
| DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT); | |
| #endif | |
| return (unsigned int)(uznum & (size_t) CURL_MASK_UINT); | |
| @@ -243,7 +243,7 @@ int curlx_sztosi(ssize_t sznum) | |
| #endif | |
| DEBUGASSERT(sznum >= 0); | |
| - | #if INT_MAX < SSIZE_T_MAX |
| + | #if INT_MAX < SSIZE_MAX |
| DEBUGASSERT((size_t) sznum <= (size_t) CURL_MASK_SINT); | |
| #endif | |
| return (int)(sznum & (ssize_t) CURL_MASK_SINT); | |
| @@ -799,7 +799,7 @@ static ssize_t send_callback(nghttp2_session *h2, | |
| ctx->nw_out_blocked = 1; | |
| return NGHTTP2_ERR_WOULDBLOCK; | |
| } | |
| - | return (nwritten > SSIZE_T_MAX) ? |
| + | return (nwritten > SSIZE_MAX) ? |
| NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nwritten; | |
| } | |
| @@ -218,15 +218,15 @@ static size_t get_max_body_write_len(struct Curl_easy *data, curl_off_t limit) | |
| return 0; | |
| } | |
| #if SIZEOF_CURL_OFF_T > SIZEOF_SIZE_T | |
| - | else if(remain_diff > SSIZE_T_MAX) { |
| - | return SIZE_T_MAX; |
| + | else if(remain_diff > SSIZE_MAX) { |
| + | return SIZE_MAX; |
| } | |
| #endif | |
| else { | |
| return (size_t)remain_diff; | |
| } | |
| } | |
| - | return SIZE_T_MAX; |
| + | return SIZE_MAX; |
| } | |
| struct cw_download_ctx { | |
| @@ -1683,7 +1683,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option, | |
| /* | |
| * Check that requested length does not overflow the size_t type. | |
| */ | |
| - | else if(s->postfieldsize > SIZE_T_MAX) |
| + | else if(s->postfieldsize > SIZE_MAX) |
| return CURLE_OUT_OF_MEMORY; | |
| #endif | |
| else { | |
| @@ -71,7 +71,7 @@ wchar_t *Curl_wcsdup(const wchar_t *src) | |
| { | |
| size_t length = wcslen(src); | |
| - | if(length > (SIZE_T_MAX / sizeof(wchar_t)) - 1) |
| + | if(length > (SIZE_MAX / sizeof(wchar_t)) - 1) |
| return (wchar_t *)NULL; /* integer overflow */ | |
| return (wchar_t *)Curl_memdup(src, (length + 1) * sizeof(wchar_t)); | |
| @@ -74,8 +74,8 @@ CURLcode Curl_auth_create_plain_message(const char *authzid, | |
| plen = strlen(passwd); | |
| /* Compute binary message length. Check for overflows. */ | |
| - | if((zlen > SIZE_T_MAX/4) || (clen > SIZE_T_MAX/4) || |
| - | (plen > (SIZE_T_MAX/2 - 2))) |
| + | if((zlen > SIZE_MAX/4) || (clen > SIZE_MAX/4) || |
| + | (plen > (SIZE_MAX/2 - 2))) |
| return CURLE_OUT_OF_MEMORY; | |
| plainlen = zlen + clen + plen + 2; | |
| @@ -426,7 +426,7 @@ CURLcode Curl_gtls_shared_creds_create(struct Curl_easy *data, | |
| CURLcode Curl_gtls_shared_creds_up_ref(struct gtls_shared_creds *creds) | |
| { | |
| DEBUGASSERT(creds); | |
| - | if(creds->refcount < SIZE_T_MAX) { |
| + | if(creds->refcount < SIZE_MAX) { |
| ++creds->refcount; | |
| return CURLE_OK; | |
| } | |
| @@ -130,7 +130,7 @@ static CURLcode glob_set(struct URLGlob *glob, const char **patternp, | |
| if(pat->c.set.elem) { | |
| char **arr; | |
| - | if(pat->c.set.size >= (curl_off_t)(SIZE_T_MAX/(sizeof(char *)))) |
| + | if(pat->c.set.size >= (curl_off_t)(SIZE_MAX/(sizeof(char *)))) |
| return globerror(glob, "range overflow", 0, CURLE_URL_MALFORMAT); | |
| arr = realloc(pat->c.set.elem, (size_t)(pat->c.set.size + 1) * | |