diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-02-24 00:45:16 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-02-24 17:05:33 +0100 |
commit | 835682661c7a36b0e860c978204e8cd9b033be45 (patch) | |
tree | 606e64e9bc9d563abafe4b20f47d63ed23b6f5ea /src | |
parent | 9672cc640ce7e38b5abcd69a5b80bd972bc0aff3 (diff) | |
download | curl-835682661c7a36b0e860c978204e8cd9b033be45.tar.gz |
misc: remove support for curl_off_t < 8 bytes
Closes #10597
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_cb_prg.c | 4 | ||||
-rw-r--r-- | src/tool_filetime.c | 11 | ||||
-rw-r--r-- | src/tool_progress.c | 14 |
3 files changed, 9 insertions, 20 deletions
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c index 78528eb87..9b856f4cc 100644 --- a/src/tool_cb_prg.c +++ b/src/tool_cb_prg.c @@ -116,8 +116,8 @@ static void fly(struct ProgressData *bar, bool moved) #define MAX_BARLENGTH 256 -#if (SIZEOF_CURL_OFF_T == 4) -# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF) +#if (SIZEOF_CURL_OFF_T < 8) +#error "too small curl_off_t" #else /* assume SIZEOF_CURL_OFF_T == 8 */ # define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF) diff --git a/src/tool_filetime.c b/src/tool_filetime.c index 374599907..937775cb8 100644 --- a/src/tool_filetime.c +++ b/src/tool_filetime.c @@ -39,7 +39,7 @@ curl_off_t getfiletime(const char *filename, struct GlobalConfig *global) /* Windows stat() may attempt to adjust the unix GMT file time by a daylight saving time offset and since it's GMT that is bad behavior. When we have access to a 64-bit type we can bypass stat and get the times directly. */ -#if defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8) +#if defined(WIN32) HANDLE hfile; TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename); @@ -85,8 +85,7 @@ curl_off_t getfiletime(const char *filename, struct GlobalConfig *global) return result; } -#if defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \ - (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) +#if defined(HAVE_UTIME) || defined(HAVE_UTIMES) || defined(WIN32) void setfiletime(curl_off_t filetime, const char *filename, struct GlobalConfig *global) { @@ -94,7 +93,7 @@ void setfiletime(curl_off_t filetime, const char *filename, /* Windows utime() may attempt to adjust the unix GMT file time by a daylight saving time offset and since it's GMT that is bad behavior. When we have access to a 64-bit type we can bypass utime and set the times directly. */ -#if defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8) +#if defined(WIN32) HANDLE hfile; TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar((char *)filename); @@ -151,5 +150,5 @@ void setfiletime(curl_off_t filetime, const char *filename, #endif } } -#endif /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \ - (defined(WIN32) && (SIZEOF_CURL_OFF_T >= 8)) */ +#endif /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) || \ + defined(WIN32) */ diff --git a/src/tool_progress.c b/src/tool_progress.c index f0dd481a1..28edafe1e 100644 --- a/src/tool_progress.c +++ b/src/tool_progress.c @@ -53,8 +53,6 @@ static char *max5data(curl_off_t bytes, char *max5) CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE, (bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) ); -#if (SIZEOF_CURL_OFF_T > 4) - else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE) /* 'XXXXM' is good until we're at 10000MB or above */ msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE); @@ -77,16 +75,8 @@ static char *max5data(curl_off_t bytes, char *max5) /* up to 10000PB, display without decimal: XXXXP */ msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "P", bytes/ONE_PETABYTE); - /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number - can hold, but our data type is signed so 8192PB will be the maximum. */ - -#else - - else - msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE); - -#endif - + /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number can + hold, but our data type is signed so 8192PB will be the maximum. */ return max5; } |