mirror of
https://github.com/curl/curl.git
synced 2026-08-25 06:03:32 +03:00
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:
parent
68c02e6ab7
commit
614313f12f
14 changed files with 149 additions and 213 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue