windows: drop redundant USE_WIN32_SMALL_FILES macro

In effect it meant `_WIN32 && !USE_WIN32_LARGE_FILES`.
Replace it with these macros.

Also:
- configure: delete tautological check for small file support.
- configure: delete stray `_MSC_VER` reference. autotools does not
  support MSVC.
- drop tautological checks for WinCE in `config-win32*.h` when setting
  `USE_WIN32_LARGE_FILES`.
- merge related PP logic.
- prefer `#ifdef`, fix whitespace.

Suggested-by: Marcel Raad
Report: https://github.com/curl/curl/pull/15952#issuecomment-2580092328

Closes #15968
This commit is contained in:
Viktor Szakats 2025-01-11 03:22:10 +01:00
parent b9840814ad
commit 7eb4ddb850
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 14 additions and 46 deletions

View file

@ -387,22 +387,13 @@ Vista
/* LARGE FILE SUPPORT */
/* ---------------------------------------------------------------- */
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
#if defined(_MSC_VER) || defined(__MINGW32__)
# define USE_WIN32_LARGE_FILES
#endif
#if defined(__MINGW32__) && !defined(USE_WIN32_LARGE_FILES)
# define USE_WIN32_LARGE_FILES
#endif
#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES)
# define USE_WIN32_SMALL_FILES
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#if defined(USE_WIN32_LARGE_FILES) && defined(__MINGW32__)
# ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
# ifdef __MINGW32__
# ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
# endif
# endif
#endif

View file

@ -232,13 +232,7 @@
/* LARGE FILE SUPPORT */
/* ---------------------------------------------------------------- */
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
# define USE_WIN32_LARGE_FILES
#endif
#if !defined(USE_WIN32_LARGE_FILES) && !defined(USE_WIN32_SMALL_FILES)
# define USE_WIN32_SMALL_FILES
#endif
/* Windows CE does not support large files */
/* ---------------------------------------------------------------- */
/* LDAP SUPPORT */

View file

@ -32,7 +32,7 @@
#include "curl_setup.h"
#if defined(_WIN32)
#ifdef _WIN32
#include "curl_multibyte.h"
@ -84,10 +84,6 @@ char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w)
return str_utf8;
}
#endif /* _WIN32 */
#if defined(USE_WIN32_LARGE_FILES) || defined(USE_WIN32_SMALL_FILES)
/* declare GetFullPathNameW for mingw-w64 UWP builds targeting old windows */
#if defined(CURL_WINDOWS_UWP) && defined(__MINGW32__) && \
(_WIN32_WINNT < _WIN32_WINNT_WIN10)
@ -329,7 +325,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer)
target = fixed;
else
target = path_w;
#if defined(USE_WIN32_SMALL_FILES)
#ifndef USE_WIN32_LARGE_FILES
result = _wstat(target, buffer);
#else
result = _wstati64(target, buffer);
@ -343,7 +339,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer)
target = fixed;
else
target = path;
#if defined(USE_WIN32_SMALL_FILES)
#ifndef USE_WIN32_LARGE_FILES
result = _stat(target, buffer);
#else
result = _stati64(target, buffer);
@ -354,4 +350,4 @@ int curlx_win32_stat(const char *path, struct_stat *buffer)
return result;
}
#endif /* USE_WIN32_LARGE_FILES || USE_WIN32_SMALL_FILES */
#endif /* _WIN32 */

View file

@ -497,7 +497,7 @@
* Small file (<2Gb) support using Win32 functions.
*/
#ifdef USE_WIN32_SMALL_FILES
#if defined(_WIN32) && !defined(USE_WIN32_LARGE_FILES)
# include <io.h>
# include <sys/types.h>
# include <sys/stat.h>