Merge pull request #4229 from facebook/noFseek
Support for libc variants without fseeko/ftello
This commit is contained in:
@@ -84,6 +84,11 @@ endif ()
|
|||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT OFF)
|
set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT OFF)
|
||||||
|
# Old versions of bionic libc don't have fseeko/ftello
|
||||||
|
if ((NOT ${ANDROID_PLATFORM_LEVEL}) OR ${ANDROID_PLATFORM_LEVEL} VERSION_LESS 24)
|
||||||
|
message(STATUS "Setting compile definitions for old Android API")
|
||||||
|
add_compile_definitions(LIBC_NO_FSEEKO)
|
||||||
|
endif ()
|
||||||
else()
|
else()
|
||||||
set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT ON)
|
set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -77,7 +77,10 @@
|
|||||||
/* ************************************************************
|
/* ************************************************************
|
||||||
* Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW
|
* Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
#if defined(LIBC_NO_FSEEKO)
|
||||||
|
/* Some older libc implementations don't include these functions (e.g. Bionic < 24) */
|
||||||
|
# define LONG_SEEK fseek
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
# define LONG_SEEK _fseeki64
|
# define LONG_SEEK _fseeki64
|
||||||
#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */
|
#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */
|
||||||
# define LONG_SEEK fseeko
|
# define LONG_SEEK fseeko
|
||||||
|
|||||||
@@ -79,12 +79,16 @@ extern UTIL_time_t g_displayClock;
|
|||||||
|
|
||||||
|
|
||||||
/* Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW */
|
/* Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW */
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
#if defined(LIBC_NO_FSEEKO)
|
||||||
|
/* Some older libc implementations don't include these functions (e.g. Bionic < 24) */
|
||||||
|
# define LONG_SEEK fseek
|
||||||
|
# define LONG_TELL ftell
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
# define LONG_SEEK _fseeki64
|
# define LONG_SEEK _fseeki64
|
||||||
# define LONG_TELL _ftelli64
|
# define LONG_TELL _ftelli64
|
||||||
#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */
|
#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */
|
||||||
# define LONG_SEEK fseeko
|
# define LONG_SEEK fseeko
|
||||||
# define LONG_TELL ftello
|
# define LONG_TELL ftello
|
||||||
#elif defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__)
|
#elif defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__)
|
||||||
# define LONG_SEEK fseeko64
|
# define LONG_SEEK fseeko64
|
||||||
# define LONG_TELL ftello64
|
# define LONG_TELL ftello64
|
||||||
|
|||||||
+4
-1
@@ -24,7 +24,10 @@
|
|||||||
/*-************************************************************
|
/*-************************************************************
|
||||||
* Fix fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW
|
* Fix fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
#if defined(LIBC_NO_FSEEKO)
|
||||||
|
/* Some older libc implementations don't include these functions (e.g. Bionic < 24) */
|
||||||
|
# define UTIL_fseek fseek
|
||||||
|
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||||
# define UTIL_fseek _fseeki64
|
# define UTIL_fseek _fseeki64
|
||||||
#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */
|
#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */
|
||||||
# define UTIL_fseek fseeko
|
# define UTIL_fseek fseeko
|
||||||
|
|||||||
Reference in New Issue
Block a user