mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
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:
parent
073b85cefe
commit
163705db75
@ -1772,8 +1772,6 @@ if(WIN32)
|
||||
endif()
|
||||
list(APPEND CURL_LIBS "bcrypt")
|
||||
|
||||
set(USE_WIN32_LARGE_FILES ON)
|
||||
|
||||
# We use crypto functions that are not available for UWP apps
|
||||
if(NOT WINDOWS_STORE)
|
||||
set(USE_WIN32_CRYPTO ON)
|
||||
@ -1972,8 +1970,7 @@ curl_add_if("asyn-rr" USE_ARES AND ENABLE_THREADED_RESOLVER AND USE_HTTPSR
|
||||
curl_add_if("IDN" (HAVE_LIBIDN2 AND HAVE_IDN2_H) OR
|
||||
USE_WIN32_IDN OR
|
||||
USE_APPLE_IDN)
|
||||
curl_add_if("Largefile" (SIZEOF_CURL_OFF_T GREATER 4) AND
|
||||
((SIZEOF_OFF_T GREATER 4) OR USE_WIN32_LARGE_FILES))
|
||||
curl_add_if("Largefile" (SIZEOF_CURL_OFF_T GREATER 4) AND ((SIZEOF_OFF_T GREATER 4) OR WIN32))
|
||||
curl_add_if("SSPI" USE_WINDOWS_SSPI)
|
||||
curl_add_if("GSS-API" HAVE_GSSAPI)
|
||||
curl_add_if("alt-svc" NOT CURL_DISABLE_ALTSVC)
|
||||
|
||||
27
acinclude.m4
27
acinclude.m4
@ -1307,33 +1307,6 @@ AS_HELP_STRING([--without-ca-embed], [Do not embed a default CA bundle in the cu
|
||||
fi
|
||||
])
|
||||
|
||||
dnl CURL_CHECK_WIN32_LARGEFILE
|
||||
dnl -------------------------------------------------
|
||||
dnl Check if curl's Win32 large file will be used
|
||||
|
||||
AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
|
||||
AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
|
||||
if test "$curl_cv_native_windows" = 'yes'; then
|
||||
AC_MSG_CHECKING([whether build target supports Win32 large files])
|
||||
dnl All mingw-w64 versions support large files
|
||||
curl_win32_has_largefile='yes'
|
||||
case "$curl_win32_has_largefile" in
|
||||
yes)
|
||||
if test x"$enable_largefile" = 'xno'; then
|
||||
AC_MSG_RESULT([yes (large file disabled)])
|
||||
else
|
||||
AC_MSG_RESULT([yes (large file enabled)])
|
||||
AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
|
||||
[Define to 1 if you are building a Windows target with large file support.])
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([no])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
dnl CURL_CHECK_WIN32_CRYPTO
|
||||
dnl -------------------------------------------------
|
||||
dnl Check if curl's Win32 crypto lib can be used
|
||||
|
||||
@ -618,7 +618,6 @@ dnl **********************************************************************
|
||||
dnl Compilation based checks should not be done before this point.
|
||||
dnl **********************************************************************
|
||||
|
||||
CURL_CHECK_WIN32_LARGEFILE
|
||||
CURL_CHECK_WIN32_CRYPTO
|
||||
|
||||
curl_cv_apple='no'
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -38,7 +38,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(_WIN32)
|
||||
|
||||
/* OUR_MAX_SEEK_L has 'long' data type, OUR_MAX_SEEK_O has 'curl_off_t,
|
||||
both represent the same value. Maximum offset used here when we lseek
|
||||
|
||||
Loading…
Reference in New Issue
Block a user