]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
windows: drop redundant `USE_WIN32_SMALL_FILES` macro
authorViktor Szakats <commit@vsz.me>
Sat, 11 Jan 2025 02:22:10 +0000 (03:22 +0100)
committerViktor Szakats <commit@vsz.me>
Sat, 11 Jan 2025 23:34:21 +0000 (00:34 +0100)
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

acinclude.m4
lib/config-win32.h
lib/config-win32ce.h
lib/curl_multibyte.c
lib/curl_setup.h
src/tool_cb_see.c

index 4081c009a9793ba6cb72db27d25f39472cd2ed88..60303be519b089d9de74d2ccc14bc67b4273da1f 100644 (file)
@@ -1385,7 +1385,7 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
       AC_COMPILE_IFELSE([
         AC_LANG_PROGRAM([[
         ]],[[
-          #if !defined(_WIN32_WCE) && (defined(__MINGW32__) || defined(_MSC_VER))
+          #if !defined(_WIN32_WCE) && defined(__MINGW32__)
             int dummy=1;
           #else
             #error Win32 large file API not supported.
@@ -1396,18 +1396,7 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
       ])
     fi
     if test "$curl_win32_file_api" = "no"; then
-      AC_COMPILE_IFELSE([
-        AC_LANG_PROGRAM([[
-        ]],[[
-          #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
-            int dummy=1;
-          #else
-            #error Win32 small file API not supported.
-          #endif
-        ]])
-      ],[
-        curl_win32_file_api="win32_small_files"
-      ])
+      curl_win32_file_api="win32_small_files"
     fi
   fi
   case "$curl_win32_file_api" in
@@ -1418,8 +1407,6 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
       ;;
     win32_small_files)
       AC_MSG_RESULT([yes (large file disabled)])
-      AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
-        [Define to 1 if you are building a Windows target without large file support.])
       ;;
     *)
       AC_MSG_RESULT([no])
index 028acf4482ca0ae1e434141de86aa96748d3d9ce..81dd46cf151e517f4f2cb7e1d36b0b4a4264b8d2 100644 (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
 
index fece5e92647c54355d59a01bd36a115f383800e3..b01c2187f2e0ea8a4e59f160273b9d387bd89a54 100644 (file)
 /*                        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                           */
index a5ec7c9bd29d6df2937f22b84cd7deebe6b10332..9102c972bcbd2c5deb4224aa42322238ec8248ef 100644 (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 */
index 9b0b14bda6c1c1fd5eaf904484bc0b7192259ad7..582a50f69076a3ab3322c72d2f5ff621e74b988a 100644 (file)
  * 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>
index 99d3197eae9deacd301d5759f49b9900f89ff8ee..c86ea7fb17ea15c8e35136b153d30fa6b12bc3ba 100644 (file)
@@ -49,7 +49,7 @@ int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
 {
   struct per_transfer *per = userdata;
 
-#if(SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(USE_WIN32_LARGE_FILES)
+#if (SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(USE_WIN32_LARGE_FILES)
 
   /* The offset check following here is only interesting if curl_off_t is
      larger than off_t and we are not using the Win32 large file support