From: Evgeny Grin Date: Sat, 10 Feb 2024 18:28:27 +0000 (+0100) Subject: curl_setup.h: add curl_uint64_t internal type X-Git-Tag: curl-8_7_0~160 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30a3880f6b57bf1a597b66de6191548f2725a7ee;p=thirdparty%2Fcurl.git curl_setup.h: add curl_uint64_t internal type The unsigned version of curl_off_t basically --- diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 703e903fa8..644a8e2742 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -266,6 +266,13 @@ #include +/* Helper macro to expand and concatenate two macros. + * Direct macros concatenation does not work because macros + * are not expanded before direct concatenation. + */ +#define CURL_CONC_MACROS_(A,B) A ## B +#define CURL_CONC_MACROS(A,B) CURL_CONC_MACROS_(A,B) + /* curl uses its own printf() function internally. It understands the GNU * format. Use this format, so that is matches the GNU format attribute we * use with the mingw compiler, allowing it to verify them at compile-time. @@ -495,6 +502,18 @@ #endif #define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1)) +#if (SIZEOF_CURL_OFF_T != 8) +# error "curl_off_t must be exactly 64 bits" +#else + typedef unsigned CURL_TYPEOF_CURL_OFF_T curl_uint64_t; +# ifndef CURL_SUFFIX_CURL_OFF_TU +# error "CURL_SUFFIX_CURL_OFF_TU must be defined" +# endif +# define CURL_UINT64_SUFFIX CURL_SUFFIX_CURL_OFF_TU +# define CURL_UINT64_C(val) CURL_CONC_MACROS(val,CURL_UINT64_SUFFIX) +# define CURL_UINT64_CAST(expr) ((curl_uint64_t)(expr)) +#endif + #if (SIZEOF_TIME_T == 4) # ifdef HAVE_TIME_T_UNSIGNED # define TIME_T_MAX UINT_MAX