windows: assume USE_WIN32_LARGE_FILES

All Windows platforms support it. It was permanently enabled with most
build methods. The exception is autotools where it is enabled by
default, with an option to disable it. It changed the build in a few
places for rarely tested code paths, but not bringing other advantages
(and used some 64-bit APIs anyway). This patch makes autotools'
`--disable-largefile` option a no-op for Windows.

Closes #19888
This commit is contained in:
Viktor Szakats 2025-12-09 10:31:20 +01:00
parent 073b85cefe
commit 163705db75
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
9 changed files with 15 additions and 72 deletions

View file

@ -318,19 +318,14 @@
/* LARGE FILE SUPPORT */
/* ---------------------------------------------------------------- */
#if defined(_MSC_VER) || defined(__MINGW32__)
# define USE_WIN32_LARGE_FILES
/* Number of bits in a file offset, on hosts where this is settable. */
# ifdef __MINGW32__
# ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
# endif
# endif
#ifdef __MINGW32__
# undef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
#endif
/* Define to the size of `off_t', as computed by sizeof. */
#if defined(__MINGW32__) && \
defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
#ifdef __MINGW32__
# define SIZEOF_OFF_T 8
#else
# define SIZEOF_OFF_T 4

View file

@ -761,9 +761,6 @@ ${SIZEOF_TIME_T_CODE}
/* if Unix domain sockets are enabled */
#cmakedefine USE_UNIX_SOCKETS 1
/* Define to 1 if you are building a Windows target with large file support. */
#cmakedefine USE_WIN32_LARGE_FILES 1
/* to enable SSPI support */
#cmakedefine USE_WINDOWS_SSPI 1

View file

@ -471,22 +471,13 @@
# endif
# include <sys/types.h>
# include <sys/stat.h>
# ifdef USE_WIN32_LARGE_FILES
/* Large file (>2Gb) support using Win32 functions. */
# undef lseek
# define lseek(fdes, offset, whence) _lseeki64(fdes, offset, whence)
# undef fstat
# define fstat(fdes, stp) _fstati64(fdes, stp)
# define struct_stat struct _stati64
# define LSEEK_ERROR (__int64)-1
# else
/* Small file (<2Gb) support using Win32 functions. */
# undef lseek
# define lseek(fdes, offset, whence) _lseek(fdes, (long)offset, whence)
# define fstat(fdes, stp) _fstat(fdes, stp)
# define struct_stat struct _stat
# define LSEEK_ERROR (long)-1
# endif
/* Large file (>2Gb) support using Win32 functions. */
# undef lseek
# define lseek(fdes, offset, whence) _lseeki64(fdes, offset, whence)
# undef fstat
# define fstat(fdes, stp) _fstati64(fdes, stp)
# define struct_stat struct _stati64
# define LSEEK_ERROR (__int64)-1
#elif defined(__DJGPP__)
/* Requires DJGPP 2.04 */
# include <unistd.h>

View file

@ -28,7 +28,7 @@
int curlx_fseek(void *stream, curl_off_t offset, int whence)
{
#if defined(_WIN32) && defined(USE_WIN32_LARGE_FILES)
#ifdef _WIN32
return _fseeki64(stream, (__int64)offset, whence);
#elif defined(HAVE_FSEEKO) && defined(HAVE_DECL_FSEEKO)
return fseeko(stream, (off_t)offset, whence);
@ -373,11 +373,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer)
target = fixed;
else
target = path_w;
#ifndef USE_WIN32_LARGE_FILES
result = _wstat(target, buffer);
#else
result = _wstati64(target, buffer);
#endif
CURLX_FREE(path_w);
}
else
@ -388,11 +384,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer)
target = fixed;
else
target = path;
#ifndef USE_WIN32_LARGE_FILES
result = _stat(target, buffer);
#else
result = _stati64(target, buffer);
#endif
#endif
CURLX_FREE(fixed);

View file

@ -500,8 +500,7 @@ static const struct feat features_table[] = {
#ifdef USE_KERBEROS5
FEATURE("Kerberos", NULL, CURL_VERSION_KERBEROS5),
#endif
#if (SIZEOF_CURL_OFF_T > 4) && \
( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) )
#if (SIZEOF_CURL_OFF_T > 4) && ((SIZEOF_OFF_T > 4) || defined(_WIN32))
FEATURE("Largefile", NULL, CURL_VERSION_LARGEFILE),
#endif
#ifdef HAVE_LIBZ