system.h: remove some macros

Since curl_off_t is always 64 bit these days, we can simplify and avoid
using some macros.

Closes #17498
This commit is contained in:
Daniel Stenberg 2025-05-31 18:47:23 +02:00
parent 68c02e6ab7
commit 614313f12f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
14 changed files with 149 additions and 213 deletions

View file

@ -46,9 +46,9 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
TCHAR *tchar_filename = curlx_convert_UTF8_to_tchar(filename);
hfile = CreateFile(tchar_filename, FILE_READ_ATTRIBUTES,
(FILE_SHARE_READ | FILE_SHARE_WRITE |
FILE_SHARE_DELETE),
NULL, OPEN_EXISTING, 0, NULL);
(FILE_SHARE_READ | FILE_SHARE_WRITE |
FILE_SHARE_DELETE),
NULL, OPEN_EXISTING, 0, NULL);
curlx_unicodefree(tchar_filename);
if(hfile != INVALID_HANDLE_VALUE) {
FILETIME ft;
@ -56,10 +56,10 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
curl_off_t converted = (curl_off_t)ft.dwLowDateTime
| ((curl_off_t)ft.dwHighDateTime) << 32;
if(converted < CURL_OFF_T_C(116444736000000000))
if(converted < 116444736000000000)
warnf(global, "Failed to get filetime: underflow");
else {
*stamp = (converted - CURL_OFF_T_C(116444736000000000)) / 10000000;
*stamp = (converted - 116444736000000000) / 10000000;
rc = 0;
}
}
@ -101,7 +101,7 @@ void setfiletime(curl_off_t filetime, const char *filename,
/* 910670515199 is the maximum Unix filetime that can be used as a
Windows FILETIME without overflow: 30827-12-31T23:59:59. */
if(filetime > CURL_OFF_T_C(910670515199)) {
if(filetime > 910670515199) {
warnf(global, "Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on outfile: overflow", filetime);
curlx_unicodefree(tchar_filename);
@ -115,7 +115,7 @@ void setfiletime(curl_off_t filetime, const char *filename,
curlx_unicodefree(tchar_filename);
if(hfile != INVALID_HANDLE_VALUE) {
curl_off_t converted = ((curl_off_t)filetime * 10000000) +
CURL_OFF_T_C(116444736000000000);
116444736000000000;
FILETIME ft;
ft.dwLowDateTime = (DWORD)(converted & 0xFFFFFFFF);
ft.dwHighDateTime = (DWORD)(converted >> 32);