diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 011e485..48dfc79 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,10 +12,7 @@ set(IMAGER_VERSION_STR "${IMAGER_VERSION_MAJOR}.${IMAGER_VERSION_MINOR}.4.1") set(IMAGER_VERSION_CSV "${IMAGER_VERSION_MAJOR},${IMAGER_VERSION_MINOR},4,1") add_definitions(-DIMAGER_VERSION_STR="${IMAGER_VERSION_STR}") add_definitions(-DIMAGER_VERSION_CSV=${IMAGER_VERSION_CSV}) - set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) # Adding headers explicity so they are displayed in Qt Creator set(HEADERS config.h imagewriter.h networkaccessmanagerfactory.h nan.h drivelistitem.h drivelistmodel.h drivelistmodelpollthread.h driveformatthread.h powersaveblocker.h cli.h @@ -109,7 +106,7 @@ endif() if (${QT}Widgets_FOUND) set(EXTRALIBS ${EXTRALIBS} ${QT}::Widgets) endif() -if(${QT}DBus_FOUND) +if(${QT}DBus_FOUND AND UNIX AND NOT APPLE) set(DEPENDENCIES ${DEPENDENCIES} linux/udisks2api.cpp linux/udisks2api.h) set(EXTRALIBS ${EXTRALIBS} ${QT}::DBus) message("udisks2 support enabled") @@ -134,6 +131,9 @@ else() add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${DEPENDENCIES}) endif() +set_property(TARGET ${PROJECT_NAME} PROPERTY AUTOMOC ON) +set_property(TARGET ${PROJECT_NAME} PROPERTY AUTORCC ON) + # Enable link time optimization if available include(CheckIPOSupported) check_ipo_supported(RESULT iposupported OUTPUT ipoerror) @@ -165,9 +165,9 @@ if (WIN32) find_package(OpenSSL REQUIRED) # Bundled zlib - add_subdirectory(dependencies/zlib-1.2.11) + add_subdirectory(dependencies/zlib-1.2.13) set(ZLIB_LIBRARY zlibstatic) - set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib-1.2.11) + set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib-1.2.13) # Bundled libcurl set(CMAKE_CURL_INCLUDES) @@ -186,8 +186,8 @@ if (WIN32) # Bundled zstd set(ZSTD_BUILD_PROGRAMS OFF) set(ZSTD_BUILD_SHARED OFF) - add_subdirectory(dependencies/zstd-1.5.0/build/cmake) - set(ZSTD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zstd-1.5.0/lib) + add_subdirectory(dependencies/zstd-1.5.4/build/cmake) + set(ZSTD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zstd-1.5.4/lib) set(ZSTD_LIBRARY libzstd_static) # Bundled libarchive @@ -195,9 +195,11 @@ if (WIN32) set(ENABLE_TAR OFF CACHE BOOL "") set(ENABLE_CPIO OFF CACHE BOOL "") set(ENABLE_CAT OFF CACHE BOOL "") - add_subdirectory(dependencies/libarchive-3.5.2) + add_subdirectory(dependencies/libarchive-3.6.2) + # Disable shared libarchive (we only want static) + set_target_properties(archive PROPERTIES EXCLUDE_FROM_ALL 1) set(LibArchive_LIBRARIES archive_static) - set(LibArchive_INCLUDE_DIR dependencies/libarchive-3.5.2/libarchive) + set(LibArchive_INCLUDE_DIR dependencies/libarchive-3.6.2/libarchive) # Bundled fat32format add_subdirectory(dependencies/fat32format) @@ -209,7 +211,9 @@ if (WIN32) COMMAND ${CMAKE_STRIP} "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.exe") # Code signing - find_program(SIGNTOOL "signtool.exe" PATHS "c:/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool") + find_program(SIGNTOOL "signtool.exe" PATHS + "c:/Program Files (x86)/Microsoft SDKs/ClickOnce/SignTool" + "c:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64") if (NOT SIGNTOOL) message(FATAL_ERROR "Unable to locate signtool.exe used for code signing") endif() @@ -275,8 +279,8 @@ elseif(APPLE) # Bundled zstd set(ZSTD_BUILD_PROGRAMS OFF) set(ZSTD_BUILD_SHARED OFF) - add_subdirectory(dependencies/zstd-1.5.0/build/cmake) - set(ZSTD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zstd-1.5.0/lib) + add_subdirectory(dependencies/zstd-1.5.4/build/cmake) + set(ZSTD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zstd-1.5.4/lib) set(ZSTD_LIBRARY libzstd_static) # Bundled libarchive @@ -284,9 +288,11 @@ elseif(APPLE) set(ENABLE_TAR OFF CACHE BOOL "") set(ENABLE_CPIO OFF CACHE BOOL "") set(ENABLE_CAT OFF CACHE BOOL "") - add_subdirectory(dependencies/libarchive-3.5.2) + add_subdirectory(dependencies/libarchive-3.6.2) + # Disable shared libarchive (we only want static) + set_target_properties(archive PROPERTIES EXCLUDE_FROM_ALL 1) set(LibArchive_LIBRARIES archive_static) - set(LibArchive_INCLUDE_DIR dependencies/libarchive-3.5.2/libarchive) + set(LibArchive_INCLUDE_DIR dependencies/libarchive-3.6.2/libarchive) find_library(Cocoa Cocoa) find_library(CoreFoundation CoreFoundation) diff --git a/src/dependencies/cmliblzma/.gitattributes b/src/dependencies/cmliblzma/.gitattributes new file mode 100644 index 0000000..562b12e --- /dev/null +++ b/src/dependencies/cmliblzma/.gitattributes @@ -0,0 +1 @@ +* -whitespace diff --git a/src/dependencies/cmliblzma/CMakeLists.txt b/src/dependencies/cmliblzma/CMakeLists.txt index b443fd6..74866e1 100644 --- a/src/dependencies/cmliblzma/CMakeLists.txt +++ b/src/dependencies/cmliblzma/CMakeLists.txt @@ -63,12 +63,10 @@ set(HAVE_MF_HC4 1) CHECK_TYPE_SIZE(int16_t INT16_T) CHECK_TYPE_SIZE(int32_t INT32_T) CHECK_TYPE_SIZE(int64_t INT64_T) -CHECK_TYPE_SIZE(intmax_t INTMAX_T) CHECK_TYPE_SIZE(uint8_t UINT8_T) CHECK_TYPE_SIZE(uint16_t UINT16_T) CHECK_TYPE_SIZE(uint32_t UINT32_T) CHECK_TYPE_SIZE(uint64_t UINT64_T) -CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) CHECK_TYPE_SIZE("short" SIZE_OF_SHORT) CHECK_TYPE_SIZE("int" SIZE_OF_INT) diff --git a/src/dependencies/cmliblzma/common/mythread.h b/src/dependencies/cmliblzma/common/mythread.h new file mode 100644 index 0000000..be22654 --- /dev/null +++ b/src/dependencies/cmliblzma/common/mythread.h @@ -0,0 +1,521 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file mythread.h +/// \brief Some threading related helper macros and functions +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef MYTHREAD_H +#define MYTHREAD_H + +#include "sysdefs.h" + +// If any type of threading is enabled, #define MYTHREAD_ENABLED. +#if defined(MYTHREAD_POSIX) || defined(MYTHREAD_WIN95) \ + || defined(MYTHREAD_VISTA) +# define MYTHREAD_ENABLED 1 +#endif + + +#ifdef MYTHREAD_ENABLED + +//////////////////////////////////////// +// Shared between all threading types // +//////////////////////////////////////// + +// Locks a mutex for a duration of a block. +// +// Perform mythread_mutex_lock(&mutex) in the beginning of a block +// and mythread_mutex_unlock(&mutex) at the end of the block. "break" +// may be used to unlock the mutex and jump out of the block. +// mythread_sync blocks may be nested. +// +// Example: +// +// mythread_sync(mutex) { +// foo(); +// if (some_error) +// break; // Skips bar() +// bar(); +// } +// +// At least GCC optimizes the loops completely away so it doesn't slow +// things down at all compared to plain mythread_mutex_lock(&mutex) +// and mythread_mutex_unlock(&mutex) calls. +// +#define mythread_sync(mutex) mythread_sync_helper1(mutex, __LINE__) +#define mythread_sync_helper1(mutex, line) mythread_sync_helper2(mutex, line) +#define mythread_sync_helper2(mutex, line) \ + for (unsigned int mythread_i_ ## line = 0; \ + mythread_i_ ## line \ + ? (mythread_mutex_unlock(&(mutex)), 0) \ + : (mythread_mutex_lock(&(mutex)), 1); \ + mythread_i_ ## line = 1) \ + for (unsigned int mythread_j_ ## line = 0; \ + !mythread_j_ ## line; \ + mythread_j_ ## line = 1) +#endif + + +#if !defined(MYTHREAD_ENABLED) + +////////////////// +// No threading // +////////////////// + +// Calls the given function once. This isn't thread safe. +#define mythread_once(func) \ +do { \ + static bool once_ = false; \ + if (!once_) { \ + func(); \ + once_ = true; \ + } \ +} while (0) + + +#if !(defined(_WIN32) && !defined(__CYGWIN__)) +// Use sigprocmask() to set the signal mask in single-threaded programs. +#include + +static inline void +mythread_sigmask(int how, const sigset_t *restrict set, + sigset_t *restrict oset) +{ + int ret = sigprocmask(how, set, oset); + assert(ret == 0); + (void)ret; +} +#endif + + +#elif defined(MYTHREAD_POSIX) + +//////////////////// +// Using pthreads // +//////////////////// + +#include +#include +#include +#include +#include + +#define MYTHREAD_RET_TYPE void * +#define MYTHREAD_RET_VALUE NULL + +typedef pthread_t mythread; +typedef pthread_mutex_t mythread_mutex; + +typedef struct { + pthread_cond_t cond; +#ifdef HAVE_CLOCK_GETTIME + // Clock ID (CLOCK_REALTIME or CLOCK_MONOTONIC) associated with + // the condition variable. + clockid_t clk_id; +#endif +} mythread_cond; + +typedef struct timespec mythread_condtime; + + +// Calls the given function once in a thread-safe way. +#define mythread_once(func) \ + do { \ + static pthread_once_t once_ = PTHREAD_ONCE_INIT; \ + pthread_once(&once_, &func); \ + } while (0) + + +// Use pthread_sigmask() to set the signal mask in multi-threaded programs. +// Do nothing on OpenVMS since it lacks pthread_sigmask(). +static inline void +mythread_sigmask(int how, const sigset_t *restrict set, + sigset_t *restrict oset) +{ +#ifdef __VMS + (void)how; + (void)set; + (void)oset; +#else + int ret = pthread_sigmask(how, set, oset); + assert(ret == 0); + (void)ret; +#endif +} + + +// Creates a new thread with all signals blocked. Returns zero on success +// and non-zero on error. +static inline int +mythread_create(mythread *thread, void *(*func)(void *arg), void *arg) +{ + sigset_t old; + sigset_t all; + sigfillset(&all); + + mythread_sigmask(SIG_SETMASK, &all, &old); + const int ret = pthread_create(thread, NULL, func, arg); + mythread_sigmask(SIG_SETMASK, &old, NULL); + + return ret; +} + +// Joins a thread. Returns zero on success and non-zero on error. +static inline int +mythread_join(mythread thread) +{ + return pthread_join(thread, NULL); +} + + +// Initiatlizes a mutex. Returns zero on success and non-zero on error. +static inline int +mythread_mutex_init(mythread_mutex *mutex) +{ + return pthread_mutex_init(mutex, NULL); +} + +static inline void +mythread_mutex_destroy(mythread_mutex *mutex) +{ + int ret = pthread_mutex_destroy(mutex); + assert(ret == 0); + (void)ret; +} + +static inline void +mythread_mutex_lock(mythread_mutex *mutex) +{ + int ret = pthread_mutex_lock(mutex); + assert(ret == 0); + (void)ret; +} + +static inline void +mythread_mutex_unlock(mythread_mutex *mutex) +{ + int ret = pthread_mutex_unlock(mutex); + assert(ret == 0); + (void)ret; +} + + +// Initializes a condition variable. +// +// Using CLOCK_MONOTONIC instead of the default CLOCK_REALTIME makes the +// timeout in pthread_cond_timedwait() work correctly also if system time +// is suddenly changed. Unfortunately CLOCK_MONOTONIC isn't available +// everywhere while the default CLOCK_REALTIME is, so the default is +// used if CLOCK_MONOTONIC isn't available. +// +// If clock_gettime() isn't available at all, gettimeofday() will be used. +static inline int +mythread_cond_init(mythread_cond *mycond) +{ +#ifdef HAVE_CLOCK_GETTIME + // NOTE: HAVE_DECL_CLOCK_MONOTONIC is always defined to 0 or 1. +# if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && HAVE_DECL_CLOCK_MONOTONIC + struct timespec ts; + pthread_condattr_t condattr; + + // POSIX doesn't seem to *require* that pthread_condattr_setclock() + // will fail if given an unsupported clock ID. Test that + // CLOCK_MONOTONIC really is supported using clock_gettime(). + if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0 + && pthread_condattr_init(&condattr) == 0) { + int ret = pthread_condattr_setclock( + &condattr, CLOCK_MONOTONIC); + if (ret == 0) + ret = pthread_cond_init(&mycond->cond, &condattr); + + pthread_condattr_destroy(&condattr); + + if (ret == 0) { + mycond->clk_id = CLOCK_MONOTONIC; + return 0; + } + } + + // If anything above fails, fall back to the default CLOCK_REALTIME. + // POSIX requires that all implementations of clock_gettime() must + // support at least CLOCK_REALTIME. +# endif + + mycond->clk_id = CLOCK_REALTIME; +#endif + + return pthread_cond_init(&mycond->cond, NULL); +} + +static inline void +mythread_cond_destroy(mythread_cond *cond) +{ + int ret = pthread_cond_destroy(&cond->cond); + assert(ret == 0); + (void)ret; +} + +static inline void +mythread_cond_signal(mythread_cond *cond) +{ + int ret = pthread_cond_signal(&cond->cond); + assert(ret == 0); + (void)ret; +} + +static inline void +mythread_cond_wait(mythread_cond *cond, mythread_mutex *mutex) +{ + int ret = pthread_cond_wait(&cond->cond, mutex); + assert(ret == 0); + (void)ret; +} + +// Waits on a condition or until a timeout expires. If the timeout expires, +// non-zero is returned, otherwise zero is returned. +static inline int +mythread_cond_timedwait(mythread_cond *cond, mythread_mutex *mutex, + const mythread_condtime *condtime) +{ + int ret = pthread_cond_timedwait(&cond->cond, mutex, condtime); + assert(ret == 0 || ret == ETIMEDOUT); + return ret; +} + +// Sets condtime to the absolute time that is timeout_ms milliseconds +// in the future. The type of the clock to use is taken from cond. +static inline void +mythread_condtime_set(mythread_condtime *condtime, const mythread_cond *cond, + uint32_t timeout_ms) +{ + condtime->tv_sec = timeout_ms / 1000; + condtime->tv_nsec = (timeout_ms % 1000) * 1000000; + +#ifdef HAVE_CLOCK_GETTIME + struct timespec now; + int ret = clock_gettime(cond->clk_id, &now); + assert(ret == 0); + (void)ret; + + condtime->tv_sec += now.tv_sec; + condtime->tv_nsec += now.tv_nsec; +#else + (void)cond; + + struct timeval now; + gettimeofday(&now, NULL); + + condtime->tv_sec += now.tv_sec; + condtime->tv_nsec += now.tv_usec * 1000L; +#endif + + // tv_nsec must stay in the range [0, 999_999_999]. + if (condtime->tv_nsec >= 1000000000L) { + condtime->tv_nsec -= 1000000000L; + ++condtime->tv_sec; + } +} + + +#elif defined(MYTHREAD_WIN95) || defined(MYTHREAD_VISTA) + +///////////////////// +// Windows threads // +///////////////////// + +#define WIN32_LEAN_AND_MEAN +#ifdef MYTHREAD_VISTA +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +#endif +#include +#include + +#define MYTHREAD_RET_TYPE unsigned int __stdcall +#define MYTHREAD_RET_VALUE 0 + +typedef HANDLE mythread; +typedef CRITICAL_SECTION mythread_mutex; + +#ifdef MYTHREAD_WIN95 +typedef HANDLE mythread_cond; +#else +typedef CONDITION_VARIABLE mythread_cond; +#endif + +typedef struct { + // Tick count (milliseconds) in the beginning of the timeout. + // NOTE: This is 32 bits so it wraps around after 49.7 days. + // Multi-day timeouts may not work as expected. + DWORD start; + + // Length of the timeout in milliseconds. The timeout expires + // when the current tick count minus "start" is equal or greater + // than "timeout". + DWORD timeout; +} mythread_condtime; + + +// mythread_once() is only available with Vista threads. +#ifdef MYTHREAD_VISTA +#define mythread_once(func) \ + do { \ + static INIT_ONCE once_ = INIT_ONCE_STATIC_INIT; \ + BOOL pending_; \ + if (!InitOnceBeginInitialize(&once_, 0, &pending_, NULL)) \ + abort(); \ + if (pending_) \ + func(); \ + if (!InitOnceComplete(&once, 0, NULL)) \ + abort(); \ + } while (0) +#endif + + +// mythread_sigmask() isn't available on Windows. Even a dummy version would +// make no sense because the other POSIX signal functions are missing anyway. + + +static inline int +mythread_create(mythread *thread, + unsigned int (__stdcall *func)(void *arg), void *arg) +{ + uintptr_t ret = _beginthreadex(NULL, 0, func, arg, 0, NULL); + if (ret == 0) + return -1; + + *thread = (HANDLE)ret; + return 0; +} + +static inline int +mythread_join(mythread thread) +{ + int ret = 0; + + if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) + ret = -1; + + if (!CloseHandle(thread)) + ret = -1; + + return ret; +} + + +static inline int +mythread_mutex_init(mythread_mutex *mutex) +{ + InitializeCriticalSection(mutex); + return 0; +} + +static inline void +mythread_mutex_destroy(mythread_mutex *mutex) +{ + DeleteCriticalSection(mutex); +} + +static inline void +mythread_mutex_lock(mythread_mutex *mutex) +{ + EnterCriticalSection(mutex); +} + +static inline void +mythread_mutex_unlock(mythread_mutex *mutex) +{ + LeaveCriticalSection(mutex); +} + + +static inline int +mythread_cond_init(mythread_cond *cond) +{ +#ifdef MYTHREAD_WIN95 + *cond = CreateEvent(NULL, FALSE, FALSE, NULL); + return *cond == NULL ? -1 : 0; +#else + InitializeConditionVariable(cond); + return 0; +#endif +} + +static inline void +mythread_cond_destroy(mythread_cond *cond) +{ +#ifdef MYTHREAD_WIN95 + CloseHandle(*cond); +#else + (void)cond; +#endif +} + +static inline void +mythread_cond_signal(mythread_cond *cond) +{ +#ifdef MYTHREAD_WIN95 + SetEvent(*cond); +#else + WakeConditionVariable(cond); +#endif +} + +static inline void +mythread_cond_wait(mythread_cond *cond, mythread_mutex *mutex) +{ +#ifdef MYTHREAD_WIN95 + LeaveCriticalSection(mutex); + WaitForSingleObject(*cond, INFINITE); + EnterCriticalSection(mutex); +#else + BOOL ret = SleepConditionVariableCS(cond, mutex, INFINITE); + assert(ret); + (void)ret; +#endif +} + +static inline int +mythread_cond_timedwait(mythread_cond *cond, mythread_mutex *mutex, + const mythread_condtime *condtime) +{ +#ifdef MYTHREAD_WIN95 + LeaveCriticalSection(mutex); +#endif + + DWORD elapsed = GetTickCount() - condtime->start; + DWORD timeout = elapsed >= condtime->timeout + ? 0 : condtime->timeout - elapsed; + +#ifdef MYTHREAD_WIN95 + DWORD ret = WaitForSingleObject(*cond, timeout); + assert(ret == WAIT_OBJECT_0 || ret == WAIT_TIMEOUT); + + EnterCriticalSection(mutex); + + return ret == WAIT_TIMEOUT; +#else + BOOL ret = SleepConditionVariableCS(cond, mutex, timeout); + assert(ret || GetLastError() == ERROR_TIMEOUT); + return !ret; +#endif +} + +static inline void +mythread_condtime_set(mythread_condtime *condtime, const mythread_cond *cond, + uint32_t timeout) +{ + (void)cond; + condtime->start = GetTickCount(); + condtime->timeout = timeout; +} + +#endif + +#endif diff --git a/src/dependencies/cmliblzma/common/sysdefs.h b/src/dependencies/cmliblzma/common/sysdefs.h index 22f487b..86c5da0 100644 --- a/src/dependencies/cmliblzma/common/sysdefs.h +++ b/src/dependencies/cmliblzma/common/sysdefs.h @@ -49,9 +49,7 @@ // Some pre-C99 systems have SIZE_MAX in limits.h instead of stdint.h. The // limits are also used to figure out some macros missing from pre-C99 systems. -#ifdef HAVE_LIMITS_H -# include -#endif +#include #if defined(_MSC_VER) && (_MSC_VER < 1310) @@ -164,9 +162,7 @@ typedef unsigned char _Bool; // string.h should be enough but let's include strings.h and memory.h too if // they exists, since that shouldn't do any harm, but may improve portability. -#ifdef HAVE_STRING_H -# include -#endif +#include #ifdef HAVE_STRINGS_H # include @@ -204,7 +200,8 @@ typedef unsigned char _Bool; # define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #endif -#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 +#if defined(__GNUC__) \ + && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4) # define lzma_attr_alloc_size(x) __attribute__((__alloc_size__(x))) #else # define lzma_attr_alloc_size(x) diff --git a/src/dependencies/cmliblzma/common/tuklib_common.h b/src/dependencies/cmliblzma/common/tuklib_common.h new file mode 100644 index 0000000..31fbab5 --- /dev/null +++ b/src/dependencies/cmliblzma/common/tuklib_common.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file tuklib_common.h +/// \brief Common definitions for tuklib modules +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef TUKLIB_COMMON_H +#define TUKLIB_COMMON_H + +// The config file may be replaced by a package-specific file. +// It should include at least stddef.h, inttypes.h, and limits.h. +#include "tuklib_config.h" + +// TUKLIB_SYMBOL_PREFIX is prefixed to all symbols exported by +// the tuklib modules. If you use a tuklib module in a library, +// you should use TUKLIB_SYMBOL_PREFIX to make sure that there +// are no symbol conflicts in case someone links your library +// into application that also uses the same tuklib module. +#ifndef TUKLIB_SYMBOL_PREFIX +# define TUKLIB_SYMBOL_PREFIX +#endif + +#define TUKLIB_CAT_X(a, b) a ## b +#define TUKLIB_CAT(a, b) TUKLIB_CAT_X(a, b) + +#ifndef TUKLIB_SYMBOL +# define TUKLIB_SYMBOL(sym) TUKLIB_CAT(TUKLIB_SYMBOL_PREFIX, sym) +#endif + +#ifndef TUKLIB_DECLS_BEGIN +# ifdef __cplusplus +# define TUKLIB_DECLS_BEGIN extern "C" { +# else +# define TUKLIB_DECLS_BEGIN +# endif +#endif + +#ifndef TUKLIB_DECLS_END +# ifdef __cplusplus +# define TUKLIB_DECLS_END } +# else +# define TUKLIB_DECLS_END +# endif +#endif + +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define TUKLIB_GNUC_REQ(major, minor) \ + ((__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)) \ + || __GNUC__ > (major)) +#else +# define TUKLIB_GNUC_REQ(major, minor) 0 +#endif + +#if TUKLIB_GNUC_REQ(2, 5) +# define tuklib_attr_noreturn __attribute__((__noreturn__)) +#else +# define tuklib_attr_noreturn +#endif + +#if (defined(_WIN32) && !defined(__CYGWIN__)) \ + || defined(__OS2__) || defined(__MSDOS__) +# define TUKLIB_DOSLIKE 1 +#endif + +#endif diff --git a/src/dependencies/cmliblzma/common/tuklib_config.h b/src/dependencies/cmliblzma/common/tuklib_config.h new file mode 100644 index 0000000..549cb24 --- /dev/null +++ b/src/dependencies/cmliblzma/common/tuklib_config.h @@ -0,0 +1,7 @@ +#ifdef HAVE_CONFIG_H +# include "sysdefs.h" +#else +# include +# include +# include +#endif diff --git a/src/dependencies/cmliblzma/common/tuklib_cpucores.c b/src/dependencies/cmliblzma/common/tuklib_cpucores.c new file mode 100644 index 0000000..cc968dd --- /dev/null +++ b/src/dependencies/cmliblzma/common/tuklib_cpucores.c @@ -0,0 +1,100 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file tuklib_cpucores.c +/// \brief Get the number of CPU cores online +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "tuklib_cpucores.h" + +#if defined(_WIN32) || defined(__CYGWIN__) +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# include + +// glibc >= 2.9 +#elif defined(TUKLIB_CPUCORES_SCHED_GETAFFINITY) +# include + +// FreeBSD +#elif defined(TUKLIB_CPUCORES_CPUSET) +# include +# include + +#elif defined(TUKLIB_CPUCORES_SYSCTL) +# ifdef HAVE_SYS_PARAM_H +# include +# endif +# include + +#elif defined(TUKLIB_CPUCORES_SYSCONF) +# include + +// HP-UX +#elif defined(TUKLIB_CPUCORES_PSTAT_GETDYNAMIC) +# include +# include +#endif + + +extern uint32_t +tuklib_cpucores(void) +{ + uint32_t ret = 0; + +#if defined(_WIN32) || defined(__CYGWIN__) + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + ret = sysinfo.dwNumberOfProcessors; + +#elif defined(TUKLIB_CPUCORES_SCHED_GETAFFINITY) + cpu_set_t cpu_mask; + if (sched_getaffinity(0, sizeof(cpu_mask), &cpu_mask) == 0) + ret = (uint32_t)CPU_COUNT(&cpu_mask); + +#elif defined(TUKLIB_CPUCORES_CPUSET) + cpuset_t set; + if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, + sizeof(set), &set) == 0) { +# ifdef CPU_COUNT + ret = (uint32_t)CPU_COUNT(&set); +# else + for (unsigned i = 0; i < CPU_SETSIZE; ++i) + if (CPU_ISSET(i, &set)) + ++ret; +# endif + } + +#elif defined(TUKLIB_CPUCORES_SYSCTL) + int name[2] = { CTL_HW, HW_NCPU }; + int cpus; + size_t cpus_size = sizeof(cpus); + if (sysctl(name, 2, &cpus, &cpus_size, NULL, 0) != -1 + && cpus_size == sizeof(cpus) && cpus > 0) + ret = (uint32_t)cpus; + +#elif defined(TUKLIB_CPUCORES_SYSCONF) +# ifdef _SC_NPROCESSORS_ONLN + // Most systems + const long cpus = sysconf(_SC_NPROCESSORS_ONLN); +# else + // IRIX + const long cpus = sysconf(_SC_NPROC_ONLN); +# endif + if (cpus > 0) + ret = (uint32_t)cpus; + +#elif defined(TUKLIB_CPUCORES_PSTAT_GETDYNAMIC) + struct pst_dynamic pst; + if (pstat_getdynamic(&pst, sizeof(pst), 1, 0) != -1) + ret = (uint32_t)pst.psd_proc_cnt; +#endif + + return ret; +} diff --git a/src/dependencies/cmliblzma/common/tuklib_cpucores.h b/src/dependencies/cmliblzma/common/tuklib_cpucores.h new file mode 100644 index 0000000..be1ce1c --- /dev/null +++ b/src/dependencies/cmliblzma/common/tuklib_cpucores.h @@ -0,0 +1,23 @@ +/////////////////////////////////////////////////////////////////////////////// +// +/// \file tuklib_cpucores.h +/// \brief Get the number of CPU cores online +// +// Author: Lasse Collin +// +// This file has been put into the public domain. +// You can do whatever you want with this file. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef TUKLIB_CPUCORES_H +#define TUKLIB_CPUCORES_H + +#include "tuklib_common.h" +TUKLIB_DECLS_BEGIN + +#define tuklib_cpucores TUKLIB_SYMBOL(tuklib_cpucores) +extern uint32_t tuklib_cpucores(void); + +TUKLIB_DECLS_END +#endif diff --git a/src/dependencies/cmliblzma/common/tuklib_integer.h b/src/dependencies/cmliblzma/common/tuklib_integer.h index 5d82685..4e61357 100644 --- a/src/dependencies/cmliblzma/common/tuklib_integer.h +++ b/src/dependencies/cmliblzma/common/tuklib_integer.h @@ -6,22 +6,26 @@ /// This file provides macros or functions to do some basic integer and bit /// operations. /// -/// Endianness related integer operations (XX = 16, 32, or 64; Y = b or l): +/// Native endian inline functions (XX = 16, 32, or 64): +/// - Unaligned native endian reads: readXXne(ptr) +/// - Unaligned native endian writes: writeXXne(ptr, num) +/// - Aligned native endian reads: aligned_readXXne(ptr) +/// - Aligned native endian writes: aligned_writeXXne(ptr, num) +/// +/// Endianness-converting integer operations (these can be macros!) +/// (XX = 16, 32, or 64; Y = b or l): /// - Byte swapping: bswapXX(num) -/// - Byte order conversions to/from native: convXXYe(num) -/// - Aligned reads: readXXYe(ptr) -/// - Aligned writes: writeXXYe(ptr, num) -/// - Unaligned reads (16/32-bit only): unaligned_readXXYe(ptr) -/// - Unaligned writes (16/32-bit only): unaligned_writeXXYe(ptr, num) +/// - Byte order conversions to/from native (byteswaps if Y isn't +/// the native endianness): convXXYe(num) +/// - Unaligned reads (16/32-bit only): readXXYe(ptr) +/// - Unaligned writes (16/32-bit only): writeXXYe(ptr, num) +/// - Aligned reads: aligned_readXXYe(ptr) +/// - Aligned writes: aligned_writeXXYe(ptr, num) /// -/// Since they can macros, the arguments should have no side effects since -/// they may be evaluated more than once. +/// Since the above can macros, the arguments should have no side effects +/// because they may be evaluated more than once. /// -/// \todo PowerPC and possibly some other architectures support -/// byte swapping load and store instructions. This file -/// doesn't take advantage of those instructions. -/// -/// Bit scan operations for non-zero 32-bit integers: +/// Bit scan operations for non-zero 32-bit integers (inline functions): /// - Bit scan reverse (find highest non-zero bit): bsr32(num) /// - Count leading zeros: clz32(num) /// - Count trailing zeros: ctz32(num) @@ -41,22 +45,27 @@ #ifndef TUKLIB_INTEGER_H #define TUKLIB_INTEGER_H -#include "sysdefs.h" +#include "tuklib_common.h" +#include -#if defined(__GNUC__) && defined(__GNUC_MINOR__) -# define TUKLIB_GNUC_REQ(major, minor) \ - ((__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)) \ - || __GNUC__ > (major)) -#else -# define TUKLIB_GNUC_REQ(major, minor) 0 +// Newer Intel C compilers require immintrin.h for _bit_scan_reverse() +// and such functions. +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) +# include #endif -//////////////////////////////////////// -// Operating system specific features // -//////////////////////////////////////// +/////////////////// +// Byte swapping // +/////////////////// -#if defined(HAVE_BYTESWAP_H) +#if defined(HAVE___BUILTIN_BSWAPXX) + // GCC >= 4.8 and Clang +# define bswap16(n) __builtin_bswap16(n) +# define bswap32(n) __builtin_bswap32(n) +# define bswap64(n) __builtin_bswap64(n) + +#elif defined(HAVE_BYTESWAP_H) // glibc, uClibc, dietlibc # include # ifdef HAVE_BSWAP_16 @@ -105,45 +114,33 @@ # endif #endif - -//////////////////////////////// -// Compiler-specific features // -//////////////////////////////// - -// Newer Intel C compilers require immintrin.h for _bit_scan_reverse() -// and such functions. -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) -# include -#endif - - -/////////////////// -// Byte swapping // -/////////////////// - #ifndef bswap16 -# define bswap16(num) \ - (((uint16_t)(num) << 8) | ((uint16_t)(num) >> 8)) +# define bswap16(n) (uint16_t)( \ + (((n) & 0x00FFU) << 8) \ + | (((n) & 0xFF00U) >> 8) \ + ) #endif #ifndef bswap32 -# define bswap32(num) \ - ( (((uint32_t)(num) << 24) ) \ - | (((uint32_t)(num) << 8) & UINT32_C(0x00FF0000)) \ - | (((uint32_t)(num) >> 8) & UINT32_C(0x0000FF00)) \ - | (((uint32_t)(num) >> 24) ) ) +# define bswap32(n) (uint32_t)( \ + (((n) & UINT32_C(0x000000FF)) << 24) \ + | (((n) & UINT32_C(0x0000FF00)) << 8) \ + | (((n) & UINT32_C(0x00FF0000)) >> 8) \ + | (((n) & UINT32_C(0xFF000000)) >> 24) \ + ) #endif #ifndef bswap64 -# define bswap64(num) \ - ( (((uint64_t)(num) << 56) ) \ - | (((uint64_t)(num) << 40) & UINT64_C(0x00FF000000000000)) \ - | (((uint64_t)(num) << 24) & UINT64_C(0x0000FF0000000000)) \ - | (((uint64_t)(num) << 8) & UINT64_C(0x000000FF00000000)) \ - | (((uint64_t)(num) >> 8) & UINT64_C(0x00000000FF000000)) \ - | (((uint64_t)(num) >> 24) & UINT64_C(0x0000000000FF0000)) \ - | (((uint64_t)(num) >> 40) & UINT64_C(0x000000000000FF00)) \ - | (((uint64_t)(num) >> 56) ) ) +# define bswap64(n) (uint64_t)( \ + (((n) & UINT64_C(0x00000000000000FF)) << 56) \ + | (((n) & UINT64_C(0x000000000000FF00)) << 40) \ + | (((n) & UINT64_C(0x0000000000FF0000)) << 24) \ + | (((n) & UINT64_C(0x00000000FF000000)) << 8) \ + | (((n) & UINT64_C(0x000000FF00000000)) >> 8) \ + | (((n) & UINT64_C(0x0000FF0000000000)) >> 24) \ + | (((n) & UINT64_C(0x00FF000000000000)) >> 40) \ + | (((n) & UINT64_C(0xFF00000000000000)) >> 56) \ + ) #endif // Define conversion macros using the basic byte swapping macros. @@ -188,76 +185,76 @@ #endif -////////////////////////////// -// Aligned reads and writes // -////////////////////////////// +//////////////////////////////// +// Unaligned reads and writes // +//////////////////////////////// + +// The traditional way of casting e.g. *(const uint16_t *)uint8_pointer +// is bad even if the uint8_pointer is properly aligned because this kind +// of casts break strict aliasing rules and result in undefined behavior. +// With unaligned pointers it's even worse: compilers may emit vector +// instructions that require aligned pointers even if non-vector +// instructions work with unaligned pointers. +// +// Using memcpy() is the standard compliant way to do unaligned access. +// Many modern compilers inline it so there is no function call overhead. +// For those compilers that don't handle the memcpy() method well, the +// old casting method (that violates strict aliasing) can be requested at +// build time. A third method, casting to a packed struct, would also be +// an option but isn't provided to keep things simpler (it's already a mess). +// Hopefully this is flexible enough in practice. static inline uint16_t -read16be(const uint8_t *buf) +read16ne(const uint8_t *buf) { - uint16_t num = *(const uint16_t *)buf; - return conv16be(num); -} - - -static inline uint16_t -read16le(const uint8_t *buf) -{ - uint16_t num = *(const uint16_t *)buf; - return conv16le(num); +#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \ + && defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) + return *(const uint16_t *)buf; +#else + uint16_t num; + memcpy(&num, buf, sizeof(num)); + return num; +#endif } static inline uint32_t -read32be(const uint8_t *buf) +read32ne(const uint8_t *buf) { - uint32_t num = *(const uint32_t *)buf; - return conv32be(num); -} - - -static inline uint32_t -read32le(const uint8_t *buf) -{ - uint32_t num = *(const uint32_t *)buf; - return conv32le(num); +#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \ + && defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) + return *(const uint32_t *)buf; +#else + uint32_t num; + memcpy(&num, buf, sizeof(num)); + return num; +#endif } static inline uint64_t -read64be(const uint8_t *buf) +read64ne(const uint8_t *buf) { - uint64_t num = *(const uint64_t *)buf; - return conv64be(num); +#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \ + && defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) + return *(const uint64_t *)buf; +#else + uint64_t num; + memcpy(&num, buf, sizeof(num)); + return num; +#endif } -static inline uint64_t -read64le(const uint8_t *buf) -{ - uint64_t num = *(const uint64_t *)buf; - return conv64le(num); -} - - -// NOTE: Possible byte swapping must be done in a macro to allow GCC -// to optimize byte swapping of constants when using glibc's or *BSD's -// byte swapping macros. The actual write is done in an inline function -// to make type checking of the buf pointer possible similarly to readXXYe() -// functions. - -#define write16be(buf, num) write16ne((buf), conv16be(num)) -#define write16le(buf, num) write16ne((buf), conv16le(num)) -#define write32be(buf, num) write32ne((buf), conv32be(num)) -#define write32le(buf, num) write32ne((buf), conv32le(num)) -#define write64be(buf, num) write64ne((buf), conv64be(num)) -#define write64le(buf, num) write64ne((buf), conv64le(num)) - - static inline void write16ne(uint8_t *buf, uint16_t num) { +#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \ + && defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) *(uint16_t *)buf = num; +#else + memcpy(buf, &num, sizeof(num)); +#endif return; } @@ -265,7 +262,12 @@ write16ne(uint8_t *buf, uint16_t num) static inline void write32ne(uint8_t *buf, uint32_t num) { +#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \ + && defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) *(uint32_t *)buf = num; +#else + memcpy(buf, &num, sizeof(num)); +#endif return; } @@ -273,90 +275,114 @@ write32ne(uint8_t *buf, uint32_t num) static inline void write64ne(uint8_t *buf, uint64_t num) { +#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \ + && defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) *(uint64_t *)buf = num; +#else + memcpy(buf, &num, sizeof(num)); +#endif return; } -//////////////////////////////// -// Unaligned reads and writes // -//////////////////////////////// - -// NOTE: TUKLIB_FAST_UNALIGNED_ACCESS indicates only support for 16-bit and -// 32-bit unaligned integer loads and stores. It's possible that 64-bit -// unaligned access doesn't work or is slower than byte-by-byte access. -// Since unaligned 64-bit is probably not needed as often as 16-bit or -// 32-bit, we simply don't support 64-bit unaligned access for now. -#ifdef TUKLIB_FAST_UNALIGNED_ACCESS -# define unaligned_read16be read16be -# define unaligned_read16le read16le -# define unaligned_read32be read32be -# define unaligned_read32le read32le -# define unaligned_write16be write16be -# define unaligned_write16le write16le -# define unaligned_write32be write32be -# define unaligned_write32le write32le - -#else - static inline uint16_t -unaligned_read16be(const uint8_t *buf) +read16be(const uint8_t *buf) { +#if defined(WORDS_BIGENDIAN) || defined(TUKLIB_FAST_UNALIGNED_ACCESS) + uint16_t num = read16ne(buf); + return conv16be(num); +#else uint16_t num = ((uint16_t)buf[0] << 8) | (uint16_t)buf[1]; return num; +#endif } static inline uint16_t -unaligned_read16le(const uint8_t *buf) +read16le(const uint8_t *buf) { +#if !defined(WORDS_BIGENDIAN) || defined(TUKLIB_FAST_UNALIGNED_ACCESS) + uint16_t num = read16ne(buf); + return conv16le(num); +#else uint16_t num = ((uint16_t)buf[0]) | ((uint16_t)buf[1] << 8); return num; +#endif } static inline uint32_t -unaligned_read32be(const uint8_t *buf) +read32be(const uint8_t *buf) { +#if defined(WORDS_BIGENDIAN) || defined(TUKLIB_FAST_UNALIGNED_ACCESS) + uint32_t num = read32ne(buf); + return conv32be(num); +#else uint32_t num = (uint32_t)buf[0] << 24; num |= (uint32_t)buf[1] << 16; num |= (uint32_t)buf[2] << 8; num |= (uint32_t)buf[3]; return num; +#endif } static inline uint32_t -unaligned_read32le(const uint8_t *buf) +read32le(const uint8_t *buf) { +#if !defined(WORDS_BIGENDIAN) || defined(TUKLIB_FAST_UNALIGNED_ACCESS) + uint32_t num = read32ne(buf); + return conv32le(num); +#else uint32_t num = (uint32_t)buf[0]; num |= (uint32_t)buf[1] << 8; num |= (uint32_t)buf[2] << 16; num |= (uint32_t)buf[3] << 24; return num; +#endif } +// NOTE: Possible byte swapping must be done in a macro to allow the compiler +// to optimize byte swapping of constants when using glibc's or *BSD's +// byte swapping macros. The actual write is done in an inline function +// to make type checking of the buf pointer possible. +#if defined(WORDS_BIGENDIAN) || defined(TUKLIB_FAST_UNALIGNED_ACCESS) +# define write16be(buf, num) write16ne(buf, conv16be(num)) +# define write32be(buf, num) write32ne(buf, conv32be(num)) +#endif + +#if !defined(WORDS_BIGENDIAN) || defined(TUKLIB_FAST_UNALIGNED_ACCESS) +# define write16le(buf, num) write16ne(buf, conv16le(num)) +# define write32le(buf, num) write32ne(buf, conv32le(num)) +#endif + + +#ifndef write16be static inline void -unaligned_write16be(uint8_t *buf, uint16_t num) +write16be(uint8_t *buf, uint16_t num) { buf[0] = (uint8_t)(num >> 8); buf[1] = (uint8_t)num; return; } +#endif +#ifndef write16le static inline void -unaligned_write16le(uint8_t *buf, uint16_t num) +write16le(uint8_t *buf, uint16_t num) { buf[0] = (uint8_t)num; buf[1] = (uint8_t)(num >> 8); return; } +#endif +#ifndef write32be static inline void -unaligned_write32be(uint8_t *buf, uint32_t num) +write32be(uint8_t *buf, uint32_t num) { buf[0] = (uint8_t)(num >> 24); buf[1] = (uint8_t)(num >> 16); @@ -364,10 +390,12 @@ unaligned_write32be(uint8_t *buf, uint32_t num) buf[3] = (uint8_t)num; return; } +#endif +#ifndef write32le static inline void -unaligned_write32le(uint8_t *buf, uint32_t num) +write32le(uint8_t *buf, uint32_t num) { buf[0] = (uint8_t)num; buf[1] = (uint8_t)(num >> 8); @@ -375,10 +403,184 @@ unaligned_write32le(uint8_t *buf, uint32_t num) buf[3] = (uint8_t)(num >> 24); return; } - #endif +////////////////////////////// +// Aligned reads and writes // +////////////////////////////// + +// Separate functions for aligned reads and writes are provided since on +// strict-align archs aligned access is much faster than unaligned access. +// +// Just like in the unaligned case, memcpy() is needed to avoid +// strict aliasing violations. However, on archs that don't support +// unaligned access the compiler cannot know that the pointers given +// to memcpy() are aligned which results in slow code. As of C11 there is +// no standard way to tell the compiler that we know that the address is +// aligned but some compilers have language extensions to do that. With +// such language extensions the memcpy() method gives excellent results. +// +// What to do on a strict-align system when no known language extentensions +// are available? Falling back to byte-by-byte access would be safe but ruin +// optimizations that have been made specifically with aligned access in mind. +// As a compromise, aligned reads will fall back to non-compliant type punning +// but aligned writes will be byte-by-byte, that is, fast reads are preferred +// over fast writes. This obviously isn't great but hopefully it's a working +// compromise for now. +// +// __builtin_assume_aligned is support by GCC >= 4.7 and clang >= 3.6. +#ifdef HAVE___BUILTIN_ASSUME_ALIGNED +# define tuklib_memcpy_aligned(dest, src, size) \ + memcpy(dest, __builtin_assume_aligned(src, size), size) +#else +# define tuklib_memcpy_aligned(dest, src, size) \ + memcpy(dest, src, size) +# ifndef TUKLIB_FAST_UNALIGNED_ACCESS +# define TUKLIB_USE_UNSAFE_ALIGNED_READS 1 +# endif +#endif + + +static inline uint16_t +aligned_read16ne(const uint8_t *buf) +{ +#if defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) \ + || defined(TUKLIB_USE_UNSAFE_ALIGNED_READS) + return *(const uint16_t *)buf; +#else + uint16_t num; + tuklib_memcpy_aligned(&num, buf, sizeof(num)); + return num; +#endif +} + + +static inline uint32_t +aligned_read32ne(const uint8_t *buf) +{ +#if defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) \ + || defined(TUKLIB_USE_UNSAFE_ALIGNED_READS) + return *(const uint32_t *)buf; +#else + uint32_t num; + tuklib_memcpy_aligned(&num, buf, sizeof(num)); + return num; +#endif +} + + +static inline uint64_t +aligned_read64ne(const uint8_t *buf) +{ +#if defined(TUKLIB_USE_UNSAFE_TYPE_PUNNING) \ + || defined(TUKLIB_USE_UNSAFE_ALIGNED_READS) + return *(const uint64_t *)buf; +#else + uint64_t num; + tuklib_memcpy_aligned(&num, buf, sizeof(num)); + return num; +#endif +} + + +static inline void +aligned_write16ne(uint8_t *buf, uint16_t num) +{ +#ifdef TUKLIB_USE_UNSAFE_TYPE_PUNNING + *(uint16_t *)buf = num; +#else + tuklib_memcpy_aligned(buf, &num, sizeof(num)); +#endif + return; +} + + +static inline void +aligned_write32ne(uint8_t *buf, uint32_t num) +{ +#ifdef TUKLIB_USE_UNSAFE_TYPE_PUNNING + *(uint32_t *)buf = num; +#else + tuklib_memcpy_aligned(buf, &num, sizeof(num)); +#endif + return; +} + + +static inline void +aligned_write64ne(uint8_t *buf, uint64_t num) +{ +#ifdef TUKLIB_USE_UNSAFE_TYPE_PUNNING + *(uint64_t *)buf = num; +#else + tuklib_memcpy_aligned(buf, &num, sizeof(num)); +#endif + return; +} + + +static inline uint16_t +aligned_read16be(const uint8_t *buf) +{ + uint16_t num = aligned_read16ne(buf); + return conv16be(num); +} + + +static inline uint16_t +aligned_read16le(const uint8_t *buf) +{ + uint16_t num = aligned_read16ne(buf); + return conv16le(num); +} + + +static inline uint32_t +aligned_read32be(const uint8_t *buf) +{ + uint32_t num = aligned_read32ne(buf); + return conv32be(num); +} + + +static inline uint32_t +aligned_read32le(const uint8_t *buf) +{ + uint32_t num = aligned_read32ne(buf); + return conv32le(num); +} + + +static inline uint64_t +aligned_read64be(const uint8_t *buf) +{ + uint64_t num = aligned_read64ne(buf); + return conv64be(num); +} + + +static inline uint64_t +aligned_read64le(const uint8_t *buf) +{ + uint64_t num = aligned_read64ne(buf); + return conv64le(num); +} + + +// These need to be macros like in the unaligned case. +#define aligned_write16be(buf, num) aligned_write16ne((buf), conv16be(num)) +#define aligned_write16le(buf, num) aligned_write16ne((buf), conv16le(num)) +#define aligned_write32be(buf, num) aligned_write32ne((buf), conv32be(num)) +#define aligned_write32le(buf, num) aligned_write32ne((buf), conv32le(num)) +#define aligned_write64be(buf, num) aligned_write64ne((buf), conv64be(num)) +#define aligned_write64le(buf, num) aligned_write64ne((buf), conv64le(num)) + + +//////////////////// +// Bit operations // +//////////////////// + static inline uint32_t bsr32(uint32_t n) { @@ -391,7 +593,7 @@ bsr32(uint32_t n) // multiple architectures. On x86, __builtin_clz() ^ 31U becomes // either plain BSR (so the XOR gets optimized away) or LZCNT and // XOR (if -march indicates that SSE4a instructions are supported). - return __builtin_clz(n) ^ 31U; + return (uint32_t)__builtin_clz(n) ^ 31U; #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) uint32_t i; @@ -401,27 +603,27 @@ bsr32(uint32_t n) #else uint32_t i = 31; - if ((n & UINT32_C(0xFFFF0000)) == 0) { + if ((n & 0xFFFF0000) == 0) { n <<= 16; i = 15; } - if ((n & UINT32_C(0xFF000000)) == 0) { + if ((n & 0xFF000000) == 0) { n <<= 8; i -= 8; } - if ((n & UINT32_C(0xF0000000)) == 0) { + if ((n & 0xF0000000) == 0) { n <<= 4; i -= 4; } - if ((n & UINT32_C(0xC0000000)) == 0) { + if ((n & 0xC0000000) == 0) { n <<= 2; i -= 2; } - if ((n & UINT32_C(0x80000000)) == 0) + if ((n & 0x80000000) == 0) --i; return i; @@ -436,7 +638,7 @@ clz32(uint32_t n) return _bit_scan_reverse(n) ^ 31U; #elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX == UINT32_MAX - return __builtin_clz(n); + return (uint32_t)__builtin_clz(n); #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) uint32_t i; @@ -448,27 +650,27 @@ clz32(uint32_t n) #else uint32_t i = 0; - if ((n & UINT32_C(0xFFFF0000)) == 0) { + if ((n & 0xFFFF0000) == 0) { n <<= 16; i = 16; } - if ((n & UINT32_C(0xFF000000)) == 0) { + if ((n & 0xFF000000) == 0) { n <<= 8; i += 8; } - if ((n & UINT32_C(0xF0000000)) == 0) { + if ((n & 0xF0000000) == 0) { n <<= 4; i += 4; } - if ((n & UINT32_C(0xC0000000)) == 0) { + if ((n & 0xC0000000) == 0) { n <<= 2; i += 2; } - if ((n & UINT32_C(0x80000000)) == 0) + if ((n & 0x80000000) == 0) ++i; return i; @@ -483,7 +685,7 @@ ctz32(uint32_t n) return _bit_scan_forward(n); #elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX >= UINT32_MAX - return __builtin_ctz(n); + return (uint32_t)__builtin_ctz(n); #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) uint32_t i; @@ -493,27 +695,27 @@ ctz32(uint32_t n) #else uint32_t i = 0; - if ((n & UINT32_C(0x0000FFFF)) == 0) { + if ((n & 0x0000FFFF) == 0) { n >>= 16; i = 16; } - if ((n & UINT32_C(0x000000FF)) == 0) { + if ((n & 0x000000FF) == 0) { n >>= 8; i += 8; } - if ((n & UINT32_C(0x0000000F)) == 0) { + if ((n & 0x0000000F) == 0) { n >>= 4; i += 4; } - if ((n & UINT32_C(0x00000003)) == 0) { + if ((n & 0x00000003) == 0) { n >>= 2; i += 2; } - if ((n & UINT32_C(0x00000001)) == 0) + if ((n & 0x00000001) == 0) ++i; return i; diff --git a/src/dependencies/cmliblzma/config.h.in b/src/dependencies/cmliblzma/config.h.in index 06f7fcb..50c3840 100644 --- a/src/dependencies/cmliblzma/config.h.in +++ b/src/dependencies/cmliblzma/config.h.in @@ -7,13 +7,11 @@ #cmakedefine HAVE_INT16_T #cmakedefine HAVE_INT32_T #cmakedefine HAVE_INT64_T -#cmakedefine HAVE_INTMAX_T #cmakedefine HAVE_UINT8_T #cmakedefine HAVE_UINT16_T #cmakedefine HAVE_UINT32_T #cmakedefine HAVE_UINT64_T -#cmakedefine HAVE_UINTMAX_T /* We might have the types we want under other spellings. */ #cmakedefine HAVE___INT64 @@ -166,18 +164,6 @@ typedef unsigned char uint8_t; #error No 8-bit unsigned integer type was found. #endif -/* Define intmax_t and uintmax_t if they are not already defined. */ -#if !defined(HAVE_INTMAX_T) -typedef int64_t intmax_t; -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#endif - -#if !defined(HAVE_UINTMAX_T) -typedef uint64_t uintmax_t; -#endif - - #cmakedefine uintptr_t @uintptr_t@ #cmakedefine WORDS_BIGENDIAN 1 diff --git a/src/dependencies/cmliblzma/liblzma/api/lzma.h b/src/dependencies/cmliblzma/liblzma/api/lzma.h index aa88e42..122dab8 100644 --- a/src/dependencies/cmliblzma/liblzma/api/lzma.h +++ b/src/dependencies/cmliblzma/liblzma/api/lzma.h @@ -224,7 +224,8 @@ # else # define lzma_nothrow throw() # endif -# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +# elif defined(__GNUC__) && (__GNUC__ > 3 \ + || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) # define lzma_nothrow __attribute__((__nothrow__)) # else # define lzma_nothrow @@ -241,7 +242,7 @@ * break anything if these are sometimes enabled and sometimes not, only * affects warnings and optimizations. */ -#if __GNUC__ >= 3 +#if defined(__GNUC__) && __GNUC__ >= 3 # ifndef lzma_attribute # define lzma_attribute(attr) __attribute__(attr) # endif diff --git a/src/dependencies/cmliblzma/liblzma/api/lzma/block.h b/src/dependencies/cmliblzma/liblzma/api/lzma/block.h index 7bdcfd7..962f387 100644 --- a/src/dependencies/cmliblzma/liblzma/api/lzma/block.h +++ b/src/dependencies/cmliblzma/liblzma/api/lzma/block.h @@ -448,7 +448,7 @@ extern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block) * - LZMA_MEM_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID - * that is not supported by this buid of liblzma. Initializing + * that is not supported by this build of liblzma. Initializing * the encoder failed. * - LZMA_PROG_ERROR */ diff --git a/src/dependencies/cmliblzma/liblzma/api/lzma/filter.h b/src/dependencies/cmliblzma/liblzma/api/lzma/filter.h index 4e78752..8c85931 100644 --- a/src/dependencies/cmliblzma/liblzma/api/lzma/filter.h +++ b/src/dependencies/cmliblzma/liblzma/api/lzma/filter.h @@ -341,9 +341,10 @@ extern LZMA_API(lzma_ret) lzma_properties_encode( * \param filter filter->id must have been set to the correct * Filter ID. filter->options doesn't need to be * initialized (it's not freed by this function). The - * decoded options will be stored to filter->options. - * filter->options is set to NULL if there are no - * properties or if an error occurs. + * decoded options will be stored in filter->options; + * it's application's responsibility to free it when + * appropriate. filter->options is set to NULL if + * there are no properties or if an error occurs. * \param allocator Custom memory allocator used to allocate the * options. Set to NULL to use the default malloc(), * and in case of an error, also free(). diff --git a/src/dependencies/cmliblzma/liblzma/api/lzma/hardware.h b/src/dependencies/cmliblzma/liblzma/api/lzma/hardware.h index 5321d9a..47481f2 100644 --- a/src/dependencies/cmliblzma/liblzma/api/lzma/hardware.h +++ b/src/dependencies/cmliblzma/liblzma/api/lzma/hardware.h @@ -6,7 +6,7 @@ * ways to limit the resource usage. Applications linking against liblzma * need to do the actual decisions how much resources to let liblzma to use. * To ease making these decisions, liblzma provides functions to find out - * the relevant capabilities of the underlaying hardware. Currently there + * the relevant capabilities of the underlying hardware. Currently there * is only a function to find out the amount of RAM, but in the future there * will be also a function to detect how many concurrent threads the system * can run. diff --git a/src/dependencies/cmliblzma/liblzma/api/lzma/lzma12.h b/src/dependencies/cmliblzma/liblzma/api/lzma/lzma12.h index 4e32fa3..df5f23b 100644 --- a/src/dependencies/cmliblzma/liblzma/api/lzma/lzma12.h +++ b/src/dependencies/cmliblzma/liblzma/api/lzma/lzma12.h @@ -301,7 +301,7 @@ typedef struct { * (2^ pb =2^2=4), which is often a good choice when there's * no better guess. * - * When the aligment is known, setting pb accordingly may reduce + * When the alignment is known, setting pb accordingly may reduce * the file size a little. E.g. with text files having one-byte * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can * improve compression slightly. For UTF-16 text, pb=1 is a good diff --git a/src/dependencies/cmliblzma/liblzma/api/lzma/version.h b/src/dependencies/cmliblzma/liblzma/api/lzma/version.h index 143c7de..2bf3eae 100644 --- a/src/dependencies/cmliblzma/liblzma/api/lzma/version.h +++ b/src/dependencies/cmliblzma/liblzma/api/lzma/version.h @@ -22,7 +22,7 @@ */ #define LZMA_VERSION_MAJOR 5 #define LZMA_VERSION_MINOR 2 -#define LZMA_VERSION_PATCH 4 +#define LZMA_VERSION_PATCH 5 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE #ifndef LZMA_VERSION_COMMIT diff --git a/src/dependencies/cmliblzma/liblzma/api/lzma/vli.h b/src/dependencies/cmliblzma/liblzma/api/lzma/vli.h index 9ad13f2..1b7a952 100644 --- a/src/dependencies/cmliblzma/liblzma/api/lzma/vli.h +++ b/src/dependencies/cmliblzma/liblzma/api/lzma/vli.h @@ -54,7 +54,7 @@ * * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the - * underlaying integer type. + * underlying integer type. * * lzma_vli will be uint64_t for the foreseeable future. If a bigger size * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will diff --git a/src/dependencies/cmliblzma/liblzma/check/crc32_fast.c b/src/dependencies/cmliblzma/liblzma/check/crc32_fast.c index 3de0263..eed7350 100644 --- a/src/dependencies/cmliblzma/liblzma/check/crc32_fast.c +++ b/src/dependencies/cmliblzma/liblzma/check/crc32_fast.c @@ -49,7 +49,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) // Calculate the CRC32 using the slice-by-eight algorithm. while (buf < limit) { - crc ^= *(const uint32_t *)(buf); + crc ^= aligned_read32ne(buf); buf += 4; crc = lzma_crc32_table[7][A(crc)] @@ -57,7 +57,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) ^ lzma_crc32_table[5][C(crc)] ^ lzma_crc32_table[4][D(crc)]; - const uint32_t tmp = *(const uint32_t *)(buf); + const uint32_t tmp = aligned_read32ne(buf); buf += 4; // At least with some compilers, it is critical for diff --git a/src/dependencies/cmliblzma/liblzma/check/crc32_table.c b/src/dependencies/cmliblzma/liblzma/check/crc32_table.c index 368874e..b11762a 100644 --- a/src/dependencies/cmliblzma/liblzma/check/crc32_table.c +++ b/src/dependencies/cmliblzma/liblzma/check/crc32_table.c @@ -12,6 +12,9 @@ #include "common.h" +// Having the declaration here silences clang -Wmissing-variable-declarations. +extern const uint32_t lzma_crc32_table[8][256]; + #ifdef WORDS_BIGENDIAN # include "crc32_table_be.h" #else diff --git a/src/dependencies/cmliblzma/liblzma/check/crc64_fast.c b/src/dependencies/cmliblzma/liblzma/check/crc64_fast.c index 52af29e..8af54cd 100644 --- a/src/dependencies/cmliblzma/liblzma/check/crc64_fast.c +++ b/src/dependencies/cmliblzma/liblzma/check/crc64_fast.c @@ -47,9 +47,9 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) while (buf < limit) { #ifdef WORDS_BIGENDIAN const uint32_t tmp = (crc >> 32) - ^ *(const uint32_t *)(buf); + ^ aligned_read32ne(buf); #else - const uint32_t tmp = crc ^ *(const uint32_t *)(buf); + const uint32_t tmp = crc ^ aligned_read32ne(buf); #endif buf += 4; diff --git a/src/dependencies/cmliblzma/liblzma/check/crc64_table.c b/src/dependencies/cmliblzma/liblzma/check/crc64_table.c index 1fbcd94..7560eb0 100644 --- a/src/dependencies/cmliblzma/liblzma/check/crc64_table.c +++ b/src/dependencies/cmliblzma/liblzma/check/crc64_table.c @@ -12,6 +12,9 @@ #include "common.h" +// Having the declaration here silences clang -Wmissing-variable-declarations. +extern const uint64_t lzma_crc64_table[4][256]; + #ifdef WORDS_BIGENDIAN # include "crc64_table_be.h" #else diff --git a/src/dependencies/cmliblzma/liblzma/common/alone_decoder.c b/src/dependencies/cmliblzma/liblzma/common/alone_decoder.c index 77d0a9b..239b230 100644 --- a/src/dependencies/cmliblzma/liblzma/common/alone_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/alone_decoder.c @@ -50,8 +50,7 @@ typedef struct { static lzma_ret -alone_decode(void *coder_ptr, - const lzma_allocator *allocator lzma_attribute((__unused__)), +alone_decode(void *coder_ptr, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, diff --git a/src/dependencies/cmliblzma/liblzma/common/alone_encoder.c b/src/dependencies/cmliblzma/liblzma/common/alone_encoder.c index 4853cfd..96c1db7 100644 --- a/src/dependencies/cmliblzma/liblzma/common/alone_encoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/alone_encoder.c @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// // -/// \file alone_decoder.c -/// \brief Decoder for LZMA_Alone files +/// \file alone_encoder.c +/// \brief Encoder for LZMA_Alone files // // Author: Lasse Collin // @@ -31,8 +31,7 @@ typedef struct { static lzma_ret -alone_encode(void *coder_ptr, - const lzma_allocator *allocator lzma_attribute((__unused__)), +alone_encode(void *coder_ptr, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, @@ -122,7 +121,7 @@ alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator, if (d != UINT32_MAX) ++d; - unaligned_write32le(coder->header + 1, d); + write32le(coder->header + 1, d); // - Uncompressed size (always unknown and using EOPM) memset(coder->header + 1 + 4, 0xFF, 8); diff --git a/src/dependencies/cmliblzma/liblzma/common/block_header_decoder.c b/src/dependencies/cmliblzma/liblzma/common/block_header_decoder.c index 1dd982f..2e1135d 100644 --- a/src/dependencies/cmliblzma/liblzma/common/block_header_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/block_header_decoder.c @@ -67,7 +67,7 @@ lzma_block_header_decode(lzma_block *block, const size_t in_size = block->header_size - 4; // Verify CRC32 - if (lzma_crc32(in, in_size, 0) != unaligned_read32le(in + in_size)) + if (lzma_crc32(in, in_size, 0) != read32le(in + in_size)) return LZMA_DATA_ERROR; // Check for unsupported flags. @@ -98,7 +98,7 @@ lzma_block_header_decode(lzma_block *block, block->uncompressed_size = LZMA_VLI_UNKNOWN; // Filter Flags - const size_t filter_count = (in[1] & 3) + 1; + const size_t filter_count = (in[1] & 3U) + 1; for (size_t i = 0; i < filter_count; ++i) { const lzma_ret ret = lzma_filter_flags_decode( &block->filters[i], allocator, diff --git a/src/dependencies/cmliblzma/liblzma/common/block_header_encoder.c b/src/dependencies/cmliblzma/liblzma/common/block_header_encoder.c index 5c5f542..160425d 100644 --- a/src/dependencies/cmliblzma/liblzma/common/block_header_encoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/block_header_encoder.c @@ -126,7 +126,7 @@ lzma_block_header_encode(const lzma_block *block, uint8_t *out) memzero(out + out_pos, out_size - out_pos); // CRC32 - unaligned_write32le(out + out_size, lzma_crc32(out, out_size, 0)); + write32le(out + out_size, lzma_crc32(out, out_size, 0)); return LZMA_OK; } diff --git a/src/dependencies/cmliblzma/liblzma/common/block_util.c b/src/dependencies/cmliblzma/liblzma/common/block_util.c index 00c7fe8..acb3111 100644 --- a/src/dependencies/cmliblzma/liblzma/common/block_util.c +++ b/src/dependencies/cmliblzma/liblzma/common/block_util.c @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // -/// \file block_header.c +/// \file block_util.c /// \brief Utility functions to handle lzma_block // // Author: Lasse Collin diff --git a/src/dependencies/cmliblzma/liblzma/common/common.c b/src/dependencies/cmliblzma/liblzma/common/common.c index 57e3f8e..cf714e5 100644 --- a/src/dependencies/cmliblzma/liblzma/common/common.c +++ b/src/dependencies/cmliblzma/liblzma/common/common.c @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // -/// \file common.h +/// \file common.c /// \brief Common functions needed in many places in liblzma // // Author: Lasse Collin @@ -99,7 +99,11 @@ lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos, const size_t out_avail = out_size - *out_pos; const size_t copy_size = my_min(in_avail, out_avail); - memcpy(out + *out_pos, in + *in_pos, copy_size); + // Call memcpy() only if there is something to copy. If there is + // nothing to copy, in or out might be NULL and then the memcpy() + // call would trigger undefined behavior. + if (copy_size > 0) + memcpy(out + *out_pos, in + *in_pos, copy_size); *in_pos += copy_size; *out_pos += copy_size; diff --git a/src/dependencies/cmliblzma/liblzma/common/common.h b/src/dependencies/cmliblzma/liblzma/common/common.h index dde3ae0..b3d3b7a 100644 --- a/src/dependencies/cmliblzma/liblzma/common/common.h +++ b/src/dependencies/cmliblzma/liblzma/common/common.h @@ -14,6 +14,7 @@ #define LZMA_COMMON_H #include "sysdefs.h" +#include "mythread.h" #include "tuklib_integer.h" #if defined(_WIN32) || defined(__CYGWIN__) diff --git a/src/dependencies/cmliblzma/liblzma/common/filter_common.h b/src/dependencies/cmliblzma/liblzma/common/filter_common.h index 42a26a2..9390305 100644 --- a/src/dependencies/cmliblzma/liblzma/common/filter_common.h +++ b/src/dependencies/cmliblzma/liblzma/common/filter_common.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // -/// \file filter_common.c +/// \file filter_common.h /// \brief Filter-specific stuff common for both encoder and decoder // // Author: Lasse Collin diff --git a/src/dependencies/cmliblzma/liblzma/common/filter_decoder.h b/src/dependencies/cmliblzma/liblzma/common/filter_decoder.h index a2e255f..2dac602 100644 --- a/src/dependencies/cmliblzma/liblzma/common/filter_decoder.h +++ b/src/dependencies/cmliblzma/liblzma/common/filter_decoder.h @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// // -/// \file filter_decoder.c +/// \file filter_decoder.h /// \brief Filter ID mapping to filter-specific functions // // Author: Lasse Collin diff --git a/src/dependencies/cmliblzma/liblzma/common/filter_flags_encoder.c b/src/dependencies/cmliblzma/liblzma/common/filter_flags_encoder.c index d110566..b57b9fd 100644 --- a/src/dependencies/cmliblzma/liblzma/common/filter_flags_encoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/filter_flags_encoder.c @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// // /// \file filter_flags_encoder.c -/// \brief Decodes a Filter Flags field +/// \brief Encodes a Filter Flags field // // Author: Lasse Collin // diff --git a/src/dependencies/cmliblzma/liblzma/common/hardware_physmem.c b/src/dependencies/cmliblzma/liblzma/common/hardware_physmem.c index 7405b65..a2bbbe2 100644 --- a/src/dependencies/cmliblzma/liblzma/common/hardware_physmem.c +++ b/src/dependencies/cmliblzma/liblzma/common/hardware_physmem.c @@ -19,7 +19,7 @@ extern LZMA_API(uint64_t) lzma_physmem(void) { // It is simpler to make lzma_physmem() a wrapper for - // tuklib_physmem() than to hack appropriate symbol visiblity + // tuklib_physmem() than to hack appropriate symbol visibility // support for the tuklib modules. return tuklib_physmem(); } diff --git a/src/dependencies/cmliblzma/liblzma/common/index.c b/src/dependencies/cmliblzma/liblzma/common/index.c index 26e4e51..a41e8f3 100644 --- a/src/dependencies/cmliblzma/liblzma/common/index.c +++ b/src/dependencies/cmliblzma/liblzma/common/index.c @@ -105,7 +105,7 @@ typedef struct { typedef struct { - /// Every index_stream is a node in the tree of Sreams. + /// Every index_stream is a node in the tree of Streams. index_tree_node node; /// Number of this Stream (first one is 1) @@ -166,7 +166,7 @@ struct lzma_index_s { lzma_vli index_list_size; /// How many Records to allocate at once in lzma_index_append(). - /// This defaults to INDEX_GROUP_SIZE but can be overriden with + /// This defaults to INDEX_GROUP_SIZE but can be overridden with /// lzma_index_prealloc(). size_t prealloc; @@ -825,8 +825,8 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src, s->groups.root = &newg->node; } - if (s->groups.rightmost == &g->node) - s->groups.rightmost = &newg->node; + assert(s->groups.rightmost == &g->node); + s->groups.rightmost = &newg->node; lzma_free(g, allocator); diff --git a/src/dependencies/cmliblzma/liblzma/common/memcmplen.h b/src/dependencies/cmliblzma/liblzma/common/memcmplen.h index c1efc9e..dcfd8d6 100644 --- a/src/dependencies/cmliblzma/liblzma/common/memcmplen.h +++ b/src/dependencies/cmliblzma/liblzma/common/memcmplen.h @@ -61,8 +61,7 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2, // to __builtin_clzll(). #define LZMA_MEMCMPLEN_EXTRA 8 while (len < limit) { - const uint64_t x = *(const uint64_t *)(buf1 + len) - - *(const uint64_t *)(buf2 + len); + const uint64_t x = read64ne(buf1 + len) - read64ne(buf2 + len); if (x != 0) { # if defined(_M_X64) // MSVC or Intel C compiler on Windows unsigned long tmp; @@ -99,15 +98,7 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2, _mm_loadu_si128((const __m128i *)(buf2 + len)))); if (x != 0) { -# if defined(__INTEL_COMPILER) - len += _bit_scan_forward(x); -# elif defined(_MSC_VER) - unsigned long tmp; - _BitScanForward(&tmp, x); - len += tmp; -# else - len += __builtin_ctz(x); -# endif + len += ctz32(x); return my_min(len, limit); } @@ -120,8 +111,7 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2, // Generic 32-bit little endian method # define LZMA_MEMCMPLEN_EXTRA 4 while (len < limit) { - uint32_t x = *(const uint32_t *)(buf1 + len) - - *(const uint32_t *)(buf2 + len); + uint32_t x = read32ne(buf1 + len) - read32ne(buf2 + len); if (x != 0) { if ((x & 0xFFFF) == 0) { len += 2; @@ -143,8 +133,7 @@ lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2, // Generic 32-bit big endian method # define LZMA_MEMCMPLEN_EXTRA 4 while (len < limit) { - uint32_t x = *(const uint32_t *)(buf1 + len) - ^ *(const uint32_t *)(buf2 + len); + uint32_t x = read32ne(buf1 + len) ^ read32ne(buf2 + len); if (x != 0) { if ((x & 0xFFFF0000) == 0) { len += 2; diff --git a/src/dependencies/cmliblzma/liblzma/common/stream_encoder_mt.c b/src/dependencies/cmliblzma/liblzma/common/stream_encoder_mt.c index 2efe44c..01e4033 100644 --- a/src/dependencies/cmliblzma/liblzma/common/stream_encoder_mt.c +++ b/src/dependencies/cmliblzma/liblzma/common/stream_encoder_mt.c @@ -700,7 +700,7 @@ stream_encode_mt(void *coder_ptr, const lzma_allocator *allocator, ret = coder->thread_error; if (ret != LZMA_OK) { assert(ret != LZMA_STREAM_END); - break; + break; // Break out of mythread_sync. } // Try to read compressed data to out[]. @@ -958,7 +958,7 @@ stream_encoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator, // Validate the filter chain so that we can give an error in this // function instead of delaying it to the first call to lzma_code(). // The memory usage calculation verifies the filter chain as - // a side effect so we take advatange of that. + // a side effect so we take advantage of that. if (lzma_raw_encoder_memusage(filters) == UINT64_MAX) return LZMA_OPTIONS_ERROR; diff --git a/src/dependencies/cmliblzma/liblzma/common/stream_flags_decoder.c b/src/dependencies/cmliblzma/liblzma/common/stream_flags_decoder.c index 1bc2f97..4e43e35 100644 --- a/src/dependencies/cmliblzma/liblzma/common/stream_flags_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/stream_flags_decoder.c @@ -38,7 +38,7 @@ lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in) // and unsupported files. const uint32_t crc = lzma_crc32(in + sizeof(lzma_header_magic), LZMA_STREAM_FLAGS_SIZE, 0); - if (crc != unaligned_read32le(in + sizeof(lzma_header_magic) + if (crc != read32le(in + sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE)) return LZMA_DATA_ERROR; @@ -67,7 +67,7 @@ lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in) // CRC32 const uint32_t crc = lzma_crc32(in + sizeof(uint32_t), sizeof(uint32_t) + LZMA_STREAM_FLAGS_SIZE, 0); - if (crc != unaligned_read32le(in)) + if (crc != read32le(in)) return LZMA_DATA_ERROR; // Stream Flags @@ -75,7 +75,7 @@ lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in) return LZMA_OPTIONS_ERROR; // Backward Size - options->backward_size = unaligned_read32le(in + sizeof(uint32_t)); + options->backward_size = read32le(in + sizeof(uint32_t)); options->backward_size = (options->backward_size + 1) * 4; return LZMA_OK; diff --git a/src/dependencies/cmliblzma/liblzma/common/stream_flags_encoder.c b/src/dependencies/cmliblzma/liblzma/common/stream_flags_encoder.c index 4e71715..b98ab17 100644 --- a/src/dependencies/cmliblzma/liblzma/common/stream_flags_encoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/stream_flags_encoder.c @@ -46,8 +46,8 @@ lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out) const uint32_t crc = lzma_crc32(out + sizeof(lzma_header_magic), LZMA_STREAM_FLAGS_SIZE, 0); - unaligned_write32le(out + sizeof(lzma_header_magic) - + LZMA_STREAM_FLAGS_SIZE, crc); + write32le(out + sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE, + crc); return LZMA_OK; } @@ -66,7 +66,7 @@ lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) if (!is_backward_size_valid(options)) return LZMA_PROG_ERROR; - unaligned_write32le(out + 4, options->backward_size / 4 - 1); + write32le(out + 4, options->backward_size / 4 - 1); // Stream Flags if (stream_flags_encode(options, out + 2 * 4)) @@ -76,7 +76,7 @@ lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out) const uint32_t crc = lzma_crc32( out + 4, 4 + LZMA_STREAM_FLAGS_SIZE, 0); - unaligned_write32le(out, crc); + write32le(out, crc); // Magic memcpy(out + 2 * 4 + LZMA_STREAM_FLAGS_SIZE, diff --git a/src/dependencies/cmliblzma/liblzma/common/vli_decoder.c b/src/dependencies/cmliblzma/liblzma/common/vli_decoder.c index c181828..af2799d 100644 --- a/src/dependencies/cmliblzma/liblzma/common/vli_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/common/vli_decoder.c @@ -72,7 +72,7 @@ lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos, // corrupt. // // If we need bigger integers in future, old versions liblzma - // will confusingly indicate the file being corrupt istead of + // will confusingly indicate the file being corrupt instead of // unsupported. I suppose it's still better this way, because // in the foreseeable future (writing this in 2008) the only // reason why files would appear having over 63-bit integers diff --git a/src/dependencies/cmliblzma/liblzma/delta/delta_decoder.c b/src/dependencies/cmliblzma/liblzma/delta/delta_decoder.c index 6859afa..13d8a28 100644 --- a/src/dependencies/cmliblzma/liblzma/delta/delta_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/delta/delta_decoder.c @@ -70,7 +70,7 @@ lzma_delta_props_decode(void **options, const lzma_allocator *allocator, return LZMA_MEM_ERROR; opt->type = LZMA_DELTA_TYPE_BYTE; - opt->dist = props[0] + 1; + opt->dist = props[0] + 1U; *options = opt; diff --git a/src/dependencies/cmliblzma/liblzma/lz/lz_decoder.c b/src/dependencies/cmliblzma/liblzma/lz/lz_decoder.c index c708644..09b5743 100644 --- a/src/dependencies/cmliblzma/liblzma/lz/lz_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/lz/lz_decoder.c @@ -91,11 +91,17 @@ decode_buffer(lzma_coder *coder, in, in_pos, in_size); // Copy the decoded data from the dictionary to the out[] - // buffer. + // buffer. Do it conditionally because out can be NULL + // (in which case copy_size is always 0). Calling memcpy() + // with a null-pointer is undefined even if the third + // argument is 0. const size_t copy_size = coder->dict.pos - dict_start; assert(copy_size <= out_size - *out_pos); - memcpy(out + *out_pos, coder->dict.buf + dict_start, - copy_size); + + if (copy_size > 0) + memcpy(out + *out_pos, coder->dict.buf + dict_start, + copy_size); + *out_pos += copy_size; // Reset the dictionary if so requested by coder->lz.code(). @@ -125,8 +131,7 @@ decode_buffer(lzma_coder *coder, static lzma_ret -lz_decode(void *coder_ptr, - const lzma_allocator *allocator lzma_attribute((__unused__)), +lz_decode(void *coder_ptr, const lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, @@ -241,7 +246,7 @@ lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator, if (lz_options.dict_size < 4096) lz_options.dict_size = 4096; - // Make dictionary size a multipe of 16. Some LZ-based decoders like + // Make dictionary size a multiple of 16. Some LZ-based decoders like // LZMA use the lowest bits lzma_dict.pos to know the alignment of the // data. Aligned buffer is also good when memcpying from the // dictionary to the output buffer, since applications are diff --git a/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_hash.h b/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_hash.h index 342a333..fb15c58 100644 --- a/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_hash.h +++ b/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_hash.h @@ -39,7 +39,7 @@ // Endianness doesn't matter in hash_2_calc() (no effect on the output). #ifdef TUKLIB_FAST_UNALIGNED_ACCESS # define hash_2_calc() \ - const uint32_t hash_value = *(const uint16_t *)(cur) + const uint32_t hash_value = read16ne(cur) #else # define hash_2_calc() \ const uint32_t hash_value \ diff --git a/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_mf.c b/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_mf.c index 7852077..d03657a 100644 --- a/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_mf.c +++ b/src/dependencies/cmliblzma/liblzma/lz/lz_encoder_mf.c @@ -113,7 +113,7 @@ normalize(lzma_mf *mf) // may be match finders that use larger resolution than one byte. const uint32_t subvalue = (MUST_NORMALIZE_POS - mf->cyclic_size); - // & (~(UINT32_C(1) << 10) - 1); + // & ~((UINT32_C(1) << 10) - 1); for (uint32_t i = 0; i < mf->hash_count; ++i) { // If the distance is greater than the dictionary size, diff --git a/src/dependencies/cmliblzma/liblzma/lzma/fastpos.h b/src/dependencies/cmliblzma/liblzma/lzma/fastpos.h index a3feea5..cba442c 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/fastpos.h +++ b/src/dependencies/cmliblzma/liblzma/lzma/fastpos.h @@ -101,7 +101,7 @@ extern const uint8_t lzma_fastpos[1 << FASTPOS_BITS]; (UINT32_C(1) << (FASTPOS_BITS + fastpos_shift(extra, n))) #define fastpos_result(dist, extra, n) \ - lzma_fastpos[(dist) >> fastpos_shift(extra, n)] \ + (uint32_t)(lzma_fastpos[(dist) >> fastpos_shift(extra, n)]) \ + 2 * fastpos_shift(extra, n) diff --git a/src/dependencies/cmliblzma/liblzma/lzma/fastpos_tablegen.c b/src/dependencies/cmliblzma/liblzma/lzma/fastpos_tablegen.c index c97e6f4..d4484c8 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/fastpos_tablegen.c +++ b/src/dependencies/cmliblzma/liblzma/lzma/fastpos_tablegen.c @@ -11,7 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// -#include #include #include #include "fastpos.h" diff --git a/src/dependencies/cmliblzma/liblzma/lzma/lzma2_decoder.c b/src/dependencies/cmliblzma/liblzma/lzma/lzma2_decoder.c index 878c870..cf1b511 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/lzma2_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/lzma/lzma2_decoder.c @@ -136,7 +136,7 @@ lzma2_decode(void *coder_ptr, lzma_dict *restrict dict, break; case SEQ_UNCOMPRESSED_2: - coder->uncompressed_size += in[(*in_pos)++] + 1; + coder->uncompressed_size += in[(*in_pos)++] + 1U; coder->sequence = SEQ_COMPRESSED_0; coder->lzma.set_uncompressed(coder->lzma.coder, coder->uncompressed_size); @@ -148,7 +148,7 @@ lzma2_decode(void *coder_ptr, lzma_dict *restrict dict, break; case SEQ_COMPRESSED_1: - coder->compressed_size += in[(*in_pos)++] + 1; + coder->compressed_size += in[(*in_pos)++] + 1U; coder->sequence = coder->next_sequence; break; @@ -297,8 +297,8 @@ lzma_lzma2_props_decode(void **options, const lzma_allocator *allocator, if (props[0] == 40) { opt->dict_size = UINT32_MAX; } else { - opt->dict_size = 2 | (props[0] & 1); - opt->dict_size <<= props[0] / 2 + 11; + opt->dict_size = 2 | (props[0] & 1U); + opt->dict_size <<= props[0] / 2U + 11; } opt->preset_dict = NULL; diff --git a/src/dependencies/cmliblzma/liblzma/lzma/lzma_common.h b/src/dependencies/cmliblzma/liblzma/lzma/lzma_common.h index 09efd38..9d040d9 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/lzma_common.h +++ b/src/dependencies/cmliblzma/liblzma/lzma/lzma_common.h @@ -122,7 +122,8 @@ typedef enum { /// byte; and /// - the highest literal_context_bits bits of the previous byte. #define literal_subcoder(probs, lc, lp_mask, pos, prev_byte) \ - ((probs)[(((pos) & lp_mask) << lc) + ((prev_byte) >> (8 - lc))]) + ((probs)[(((pos) & (lp_mask)) << (lc)) \ + + ((uint32_t)(prev_byte) >> (8U - (lc)))]) static inline void diff --git a/src/dependencies/cmliblzma/liblzma/lzma/lzma_decoder.c b/src/dependencies/cmliblzma/liblzma/lzma/lzma_decoder.c index d0f29b7..e605a0a 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/lzma_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/lzma/lzma_decoder.c @@ -398,7 +398,7 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr, // ("match byte") to "len" to minimize the // number of variables we need to store // between decoder calls. - len = dict_get(&dict, rep0) << 1; + len = (uint32_t)(dict_get(&dict, rep0)) << 1; // The usage of "offset" allows omitting some // branches, which should give tiny speed @@ -569,7 +569,7 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr, #ifdef HAVE_SMALL do { rc_bit(probs[symbol], , - rep0 += 1 << offset, + rep0 += 1U << offset, SEQ_DIST_MODEL); } while (++offset < limit); #else @@ -577,25 +577,25 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr, case 5: assert(offset == 0); rc_bit(probs[symbol], , - rep0 += 1, + rep0 += 1U, SEQ_DIST_MODEL); ++offset; --limit; case 4: rc_bit(probs[symbol], , - rep0 += 1 << offset, + rep0 += 1U << offset, SEQ_DIST_MODEL); ++offset; --limit; case 3: rc_bit(probs[symbol], , - rep0 += 1 << offset, + rep0 += 1U << offset, SEQ_DIST_MODEL); ++offset; --limit; case 2: rc_bit(probs[symbol], , - rep0 += 1 << offset, + rep0 += 1U << offset, SEQ_DIST_MODEL); ++offset; --limit; @@ -607,7 +607,7 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr, // the unneeded updating of // "symbol". rc_bit_last(probs[symbol], , - rep0 += 1 << offset, + rep0 += 1U << offset, SEQ_DIST_MODEL); } #endif @@ -635,7 +635,7 @@ lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr, do { rc_bit(coder->pos_align[ symbol], , - rep0 += 1 << offset, + rep0 += 1U << offset, SEQ_ALIGN); } while (++offset < ALIGN_BITS); #else @@ -1049,7 +1049,7 @@ lzma_lzma_props_decode(void **options, const lzma_allocator *allocator, // All dictionary sizes are accepted, including zero. LZ decoder // will automatically use a dictionary at least a few KiB even if // a smaller dictionary is requested. - opt->dict_size = unaligned_read32le(props + 1); + opt->dict_size = read32le(props + 1); opt->preset_dict = NULL; opt->preset_dict_size = 0; diff --git a/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder.c b/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder.c index ba9ce69..07d2b87 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder.c +++ b/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder.c @@ -663,7 +663,7 @@ lzma_lzma_props_encode(const void *options, uint8_t *out) if (lzma_lzma_lclppb_encode(opt, out)) return LZMA_PROG_ERROR; - unaligned_write32le(out + 1, opt->dict_size); + write32le(out + 1, opt->dict_size); return LZMA_OK; } diff --git a/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c b/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c index 59f7734..101c8d4 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c +++ b/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_optimum_normal.c @@ -636,9 +636,10 @@ helper2(lzma_lzma1_encoder *coder, uint32_t *reps, const uint8_t *buf, uint32_t len_test_2 = len_test + 1; const uint32_t limit = my_min(buf_avail_full, len_test_2 + nice_len); - for (; len_test_2 < limit - && buf[len_test_2] == buf_back[len_test_2]; - ++len_test_2) ; + // NOTE: len_test_2 may be greater than limit so the call to + // lzma_memcmplen() must be done conditionally. + if (len_test_2 < limit) + len_test_2 = lzma_memcmplen(buf, buf_back, len_test_2, limit); len_test_2 -= len_test + 1; @@ -732,9 +733,12 @@ helper2(lzma_lzma1_encoder *coder, uint32_t *reps, const uint8_t *buf, const uint32_t limit = my_min(buf_avail_full, len_test_2 + nice_len); - for (; len_test_2 < limit && - buf[len_test_2] == buf_back[len_test_2]; - ++len_test_2) ; + // NOTE: len_test_2 may be greater than limit + // so the call to lzma_memcmplen() must be + // done conditionally. + if (len_test_2 < limit) + len_test_2 = lzma_memcmplen(buf, buf_back, + len_test_2, limit); len_test_2 -= len_test + 1; diff --git a/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_private.h b/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_private.h index a2da969..2e34aac 100644 --- a/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_private.h +++ b/src/dependencies/cmliblzma/liblzma/lzma/lzma_encoder_private.h @@ -25,8 +25,7 @@ // MATCH_LEN_MIN bytes. Unaligned access gives tiny gain so there's no // reason to not use it when it is supported. #ifdef TUKLIB_FAST_UNALIGNED_ACCESS -# define not_equal_16(a, b) \ - (*(const uint16_t *)(a) != *(const uint16_t *)(b)) +# define not_equal_16(a, b) (read16ne(a) != read16ne(b)) #else # define not_equal_16(a, b) \ ((a)[0] != (b)[0] || (a)[1] != (b)[1]) diff --git a/src/dependencies/cmliblzma/liblzma/simple/arm.c b/src/dependencies/cmliblzma/liblzma/simple/arm.c index 181d0e3..ff5073a 100644 --- a/src/dependencies/cmliblzma/liblzma/simple/arm.c +++ b/src/dependencies/cmliblzma/liblzma/simple/arm.c @@ -22,9 +22,9 @@ arm_code(void *simple lzma_attribute((__unused__)), size_t i; for (i = 0; i + 4 <= size; i += 4) { if (buffer[i + 3] == 0xEB) { - uint32_t src = (buffer[i + 2] << 16) - | (buffer[i + 1] << 8) - | (buffer[i + 0]); + uint32_t src = ((uint32_t)(buffer[i + 2]) << 16) + | ((uint32_t)(buffer[i + 1]) << 8) + | (uint32_t)(buffer[i + 0]); src <<= 2; uint32_t dest; diff --git a/src/dependencies/cmliblzma/liblzma/simple/armthumb.c b/src/dependencies/cmliblzma/liblzma/simple/armthumb.c index eab4862..a8da334 100644 --- a/src/dependencies/cmliblzma/liblzma/simple/armthumb.c +++ b/src/dependencies/cmliblzma/liblzma/simple/armthumb.c @@ -23,10 +23,10 @@ armthumb_code(void *simple lzma_attribute((__unused__)), for (i = 0; i + 4 <= size; i += 2) { if ((buffer[i + 1] & 0xF8) == 0xF0 && (buffer[i + 3] & 0xF8) == 0xF8) { - uint32_t src = ((buffer[i + 1] & 0x7) << 19) - | (buffer[i + 0] << 11) - | ((buffer[i + 3] & 0x7) << 8) - | (buffer[i + 2]); + uint32_t src = (((uint32_t)(buffer[i + 1]) & 7) << 19) + | ((uint32_t)(buffer[i + 0]) << 11) + | (((uint32_t)(buffer[i + 3]) & 7) << 8) + | (uint32_t)(buffer[i + 2]); src <<= 1; diff --git a/src/dependencies/cmliblzma/liblzma/simple/ia64.c b/src/dependencies/cmliblzma/liblzma/simple/ia64.c index 580529e..6492d0a 100644 --- a/src/dependencies/cmliblzma/liblzma/simple/ia64.c +++ b/src/dependencies/cmliblzma/liblzma/simple/ia64.c @@ -70,7 +70,7 @@ ia64_code(void *simple lzma_attribute((__unused__)), inst_norm |= (uint64_t)(dest & 0x100000) << (36 - 20); - instruction &= (1 << bit_res) - 1; + instruction &= (1U << bit_res) - 1; instruction |= (inst_norm << bit_res); for (size_t j = 0; j < 6; j++) diff --git a/src/dependencies/cmliblzma/liblzma/simple/powerpc.c b/src/dependencies/cmliblzma/liblzma/simple/powerpc.c index 54dfbf1..0b60e9b 100644 --- a/src/dependencies/cmliblzma/liblzma/simple/powerpc.c +++ b/src/dependencies/cmliblzma/liblzma/simple/powerpc.c @@ -25,10 +25,11 @@ powerpc_code(void *simple lzma_attribute((__unused__)), if ((buffer[i] >> 2) == 0x12 && ((buffer[i + 3] & 3) == 1)) { - const uint32_t src = ((buffer[i + 0] & 3) << 24) - | (buffer[i + 1] << 16) - | (buffer[i + 2] << 8) - | (buffer[i + 3] & (~3)); + const uint32_t src + = (((uint32_t)(buffer[i + 0]) & 3) << 24) + | ((uint32_t)(buffer[i + 1]) << 16) + | ((uint32_t)(buffer[i + 2]) << 8) + | ((uint32_t)(buffer[i + 3]) & ~UINT32_C(3)); uint32_t dest; if (is_encoder) diff --git a/src/dependencies/cmliblzma/liblzma/simple/simple_coder.c b/src/dependencies/cmliblzma/liblzma/simple/simple_coder.c index 13ebabc..4f499be 100644 --- a/src/dependencies/cmliblzma/liblzma/simple/simple_coder.c +++ b/src/dependencies/cmliblzma/liblzma/simple/simple_coder.c @@ -118,7 +118,15 @@ simple_code(void *coder_ptr, const lzma_allocator *allocator, // coder->pos and coder->size yet. This way the coder can be // restarted if the next filter in the chain returns e.g. // LZMA_MEM_ERROR. - memcpy(out + *out_pos, coder->buffer + coder->pos, buf_avail); + // + // Do the memcpy() conditionally because out can be NULL + // (in which case buf_avail is always 0). Calling memcpy() + // with a null-pointer is undefined even if the third + // argument is 0. + if (buf_avail > 0) + memcpy(out + *out_pos, coder->buffer + coder->pos, + buf_avail); + *out_pos += buf_avail; // Copy/Encode/Decode more data to out[]. diff --git a/src/dependencies/cmliblzma/liblzma/simple/simple_decoder.c b/src/dependencies/cmliblzma/liblzma/simple/simple_decoder.c index 1d864f2..dc4d241 100644 --- a/src/dependencies/cmliblzma/liblzma/simple/simple_decoder.c +++ b/src/dependencies/cmliblzma/liblzma/simple/simple_decoder.c @@ -28,7 +28,7 @@ lzma_simple_props_decode(void **options, const lzma_allocator *allocator, if (opt == NULL) return LZMA_MEM_ERROR; - opt->start_offset = unaligned_read32le(props); + opt->start_offset = read32le(props); // Don't leave an options structure allocated if start_offset is zero. if (opt->start_offset == 0) diff --git a/src/dependencies/cmliblzma/liblzma/simple/simple_encoder.c b/src/dependencies/cmliblzma/liblzma/simple/simple_encoder.c index 8aa463b..d2cc03e 100644 --- a/src/dependencies/cmliblzma/liblzma/simple/simple_encoder.c +++ b/src/dependencies/cmliblzma/liblzma/simple/simple_encoder.c @@ -32,7 +32,7 @@ lzma_simple_props_encode(const void *options, uint8_t *out) if (opt == NULL || opt->start_offset == 0) return LZMA_OK; - unaligned_write32le(out, opt->start_offset); + write32le(out, opt->start_offset); return LZMA_OK; } diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/config.sub b/src/dependencies/libarchive-3.5.2/build/autoconf/config.sub deleted file mode 100755 index 1d8e98b..0000000 --- a/src/dependencies/libarchive-3.5.2/build/autoconf/config.sub +++ /dev/null @@ -1,1801 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2018 Free Software Foundation, Inc. - -timestamp='2018-02-22' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to . -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS - -Canonicalize a configuration name. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2018 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo "$1" - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo "$1" | sed 's/-[^-]*$//'` - if [ "$basic_machine" != "$1" ] - then os=`echo "$1" | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | ba \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | wasm32 \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | ba-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ - | pyramid-* \ - | riscv32-* | riscv64-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | visium-* \ - | wasm32-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-pc - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - asmjs) - basic_machine=asmjs-unknown - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2*) - basic_machine=m68k-bull - os=-sysv3 - ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=$os"spe" - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - nsv-tandem) - basic_machine=nsv-tandem - ;; - nsx-tandem) - basic_machine=nsx-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - x64) - basic_machine=x86_64-pc - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases that might get confused - # with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # es1800 is here to avoid being matched by es* (a different OS) - -es1800*) - os=-ose - ;; - # Now accept the basic system types. - # The portable systems comes first. - # Each alternative MUST end in a * to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* | -sortix* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ - | -midnightbsd*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -xray | -os68k* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo "$os" | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo "$os" | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo "$os" | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4*) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -pikeos*) - # Until real need of OS specific support for - # particular features comes up, bare metal - # configurations are quite functional. - case $basic_machine in - arm*) - os=-eabi - ;; - *) - os=-elf - ;; - esac - ;; - -nacl*) - ;; - -ios) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - pru-*) - os=-elf - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` - ;; -esac - -echo "$basic_machine$os" -exit - -# Local variables: -# eval: (add-hook 'write-file-functions 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/dependencies/libarchive-3.5.2/build/version b/src/dependencies/libarchive-3.5.2/build/version deleted file mode 100644 index 5fce0ed..0000000 --- a/src/dependencies/libarchive-3.5.2/build/version +++ /dev/null @@ -1 +0,0 @@ -3005002 diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry.3.pdf deleted file mode 100644 index 0a159f2..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_acl.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_acl.3.pdf deleted file mode 100644 index a428f40..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_acl.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_linkify.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_linkify.3.pdf deleted file mode 100644 index 983eb0c..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_linkify.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_misc.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_misc.3.pdf deleted file mode 100644 index 4a815f3..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_misc.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_paths.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_paths.3.pdf deleted file mode 100644 index 3165b31..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_paths.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_perms.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_perms.3.pdf deleted file mode 100644 index cd4a6dd..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_perms.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_stat.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_stat.3.pdf deleted file mode 100644 index 432760b..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_stat.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_time.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_time.3.pdf deleted file mode 100644 index 29289ce..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_entry_time.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read.3.pdf deleted file mode 100644 index 553e24f..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_add_passphrase.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_add_passphrase.3.pdf deleted file mode 100644 index 4600a06..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_add_passphrase.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_data.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_data.3.pdf deleted file mode 100644 index ed8628f..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_data.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_disk.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_disk.3.pdf deleted file mode 100644 index ff4845e..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_disk.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_extract.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_extract.3.pdf deleted file mode 100644 index 3d0f002..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_extract.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_filter.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_filter.3.pdf deleted file mode 100644 index 830ff89..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_filter.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_format.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_format.3.pdf deleted file mode 100644 index 554df99..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_format.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_free.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_free.3.pdf deleted file mode 100644 index 5c5c370..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_free.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_header.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_header.3.pdf deleted file mode 100644 index aabfcba..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_header.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_new.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_new.3.pdf deleted file mode 100644 index 69eab90..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_new.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_open.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_open.3.pdf deleted file mode 100644 index 3fad700..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_open.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_set_options.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_set_options.3.pdf deleted file mode 100644 index 084687f..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_read_set_options.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_util.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_util.3.pdf deleted file mode 100644 index 3cee5fe..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_util.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write.3.pdf deleted file mode 100644 index 5c318d5..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_blocksize.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_blocksize.3.pdf deleted file mode 100644 index 99473f7..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_blocksize.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_data.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_data.3.pdf deleted file mode 100644 index f40d118..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_data.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_disk.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_disk.3.pdf deleted file mode 100644 index 03ec498..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_disk.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_filter.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_filter.3.pdf deleted file mode 100644 index 5953814..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_filter.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_finish_entry.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_finish_entry.3.pdf deleted file mode 100644 index c06343c..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_finish_entry.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_format.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_format.3.pdf deleted file mode 100644 index 777a497..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_format.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_free.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_free.3.pdf deleted file mode 100644 index 0ef0d7d..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_free.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_header.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_header.3.pdf deleted file mode 100644 index 9cd7603..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_header.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_new.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_new.3.pdf deleted file mode 100644 index 3688e70..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_new.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_open.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_open.3.pdf deleted file mode 100644 index 09bdadb..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_open.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_set_options.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_set_options.3.pdf deleted file mode 100644 index 686be86..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_set_options.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_set_passphrase.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_set_passphrase.3.pdf deleted file mode 100644 index 3681f06..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/archive_write_set_passphrase.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/bsdcpio.1.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/bsdcpio.1.pdf deleted file mode 100644 index ff11dc5..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/bsdcpio.1.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/bsdtar.1.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/bsdtar.1.pdf deleted file mode 100644 index 07804d0..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/bsdtar.1.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/cpio.5.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/cpio.5.pdf deleted file mode 100644 index 29722b2..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/cpio.5.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive-formats.5.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive-formats.5.pdf deleted file mode 100644 index b4f1b57..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive-formats.5.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive.3.pdf deleted file mode 100644 index 6450684..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive_changes.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive_changes.3.pdf deleted file mode 100644 index 566bd8d..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive_changes.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive_internals.3.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive_internals.3.pdf deleted file mode 100644 index 03fc168..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/libarchive_internals.3.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/mtree.5.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/mtree.5.pdf deleted file mode 100644 index 13b63f0..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/mtree.5.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/tar.5.pdf b/src/dependencies/libarchive-3.5.2/doc/pdf/tar.5.pdf deleted file mode 100644 index 84e5eff..0000000 Binary files a/src/dependencies/libarchive-3.5.2/doc/pdf/tar.5.pdf and /dev/null differ diff --git a/src/dependencies/libarchive-3.5.2/test_utils/test_utils.c b/src/dependencies/libarchive-3.5.2/test_utils/test_utils.c deleted file mode 100644 index 8ea3d3c..0000000 --- a/src/dependencies/libarchive-3.5.2/test_utils/test_utils.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2003-2012 Tim Kientzle - * Copyright (c) 2012 Andres Mejia - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "test_utils.h" - -#include -#include - -/* Filter tests against a glob pattern. Returns non-zero if test matches - * pattern, zero otherwise. A '^' at the beginning of the pattern negates - * the return values (i.e. returns zero for a match, non-zero otherwise. - */ -static int -test_filter(const char *pattern, const char *test) -{ - int retval = 0; - int negate = 0; - const char *p = pattern; - const char *t = test; - - if (p[0] == '^') - { - negate = 1; - p++; - } - - while (1) - { - if (p[0] == '\\') - p++; - else if (p[0] == '*') - { - while (p[0] == '*') - p++; - if (p[0] == '\\') - p++; - if ((t = strchr(t, p[0])) == 0) - break; - } - if (p[0] != t[0]) - break; - if (p[0] == '\0') { - retval = 1; - break; - } - p++; - t++; - } - - return (negate) ? !retval : retval; -} - -int get_test_set(int *test_set, int limit, const char *test, - struct test_list_t *tests) -{ - int start, end; - int idx = 0; - - if (test == NULL) { - /* Default: Run all tests. */ - for (;idx < limit; idx++) - test_set[idx] = idx; - return (limit); - } - if (*test >= '0' && *test <= '9') { - const char *vp = test; - start = 0; - while (*vp >= '0' && *vp <= '9') { - start *= 10; - start += *vp - '0'; - ++vp; - } - if (*vp == '\0') { - end = start; - } else if (*vp == '-') { - ++vp; - if (*vp == '\0') { - end = limit - 1; - } else { - end = 0; - while (*vp >= '0' && *vp <= '9') { - end *= 10; - end += *vp - '0'; - ++vp; - } - } - } else - return (-1); - if (start < 0 || end >= limit || start > end) - return (-1); - while (start <= end) - test_set[idx++] = start++; - } else { - for (start = 0; start < limit; ++start) { - const char *name = tests[start].name; - if (test_filter(test, name)) - test_set[idx++] = start; - } - } - return ((idx == 0)?-1:idx); -} diff --git a/src/dependencies/libarchive-3.5.2/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/CMakeLists.txt similarity index 95% rename from src/dependencies/libarchive-3.5.2/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/CMakeLists.txt index 9a1aeb2..713e3bc 100644 --- a/src/dependencies/libarchive-3.5.2/CMakeLists.txt +++ b/src/dependencies/libarchive-3.6.2/CMakeLists.txt @@ -1,5 +1,8 @@ # CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR) +if(POLICY CMP0065) + cmake_policy(SET CMP0065 NEW) #3.4 don't use `-rdynamic` with executables +endif() if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) #3.12.0 `find_package()`` uses ``_ROOT`` variables. endif() @@ -96,24 +99,8 @@ endif () # Especially for early development, we want to be a little # aggressive about diagnosing build problems; this can get # relaxed somewhat in final shipping versions. -IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") - SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") - ################################################################# - # Set compile flags for all build types. - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") - if (ENABLE_WERROR) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - endif () - ################################################################# - # Set compile flags for debug build. - # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") -ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") -IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") +IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") ################################################################# # Set compile flags for all build types. @@ -130,7 +117,26 @@ IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") -ENDIF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") + # Ideally this will be a compile/link time check, yet there's no obvious way + # how considering how old our minimum required cmake version is. The official + # cmake.org side does not host the manual pages even. Normally we can use + # either of the following two, yet neither is supported as of 3.0.2 + # - check_linker_flag - does not exist + # - try_compile - does not support linker flags + # + # The CI fails with this on MacOS + IF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + # Place the functions and data into separate sections, allowing the linker + # to garbage collect the unused ones. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections") + # Printing the discarded section is "too much", so enable on demand. + #SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Wl,--print-gc-sections") + #SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--print-gc-sections") + ENDIF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") SET(CMAKE_C_COMPILER "xlc_r") SET(CMAKE_REQUIRED_FLAGS "-qflag=e:e -qformat=sec") @@ -207,7 +213,7 @@ OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON) OPTION(ENABLE_LIBXML2 "Enable the use of the system libxml2 library if found" ON) OPTION(ENABLE_EXPAT "Enable the use of the system EXPAT library if found" ON) OPTION(ENABLE_PCREPOSIX "Enable the use of the system PCREPOSIX library if found" ON) -OPTION(ENABLE_LibGCC "Enable the use of the system LibGCC library if found" ON) +OPTION(ENABLE_LIBGCC "Enable the use of the system LibGCC library if found" ON) # CNG is used for encrypt/decrypt Zip archives on Windows. OPTION(ENABLE_CNG "Enable the use of CNG(Crypto Next Generation)" ON) @@ -226,7 +232,7 @@ OPTION(ENABLE_INSTALL "Enable installing of libraries" ON) SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support") SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)") -SET(WINDOWS_VERSION "WIN7" CACHE STRING "Set Windows version to use (Windows only)") +SET(WINDOWS_VERSION "WIN10" CACHE STRING "Set Windows version to use (Windows only)") IF(ENABLE_COVERAGE) include(LibarchiveCodeCoverage) @@ -237,7 +243,11 @@ IF(ENABLE_TEST) ENDIF(ENABLE_TEST) IF(WIN32) - IF(WINDOWS_VERSION STREQUAL "WIN8") + IF(WINDOWS_VERSION STREQUAL "WIN10") + SET(NTDDI_VERSION 0x0A000000) + SET(_WIN32_WINNT 0x0A00) + SET(WINVER 0x0A00) + ELSEIF(WINDOWS_VERSION STREQUAL "WIN8") SET(NTDDI_VERSION 0x06020000) SET(_WIN32_WINNT 0x0602) SET(WINVER 0x0602) @@ -261,12 +271,12 @@ IF(WIN32) SET(NTDDI_VERSION 0x05010000) SET(_WIN32_WINNT 0x0501) SET(WINVER 0x0501) - ELSE(WINDOWS_VERSION STREQUAL "WIN8") + ELSE(WINDOWS_VERSION STREQUAL "WIN10") # Default to Windows Server 2003 API if we don't recognize the specifier SET(NTDDI_VERSION 0x05020000) SET(_WIN32_WINNT 0x0502) SET(WINVER 0x0502) - ENDIF(WINDOWS_VERSION STREQUAL "WIN8") + ENDIF(WINDOWS_VERSION STREQUAL "WIN10") ENDIF(WIN32) IF(MSVC) @@ -604,8 +614,13 @@ IF(ENABLE_ZSTD) SET(ZSTD_FIND_QUIETLY TRUE) ENDIF (ZSTD_INCLUDE_DIR) - FIND_PATH(ZSTD_INCLUDE_DIR zstd.h) - FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd) + IF(UNIX) + FIND_PACKAGE(PkgConfig QUIET) + PKG_SEARCH_MODULE(PC_ZSTD libzstd) + ENDIF() + + FIND_PATH(ZSTD_INCLUDE_DIR zstd.h HINTS ${PC_ZSTD_INCLUDEDIR} ${PC_ZSTD_INCLUDE_DIRS}) + FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd HINTS ${PC_ZSTD_LIBDIR} ${PC_ZSTD_LIBRARY_DIRS}) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR) ELSE(ENABLE_ZSTD) @@ -618,10 +633,8 @@ IF(ZSTD_FOUND) CMAKE_PUSH_CHECK_STATE() SET(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY}) SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR}) - #CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD) - # rpi-imager: cannot check since static lib is not build yet - SET(HAVE_LIBZSTD 1) - + CHECK_FUNCTION_EXISTS(ZSTD_decompressStream HAVE_LIBZSTD) + CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD_COMPRESSOR) # # TODO: test for static library. # @@ -1251,9 +1264,10 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" # # If requested, try finding library for PCREPOSIX # - IF(ENABLE_LibGCC) - FIND_PACKAGE(LibGCC) + IF(ENABLE_LIBGCC) + FIND_PACKAGE(LIBGCC) ELSE() + MESSAGE(FATAL_ERROR "libgcc not found.") SET(LIBGCC_FOUND FALSE) # Override cached value ENDIF() IF(ENABLE_PCREPOSIX) @@ -1551,15 +1565,15 @@ CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec # Check for integer types # # -CHECK_TYPE_SIZE("short" SIZE_OF_SHORT) -CHECK_TYPE_SIZE("int" SIZE_OF_INT) -CHECK_TYPE_SIZE("long" SIZE_OF_LONG) -CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG) +CHECK_TYPE_SIZE("short" SIZEOF_SHORT) +CHECK_TYPE_SIZE("int" SIZEOF_INT) +CHECK_TYPE_SIZE("long" SIZEOF_LONG) +CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) -CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT) -CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED) -CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG) -CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) +CHECK_TYPE_SIZE("unsigned short" SIZEOF_UNSIGNED_SHORT) +CHECK_TYPE_SIZE("unsigned" SIZEOF_UNSIGNED) +CHECK_TYPE_SIZE("unsigned long" SIZEOF_UNSIGNED_LONG) +CHECK_TYPE_SIZE("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG) CHECK_TYPE_SIZE("__int64" __INT64) CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) @@ -2020,6 +2034,17 @@ CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA512" LIBMD) CHECK_CRYPTO_WIN("MD5;SHA1;SHA256;SHA384;SHA512") +# Check visibility annotations +SET(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") +SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fvisibility=hidden -Werror") +CHECK_C_SOURCE_COMPILES("void __attribute__((visibility(\"default\"))) foo(void); +int main() { return 0; }" HAVE_VISIBILITY_ATTR) +IF (HAVE_VISIBILITY_ATTR) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + ADD_DEFINITIONS(-D__LIBARCHIVE_ENABLE_VISIBILITY) +ENDIF(HAVE_VISIBILITY_ATTR) +SET(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}") + # Generate "config.h" from "build/cmake/config.h.in" CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/src/dependencies/libarchive-3.5.2/COPYING b/src/dependencies/libarchive-3.6.2/COPYING similarity index 100% rename from src/dependencies/libarchive-3.5.2/COPYING rename to src/dependencies/libarchive-3.6.2/COPYING diff --git a/src/dependencies/libarchive-3.5.2/INSTALL b/src/dependencies/libarchive-3.6.2/INSTALL similarity index 100% rename from src/dependencies/libarchive-3.5.2/INSTALL rename to src/dependencies/libarchive-3.6.2/INSTALL diff --git a/src/dependencies/libarchive-3.5.2/Makefile.am b/src/dependencies/libarchive-3.6.2/Makefile.am similarity index 98% rename from src/dependencies/libarchive-3.5.2/Makefile.am rename to src/dependencies/libarchive-3.6.2/Makefile.am index c93a82e..3fd2fdb 100644 --- a/src/dependencies/libarchive-3.5.2/Makefile.am +++ b/src/dependencies/libarchive-3.6.2/Makefile.am @@ -284,7 +284,7 @@ endif # -no-undefined marks that libarchive doesn't rely on symbols # defined in the application. This is mandatory for cygwin. -libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) +libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) $(GC_SECTIONS) libarchive_la_LIBADD= $(LTLIBICONV) # Manpages to install @@ -414,6 +414,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_compat_solaris_tar_acl.c \ libarchive/test/test_compat_solaris_pax_sparse.c \ libarchive/test/test_compat_star_acl.c \ + libarchive/test/test_compat_tar_directory.c \ libarchive/test/test_compat_tar_hardlink.c \ libarchive/test/test_compat_uudecode.c \ libarchive/test/test_compat_uudecode_large.c \ @@ -502,6 +503,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_rar_encryption_data.c \ libarchive/test/test_read_format_rar_encryption_partially.c \ libarchive/test/test_read_format_rar_encryption_header.c \ + libarchive/test/test_read_format_rar_filter.c \ libarchive/test/test_read_format_rar_invalid1.c \ libarchive/test/test_read_format_rar5.c \ libarchive/test/test_read_format_raw.c \ @@ -511,6 +513,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_tar_empty_filename.c \ libarchive/test/test_read_format_tar_empty_with_gnulabel.c \ libarchive/test/test_read_format_tar_filename.c \ + libarchive/test/test_read_format_tar_invalid_pax_size.c \ libarchive/test/test_read_format_tbz.c \ libarchive/test/test_read_format_tgz.c \ libarchive/test/test_read_format_tlz.c \ @@ -625,6 +628,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_write_format_xar_empty.c \ libarchive/test/test_write_format_zip.c \ libarchive/test/test_write_format_zip_compression_store.c \ + libarchive/test/test_write_format_zip_entry_size_unset.c \ libarchive/test/test_write_format_zip_empty.c \ libarchive/test/test_write_format_zip_empty_zip64.c \ libarchive/test/test_write_format_zip_file.c \ @@ -695,6 +699,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_compat_solaris_tar_acl.tar.uu \ libarchive/test/test_compat_star_acl_nfs4.tar.uu \ libarchive/test/test_compat_star_acl_posix1e.tar.uu \ + libarchive/test/test_compat_tar_directory_1.tar.uu \ libarchive/test/test_compat_tar_hardlink_1.tar.uu \ libarchive/test/test_compat_uudecode_large.tar.Z.uu \ libarchive/test/test_compat_xz_1.txz.uu \ @@ -835,6 +840,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar_encryption_data.rar.uu \ libarchive/test/test_read_format_rar_encryption_header.rar.uu \ libarchive/test/test_read_format_rar_encryption_partially.rar.uu \ + libarchive/test/test_read_format_rar_filter.rar.uu \ libarchive/test/test_read_format_rar_invalid1.rar.uu \ libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \ libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu \ @@ -878,6 +884,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar5_nonempty_dir_stream.rar.uu \ libarchive/test/test_read_format_rar5_owner.rar.uu \ libarchive/test/test_read_format_rar5_readtables_overflow.rar.uu \ + libarchive/test/test_read_format_rar5_sfx.exe.uu \ libarchive/test/test_read_format_rar5_solid.rar.uu \ libarchive/test/test_read_format_rar5_stored.rar.uu \ libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu \ @@ -887,6 +894,9 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu \ libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu \ libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu \ + libarchive/test/test_read_format_rar5_decode_number_out_of_bounds_read.rar.uu \ + libarchive/test/test_read_format_rar5_window_buf_and_size_desync.rar.uu \ + libarchive/test/test_read_format_rar5_bad_window_sz_in_mltarc_file.rar.uu \ libarchive/test/test_read_format_raw.bufr.uu \ libarchive/test/test_read_format_raw.data.gz.uu \ libarchive/test/test_read_format_raw.data.Z.uu \ @@ -896,6 +906,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_tar_empty_with_gnulabel.tar.uu \ libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu \ libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_tar_invalid_pax_size.tar.uu \ libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \ libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \ libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \ @@ -950,6 +961,8 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_zip_xz_multi.zipx.uu \ libarchive/test/test_read_format_zip_zip64a.zip.uu \ libarchive/test/test_read_format_zip_zip64b.zip.uu \ + libarchive/test/test_read_format_zip_zstd.zipx.uu \ + libarchive/test/test_read_format_zip_zstd_multi.zipx.uu \ libarchive/test/test_read_large_splitted_rar_aa.uu \ libarchive/test/test_read_large_splitted_rar_ab.uu \ libarchive/test/test_read_large_splitted_rar_ac.uu \ @@ -1020,7 +1033,7 @@ endif bsdtar_LDADD= libarchive.la libarchive_fe.la $(LTLIBICONV) bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS) -bsdtar_LDFLAGS= $(bsdtar_ldstatic) +bsdtar_LDFLAGS= $(bsdtar_ldstatic) $(GC_SECTIONS) bsdtar_EXTRA_DIST= \ tar/bsdtar.1 \ @@ -1081,6 +1094,7 @@ bsdtar_test_SOURCES= \ tar/test/test_option_fflags.c \ tar/test/test_option_gid_gname.c \ tar/test/test_option_grzip.c \ + tar/test/test_option_ignore_zeros.c \ tar/test/test_option_j.c \ tar/test/test_option_k.c \ tar/test/test_option_keep_newer_files.c \ @@ -1185,7 +1199,7 @@ endif bsdcpio_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV) bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS) -bsdcpio_LDFLAGS= $(bsdcpio_ldstatic) +bsdcpio_LDFLAGS= $(bsdcpio_ldstatic) $(GC_SECTIONS) bsdcpio_EXTRA_DIST= \ cpio/bsdcpio.1 \ @@ -1339,7 +1353,7 @@ endif bsdcat_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV) bsdcat_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcat_ccstatic) $(PLATFORMCPPFLAGS) -bsdcat_LDFLAGS= $(bsdcat_ldstatic) +bsdcat_LDFLAGS= $(bsdcat_ldstatic) $(GC_SECTIONS) bsdcat_EXTRA_DIST= \ cat/bsdcat.1 \ diff --git a/src/dependencies/libarchive-3.5.2/Makefile.in b/src/dependencies/libarchive-3.6.2/Makefile.in similarity index 99% rename from src/dependencies/libarchive-3.5.2/Makefile.in rename to src/dependencies/libarchive-3.6.2/Makefile.in index ba651eb..be13f91 100644 --- a/src/dependencies/libarchive-3.5.2/Makefile.in +++ b/src/dependencies/libarchive-3.6.2/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -136,6 +136,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/build/autoconf/lib-ld.m4 \ $(top_srcdir)/build/autoconf/lib-link.m4 \ $(top_srcdir)/build/autoconf/lib-prefix.m4 \ + $(top_srcdir)/build/autoconf/m4_ax_compile_check_sizeof.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -623,6 +624,7 @@ am_bsdtar_test_OBJECTS = $(am__objects_12) \ tar/test/bsdtar_test-test_option_fflags.$(OBJEXT) \ tar/test/bsdtar_test-test_option_gid_gname.$(OBJEXT) \ tar/test/bsdtar_test-test_option_grzip.$(OBJEXT) \ + tar/test/bsdtar_test-test_option_ignore_zeros.$(OBJEXT) \ tar/test/bsdtar_test-test_option_j.$(OBJEXT) \ tar/test/bsdtar_test-test_option_k.$(OBJEXT) \ tar/test/bsdtar_test-test_option_keep_newer_files.$(OBJEXT) \ @@ -858,6 +860,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \ libarchive/test/test_compat_solaris_tar_acl.c \ libarchive/test/test_compat_solaris_pax_sparse.c \ libarchive/test/test_compat_star_acl.c \ + libarchive/test/test_compat_tar_directory.c \ libarchive/test/test_compat_tar_hardlink.c \ libarchive/test/test_compat_uudecode.c \ libarchive/test/test_compat_uudecode_large.c \ @@ -946,6 +949,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \ libarchive/test/test_read_format_rar_encryption_data.c \ libarchive/test/test_read_format_rar_encryption_partially.c \ libarchive/test/test_read_format_rar_encryption_header.c \ + libarchive/test/test_read_format_rar_filter.c \ libarchive/test/test_read_format_rar_invalid1.c \ libarchive/test/test_read_format_rar5.c \ libarchive/test/test_read_format_raw.c \ @@ -955,6 +959,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \ libarchive/test/test_read_format_tar_empty_filename.c \ libarchive/test/test_read_format_tar_empty_with_gnulabel.c \ libarchive/test/test_read_format_tar_filename.c \ + libarchive/test/test_read_format_tar_invalid_pax_size.c \ libarchive/test/test_read_format_tbz.c \ libarchive/test/test_read_format_tgz.c \ libarchive/test/test_read_format_tlz.c \ @@ -1069,6 +1074,7 @@ am__libarchive_test_SOURCES_DIST = libarchive/archive_acl.c \ libarchive/test/test_write_format_xar_empty.c \ libarchive/test/test_write_format_zip.c \ libarchive/test/test_write_format_zip_compression_store.c \ + libarchive/test/test_write_format_zip_entry_size_unset.c \ libarchive/test/test_write_format_zip_empty.c \ libarchive/test/test_write_format_zip_empty_zip64.c \ libarchive/test/test_write_format_zip_file.c \ @@ -1270,6 +1276,7 @@ am_libarchive_test_OBJECTS = $(am__objects_19) $(am__objects_20) \ libarchive/test/test-test_compat_solaris_tar_acl.$(OBJEXT) \ libarchive/test/test-test_compat_solaris_pax_sparse.$(OBJEXT) \ libarchive/test/test-test_compat_star_acl.$(OBJEXT) \ + libarchive/test/test-test_compat_tar_directory.$(OBJEXT) \ libarchive/test/test-test_compat_tar_hardlink.$(OBJEXT) \ libarchive/test/test-test_compat_uudecode.$(OBJEXT) \ libarchive/test/test-test_compat_uudecode_large.$(OBJEXT) \ @@ -1358,6 +1365,7 @@ am_libarchive_test_OBJECTS = $(am__objects_19) $(am__objects_20) \ libarchive/test/test-test_read_format_rar_encryption_data.$(OBJEXT) \ libarchive/test/test-test_read_format_rar_encryption_partially.$(OBJEXT) \ libarchive/test/test-test_read_format_rar_encryption_header.$(OBJEXT) \ + libarchive/test/test-test_read_format_rar_filter.$(OBJEXT) \ libarchive/test/test-test_read_format_rar_invalid1.$(OBJEXT) \ libarchive/test/test-test_read_format_rar5.$(OBJEXT) \ libarchive/test/test-test_read_format_raw.$(OBJEXT) \ @@ -1367,6 +1375,7 @@ am_libarchive_test_OBJECTS = $(am__objects_19) $(am__objects_20) \ libarchive/test/test-test_read_format_tar_empty_filename.$(OBJEXT) \ libarchive/test/test-test_read_format_tar_empty_with_gnulabel.$(OBJEXT) \ libarchive/test/test-test_read_format_tar_filename.$(OBJEXT) \ + libarchive/test/test-test_read_format_tar_invalid_pax_size.$(OBJEXT) \ libarchive/test/test-test_read_format_tbz.$(OBJEXT) \ libarchive/test/test-test_read_format_tgz.$(OBJEXT) \ libarchive/test/test-test_read_format_tlz.$(OBJEXT) \ @@ -1481,6 +1490,7 @@ am_libarchive_test_OBJECTS = $(am__objects_19) $(am__objects_20) \ libarchive/test/test-test_write_format_xar_empty.$(OBJEXT) \ libarchive/test/test-test_write_format_zip.$(OBJEXT) \ libarchive/test/test-test_write_format_zip_compression_store.$(OBJEXT) \ + libarchive/test/test-test_write_format_zip_entry_size_unset.$(OBJEXT) \ libarchive/test/test-test_write_format_zip_empty.$(OBJEXT) \ libarchive/test/test-test_write_format_zip_empty_zip64.$(OBJEXT) \ libarchive/test/test-test_write_format_zip_file.$(OBJEXT) \ @@ -1897,6 +1907,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \ libarchive/test/$(DEPDIR)/test-test_compat_solaris_pax_sparse.Po \ libarchive/test/$(DEPDIR)/test-test_compat_solaris_tar_acl.Po \ libarchive/test/$(DEPDIR)/test-test_compat_star_acl.Po \ + libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Po \ libarchive/test/$(DEPDIR)/test-test_compat_tar_hardlink.Po \ libarchive/test/$(DEPDIR)/test-test_compat_uudecode.Po \ libarchive/test/$(DEPDIR)/test-test_compat_uudecode_large.Po \ @@ -1986,6 +1997,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_data.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_header.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_partially.Po \ + libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_rar_invalid1.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_raw.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_tar.Po \ @@ -1994,6 +2006,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_pax.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po \ + libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po \ libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po \ @@ -2110,6 +2123,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \ libarchive/test/$(DEPDIR)/test-test_write_format_zip_compression_store.Po \ libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty.Po \ libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty_zip64.Po \ + libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Po \ libarchive/test/$(DEPDIR)/test-test_write_format_zip_file.Po \ libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po \ libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po \ @@ -2163,6 +2177,7 @@ am__depfiles_remade = cat/$(DEPDIR)/bsdcat-bsdcat.Po \ tar/test/$(DEPDIR)/bsdtar_test-test_option_fflags.Po \ tar/test/$(DEPDIR)/bsdtar_test-test_option_gid_gname.Po \ tar/test/$(DEPDIR)/bsdtar_test-test_option_grzip.Po \ + tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Po \ tar/test/$(DEPDIR)/bsdtar_test-test_option_j.Po \ tar/test/$(DEPDIR)/bsdtar_test-test_option_k.Po \ tar/test/$(DEPDIR)/bsdtar_test-test_option_keep_newer_files.Po \ @@ -2240,8 +2255,8 @@ NROFF = nroff MANS = $(man_MANS) DATA = $(pkgconfig_DATA) HEADERS = $(include_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -2258,9 +2273,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope AM_RECURSIVE_TARGETS = cscope check recheck am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ @@ -2417,6 +2429,7 @@ am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test @@ -2449,10 +2462,11 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/build/autoconf/missing \ $(top_srcdir)/build/autoconf/test-driver \ $(top_srcdir)/build/pkgconfig/libarchive.pc.in COPYING INSTALL \ - NEWS build/autoconf/compile build/autoconf/config.guess \ - build/autoconf/config.rpath build/autoconf/config.sub \ - build/autoconf/depcomp build/autoconf/install-sh \ - build/autoconf/ltmain.sh build/autoconf/missing + NEWS README.md build/autoconf/compile \ + build/autoconf/config.guess build/autoconf/config.rpath \ + build/autoconf/config.sub build/autoconf/depcomp \ + build/autoconf/install-sh build/autoconf/ltmain.sh \ + build/autoconf/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -2466,6 +2480,8 @@ am__post_remove_distdir = $(am__remove_distdir) DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz $(distdir).zip GZIP_ENV = --best DIST_TARGETS = dist-xz dist-gzip dist-zip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -2488,6 +2504,8 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -2498,8 +2516,10 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ +GC_SECTIONS = @GC_SECTIONS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -2513,6 +2533,7 @@ LIBARCHIVE_VERSION_STRING = @LIBARCHIVE_VERSION_STRING@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ +LIBSREQUIRED = @LIBSREQUIRED@ LIBTOOL = @LIBTOOL@ LIBXML2_PC_CFLAGS = @LIBXML2_PC_CFLAGS@ LIBXML2_PC_LIBS = @LIBXML2_PC_LIBS@ @@ -2802,7 +2823,7 @@ libarchive_la_SOURCES = libarchive/archive_acl.c \ # -no-undefined marks that libarchive doesn't rely on symbols # defined in the application. This is mandatory for cygwin. -libarchive_la_LDFLAGS = -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) +libarchive_la_LDFLAGS = -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) $(GC_SECTIONS) libarchive_la_LIBADD = $(LTLIBICONV) # Manpages to install @@ -2935,6 +2956,7 @@ libarchive_test_SOURCES = \ libarchive/test/test_compat_solaris_tar_acl.c \ libarchive/test/test_compat_solaris_pax_sparse.c \ libarchive/test/test_compat_star_acl.c \ + libarchive/test/test_compat_tar_directory.c \ libarchive/test/test_compat_tar_hardlink.c \ libarchive/test/test_compat_uudecode.c \ libarchive/test/test_compat_uudecode_large.c \ @@ -3023,6 +3045,7 @@ libarchive_test_SOURCES = \ libarchive/test/test_read_format_rar_encryption_data.c \ libarchive/test/test_read_format_rar_encryption_partially.c \ libarchive/test/test_read_format_rar_encryption_header.c \ + libarchive/test/test_read_format_rar_filter.c \ libarchive/test/test_read_format_rar_invalid1.c \ libarchive/test/test_read_format_rar5.c \ libarchive/test/test_read_format_raw.c \ @@ -3032,6 +3055,7 @@ libarchive_test_SOURCES = \ libarchive/test/test_read_format_tar_empty_filename.c \ libarchive/test/test_read_format_tar_empty_with_gnulabel.c \ libarchive/test/test_read_format_tar_filename.c \ + libarchive/test/test_read_format_tar_invalid_pax_size.c \ libarchive/test/test_read_format_tbz.c \ libarchive/test/test_read_format_tgz.c \ libarchive/test/test_read_format_tlz.c \ @@ -3146,6 +3170,7 @@ libarchive_test_SOURCES = \ libarchive/test/test_write_format_xar_empty.c \ libarchive/test/test_write_format_zip.c \ libarchive/test/test_write_format_zip_compression_store.c \ + libarchive/test/test_write_format_zip_entry_size_unset.c \ libarchive/test/test_write_format_zip_empty.c \ libarchive/test/test_write_format_zip_empty_zip64.c \ libarchive/test/test_write_format_zip_file.c \ @@ -3207,6 +3232,7 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_compat_solaris_tar_acl.tar.uu \ libarchive/test/test_compat_star_acl_nfs4.tar.uu \ libarchive/test/test_compat_star_acl_posix1e.tar.uu \ + libarchive/test/test_compat_tar_directory_1.tar.uu \ libarchive/test/test_compat_tar_hardlink_1.tar.uu \ libarchive/test/test_compat_uudecode_large.tar.Z.uu \ libarchive/test/test_compat_xz_1.txz.uu \ @@ -3347,6 +3373,7 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_rar_encryption_data.rar.uu \ libarchive/test/test_read_format_rar_encryption_header.rar.uu \ libarchive/test/test_read_format_rar_encryption_partially.rar.uu \ + libarchive/test/test_read_format_rar_filter.rar.uu \ libarchive/test/test_read_format_rar_invalid1.rar.uu \ libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \ libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu \ @@ -3390,6 +3417,7 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_rar5_nonempty_dir_stream.rar.uu \ libarchive/test/test_read_format_rar5_owner.rar.uu \ libarchive/test/test_read_format_rar5_readtables_overflow.rar.uu \ + libarchive/test/test_read_format_rar5_sfx.exe.uu \ libarchive/test/test_read_format_rar5_solid.rar.uu \ libarchive/test/test_read_format_rar5_stored.rar.uu \ libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu \ @@ -3399,6 +3427,9 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu \ libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu \ libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu \ + libarchive/test/test_read_format_rar5_decode_number_out_of_bounds_read.rar.uu \ + libarchive/test/test_read_format_rar5_window_buf_and_size_desync.rar.uu \ + libarchive/test/test_read_format_rar5_bad_window_sz_in_mltarc_file.rar.uu \ libarchive/test/test_read_format_raw.bufr.uu \ libarchive/test/test_read_format_raw.data.gz.uu \ libarchive/test/test_read_format_raw.data.Z.uu \ @@ -3408,6 +3439,7 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_tar_empty_with_gnulabel.tar.uu \ libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu \ libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_tar_invalid_pax_size.tar.uu \ libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \ libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \ libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \ @@ -3462,6 +3494,8 @@ libarchive_test_EXTRA_DIST = \ libarchive/test/test_read_format_zip_xz_multi.zipx.uu \ libarchive/test/test_read_format_zip_zip64a.zip.uu \ libarchive/test/test_read_format_zip_zip64b.zip.uu \ + libarchive/test/test_read_format_zip_zstd.zipx.uu \ + libarchive/test/test_read_format_zip_zstd_multi.zipx.uu \ libarchive/test/test_read_large_splitted_rar_aa.uu \ libarchive/test/test_read_large_splitted_rar_ab.uu \ libarchive/test/test_read_large_splitted_rar_ac.uu \ @@ -3513,7 +3547,7 @@ bsdtar_DEPENDENCIES = libarchive.la libarchive_fe.la @STATIC_BSDTAR_TRUE@bsdtar_ccstatic = -DLIBARCHIVE_STATIC bsdtar_LDADD = libarchive.la libarchive_fe.la $(LTLIBICONV) bsdtar_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS) -bsdtar_LDFLAGS = $(bsdtar_ldstatic) +bsdtar_LDFLAGS = $(bsdtar_ldstatic) $(GC_SECTIONS) bsdtar_EXTRA_DIST = \ tar/bsdtar.1 \ tar/bsdtar_windows.h \ @@ -3568,6 +3602,7 @@ bsdtar_test_SOURCES = \ tar/test/test_option_fflags.c \ tar/test/test_option_gid_gname.c \ tar/test/test_option_grzip.c \ + tar/test/test_option_ignore_zeros.c \ tar/test/test_option_j.c \ tar/test/test_option_k.c \ tar/test/test_option_keep_newer_files.c \ @@ -3647,7 +3682,7 @@ bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la @STATIC_BSDCPIO_TRUE@bsdcpio_ccstatic = -DLIBARCHIVE_STATIC bsdcpio_LDADD = libarchive_fe.la libarchive.la $(LTLIBICONV) bsdcpio_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS) -bsdcpio_LDFLAGS = $(bsdcpio_ldstatic) +bsdcpio_LDFLAGS = $(bsdcpio_ldstatic) $(GC_SECTIONS) bsdcpio_EXTRA_DIST = \ cpio/bsdcpio.1 \ cpio/cpio_windows.h \ @@ -3774,7 +3809,7 @@ bsdcat_DEPENDENCIES = libarchive.la libarchive_fe.la @STATIC_BSDCAT_TRUE@bsdcat_ccstatic = -DLIBARCHIVE_STATIC bsdcat_LDADD = libarchive_fe.la libarchive.la $(LTLIBICONV) bsdcat_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcat_ccstatic) $(PLATFORMCPPFLAGS) -bsdcat_LDFLAGS = $(bsdcat_ldstatic) +bsdcat_LDFLAGS = $(bsdcat_ldstatic) $(GC_SECTIONS) bsdcat_EXTRA_DIST = \ cat/bsdcat.1 \ cat/CMakeLists.txt @@ -4662,6 +4697,8 @@ tar/test/bsdtar_test-test_option_gid_gname.$(OBJEXT): \ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp) tar/test/bsdtar_test-test_option_grzip.$(OBJEXT): \ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp) +tar/test/bsdtar_test-test_option_ignore_zeros.$(OBJEXT): \ + tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp) tar/test/bsdtar_test-test_option_j.$(OBJEXT): \ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp) tar/test/bsdtar_test-test_option_k.$(OBJEXT): \ @@ -5274,6 +5311,9 @@ libarchive/test/test-test_compat_solaris_pax_sparse.$(OBJEXT): \ libarchive/test/test-test_compat_star_acl.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/test-test_compat_tar_directory.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) libarchive/test/test-test_compat_tar_hardlink.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) @@ -5538,6 +5578,9 @@ libarchive/test/test-test_read_format_rar_encryption_partially.$(OBJEXT): \ libarchive/test/test-test_read_format_rar_encryption_header.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/test-test_read_format_rar_filter.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) libarchive/test/test-test_read_format_rar_invalid1.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) @@ -5565,6 +5608,9 @@ libarchive/test/test-test_read_format_tar_empty_with_gnulabel.$(OBJEXT): \ libarchive/test/test-test_read_format_tar_filename.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/test-test_read_format_tar_invalid_pax_size.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) libarchive/test/test-test_read_format_tbz.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) @@ -5907,6 +5953,9 @@ libarchive/test/test-test_write_format_zip.$(OBJEXT): \ libarchive/test/test-test_write_format_zip_compression_store.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) +libarchive/test/test-test_write_format_zip_entry_size_unset.$(OBJEXT): \ + libarchive/test/$(am__dirstamp) \ + libarchive/test/$(DEPDIR)/$(am__dirstamp) libarchive/test/test-test_write_format_zip_empty.$(OBJEXT): \ libarchive/test/$(am__dirstamp) \ libarchive/test/$(DEPDIR)/$(am__dirstamp) @@ -6349,6 +6398,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_compat_solaris_pax_sparse.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_compat_solaris_tar_acl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_compat_star_acl.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_compat_tar_hardlink.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_compat_uudecode.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_compat_uudecode_large.Po@am__quote@ # am--include-marker @@ -6438,6 +6488,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_data.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_header.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_partially.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_rar_invalid1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_raw.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar.Po@am__quote@ # am--include-marker @@ -6446,6 +6497,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_pax.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po@am__quote@ # am--include-marker @@ -6562,6 +6614,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_compression_store.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty_zip64.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_file.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po@am__quote@ # am--include-marker @@ -6617,6 +6670,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_fflags.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_gid_gname.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_grzip.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_j.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_k.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_keep_newer_files.Po@am__quote@ # am--include-marker @@ -8414,6 +8468,20 @@ tar/test/bsdtar_test-test_option_grzip.obj: tar/test/test_option_grzip.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_grzip.obj `if test -f 'tar/test/test_option_grzip.c'; then $(CYGPATH_W) 'tar/test/test_option_grzip.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_grzip.c'; fi` +tar/test/bsdtar_test-test_option_ignore_zeros.o: tar/test/test_option_ignore_zeros.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_ignore_zeros.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Tpo -c -o tar/test/bsdtar_test-test_option_ignore_zeros.o `test -f 'tar/test/test_option_ignore_zeros.c' || echo '$(srcdir)/'`tar/test/test_option_ignore_zeros.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tar/test/test_option_ignore_zeros.c' object='tar/test/bsdtar_test-test_option_ignore_zeros.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_ignore_zeros.o `test -f 'tar/test/test_option_ignore_zeros.c' || echo '$(srcdir)/'`tar/test/test_option_ignore_zeros.c + +tar/test/bsdtar_test-test_option_ignore_zeros.obj: tar/test/test_option_ignore_zeros.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_ignore_zeros.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Tpo -c -o tar/test/bsdtar_test-test_option_ignore_zeros.obj `if test -f 'tar/test/test_option_ignore_zeros.c'; then $(CYGPATH_W) 'tar/test/test_option_ignore_zeros.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_ignore_zeros.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tar/test/test_option_ignore_zeros.c' object='tar/test/bsdtar_test-test_option_ignore_zeros.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_ignore_zeros.obj `if test -f 'tar/test/test_option_ignore_zeros.c'; then $(CYGPATH_W) 'tar/test/test_option_ignore_zeros.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_ignore_zeros.c'; fi` + tar/test/bsdtar_test-test_option_j.o: tar/test/test_option_j.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_j.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_j.Tpo -c -o tar/test/bsdtar_test-test_option_j.o `test -f 'tar/test/test_option_j.c' || echo '$(srcdir)/'`tar/test/test_option_j.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tar/test/$(DEPDIR)/bsdtar_test-test_option_j.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_j.Po @@ -11452,6 +11520,20 @@ libarchive/test/test-test_compat_star_acl.obj: libarchive/test/test_compat_star_ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_compat_star_acl.obj `if test -f 'libarchive/test/test_compat_star_acl.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_star_acl.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_star_acl.c'; fi` +libarchive/test/test-test_compat_tar_directory.o: libarchive/test/test_compat_tar_directory.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_compat_tar_directory.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Tpo -c -o libarchive/test/test-test_compat_tar_directory.o `test -f 'libarchive/test/test_compat_tar_directory.c' || echo '$(srcdir)/'`libarchive/test/test_compat_tar_directory.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Tpo libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_compat_tar_directory.c' object='libarchive/test/test-test_compat_tar_directory.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_compat_tar_directory.o `test -f 'libarchive/test/test_compat_tar_directory.c' || echo '$(srcdir)/'`libarchive/test/test_compat_tar_directory.c + +libarchive/test/test-test_compat_tar_directory.obj: libarchive/test/test_compat_tar_directory.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_compat_tar_directory.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Tpo -c -o libarchive/test/test-test_compat_tar_directory.obj `if test -f 'libarchive/test/test_compat_tar_directory.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_tar_directory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_tar_directory.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Tpo libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_compat_tar_directory.c' object='libarchive/test/test-test_compat_tar_directory.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_compat_tar_directory.obj `if test -f 'libarchive/test/test_compat_tar_directory.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_tar_directory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_tar_directory.c'; fi` + libarchive/test/test-test_compat_tar_hardlink.o: libarchive/test/test_compat_tar_hardlink.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_compat_tar_hardlink.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_compat_tar_hardlink.Tpo -c -o libarchive/test/test-test_compat_tar_hardlink.o `test -f 'libarchive/test/test_compat_tar_hardlink.c' || echo '$(srcdir)/'`libarchive/test/test_compat_tar_hardlink.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_compat_tar_hardlink.Tpo libarchive/test/$(DEPDIR)/test-test_compat_tar_hardlink.Po @@ -12684,6 +12766,20 @@ libarchive/test/test-test_read_format_rar_encryption_header.obj: libarchive/test @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_read_format_rar_encryption_header.obj `if test -f 'libarchive/test/test_read_format_rar_encryption_header.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_rar_encryption_header.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_rar_encryption_header.c'; fi` +libarchive/test/test-test_read_format_rar_filter.o: libarchive/test/test_read_format_rar_filter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_rar_filter.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Tpo -c -o libarchive/test/test-test_read_format_rar_filter.o `test -f 'libarchive/test/test_read_format_rar_filter.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_rar_filter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_rar_filter.c' object='libarchive/test/test-test_read_format_rar_filter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_read_format_rar_filter.o `test -f 'libarchive/test/test_read_format_rar_filter.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_rar_filter.c + +libarchive/test/test-test_read_format_rar_filter.obj: libarchive/test/test_read_format_rar_filter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_rar_filter.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Tpo -c -o libarchive/test/test-test_read_format_rar_filter.obj `if test -f 'libarchive/test/test_read_format_rar_filter.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_rar_filter.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_rar_filter.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_rar_filter.c' object='libarchive/test/test-test_read_format_rar_filter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_read_format_rar_filter.obj `if test -f 'libarchive/test/test_read_format_rar_filter.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_rar_filter.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_rar_filter.c'; fi` + libarchive/test/test-test_read_format_rar_invalid1.o: libarchive/test/test_read_format_rar_invalid1.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_rar_invalid1.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_rar_invalid1.Tpo -c -o libarchive/test/test-test_read_format_rar_invalid1.o `test -f 'libarchive/test/test_read_format_rar_invalid1.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_rar_invalid1.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_rar_invalid1.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_rar_invalid1.Po @@ -12810,6 +12906,20 @@ libarchive/test/test-test_read_format_tar_filename.obj: libarchive/test/test_rea @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_read_format_tar_filename.obj `if test -f 'libarchive/test/test_read_format_tar_filename.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tar_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_filename.c'; fi` +libarchive/test/test-test_read_format_tar_invalid_pax_size.o: libarchive/test/test_read_format_tar_invalid_pax_size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_tar_invalid_pax_size.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Tpo -c -o libarchive/test/test-test_read_format_tar_invalid_pax_size.o `test -f 'libarchive/test/test_read_format_tar_invalid_pax_size.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar_invalid_pax_size.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_tar_invalid_pax_size.c' object='libarchive/test/test-test_read_format_tar_invalid_pax_size.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_read_format_tar_invalid_pax_size.o `test -f 'libarchive/test/test_read_format_tar_invalid_pax_size.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar_invalid_pax_size.c + +libarchive/test/test-test_read_format_tar_invalid_pax_size.obj: libarchive/test/test_read_format_tar_invalid_pax_size.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_tar_invalid_pax_size.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Tpo -c -o libarchive/test/test-test_read_format_tar_invalid_pax_size.obj `if test -f 'libarchive/test/test_read_format_tar_invalid_pax_size.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tar_invalid_pax_size.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_invalid_pax_size.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_read_format_tar_invalid_pax_size.c' object='libarchive/test/test-test_read_format_tar_invalid_pax_size.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_read_format_tar_invalid_pax_size.obj `if test -f 'libarchive/test/test_read_format_tar_invalid_pax_size.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tar_invalid_pax_size.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_invalid_pax_size.c'; fi` + libarchive/test/test-test_read_format_tbz.o: libarchive/test/test_read_format_tbz.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_read_format_tbz.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Tpo -c -o libarchive/test/test-test_read_format_tbz.o `test -f 'libarchive/test/test_read_format_tbz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tbz.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Tpo libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po @@ -14406,6 +14516,20 @@ libarchive/test/test-test_write_format_zip_compression_store.obj: libarchive/tes @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_write_format_zip_compression_store.obj `if test -f 'libarchive/test/test_write_format_zip_compression_store.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_compression_store.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_compression_store.c'; fi` +libarchive/test/test-test_write_format_zip_entry_size_unset.o: libarchive/test/test_write_format_zip_entry_size_unset.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_write_format_zip_entry_size_unset.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Tpo -c -o libarchive/test/test-test_write_format_zip_entry_size_unset.o `test -f 'libarchive/test/test_write_format_zip_entry_size_unset.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_entry_size_unset.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Tpo libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_format_zip_entry_size_unset.c' object='libarchive/test/test-test_write_format_zip_entry_size_unset.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_write_format_zip_entry_size_unset.o `test -f 'libarchive/test/test_write_format_zip_entry_size_unset.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_entry_size_unset.c + +libarchive/test/test-test_write_format_zip_entry_size_unset.obj: libarchive/test/test_write_format_zip_entry_size_unset.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_write_format_zip_entry_size_unset.obj -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Tpo -c -o libarchive/test/test-test_write_format_zip_entry_size_unset.obj `if test -f 'libarchive/test/test_write_format_zip_entry_size_unset.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_entry_size_unset.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_entry_size_unset.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Tpo libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libarchive/test/test_write_format_zip_entry_size_unset.c' object='libarchive/test/test-test_write_format_zip_entry_size_unset.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/test-test_write_format_zip_entry_size_unset.obj `if test -f 'libarchive/test/test_write_format_zip_entry_size_unset.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_entry_size_unset.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_entry_size_unset.c'; fi` + libarchive/test/test-test_write_format_zip_empty.o: libarchive/test/test_write_format_zip_empty.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/test-test_write_format_zip_empty.o -MD -MP -MF libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty.Tpo -c -o libarchive/test/test-test_write_format_zip_empty.o `test -f 'libarchive/test/test_write_format_zip_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_empty.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty.Tpo libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty.Po @@ -14894,7 +15018,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -14970,7 +15094,6 @@ bsdcat_test.log: bsdcat_test$(EXEEXT) @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -15031,6 +15154,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -15072,6 +15199,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -15087,7 +15216,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -15147,13 +15276,16 @@ all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(MANS) $(DATA) $(HEADERS) \ config.h install-binPROGRAMS: install-libLTLIBRARIES +install-checkPROGRAMS: install-libLTLIBRARIES + installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am +install-exec: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -15604,6 +15736,7 @@ distclean: distclean-am -rm -f libarchive/test/$(DEPDIR)/test-test_compat_solaris_pax_sparse.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_solaris_tar_acl.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_star_acl.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_tar_hardlink.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_uudecode.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_uudecode_large.Po @@ -15693,6 +15826,7 @@ distclean: distclean-am -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_data.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_header.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_partially.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_invalid1.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_raw.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar.Po @@ -15701,6 +15835,7 @@ distclean: distclean-am -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_pax.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po @@ -15817,6 +15952,7 @@ distclean: distclean-am -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_compression_store.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty_zip64.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_file.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po @@ -15872,6 +16008,7 @@ distclean: distclean-am -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_fflags.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_gid_gname.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_grzip.Po + -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_j.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_k.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_keep_newer_files.Po @@ -16346,6 +16483,7 @@ maintainer-clean: maintainer-clean-am -rm -f libarchive/test/$(DEPDIR)/test-test_compat_solaris_pax_sparse.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_solaris_tar_acl.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_star_acl.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_compat_tar_directory.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_tar_hardlink.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_uudecode.Po -rm -f libarchive/test/$(DEPDIR)/test-test_compat_uudecode_large.Po @@ -16435,6 +16573,7 @@ maintainer-clean: maintainer-clean-am -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_data.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_header.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_encryption_partially.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_filter.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_rar_invalid1.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_raw.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar.Po @@ -16443,6 +16582,7 @@ maintainer-clean: maintainer-clean-am -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_pax.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_empty_with_gnulabel.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_filename.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tar_invalid_pax_size.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tbz.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tgz.Po -rm -f libarchive/test/$(DEPDIR)/test-test_read_format_tlz.Po @@ -16559,6 +16699,7 @@ maintainer-clean: maintainer-clean-am -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_compression_store.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_empty_zip64.Po + -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_entry_size_unset.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_file.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_file_zip64.Po -rm -f libarchive/test/$(DEPDIR)/test-test_write_format_zip_large.Po @@ -16614,6 +16755,7 @@ maintainer-clean: maintainer-clean-am -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_fflags.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_gid_gname.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_grzip.Po + -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_ignore_zeros.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_j.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_k.Po -rm -f tar/test/$(DEPDIR)/bsdtar_test-test_option_keep_newer_files.Po @@ -16672,7 +16814,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5 -.MAKE: all check check-am install install-am install-strip +.MAKE: all check check-am install install-am install-exec \ + install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \ check-TESTS check-am clean clean-binPROGRAMS \ @@ -16680,7 +16823,7 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5 clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ - dist-zip distcheck distclean distclean-compile \ + dist-zip dist-zstd distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-libtool \ distclean-local distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ diff --git a/src/dependencies/libarchive-3.5.2/NEWS b/src/dependencies/libarchive-3.6.2/NEWS similarity index 99% rename from src/dependencies/libarchive-3.5.2/NEWS rename to src/dependencies/libarchive-3.6.2/NEWS index 0964106..d632448 100644 --- a/src/dependencies/libarchive-3.5.2/NEWS +++ b/src/dependencies/libarchive-3.6.2/NEWS @@ -1,3 +1,11 @@ +Wed 07, 2022: libarchive 3.6.2 released + +Apr 08, 2022: libarchive 3.6.1 released + +Feb 09, 2022: libarchive 3.6.0 released + +Feb 08, 2022: libarchive 3.5.3 released + Aug 22, 2021: libarchive 3.5.2 released Dec 26, 2020: libarchive 3.5.1 released diff --git a/src/dependencies/libarchive-3.5.2/README.md b/src/dependencies/libarchive-3.6.2/README.md similarity index 99% rename from src/dependencies/libarchive-3.5.2/README.md rename to src/dependencies/libarchive-3.6.2/README.md index d5ef70c..4040762 100644 --- a/src/dependencies/libarchive-3.5.2/README.md +++ b/src/dependencies/libarchive-3.6.2/README.md @@ -37,6 +37,7 @@ The top-level directory contains the following information files: * **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`). The following files in the top-level directory are used by the 'configure' script: + * `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers * `Makefile.in`, `config.h.in` - templates used by configure script @@ -71,6 +72,7 @@ know about any errors or omissions you find. ## Supported Formats Currently, the library automatically detects and reads the following formats: + * Old V7 tar archives * POSIX ustar * GNU tar format (including GNU long filenames, long link names, and sparse files) @@ -92,6 +94,7 @@ Currently, the library automatically detects and reads the following formats: * XAR archives The library also detects and handles any of the following before evaluating the archive: + * uuencoded files * files with RPM wrapper * gzip compression @@ -103,6 +106,7 @@ The library also detects and handles any of the following before evaluating the * zstandard compression The library can create archives in any of the following formats: + * POSIX ustar * POSIX pax interchange format * "restricted" pax format, which will create ustar archives except for @@ -122,6 +126,7 @@ The library can create archives in any of the following formats: * XAR archives When creating archives, the result can be filtered with any of the following: + * uuencode * gzip compression * bzip2 compression diff --git a/src/dependencies/libarchive-3.5.2/aclocal.m4 b/src/dependencies/libarchive-3.6.2/aclocal.m4 similarity index 99% rename from src/dependencies/libarchive-3.5.2/aclocal.m4 rename to src/dependencies/libarchive-3.6.2/aclocal.m4 index e35d2fb..14646f7 100644 --- a/src/dependencies/libarchive-3.5.2/aclocal.m4 +++ b/src/dependencies/libarchive-3.6.2/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,8 +14,8 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) @@ -1085,11 +1085,11 @@ _LT_EOF # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) + 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; @@ -9074,9 +9074,9 @@ m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl @@ -9117,7 +9117,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -9218,7 +9218,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -9228,11 +9228,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -9249,7 +9249,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -9350,7 +9350,7 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9365,7 +9365,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -9381,14 +9381,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9440,7 +9440,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9471,7 +9471,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9662,7 +9662,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9701,7 +9701,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -9728,7 +9730,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9756,6 +9758,10 @@ m4_defn([AC_PROG_CC]) # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -9792,7 +9798,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -9844,6 +9850,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -9925,7 +9945,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9946,7 +9966,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -9968,7 +9988,7 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10003,7 +10023,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10046,7 +10066,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10067,12 +10087,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -10085,7 +10100,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10114,7 +10129,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10161,7 +10176,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10180,7 +10195,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10261,7 +10276,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10321,7 +10336,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10349,7 +10364,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10368,7 +10383,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10509,3 +10524,4 @@ m4_include([build/autoconf/la_uid_t.m4]) m4_include([build/autoconf/lib-ld.m4]) m4_include([build/autoconf/lib-link.m4]) m4_include([build/autoconf/lib-prefix.m4]) +m4_include([build/autoconf/m4_ax_compile_check_sizeof.m4]) diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/ax_append_compile_flags.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/ax_append_compile_flags.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/ax_append_flag.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/ax_append_flag.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/ax_check_compile_flag.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/ax_check_compile_flag.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/ax_require_defined.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/ax_require_defined.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/check_stdcall_func.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/check_stdcall_func.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/check_stdcall_func.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/check_stdcall_func.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/compile b/src/dependencies/libarchive-3.6.2/build/autoconf/compile similarity index 98% rename from src/dependencies/libarchive-3.5.2/build/autoconf/compile rename to src/dependencies/libarchive-3.6.2/build/autoconf/compile index 99e5052..df363c8 100755 --- a/src/dependencies/libarchive-3.5.2/build/autoconf/compile +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/config.guess b/src/dependencies/libarchive-3.6.2/build/autoconf/config.guess similarity index 54% rename from src/dependencies/libarchive-3.5.2/build/autoconf/config.guess rename to src/dependencies/libarchive-3.6.2/build/autoconf/config.guess index f50dcdb..7f76b62 100755 --- a/src/dependencies/libarchive-3.5.2/build/autoconf/config.guess +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/config.guess @@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2018-02-24' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -27,11 +29,19 @@ timestamp='2018-02-24' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ @@ -50,7 +60,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,7 +94,8 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 +# Just in case it came from the environment. +GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -96,73 +107,90 @@ trap 'exit 1' 1 2 15 # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > "$dummy.c" ; - for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown - eval "$set_cc_for_build" + set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -174,12 +202,12 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; @@ -188,18 +216,18 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown + machine=${arch}${endian}-unknown ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval "$set_cc_for_build" + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -215,7 +243,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in + case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` @@ -226,7 +254,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; @@ -237,45 +265,57 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; + GUESS=$UNAME_MACHINE-unknown-redox + ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -289,7 +329,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in + case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") @@ -326,117 +366,121 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval "$set_cc_for_build" + set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in + case `/bin/arch` in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -446,43 +490,43 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ @@ -508,78 +552,79 @@ EOF dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux"$UNAME_RELEASE" + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux"$UNAME_RELEASE" + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then + if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include @@ -593,16 +638,16 @@ EOF EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then @@ -610,57 +655,57 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; + GUESS=rs6000-ibm-aix + ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then + if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in + case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in + case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then - eval "$set_cc_for_build" + if test "$HP_ARCH" = ""; then + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE @@ -698,9 +743,9 @@ EOF test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if test "$HP_ARCH" = hppa2.0w then - eval "$set_cc_for_build" + set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -719,14 +764,14 @@ EOF HP_ARCH=hppa64 fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int @@ -754,36 +799,36 @@ EOF EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - echo hppa1.1-hp-bsd - exit ;; + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -791,17 +836,18 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ @@ -809,103 +855,129 @@ EOF -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in + case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys - exit ;; + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case $UNAME_MACHINE in x86) - echo i586-pc-interix"$UNAME_RELEASE" - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" - exit ;; - i*86:Minix:*:*) - echo "$UNAME_MACHINE"-pc-minix - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -916,187 +988,225 @@ EOF esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el + MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} + MIPS_ENDIAN= #else - CPU= + MIPS_ENDIAN= #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" - test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; + GUESS=or1k-unknown-linux-$LIBC + ;; or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) - if objdump -f /bin/sh | grep -q elf32-x86-64; then - echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 - else - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI=${LIBC}x32 + fi fi - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp - exit ;; + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in @@ -1104,12 +1214,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1119,11 +1229,11 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -1131,31 +1241,31 @@ EOF # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) @@ -1180,249 +1290,404 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; + ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv"$UNAME_RELEASE" + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv"$UNAME_RELEASE" + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; + GUESS=i586-pc-haiku + ;; x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=x86_64-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" - exit ;; + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval "$set_cc_for_build" - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; + GUESS=i386-pc-qnx + ;; NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" - exit ;; + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = 386; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo "$UNAME_MACHINE"-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos - exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; esac +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + echo "$0: unable to guess system type" >&2 -case "$UNAME_MACHINE:$UNAME_SYSTEM" in +case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2022 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/depcomp b/src/dependencies/libarchive-3.6.2/build/autoconf/depcomp similarity index 99% rename from src/dependencies/libarchive-3.5.2/build/autoconf/depcomp rename to src/dependencies/libarchive-3.6.2/build/autoconf/depcomp index 65cbf70..715e343 100755 --- a/src/dependencies/libarchive-3.5.2/build/autoconf/depcomp +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/depcomp @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/iconv.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/iconv.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/iconv.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/iconv.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/install-sh b/src/dependencies/libarchive-3.6.2/build/autoconf/install-sh similarity index 79% rename from src/dependencies/libarchive-3.5.2/build/autoconf/install-sh rename to src/dependencies/libarchive-3.6.2/build/autoconf/install-sh index 8175c64..ec298b5 100755 --- a/src/dependencies/libarchive-3.5.2/build/autoconf/install-sh +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ do if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -451,7 +456,18 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -477,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -491,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/la_uid_t.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/la_uid_t.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/la_uid_t.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/la_uid_t.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/lib-ld.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/lib-ld.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/lib-ld.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/lib-ld.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/lib-link.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/lib-link.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/lib-link.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/lib-link.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/lib-prefix.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/lib-prefix.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autoconf/lib-prefix.m4 rename to src/dependencies/libarchive-3.6.2/build/autoconf/lib-prefix.m4 diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/ltmain.sh b/src/dependencies/libarchive-3.6.2/build/autoconf/ltmain.sh old mode 100644 new mode 100755 similarity index 99% rename from src/dependencies/libarchive-3.5.2/build/autoconf/ltmain.sh rename to src/dependencies/libarchive-3.6.2/build/autoconf/ltmain.sh index 0cb7f90..540a92a --- a/src/dependencies/libarchive-3.5.2/build/autoconf/ltmain.sh +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/ltmain.sh @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-14" +VERSION="2.4.6 Debian-2.4.6-15build2" package_revision=2.4.6 @@ -2141,7 +2141,7 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname $scriptversion Debian-2.4.6-14 + version: $progname $scriptversion Debian-2.4.6-15build2 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` diff --git a/src/dependencies/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 b/src/dependencies/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 new file mode 100644 index 0000000..f834df6 --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 @@ -0,0 +1,115 @@ +# ============================================================================ +# https://www.gnu.org/software/autoconf-archive/ax_compile_check_sizeof.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_COMPILE_CHECK_SIZEOF(TYPE [, HEADERS [, EXTRA_SIZES...]]) +# +# DESCRIPTION +# +# This macro checks for the size of TYPE using compile checks, not run +# checks. You can supply extra HEADERS to look into. the check will cycle +# through 1 2 4 8 16 and any EXTRA_SIZES the user supplies. If a match is +# found, it will #define SIZEOF_`TYPE' to that value. Otherwise it will +# emit a configure time error indicating the size of the type could not be +# determined. +# +# The trick is that C will not allow duplicate case labels. While this is +# valid C code: +# +# switch (0) case 0: case 1:; +# +# The following is not: +# +# switch (0) case 0: case 0:; +# +# Thus, the AC_COMPILE_IFELSE will fail if the currently tried size does +# not match. +# +# Here is an example skeleton configure.in script, demonstrating the +# macro's usage: +# +# AC_PROG_CC +# AC_CHECK_HEADERS(stddef.h unistd.h) +# AC_TYPE_SIZE_T +# AC_CHECK_TYPE(ssize_t, int) +# +# headers='#ifdef HAVE_STDDEF_H +# #include +# #endif +# #ifdef HAVE_UNISTD_H +# #include +# #endif +# ' +# +# AX_COMPILE_CHECK_SIZEOF(char) +# AX_COMPILE_CHECK_SIZEOF(short) +# AX_COMPILE_CHECK_SIZEOF(int) +# AX_COMPILE_CHECK_SIZEOF(long) +# AX_COMPILE_CHECK_SIZEOF(unsigned char *) +# AX_COMPILE_CHECK_SIZEOF(void *) +# AX_COMPILE_CHECK_SIZEOF(size_t, $headers) +# AX_COMPILE_CHECK_SIZEOF(ssize_t, $headers) +# AX_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers) +# AX_COMPILE_CHECK_SIZEOF(off_t, $headers) +# +# LICENSE +# +# Copyright (c) 2008 Kaveh Ghazi +# Copyright (c) 2017 Reini Urban +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 8 + +AU_ALIAS([AC_COMPILE_CHECK_SIZEOF], [AX_COMPILE_CHECK_SIZEOF]) +AC_DEFUN([AX_COMPILE_CHECK_SIZEOF], +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +$2 +]], [[switch (0) case 0: case (sizeof ($1) == $ac_size):;]])], [AC_CV_NAME=$ac_size]) + if test x$AC_CV_NAME != x ; then break; fi +done +]) +if test x$AC_CV_NAME = x ; then + AC_MSG_ERROR([cannot determine a size for $1]) +fi +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1]) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/missing b/src/dependencies/libarchive-3.6.2/build/autoconf/missing similarity index 99% rename from src/dependencies/libarchive-3.5.2/build/autoconf/missing rename to src/dependencies/libarchive-3.6.2/build/autoconf/missing index 625aeb1..1fe1611 100755 --- a/src/dependencies/libarchive-3.5.2/build/autoconf/missing +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/missing @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/src/dependencies/libarchive-3.5.2/build/autoconf/test-driver b/src/dependencies/libarchive-3.6.2/build/autoconf/test-driver similarity index 88% rename from src/dependencies/libarchive-3.5.2/build/autoconf/test-driver rename to src/dependencies/libarchive-3.6.2/build/autoconf/test-driver index b8521a4..be73b80 100755 --- a/src/dependencies/libarchive-3.5.2/build/autoconf/test-driver +++ b/src/dependencies/libarchive-3.6.2/build/autoconf/test-driver @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2018 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,11 +42,13 @@ print_usage () { cat <$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -126,7 +131,7 @@ esac # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" diff --git a/src/dependencies/libarchive-3.5.2/build/autogen.sh b/src/dependencies/libarchive-3.6.2/build/autogen.sh similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/autogen.sh rename to src/dependencies/libarchive-3.6.2/build/autogen.sh diff --git a/src/dependencies/libarchive-3.5.2/build/bump-version.sh b/src/dependencies/libarchive-3.6.2/build/bump-version.sh similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/bump-version.sh rename to src/dependencies/libarchive-3.6.2/build/bump-version.sh diff --git a/src/dependencies/libarchive-3.5.2/build/clean.sh b/src/dependencies/libarchive-3.6.2/build/clean.sh similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/clean.sh rename to src/dependencies/libarchive-3.6.2/build/clean.sh diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/CheckFileOffsetBits.c b/src/dependencies/libarchive-3.6.2/build/cmake/CheckFileOffsetBits.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/CheckFileOffsetBits.c rename to src/dependencies/libarchive-3.6.2/build/cmake/CheckFileOffsetBits.c diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/CheckFileOffsetBits.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/CheckFileOffsetBits.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/CheckFileOffsetBits.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/CheckFileOffsetBits.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/CheckFuncs.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/CheckFuncs.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/CheckFuncs.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/CheckFuncs.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/CheckFuncs_stub.c.in b/src/dependencies/libarchive-3.6.2/build/cmake/CheckFuncs_stub.c.in similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/CheckFuncs_stub.c.in rename to src/dependencies/libarchive-3.6.2/build/cmake/CheckFuncs_stub.c.in diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/CheckHeaderDirent.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/CheckHeaderDirent.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/CheckHeaderDirent.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/CheckHeaderDirent.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/CheckTypeExists.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/CheckTypeExists.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/CheckTypeExists.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/CheckTypeExists.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/CreatePkgConfigFile.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/CreatePkgConfigFile.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/CreatePkgConfigFile.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/CreatePkgConfigFile.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/FindLibGCC.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/FindLIBGCC.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/FindLibGCC.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/FindLIBGCC.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/FindMbedTLS.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/FindMbedTLS.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/FindMbedTLS.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/FindMbedTLS.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/FindNettle.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/FindNettle.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/FindNettle.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/FindNettle.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/FindPCREPOSIX.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/FindPCREPOSIX.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/FindPCREPOSIX.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/FindPCREPOSIX.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/LibarchiveCodeCoverage.cmake b/src/dependencies/libarchive-3.6.2/build/cmake/LibarchiveCodeCoverage.cmake similarity index 100% rename from src/dependencies/libarchive-3.5.2/build/cmake/LibarchiveCodeCoverage.cmake rename to src/dependencies/libarchive-3.6.2/build/cmake/LibarchiveCodeCoverage.cmake diff --git a/src/dependencies/libarchive-3.5.2/build/cmake/config.h.in b/src/dependencies/libarchive-3.6.2/build/cmake/config.h.in similarity index 94% rename from src/dependencies/libarchive-3.5.2/build/cmake/config.h.in rename to src/dependencies/libarchive-3.6.2/build/cmake/config.h.in index 5ddd2f3..5012ad2 100644 --- a/src/dependencies/libarchive-3.5.2/build/cmake/config.h.in +++ b/src/dependencies/libarchive-3.6.2/build/cmake/config.h.in @@ -23,14 +23,14 @@ #cmakedefine HAVE_UNSIGNED___INT64 /* The sizes of various standard integer types. */ -@SIZE_OF_SHORT_CODE@ -@SIZE_OF_INT_CODE@ -@SIZE_OF_LONG_CODE@ -@SIZE_OF_LONG_LONG_CODE@ -@SIZE_OF_UNSIGNED_SHORT_CODE@ -@SIZE_OF_UNSIGNED_CODE@ -@SIZE_OF_UNSIGNED_LONG_CODE@ -@SIZE_OF_UNSIGNED_LONG_LONG_CODE@ +@SIZEOF_SHORT_CODE@ +@SIZEOF_INT_CODE@ +@SIZEOF_LONG_CODE@ +@SIZEOF_LONG_LONG_CODE@ +@SIZEOF_UNSIGNED_SHORT_CODE@ +@SIZEOF_UNSIGNED_CODE@ +@SIZEOF_UNSIGNED_LONG_CODE@ +@SIZEOF_UNSIGNED_LONG_LONG_CODE@ /* * If we lack int64_t, define it to the first of __int64, int, long, and long long @@ -41,17 +41,17 @@ typedef __int64 int64_t; #define HAVE_INT64_T #endif -#if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8 +#if !defined(HAVE_INT64_T) && SIZEOF_INT == 8 typedef int int64_t; #define HAVE_INT64_T #endif -#if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8 +#if !defined(HAVE_INT64_T) && SIZEOF_LONG == 8 typedef long int64_t; #define HAVE_INT64_T #endif -#if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8 +#if !defined(HAVE_INT64_T) && SIZEOF_LONG_LONG == 8 typedef long long int64_t; #define HAVE_INT64_T #endif @@ -63,12 +63,12 @@ typedef long long int64_t; /* * Similarly for int32_t */ -#if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4 +#if !defined(HAVE_INT32_T) && SIZEOF_INT == 4 typedef int int32_t; #define HAVE_INT32_T #endif -#if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4 +#if !defined(HAVE_INT32_T) && SIZEOF_LONG == 4 typedef long int32_t; #define HAVE_INT32_T #endif @@ -80,12 +80,12 @@ typedef long int32_t; /* * Similarly for int16_t */ -#if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2 +#if !defined(HAVE_INT16_T) && SIZEOF_INT == 2 typedef int int16_t; #define HAVE_INT16_T #endif -#if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2 +#if !defined(HAVE_INT16_T) && SIZEOF_SHORT == 2 typedef short int16_t; #define HAVE_INT16_T #endif @@ -102,17 +102,17 @@ typedef unsigned __int64 uint64_t; #define HAVE_UINT64_T #endif -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8 +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED == 8 typedef unsigned uint64_t; #define HAVE_UINT64_T #endif -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8 +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG == 8 typedef unsigned long uint64_t; #define HAVE_UINT64_T #endif -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8 +#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG_LONG == 8 typedef unsigned long long uint64_t; #define HAVE_UINT64_T #endif @@ -125,12 +125,12 @@ typedef unsigned long long uint64_t; /* * Similarly for uint32_t */ -#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4 +#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED == 4 typedef unsigned uint32_t; #define HAVE_UINT32_T #endif -#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4 +#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED_LONG == 4 typedef unsigned long uint32_t; #define HAVE_UINT32_T #endif @@ -142,12 +142,12 @@ typedef unsigned long uint32_t; /* * Similarly for uint16_t */ -#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2 +#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED == 2 typedef unsigned uint16_t; #define HAVE_UINT16_T #endif -#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2 +#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED_SHORT == 2 typedef unsigned short uint16_t; #define HAVE_UINT16_T #endif @@ -316,13 +316,13 @@ typedef uint64_t uintmax_t; #cmakedefine ARCHIVE_XATTR_LINUX 1 /* Version number of bsdcpio */ -#cmakedefine BSDCPIO_VERSION_STRING "${BSDCPIO_VERSION_STRING}" +#cmakedefine BSDCPIO_VERSION_STRING "@BSDCPIO_VERSION_STRING@" /* Version number of bsdtar */ -#cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}" +#cmakedefine BSDTAR_VERSION_STRING "@BSDTAR_VERSION_STRING@" /* Version number of bsdcat */ -#cmakedefine BSDCAT_VERSION_STRING "${BSDCAT_VERSION_STRING}" +#cmakedefine BSDCAT_VERSION_STRING "@BSDCAT_VERSION_STRING@" /* Define to 1 if you have the `acl_create_entry' function. */ #cmakedefine HAVE_ACL_CREATE_ENTRY 1 @@ -738,6 +738,10 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `zstd' library (-lzstd). */ #cmakedefine HAVE_LIBZSTD 1 +/* Define to 1 if you have the `zstd' library (-lzstd) with compression + support. */ +#cmakedefine HAVE_LIBZSTD_COMPRESSOR 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIMITS_H 1 @@ -1227,13 +1231,13 @@ typedef uint64_t uintmax_t; #cmakedefine HAVE__MKGMTIME64 1 /* Define as const if the declaration of iconv() needs const. */ -#define ICONV_CONST ${ICONV_CONST} +#define ICONV_CONST @ICONV_CONST@ /* Version number of libarchive as a single integer */ -#cmakedefine LIBARCHIVE_VERSION_NUMBER "${LIBARCHIVE_VERSION_NUMBER}" +#cmakedefine LIBARCHIVE_VERSION_NUMBER "@LIBARCHIVE_VERSION_NUMBER@" /* Version number of libarchive */ -#cmakedefine LIBARCHIVE_VERSION_STRING "${LIBARCHIVE_VERSION_STRING}" +#cmakedefine LIBARCHIVE_VERSION_STRING "@LIBARCHIVE_VERSION_STRING@" /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ @@ -1251,7 +1255,7 @@ typedef uint64_t uintmax_t; #cmakedefine NO_MINUS_C_MINUS_O 1 /* The size of `wchar_t', as computed by sizeof. */ -#cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T} +#cmakedefine SIZEOF_WCHAR_T @SIZEOF_WCHAR_T@ /* Define to 1 if strerror_r returns char *. */ #cmakedefine STRERROR_R_CHAR_P 1 @@ -1287,59 +1291,59 @@ typedef uint64_t uintmax_t; #endif /* SAFE_TO_DEFINE_EXTENSIONS */ /* Version number of package */ -#cmakedefine VERSION "${VERSION}" +#cmakedefine VERSION "@VERSION@" /* Number of bits in a file offset, on hosts where this is settable. */ -#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} +#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #cmakedefine _LARGEFILE_SOURCE 1 /* Define for large files, on AIX-style hosts. */ -#cmakedefine _LARGE_FILES ${_LARGE_FILES} +#cmakedefine _LARGE_FILES @_LARGE_FILES@ /* Define to control Windows SDK version */ #ifndef NTDDI_VERSION -#cmakedefine NTDDI_VERSION ${NTDDI_VERSION} +#cmakedefine NTDDI_VERSION @NTDDI_VERSION@ #endif // NTDDI_VERSION #ifndef _WIN32_WINNT -#cmakedefine _WIN32_WINNT ${_WIN32_WINNT} +#cmakedefine _WIN32_WINNT @_WIN32_WINNT@ #endif // _WIN32_WINNT #ifndef WINVER -#cmakedefine WINVER ${WINVER} +#cmakedefine WINVER @WINVER@ #endif // WINVER /* Define to empty if `const' does not conform to ANSI C. */ -#cmakedefine const ${const} +#cmakedefine const @const@ /* Define to `int' if doesn't define. */ -#cmakedefine gid_t ${gid_t} +#cmakedefine gid_t @gid_t@ /* Define to `unsigned long' if does not define. */ -#cmakedefine id_t ${id_t} +#cmakedefine id_t @id_t@ /* Define to `int' if does not define. */ -#cmakedefine mode_t ${mode_t} +#cmakedefine mode_t @mode_t@ /* Define to `long long' if does not define. */ -#cmakedefine off_t ${off_t} +#cmakedefine off_t @off_t@ /* Define to `int' if doesn't define. */ -#cmakedefine pid_t ${pid_t} +#cmakedefine pid_t @pid_t@ /* Define to `unsigned int' if does not define. */ -#cmakedefine size_t ${size_t} +#cmakedefine size_t @size_t@ /* Define to `int' if does not define. */ -#cmakedefine ssize_t ${ssize_t} +#cmakedefine ssize_t @ssize_t@ /* Define to `int' if doesn't define. */ -#cmakedefine uid_t ${uid_t} +#cmakedefine uid_t @uid_t@ /* Define to `int' if does not define. */ -#cmakedefine intptr_t ${intptr_t} +#cmakedefine intptr_t @intptr_t@ /* Define to `unsigned int' if does not define. */ -#cmakedefine uintptr_t ${uintptr_t} +#cmakedefine uintptr_t @uintptr_t@ diff --git a/src/dependencies/libarchive-3.5.2/build/pkgconfig/libarchive.pc.in b/src/dependencies/libarchive-3.6.2/build/pkgconfig/libarchive.pc.in similarity index 90% rename from src/dependencies/libarchive-3.5.2/build/pkgconfig/libarchive.pc.in rename to src/dependencies/libarchive-3.6.2/build/pkgconfig/libarchive.pc.in index 4b631e6..1f51e77 100644 --- a/src/dependencies/libarchive-3.5.2/build/pkgconfig/libarchive.pc.in +++ b/src/dependencies/libarchive-3.6.2/build/pkgconfig/libarchive.pc.in @@ -10,3 +10,4 @@ Cflags: -I${includedir} Cflags.private: -DLIBARCHIVE_STATIC Libs: -L${libdir} -larchive Libs.private: @LIBS@ +Requires.private: @LIBSREQUIRED@ diff --git a/src/dependencies/libarchive-3.6.2/build/version b/src/dependencies/libarchive-3.6.2/build/version new file mode 100644 index 0000000..1af1bec --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/build/version @@ -0,0 +1 @@ +3006002 diff --git a/src/dependencies/libarchive-3.5.2/cat/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/cat/CMakeLists.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/cat/CMakeLists.txt diff --git a/src/dependencies/libarchive-3.5.2/cat/bsdcat.1 b/src/dependencies/libarchive-3.6.2/cat/bsdcat.1 similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/bsdcat.1 rename to src/dependencies/libarchive-3.6.2/cat/bsdcat.1 diff --git a/src/dependencies/libarchive-3.5.2/cat/bsdcat.c b/src/dependencies/libarchive-3.6.2/cat/bsdcat.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/bsdcat.c rename to src/dependencies/libarchive-3.6.2/cat/bsdcat.c diff --git a/src/dependencies/libarchive-3.5.2/cat/bsdcat.h b/src/dependencies/libarchive-3.6.2/cat/bsdcat.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/bsdcat.h rename to src/dependencies/libarchive-3.6.2/cat/bsdcat.h diff --git a/src/dependencies/libarchive-3.5.2/cat/bsdcat_platform.h b/src/dependencies/libarchive-3.6.2/cat/bsdcat_platform.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/bsdcat_platform.h rename to src/dependencies/libarchive-3.6.2/cat/bsdcat_platform.h diff --git a/src/dependencies/libarchive-3.5.2/cat/cmdline.c b/src/dependencies/libarchive-3.6.2/cat/cmdline.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/cmdline.c rename to src/dependencies/libarchive-3.6.2/cat/cmdline.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/cat/test/CMakeLists.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/cat/test/CMakeLists.txt diff --git a/src/dependencies/libarchive-3.5.2/cat/test/list.h b/src/dependencies/libarchive-3.6.2/cat/test/list.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/list.h rename to src/dependencies/libarchive-3.6.2/cat/test/list.h index 5246122..57f2f2a 100644 --- a/src/dependencies/libarchive-3.5.2/cat/test/list.h +++ b/src/dependencies/libarchive-3.6.2/cat/test/list.h @@ -5,13 +5,13 @@ DEFINE_TEST(test_empty_xz) DEFINE_TEST(test_empty_zstd) DEFINE_TEST(test_error) DEFINE_TEST(test_error_mixed) +DEFINE_TEST(test_expand_Z) DEFINE_TEST(test_expand_bz2) DEFINE_TEST(test_expand_gz) DEFINE_TEST(test_expand_lz4) DEFINE_TEST(test_expand_mixed) DEFINE_TEST(test_expand_plain) DEFINE_TEST(test_expand_xz) -DEFINE_TEST(test_expand_Z) DEFINE_TEST(test_expand_zstd) DEFINE_TEST(test_help) DEFINE_TEST(test_stdin) diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test.h b/src/dependencies/libarchive-3.6.2/cat/test/test.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test.h rename to src/dependencies/libarchive-3.6.2/cat/test/test.h diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_0.c b/src/dependencies/libarchive-3.6.2/cat/test/test_0.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_0.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_0.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty.gz.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_empty.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty.gz.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty.lz4.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_empty.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty.lz4.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty.xz.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_empty.xz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty.xz.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty.xz.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty.zst.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_empty.zst.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty.zst.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty.zst.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty_gz.c b/src/dependencies/libarchive-3.6.2/cat/test/test_empty_gz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty_gz.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty_gz.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty_lz4.c b/src/dependencies/libarchive-3.6.2/cat/test/test_empty_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty_lz4.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty_xz.c b/src/dependencies/libarchive-3.6.2/cat/test/test_empty_xz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty_xz.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty_xz.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_empty_zstd.c b/src/dependencies/libarchive-3.6.2/cat/test/test_empty_zstd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_empty_zstd.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_empty_zstd.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_error.c b/src/dependencies/libarchive-3.6.2/cat/test/test_error.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_error.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_error.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_error_mixed.c b/src/dependencies/libarchive-3.6.2/cat/test/test_error_mixed.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_error_mixed.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_error_mixed.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand.Z.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_expand.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand.Z.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand.bz2.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_expand.bz2.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand.bz2.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand.bz2.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand.gz.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_expand.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand.gz.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand.lz4.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_expand.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand.lz4.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand.plain.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_expand.plain.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand.plain.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand.plain.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand.xz.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_expand.xz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand.xz.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand.xz.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand.zst.uu b/src/dependencies/libarchive-3.6.2/cat/test/test_expand.zst.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand.zst.uu rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand.zst.uu diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_Z.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_Z.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_Z.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_Z.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_bz2.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_bz2.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_bz2.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_bz2.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_gz.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_gz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_gz.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_gz.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_lz4.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_lz4.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_mixed.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_mixed.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_mixed.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_mixed.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_plain.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_plain.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_plain.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_plain.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_xz.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_xz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_xz.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_xz.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_expand_zstd.c b/src/dependencies/libarchive-3.6.2/cat/test/test_expand_zstd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_expand_zstd.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_expand_zstd.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_help.c b/src/dependencies/libarchive-3.6.2/cat/test/test_help.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_help.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_help.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_stdin.c b/src/dependencies/libarchive-3.6.2/cat/test/test_stdin.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_stdin.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_stdin.c diff --git a/src/dependencies/libarchive-3.5.2/cat/test/test_version.c b/src/dependencies/libarchive-3.6.2/cat/test/test_version.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cat/test/test_version.c rename to src/dependencies/libarchive-3.6.2/cat/test/test_version.c diff --git a/src/dependencies/libarchive-3.5.2/config.h.in b/src/dependencies/libarchive-3.6.2/config.h.in similarity index 93% rename from src/dependencies/libarchive-3.5.2/config.h.in rename to src/dependencies/libarchive-3.6.2/config.h.in index 8abfedc..7ba4650 100644 --- a/src/dependencies/libarchive-3.5.2/config.h.in +++ b/src/dependencies/libarchive-3.6.2/config.h.in @@ -631,12 +631,6 @@ /* Define to 1 if you have the `crypto' library (-lcrypto). */ #undef HAVE_LIBCRYPTO -/* Define to 1 if you have the `eay32' library (-leay32). */ -#undef HAVE_LIBEAY32 - -/* Define to 1 if you have the `eay64' library (-leay64). */ -#undef HAVE_LIBEAY64 - /* Define to 1 if you have the `expat' library (-lexpat). */ #undef HAVE_LIBEXPAT @@ -685,6 +679,10 @@ /* Define to 1 if you have the `zstd' library (-lzstd). */ #undef HAVE_LIBZSTD +/* Define to 1 if you have the `zstd' library (-lzstd) with compression + support. */ +#undef HAVE_LIBZSTD_COMPRESSOR + /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H @@ -797,12 +795,12 @@ /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H + /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR @@ -960,6 +958,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -972,7 +973,7 @@ /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR -/* Define to 1 if you have the `strerror_r' function. */ +/* Define if you have `strerror_r'. */ #undef HAVE_STRERROR_R /* Define to 1 if you have the `strftime' function. */ @@ -1295,37 +1296,112 @@ /* Define to 1 if PCRE_STATIC needs to be defined. */ #undef PCRE_STATIC +/* The number of bytes in type int */ +#undef SIZEOF_INT + +/* The number of bytes in type long */ +#undef SIZEOF_LONG + /* The size of `wchar_t', as computed by sizeof. */ #undef SIZEOF_WCHAR_T -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P -/* Define to 1 if you can safely include both and . */ +/* Define to 1 if you can safely include both and . This + macro is obsolete. */ #undef TIME_WITH_SYS_TIME /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif -/* Enable threading extensions on Solaris. */ +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE #endif @@ -1335,11 +1411,6 @@ /* Define to '0x0502' for Windows Server 2003 APIs. */ #undef WINVER -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS @@ -1349,16 +1420,6 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ diff --git a/src/dependencies/libarchive-3.5.2/configure b/src/dependencies/libarchive-3.6.2/configure similarity index 68% rename from src/dependencies/libarchive-3.5.2/configure rename to src/dependencies/libarchive-3.6.2/configure index e3190e2..ab8c099 100755 --- a/src/dependencies/libarchive-3.5.2/configure +++ b/src/dependencies/libarchive-3.6.2/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libarchive 3.5.2. +# Generated by GNU Autoconf 2.71 for libarchive 3.6.2. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,18 +169,20 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' @@ -206,31 +190,40 @@ test \$(( 1 + 1 )) = 2 || exit 1 ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" - if (eval "$as_required") 2>/dev/null; then : + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -238,14 +231,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -263,18 +263,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: libarchive-discuss@googlegroups.com about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run @@ -302,6 +303,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -319,6 +321,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -333,7 +343,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -342,7 +352,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -381,12 +391,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -398,18 +409,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -421,9 +441,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -450,7 +470,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -494,7 +514,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -508,6 +528,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -521,6 +545,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -590,51 +621,49 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libarchive' PACKAGE_TARNAME='libarchive' -PACKAGE_VERSION='3.5.2' -PACKAGE_STRING='libarchive 3.5.2' +PACKAGE_VERSION='3.6.2' +PACKAGE_STRING='libarchive 3.6.2' PACKAGE_BUGREPORT='libarchive-discuss@googlegroups.com' PACKAGE_URL='' ac_unique_file="libarchive" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= +ac_func_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS +LIBSREQUIRED INC_FREEBSD_ACL_FALSE INC_FREEBSD_ACL_TRUE INC_DARWIN_ACL_FALSE @@ -644,6 +673,7 @@ INC_SUNOS_ACL_TRUE INC_LINUX_ACL_FALSE INC_LINUX_ACL_TRUE LIBOBJS +GC_SECTIONS LIBXML2_PC_LIBS LIBXML2_PC_CFLAGS PKG_CONFIG_LIBDIR @@ -681,13 +711,13 @@ ac_ct_DUMPBIN DUMPBIN LD FGREP +EGREP +GREP SED LIBTOOL OBJDUMP DLLTOOL AS -EGREP -GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE @@ -731,6 +761,9 @@ AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -915,8 +948,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -957,9 +988,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -983,9 +1014,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1196,9 +1227,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1212,9 +1243,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1258,9 +1289,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1276,7 +1307,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1340,7 +1371,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1397,7 +1428,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libarchive 3.5.2 to adapt to many kinds of systems. +\`configure' configures libarchive 3.6.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1468,7 +1499,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libarchive 3.5.2:";; + short | recursive ) echo "Configuration of libarchive 3.6.2:";; esac cat <<\_ACEOF @@ -1588,9 +1619,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1618,7 +1649,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1626,7 +1658,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1635,10 +1667,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libarchive configure 3.5.2 -generated by GNU Autoconf 2.69 +libarchive configure 3.6.2 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1655,14 +1687,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1670,14 +1702,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1699,7 +1732,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1707,14 +1740,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1724,139 +1758,6 @@ fi } # ac_fn_c_try_cpp -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## -------------------------------------------------- ## -## Report this to libarchive-discuss@googlegroups.com ## -## -------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1864,26 +1765,28 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1894,14 +1797,14 @@ $as_echo "$ac_res" >&6; } ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1909,17 +1812,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1940,11 +1844,12 @@ fi ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1952,16 +1857,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1979,28 +1877,72 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -2008,17 +1950,18 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof ($2)) return 0; @@ -2026,12 +1969,13 @@ if (sizeof ($2)) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof (($2))) return 0; @@ -2039,18 +1983,19 @@ if (sizeof (($2))) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop eval "$3=yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -2062,16 +2007,17 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (ac_aggr.$3) @@ -2080,14 +2026,15 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int -main () +main (void) { static $2 ac_aggr; if (sizeof ac_aggr.$3) @@ -2096,18 +2043,19 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$4=yes" -else +else $as_nop eval "$4=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member @@ -2119,11 +2067,12 @@ $as_echo "$ac_res" >&6; } ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +printf %s "checking for int$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. @@ -2134,7 +2083,7 @@ else $ac_includes_default enum { N = $2 / 2 - 1 }; int -main () +main (void) { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; @@ -2144,13 +2093,14 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int -main () +main (void) { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; @@ -2161,9 +2111,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( @@ -2171,19 +2122,20 @@ else eval "$3=\$ac_type" ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : -else +else $as_nop break fi done fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t @@ -2195,11 +2147,12 @@ $as_echo "$ac_res" >&6; } ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +printf %s "checking for uint$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. @@ -2209,7 +2162,7 @@ else /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; @@ -2219,7 +2172,8 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( @@ -2227,40 +2181,44 @@ if ac_fn_c_try_compile "$LINENO"; then : eval "$3=\$ac_type" ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : -else +else $as_nop break fi done fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { #ifndef $as_decl_name #ifdef __cplusplus @@ -2274,19 +2232,22 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_decl +} # ac_fn_check_decl # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- @@ -2302,7 +2263,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; @@ -2312,14 +2273,15 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2329,9 +2291,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid; break -else +else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= @@ -2339,14 +2302,14 @@ else fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; @@ -2356,14 +2319,15 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; @@ -2373,9 +2337,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=$ac_mid; break -else +else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= @@ -2383,14 +2348,14 @@ else fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop ac_lo= ac_hi= fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val @@ -2398,7 +2363,7 @@ while test "x$ac_lo" != "x$ac_hi"; do /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2408,12 +2373,13 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid -else +else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; @@ -2423,12 +2389,12 @@ esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } #include #include int -main () +main (void) { FILE *f = fopen ("conftest.val", "w"); @@ -2456,9 +2422,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libarchive $as_me 3.5.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by libarchive $as_me 3.6.2, which was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -2510,8 +2497,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2546,7 +2537,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2581,11 +2572,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2596,8 +2589,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2621,7 +2614,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2629,14 +2622,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2644,15 +2637,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2660,8 +2653,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2675,63 +2668,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2741,19 +2719,438 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" +as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" +as_fn_append ac_func_c_list " vprintf HAVE_VPRINTF" + +# Auxiliary files required by this configure script. +ac_aux_files="config.rpath ltmain.sh compile config.guess config.sub missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/build/autoconf" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2764,12 +3161,12 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -2778,24 +3175,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2805,11 +3202,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2825,41 +3223,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Make sure the srcdir contains "libarchive" directory # Use auxiliary subscripts from this subdirectory (cleans up root) -ac_aux_dir= -for ac_dir in build/autoconf "$srcdir"/build/autoconf; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in build/autoconf \"$srcdir\"/build/autoconf" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - # M4 scripts # Must follow AC_CONFIG macros above... am__api_version='1.16' -# Find a good install program. We prefer a C program (faster), + + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -2873,20 +3245,25 @@ am__api_version='1.16' # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -2896,13 +3273,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -2910,12 +3287,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -2931,7 +3308,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -2941,8 +3318,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2952,8 +3329,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -3007,8 +3384,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -3027,26 +3404,23 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -3066,11 +3440,12 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -3078,11 +3453,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3093,11 +3472,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3106,11 +3485,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -3118,11 +3498,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3133,11 +3517,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -3145,8 +3529,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -3158,25 +3542,31 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -3187,7 +3577,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -3197,18 +3587,19 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -3216,11 +3607,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3231,24 +3626,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -3264,12 +3660,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -3283,7 +3679,8 @@ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -3293,12 +3690,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -3310,8 +3708,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -3343,17 +3741,13 @@ fi # Define the identity of the package. PACKAGE='libarchive' - VERSION='3.5.2' + VERSION='3.6.2' -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -3393,6 +3787,20 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -3437,17 +3845,18 @@ END fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then : +if test ${enable_maintainer_mode+y} +then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else +else $as_nop USE_MAINTAINER_MODE=yes fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -$as_echo "$USE_MAINTAINER_MODE" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +printf "%s\n" "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' @@ -3460,7 +3869,8 @@ fi # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -3470,12 +3880,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -3487,8 +3898,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -3503,7 +3914,7 @@ AM_BACKSLASH='\' # Libtool interface version bumps on any API change, so increments # whenever libarchive minor version does. -ARCHIVE_MINOR=$(( (3005002 / 1000) % 1000 )) +ARCHIVE_MINOR=$(( (3006002 / 1000) % 1000 )) # Libarchive 2.7 == libtool interface 9 = 2 + 7 # Libarchive 2.8 == libtool interface 10 = 2 + 8 # Libarchive 2.9 == libtool interface 11 = 2 + 8 @@ -3511,40 +3922,38 @@ ARCHIVE_MINOR=$(( (3005002 / 1000) % 1000 )) # Libarchive 3.1 == libtool interface 13 ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` # Libarchive revision is bumped on any source change === libtool revision -ARCHIVE_REVISION=$(( 3005002 % 1000 )) +ARCHIVE_REVISION=$(( 3006002 % 1000 )) # Libarchive minor is bumped on any interface addition === libtool age ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR # Stick the version numbers into config.h -$as_echo "#define __LIBARCHIVE_CONFIG_H_INCLUDED 1" >>confdefs.h +printf "%s\n" "#define __LIBARCHIVE_CONFIG_H_INCLUDED 1" >>confdefs.h -$as_echo "#define LIBARCHIVE_VERSION_STRING \"3.5.2\"" >>confdefs.h +printf "%s\n" "#define LIBARCHIVE_VERSION_STRING \"3.6.2\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define LIBARCHIVE_VERSION_NUMBER "3005002" -_ACEOF +printf "%s\n" "#define LIBARCHIVE_VERSION_NUMBER \"3006002\"" >>confdefs.h -$as_echo "#define BSDCPIO_VERSION_STRING \"3.5.2\"" >>confdefs.h +printf "%s\n" "#define BSDCPIO_VERSION_STRING \"3.6.2\"" >>confdefs.h -$as_echo "#define BSDTAR_VERSION_STRING \"3.5.2\"" >>confdefs.h +printf "%s\n" "#define BSDTAR_VERSION_STRING \"3.6.2\"" >>confdefs.h -$as_echo "#define BSDCAT_VERSION_STRING \"3.5.2\"" >>confdefs.h +printf "%s\n" "#define BSDCAT_VERSION_STRING \"3.6.2\"" >>confdefs.h # The shell variables here must be the same as the AC_SUBST() variables # below, but the shell variable names apparently cannot be the same as # the m4 macro names above. Why? Ask autoconf. -BSDCPIO_VERSION_STRING=3.5.2 -BSDTAR_VERSION_STRING=3.5.2 -BSDCAT_VERSION_STRING=3.5.2 -LIBARCHIVE_VERSION_STRING=3.5.2 -LIBARCHIVE_VERSION_NUMBER=3005002 +BSDCPIO_VERSION_STRING=3.6.2 +BSDTAR_VERSION_STRING=3.6.2 +BSDCAT_VERSION_STRING=3.6.2 +LIBARCHIVE_VERSION_STRING=3.6.2 +LIBARCHIVE_VERSION_NUMBER=3006002 # Substitute the above version numbers into the various files below. # Yes, I believe this is the fourth time we define what are essentially @@ -3564,26 +3973,29 @@ ac_config_files="$ac_config_files build/pkgconfig/libarchive.pc" # Check for host type -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; @@ -3602,21 +4014,22 @@ IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -3666,6 +4079,15 @@ esac # Checks for programs. + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3674,11 +4096,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3686,11 +4109,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3701,11 +4128,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3714,11 +4141,12 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3726,11 +4154,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3741,11 +4173,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -3753,8 +4185,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3767,11 +4199,12 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3779,11 +4212,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3794,11 +4231,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3807,11 +4244,12 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3820,15 +4258,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3844,18 +4286,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3866,11 +4308,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3878,11 +4321,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3893,11 +4340,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3910,11 +4357,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3922,11 +4370,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3937,11 +4389,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3953,8 +4405,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3962,25 +4414,129 @@ esac fi fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3990,7 +4546,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -3998,7 +4554,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -4010,9 +4566,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -4033,11 +4589,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -4054,7 +4611,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -4070,44 +4627,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -4121,15 +4680,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -4138,7 +4697,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -4150,8 +4709,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -4159,10 +4718,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -4170,39 +4729,40 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -4216,11 +4776,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -4229,31 +4790,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -4263,29 +4825,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -4294,57 +4860,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -4359,94 +4928,144 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -4455,21 +5074,23 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -4497,8 +5118,8 @@ _ACEOF rm -f core conftest* unset am_i fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -4517,8 +5138,8 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -4554,11 +5175,12 @@ esac fi done rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; fi @@ -4579,11 +5201,12 @@ fi depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -4690,8 +5313,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if @@ -4705,182 +5328,6 @@ else fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - -fi - ac_ext=c @@ -4888,40 +5335,36 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -4933,10 +5376,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -4946,7 +5390,8 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : break fi @@ -4958,29 +5403,24 @@ fi else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : -else +else $as_nop # Broken: fails on valid input. continue fi @@ -4992,10 +5432,11 @@ rm -f conftest.err conftest.i conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : # Broken: success on invalid input. continue -else +else $as_nop # Passes both tests. ac_preproc_ok=: break @@ -5005,11 +5446,12 @@ rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +if $ac_preproc_ok +then : -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi @@ -5021,326 +5463,175 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - done - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : - MINIX=yes -else - MINIX= + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + fi - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_safe_to_define___extensions__=yes -else +else $as_nop ac_cv_safe_to_define___extensions__=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + #include + mbstate_t x; +int +main (void) +{ - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #define _XOPEN_SOURCE 500 + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi enable_win32_dll=yes @@ -5349,11 +5640,12 @@ case $host in if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else @@ -5361,11 +5653,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5376,11 +5672,11 @@ fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +printf "%s\n" "$AS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5389,11 +5685,12 @@ if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else @@ -5401,11 +5698,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5416,11 +5717,11 @@ fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +printf "%s\n" "$ac_ct_AS" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_AS" = x; then @@ -5428,8 +5729,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS @@ -5441,11 +5742,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -5453,11 +5755,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5468,11 +5774,11 @@ fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5481,11 +5787,12 @@ if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -5493,11 +5800,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5508,11 +5819,11 @@ fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -5520,8 +5831,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -5533,11 +5844,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -5545,11 +5857,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5560,11 +5876,11 @@ fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5573,11 +5889,12 @@ if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -5585,11 +5902,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5600,11 +5921,11 @@ fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -5612,8 +5933,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -5647,8 +5968,8 @@ test -z "$OBJDUMP" && OBJDUMP=objdump case `pwd` in *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac @@ -5668,6 +5989,7 @@ macro_revision='2.4.6' + ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within @@ -5691,8 +6013,8 @@ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +printf %s "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then @@ -5718,12 +6040,12 @@ func_echo_all () } case $ECHO in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; + printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +printf "%s\n" "printf" >&6; } ;; + print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +printf "%s\n" "print -r" >&6; } ;; + *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +printf "%s\n" "cat" >&6; } ;; esac @@ -5739,11 +6061,12 @@ esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" @@ -5757,10 +6080,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in sed gsed + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED @@ -5769,13 +6097,13 @@ case `"$ac_path_SED" --version 2>&1` in ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" + printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -5803,8 +6131,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed @@ -5821,11 +6149,154 @@ Xsed="$SED -e 1s/^X//" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +printf %s "checking for fgrep... " >&6; } +if test ${ac_cv_path_FGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else @@ -5836,10 +6307,15 @@ else for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in fgrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP @@ -5848,13 +6324,13 @@ case `"$ac_path_FGREP" --version 2>&1` in ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" + printf "%s\n" 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -5883,8 +6359,8 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +printf "%s\n" "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" @@ -5909,17 +6385,18 @@ test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : +if test ${with_gnu_ld+y} +then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes -else +else $as_nop with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw @@ -5948,15 +6425,16 @@ $as_echo_n "checking for ld used by $CC... " >&6; } ;; esac elif test yes = "$with_gnu_ld"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do @@ -5985,18 +6463,19 @@ fi LD=$lt_cv_path_LD if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -6019,11 +6498,12 @@ with_gnu_ld=$lt_cv_prog_gnu_ld -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test ${lt_cv_path_NM+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM @@ -6073,8 +6553,8 @@ else : ${lt_cv_path_NM=no} fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +printf "%s\n" "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else @@ -6087,11 +6567,12 @@ else do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else @@ -6099,11 +6580,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6114,11 +6599,11 @@ fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +printf "%s\n" "$DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6131,11 +6616,12 @@ if test -z "$DUMPBIN"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else @@ -6143,11 +6629,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6158,11 +6648,11 @@ fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +printf "%s\n" "$ac_ct_DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6174,8 +6664,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN @@ -6203,11 +6693,12 @@ test -z "$NM" && NM=nm -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +printf %s "checking the name lister ($NM) interface... " >&6; } +if test ${lt_cv_nm_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) @@ -6223,26 +6714,27 @@ else fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +printf "%s\n" "$lt_cv_nm_interface" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +printf %s "checking the maximum length of command line arguments... " >&6; } +if test ${lt_cv_sys_max_cmd_len+y} +then : + printf %s "(cached) " >&6 +else $as_nop i=0 teststring=ABCD @@ -6369,11 +6861,11 @@ else fi if test -n "$lt_cv_sys_max_cmd_len"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len @@ -6417,11 +6909,12 @@ esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +printf %s "checking how to convert $build file names to $host format... " >&6; } +if test ${lt_cv_to_host_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $host in *-*-mingw* ) case $build in @@ -6457,18 +6950,19 @@ esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +printf %s "checking how to convert $build file names to toolchain format... " >&6; } +if test ${lt_cv_to_tool_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in @@ -6484,22 +6978,23 @@ esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +printf %s "checking for $LD option to reload object files... " >&6; } +if test ${lt_cv_ld_reload_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_reload_flag='-r' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; @@ -6532,11 +7027,12 @@ esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else @@ -6544,11 +7040,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6559,11 +7059,11 @@ fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6572,11 +7072,12 @@ if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else @@ -6584,11 +7085,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6599,11 +7104,11 @@ fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then @@ -6611,8 +7116,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP @@ -6628,11 +7133,12 @@ test -z "$OBJDUMP" && OBJDUMP=objdump -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +printf %s "checking how to recognize dependent libraries... " >&6; } +if test ${lt_cv_deplibs_check_method+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' @@ -6828,8 +7334,8 @@ os2*) esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no @@ -6873,11 +7379,12 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else @@ -6885,11 +7392,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6900,11 +7411,11 @@ fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -6913,11 +7424,12 @@ if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else @@ -6925,11 +7437,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -6940,11 +7456,11 @@ fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then @@ -6952,8 +7468,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL @@ -6970,11 +7486,12 @@ test -z "$DLLTOOL" && DLLTOOL=dlltool -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +printf %s "checking how to associate runtime and link libraries... " >&6; } +if test ${lt_cv_sharedlib_from_linklib_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in @@ -6997,8 +7514,8 @@ cygwin* | mingw* | pw32* | cegcc*) esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO @@ -7013,11 +7530,12 @@ if test -n "$ac_tool_prefix"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else @@ -7025,11 +7543,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7040,11 +7562,11 @@ fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7057,11 +7579,12 @@ if test -z "$AR"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else @@ -7069,11 +7592,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7084,11 +7611,11 @@ fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7100,8 +7627,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR @@ -7121,30 +7648,32 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +printf %s "checking for archiver @FILE support... " >&6; } +if test ${lt_cv_ar_at_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. @@ -7152,7 +7681,7 @@ if ac_fn_c_try_compile "$LINENO"; then : { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ @@ -7161,11 +7690,11 @@ if ac_fn_c_try_compile "$LINENO"; then : rm -f conftest.* libconftest.a fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +printf "%s\n" "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= @@ -7182,11 +7711,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -7194,11 +7724,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7209,11 +7743,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7222,11 +7756,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -7234,11 +7769,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7249,11 +7788,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -7261,8 +7800,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -7281,11 +7820,12 @@ test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -7293,11 +7833,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7308,11 +7852,11 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7321,11 +7865,12 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -7333,11 +7878,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7348,11 +7897,11 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -7360,8 +7909,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -7450,11 +7999,12 @@ compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +printf %s "checking command to parse $NM output from $compiler object... " >&6; } +if test ${lt_cv_sys_global_symbol_pipe+y} +then : + printf %s "(cached) " >&6 +else $as_nop # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] @@ -7606,7 +8156,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm @@ -7679,7 +8229,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi @@ -7714,11 +8264,11 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +printf "%s\n" "failed" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } fi # Response file support. @@ -7764,13 +8314,14 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +printf %s "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : +if test ${with_sysroot+y} +then : withval=$with_sysroot; -else +else $as_nop with_sysroot=no fi @@ -7788,24 +8339,25 @@ case $with_sysroot in #( no|'') ;; #( *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -$as_echo "$with_sysroot" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +printf "%s\n" "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +printf "%s\n" "${lt_sysroot:-no}" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -$as_echo_n "checking for a working dd... " >&6; } -if ${ac_cv_path_lt_DD+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +printf %s "checking for a working dd... " >&6; } +if test ${ac_cv_path_lt_DD+y} +then : + printf %s "(cached) " >&6 +else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} @@ -7816,10 +8368,15 @@ if test -z "$lt_DD"; then for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in dd; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in dd + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ @@ -7839,15 +8396,16 @@ fi rm -f conftest.i conftest2.i conftest.out fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -$as_echo "$ac_cv_path_lt_DD" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +printf "%s\n" "$ac_cv_path_lt_DD" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -$as_echo_n "checking how to truncate binary pipes... " >&6; } -if ${lt_cv_truncate_bin+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +printf %s "checking how to truncate binary pipes... " >&6; } +if test ${lt_cv_truncate_bin+y} +then : + printf %s "(cached) " >&6 +else $as_nop printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= @@ -7858,8 +8416,8 @@ fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -$as_echo "$lt_cv_truncate_bin" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +printf "%s\n" "$lt_cv_truncate_bin" >&6; } @@ -7882,7 +8440,8 @@ func_cc_basename () } # Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : +if test ${enable_libtool_lock+y} +then : enableval=$enable_libtool_lock; fi @@ -7898,7 +8457,7 @@ ia64-*-hpux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) @@ -7918,7 +8477,7 @@ ia64-*-hpux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in @@ -7956,7 +8515,7 @@ mips64*-*linux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in @@ -7997,7 +8556,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) @@ -8060,11 +8619,12 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +printf %s "checking whether the C compiler needs -belf... " >&6; } +if test ${lt_cv_cc_needs_belf+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8075,19 +8635,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_cc_needs_belf=yes -else +else $as_nop lt_cv_cc_needs_belf=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -8096,8 +8657,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS @@ -8110,7 +8671,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) @@ -8147,11 +8708,12 @@ need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else @@ -8159,11 +8721,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8174,11 +8740,11 @@ fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +printf "%s\n" "$MANIFEST_TOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8187,11 +8753,12 @@ if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else @@ -8199,11 +8766,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8214,11 +8785,11 @@ fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then @@ -8226,8 +8797,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL @@ -8237,11 +8808,12 @@ else fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if test ${lt_cv_path_mainfest_tool+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out @@ -8251,8 +8823,8 @@ else fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi @@ -8267,11 +8839,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else @@ -8279,11 +8852,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8294,11 +8871,11 @@ fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +printf "%s\n" "$DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8307,11 +8884,12 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else @@ -8319,11 +8897,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8334,11 +8916,11 @@ fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then @@ -8346,8 +8928,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL @@ -8359,11 +8941,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else @@ -8371,11 +8954,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8386,11 +8973,11 @@ fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +printf "%s\n" "$NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8399,11 +8986,12 @@ if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else @@ -8411,11 +8999,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8426,11 +9018,11 @@ fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +printf "%s\n" "$ac_ct_NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then @@ -8438,8 +9030,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT @@ -8451,11 +9043,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else @@ -8463,11 +9056,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8478,11 +9075,11 @@ fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +printf "%s\n" "$LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8491,11 +9088,12 @@ if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else @@ -8503,11 +9101,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8518,11 +9120,11 @@ fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +printf "%s\n" "$ac_ct_LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then @@ -8530,8 +9132,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO @@ -8543,11 +9145,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else @@ -8555,11 +9158,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8570,11 +9177,11 @@ fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +printf "%s\n" "$OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8583,11 +9190,12 @@ if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else @@ -8595,11 +9203,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8610,11 +9222,11 @@ fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +printf "%s\n" "$ac_ct_OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then @@ -8622,8 +9234,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL @@ -8635,11 +9247,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else @@ -8647,11 +9260,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8662,11 +9279,11 @@ fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +printf "%s\n" "$OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8675,11 +9292,12 @@ if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else @@ -8687,11 +9305,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8702,11 +9324,11 @@ fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +printf "%s\n" "$ac_ct_OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then @@ -8714,8 +9336,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 @@ -8750,11 +9372,12 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +printf %s "checking for -single_module linker flag... " >&6; } +if test ${lt_cv_apple_cc_single_mod+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override @@ -8783,14 +9406,15 @@ else rm -f conftest.* fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +printf %s "checking for -exported_symbols_list linker flag... " >&6; } +if test ${lt_cv_ld_exported_symbols_list+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym @@ -8799,31 +9423,33 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_ld_exported_symbols_list=yes -else +else $as_nop lt_cv_ld_exported_symbols_list=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +printf %s "checking for -force_load linker flag... " >&6; } +if test ${lt_cv_ld_force_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} @@ -8851,8 +9477,8 @@ _LT_EOF rm -rf conftest.dSYM fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +printf "%s\n" "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; @@ -8863,11 +9489,11 @@ $as_echo "$lt_cv_ld_force_load" >&6; } # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + 10.0,*86*-darwin8*|10.0,*-darwin[912]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) + 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; @@ -8923,19 +9549,14 @@ func_munge_path_list () esac } -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h fi -done - @@ -8949,7 +9570,8 @@ done # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : +if test ${enable_shared+y} +then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; @@ -8967,7 +9589,7 @@ if test "${enable_shared+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_shared=yes fi @@ -8980,7 +9602,8 @@ fi # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : +if test ${enable_static+y} +then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; @@ -8998,7 +9621,7 @@ if test "${enable_static+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_static=yes fi @@ -9012,7 +9635,8 @@ fi # Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : +if test ${with_pic+y} +then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; @@ -9029,7 +9653,7 @@ if test "${with_pic+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop pic_mode=default fi @@ -9041,7 +9665,8 @@ fi # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : +if test ${enable_fast_install+y} +then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; @@ -9059,7 +9684,7 @@ if test "${enable_fast_install+set}" = set; then : IFS=$lt_save_ifs ;; esac -else +else $as_nop enable_fast_install=yes fi @@ -9073,11 +9698,12 @@ fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +printf %s "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. -if test "${with_aix_soname+set}" = set; then : +if test ${with_aix_soname+y} +then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; @@ -9086,18 +9712,19 @@ if test "${with_aix_soname+set}" = set; then : ;; esac lt_cv_with_aix_soname=$with_aix_soname -else - if ${lt_cv_with_aix_soname+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + if test ${lt_cv_with_aix_soname+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -$as_echo "$with_aix_soname" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +printf "%s\n" "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', @@ -9179,11 +9806,12 @@ if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +printf %s "checking for objdir... " >&6; } +if test ${lt_cv_objdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then @@ -9194,17 +9822,15 @@ else fi rmdir .libs 2>/dev/null fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +printf "%s\n" "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF +printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h @@ -9250,11 +9876,12 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +printf %s "checking for ${ac_tool_prefix}file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -9303,11 +9930,11 @@ fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9316,11 +9943,12 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +printf %s "checking for file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. @@ -9369,11 +9997,11 @@ fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -9454,11 +10082,12 @@ if test yes = "$GCC"; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test ${lt_cv_prog_compiler_rtti_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -9489,8 +10118,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" @@ -9853,26 +10482,28 @@ case $host_os in ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -9903,8 +10534,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in @@ -9932,11 +10563,12 @@ fi # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" @@ -9960,8 +10592,8 @@ else LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : @@ -9975,11 +10607,12 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -10022,19 +10655,20 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest @@ -10077,8 +10711,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } @@ -10086,19 +10720,19 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -10110,8 +10744,8 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= @@ -10669,21 +11303,23 @@ _LT_EOF if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -10698,7 +11334,7 @@ if ac_fn_c_try_link "$LINENO"; then : lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -10722,21 +11358,23 @@ fi if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -10751,7 +11389,7 @@ if ac_fn_c_try_link "$LINENO"; then : lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib @@ -11002,11 +11640,12 @@ fi # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +printf %s "checking if $CC understands -b... " >&6; } +if test ${lt_cv_prog_compiler__b+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" @@ -11030,8 +11669,8 @@ else LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' @@ -11071,28 +11710,30 @@ fi # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : lt_cv_irix_exported_symbol=yes -else +else $as_nop lt_cv_irix_exported_symbol=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi @@ -11373,8 +12014,8 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +printf "%s\n" "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld @@ -11410,18 +12051,19 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc+y} +then : + printf %s "(cached) " >&6 +else $as_nop $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest @@ -11439,7 +12081,7 @@ else if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no @@ -11453,8 +12095,8 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac @@ -11613,8 +12255,8 @@ esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in @@ -12175,9 +12817,10 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir @@ -12187,19 +12830,21 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : +if ac_fn_c_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : lt_cv_shlibpath_overrides_runpath=yes fi fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -12443,8 +13088,8 @@ uts4*) dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" @@ -12565,8 +13210,8 @@ configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || @@ -12590,8 +13235,8 @@ else # directories. hardcode_action=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +printf "%s\n" "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then @@ -12635,11 +13280,12 @@ else darwin*) # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12648,32 +13294,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else +else $as_nop lt_cv_dlopen=dyld lt_cv_dlopen_libs= @@ -12693,14 +13338,16 @@ fi *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : +if test "x$ac_cv_func_shl_load" = xyes +then : lt_cv_dlopen=shl_load -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +printf %s "checking for shl_load in -ldld... " >&6; } +if test ${ac_cv_lib_dld_shl_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12709,41 +13356,42 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char shl_load (); int -main () +main (void) { return shl_load (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dld_shl_load=yes -else +else $as_nop ac_cv_lib_dld_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes +then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld -else +else $as_nop ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = xyes +then : lt_cv_dlopen=dlopen -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12752,37 +13400,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +printf %s "checking for dlopen in -lsvld... " >&6; } +if test ${ac_cv_lib_svld_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12791,37 +13439,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_svld_dlopen=yes -else +else $as_nop ac_cv_lib_svld_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes +then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +printf %s "checking for dld_link in -ldld... " >&6; } +if test ${ac_cv_lib_dld_dld_link+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12830,30 +13478,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dld_link (); int -main () +main (void) { return dld_link (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dld_dld_link=yes -else +else $as_nop ac_cv_lib_dld_dld_link=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes +then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi @@ -12892,11 +13539,12 @@ fi save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +printf %s "checking whether a program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else @@ -12975,7 +13623,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -12993,16 +13641,17 @@ rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +printf "%s\n" "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +printf %s "checking whether a statically linked program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self_static+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else @@ -13081,7 +13730,7 @@ _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? @@ -13099,8 +13748,8 @@ rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS @@ -13138,13 +13787,13 @@ fi striplib= old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +printf %s "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in @@ -13152,16 +13801,16 @@ else if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } ;; esac fi @@ -13178,13 +13827,13 @@ fi # Report what library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and @@ -13208,15 +13857,15 @@ $as_echo_n "checking whether to build shared libraries... " >&6; } fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$enable_static" >&6; } @@ -13255,11 +13904,12 @@ CC=$lt_save_CC if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -13267,11 +13917,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13282,11 +13936,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -13295,11 +13949,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -13307,11 +13962,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -13322,11 +13981,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -13334,8 +13993,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -13352,9 +14011,10 @@ fi # Default is to build bsdtar, but allow people to override that. # # Check whether --enable-bsdtar was given. -if test "${enable_bsdtar+set}" = set; then : +if test ${enable_bsdtar+y} +then : enableval=$enable_bsdtar; -else +else $as_nop enable_bsdtar=yes fi @@ -13370,8 +14030,8 @@ yes) ;; dynamic|shared) if test "$enable_shared" = "no"; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Shared linking of bsdtar requires shared libarchive See \`config.log' for more details" "$LINENO" 5; } fi @@ -13387,8 +14047,8 @@ no) static_bsdtar=no ;; *) - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Unsupported value for --enable-bsdtar See \`config.log' for more details" "$LINENO" 5; } ;; @@ -13417,9 +14077,10 @@ fi # Default is to build bsdcat, but allow people to override that. # # Check whether --enable-bsdcat was given. -if test "${enable_bsdcat+set}" = set; then : +if test ${enable_bsdcat+y} +then : enableval=$enable_bsdcat; -else +else $as_nop enable_bsdcat=yes fi @@ -13435,8 +14096,8 @@ yes) ;; dynamic|shared) if test "$enable_shared" = "no"; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Shared linking of bsdcat requires shared libarchive See \`config.log' for more details" "$LINENO" 5; } fi @@ -13452,8 +14113,8 @@ no) static_bsdcat=no ;; *) - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Unsupported value for --enable-bsdcat See \`config.log' for more details" "$LINENO" 5; } ;; @@ -13482,9 +14143,10 @@ fi # Default is not to build bsdcpio, but that can be overridden. # # Check whether --enable-bsdcpio was given. -if test "${enable_bsdcpio+set}" = set; then : +if test ${enable_bsdcpio+y} +then : enableval=$enable_bsdcpio; -else +else $as_nop enable_bsdcpio=yes fi @@ -13500,8 +14162,8 @@ yes) ;; dynamic|shared) if test "$enabled_shared" = "no"; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Shared linking of bsdcpio requires shared libarchive See \`config.log' for more details" "$LINENO" 5; } fi @@ -13516,8 +14178,8 @@ no) static_bsdcpio=no ;; *) - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Unsupported value for --enable-bsdcpio See \`config.log' for more details" "$LINENO" 5; } ;; @@ -13543,14 +14205,15 @@ fi # Set up defines needed before including any headers case $host in *mingw* | *cygwin* | *msys* ) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _WIN32_WINNT # error _WIN32_WINNT already defined #endif int -main () +main (void) { ; ; @@ -13558,13 +14221,14 @@ main () } _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : -$as_echo "#define _WIN32_WINNT 0x0502" >>confdefs.h +printf "%s\n" "#define _WIN32_WINNT 0x0502" >>confdefs.h -$as_echo "#define NTDDI_VERSION 0x05020000" >>confdefs.h +printf "%s\n" "#define NTDDI_VERSION 0x05020000" >>confdefs.h fi @@ -13576,7 +14240,7 @@ rm -f conftest.err conftest.i conftest.$ac_ext #endif int -main () +main (void) { ; ; @@ -13584,10 +14248,11 @@ main () } _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if ac_fn_c_try_cpp "$LINENO" +then : -$as_echo "#define WINVER 0x0502" >>confdefs.h +printf "%s\n" "#define WINVER 0x0502" >>confdefs.h fi @@ -13598,19 +14263,20 @@ esac # Checks for header files. ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +printf %s "checking for $ac_hdr that defines DIR... " >&6; } +if eval test \${$as_ac_Header+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int -main () +main (void) { if ((DIR *) 0) return 0; @@ -13618,19 +14284,21 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$as_ac_Header=yes" -else +else $as_nop eval "$as_ac_Header=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break @@ -13639,11 +14307,12 @@ fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +printf %s "checking for library containing opendir... " >&6; } +if test ${ac_cv_search_opendir+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -13651,56 +14320,59 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char opendir (); int -main () +main (void) { return opendir (); ; return 0; } _ACEOF -for ac_lib in '' dir; do +for ac_lib in '' dir +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_opendir=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test ${ac_cv_search_opendir+y} +then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test ${ac_cv_search_opendir+y} +then : -else +else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +printf %s "checking for library containing opendir... " >&6; } +if test ${ac_cv_search_opendir+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -13708,57 +14380,60 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char opendir (); int -main () +main (void) { return opendir (); ; return 0; } _ACEOF -for ac_lib in '' x; do +for ac_lib in '' x +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_opendir=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test ${ac_cv_search_opendir+y} +then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test ${ac_cv_search_opendir+y} +then : -else +else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 -$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if ${ac_cv_header_sys_wait_h+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +printf %s "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if test ${ac_cv_header_sys_wait_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -13771,7 +14446,7 @@ else #endif int -main () +main (void) { int s; wait (&s); @@ -13780,332 +14455,481 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_header_sys_wait_h=yes -else +else $as_nop ac_cv_header_sys_wait_h=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 -$as_echo "$ac_cv_header_sys_wait_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +printf "%s\n" "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then -$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -for ac_header in acl/libacl.h attr/xattr.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "acl/libacl.h" "ac_cv_header_acl_libacl_h" "$ac_includes_default" +if test "x$ac_cv_header_acl_libacl_h" = xyes +then : + printf "%s\n" "#define HAVE_ACL_LIBACL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "attr/xattr.h" "ac_cv_header_attr_xattr_h" "$ac_includes_default" +if test "x$ac_cv_header_attr_xattr_h" = xyes +then : + printf "%s\n" "#define HAVE_ATTR_XATTR_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "copyfile.h" "ac_cv_header_copyfile_h" "$ac_includes_default" +if test "x$ac_cv_header_copyfile_h" = xyes +then : + printf "%s\n" "#define HAVE_COPYFILE_H 1" >>confdefs.h -for ac_header in copyfile.h ctype.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" +if test "x$ac_cv_header_ctype_h" = xyes +then : + printf "%s\n" "#define HAVE_CTYPE_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" +if test "x$ac_cv_header_errno_h" = xyes +then : + printf "%s\n" "#define HAVE_ERRNO_H 1" >>confdefs.h -for ac_header in errno.h ext2fs/ext2_fs.h fcntl.h grp.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "ext2fs/ext2_fs.h" "ac_cv_header_ext2fs_ext2_fs_h" "$ac_includes_default" +if test "x$ac_cv_header_ext2fs_ext2_fs_h" = xyes +then : + printf "%s\n" "#define HAVE_EXT2FS_EXT2_FS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "grp.h" "ac_cv_header_grp_h" "$ac_includes_default" +if test "x$ac_cv_header_grp_h" = xyes +then : + printf "%s\n" "#define HAVE_GRP_H 1" >>confdefs.h fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether EXT2_IOC_GETFLAGS is usable" >&5 -$as_echo_n "checking whether EXT2_IOC_GETFLAGS is usable... " >&6; } -if ${ac_cv_have_decl_EXT2_IOC_GETFLAGS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether EXT2_IOC_GETFLAGS is usable" >&5 +printf %s "checking whether EXT2_IOC_GETFLAGS is usable... " >&6; } +if test ${ac_cv_have_decl_EXT2_IOC_GETFLAGS+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int -main () +main (void) { int x = EXT2_IOC_GETFLAGS ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_have_decl_EXT2_IOC_GETFLAGS=yes -else +else $as_nop ac_cv_have_decl_EXT2_IOC_GETFLAGS=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_decl_EXT2_IOC_GETFLAGS" >&5 -$as_echo "$ac_cv_have_decl_EXT2_IOC_GETFLAGS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_decl_EXT2_IOC_GETFLAGS" >&5 +printf "%s\n" "$ac_cv_have_decl_EXT2_IOC_GETFLAGS" >&6; } -if test "x$ac_cv_have_decl_EXT2_IOC_GETFLAGS" = xyes; then : +if test "x$ac_cv_have_decl_EXT2_IOC_GETFLAGS" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_WORKING_EXT2_IOC_GETFLAGS 1 -_ACEOF +printf "%s\n" "#define HAVE_WORKING_EXT2_IOC_GETFLAGS 1" >>confdefs.h fi -for ac_header in inttypes.h io.h langinfo.h limits.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_inttypes_h" = xyes +then : + printf "%s\n" "#define HAVE_INTTYPES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "io.h" "ac_cv_header_io_h" "$ac_includes_default" +if test "x$ac_cv_header_io_h" = xyes +then : + printf "%s\n" "#define HAVE_IO_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "langinfo.h" "ac_cv_header_langinfo_h" "$ac_includes_default" +if test "x$ac_cv_header_langinfo_h" = xyes +then : + printf "%s\n" "#define HAVE_LANGINFO_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : + printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "linux/fiemap.h" "ac_cv_header_linux_fiemap_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_fiemap_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_FIEMAP_H 1" >>confdefs.h -for ac_header in linux/fiemap.h linux/fs.h linux/magic.h linux/types.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "linux/fs.h" "ac_cv_header_linux_fs_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_fs_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_FS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "linux/magic.h" "ac_cv_header_linux_magic_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_magic_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_MAGIC_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "linux/types.h" "ac_cv_header_linux_types_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_types_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_TYPES_H 1" >>confdefs.h fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether FS_IOC_GETFLAGS is usable" >&5 -$as_echo_n "checking whether FS_IOC_GETFLAGS is usable... " >&6; } -if ${ac_cv_have_decl_FS_IOC_GETFLAGS+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether FS_IOC_GETFLAGS is usable" >&5 +printf %s "checking whether FS_IOC_GETFLAGS is usable... " >&6; } +if test ${ac_cv_have_decl_FS_IOC_GETFLAGS+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int -main () +main (void) { int x = FS_IOC_GETFLAGS ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_have_decl_FS_IOC_GETFLAGS=yes -else +else $as_nop ac_cv_have_decl_FS_IOC_GETFLAGS=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_decl_FS_IOC_GETFLAGS" >&5 -$as_echo "$ac_cv_have_decl_FS_IOC_GETFLAGS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_decl_FS_IOC_GETFLAGS" >&5 +printf "%s\n" "$ac_cv_have_decl_FS_IOC_GETFLAGS" >&6; } -if test "x$ac_cv_have_decl_FS_IOC_GETFLAGS" = xyes; then : +if test "x$ac_cv_have_decl_FS_IOC_GETFLAGS" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_WORKING_FS_IOC_GETFLAGS 1 -_ACEOF +printf "%s\n" "#define HAVE_WORKING_FS_IOC_GETFLAGS 1" >>confdefs.h fi -for ac_header in locale.h membership.h paths.h poll.h pthread.h pwd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" +if test "x$ac_cv_header_locale_h" = xyes +then : + printf "%s\n" "#define HAVE_LOCALE_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "membership.h" "ac_cv_header_membership_h" "$ac_includes_default" +if test "x$ac_cv_header_membership_h" = xyes +then : + printf "%s\n" "#define HAVE_MEMBERSHIP_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" +if test "x$ac_cv_header_paths_h" = xyes +then : + printf "%s\n" "#define HAVE_PATHS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" +if test "x$ac_cv_header_poll_h" = xyes +then : + printf "%s\n" "#define HAVE_POLL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + printf "%s\n" "#define HAVE_PTHREAD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" +if test "x$ac_cv_header_pwd_h" = xyes +then : + printf "%s\n" "#define HAVE_PWD_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "readpassphrase.h" "ac_cv_header_readpassphrase_h" "$ac_includes_default" +if test "x$ac_cv_header_readpassphrase_h" = xyes +then : + printf "%s\n" "#define HAVE_READPASSPHRASE_H 1" >>confdefs.h -for ac_header in readpassphrase.h signal.h spawn.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" +if test "x$ac_cv_header_signal_h" = xyes +then : + printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "spawn.h" "ac_cv_header_spawn_h" "$ac_includes_default" +if test "x$ac_cv_header_spawn_h" = xyes +then : + printf "%s\n" "#define HAVE_SPAWN_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" +if test "x$ac_cv_header_stdarg_h" = xyes +then : + printf "%s\n" "#define HAVE_STDARG_H 1" >>confdefs.h -for ac_header in stdarg.h stdint.h stdlib.h string.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "sys/acl.h" "ac_cv_header_sys_acl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_acl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_ACL_H 1" >>confdefs.h -for ac_header in sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "sys/cdefs.h" "ac_cv_header_sys_cdefs_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_cdefs_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_CDEFS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/ea.h" "ac_cv_header_sys_ea_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ea_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_EA_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/extattr.h" "ac_cv_header_sys_extattr_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_extattr_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_EXTATTR_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ioctl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h -for ac_header in sys/ioctl.h sys/mkdev.h sys/mount.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mkdev_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_MKDEV_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/mount.h" "ac_cv_header_sys_mount_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mount_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_MOUNT_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h -for ac_header in sys/param.h sys/poll.h sys/richacl.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_poll_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_POLL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/richacl.h" "ac_cv_header_sys_richacl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_richacl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_RICHACL_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_select_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h -for ac_header in sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "sys/statfs.h" "ac_cv_header_sys_statfs_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_statfs_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_STATFS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_statvfs_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_STATVFS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sysmacros_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SYSMACROS_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h -for ac_header in sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "sys/utime.h" "ac_cv_header_sys_utime_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_utime_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_UTIME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/utsname.h" "ac_cv_header_sys_utsname_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_utsname_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_UTSNAME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/vfs.h" "ac_cv_header_sys_vfs_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_vfs_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_VFS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/xattr.h" "ac_cv_header_sys_xattr_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_xattr_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_XATTR_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "time.h" "ac_cv_header_time_h" "$ac_includes_default" +if test "x$ac_cv_header_time_h" = xyes +then : + printf "%s\n" "#define HAVE_TIME_H 1" >>confdefs.h -for ac_header in time.h unistd.h utime.h wchar.h wctype.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "utime.h" "ac_cv_header_utime_h" "$ac_includes_default" +if test "x$ac_cv_header_utime_h" = xyes +then : + printf "%s\n" "#define HAVE_UTIME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" +if test "x$ac_cv_header_wchar_h" = xyes +then : + printf "%s\n" "#define HAVE_WCHAR_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "wctype.h" "ac_cv_header_wctype_h" "$ac_includes_default" +if test "x$ac_cv_header_wctype_h" = xyes +then : + printf "%s\n" "#define HAVE_WCTYPE_H 1" >>confdefs.h fi -done - -for ac_header in windows.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" -if test "x$ac_cv_header_windows_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WINDOWS_H 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" +if test "x$ac_cv_header_windows_h" = xyes +then : + printf "%s\n" "#define HAVE_WINDOWS_H 1" >>confdefs.h fi -done - # check windows.h first; the other headers require it. -for ac_header in wincrypt.h winioctl.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#ifdef HAVE_WINDOWS_H +ac_fn_c_check_header_compile "$LINENO" "wincrypt.h" "ac_cv_header_wincrypt_h" "#ifdef HAVE_WINDOWS_H # include #endif " -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +if test "x$ac_cv_header_wincrypt_h" = xyes +then : + printf "%s\n" "#define HAVE_WINCRYPT_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "winioctl.h" "ac_cv_header_winioctl_h" "#ifdef HAVE_WINDOWS_H +# include +#endif -done +" +if test "x$ac_cv_header_winioctl_h" = xyes +then : + printf "%s\n" "#define HAVE_WINIOCTL_H 1" >>confdefs.h + +fi # Checks for libraries. # Check whether --with-zlib was given. -if test "${with_zlib+set}" = set; then : +if test ${with_zlib+y} +then : withval=$with_zlib; fi if test "x$with_zlib" != "xno"; then - for ac_header in zlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ZLIB_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +if test "x$ac_cv_header_zlib_h" = xyes +then : + printf "%s\n" "#define HAVE_ZLIB_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 -$as_echo_n "checking for inflate in -lz... " >&6; } -if ${ac_cv_lib_z_inflate+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 +printf %s "checking for inflate in -lz... " >&6; } +if test ${ac_cv_lib_z_inflate+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14114,33 +14938,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char inflate (); int -main () +main (void) { return inflate (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_z_inflate=yes -else +else $as_nop ac_cv_lib_z_inflate=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 -$as_echo "$ac_cv_lib_z_inflate" >&6; } -if test "x$ac_cv_lib_z_inflate" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBZ 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 +printf "%s\n" "$ac_cv_lib_z_inflate" >&6; } +if test "x$ac_cv_lib_z_inflate" = xyes +then : + printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h LIBS="-lz $LIBS" @@ -14150,28 +14971,24 @@ fi # Check whether --with-bz2lib was given. -if test "${with_bz2lib+set}" = set; then : +if test ${with_bz2lib+y} +then : withval=$with_bz2lib; fi if test "x$with_bz2lib" != "xno"; then - for ac_header in bzlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default" -if test "x$ac_cv_header_bzlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_BZLIB_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default" +if test "x$ac_cv_header_bzlib_h" = xyes +then : + printf "%s\n" "#define HAVE_BZLIB_H 1" >>confdefs.h fi -done - case "$host_os" in *mingw* | *cygwin* | *msys*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5 -$as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5 +printf %s "checking for BZ2_bzDecompressInit in -lbz2... " >&6; } old_LIBS="$LIBS" LIBS="-lbz2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14179,29 +14996,31 @@ $as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; } #include int main() { return BZ2_bzDecompressInit(NULL, 0, 0); } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_bz2_BZ2_bzDecompressInit=yes -else +else $as_nop ac_cv_lib_bz2_BZ2_bzDecompressInit=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$old_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5 -$as_echo "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5 +printf "%s\n" "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; } if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then -$as_echo "#define HAVE_LIBBZ2 1" >>confdefs.h +printf "%s\n" "#define HAVE_LIBBZ2 1" >>confdefs.h LIBS="-lbz2 $LIBS" fi ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5 -$as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; } -if ${ac_cv_lib_bz2_BZ2_bzDecompressInit+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5 +printf %s "checking for BZ2_bzDecompressInit in -lbz2... " >&6; } +if test ${ac_cv_lib_bz2_BZ2_bzDecompressInit+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lbz2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14210,33 +15029,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char BZ2_bzDecompressInit (); int -main () +main (void) { return BZ2_bzDecompressInit (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_bz2_BZ2_bzDecompressInit=yes -else +else $as_nop ac_cv_lib_bz2_BZ2_bzDecompressInit=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5 -$as_echo "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; } -if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBBZ2 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5 +printf "%s\n" "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; } +if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes +then : + printf "%s\n" "#define HAVE_LIBBZ2 1" >>confdefs.h LIBS="-lbz2 $LIBS" @@ -14248,29 +15064,26 @@ fi # Check whether --with-libb2 was given. -if test "${with_libb2+set}" = set; then : +if test ${with_libb2+y} +then : withval=$with_libb2; fi if test "x$with_libb2" != "xno"; then - for ac_header in blake2.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "blake2.h" "ac_cv_header_blake2_h" "$ac_includes_default" -if test "x$ac_cv_header_blake2_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_BLAKE2_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "blake2.h" "ac_cv_header_blake2_h" "$ac_includes_default" +if test "x$ac_cv_header_blake2_h" = xyes +then : + printf "%s\n" "#define HAVE_BLAKE2_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for blake2sp_init in -lb2" >&5 -$as_echo_n "checking for blake2sp_init in -lb2... " >&6; } -if ${ac_cv_lib_b2_blake2sp_init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for blake2sp_init in -lb2" >&5 +printf %s "checking for blake2sp_init in -lb2... " >&6; } +if test ${ac_cv_lib_b2_blake2sp_init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lb2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14279,33 +15092,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char blake2sp_init (); int -main () +main (void) { return blake2sp_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_b2_blake2sp_init=yes -else +else $as_nop ac_cv_lib_b2_blake2sp_init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_b2_blake2sp_init" >&5 -$as_echo "$ac_cv_lib_b2_blake2sp_init" >&6; } -if test "x$ac_cv_lib_b2_blake2sp_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBB2 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_b2_blake2sp_init" >&5 +printf "%s\n" "$ac_cv_lib_b2_blake2sp_init" >&6; } +if test "x$ac_cv_lib_b2_blake2sp_init" = xyes +then : + printf "%s\n" "#define HAVE_LIBB2 1" >>confdefs.h LIBS="-lb2 $LIBS" @@ -14324,7 +15134,8 @@ fi # Check whether --with-iconv was given. -if test "${with_iconv+set}" = set; then : +if test ${with_iconv+y} +then : withval=$with_iconv; fi @@ -14348,9 +15159,10 @@ if test "x$with_iconv" != "xno"; then # Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : +if test ${with_gnu_ld+y} +then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else +else $as_nop with_gnu_ld=no fi @@ -14369,8 +15181,8 @@ fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5 -$as_echo_n "checking for ld used by GCC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5 +printf %s "checking for ld used by GCC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -14399,15 +15211,16 @@ $as_echo_n "checking for ld used by GCC... " >&6; } ;; esac elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } fi -if ${acl_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${acl_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do @@ -14433,18 +15246,19 @@ fi LD="$acl_cv_path_LD" if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -$as_echo "$LD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${acl_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${acl_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop # I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 &1 &5 -$as_echo "$acl_cv_prog_gnu_ld" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5 +printf "%s\n" "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 -$as_echo_n "checking for shared library run path origin... " >&6; } -if ${acl_cv_rpath+:} false; then : - $as_echo_n "(cached) " >&6 -else + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +printf %s "checking for shared library run path origin... " >&6; } +if test ${acl_cv_rpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh @@ -14473,8 +15289,8 @@ else acl_cv_rpath=done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 -$as_echo "$acl_cv_rpath" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +printf "%s\n" "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" @@ -14485,9 +15301,10 @@ $as_echo "$acl_cv_rpath" >&6; } acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : +if test ${enable_rpath+y} +then : enableval=$enable_rpath; : -else +else $as_nop enable_rpath=yes fi @@ -14498,11 +15315,12 @@ fi acl_libdirstem2= case "$host_os" in solaris*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 -$as_echo_n "checking for 64-bit host... " >&6; } -if ${gl_cv_solaris_64bit+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 +printf %s "checking for 64-bit host... " >&6; } +if test ${gl_cv_solaris_64bit+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14512,17 +15330,18 @@ sixtyfour bits _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sixtyfour bits" >/dev/null 2>&1; then : + $EGREP "sixtyfour bits" >/dev/null 2>&1 +then : gl_cv_solaris_64bit=yes -else +else $as_nop gl_cv_solaris_64bit=no fi -rm -f conftest* +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 -$as_echo "$gl_cv_solaris_64bit" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 +printf "%s\n" "$gl_cv_solaris_64bit" >&6; } if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in @@ -14581,7 +15400,8 @@ $as_echo "$gl_cv_solaris_64bit" >&6; } # Check whether --with-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then : +if test ${with_libiconv_prefix+y} +then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no @@ -15051,11 +15871,12 @@ fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 -$as_echo_n "checking for iconv... " >&6; } -if ${am_cv_func_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +printf %s "checking for iconv... " >&6; } +if test ${am_cv_func_iconv+y} +then : + printf %s "(cached) " >&6 +else $as_nop am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no @@ -15066,7 +15887,7 @@ else #include int -main () +main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); @@ -15075,10 +15896,11 @@ iconv_t cd = iconv_open("",""); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : am_cv_func_iconv=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" @@ -15090,7 +15912,7 @@ rm -f core conftest.err conftest.$ac_objext \ #include int -main () +main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); @@ -15099,24 +15921,26 @@ iconv_t cd = iconv_open("",""); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 -$as_echo "$am_cv_func_iconv" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +printf "%s\n" "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 -$as_echo_n "checking for working iconv... " >&6; } -if ${am_cv_func_iconv_works+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +printf %s "checking for working iconv... " >&6; } +if test ${am_cv_func_iconv_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then @@ -15124,12 +15948,13 @@ else fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15141,7 +15966,7 @@ else #endif int -main () +main (void) { int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful @@ -15241,7 +16066,8 @@ int result = 0; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : am_cv_func_iconv_works=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -15253,8 +16079,8 @@ fi LIBS="$am_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 -$as_echo "$am_cv_func_iconv_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +printf "%s\n" "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; @@ -15264,14 +16090,14 @@ $as_echo "$am_cv_func_iconv_works" >&6; } fi if test "$am_func_iconv" = yes; then -$as_echo "#define HAVE_ICONV 1" >>confdefs.h +printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 -$as_echo_n "checking how to link with libiconv... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 -$as_echo "$LIBICONV" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +printf %s "checking how to link with libiconv... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +printf "%s\n" "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= @@ -15281,11 +16107,12 @@ $as_echo "$LIBICONV" >&6; } if test "$am_cv_func_iconv" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 -$as_echo_n "checking for iconv declaration... " >&6; } - if ${am_cv_proto_iconv+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 +printf %s "checking for iconv declaration... " >&6; } + if test ${am_cv_proto_iconv+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15303,82 +16130,69 @@ size_t iconv(); #endif int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : am_cv_proto_iconv_arg1="" -else +else $as_nop am_cv_proto_iconv_arg1="const" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_proto_iconv" >&5 -$as_echo " +printf "%s\n" " $am_cv_proto_iconv" >&6; } -cat >>confdefs.h <<_ACEOF -#define ICONV_CONST $am_cv_proto_iconv_arg1 -_ACEOF +printf "%s\n" "#define ICONV_CONST $am_cv_proto_iconv_arg1" >>confdefs.h fi - for ac_header in iconv.h -do : ac_fn_c_check_header_compile "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "#include " -if test "x$ac_cv_header_iconv_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ICONV_H 1 -_ACEOF +if test "x$ac_cv_header_iconv_h" = xyes +then : + printf "%s\n" "#define HAVE_ICONV_H 1" >>confdefs.h fi -done - if test "x$am_cv_func_iconv" = "xyes"; then - for ac_header in localcharset.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "localcharset.h" "ac_cv_header_localcharset_h" "$ac_includes_default" -if test "x$ac_cv_header_localcharset_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LOCALCHARSET_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "localcharset.h" "ac_cv_header_localcharset_h" "$ac_includes_default" +if test "x$ac_cv_header_localcharset_h" = xyes +then : + printf "%s\n" "#define HAVE_LOCALCHARSET_H 1" >>confdefs.h fi -done - am_save_LIBS="$LIBS" LIBS="${LIBS} ${LIBICONV}" - for ac_func in locale_charset -do : - ac_fn_c_check_func "$LINENO" "locale_charset" "ac_cv_func_locale_charset" -if test "x$ac_cv_func_locale_charset" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LOCALE_CHARSET 1 -_ACEOF + LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv" + ac_fn_c_check_func "$LINENO" "locale_charset" "ac_cv_func_locale_charset" +if test "x$ac_cv_func_locale_charset" = xyes +then : + printf "%s\n" "#define HAVE_LOCALE_CHARSET 1" >>confdefs.h fi -done LIBS="${am_save_LIBS}" if test "x$ac_cv_func_locale_charset" != "xyes"; then # If locale_charset() is not in libiconv, we have to find libcharset. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_charset in -lcharset" >&5 -$as_echo_n "checking for locale_charset in -lcharset... " >&6; } -if ${ac_cv_lib_charset_locale_charset+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for locale_charset in -lcharset" >&5 +printf %s "checking for locale_charset in -lcharset... " >&6; } +if test ${ac_cv_lib_charset_locale_charset+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcharset $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15387,33 +16201,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char locale_charset (); int -main () +main (void) { return locale_charset (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_charset_locale_charset=yes -else +else $as_nop ac_cv_lib_charset_locale_charset=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_charset_locale_charset" >&5 -$as_echo "$ac_cv_lib_charset_locale_charset" >&6; } -if test "x$ac_cv_lib_charset_locale_charset" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBCHARSET 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_charset_locale_charset" >&5 +printf "%s\n" "$ac_cv_lib_charset_locale_charset" >&6; } +if test "x$ac_cv_lib_charset_locale_charset" = xyes +then : + printf "%s\n" "#define HAVE_LIBCHARSET 1" >>confdefs.h LIBS="-lcharset $LIBS" @@ -15425,30 +16236,32 @@ fi # Check whether --with-lz4 was given. -if test "${with_lz4+set}" = set; then : +if test ${with_lz4+y} +then : withval=$with_lz4; fi if test "x$with_lz4" != "xno"; then - for ac_header in lz4.h lz4hc.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "lz4.h" "ac_cv_header_lz4_h" "$ac_includes_default" +if test "x$ac_cv_header_lz4_h" = xyes +then : + printf "%s\n" "#define HAVE_LZ4_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "lz4hc.h" "ac_cv_header_lz4hc_h" "$ac_includes_default" +if test "x$ac_cv_header_lz4hc_h" = xyes +then : + printf "%s\n" "#define HAVE_LZ4HC_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ4_decompress_safe in -llz4" >&5 -$as_echo_n "checking for LZ4_decompress_safe in -llz4... " >&6; } -if ${ac_cv_lib_lz4_LZ4_decompress_safe+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LZ4_decompress_safe in -llz4" >&5 +printf %s "checking for LZ4_decompress_safe in -llz4... " >&6; } +if test ${ac_cv_lib_lz4_LZ4_decompress_safe+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-llz4 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15457,33 +16270,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char LZ4_decompress_safe (); int -main () +main (void) { return LZ4_decompress_safe (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_lz4_LZ4_decompress_safe=yes -else +else $as_nop ac_cv_lib_lz4_LZ4_decompress_safe=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lz4_LZ4_decompress_safe" >&5 -$as_echo "$ac_cv_lib_lz4_LZ4_decompress_safe" >&6; } -if test "x$ac_cv_lib_lz4_LZ4_decompress_safe" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLZ4 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lz4_LZ4_decompress_safe" >&5 +printf "%s\n" "$ac_cv_lib_lz4_LZ4_decompress_safe" >&6; } +if test "x$ac_cv_lib_lz4_LZ4_decompress_safe" = xyes +then : + printf "%s\n" "#define HAVE_LIBLZ4 1" >>confdefs.h LIBS="-llz4 $LIBS" @@ -15493,29 +16303,69 @@ fi # Check whether --with-zstd was given. -if test "${with_zstd+set}" = set; then : +if test ${with_zstd+y} +then : withval=$with_zstd; fi if test "x$with_zstd" != "xno"; then - for ac_header in zstd.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default" -if test "x$ac_cv_header_zstd_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ZSTD_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default" +if test "x$ac_cv_header_zstd_h" = xyes +then : + printf "%s\n" "#define HAVE_ZSTD_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ZSTD_compressStream in -lzstd" >&5 -$as_echo_n "checking for ZSTD_compressStream in -lzstd... " >&6; } -if ${ac_cv_lib_zstd_ZSTD_compressStream+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ZSTD_decompressStream in -lzstd" >&5 +printf %s "checking for ZSTD_decompressStream in -lzstd... " >&6; } +if test ${ac_cv_lib_zstd_ZSTD_decompressStream+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lzstd $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char ZSTD_decompressStream (); +int +main (void) +{ +return ZSTD_decompressStream (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_zstd_ZSTD_decompressStream=yes +else $as_nop + ac_cv_lib_zstd_ZSTD_decompressStream=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_decompressStream" >&5 +printf "%s\n" "$ac_cv_lib_zstd_ZSTD_decompressStream" >&6; } +if test "x$ac_cv_lib_zstd_ZSTD_decompressStream" = xyes +then : + printf "%s\n" "#define HAVE_LIBZSTD 1" >>confdefs.h + + LIBS="-lzstd $LIBS" + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ZSTD_compressStream in -lzstd" >&5 +printf %s "checking for ZSTD_compressStream in -lzstd... " >&6; } +if test ${ac_cv_lib_zstd_ZSTD_compressStream+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lzstd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15524,35 +16374,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char ZSTD_compressStream (); int -main () +main (void) { return ZSTD_compressStream (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_zstd_ZSTD_compressStream=yes -else +else $as_nop ac_cv_lib_zstd_ZSTD_compressStream=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_compressStream" >&5 -$as_echo "$ac_cv_lib_zstd_ZSTD_compressStream" >&6; } -if test "x$ac_cv_lib_zstd_ZSTD_compressStream" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBZSTD 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_compressStream" >&5 +printf "%s\n" "$ac_cv_lib_zstd_ZSTD_compressStream" >&6; } +if test "x$ac_cv_lib_zstd_ZSTD_compressStream" = xyes +then : - LIBS="-lzstd $LIBS" +printf "%s\n" "#define HAVE_LIBZSTD_COMPRESSOR 1" >>confdefs.h fi @@ -15560,29 +16406,26 @@ fi # Check whether --with-lzma was given. -if test "${with_lzma+set}" = set; then : +if test ${with_lzma+y} +then : withval=$with_lzma; fi if test "x$with_lzma" != "xno"; then - for ac_header in lzma.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default" -if test "x$ac_cv_header_lzma_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LZMA_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default" +if test "x$ac_cv_header_lzma_h" = xyes +then : + printf "%s\n" "#define HAVE_LZMA_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_stream_decoder in -llzma" >&5 -$as_echo_n "checking for lzma_stream_decoder in -llzma... " >&6; } -if ${ac_cv_lib_lzma_lzma_stream_decoder+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lzma_stream_decoder in -llzma" >&5 +printf %s "checking for lzma_stream_decoder in -llzma... " >&6; } +if test ${ac_cv_lib_lzma_lzma_stream_decoder+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-llzma $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15591,33 +16434,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char lzma_stream_decoder (); int -main () +main (void) { return lzma_stream_decoder (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_lzma_lzma_stream_decoder=yes -else +else $as_nop ac_cv_lib_lzma_lzma_stream_decoder=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_stream_decoder" >&5 -$as_echo "$ac_cv_lib_lzma_lzma_stream_decoder" >&6; } -if test "x$ac_cv_lib_lzma_lzma_stream_decoder" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLZMA 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_stream_decoder" >&5 +printf "%s\n" "$ac_cv_lib_lzma_lzma_stream_decoder" >&6; } +if test "x$ac_cv_lib_lzma_lzma_stream_decoder" = xyes +then : + printf "%s\n" "#define HAVE_LIBLZMA 1" >>confdefs.h LIBS="-llzma $LIBS" @@ -15627,11 +16467,12 @@ fi # included a disabled version of lzma_stream_encoder_mt that # fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need # to do something more complex here: - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have multithread support in lzma" >&5 -$as_echo_n "checking whether we have multithread support in lzma... " >&6; } -if ${ac_cv_lzma_has_mt+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we have multithread support in lzma" >&5 +printf %s "checking whether we have multithread support in lzma... " >&6; } +if test ${ac_cv_lzma_has_mt+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15640,56 +16481,59 @@ else #error unsupported #endif int -main () +main (void) { lzma_stream_encoder_mt(0, 0); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lzma_has_mt=yes -else +else $as_nop ac_cv_lzma_has_mt=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lzma_has_mt" >&5 -$as_echo "$ac_cv_lzma_has_mt" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lzma_has_mt" >&5 +printf "%s\n" "$ac_cv_lzma_has_mt" >&6; } if test "x$ac_cv_lzma_has_mt" != xno; then -$as_echo "#define HAVE_LZMA_STREAM_ENCODER_MT 1" >>confdefs.h +printf "%s\n" "#define HAVE_LZMA_STREAM_ENCODER_MT 1" >>confdefs.h fi fi # Check whether --with-lzo2 was given. -if test "${with_lzo2+set}" = set; then : +if test ${with_lzo2+y} +then : withval=$with_lzo2; fi if test "x$with_lzo2" = "xyes"; then - for ac_header in lzo/lzoconf.h lzo/lzo1x.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "lzo/lzoconf.h" "ac_cv_header_lzo_lzoconf_h" "$ac_includes_default" +if test "x$ac_cv_header_lzo_lzoconf_h" = xyes +then : + printf "%s\n" "#define HAVE_LZO_LZOCONF_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "lzo/lzo1x.h" "ac_cv_header_lzo_lzo1x_h" "$ac_includes_default" +if test "x$ac_cv_header_lzo_lzo1x_h" = xyes +then : + printf "%s\n" "#define HAVE_LZO_LZO1X_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo1x_decompress_safe in -llzo2" >&5 -$as_echo_n "checking for lzo1x_decompress_safe in -llzo2... " >&6; } -if ${ac_cv_lib_lzo2_lzo1x_decompress_safe+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lzo1x_decompress_safe in -llzo2" >&5 +printf %s "checking for lzo1x_decompress_safe in -llzo2... " >&6; } +if test ${ac_cv_lib_lzo2_lzo1x_decompress_safe+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-llzo2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15698,33 +16542,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char lzo1x_decompress_safe (); int -main () +main (void) { return lzo1x_decompress_safe (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_lzo2_lzo1x_decompress_safe=yes -else +else $as_nop ac_cv_lib_lzo2_lzo1x_decompress_safe=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzo2_lzo1x_decompress_safe" >&5 -$as_echo "$ac_cv_lib_lzo2_lzo1x_decompress_safe" >&6; } -if test "x$ac_cv_lib_lzo2_lzo1x_decompress_safe" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLZO2 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzo2_lzo1x_decompress_safe" >&5 +printf "%s\n" "$ac_cv_lib_lzo2_lzo1x_decompress_safe" >&6; } +if test "x$ac_cv_lib_lzo2_lzo1x_decompress_safe" = xyes +then : + printf "%s\n" "#define HAVE_LIBLZO2 1" >>confdefs.h LIBS="-llzo2 $LIBS" @@ -15734,26 +16575,30 @@ fi # Check whether --with-cng was given. -if test "${with_cng+set}" = set; then : +if test ${with_cng+y} +then : withval=$with_cng; fi # Check whether --with-mbedtls was given. -if test "${with_mbedtls+set}" = set; then : +if test ${with_mbedtls+y} +then : withval=$with_mbedtls; fi # Check whether --with-nettle was given. -if test "${with_nettle+set}" = set; then : +if test ${with_nettle+y} +then : withval=$with_nettle; fi # Check whether --with-openssl was given. -if test "${with_openssl+set}" = set; then : +if test ${with_openssl+y} +then : withval=$with_openssl; fi @@ -15763,13 +16608,15 @@ esac # Check whether --with-xml2 was given. -if test "${with_xml2+set}" = set; then : +if test ${with_xml2+y} +then : withval=$with_xml2; fi # Check whether --with-expat was given. -if test "${with_expat+set}" = set; then : +if test ${with_expat+y} +then : withval=$with_expat; fi @@ -15786,11 +16633,12 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. @@ -15800,11 +16648,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -15816,11 +16668,11 @@ esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -15829,11 +16681,12 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. @@ -15843,11 +16696,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -15859,11 +16716,11 @@ esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then @@ -15871,8 +16728,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG @@ -15884,30 +16741,30 @@ fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBXML2_PC" >&5 -$as_echo_n "checking for LIBXML2_PC... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0" >&5 +printf %s "checking for libxml-2.0... " >&6; } if test -n "$LIBXML2_PC_CFLAGS"; then pkg_cv_LIBXML2_PC_CFLAGS="$LIBXML2_PC_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBXML2_PC_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -15921,10 +16778,10 @@ if test -n "$LIBXML2_PC_LIBS"; then pkg_cv_LIBXML2_PC_LIBS="$LIBXML2_PC_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBXML2_PC_LIBS=`$PKG_CONFIG --libs "libxml-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -15938,8 +16795,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -15955,11 +16812,12 @@ fi echo "$LIBXML2_PC_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlInitParser in -lxml2" >&5 -$as_echo_n "checking for xmlInitParser in -lxml2... " >&6; } -if ${ac_cv_lib_xml2_xmlInitParser+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xmlInitParser in -lxml2" >&5 +printf %s "checking for xmlInitParser in -lxml2... " >&6; } +if test ${ac_cv_lib_xml2_xmlInitParser+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lxml2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15968,33 +16826,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char xmlInitParser (); int -main () +main (void) { return xmlInitParser (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_xml2_xmlInitParser=yes -else +else $as_nop ac_cv_lib_xml2_xmlInitParser=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlInitParser" >&5 -$as_echo "$ac_cv_lib_xml2_xmlInitParser" >&6; } -if test "x$ac_cv_lib_xml2_xmlInitParser" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBXML2 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlInitParser" >&5 +printf "%s\n" "$ac_cv_lib_xml2_xmlInitParser" >&6; } +if test "x$ac_cv_lib_xml2_xmlInitParser" = xyes +then : + printf "%s\n" "#define HAVE_LIBXML2 1" >>confdefs.h LIBS="-lxml2 $LIBS" @@ -16002,14 +16857,15 @@ fi elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlInitParser in -lxml2" >&5 -$as_echo_n "checking for xmlInitParser in -lxml2... " >&6; } -if ${ac_cv_lib_xml2_xmlInitParser+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xmlInitParser in -lxml2" >&5 +printf %s "checking for xmlInitParser in -lxml2... " >&6; } +if test ${ac_cv_lib_xml2_xmlInitParser+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lxml2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16018,33 +16874,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char xmlInitParser (); int -main () +main (void) { return xmlInitParser (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_xml2_xmlInitParser=yes -else +else $as_nop ac_cv_lib_xml2_xmlInitParser=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlInitParser" >&5 -$as_echo "$ac_cv_lib_xml2_xmlInitParser" >&6; } -if test "x$ac_cv_lib_xml2_xmlInitParser" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBXML2 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlInitParser" >&5 +printf "%s\n" "$ac_cv_lib_xml2_xmlInitParser" >&6; } +if test "x$ac_cv_lib_xml2_xmlInitParser" = xyes +then : + printf "%s\n" "#define HAVE_LIBXML2 1" >>confdefs.h LIBS="-lxml2 $LIBS" @@ -16054,16 +16907,17 @@ fi else LIBXML2_PC_CFLAGS=$pkg_cv_LIBXML2_PC_CFLAGS LIBXML2_PC_LIBS=$pkg_cv_LIBXML2_PC_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}" LIBS="${LIBS} ${LIBXML2_PC_LIBS}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlInitParser in -lxml2" >&5 -$as_echo_n "checking for xmlInitParser in -lxml2... " >&6; } -if ${ac_cv_lib_xml2_xmlInitParser+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for xmlInitParser in -lxml2" >&5 +printf %s "checking for xmlInitParser in -lxml2... " >&6; } +if test ${ac_cv_lib_xml2_xmlInitParser+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lxml2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16072,73 +16926,68 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char xmlInitParser (); int -main () +main (void) { return xmlInitParser (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_xml2_xmlInitParser=yes -else +else $as_nop ac_cv_lib_xml2_xmlInitParser=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlInitParser" >&5 -$as_echo "$ac_cv_lib_xml2_xmlInitParser" >&6; } -if test "x$ac_cv_lib_xml2_xmlInitParser" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_xmlInitParser" >&5 +printf "%s\n" "$ac_cv_lib_xml2_xmlInitParser" >&6; } +if test "x$ac_cv_lib_xml2_xmlInitParser" = xyes +then : true -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Missing xml2 library See \`config.log' for more details" "$LINENO" 5; } fi fi - for ac_header in libxml/xmlreader.h libxml/xmlwriter.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "libxml/xmlreader.h" "ac_cv_header_libxml_xmlreader_h" "$ac_includes_default" +if test "x$ac_cv_header_libxml_xmlreader_h" = xyes +then : + printf "%s\n" "#define HAVE_LIBXML_XMLREADER_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "libxml/xmlwriter.h" "ac_cv_header_libxml_xmlwriter_h" "$ac_includes_default" +if test "x$ac_cv_header_libxml_xmlwriter_h" = xyes +then : + printf "%s\n" "#define HAVE_LIBXML_XMLWRITER_H 1" >>confdefs.h -done +fi fi if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then if test "x$with_expat" != "xno"; then - for ac_header in expat.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "expat.h" "ac_cv_header_expat_h" "$ac_includes_default" -if test "x$ac_cv_header_expat_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_EXPAT_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "expat.h" "ac_cv_header_expat_h" "$ac_includes_default" +if test "x$ac_cv_header_expat_h" = xyes +then : + printf "%s\n" "#define HAVE_EXPAT_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML_ParserCreate in -lexpat" >&5 -$as_echo_n "checking for XML_ParserCreate in -lexpat... " >&6; } -if ${ac_cv_lib_expat_XML_ParserCreate+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for XML_ParserCreate in -lexpat" >&5 +printf %s "checking for XML_ParserCreate in -lexpat... " >&6; } +if test ${ac_cv_lib_expat_XML_ParserCreate+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lexpat $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16147,33 +16996,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char XML_ParserCreate (); int -main () +main (void) { return XML_ParserCreate (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_expat_XML_ParserCreate=yes -else +else $as_nop ac_cv_lib_expat_XML_ParserCreate=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_expat_XML_ParserCreate" >&5 -$as_echo "$ac_cv_lib_expat_XML_ParserCreate" >&6; } -if test "x$ac_cv_lib_expat_XML_ParserCreate" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBEXPAT 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_expat_XML_ParserCreate" >&5 +printf "%s\n" "$ac_cv_lib_expat_XML_ParserCreate" >&6; } +if test "x$ac_cv_lib_expat_XML_ParserCreate" = xyes +then : + printf "%s\n" "#define HAVE_LIBEXPAT 1" >>confdefs.h LIBS="-lexpat $LIBS" @@ -16183,41 +17029,39 @@ fi fi # Check whether --enable-posix-regex-lib was given. -if test "${enable_posix_regex_lib+set}" = set; then : +if test ${enable_posix_regex_lib+y} +then : enableval=$enable_posix_regex_lib; -else +else $as_nop enable_posix_regex_lib=auto fi posix_regex_lib_found= if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then - for ac_header in regex.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default" -if test "x$ac_cv_header_regex_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_REGEX_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default" +if test "x$ac_cv_header_regex_h" = xyes +then : + printf "%s\n" "#define HAVE_REGEX_H 1" >>confdefs.h fi -done - if test "x$ac_cv_header_regex_h" != "xno"; then ac_fn_c_check_func "$LINENO" "regcomp" "ac_cv_func_regcomp" -if test "x$ac_cv_func_regcomp" = xyes; then : +if test "x$ac_cv_func_regcomp" = xyes +then : fi if test "x$ac_cv_func_regcomp" = xyes; then posix_regex_lib_found=1 else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcomp in -lregex" >&5 -$as_echo_n "checking for regcomp in -lregex... " >&6; } -if ${ac_cv_lib_regex_regcomp+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for regcomp in -lregex" >&5 +printf %s "checking for regcomp in -lregex... " >&6; } +if test ${ac_cv_lib_regex_regcomp+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lregex $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16226,33 +17070,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char regcomp (); int -main () +main (void) { return regcomp (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_regex_regcomp=yes -else +else $as_nop ac_cv_lib_regex_regcomp=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_regex_regcomp" >&5 -$as_echo "$ac_cv_lib_regex_regcomp" >&6; } -if test "x$ac_cv_lib_regex_regcomp" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBREGEX 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_regex_regcomp" >&5 +printf "%s\n" "$ac_cv_lib_regex_regcomp" >&6; } +if test "x$ac_cv_lib_regex_regcomp" = xyes +then : + printf "%s\n" "#define HAVE_LIBREGEX 1" >>confdefs.h LIBS="-lregex $LIBS" @@ -16265,23 +17106,19 @@ fi fi fi if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then - for ac_header in pcreposix.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "pcreposix.h" "ac_cv_header_pcreposix_h" "$ac_includes_default" -if test "x$ac_cv_header_pcreposix_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PCREPOSIX_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "pcreposix.h" "ac_cv_header_pcreposix_h" "$ac_includes_default" +if test "x$ac_cv_header_pcreposix_h" = xyes +then : + printf "%s\n" "#define HAVE_PCREPOSIX_H 1" >>confdefs.h fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcomp in -lpcreposix" >&5 -$as_echo_n "checking for regcomp in -lpcreposix... " >&6; } -if ${ac_cv_lib_pcreposix_regcomp+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for regcomp in -lpcreposix" >&5 +printf %s "checking for regcomp in -lpcreposix... " >&6; } +if test ${ac_cv_lib_pcreposix_regcomp+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpcreposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16290,47 +17127,45 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char regcomp (); int -main () +main (void) { return regcomp (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_pcreposix_regcomp=yes -else +else $as_nop ac_cv_lib_pcreposix_regcomp=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcreposix_regcomp" >&5 -$as_echo "$ac_cv_lib_pcreposix_regcomp" >&6; } -if test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBPCREPOSIX 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcreposix_regcomp" >&5 +printf "%s\n" "$ac_cv_lib_pcreposix_regcomp" >&6; } +if test "x$ac_cv_lib_pcreposix_regcomp" = xyes +then : + printf "%s\n" "#define HAVE_LIBPCREPOSIX 1" >>confdefs.h LIBS="-lpcreposix $LIBS" fi if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: trying libpcreposix check again with libpcre" >&5 -$as_echo "$as_me: trying libpcreposix check again with libpcre" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying libpcreposix check again with libpcre" >&5 +printf "%s\n" "$as_me: trying libpcreposix check again with libpcre" >&6;} unset ac_cv_lib_pcreposix_regcomp - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_exec in -lpcre" >&5 -$as_echo_n "checking for pcre_exec in -lpcre... " >&6; } -if ${ac_cv_lib_pcre_pcre_exec+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcre_exec in -lpcre" >&5 +printf %s "checking for pcre_exec in -lpcre... " >&6; } +if test ${ac_cv_lib_pcre_pcre_exec+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16339,43 +17174,41 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char pcre_exec (); int -main () +main (void) { return pcre_exec (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_pcre_pcre_exec=yes -else +else $as_nop ac_cv_lib_pcre_pcre_exec=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_exec" >&5 -$as_echo "$ac_cv_lib_pcre_pcre_exec" >&6; } -if test "x$ac_cv_lib_pcre_pcre_exec" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBPCRE 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_exec" >&5 +printf "%s\n" "$ac_cv_lib_pcre_pcre_exec" >&6; } +if test "x$ac_cv_lib_pcre_pcre_exec" = xyes +then : + printf "%s\n" "#define HAVE_LIBPCRE 1" >>confdefs.h LIBS="-lpcre $LIBS" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcomp in -lpcreposix" >&5 -$as_echo_n "checking for regcomp in -lpcreposix... " >&6; } -if ${ac_cv_lib_pcreposix_regcomp+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for regcomp in -lpcreposix" >&5 +printf %s "checking for regcomp in -lpcreposix... " >&6; } +if test ${ac_cv_lib_pcreposix_regcomp+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lpcreposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16384,52 +17217,50 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char regcomp (); int -main () +main (void) { return regcomp (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_pcreposix_regcomp=yes -else +else $as_nop ac_cv_lib_pcreposix_regcomp=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcreposix_regcomp" >&5 -$as_echo "$ac_cv_lib_pcreposix_regcomp" >&6; } -if test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBPCREPOSIX 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcreposix_regcomp" >&5 +printf "%s\n" "$ac_cv_lib_pcreposix_regcomp" >&6; } +if test "x$ac_cv_lib_pcreposix_regcomp" = xyes +then : + printf "%s\n" "#define HAVE_LIBPCREPOSIX 1" >>confdefs.h LIBS="-lpcreposix $LIBS" fi if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PCRE_STATIC needs to be defined" >&5 -$as_echo_n "checking if PCRE_STATIC needs to be defined... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if PCRE_STATIC needs to be defined" >&5 +printf %s "checking if PCRE_STATIC needs to be defined... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main() { return regcomp(NULL, NULL, 0); } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : without_pcre_static=yes -else +else $as_nop without_pcre_static=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -16437,22 +17268,23 @@ rm -f core conftest.err conftest.$ac_objext \ #include int main() { return regcomp(NULL, NULL, 0); } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : with_pcre_static=yes -else +else $as_nop with_pcre_static=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -$as_echo "#define PCRE_STATIC 1" >>confdefs.h +printf "%s\n" "#define PCRE_STATIC 1" >>confdefs.h elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi posix_regex_lib_found=1 fi @@ -16474,12 +17306,13 @@ fi for flag in -Wall -Wformat -Wformat-security; do - as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 -$as_echo_n "checking whether C compiler accepts $flag... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +printf %s "checking whether C compiler accepts $flag... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $flag" @@ -16487,75 +17320,184 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$as_CACHEVAR=yes" -else +else $as_nop eval "$as_CACHEVAR=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" +then : -if ${CFLAGS+:} false; then : +if test ${CFLAGS+y} +then : case " $CFLAGS " in #( *" $flag "*) : - { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 (: CFLAGS already contains $flag) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append CFLAGS " $flag" - { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 (: CFLAGS="$CFLAGS") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac -else +else $as_nop CFLAGS=$flag - { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 (: CFLAGS="$CFLAGS") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } fi -else +else $as_nop : fi done -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else +# Place the functions and data into separate sections, allowing the linker +# to garbage collect the unused ones. +save_LDFLAGS=$LDFLAGS +LDFLAGS="$LDFLAGS -Wl,--gc-sections" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld supports --gc-sections" >&5 +printf %s "checking whether ld supports --gc-sections... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +static char UnusedFunc() { return 5; } int main() { return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + GC_SECTIONS="-Wl,--gc-sections"; + + + + +for flag in -ffunction-sections -fdata-sections; do + as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +printf %s "checking whether C compiler accepts $flag... " >&6; } +if eval test \${$as_CACHEVAR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $flag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$as_CACHEVAR=yes" +else $as_nop + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes" +then : + +if test ${CFLAGS+y} +then : + + case " $CFLAGS " in #( + *" $flag "*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 + (: CFLAGS already contains $flag) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append CFLAGS " $flag" + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; +esac + +else $as_nop + + CFLAGS=$flag + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + +fi + +else $as_nop + : +fi + +done + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + GC_SECTIONS=""; +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LDFLAGS=$save_LDFLAGS + + + +# Checks for typedefs, structures, and compiler characteristics. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +printf %s "checking for an ANSI C-conforming const... " >&6; } +if test ${ac_cv_c_const+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) { #ifndef __cplusplus @@ -16568,7 +17510,7 @@ main () /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. + /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ @@ -16596,7 +17538,7 @@ main () iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; @@ -16612,115 +17554,109 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_const=yes -else +else $as_nop ac_cv_c_const=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -$as_echo "#define const /**/" >>confdefs.h +printf "%s\n" "#define const /**/" >>confdefs.h fi # la_TYPE_UID_T defaults to "int", which is incorrect for MinGW # and MSVC. Use a customized version. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${la_cv_type_uid_t+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +printf %s "checking for uid_t in sys/types.h... " >&6; } +if test ${la_cv_type_uid_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then : + $EGREP "uid_t" >/dev/null 2>&1 +then : la_cv_type_uid_t=yes -else +else $as_nop la_cv_type_uid_t=no fi -rm -f conftest* +rm -rf conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $la_cv_type_uid_t" >&5 -$as_echo "$la_cv_type_uid_t" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $la_cv_type_uid_t" >&5 +printf "%s\n" "$la_cv_type_uid_t" >&6; } if test $la_cv_type_uid_t = no; then case $host in *mingw*) def_uid_t=short ;; *) def_uid_t=int ;; esac -cat >>confdefs.h <<_ACEOF -#define uid_t $def_uid_t -_ACEOF +printf "%s\n" "#define uid_t $def_uid_t" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define gid_t $def_uid_t -_ACEOF +printf "%s\n" "#define gid_t $def_uid_t" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : +if test "x$ac_cv_type_mode_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define mode_t int -_ACEOF +printf "%s\n" "#define mode_t int" >>confdefs.h fi # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on # most systems... default to "long long" instead. ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : +if test "x$ac_cv_type_off_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define off_t long long -_ACEOF +printf "%s\n" "#define off_t long long" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF +printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "id_t" "ac_cv_type_id_t" "$ac_includes_default" -if test "x$ac_cv_type_id_t" = xyes; then : +if test "x$ac_cv_type_id_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define id_t unsigned long -_ACEOF +printf "%s\n" "#define id_t unsigned long" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" -if test "x$ac_cv_type_uintptr_t" = xyes; then : +if test "x$ac_cv_type_uintptr_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define uintptr_t unsigned int -_ACEOF +printf "%s\n" "#define uintptr_t unsigned int" >>confdefs.h fi @@ -16730,11 +17666,10 @@ ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_t #include " -if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : +if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_TM_TM_GMTOFF 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_TM_TM_GMTOFF 1" >>confdefs.h fi @@ -16742,11 +17677,10 @@ ac_fn_c_check_member "$LINENO" "struct tm" "__tm_gmtoff" "ac_cv_member_struct_tm #include " -if test "x$ac_cv_member_struct_tm___tm_gmtoff" = xyes; then : +if test "x$ac_cv_member_struct_tm___tm_gmtoff" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_TM___TM_GMTOFF 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_TM___TM_GMTOFF 1" >>confdefs.h fi @@ -16758,11 +17692,10 @@ ac_fn_c_check_member "$LINENO" "struct statfs" "f_namemax" "ac_cv_member_struct_ #include " -if test "x$ac_cv_member_struct_statfs_f_namemax" = xyes; then : +if test "x$ac_cv_member_struct_statfs_f_namemax" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STATFS_F_NAMEMAX 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STATFS_F_NAMEMAX 1" >>confdefs.h fi @@ -16774,11 +17707,10 @@ ac_fn_c_check_member "$LINENO" "struct statfs" "f_iosize" "ac_cv_member_struct_s #include " -if test "x$ac_cv_member_struct_statfs_f_iosize" = xyes; then : +if test "x$ac_cv_member_struct_statfs_f_iosize" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STATFS_F_IOSIZE 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STATFS_F_IOSIZE 1" >>confdefs.h fi @@ -16789,11 +17721,10 @@ ac_fn_c_check_member "$LINENO" "struct statvfs" "f_iosize" "ac_cv_member_struct_ #include " -if test "x$ac_cv_member_struct_statvfs_f_iosize" = xyes; then : +if test "x$ac_cv_member_struct_statvfs_f_iosize" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STATVFS_F_IOSIZE 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STATVFS_F_IOSIZE 1" >>confdefs.h fi @@ -16801,11 +17732,10 @@ fi # Check for birthtime in struct stat ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1" >>confdefs.h fi @@ -16813,83 +17743,75 @@ fi # Check for high-resolution timestamps in struct stat ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec.tv_nsec" "ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimespec.tv_nsec" "ac_cv_member_struct_stat_st_mtimespec_tv_nsec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim.tv_nsec" "ac_cv_member_struct_stat_st_mtim_tv_nsec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_mtim_tv_nsec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_mtim_tv_nsec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct stat" "st_mtime_n" "ac_cv_member_struct_stat_st_mtime_n" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_mtime_n" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_mtime_n" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_MTIME_N 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIME_N 1" >>confdefs.h fi # AIX ac_fn_c_check_member "$LINENO" "struct stat" "st_umtime" "ac_cv_member_struct_stat_st_umtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_umtime" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_umtime" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_UMTIME 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_UMTIME 1" >>confdefs.h fi # Tru64 ac_fn_c_check_member "$LINENO" "struct stat" "st_mtime_usec" "ac_cv_member_struct_stat_st_mtime_usec" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_mtime_usec" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_mtime_usec" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_MTIME_USEC 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_MTIME_USEC 1" >>confdefs.h fi # Hurd # Check for block size support in struct stat ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_blksize" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BLKSIZE 1" >>confdefs.h fi # Check for st_flags in struct stat (BSD fflags) ac_fn_c_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : +if test "x$ac_cv_member_struct_stat_st_flags" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_FLAGS 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_FLAGS 1" >>confdefs.h fi @@ -16899,20 +17821,18 @@ fi # If you have unsigned long long, we assume printf supports %llu # TODO: Check for %ju and %llu support directly. ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "$ac_includes_default" -if test "x$ac_cv_type_uintmax_t" = xyes; then : +if test "x$ac_cv_type_uintmax_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_UINTMAX_T 1 -_ACEOF +printf "%s\n" "#define HAVE_UINTMAX_T 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "unsigned long long" "ac_cv_type_unsigned_long_long" "$ac_includes_default" -if test "x$ac_cv_type_unsigned_long_long" = xyes; then : +if test "x$ac_cv_type_unsigned_long_long" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_UNSIGNED_LONG_LONG 1 -_ACEOF +printf "%s\n" "#define HAVE_UNSIGNED_LONG_LONG 1" >>confdefs.h fi @@ -16921,14 +17841,17 @@ fi # We use C99-style integer types # Declare them if the local platform doesn't already do so. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 -$as_echo_n "checking for unsigned long long int... " >&6; } -if ${ac_cv_type_unsigned_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 +printf %s "checking for unsigned long long int... " >&6; } +if test ${ac_cv_type_unsigned_long_long_int+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_type_unsigned_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + case $ac_prog_cc_stdc in + no | c89) ;; + *) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* For now, do not test the preprocessor; as of 2007 there are too many @@ -16946,7 +17869,7 @@ else ? 1 : -1)]; int i = 63; int -main () +main (void) { /* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; @@ -16960,98 +17883,103 @@ main () } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : -else +else $as_nop ac_cv_type_unsigned_long_long_int=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 -$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 +printf "%s\n" "$ac_cv_type_unsigned_long_long_int" >&6; } if test $ac_cv_type_unsigned_long_long_int = yes; then -$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h +printf "%s\n" "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 -$as_echo_n "checking for long long int... " >&6; } -if ${ac_cv_type_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 +printf %s "checking for long long int... " >&6; } +if test ${ac_cv_type_long_long_int+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_type_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_long_long_int = yes; then - if test "$cross_compiling" = yes; then : + case $ac_prog_cc_stdc in + no | c89) ;; + *) + ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_long_long_int = yes; then + if test "$cross_compiling" = yes +then : : -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif int -main () +main (void) { long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : -else +else $as_nop ac_cv_type_long_long_int=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - fi + fi;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 -$as_echo "$ac_cv_type_long_long_int" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 +printf "%s\n" "$ac_cv_type_long_long_int" >&6; } if test $ac_cv_type_long_long_int = yes; then -$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h +printf "%s\n" "#define HAVE_LONG_LONG_INT 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default" -if test "x$ac_cv_type_intmax_t" = xyes; then : +if test "x$ac_cv_type_intmax_t" = xyes +then : -$as_echo "#define HAVE_INTMAX_T 1" >>confdefs.h +printf "%s\n" "#define HAVE_INTMAX_T 1" >>confdefs.h -else +else $as_nop test $ac_cv_type_long_long_int = yes \ && ac_type='long long int' \ || ac_type='long int' -cat >>confdefs.h <<_ACEOF -#define intmax_t $ac_type -_ACEOF +printf "%s\n" "#define intmax_t $ac_type" >>confdefs.h fi @@ -17059,18 +17987,17 @@ fi ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "$ac_includes_default" -if test "x$ac_cv_type_uintmax_t" = xyes; then : +if test "x$ac_cv_type_uintmax_t" = xyes +then : -$as_echo "#define HAVE_UINTMAX_T 1" >>confdefs.h +printf "%s\n" "#define HAVE_UINTMAX_T 1" >>confdefs.h -else +else $as_nop test $ac_cv_type_unsigned_long_long_int = yes \ && ac_type='unsigned long long int' \ || ac_type='unsigned long int' -cat >>confdefs.h <<_ACEOF -#define uintmax_t $ac_type -_ACEOF +printf "%s\n" "#define uintmax_t $ac_type" >>confdefs.h fi @@ -17080,9 +18007,7 @@ case $ac_cv_c_int64_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int64_t $ac_cv_c_int64_t -_ACEOF +printf "%s\n" "#define int64_t $ac_cv_c_int64_t" >>confdefs.h ;; esac @@ -17091,12 +18016,10 @@ case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT64_T 1" >>confdefs.h +printf "%s\n" "#define _UINT64_T 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define uint64_t $ac_cv_c_uint64_t -_ACEOF +printf "%s\n" "#define uint64_t $ac_cv_c_uint64_t" >>confdefs.h ;; esac @@ -17105,9 +18028,7 @@ case $ac_cv_c_int32_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int32_t $ac_cv_c_int32_t -_ACEOF +printf "%s\n" "#define int32_t $ac_cv_c_int32_t" >>confdefs.h ;; esac @@ -17116,12 +18037,10 @@ case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT32_T 1" >>confdefs.h +printf "%s\n" "#define _UINT32_T 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define uint32_t $ac_cv_c_uint32_t -_ACEOF +printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h ;; esac @@ -17130,9 +18049,7 @@ case $ac_cv_c_int16_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int16_t $ac_cv_c_int16_t -_ACEOF +printf "%s\n" "#define int16_t $ac_cv_c_int16_t" >>confdefs.h ;; esac @@ -17142,9 +18059,7 @@ case $ac_cv_c_uint16_t in #( *) -cat >>confdefs.h <<_ACEOF -#define uint16_t $ac_cv_c_uint16_t -_ACEOF +printf "%s\n" "#define uint16_t $ac_cv_c_uint16_t" >>confdefs.h ;; esac @@ -17153,166 +18068,225 @@ case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT8_T 1" >>confdefs.h +printf "%s\n" "#define _UINT8_T 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define uint8_t $ac_cv_c_uint8_t -_ACEOF +printf "%s\n" "#define uint8_t $ac_cv_c_uint8_t" >>confdefs.h ;; esac -ac_fn_c_check_decl "$LINENO" "SIZE_MAX" "ac_cv_have_decl_SIZE_MAX" "$ac_includes_default" -if test "x$ac_cv_have_decl_SIZE_MAX" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "SIZE_MAX" "ac_cv_have_decl_SIZE_MAX" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_SIZE_MAX" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SIZE_MAX $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "INT32_MAX" "ac_cv_have_decl_INT32_MAX" "$ac_includes_default" -if test "x$ac_cv_have_decl_INT32_MAX" = xyes; then : +printf "%s\n" "#define HAVE_DECL_SIZE_MAX $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "INT32_MAX" "ac_cv_have_decl_INT32_MAX" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_INT32_MAX" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_INT32_MAX $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "INT32_MIN" "ac_cv_have_decl_INT32_MIN" "$ac_includes_default" -if test "x$ac_cv_have_decl_INT32_MIN" = xyes; then : +printf "%s\n" "#define HAVE_DECL_INT32_MAX $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "INT32_MIN" "ac_cv_have_decl_INT32_MIN" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_INT32_MIN" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_INT32_MIN $ac_have_decl" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_INT32_MIN $ac_have_decl -_ACEOF - -ac_fn_c_check_decl "$LINENO" "INT64_MAX" "ac_cv_have_decl_INT64_MAX" "$ac_includes_default" -if test "x$ac_cv_have_decl_INT64_MAX" = xyes; then : +ac_fn_check_decl "$LINENO" "INT64_MAX" "ac_cv_have_decl_INT64_MAX" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_INT64_MAX" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_INT64_MAX $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "INT64_MIN" "ac_cv_have_decl_INT64_MIN" "$ac_includes_default" -if test "x$ac_cv_have_decl_INT64_MIN" = xyes; then : +printf "%s\n" "#define HAVE_DECL_INT64_MAX $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "INT64_MIN" "ac_cv_have_decl_INT64_MIN" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_INT64_MIN" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_INT64_MIN $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "UINT64_MAX" "ac_cv_have_decl_UINT64_MAX" "$ac_includes_default" -if test "x$ac_cv_have_decl_UINT64_MAX" = xyes; then : +printf "%s\n" "#define HAVE_DECL_INT64_MIN $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "UINT64_MAX" "ac_cv_have_decl_UINT64_MAX" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_UINT64_MAX" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_UINT64_MAX $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "UINT32_MAX" "ac_cv_have_decl_UINT32_MAX" "$ac_includes_default" -if test "x$ac_cv_have_decl_UINT32_MAX" = xyes; then : +printf "%s\n" "#define HAVE_DECL_UINT64_MAX $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "UINT32_MAX" "ac_cv_have_decl_UINT32_MAX" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_UINT32_MAX" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_UINT32_MAX $ac_have_decl" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_UINT32_MAX $ac_have_decl -_ACEOF - -ac_fn_c_check_decl "$LINENO" "INTMAX_MAX" "ac_cv_have_decl_INTMAX_MAX" "$ac_includes_default" -if test "x$ac_cv_have_decl_INTMAX_MAX" = xyes; then : +ac_fn_check_decl "$LINENO" "INTMAX_MAX" "ac_cv_have_decl_INTMAX_MAX" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_INTMAX_MAX" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_INTMAX_MAX $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "INTMAX_MIN" "ac_cv_have_decl_INTMAX_MIN" "$ac_includes_default" -if test "x$ac_cv_have_decl_INTMAX_MIN" = xyes; then : +printf "%s\n" "#define HAVE_DECL_INTMAX_MAX $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "INTMAX_MIN" "ac_cv_have_decl_INTMAX_MIN" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_INTMAX_MIN" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_INTMAX_MIN $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "UINTMAX_MAX" "ac_cv_have_decl_UINTMAX_MAX" "$ac_includes_default" -if test "x$ac_cv_have_decl_UINTMAX_MAX" = xyes; then : +printf "%s\n" "#define HAVE_DECL_INTMAX_MIN $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "UINTMAX_MAX" "ac_cv_have_decl_UINTMAX_MAX" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_UINTMAX_MAX" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_UINTMAX_MAX $ac_have_decl -_ACEOF +printf "%s\n" "#define HAVE_DECL_UINTMAX_MAX $ac_have_decl" >>confdefs.h -ac_fn_c_check_decl "$LINENO" "SSIZE_MAX" "ac_cv_have_decl_SSIZE_MAX" "#include -" -if test "x$ac_cv_have_decl_SSIZE_MAX" = xyes; then : +ac_fn_check_decl "$LINENO" "SSIZE_MAX" "ac_cv_have_decl_SSIZE_MAX" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_SSIZE_MAX" = xyes +then : -$as_echo "#define HAVE_DECL_SSIZE_MAX 1" >>confdefs.h +printf "%s\n" "#define HAVE_DECL_SSIZE_MAX 1" >>confdefs.h fi +ac_fn_check_decl "$LINENO" "EFTYPE" "ac_cv_have_decl_EFTYPE" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_EFTYPE" = xyes +then : -ac_fn_c_check_decl "$LINENO" "EFTYPE" "ac_cv_have_decl_EFTYPE" "#include -" -if test "x$ac_cv_have_decl_EFTYPE" = xyes; then : - -$as_echo "#define HAVE_EFTYPE 1" >>confdefs.h +printf "%s\n" "#define HAVE_EFTYPE 1" >>confdefs.h fi +ac_fn_check_decl "$LINENO" "EILSEQ" "ac_cv_have_decl_EILSEQ" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_EILSEQ" = xyes +then : -ac_fn_c_check_decl "$LINENO" "EILSEQ" "ac_cv_have_decl_EILSEQ" "#include -" -if test "x$ac_cv_have_decl_EILSEQ" = xyes; then : - -$as_echo "#define HAVE_EILSEQ 1" >>confdefs.h +printf "%s\n" "#define HAVE_EILSEQ 1" >>confdefs.h fi - ac_fn_c_check_type "$LINENO" "wchar_t" "ac_cv_type_wchar_t" "$ac_includes_default" -if test "x$ac_cv_type_wchar_t" = xyes; then : +if test "x$ac_cv_type_wchar_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_WCHAR_T 1 -_ACEOF +printf "%s\n" "#define HAVE_WCHAR_T 1" >>confdefs.h # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 -$as_echo_n "checking size of wchar_t... " >&6; } -if ${ac_cv_sizeof_wchar_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default"; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 +printf %s "checking size of wchar_t... " >&6; } +if test ${ac_cv_sizeof_wchar_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default" +then : -else +else $as_nop if test "$ac_cv_type_wchar_t" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) See \`config.log' for more details" "$LINENO" 5; } else @@ -17321,62 +18295,117 @@ See \`config.log' for more details" "$LINENO" 5; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5 -$as_echo "$ac_cv_sizeof_wchar_t" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5 +printf "%s\n" "$ac_cv_sizeof_wchar_t" >&6; } -cat >>confdefs.h <<_ACEOF -#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t -_ACEOF +printf "%s\n" "#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +printf %s "checking size of int... " >&6; } +if test ${ac_cv_sizeof_int+y} +then : + printf %s "(cached) " >&6 +else $as_nop + for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + #include -#include -#include + int -main () +main (void) { -if ((struct tm *) 0) -return 0; +switch (0) case 0: case (sizeof (int) == $ac_size):; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sizeof_int=$ac_size fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test x$ac_cv_sizeof_int != x ; then break; fi +done fi +if test x$ac_cv_sizeof_int = x ; then + as_fn_error $? "cannot determine a size for int" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +printf "%s\n" "$ac_cv_sizeof_int" >&6; } + +printf "%s\n" "#define SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +printf %s "checking size of long... " >&6; } +if test ${ac_cv_sizeof_long+y} +then : + printf %s "(cached) " >&6 +else $as_nop + for ac_size in 4 8 1 2 16 ; do # List sizes in rough order of prevalence. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + + +int +main (void) +{ +switch (0) case 0: case (sizeof (long) == $ac_size):; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sizeof_long=$ac_size +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if test x$ac_cv_sizeof_long != x ; then break; fi +done + +fi + +if test x$ac_cv_sizeof_long = x ; then + as_fn_error $? "cannot determine a size for long" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +printf "%s\n" "$ac_cv_sizeof_long" >&6; } + +printf "%s\n" "#define SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h + + + + + +# Obsolete code to be removed. +if test $ac_cv_header_sys_time_h = yes; then + +printf "%s\n" "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi +# End of obsolete code. + # Checks for library functions. if test $ac_cv_c_compiler_gnu = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 -$as_echo_n "checking whether $CC needs -traditional... " >&6; } -if ${ac_cv_prog_gcc_traditional+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +printf %s "checking whether $CC needs -traditional... " >&6; } +if test ${ac_cv_prog_gcc_traditional+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17384,12 +18413,13 @@ else Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then : + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : ac_cv_prog_gcc_traditional=yes -else +else $as_nop ac_cv_prog_gcc_traditional=no fi -rm -f conftest* +rm -rf conftest* if test $ac_cv_prog_gcc_traditional = no; then @@ -17399,82 +18429,54 @@ rm -f conftest* Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then : + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : ac_cv_prog_gcc_traditional=yes fi -rm -f conftest* +rm -rf conftest* fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 -$as_echo "$ac_cv_prog_gcc_traditional" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +printf "%s\n" "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 -$as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if ${ac_cv_header_sys_types_h_makedev+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -return makedev(0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_header_sys_types_h_makedev=yes -else - ac_cv_header_sys_types_h_makedev=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5 -$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } +ac_fn_c_check_header_compile "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mkdev_h" = xyes +then : -if test $ac_cv_header_sys_types_h_makedev = no; then -ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : - -$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h +printf "%s\n" "#define MAJOR_IN_MKDEV 1" >>confdefs.h fi +if test $ac_cv_header_sys_mkdev_h = no; then + ac_fn_c_check_header_compile "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sysmacros_h" = xyes +then : - - if test $ac_cv_header_sys_mkdev_h = no; then - ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : - -$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h +printf "%s\n" "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h fi - - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 -$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } -if ${ac_cv_sys_largefile_source+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +printf %s "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* for off_t */ #include int -main () +main (void) { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); @@ -17482,10 +18484,11 @@ int (*fp) (FILE *, off_t, int) = fseeko; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_sys_largefile_source=no; break fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17493,7 +18496,7 @@ rm -f core conftest.err conftest.$ac_objext \ #include /* for off_t */ #include int -main () +main (void) { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); @@ -17501,23 +18504,22 @@ int (*fp) (FILE *, off_t, int) = fseeko; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_sys_largefile_source=1; break fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 -$as_echo "$ac_cv_sys_largefile_source" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 +printf "%s\n" "$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) -cat >>confdefs.h <<_ACEOF -#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source -_ACEOF +printf "%s\n" "#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source" >>confdefs.h ;; esac rm -rf conftest* @@ -17527,23 +18529,25 @@ rm -rf conftest* # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then -$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h +printf "%s\n" "#define HAVE_FSEEKO 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 -$as_echo_n "checking for working memcmp... " >&6; } -if ${ac_cv_func_memcmp_working+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 +printf %s "checking for working memcmp... " >&6; } +if test ${ac_cv_func_memcmp_working+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_memcmp_working=no -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { /* Some versions of memcmp are not 8-bit clean. */ @@ -17574,9 +18578,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_memcmp_working=yes -else +else $as_nop ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -17584,8 +18589,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 -$as_echo "$ac_cv_func_memcmp_working" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 +printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" @@ -17593,22 +18598,29 @@ test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 -$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } -if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 +printf %s "checking whether lstat correctly handles trailing slash... " >&6; } +if test ${ac_cv_func_lstat_dereferences_slashed_symlink+y} +then : + printf %s "(cached) " >&6 +else $as_nop rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then : - ac_cv_func_lstat_dereferences_slashed_symlink=no -else + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on glibc systems. + *-gnu*) ac_cv_func_lstat_dereferences_slashed_symlink=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_lstat_dereferences_slashed_symlink=no ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. @@ -17619,9 +18631,10 @@ struct stat sbuf; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_lstat_dereferences_slashed_symlink=yes -else +else $as_nop ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -17636,14 +18649,12 @@ fi rm -f conftest.sym conftest.file fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 -$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 +printf "%s\n" "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && -cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 -_ACEOF +printf "%s\n" "#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1" >>confdefs.h if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then @@ -17655,19 +18666,21 @@ esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat accepts an empty string" >&5 -$as_echo_n "checking whether lstat accepts an empty string... " >&6; } -if ${ac_cv_func_lstat_empty_string_bug+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether lstat accepts an empty string" >&5 +printf %s "checking whether lstat accepts an empty string... " >&6; } +if test ${ac_cv_func_lstat_empty_string_bug+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_lstat_empty_string_bug=yes -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { struct stat sbuf; return lstat ("", &sbuf) == 0; @@ -17675,9 +18688,10 @@ struct stat sbuf; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_lstat_empty_string_bug=no -else +else $as_nop ac_cv_func_lstat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -17685,8 +18699,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_empty_string_bug" >&5 -$as_echo "$ac_cv_func_lstat_empty_string_bug" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_empty_string_bug" >&5 +printf "%s\n" "$ac_cv_func_lstat_empty_string_bug" >&6; } if test $ac_cv_func_lstat_empty_string_bug = yes; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; @@ -17695,25 +18709,25 @@ if test $ac_cv_func_lstat_empty_string_bug = yes; then esac -cat >>confdefs.h <<_ACEOF -#define HAVE_LSTAT_EMPTY_STRING_BUG 1 -_ACEOF +printf "%s\n" "#define HAVE_LSTAT_EMPTY_STRING_BUG 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 -$as_echo_n "checking whether stat accepts an empty string... " >&6; } -if ${ac_cv_func_stat_empty_string_bug+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 +printf %s "checking whether stat accepts an empty string... " >&6; } +if test ${ac_cv_func_stat_empty_string_bug+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_stat_empty_string_bug=yes -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { struct stat sbuf; return stat ("", &sbuf) == 0; @@ -17721,9 +18735,10 @@ struct stat sbuf; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_stat_empty_string_bug=no -else +else $as_nop ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -17731,8 +18746,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 -$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 +printf "%s\n" "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; @@ -17741,47 +18756,43 @@ if test $ac_cv_func_stat_empty_string_bug = yes; then esac -cat >>confdefs.h <<_ACEOF -#define HAVE_STAT_EMPTY_STRING_BUG 1 -_ACEOF +printf "%s\n" "#define HAVE_STAT_EMPTY_STRING_BUG 1" >>confdefs.h fi -ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" -if test "x$ac_cv_have_decl_strerror_r" = xyes; then : +ac_fn_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strerror_r" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_STRERROR_R $ac_have_decl" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRERROR_R $ac_have_decl -_ACEOF -for ac_func in strerror_r -do : - ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" -if test "x$ac_cv_func_strerror_r" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRERROR_R 1 -_ACEOF +if test $ac_cv_have_decl_strerror_r = yes; then + # For backward compatibility's sake, define HAVE_STRERROR_R. + # (We used to run AC_CHECK_FUNCS_ONCE for strerror_r, as well + # as AC_CHECK_DECLS_ONCE.) + +printf "%s\n" "#define HAVE_STRERROR_R 1" >>confdefs.h fi -done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 -$as_echo_n "checking whether strerror_r returns char *... " >&6; } -if ${ac_cv_func_strerror_r_char_p+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 +printf %s "checking whether strerror_r returns char *... " >&6; } +if test ${ac_cv_func_strerror_r_char_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default +#include int -main () +main (void) { char buf[100]; @@ -17793,67 +18804,39 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_func_strerror_r_char_p=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - else - # strerror_r is not declared. Choose between - # systems that have relatively inaccessible declarations for the - # function. BeOS and DEC UNIX 4.0 fall in this category, but the - # former has a strerror_r that returns char*, while the latter - # has a strerror_r that returns `int'. - # This test should segfault on the DEC system. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - extern char *strerror_r (); -int -main () -{ -char buf[100]; - char x = *strerror_r (0, buf, sizeof buf); - return ! isalpha (x); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_strerror_r_char_p=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 -$as_echo "$ac_cv_func_strerror_r_char_p" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 +printf "%s\n" "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then -$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h +printf "%s\n" "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi -for ac_func in strftime + + for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" -if test "x$ac_cv_func_strftime" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRFTIME 1 -_ACEOF +if test "x$ac_cv_func_strftime" = xyes +then : + printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h -else +else $as_nop # strftime is in -lintl on SCO UNIX. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 -$as_echo_n "checking for strftime in -lintl... " >&6; } -if ${ac_cv_lib_intl_strftime+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 +printf %s "checking for strftime in -lintl... " >&6; } +if test ${ac_cv_lib_intl_strftime+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17862,66 +18845,72 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char strftime (); int -main () +main (void) { return strftime (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_intl_strftime=yes -else +else $as_nop ac_cv_lib_intl_strftime=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 -$as_echo "$ac_cv_lib_intl_strftime" >&6; } -if test "x$ac_cv_lib_intl_strftime" = xyes; then : - $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 +printf "%s\n" "$ac_cv_lib_intl_strftime" >&6; } +if test "x$ac_cv_lib_intl_strftime" = xyes +then : + printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi + +done +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi done -for ac_func in vprintf -do : - ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" -if test "x$ac_cv_func_vprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VPRINTF 1 -_ACEOF +if test "x$ac_cv_func_vprintf" = xno +then : + ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = xyes +then : -ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" -if test "x$ac_cv_func__doprnt" = xyes; then : - -$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h +printf "%s\n" "#define HAVE_DOPRNT 1" >>confdefs.h fi fi -done - - # check for: # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) # To avoid necessity for including windows.h or special forward declaration # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CreateHardLinkA" >&5 -$as_echo_n "checking for CreateHardLinkA... " >&6; } -if ${ac_cv_func_CreateHardLinkA+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CreateHardLinkA" >&5 +printf %s "checking for CreateHardLinkA... " >&6; } +if test ${ac_cv_func_CreateHardLinkA+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, @@ -17937,7 +18926,7 @@ char __stdcall CreateHardLinkA ( const char *, const char *, void * ); char (*f) ( const char *, const char *, void * ); int -main () +main (void) { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named @@ -17952,233 +18941,561 @@ f = CreateHardLinkA; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_func_CreateHardLinkA=yes -else +else $as_nop ac_cv_func_CreateHardLinkA=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_CreateHardLinkA" >&5 -$as_echo "$ac_cv_func_CreateHardLinkA" >&6; } -if test $ac_cv_func_CreateHardLinkA = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_CreateHardLinkA" >&5 +printf "%s\n" "$ac_cv_func_CreateHardLinkA" >&6; } +if test $ac_cv_func_CreateHardLinkA = yes +then : fi -for ac_func in arc4random_buf chflags chown chroot ctime_r -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "arc4random_buf" "ac_cv_func_arc4random_buf" +if test "x$ac_cv_func_arc4random_buf" = xyes +then : + printf "%s\n" "#define HAVE_ARC4RANDOM_BUF 1" >>confdefs.h fi -done - -for ac_func in fchdir fchflags fchmod fchown fcntl fdopendir fork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "chflags" "ac_cv_func_chflags" +if test "x$ac_cv_func_chflags" = xyes +then : + printf "%s\n" "#define HAVE_CHFLAGS 1" >>confdefs.h fi -done - -for ac_func in fstat fstatat fstatfs fstatvfs ftruncate -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "chown" "ac_cv_func_chown" +if test "x$ac_cv_func_chown" = xyes +then : + printf "%s\n" "#define HAVE_CHOWN 1" >>confdefs.h fi -done - -for ac_func in futimens futimes futimesat -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "chroot" "ac_cv_func_chroot" +if test "x$ac_cv_func_chroot" = xyes +then : + printf "%s\n" "#define HAVE_CHROOT 1" >>confdefs.h fi -done - -for ac_func in geteuid getpid getgrgid_r getgrnam_r -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "ctime_r" "ac_cv_func_ctime_r" +if test "x$ac_cv_func_ctime_r" = xyes +then : + printf "%s\n" "#define HAVE_CTIME_R 1" >>confdefs.h fi -done -for ac_func in getpwnam_r getpwuid_r getvfsbyname gmtime_r -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fchdir" "ac_cv_func_fchdir" +if test "x$ac_cv_func_fchdir" = xyes +then : + printf "%s\n" "#define HAVE_FCHDIR 1" >>confdefs.h fi -done - -for ac_func in lchflags lchmod lchown link linkat localtime_r lstat lutimes -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fchflags" "ac_cv_func_fchflags" +if test "x$ac_cv_func_fchflags" = xyes +then : + printf "%s\n" "#define HAVE_FCHFLAGS 1" >>confdefs.h fi -done - -for ac_func in mbrtowc memmove memset -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fchmod" "ac_cv_func_fchmod" +if test "x$ac_cv_func_fchmod" = xyes +then : + printf "%s\n" "#define HAVE_FCHMOD 1" >>confdefs.h fi -done - -for ac_func in mkdir mkfifo mknod mkstemp -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fchown" "ac_cv_func_fchown" +if test "x$ac_cv_func_fchown" = xyes +then : + printf "%s\n" "#define HAVE_FCHOWN 1" >>confdefs.h fi -done - -for ac_func in nl_langinfo openat pipe poll posix_spawnp readlink readlinkat -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fcntl" "ac_cv_func_fcntl" +if test "x$ac_cv_func_fcntl" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL 1" >>confdefs.h fi -done - -for ac_func in readpassphrase -do : - ac_fn_c_check_func "$LINENO" "readpassphrase" "ac_cv_func_readpassphrase" -if test "x$ac_cv_func_readpassphrase" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_READPASSPHRASE 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fdopendir" "ac_cv_func_fdopendir" +if test "x$ac_cv_func_fdopendir" = xyes +then : + printf "%s\n" "#define HAVE_FDOPENDIR 1" >>confdefs.h fi -done - -for ac_func in select setenv setlocale sigaction statfs statvfs -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fork" "ac_cv_func_fork" +if test "x$ac_cv_func_fork" = xyes +then : + printf "%s\n" "#define HAVE_FORK 1" >>confdefs.h fi -done -for ac_func in strchr strdup strerror strncpy_s strnlen strrchr symlink -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fstat" "ac_cv_func_fstat" +if test "x$ac_cv_func_fstat" = xyes +then : + printf "%s\n" "#define HAVE_FSTAT 1" >>confdefs.h fi -done - -for ac_func in timegm tzset unlinkat unsetenv utime utimensat utimes vfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fstatat" "ac_cv_func_fstatat" +if test "x$ac_cv_func_fstatat" = xyes +then : + printf "%s\n" "#define HAVE_FSTATAT 1" >>confdefs.h fi -done - -for ac_func in wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fstatfs" "ac_cv_func_fstatfs" +if test "x$ac_cv_func_fstatfs" = xyes +then : + printf "%s\n" "#define HAVE_FSTATFS 1" >>confdefs.h fi -done - -for ac_func in _ctime64_s _fseeki64 -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "fstatvfs" "ac_cv_func_fstatvfs" +if test "x$ac_cv_func_fstatvfs" = xyes +then : + printf "%s\n" "#define HAVE_FSTATVFS 1" >>confdefs.h fi -done - -for ac_func in _get_timezone _gmtime64_s _localtime64_s _mkgmtime64 -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "ftruncate" "ac_cv_func_ftruncate" +if test "x$ac_cv_func_ftruncate" = xyes +then : + printf "%s\n" "#define HAVE_FTRUNCATE 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "futimens" "ac_cv_func_futimens" +if test "x$ac_cv_func_futimens" = xyes +then : + printf "%s\n" "#define HAVE_FUTIMENS 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "futimes" "ac_cv_func_futimes" +if test "x$ac_cv_func_futimes" = xyes +then : + printf "%s\n" "#define HAVE_FUTIMES 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "futimesat" "ac_cv_func_futimesat" +if test "x$ac_cv_func_futimesat" = xyes +then : + printf "%s\n" "#define HAVE_FUTIMESAT 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "geteuid" "ac_cv_func_geteuid" +if test "x$ac_cv_func_geteuid" = xyes +then : + printf "%s\n" "#define HAVE_GETEUID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getpid" "ac_cv_func_getpid" +if test "x$ac_cv_func_getpid" = xyes +then : + printf "%s\n" "#define HAVE_GETPID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getgrgid_r" "ac_cv_func_getgrgid_r" +if test "x$ac_cv_func_getgrgid_r" = xyes +then : + printf "%s\n" "#define HAVE_GETGRGID_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getgrnam_r" "ac_cv_func_getgrnam_r" +if test "x$ac_cv_func_getgrnam_r" = xyes +then : + printf "%s\n" "#define HAVE_GETGRNAM_R 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "getpwnam_r" "ac_cv_func_getpwnam_r" +if test "x$ac_cv_func_getpwnam_r" = xyes +then : + printf "%s\n" "#define HAVE_GETPWNAM_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getpwuid_r" "ac_cv_func_getpwuid_r" +if test "x$ac_cv_func_getpwuid_r" = xyes +then : + printf "%s\n" "#define HAVE_GETPWUID_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getvfsbyname" "ac_cv_func_getvfsbyname" +if test "x$ac_cv_func_getvfsbyname" = xyes +then : + printf "%s\n" "#define HAVE_GETVFSBYNAME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gmtime_r" "ac_cv_func_gmtime_r" +if test "x$ac_cv_func_gmtime_r" = xyes +then : + printf "%s\n" "#define HAVE_GMTIME_R 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "lchflags" "ac_cv_func_lchflags" +if test "x$ac_cv_func_lchflags" = xyes +then : + printf "%s\n" "#define HAVE_LCHFLAGS 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "lchmod" "ac_cv_func_lchmod" +if test "x$ac_cv_func_lchmod" = xyes +then : + printf "%s\n" "#define HAVE_LCHMOD 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "lchown" "ac_cv_func_lchown" +if test "x$ac_cv_func_lchown" = xyes +then : + printf "%s\n" "#define HAVE_LCHOWN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "link" "ac_cv_func_link" +if test "x$ac_cv_func_link" = xyes +then : + printf "%s\n" "#define HAVE_LINK 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "linkat" "ac_cv_func_linkat" +if test "x$ac_cv_func_linkat" = xyes +then : + printf "%s\n" "#define HAVE_LINKAT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r" +if test "x$ac_cv_func_localtime_r" = xyes +then : + printf "%s\n" "#define HAVE_LOCALTIME_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "lstat" "ac_cv_func_lstat" +if test "x$ac_cv_func_lstat" = xyes +then : + printf "%s\n" "#define HAVE_LSTAT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "lutimes" "ac_cv_func_lutimes" +if test "x$ac_cv_func_lutimes" = xyes +then : + printf "%s\n" "#define HAVE_LUTIMES 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "mbrtowc" "ac_cv_func_mbrtowc" +if test "x$ac_cv_func_mbrtowc" = xyes +then : + printf "%s\n" "#define HAVE_MBRTOWC 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" +if test "x$ac_cv_func_memmove" = xyes +then : + printf "%s\n" "#define HAVE_MEMMOVE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "mkdir" "ac_cv_func_mkdir" +if test "x$ac_cv_func_mkdir" = xyes +then : + printf "%s\n" "#define HAVE_MKDIR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mkfifo" "ac_cv_func_mkfifo" +if test "x$ac_cv_func_mkfifo" = xyes +then : + printf "%s\n" "#define HAVE_MKFIFO 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mknod" "ac_cv_func_mknod" +if test "x$ac_cv_func_mknod" = xyes +then : + printf "%s\n" "#define HAVE_MKNOD 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mkstemp" "ac_cv_func_mkstemp" +if test "x$ac_cv_func_mkstemp" = xyes +then : + printf "%s\n" "#define HAVE_MKSTEMP 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "openat" "ac_cv_func_openat" +if test "x$ac_cv_func_openat" = xyes +then : + printf "%s\n" "#define HAVE_OPENAT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "pipe" "ac_cv_func_pipe" +if test "x$ac_cv_func_pipe" = xyes +then : + printf "%s\n" "#define HAVE_PIPE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" +if test "x$ac_cv_func_poll" = xyes +then : + printf "%s\n" "#define HAVE_POLL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "posix_spawnp" "ac_cv_func_posix_spawnp" +if test "x$ac_cv_func_posix_spawnp" = xyes +then : + printf "%s\n" "#define HAVE_POSIX_SPAWNP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "readlink" "ac_cv_func_readlink" +if test "x$ac_cv_func_readlink" = xyes +then : + printf "%s\n" "#define HAVE_READLINK 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "readlinkat" "ac_cv_func_readlinkat" +if test "x$ac_cv_func_readlinkat" = xyes +then : + printf "%s\n" "#define HAVE_READLINKAT 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "readpassphrase" "ac_cv_func_readpassphrase" +if test "x$ac_cv_func_readpassphrase" = xyes +then : + printf "%s\n" "#define HAVE_READPASSPHRASE 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" +if test "x$ac_cv_func_select" = xyes +then : + printf "%s\n" "#define HAVE_SELECT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv" +if test "x$ac_cv_func_setenv" = xyes +then : + printf "%s\n" "#define HAVE_SETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" +if test "x$ac_cv_func_setlocale" = xyes +then : + printf "%s\n" "#define HAVE_SETLOCALE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction" +if test "x$ac_cv_func_sigaction" = xyes +then : + printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "statfs" "ac_cv_func_statfs" +if test "x$ac_cv_func_statfs" = xyes +then : + printf "%s\n" "#define HAVE_STATFS 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "statvfs" "ac_cv_func_statvfs" +if test "x$ac_cv_func_statvfs" = xyes +then : + printf "%s\n" "#define HAVE_STATVFS 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" +if test "x$ac_cv_func_strdup" = xyes +then : + printf "%s\n" "#define HAVE_STRDUP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes +then : + printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strncpy_s" "ac_cv_func_strncpy_s" +if test "x$ac_cv_func_strncpy_s" = xyes +then : + printf "%s\n" "#define HAVE_STRNCPY_S 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strnlen" "ac_cv_func_strnlen" +if test "x$ac_cv_func_strnlen" = xyes +then : + printf "%s\n" "#define HAVE_STRNLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" +if test "x$ac_cv_func_strrchr" = xyes +then : + printf "%s\n" "#define HAVE_STRRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "symlink" "ac_cv_func_symlink" +if test "x$ac_cv_func_symlink" = xyes +then : + printf "%s\n" "#define HAVE_SYMLINK 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" +if test "x$ac_cv_func_timegm" = xyes +then : + printf "%s\n" "#define HAVE_TIMEGM 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "tzset" "ac_cv_func_tzset" +if test "x$ac_cv_func_tzset" = xyes +then : + printf "%s\n" "#define HAVE_TZSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "unlinkat" "ac_cv_func_unlinkat" +if test "x$ac_cv_func_unlinkat" = xyes +then : + printf "%s\n" "#define HAVE_UNLINKAT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv" +if test "x$ac_cv_func_unsetenv" = xyes +then : + printf "%s\n" "#define HAVE_UNSETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "utime" "ac_cv_func_utime" +if test "x$ac_cv_func_utime" = xyes +then : + printf "%s\n" "#define HAVE_UTIME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "utimensat" "ac_cv_func_utimensat" +if test "x$ac_cv_func_utimensat" = xyes +then : + printf "%s\n" "#define HAVE_UTIMENSAT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "utimes" "ac_cv_func_utimes" +if test "x$ac_cv_func_utimes" = xyes +then : + printf "%s\n" "#define HAVE_UTIMES 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "vfork" "ac_cv_func_vfork" +if test "x$ac_cv_func_vfork" = xyes +then : + printf "%s\n" "#define HAVE_VFORK 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "wcrtomb" "ac_cv_func_wcrtomb" +if test "x$ac_cv_func_wcrtomb" = xyes +then : + printf "%s\n" "#define HAVE_WCRTOMB 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcscmp" "ac_cv_func_wcscmp" +if test "x$ac_cv_func_wcscmp" = xyes +then : + printf "%s\n" "#define HAVE_WCSCMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcscpy" "ac_cv_func_wcscpy" +if test "x$ac_cv_func_wcscpy" = xyes +then : + printf "%s\n" "#define HAVE_WCSCPY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcslen" "ac_cv_func_wcslen" +if test "x$ac_cv_func_wcslen" = xyes +then : + printf "%s\n" "#define HAVE_WCSLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wctomb" "ac_cv_func_wctomb" +if test "x$ac_cv_func_wctomb" = xyes +then : + printf "%s\n" "#define HAVE_WCTOMB 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wmemcmp" "ac_cv_func_wmemcmp" +if test "x$ac_cv_func_wmemcmp" = xyes +then : + printf "%s\n" "#define HAVE_WMEMCMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wmemcpy" "ac_cv_func_wmemcpy" +if test "x$ac_cv_func_wmemcpy" = xyes +then : + printf "%s\n" "#define HAVE_WMEMCPY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wmemmove" "ac_cv_func_wmemmove" +if test "x$ac_cv_func_wmemmove" = xyes +then : + printf "%s\n" "#define HAVE_WMEMMOVE 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "_ctime64_s" "ac_cv_func__ctime64_s" +if test "x$ac_cv_func__ctime64_s" = xyes +then : + printf "%s\n" "#define HAVE__CTIME64_S 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_fseeki64" "ac_cv_func__fseeki64" +if test "x$ac_cv_func__fseeki64" = xyes +then : + printf "%s\n" "#define HAVE__FSEEKI64 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "_get_timezone" "ac_cv_func__get_timezone" +if test "x$ac_cv_func__get_timezone" = xyes +then : + printf "%s\n" "#define HAVE__GET_TIMEZONE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_gmtime64_s" "ac_cv_func__gmtime64_s" +if test "x$ac_cv_func__gmtime64_s" = xyes +then : + printf "%s\n" "#define HAVE__GMTIME64_S 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_localtime64_s" "ac_cv_func__localtime64_s" +if test "x$ac_cv_func__localtime64_s" = xyes +then : + printf "%s\n" "#define HAVE__LOCALTIME64_S 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "_mkgmtime64" "ac_cv_func__mkgmtime64" +if test "x$ac_cv_func__mkgmtime64" = xyes +then : + printf "%s\n" "#define HAVE__MKGMTIME64 1" >>confdefs.h fi -done # detects cygwin-1.7, as opposed to older versions -for ac_func in cygwin_conv_path -do : - ac_fn_c_check_func "$LINENO" "cygwin_conv_path" "ac_cv_func_cygwin_conv_path" -if test "x$ac_cv_func_cygwin_conv_path" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_CYGWIN_CONV_PATH 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "cygwin_conv_path" "ac_cv_func_cygwin_conv_path" +if test "x$ac_cv_func_cygwin_conv_path" = xyes +then : + printf "%s\n" "#define HAVE_CYGWIN_CONV_PATH 1" >>confdefs.h fi -done # DragonFly uses vfsconf, FreeBSD xvfsconf. @@ -18188,11 +19505,10 @@ ac_fn_c_check_type "$LINENO" "struct vfsconf" "ac_cv_type_struct_vfsconf" "#if H #include " -if test "x$ac_cv_type_struct_vfsconf" = xyes; then : +if test "x$ac_cv_type_struct_vfsconf" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_VFSCONF 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_VFSCONF 1" >>confdefs.h fi @@ -18204,11 +19520,10 @@ ac_fn_c_check_type "$LINENO" "struct xvfsconf" "ac_cv_type_struct_xvfsconf" "#if #include " -if test "x$ac_cv_type_struct_xvfsconf" = xyes; then : +if test "x$ac_cv_type_struct_xvfsconf" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_XVFSCONF 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_XVFSCONF 1" >>confdefs.h fi @@ -18220,11 +19535,10 @@ ac_fn_c_check_type "$LINENO" "struct statfs" "ac_cv_type_struct_statfs" "#if HAV #include " -if test "x$ac_cv_type_struct_statfs" = xyes; then : +if test "x$ac_cv_type_struct_statfs" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STATFS 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_STATFS 1" >>confdefs.h fi @@ -18236,7 +19550,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { DIR *dir; struct dirent e, *r; return(readdir_r(dir, &e, &r)); @@ -18244,49 +19558,53 @@ DIR *dir; struct dirent e, *r; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : -$as_echo "#define HAVE_READDIR_R 1" >>confdefs.h +printf "%s\n" "#define HAVE_READDIR_R 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext # dirfd can be either a function or a macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include DIR *dir; int -main () +main (void) { return(dirfd(dir)); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : -$as_echo "#define HAVE_DIRFD 1" >>confdefs.h +printf "%s\n" "#define HAVE_DIRFD 1" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext # FreeBSD's nl_langinfo supports an option to specify whether the # current locale uses month/day or day/month ordering. It makes the # output a little prettier... -ac_fn_c_check_decl "$LINENO" "D_MD_ORDER" "ac_cv_have_decl_D_MD_ORDER" "#if HAVE_LANGINFO_H +ac_fn_check_decl "$LINENO" "D_MD_ORDER" "ac_cv_have_decl_D_MD_ORDER" "#if HAVE_LANGINFO_H #include #endif -" -if test "x$ac_cv_have_decl_D_MD_ORDER" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_D_MD_ORDER" = xyes +then : -$as_echo "#define HAVE_D_MD_ORDER 1" >>confdefs.h +printf "%s\n" "#define HAVE_D_MD_ORDER 1" >>confdefs.h fi - # Check for dirent.d_namlen field explicitly # (This is a bit more straightforward than, if not quite as portable as, # the recipe given by the autoconf maintainers.) @@ -18295,24 +19613,27 @@ ac_fn_c_check_member "$LINENO" "struct dirent" "d_namlen" "ac_cv_member_struct_d #endif " -if test "x$ac_cv_member_struct_dirent_d_namlen" = xyes; then : +if test "x$ac_cv_member_struct_dirent_d_namlen" = xyes +then : fi # Check for Extended Attributes support # Check whether --enable-xattr was given. -if test "${enable_xattr+set}" = set; then : +if test ${enable_xattr+y} +then : enableval=$enable_xattr; fi if test "x$enable_xattr" != "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setxattr" >&5 -$as_echo_n "checking for library containing setxattr... " >&6; } -if ${ac_cv_search_setxattr+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing setxattr" >&5 +printf %s "checking for library containing setxattr... " >&6; } +if test ${ac_cv_search_setxattr+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -18320,102 +19641,98 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char setxattr (); int -main () +main (void) { return setxattr (); ; return 0; } _ACEOF -for ac_lib in '' attr gnu; do +for ac_lib in '' attr gnu +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_setxattr=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_setxattr+:} false; then : + if test ${ac_cv_search_setxattr+y} +then : break fi done -if ${ac_cv_search_setxattr+:} false; then : +if test ${ac_cv_search_setxattr+y} +then : -else +else $as_nop ac_cv_search_setxattr=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setxattr" >&5 -$as_echo "$ac_cv_search_setxattr" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setxattr" >&5 +printf "%s\n" "$ac_cv_search_setxattr" >&6; } ac_res=$ac_cv_search_setxattr -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi - ac_fn_c_check_decl "$LINENO" "EXTATTR_NAMESPACE_USER" "ac_cv_have_decl_EXTATTR_NAMESPACE_USER" "#include + ac_fn_check_decl "$LINENO" "EXTATTR_NAMESPACE_USER" "ac_cv_have_decl_EXTATTR_NAMESPACE_USER" "#include #include -" -if test "x$ac_cv_have_decl_EXTATTR_NAMESPACE_USER" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_EXTATTR_NAMESPACE_USER" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi +printf "%s\n" "#define HAVE_DECL_EXTATTR_NAMESPACE_USER $ac_have_decl" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_EXTATTR_NAMESPACE_USER $ac_have_decl -_ACEOF + ac_fn_check_decl "$LINENO" "XATTR_NOFOLLOW" "ac_cv_have_decl_XATTR_NOFOLLOW" "#include - ac_fn_c_check_decl "$LINENO" "XATTR_NOFOLLOW" "ac_cv_have_decl_XATTR_NOFOLLOW" "#include - -" -if test "x$ac_cv_have_decl_XATTR_NOFOLLOW" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_XATTR_NOFOLLOW" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_XATTR_NOFOLLOW $ac_have_decl -_ACEOF +printf "%s\n" "#define HAVE_DECL_XATTR_NOFOLLOW $ac_have_decl" >>confdefs.h if test "x$ac_cv_header_sys_xattr_h" = "xyes" \ -a "x$ac_cv_have_decl_XATTR_NOFOLLOW" = "xyes"; then # Darwin extended attributes support - if ${ac_cv_archive_xattr_darwin+:} false; then : - $as_echo_n "(cached) " >&6 -else - for ac_func in fgetxattr \ - flistxattr \ - fsetxattr \ - getxattr \ - listxattr \ - setxattr + if test ${ac_cv_archive_xattr_darwin+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + for ac_func in fgetxattr flistxattr fsetxattr getxattr listxattr setxattr do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ac_cv_archive_xattr_darwin=yes -else +else $as_nop ac_cv_archive_xattr_darwin=no fi -done +done fi @@ -18423,30 +19740,26 @@ fi elif test "x$ac_cv_header_sys_extattr_h" = "xyes" \ -a "x$ac_cv_have_decl_EXTATTR_NAMESPACE_USER" = "xyes"; then # FreeBSD extended attributes support - if ${ac_cv_archive_xattr_freebsd+:} false; then : - $as_echo_n "(cached) " >&6 -else - for ac_func in extattr_get_fd \ - extattr_get_file \ - extattr_get_link \ - extattr_list_fd \ - extattr_list_file \ - extattr_list_link \ - extattr_set_fd \ - extattr_set_link + if test ${ac_cv_archive_xattr_freebsd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + for ac_func in extattr_get_fd extattr_get_file extattr_get_link extattr_list_fd extattr_list_file extattr_list_link extattr_set_fd extattr_set_link do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ac_cv_archive_xattr_freebsd=yes -else +else $as_nop ac_cv_archive_xattr_freebsd=no fi -done +done fi @@ -18454,95 +19767,87 @@ fi elif test "x$ac_cv_header_sys_xattr_h" = "xyes" \ -o "x$ac_cv_header_attr_xattr_h" = "xyes"; then # Linux extended attributes support - if ${ac_cv_archive_xattr_linux+:} false; then : - $as_echo_n "(cached) " >&6 -else - for ac_func in fgetxattr \ - flistxattr \ - fsetxattr \ - getxattr \ - lgetxattr \ - listxattr \ - llistxattr \ - lsetxattr + if test ${ac_cv_archive_xattr_linux+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + for ac_func in fgetxattr flistxattr fsetxattr getxattr lgetxattr listxattr llistxattr lsetxattr do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ac_cv_archive_xattr_linux=yes -else +else $as_nop ac_cv_archive_xattr_linux=no fi -done +done fi elif test "x$ac_cv_header_sys_ea_h" = "xyes"; then # AIX extended attributes support - if ${ac_cv_archive_xattr_aix+:} false; then : - $as_echo_n "(cached) " >&6 -else - for ac_func in fgetea \ - flistea \ - fsetea \ - getea \ - lgetea \ - listea \ - llistea \ - lsetea + if test ${ac_cv_archive_xattr_aix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + for ac_func in fgetea flistea fsetea getea lgetea listea llistea lsetea do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ac_cv_archive_xattr_aix=yes -else +else $as_nop ac_cv_archive_xattr_aix=no fi -done +done fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extended attributes support" >&5 -$as_echo_n "checking for extended attributes support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for extended attributes support" >&5 +printf %s "checking for extended attributes support... " >&6; } if test "x$ac_cv_archive_xattr_linux" = "xyes"; then -$as_echo "#define ARCHIVE_XATTR_LINUX 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_XATTR_LINUX 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Linux" >&5 -$as_echo "Linux" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Linux" >&5 +printf "%s\n" "Linux" >&6; } elif test "x$ac_cv_archive_xattr_darwin" = "xyes"; then -$as_echo "#define ARCHIVE_XATTR_DARWIN 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_XATTR_DARWIN 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Darwin" >&5 -$as_echo "Darwin" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Darwin" >&5 +printf "%s\n" "Darwin" >&6; } elif test "x$ac_cv_archive_xattr_freebsd" = "xyes"; then -$as_echo "#define ARCHIVE_XATTR_FREEBSD 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_XATTR_FREEBSD 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: FreeBSD" >&5 -$as_echo "FreeBSD" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: FreeBSD" >&5 +printf "%s\n" "FreeBSD" >&6; } elif test "x$ac_cv_archive_xattr_aix" = "xyes"; then -$as_echo "#define ARCHIVE_XATTR_AIX 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_XATTR_AIX 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: AIX" >&5 -$as_echo "AIX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: AIX" >&5 +printf "%s\n" "AIX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } fi fi @@ -18554,18 +19859,20 @@ fi # which makes the following checks rather more complex than I would like. # # Check whether --enable-acl was given. -if test "${enable_acl+set}" = set; then : +if test ${enable_acl+y} +then : enableval=$enable_acl; fi if test "x$enable_acl" != "xno"; then # Libacl - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get_file in -lacl" >&5 -$as_echo_n "checking for acl_get_file in -lacl... " >&6; } -if ${ac_cv_lib_acl_acl_get_file+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for acl_get_file in -lacl" >&5 +printf %s "checking for acl_get_file in -lacl... " >&6; } +if test ${ac_cv_lib_acl_acl_get_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lacl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18574,33 +19881,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char acl_get_file (); int -main () +main (void) { return acl_get_file (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_acl_acl_get_file=yes -else +else $as_nop ac_cv_lib_acl_acl_get_file=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_acl_acl_get_file" >&5 -$as_echo "$ac_cv_lib_acl_acl_get_file" >&6; } -if test "x$ac_cv_lib_acl_acl_get_file" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBACL 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_acl_acl_get_file" >&5 +printf "%s\n" "$ac_cv_lib_acl_acl_get_file" >&6; } +if test "x$ac_cv_lib_acl_acl_get_file" = xyes +then : + printf "%s\n" "#define HAVE_LIBACL 1" >>confdefs.h LIBS="-lacl $LIBS" @@ -18616,11 +19920,10 @@ fi #endif " -if test "x$ac_cv_type_acl_t" = xyes; then : +if test "x$ac_cv_type_acl_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_ACL_T 1 -_ACEOF +printf "%s\n" "#define HAVE_ACL_T 1" >>confdefs.h fi @@ -18633,11 +19936,10 @@ ac_fn_c_check_type "$LINENO" "acl_entry_t" "ac_cv_type_acl_entry_t" " #endif " -if test "x$ac_cv_type_acl_entry_t" = xyes; then : +if test "x$ac_cv_type_acl_entry_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_ACL_ENTRY_T 1 -_ACEOF +printf "%s\n" "#define HAVE_ACL_ENTRY_T 1" >>confdefs.h fi @@ -18650,11 +19952,10 @@ ac_fn_c_check_type "$LINENO" "acl_permset_t" "ac_cv_type_acl_permset_t" " #endif " -if test "x$ac_cv_type_acl_permset_t" = xyes; then : +if test "x$ac_cv_type_acl_permset_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_ACL_PERMSET_T 1 -_ACEOF +printf "%s\n" "#define HAVE_ACL_PERMSET_T 1" >>confdefs.h fi @@ -18667,21 +19968,21 @@ ac_fn_c_check_type "$LINENO" "acl_tag_t" "ac_cv_type_acl_tag_t" " #endif " -if test "x$ac_cv_type_acl_tag_t" = xyes; then : +if test "x$ac_cv_type_acl_tag_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_ACL_TAG_T 1 -_ACEOF +printf "%s\n" "#define HAVE_ACL_TAG_T 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for richacl_get_file in -lrichacl" >&5 -$as_echo_n "checking for richacl_get_file in -lrichacl... " >&6; } -if ${ac_cv_lib_richacl_richacl_get_file+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for richacl_get_file in -lrichacl" >&5 +printf %s "checking for richacl_get_file in -lrichacl... " >&6; } +if test ${ac_cv_lib_richacl_richacl_get_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lrichacl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -18690,33 +19991,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char richacl_get_file (); int -main () +main (void) { return richacl_get_file (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_richacl_richacl_get_file=yes -else +else $as_nop ac_cv_lib_richacl_richacl_get_file=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_richacl_richacl_get_file" >&5 -$as_echo "$ac_cv_lib_richacl_richacl_get_file" >&6; } -if test "x$ac_cv_lib_richacl_richacl_get_file" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBRICHACL 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_richacl_richacl_get_file" >&5 +printf "%s\n" "$ac_cv_lib_richacl_richacl_get_file" >&6; } +if test "x$ac_cv_lib_richacl_richacl_get_file" = xyes +then : + printf "%s\n" "#define HAVE_LIBRICHACL 1" >>confdefs.h LIBS="-lrichacl $LIBS" @@ -18729,11 +20027,10 @@ fi #endif " -if test "x$ac_cv_type_struct_richace" = xyes; then : +if test "x$ac_cv_type_struct_richace" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_RICHACE 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_RICHACE 1" >>confdefs.h fi @@ -18743,56 +20040,53 @@ ac_fn_c_check_type "$LINENO" "struct richacl" "ac_cv_type_struct_richacl" " #endif " -if test "x$ac_cv_type_struct_richacl" = xyes; then : +if test "x$ac_cv_type_struct_richacl" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_RICHACL 1 -_ACEOF +printf "%s\n" "#define HAVE_STRUCT_RICHACL 1" >>confdefs.h fi # Solaris and derivates ACLs - for ac_func in acl facl -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "acl" "ac_cv_func_acl" +if test "x$ac_cv_func_acl" = xyes +then : + printf "%s\n" "#define HAVE_ACL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "facl" "ac_cv_func_facl" +if test "x$ac_cv_func_facl" = xyes +then : + printf "%s\n" "#define HAVE_FACL 1" >>confdefs.h fi -done if test "x$ac_cv_lib_richacl_richacl_get_file" = "xyes" \ -a "x$ac_cv_type_struct_richace" = "xyes" \ -a "x$ac_cv_type_struct_richacl" = "xyes"; then - if ${ac_cv_archive_acl_librichacl+:} false; then : - $as_echo_n "(cached) " >&6 -else - for ac_func in richacl_alloc \ - richacl_equiv_mode \ - richacl_free \ - richacl_get_fd \ - richacl_get_file \ - richacl_set_fd \ - richacl_set_file + if test ${ac_cv_archive_acl_librichacl+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + for ac_func in richacl_alloc richacl_equiv_mode richacl_free richacl_get_fd richacl_get_file richacl_set_fd richacl_set_file do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ac_cv_archive_acl_librichacl=yes -else +else $as_nop ac_cv_archive_acl_librichacl=no fi -done +done fi fi @@ -18801,65 +20095,62 @@ fi -a "x$ac_cv_func_facl" = "xyes"; then ac_fn_c_check_type "$LINENO" "aclent_t" "ac_cv_type_aclent_t" "#include " -if test "x$ac_cv_type_aclent_t" = xyes; then : +if test "x$ac_cv_type_aclent_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_ACLENT_T 1 -_ACEOF +printf "%s\n" "#define HAVE_ACLENT_T 1" >>confdefs.h fi if test "x$ac_cv_type_aclent_t" = "xyes"; then - if ${ac_cv_archive_acl_sunos+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_fn_c_check_decl "$LINENO" "GETACL" "ac_cv_have_decl_GETACL" "#include -" -if test "x$ac_cv_have_decl_GETACL" = xyes; then : + if test ${ac_cv_archive_acl_sunos+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_fn_check_decl "$LINENO" "GETACL" "ac_cv_have_decl_GETACL" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_GETACL" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETACL $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : +printf "%s\n" "#define HAVE_DECL_GETACL $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : ac_cv_archive_acl_sunos=yes -else +else $as_nop ac_cv_archive_acl_sunos=no fi -ac_fn_c_check_decl "$LINENO" "SETACL" "ac_cv_have_decl_SETACL" "#include -" -if test "x$ac_cv_have_decl_SETACL" = xyes; then : +ac_fn_check_decl "$LINENO" "SETACL" "ac_cv_have_decl_SETACL" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_SETACL" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SETACL $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : +printf "%s\n" "#define HAVE_DECL_SETACL $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : ac_cv_archive_acl_sunos=yes -else +else $as_nop ac_cv_archive_acl_sunos=no fi -ac_fn_c_check_decl "$LINENO" "GETACLCNT" "ac_cv_have_decl_GETACLCNT" "#include -" -if test "x$ac_cv_have_decl_GETACLCNT" = xyes; then : +ac_fn_check_decl "$LINENO" "GETACLCNT" "ac_cv_have_decl_GETACLCNT" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_GETACLCNT" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETACLCNT $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : +printf "%s\n" "#define HAVE_DECL_GETACLCNT $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : ac_cv_archive_acl_sunos=yes -else +else $as_nop ac_cv_archive_acl_sunos=no fi @@ -18867,65 +20158,62 @@ fi ac_fn_c_check_type "$LINENO" "ace_t" "ac_cv_type_ace_t" "#include " -if test "x$ac_cv_type_ace_t" = xyes; then : +if test "x$ac_cv_type_ace_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_ACE_T 1 -_ACEOF +printf "%s\n" "#define HAVE_ACE_T 1" >>confdefs.h fi if test "x$ac_cv_type_ace_t" = "xyes"; then - if ${ac_cv_archive_acl_sunos_nfs4+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_fn_c_check_decl "$LINENO" "ACE_GETACL" "ac_cv_have_decl_ACE_GETACL" "#include -" -if test "x$ac_cv_have_decl_ACE_GETACL" = xyes; then : + if test ${ac_cv_archive_acl_sunos_nfs4+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_fn_check_decl "$LINENO" "ACE_GETACL" "ac_cv_have_decl_ACE_GETACL" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ACE_GETACL" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ACE_GETACL $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : +printf "%s\n" "#define HAVE_DECL_ACE_GETACL $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : ac_cv_archive_acl_sunos_nfs4=yes -else +else $as_nop ac_cv_archive_acl_sonos_nfs4=no fi -ac_fn_c_check_decl "$LINENO" "ACE_SETACL" "ac_cv_have_decl_ACE_SETACL" "#include -" -if test "x$ac_cv_have_decl_ACE_SETACL" = xyes; then : +ac_fn_check_decl "$LINENO" "ACE_SETACL" "ac_cv_have_decl_ACE_SETACL" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ACE_SETACL" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ACE_SETACL $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : +printf "%s\n" "#define HAVE_DECL_ACE_SETACL $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : ac_cv_archive_acl_sunos_nfs4=yes -else +else $as_nop ac_cv_archive_acl_sonos_nfs4=no fi -ac_fn_c_check_decl "$LINENO" "ACE_GETACLCNT" "ac_cv_have_decl_ACE_GETACLCNT" "#include -" -if test "x$ac_cv_have_decl_ACE_GETACLCNT" = xyes; then : +ac_fn_check_decl "$LINENO" "ACE_GETACLCNT" "ac_cv_have_decl_ACE_GETACLCNT" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ACE_GETACLCNT" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ACE_GETACLCNT $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : +printf "%s\n" "#define HAVE_DECL_ACE_GETACLCNT $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : ac_cv_archive_acl_sunos_nfs4=yes -else +else $as_nop ac_cv_archive_acl_sonos_nfs4=no fi @@ -18938,157 +20226,194 @@ fi -a "x$ac_cv_type_acl_permset_t" = "xyes" \ -a "x$ac_cv_type_acl_tag_t" = "xyes"; then # POSIX.1e ACL functions - if ${ac_cv_posix_acl_funcs+:} false; then : - $as_echo_n "(cached) " >&6 -else - for ac_func in acl_add_perm \ - acl_clear_perms \ - acl_create_entry \ - acl_delete_def_file \ - acl_free \ - acl_get_entry \ - acl_get_fd \ - acl_get_file \ - acl_get_permset \ - acl_get_qualifier \ - acl_get_tag_type \ - acl_init \ - acl_set_fd \ - acl_set_file \ - acl_set_qualifier \ - acl_set_tag_type + if test ${ac_cv_posix_acl_funcs+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + for ac_func in acl_add_perm acl_clear_perms acl_create_entry acl_delete_def_file acl_free acl_get_entry acl_get_fd acl_get_file acl_get_permset acl_get_qualifier acl_get_tag_type acl_init acl_set_fd acl_set_file acl_set_qualifier acl_set_tag_type do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF ac_cv_posix_acl_funcs=yes -else +else $as_nop ac_cv_posix_acl_funcs=no fi -done +done fi - for ac_func in acl_get_perm -do : - ac_fn_c_check_func "$LINENO" "acl_get_perm" "ac_cv_func_acl_get_perm" -if test "x$ac_cv_func_acl_get_perm" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ACL_GET_PERM 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "acl_get_perm" "ac_cv_func_acl_get_perm" +if test "x$ac_cv_func_acl_get_perm" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_PERM 1" >>confdefs.h fi -done if test "x$ac_cv_posix_acl_funcs" = "xyes" \ -a "x$ac_cv_header_acl_libacl_h" = "xyes" \ -a "x$ac_cv_lib_acl_acl_get_file" = "xyes" \ -a "x$ac_cv_func_acl_get_perm"; then - if ${ac_cv_archive_acl_libacl+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_archive_acl_libacl+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_archive_acl_libacl=yes fi -$as_echo "#define ARCHIVE_ACL_LIBACL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_LIBACL 1" >>confdefs.h else # FreeBSD/Darwin - for ac_func in acl_add_flag_np \ - acl_clear_flags_np \ - acl_get_brand_np \ - acl_get_entry_type_np \ - acl_get_flag_np \ - acl_get_flagset_np \ - acl_get_fd_np \ - acl_get_link_np \ - acl_get_perm_np \ - acl_is_trivial_np \ - acl_set_entry_type_np \ - acl_set_fd_np \ - acl_set_link_np -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "acl_add_flag_np" "ac_cv_func_acl_add_flag_np" +if test "x$ac_cv_func_acl_add_flag_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_ADD_FLAG_NP 1" >>confdefs.h fi -done - - - for ac_func in mbr_uid_to_uuid \ - mbr_uuid_to_id \ - mbr_gid_to_uuid -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "acl_clear_flags_np" "ac_cv_func_acl_clear_flags_np" +if test "x$ac_cv_func_acl_clear_flags_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_CLEAR_FLAGS_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_get_brand_np" "ac_cv_func_acl_get_brand_np" +if test "x$ac_cv_func_acl_get_brand_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_BRAND_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_get_entry_type_np" "ac_cv_func_acl_get_entry_type_np" +if test "x$ac_cv_func_acl_get_entry_type_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_ENTRY_TYPE_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_get_flag_np" "ac_cv_func_acl_get_flag_np" +if test "x$ac_cv_func_acl_get_flag_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_FLAG_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_get_flagset_np" "ac_cv_func_acl_get_flagset_np" +if test "x$ac_cv_func_acl_get_flagset_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_FLAGSET_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_get_fd_np" "ac_cv_func_acl_get_fd_np" +if test "x$ac_cv_func_acl_get_fd_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_FD_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_get_link_np" "ac_cv_func_acl_get_link_np" +if test "x$ac_cv_func_acl_get_link_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_LINK_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_get_perm_np" "ac_cv_func_acl_get_perm_np" +if test "x$ac_cv_func_acl_get_perm_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_GET_PERM_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_is_trivial_np" "ac_cv_func_acl_is_trivial_np" +if test "x$ac_cv_func_acl_is_trivial_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_IS_TRIVIAL_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_set_entry_type_np" "ac_cv_func_acl_set_entry_type_np" +if test "x$ac_cv_func_acl_set_entry_type_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_SET_ENTRY_TYPE_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_set_fd_np" "ac_cv_func_acl_set_fd_np" +if test "x$ac_cv_func_acl_set_fd_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_SET_FD_NP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "acl_set_link_np" "ac_cv_func_acl_set_link_np" +if test "x$ac_cv_func_acl_set_link_np" = xyes +then : + printf "%s\n" "#define HAVE_ACL_SET_LINK_NP 1" >>confdefs.h fi -done - ac_fn_c_check_decl "$LINENO" "ACL_TYPE_EXTENDED" "ac_cv_have_decl_ACL_TYPE_EXTENDED" "#include + ac_fn_c_check_func "$LINENO" "mbr_uid_to_uuid" "ac_cv_func_mbr_uid_to_uuid" +if test "x$ac_cv_func_mbr_uid_to_uuid" = xyes +then : + printf "%s\n" "#define HAVE_MBR_UID_TO_UUID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mbr_uuid_to_id" "ac_cv_func_mbr_uuid_to_id" +if test "x$ac_cv_func_mbr_uuid_to_id" = xyes +then : + printf "%s\n" "#define HAVE_MBR_UUID_TO_ID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mbr_gid_to_uuid" "ac_cv_func_mbr_gid_to_uuid" +if test "x$ac_cv_func_mbr_gid_to_uuid" = xyes +then : + printf "%s\n" "#define HAVE_MBR_GID_TO_UUID 1" >>confdefs.h + +fi + + + ac_fn_check_decl "$LINENO" "ACL_TYPE_EXTENDED" "ac_cv_have_decl_ACL_TYPE_EXTENDED" "#include #include -" -if test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ACL_TYPE_EXTENDED $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "ACL_TYPE_NFS4" "ac_cv_have_decl_ACL_TYPE_NFS4" "#include +printf "%s\n" "#define HAVE_DECL_ACL_TYPE_EXTENDED $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "ACL_TYPE_NFS4" "ac_cv_have_decl_ACL_TYPE_NFS4" "#include #include -" -if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ACL_TYPE_NFS4 $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "ACL_USER" "ac_cv_have_decl_ACL_USER" "#include +printf "%s\n" "#define HAVE_DECL_ACL_TYPE_NFS4 $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "ACL_USER" "ac_cv_have_decl_ACL_USER" "#include #include -" -if test "x$ac_cv_have_decl_ACL_USER" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ACL_USER" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ACL_USER $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "ACL_SYNCHRONIZE" "ac_cv_have_decl_ACL_SYNCHRONIZE" "#include +printf "%s\n" "#define HAVE_DECL_ACL_USER $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "ACL_SYNCHRONIZE" "ac_cv_have_decl_ACL_SYNCHRONIZE" "#include #include -" -if test "x$ac_cv_have_decl_ACL_SYNCHRONIZE" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_ACL_SYNCHRONIZE" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ACL_SYNCHRONIZE $ac_have_decl -_ACEOF +printf "%s\n" "#define HAVE_DECL_ACL_SYNCHRONIZE $ac_have_decl" >>confdefs.h if test "x$ac_cv_posix_acl_funcs" = "xyes" \ -a "x$ac_cv_func_acl_get_fd_np" = "xyes" \ @@ -19096,9 +20421,10 @@ _ACEOF -a "x$ac_cv_func_acl_get_perm_np" = "xyes" \ -a "x$ac_cv_func_acl_set_fd_np" = "xyes"; then if test "x$ac_cv_have_decl_ACL_USER" = "xyes"; then - if ${ac_cv_archive_acl_freebsd+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_archive_acl_freebsd+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_archive_acl_freebsd=yes fi @@ -19108,9 +20434,10 @@ fi -a "x$ac_cv_func_acl_get_entry_type_np" = "xyes" \ -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \ -a "x$ac_cv_func_acl_set_entry_type_np" = "xyes"; then - if ${ac_cv_archive_acl_freebsd_nfs4+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_archive_acl_freebsd_nfs4+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_archive_acl_freebsd_nfs4=yes fi @@ -19123,9 +20450,10 @@ fi -a "x$ac_cv_func_mbr_uid_to_uuid" = "xyes" \ -a "x$ac_cv_func_mbr_uuid_to_id" = "xyes" \ -a "x$ac_cv_func_mbr_gid_to_uuid" = "xyes"; then - if ${ac_cv_archive_acl_darwin+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_archive_acl_darwin+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_archive_acl_darwin=yes fi @@ -19133,67 +20461,67 @@ fi fi fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ACL support" >&5 -$as_echo_n "checking for ACL support... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ACL support" >&5 +printf %s "checking for ACL support... " >&6; } if test "x$ac_cv_archive_acl_libacl" = "xyes" \ -a "x$ac_cv_archive_acl_librichacl" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: libacl (POSIX.1e) + librichacl (NFSv4)" >&5 -$as_echo "libacl (POSIX.1e) + librichacl (NFSv4)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libacl (POSIX.1e) + librichacl (NFSv4)" >&5 +printf "%s\n" "libacl (POSIX.1e) + librichacl (NFSv4)" >&6; } -$as_echo "#define ARCHIVE_ACL_LIBACL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_LIBACL 1" >>confdefs.h -$as_echo "#define ARCHIVE_ACL_LIBRICHACL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_LIBRICHACL 1" >>confdefs.h elif test "x$ac_cv_archive_acl_libacl" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: libacl (POSIX.1e)" >&5 -$as_echo "libacl (POSIX.1e)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libacl (POSIX.1e)" >&5 +printf "%s\n" "libacl (POSIX.1e)" >&6; } -$as_echo "#define ARCHIVE_ACL_LIBACL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_LIBACL 1" >>confdefs.h elif test "x$ac_cv_archive_acl_librichacl" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: librichacl (NFSv4)" >&5 -$as_echo "librichacl (NFSv4)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: librichacl (NFSv4)" >&5 +printf "%s\n" "librichacl (NFSv4)" >&6; } -$as_echo "#define ARCHIVE_ACL_LIBRICHACL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_LIBRICHACL 1" >>confdefs.h elif test "x$ac_cv_archive_acl_darwin" = "xyes"; then -$as_echo "#define ARCHIVE_ACL_DARWIN 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_DARWIN 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Darwin (limited NFSv4)" >&5 -$as_echo "Darwin (limited NFSv4)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Darwin (limited NFSv4)" >&5 +printf "%s\n" "Darwin (limited NFSv4)" >&6; } elif test "x$ac_cv_archive_acl_sunos" = "xyes"; then -$as_echo "#define ARCHIVE_ACL_SUNOS 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_SUNOS 1" >>confdefs.h if test "x$ac_cv_archive_acl_sunos_nfs4" = "xyes"; then -$as_echo "#define ARCHIVE_ACL_SUNOS_NFS4 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_SUNOS_NFS4 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Solaris (POSIX.1e and NFSv4)" >&5 -$as_echo "Solaris (POSIX.1e and NFSv4)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Solaris (POSIX.1e and NFSv4)" >&5 +printf "%s\n" "Solaris (POSIX.1e and NFSv4)" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Solaris (POSIX.1e)" >&5 -$as_echo "Solaris (POSIX.1e)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Solaris (POSIX.1e)" >&5 +printf "%s\n" "Solaris (POSIX.1e)" >&6; } fi elif test "x$ac_cv_archive_acl_freebsd" = "xyes"; then -$as_echo "#define ARCHIVE_ACL_FREEBSD 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_FREEBSD 1" >>confdefs.h if test "x$ac_cv_archive_acl_freebsd_nfs4" = "xyes"; then -$as_echo "#define ARCHIVE_ACL_FREEBSD_NFS4 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_ACL_FREEBSD_NFS4 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: FreeBSD (POSIX.1e and NFSv4)" >&5 -$as_echo "FreeBSD (POSIX.1e and NFSv4)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: FreeBSD (POSIX.1e and NFSv4)" >&5 +printf "%s\n" "FreeBSD (POSIX.1e and NFSv4)" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: FreeBSD (POSIX.1e)" >&5 -$as_echo "FreeBSD (POSIX.1e)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: FreeBSD (POSIX.1e)" >&5 +printf "%s\n" "FreeBSD (POSIX.1e)" >&6; } fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } fi fi @@ -19234,17 +20562,19 @@ fi # Additional requirements # Check whether --enable-largefile was given. -if test "${enable_largefile+set}" = set; then : +if test ${enable_largefile+y} +then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -$as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if ${ac_cv_sys_largefile_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC @@ -19258,44 +20588,47 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : break fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_largefile_CC=' -n32'; break fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -$as_echo "$ac_cv_sys_largefile_CC" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if ${ac_cv_sys_file_offset_bits+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19304,22 +20637,23 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_file_offset_bits=no; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 @@ -19328,43 +20662,43 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_file_offset_bits=64; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) -cat >>confdefs.h <<_ACEOF -#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -_ACEOF +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if ${ac_cv_sys_large_files+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} +then : + printf %s "(cached) " >&6 +else $as_nop while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19373,22 +20707,23 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_large_files=no; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 @@ -19397,40 +20732,37 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_sys_large_files=1; break fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -$as_echo "$ac_cv_sys_large_files" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) -cat >>confdefs.h <<_ACEOF -#define _LARGE_FILES $ac_cv_sys_large_files -_ACEOF +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h ;; esac rm -rf conftest* fi - - fi @@ -19447,8 +20779,8 @@ case "$host_os" in saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_LIBC" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_MD5_LIBC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_LIBC" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_MD5_LIBC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19469,20 +20801,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_MD5=yes found_LIBC=yes -$as_echo "#define ARCHIVE_CRYPTO_MD5_LIBC 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_MD5_LIBC 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19493,8 +20826,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_LIBSYSTEM" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_MD5_LIBSYSTEM... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_LIBSYSTEM" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_MD5_LIBSYSTEM... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19515,20 +20848,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_MD5=yes found_LIBSYSTEM=yes -$as_echo "#define ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19539,8 +20873,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_LIBC" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_RMD160_LIBC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_LIBC" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_RMD160_LIBC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19561,20 +20895,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_RMD160=yes found_LIBC=yes -$as_echo "#define ARCHIVE_CRYPTO_RMD160_LIBC 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_RMD160_LIBC 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19585,8 +20920,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_LIBC" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA1_LIBC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_LIBC" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA1_LIBC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19607,20 +20942,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA1=yes found_LIBC=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA1_LIBC 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA1_LIBC 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19631,8 +20967,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_LIBSYSTEM" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA1_LIBSYSTEM... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_LIBSYSTEM" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA1_LIBSYSTEM... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19653,20 +20989,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA1=yes found_LIBSYSTEM=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19677,8 +21014,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBC" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_LIBC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBC" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_LIBC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19699,20 +21036,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_LIBC=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_LIBC 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_LIBC 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19723,8 +21061,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBC2" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_LIBC2... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBC2" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_LIBC2... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19745,20 +21083,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_LIBC2=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_LIBC2 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_LIBC2 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19769,8 +21108,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBC3" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_LIBC3... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBC3" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_LIBC3... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19791,20 +21130,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_LIBC3=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_LIBC3 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_LIBC3 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19815,8 +21155,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBSYSTEM" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_LIBSYSTEM... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBSYSTEM" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_LIBSYSTEM... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19837,20 +21177,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_LIBSYSTEM=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19861,8 +21202,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBC" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_LIBC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBC" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_LIBC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19883,20 +21224,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_LIBC=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_LIBC 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_LIBC 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19907,8 +21249,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBC2" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_LIBC2... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBC2" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_LIBC2... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19929,20 +21271,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_LIBC2=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_LIBC2 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_LIBC2 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19953,8 +21296,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBC3" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_LIBC3... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBC3" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_LIBC3... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -19975,20 +21318,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_LIBC3=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_LIBC3 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_LIBC3 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -19999,8 +21343,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBSYSTEM" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_LIBSYSTEM... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_LIBSYSTEM" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_LIBSYSTEM... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20021,20 +21365,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_LIBSYSTEM=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20045,8 +21390,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBC" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_LIBC... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBC" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_LIBC... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20067,20 +21412,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_LIBC=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_LIBC 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_LIBC 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20091,8 +21437,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBC2" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_LIBC2... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBC2" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_LIBC2... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20113,20 +21459,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_LIBC2=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_LIBC2 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_LIBC2 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20137,8 +21484,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBC3" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_LIBC3... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBC3" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_LIBC3... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20159,20 +21506,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_LIBC3=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_LIBC3 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_LIBC3 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20183,8 +21531,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBSYSTEM" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_LIBSYSTEM... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBSYSTEM" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_LIBSYSTEM... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20205,20 +21553,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_LIBSYSTEM=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20228,46 +21577,51 @@ rm -f core conftest.err conftest.$ac_objext \ esac if test "x$with_cng" != "xno"; then - for ac_header in bcrypt.h + for ac_header in bcrypt.h do : ac_fn_c_check_header_compile "$LINENO" "bcrypt.h" "ac_cv_header_bcrypt_h" "#ifdef HAVE_WINDOWS_H # include #endif " -if test "x$ac_cv_header_bcrypt_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_BCRYPT_H 1 -_ACEOF +if test "x$ac_cv_header_bcrypt_h" = xyes +then : + printf "%s\n" "#define HAVE_BCRYPT_H 1" >>confdefs.h LIBS="$LIBS -lbcrypt" fi done - fi if test "x$with_mbedtls" = "xyes"; then - for ac_header in mbedtls/aes.h mbedtls/md.h mbedtls/pkcs5.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "mbedtls/aes.h" "ac_cv_header_mbedtls_aes_h" "$ac_includes_default" +if test "x$ac_cv_header_mbedtls_aes_h" = xyes +then : + printf "%s\n" "#define HAVE_MBEDTLS_AES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "mbedtls/md.h" "ac_cv_header_mbedtls_md_h" "$ac_includes_default" +if test "x$ac_cv_header_mbedtls_md_h" = xyes +then : + printf "%s\n" "#define HAVE_MBEDTLS_MD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "mbedtls/pkcs5.h" "ac_cv_header_mbedtls_pkcs5_h" "$ac_includes_default" +if test "x$ac_cv_header_mbedtls_pkcs5_h" = xyes +then : + printf "%s\n" "#define HAVE_MBEDTLS_PKCS5_H 1" >>confdefs.h fi -done - saved_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbedtls_sha1_init in -lmbedcrypto" >&5 -$as_echo_n "checking for mbedtls_sha1_init in -lmbedcrypto... " >&6; } -if ${ac_cv_lib_mbedcrypto_mbedtls_sha1_init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mbedtls_sha1_init in -lmbedcrypto" >&5 +printf %s "checking for mbedtls_sha1_init in -lmbedcrypto... " >&6; } +if test ${ac_cv_lib_mbedcrypto_mbedtls_sha1_init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmbedcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20276,33 +21630,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char mbedtls_sha1_init (); int -main () +main (void) { return mbedtls_sha1_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_mbedcrypto_mbedtls_sha1_init=yes -else +else $as_nop ac_cv_lib_mbedcrypto_mbedtls_sha1_init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mbedcrypto_mbedtls_sha1_init" >&5 -$as_echo "$ac_cv_lib_mbedcrypto_mbedtls_sha1_init" >&6; } -if test "x$ac_cv_lib_mbedcrypto_mbedtls_sha1_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBMBEDCRYPTO 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mbedcrypto_mbedtls_sha1_init" >&5 +printf "%s\n" "$ac_cv_lib_mbedcrypto_mbedtls_sha1_init" >&6; } +if test "x$ac_cv_lib_mbedcrypto_mbedtls_sha1_init" = xyes +then : + printf "%s\n" "#define HAVE_LIBMBEDCRYPTO 1" >>confdefs.h LIBS="-lmbedcrypto $LIBS" @@ -20313,8 +21664,8 @@ fi saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_MBEDTLS" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_MD5_MBEDTLS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_MBEDTLS" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_MD5_MBEDTLS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20335,20 +21686,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_MD5=yes found_MBEDTLS=yes -$as_echo "#define ARCHIVE_CRYPTO_MD5_MBEDTLS 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_MD5_MBEDTLS 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20359,8 +21711,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_MBEDTLS" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_RMD160_MBEDTLS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_MBEDTLS" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_RMD160_MBEDTLS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20381,20 +21733,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_RMD160=yes found_MBEDTLS=yes -$as_echo "#define ARCHIVE_CRYPTO_RMD160_MBEDTLS 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_RMD160_MBEDTLS 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20405,8 +21758,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_MBEDTLS" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA1_MBEDTLS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_MBEDTLS" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA1_MBEDTLS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20427,20 +21780,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA1=yes found_MBEDTLS=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA1_MBEDTLS 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA1_MBEDTLS 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20451,8 +21805,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_MBEDTLS" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_MBEDTLS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_MBEDTLS" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_MBEDTLS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20473,20 +21827,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_MBEDTLS=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_MBEDTLS 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_MBEDTLS 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20497,8 +21852,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_MBEDTLS" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_MBEDTLS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_MBEDTLS" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_MBEDTLS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20519,20 +21874,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_MBEDTLS=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_MBEDTLS 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_MBEDTLS 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20543,8 +21899,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_MBEDTLS" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_MBEDTLS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_MBEDTLS" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_MBEDTLS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20565,20 +21921,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_MBEDTLS=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_MBEDTLS 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_MBEDTLS 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20590,38 +21947,51 @@ rm -f core conftest.err conftest.$ac_objext \ fi if test "x$with_nettle" = "xyes"; then - for ac_header in nettle/md5.h nettle/ripemd160.h nettle/sha.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "nettle/md5.h" "ac_cv_header_nettle_md5_h" "$ac_includes_default" +if test "x$ac_cv_header_nettle_md5_h" = xyes +then : + printf "%s\n" "#define HAVE_NETTLE_MD5_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "nettle/ripemd160.h" "ac_cv_header_nettle_ripemd160_h" "$ac_includes_default" +if test "x$ac_cv_header_nettle_ripemd160_h" = xyes +then : + printf "%s\n" "#define HAVE_NETTLE_RIPEMD160_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "nettle/sha.h" "ac_cv_header_nettle_sha_h" "$ac_includes_default" +if test "x$ac_cv_header_nettle_sha_h" = xyes +then : + printf "%s\n" "#define HAVE_NETTLE_SHA_H 1" >>confdefs.h fi -done - - for ac_header in nettle/pbkdf2.h nettle/aes.h nettle/hmac.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "nettle/pbkdf2.h" "ac_cv_header_nettle_pbkdf2_h" "$ac_includes_default" +if test "x$ac_cv_header_nettle_pbkdf2_h" = xyes +then : + printf "%s\n" "#define HAVE_NETTLE_PBKDF2_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "nettle/aes.h" "ac_cv_header_nettle_aes_h" "$ac_includes_default" +if test "x$ac_cv_header_nettle_aes_h" = xyes +then : + printf "%s\n" "#define HAVE_NETTLE_AES_H 1" >>confdefs.h -done +fi +ac_fn_c_check_header_compile "$LINENO" "nettle/hmac.h" "ac_cv_header_nettle_hmac_h" "$ac_includes_default" +if test "x$ac_cv_header_nettle_hmac_h" = xyes +then : + printf "%s\n" "#define HAVE_NETTLE_HMAC_H 1" >>confdefs.h + +fi saved_LIBS=$LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nettle_sha1_init in -lnettle" >&5 -$as_echo_n "checking for nettle_sha1_init in -lnettle... " >&6; } -if ${ac_cv_lib_nettle_nettle_sha1_init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nettle_sha1_init in -lnettle" >&5 +printf %s "checking for nettle_sha1_init in -lnettle... " >&6; } +if test ${ac_cv_lib_nettle_nettle_sha1_init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lnettle $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -20630,33 +22000,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char nettle_sha1_init (); int -main () +main (void) { return nettle_sha1_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_nettle_nettle_sha1_init=yes -else +else $as_nop ac_cv_lib_nettle_nettle_sha1_init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nettle_nettle_sha1_init" >&5 -$as_echo "$ac_cv_lib_nettle_nettle_sha1_init" >&6; } -if test "x$ac_cv_lib_nettle_nettle_sha1_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBNETTLE 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nettle_nettle_sha1_init" >&5 +printf "%s\n" "$ac_cv_lib_nettle_nettle_sha1_init" >&6; } +if test "x$ac_cv_lib_nettle_nettle_sha1_init" = xyes +then : + printf "%s\n" "#define HAVE_LIBNETTLE 1" >>confdefs.h LIBS="-lnettle $LIBS" @@ -20667,8 +22034,8 @@ fi saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_NETTLE" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_MD5_NETTLE... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_NETTLE" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_MD5_NETTLE... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20689,20 +22056,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_MD5=yes found_NETTLE=yes -$as_echo "#define ARCHIVE_CRYPTO_MD5_NETTLE 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_MD5_NETTLE 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20713,8 +22081,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_NETTLE" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_RMD160_NETTLE... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_NETTLE" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_RMD160_NETTLE... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20735,20 +22103,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_RMD160=yes found_NETTLE=yes -$as_echo "#define ARCHIVE_CRYPTO_RMD160_NETTLE 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_RMD160_NETTLE 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20759,8 +22128,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_NETTLE" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA1_NETTLE... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_NETTLE" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA1_NETTLE... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20781,20 +22150,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA1=yes found_NETTLE=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA1_NETTLE 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA1_NETTLE 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20805,8 +22175,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_NETTLE" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_NETTLE... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_NETTLE" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_NETTLE... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20827,20 +22197,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_NETTLE=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_NETTLE 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_NETTLE 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20851,8 +22222,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_NETTLE" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_NETTLE... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_NETTLE" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_NETTLE... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20873,20 +22244,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_NETTLE=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_NETTLE 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_NETTLE 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20897,8 +22269,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_NETTLE" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_NETTLE... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_NETTLE" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_NETTLE... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -20919,20 +22291,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_NETTLE=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_NETTLE 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_NETTLE 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -20944,171 +22317,21 @@ rm -f core conftest.err conftest.$ac_objext \ fi if test "x$with_openssl" != "xno"; then - for ac_header in openssl/evp.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "openssl/evp.h" "ac_cv_header_openssl_evp_h" "$ac_includes_default" -if test "x$ac_cv_header_openssl_evp_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_EVP_H 1 -_ACEOF + ac_fn_c_check_header_compile "$LINENO" "openssl/evp.h" "ac_cv_header_openssl_evp_h" "$ac_includes_default" +if test "x$ac_cv_header_openssl_evp_h" = xyes +then : + printf "%s\n" "#define HAVE_OPENSSL_EVP_H 1" >>confdefs.h fi -done - saved_LIBS=$LIBS - case "$host_os" in - *mingw* | *cygwin* | *msys*) - case "$host_cpu" in - x86_64) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_config in -leay64" >&5 -$as_echo_n "checking for OPENSSL_config in -leay64... " >&6; } -if ${ac_cv_lib_eay64_OPENSSL_config+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-leay64 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char OPENSSL_config (); -int -main () -{ -return OPENSSL_config (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_eay64_OPENSSL_config=yes -else - ac_cv_lib_eay64_OPENSSL_config=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_eay64_OPENSSL_config" >&5 -$as_echo "$ac_cv_lib_eay64_OPENSSL_config" >&6; } -if test "x$ac_cv_lib_eay64_OPENSSL_config" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBEAY64 1 -_ACEOF - - LIBS="-leay64 $LIBS" - -fi - - if test "x$ac_cv_lib_eay64_main" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_config in -leay32" >&5 -$as_echo_n "checking for OPENSSL_config in -leay32... " >&6; } -if ${ac_cv_lib_eay32_OPENSSL_config+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-leay32 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char OPENSSL_config (); -int -main () -{ -return OPENSSL_config (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_eay32_OPENSSL_config=yes -else - ac_cv_lib_eay32_OPENSSL_config=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_eay32_OPENSSL_config" >&5 -$as_echo "$ac_cv_lib_eay32_OPENSSL_config" >&6; } -if test "x$ac_cv_lib_eay32_OPENSSL_config" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBEAY32 1 -_ACEOF - - LIBS="-leay32 $LIBS" - -fi - - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_config in -leay32" >&5 -$as_echo_n "checking for OPENSSL_config in -leay32... " >&6; } -if ${ac_cv_lib_eay32_OPENSSL_config+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-leay32 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char OPENSSL_config (); -int -main () -{ -return OPENSSL_config (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_eay32_OPENSSL_config=yes -else - ac_cv_lib_eay32_OPENSSL_config=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_eay32_OPENSSL_config" >&5 -$as_echo "$ac_cv_lib_eay32_OPENSSL_config" >&6; } -if test "x$ac_cv_lib_eay32_OPENSSL_config" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBEAY32 1 -_ACEOF - - LIBS="-leay32 $LIBS" - -fi - - ;; - esac - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_config in -lcrypto" >&5 -$as_echo_n "checking for OPENSSL_config in -lcrypto... " >&6; } -if ${ac_cv_lib_crypto_OPENSSL_config+:} false; then : - $as_echo_n "(cached) " >&6 -else + LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libssl libcrypto" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_config in -lcrypto" >&5 +printf %s "checking for OPENSSL_config in -lcrypto... " >&6; } +if test ${ac_cv_lib_crypto_OPENSSL_config+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21117,47 +22340,42 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char OPENSSL_config (); int -main () +main (void) { return OPENSSL_config (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_crypto_OPENSSL_config=yes -else +else $as_nop ac_cv_lib_crypto_OPENSSL_config=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_OPENSSL_config" >&5 -$as_echo "$ac_cv_lib_crypto_OPENSSL_config" >&6; } -if test "x$ac_cv_lib_crypto_OPENSSL_config" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBCRYPTO 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_OPENSSL_config" >&5 +printf "%s\n" "$ac_cv_lib_crypto_OPENSSL_config" >&6; } +if test "x$ac_cv_lib_crypto_OPENSSL_config" = xyes +then : + printf "%s\n" "#define HAVE_LIBCRYPTO 1" >>confdefs.h LIBS="-lcrypto $LIBS" fi - ;; - esac if test "$found_MD5" != yes; then saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_OPENSSL" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_MD5_OPENSSL... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_OPENSSL" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_MD5_OPENSSL... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21178,20 +22396,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_MD5=yes found_OPENSSL=yes -$as_echo "#define ARCHIVE_CRYPTO_MD5_OPENSSL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_MD5_OPENSSL 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21202,8 +22421,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_OPENSSL" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_RMD160_OPENSSL... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_OPENSSL" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_RMD160_OPENSSL... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21224,20 +22443,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_RMD160=yes found_OPENSSL=yes -$as_echo "#define ARCHIVE_CRYPTO_RMD160_OPENSSL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_RMD160_OPENSSL 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21248,8 +22468,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_OPENSSL" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA1_OPENSSL... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_OPENSSL" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA1_OPENSSL... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21270,20 +22490,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA1=yes found_OPENSSL=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA1_OPENSSL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA1_OPENSSL 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21294,8 +22515,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_OPENSSL" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_OPENSSL... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_OPENSSL" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_OPENSSL... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21316,20 +22537,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_OPENSSL=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_OPENSSL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_OPENSSL 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21340,8 +22562,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_OPENSSL" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_OPENSSL... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_OPENSSL" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_OPENSSL... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21362,20 +22584,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_OPENSSL=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_OPENSSL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_OPENSSL 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21386,8 +22609,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_OPENSSL" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_OPENSSL... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_OPENSSL" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_OPENSSL... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21408,59 +22631,77 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_OPENSSL=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_OPENSSL 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_OPENSSL 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" fi - for ac_func in PKCS5_PBKDF2_HMAC_SHA1 -do : - ac_fn_c_check_func "$LINENO" "PKCS5_PBKDF2_HMAC_SHA1" "ac_cv_func_PKCS5_PBKDF2_HMAC_SHA1" -if test "x$ac_cv_func_PKCS5_PBKDF2_HMAC_SHA1" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PKCS5_PBKDF2_HMAC_SHA1 1 -_ACEOF + ac_fn_c_check_func "$LINENO" "PKCS5_PBKDF2_HMAC_SHA1" "ac_cv_func_PKCS5_PBKDF2_HMAC_SHA1" +if test "x$ac_cv_func_PKCS5_PBKDF2_HMAC_SHA1" = xyes +then : + printf "%s\n" "#define HAVE_PKCS5_PBKDF2_HMAC_SHA1 1" >>confdefs.h fi -done fi + + # Probe libmd AFTER OpenSSL/libcrypto. # The two are incompatible and OpenSSL is more complete. -for ac_header in md5.h ripemd.h sha.h sha256.h sha512.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "md5.h" "ac_cv_header_md5_h" "$ac_includes_default" +if test "x$ac_cv_header_md5_h" = xyes +then : + printf "%s\n" "#define HAVE_MD5_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "ripemd.h" "ac_cv_header_ripemd_h" "$ac_includes_default" +if test "x$ac_cv_header_ripemd_h" = xyes +then : + printf "%s\n" "#define HAVE_RIPEMD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sha.h" "ac_cv_header_sha_h" "$ac_includes_default" +if test "x$ac_cv_header_sha_h" = xyes +then : + printf "%s\n" "#define HAVE_SHA_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sha256.h" "ac_cv_header_sha256_h" "$ac_includes_default" +if test "x$ac_cv_header_sha256_h" = xyes +then : + printf "%s\n" "#define HAVE_SHA256_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sha512.h" "ac_cv_header_sha512_h" "$ac_includes_default" +if test "x$ac_cv_header_sha512_h" = xyes +then : + printf "%s\n" "#define HAVE_SHA512_H 1" >>confdefs.h fi -done - saved_LIBS=$LIBS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5Init in -lmd" >&5 -$as_echo_n "checking for MD5Init in -lmd... " >&6; } -if ${ac_cv_lib_md_MD5Init+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MD5Init in -lmd" >&5 +printf %s "checking for MD5Init in -lmd... " >&6; } +if test ${ac_cv_lib_md_MD5Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -21469,33 +22710,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char MD5Init (); int -main () +main (void) { return MD5Init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_md_MD5Init=yes -else +else $as_nop ac_cv_lib_md_MD5Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_md_MD5Init" >&5 -$as_echo "$ac_cv_lib_md_MD5Init" >&6; } -if test "x$ac_cv_lib_md_MD5Init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBMD 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_md_MD5Init" >&5 +printf "%s\n" "$ac_cv_lib_md_MD5Init" >&6; } +if test "x$ac_cv_lib_md_MD5Init" = xyes +then : + printf "%s\n" "#define HAVE_LIBMD 1" >>confdefs.h LIBS="-lmd $LIBS" @@ -21506,8 +22744,8 @@ fi saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_LIBMD" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_MD5_LIBMD... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_LIBMD" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_MD5_LIBMD... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21528,20 +22766,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_MD5=yes found_LIBMD=yes -$as_echo "#define ARCHIVE_CRYPTO_MD5_LIBMD 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_MD5_LIBMD 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21552,8 +22791,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_LIBMD" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_RMD160_LIBMD... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_RMD160_LIBMD" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_RMD160_LIBMD... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21574,20 +22813,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_RMD160=yes found_LIBMD=yes -$as_echo "#define ARCHIVE_CRYPTO_RMD160_LIBMD 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_RMD160_LIBMD 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21598,8 +22838,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_LIBMD" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA1_LIBMD... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_LIBMD" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA1_LIBMD... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21620,20 +22860,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA1=yes found_LIBMD=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA1_LIBMD 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA1_LIBMD 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21644,8 +22885,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBMD" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_LIBMD... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_LIBMD" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_LIBMD... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21666,20 +22907,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_LIBMD=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_LIBMD 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_LIBMD 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21690,8 +22932,8 @@ rm -f core conftest.err conftest.$ac_objext \ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" touch "check_crypto_md.h" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBMD" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_LIBMD... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_LIBMD" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_LIBMD... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21712,20 +22954,21 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_LIBMD=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_LIBMD 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_LIBMD 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" @@ -21739,8 +22982,8 @@ case "$host_os" in *mingw* | *cygwin* | *msys*) if test "$found_MD5" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_WIN" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_MD5_WIN... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_MD5_WIN" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_MD5_WIN... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21758,27 +23001,28 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_MD5=yes found_WIN=yes -$as_echo "#define ARCHIVE_CRYPTO_MD5_WIN 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_MD5_WIN 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi if test "$found_SHA1" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_WIN" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA1_WIN... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA1_WIN" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA1_WIN... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21796,27 +23040,28 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA1=yes found_WIN=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA1_WIN 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA1_WIN 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi if test "$found_SHA256" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_WIN" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA256_WIN... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA256_WIN" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA256_WIN... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21834,27 +23079,28 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA256=yes found_WIN=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA256_WIN 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA256_WIN 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi if test "$found_SHA384" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_WIN" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA384_WIN... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA384_WIN" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA384_WIN... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21872,27 +23118,28 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA384=yes found_WIN=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA384_WIN 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA384_WIN 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi if test "$found_SHA512" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_WIN" >&5 -$as_echo_n "checking support for ARCHIVE_CRYPTO_SHA512_WIN... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ARCHIVE_CRYPTO_SHA512_WIN" >&5 +printf %s "checking support for ARCHIVE_CRYPTO_SHA512_WIN... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -21910,26 +23157,57 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } found_SHA512=yes found_WIN=yes -$as_echo "#define ARCHIVE_CRYPTO_SHA512_WIN 1" >>confdefs.h +printf "%s\n" "#define ARCHIVE_CRYPTO_SHA512_WIN 1" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi ;; esac +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fvisibility=hidden -Werror" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiler supports visibility annotations" >&5 +printf %s "checking whether compiler supports visibility annotations... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + int foo( void ) __attribute__((visibility("default"))); + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + CFLAGS="$saved_CFLAGS -fvisibility=hidden -D__LIBARCHIVE_ENABLE_VISIBILITY"; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + CFLAGS="$saved_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + # Ensure test directories are present if building out-of-tree ac_config_commands="$ac_config_commands mkdirs" @@ -21961,8 +23239,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -21992,15 +23270,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -22014,8 +23292,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -22032,7 +23310,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -22043,14 +23321,14 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -22128,8 +23406,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -22152,14 +23430,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -22169,46 +23449,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -22217,13 +23497,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -22232,8 +23505,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -22245,30 +23522,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -22281,13 +23538,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -22314,18 +23572,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -22337,12 +23597,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -22373,7 +23634,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -22395,6 +23656,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -22408,6 +23673,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -22449,7 +23720,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -22458,7 +23729,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -22520,8 +23791,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libarchive $as_me 3.5.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by libarchive $as_me 3.6.2, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -22583,14 +23854,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -libarchive config.status 3.5.2 -configured by $0, generated by GNU Autoconf 2.69, +libarchive config.status 3.6.2 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -22630,15 +23903,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -22646,7 +23919,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -22655,7 +23928,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -22683,7 +23956,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -22697,7 +23970,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -23017,9 +24290,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -23355,7 +24628,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -23363,17 +24636,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -23390,7 +24663,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -23414,9 +24687,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -23478,8 +24751,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -23523,9 +24796,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -23541,20 +24814,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -23574,7 +24847,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -23594,8 +24867,8 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -23621,7 +24894,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -23633,7 +24906,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -23655,7 +24928,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -23680,10 +24953,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -24225,6 +25500,7 @@ _LT_EOF esac + ltmain=$ac_aux_dir/ltmain.sh @@ -24275,7 +25551,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff --git a/src/dependencies/libarchive-3.5.2/configure.ac b/src/dependencies/libarchive-3.6.2/configure.ac similarity index 96% rename from src/dependencies/libarchive-3.5.2/configure.ac rename to src/dependencies/libarchive-3.6.2/configure.ac index f59ada9..349e758 100644 --- a/src/dependencies/libarchive-3.5.2/configure.ac +++ b/src/dependencies/libarchive-3.6.2/configure.ac @@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front. dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[3.5.2]) -m4_define([LIBARCHIVE_VERSION_N],[3005002]) +m4_define([LIBARCHIVE_VERSION_S],[3.6.2]) +m4_define([LIBARCHIVE_VERSION_N],[3006002]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) @@ -378,6 +378,7 @@ if test "x$with_iconv" != "xno"; then AC_CHECK_HEADERS([localcharset.h]) am_save_LIBS="$LIBS" LIBS="${LIBS} ${LIBICONV}" + LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv" AC_CHECK_FUNCS([locale_charset]) LIBS="${am_save_LIBS}" if test "x$ac_cv_func_locale_charset" != "xyes"; then @@ -400,7 +401,9 @@ AC_ARG_WITH([zstd], if test "x$with_zstd" != "xno"; then AC_CHECK_HEADERS([zstd.h]) - AC_CHECK_LIB(zstd,ZSTD_compressStream) + AC_CHECK_LIB(zstd,ZSTD_decompressStream) + AC_CHECK_LIB(zstd,ZSTD_compressStream, + AC_DEFINE([HAVE_LIBZSTD_COMPRESSOR], [1], [Define to 1 if you have the `zstd' library (-lzstd) with compression support.])) fi AC_ARG_WITH([lzma], @@ -540,6 +543,22 @@ fi # Checks for supported compiler flags AX_APPEND_COMPILE_FLAGS([-Wall -Wformat -Wformat-security]) +# Place the functions and data into separate sections, allowing the linker +# to garbage collect the unused ones. +save_LDFLAGS=$LDFLAGS +LDFLAGS="$LDFLAGS -Wl,--gc-sections" +AC_MSG_CHECKING([whether ld supports --gc-sections]) +AC_LINK_IFELSE( + [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])], + [AC_MSG_RESULT([yes]) + GC_SECTIONS="-Wl,--gc-sections"; + AX_APPEND_COMPILE_FLAGS([-ffunction-sections -fdata-sections])], + [AC_MSG_RESULT([no]) + GC_SECTIONS="";]) +LDFLAGS=$save_LDFLAGS + +AC_SUBST(GC_SECTIONS) + # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST # la_TYPE_UID_T defaults to "int", which is incorrect for MinGW @@ -633,6 +652,9 @@ AC_CHECK_TYPE([wchar_t], AC_CHECK_SIZEOF([wchar_t])], []) +AX_COMPILE_CHECK_SIZEOF(int) +AX_COMPILE_CHECK_SIZEOF(long) + AC_HEADER_TIME # Checks for library functions. @@ -694,14 +716,14 @@ AC_CHECK_TYPES(struct statfs,,, # There are several variants of readdir_r around; we only # accept the POSIX-compliant version. -AC_COMPILE_IFELSE( +AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[DIR *dir; struct dirent e, *r; return(readdir_r(dir, &e, &r));]])], [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] ) # dirfd can be either a function or a macro. -AC_COMPILE_IFELSE( +AC_LINK_IFELSE( [AC_LANG_PROGRAM([[#include DIR *dir;]], [[return(dirfd(dir));]])], @@ -1188,24 +1210,8 @@ fi if test "x$with_openssl" != "xno"; then AC_CHECK_HEADERS([openssl/evp.h]) saved_LIBS=$LIBS - case "$host_os" in - *mingw* | *cygwin* | *msys*) - case "$host_cpu" in - x86_64) - AC_CHECK_LIB(eay64,OPENSSL_config) - if test "x$ac_cv_lib_eay64_main" != "xyes"; then - AC_CHECK_LIB(eay32,OPENSSL_config) - fi - ;; - *) - AC_CHECK_LIB(eay32,OPENSSL_config) - ;; - esac - ;; - *) - AC_CHECK_LIB(crypto,OPENSSL_config) - ;; - esac + LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libssl libcrypto" + AC_CHECK_LIB(crypto,OPENSSL_config) CRYPTO_CHECK(MD5, OPENSSL, md5) CRYPTO_CHECK(RMD160, OPENSSL, rmd160) CRYPTO_CHECK(SHA1, OPENSSL, sha1) @@ -1215,6 +1221,8 @@ if test "x$with_openssl" != "xno"; then AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) fi +AC_SUBST(LIBSREQUIRED) + # Probe libmd AFTER OpenSSL/libcrypto. # The two are incompatible and OpenSSL is more complete. AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) @@ -1239,6 +1247,18 @@ case "$host_os" in ;; esac +dnl Visibility annotations... +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fvisibility=hidden -Werror" +AC_MSG_CHECKING(whether compiler supports visibility annotations) +AC_LINK_IFELSE([AC_LANG_PROGRAM([ + int foo( void ) __attribute__((visibility("default"))); + ])], + [CFLAGS="$saved_CFLAGS -fvisibility=hidden -D__LIBARCHIVE_ENABLE_VISIBILITY"; + AC_MSG_RESULT(yes)], + [CFLAGS="$saved_CFLAGS" + AC_MSG_RESULT(no)]) + # Ensure test directories are present if building out-of-tree AC_CONFIG_COMMANDS([mkdirs], [mkdir -p libarchive/test tar/test cat/test cpio/test]) diff --git a/src/dependencies/libarchive-3.5.2/contrib/README b/src/dependencies/libarchive-3.6.2/contrib/README similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/README rename to src/dependencies/libarchive-3.6.2/contrib/README diff --git a/src/dependencies/libarchive-3.5.2/contrib/android/Android.mk b/src/dependencies/libarchive-3.6.2/contrib/android/Android.mk similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/android/Android.mk rename to src/dependencies/libarchive-3.6.2/contrib/android/Android.mk diff --git a/src/dependencies/libarchive-3.5.2/contrib/android/config/android.h b/src/dependencies/libarchive-3.6.2/contrib/android/config/android.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/android/config/android.h rename to src/dependencies/libarchive-3.6.2/contrib/android/config/android.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/android/config/linux_host.h b/src/dependencies/libarchive-3.6.2/contrib/android/config/linux_host.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/android/config/linux_host.h rename to src/dependencies/libarchive-3.6.2/contrib/android/config/linux_host.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/android/config/windows_host.h b/src/dependencies/libarchive-3.6.2/contrib/android/config/windows_host.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/android/config/windows_host.h rename to src/dependencies/libarchive-3.6.2/contrib/android/config/windows_host.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/android/include/Bcrypt.h b/src/dependencies/libarchive-3.6.2/contrib/android/include/Bcrypt.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/android/include/Bcrypt.h rename to src/dependencies/libarchive-3.6.2/contrib/android/include/Bcrypt.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/android/include/Windows.h b/src/dependencies/libarchive-3.6.2/contrib/android/include/Windows.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/android/include/Windows.h rename to src/dependencies/libarchive-3.6.2/contrib/android/include/Windows.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/android/include/android_lf.h b/src/dependencies/libarchive-3.6.2/contrib/android/include/android_lf.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/android/include/android_lf.h rename to src/dependencies/libarchive-3.6.2/contrib/android/include/android_lf.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/archivetest.c b/src/dependencies/libarchive-3.6.2/contrib/archivetest.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/archivetest.c rename to src/dependencies/libarchive-3.6.2/contrib/archivetest.c diff --git a/src/dependencies/libarchive-3.5.2/contrib/libarchive.1aix53.spec b/src/dependencies/libarchive-3.6.2/contrib/libarchive.1aix53.spec similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/libarchive.1aix53.spec rename to src/dependencies/libarchive-3.6.2/contrib/libarchive.1aix53.spec diff --git a/src/dependencies/libarchive-3.5.2/contrib/libarchive.spec b/src/dependencies/libarchive-3.6.2/contrib/libarchive.spec similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/libarchive.spec rename to src/dependencies/libarchive-3.6.2/contrib/libarchive.spec diff --git a/src/dependencies/libarchive-3.5.2/contrib/libarchive_autodetect-st_lib_archive.m4 b/src/dependencies/libarchive-3.6.2/contrib/libarchive_autodetect-st_lib_archive.m4 similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/libarchive_autodetect-st_lib_archive.m4 rename to src/dependencies/libarchive-3.6.2/contrib/libarchive_autodetect-st_lib_archive.m4 diff --git a/src/dependencies/libarchive-3.5.2/contrib/oss-fuzz/corpus.zip b/src/dependencies/libarchive-3.6.2/contrib/oss-fuzz/corpus.zip similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/oss-fuzz/corpus.zip rename to src/dependencies/libarchive-3.6.2/contrib/oss-fuzz/corpus.zip diff --git a/src/dependencies/libarchive-3.5.2/contrib/oss-fuzz/libarchive_fuzzer.cc b/src/dependencies/libarchive-3.6.2/contrib/oss-fuzz/libarchive_fuzzer.cc similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/oss-fuzz/libarchive_fuzzer.cc rename to src/dependencies/libarchive-3.6.2/contrib/oss-fuzz/libarchive_fuzzer.cc diff --git a/src/dependencies/libarchive-3.5.2/contrib/oss-fuzz/oss-fuzz-build.sh b/src/dependencies/libarchive-3.6.2/contrib/oss-fuzz/oss-fuzz-build.sh similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/oss-fuzz/oss-fuzz-build.sh rename to src/dependencies/libarchive-3.6.2/contrib/oss-fuzz/oss-fuzz-build.sh diff --git a/src/dependencies/libarchive-3.5.2/contrib/psota-benchmark/results.txt b/src/dependencies/libarchive-3.6.2/contrib/psota-benchmark/results.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/psota-benchmark/results.txt rename to src/dependencies/libarchive-3.6.2/contrib/psota-benchmark/results.txt diff --git a/src/dependencies/libarchive-3.5.2/contrib/psota-benchmark/tcp.sh b/src/dependencies/libarchive-3.6.2/contrib/psota-benchmark/tcp.sh similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/psota-benchmark/tcp.sh rename to src/dependencies/libarchive-3.6.2/contrib/psota-benchmark/tcp.sh diff --git a/src/dependencies/libarchive-3.5.2/contrib/shar/shar.1 b/src/dependencies/libarchive-3.6.2/contrib/shar/shar.1 similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/shar/shar.1 rename to src/dependencies/libarchive-3.6.2/contrib/shar/shar.1 diff --git a/src/dependencies/libarchive-3.5.2/contrib/shar/shar.c b/src/dependencies/libarchive-3.6.2/contrib/shar/shar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/shar/shar.c rename to src/dependencies/libarchive-3.6.2/contrib/shar/shar.c diff --git a/src/dependencies/libarchive-3.5.2/contrib/shar/tree.c b/src/dependencies/libarchive-3.6.2/contrib/shar/tree.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/shar/tree.c rename to src/dependencies/libarchive-3.6.2/contrib/shar/tree.c diff --git a/src/dependencies/libarchive-3.5.2/contrib/shar/tree.h b/src/dependencies/libarchive-3.6.2/contrib/shar/tree.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/shar/tree.h rename to src/dependencies/libarchive-3.6.2/contrib/shar/tree.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/shar/tree_config.h b/src/dependencies/libarchive-3.6.2/contrib/shar/tree_config.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/contrib/shar/tree_config.h rename to src/dependencies/libarchive-3.6.2/contrib/shar/tree_config.h diff --git a/src/dependencies/libarchive-3.5.2/contrib/untar.c b/src/dependencies/libarchive-3.6.2/contrib/untar.c similarity index 95% rename from src/dependencies/libarchive-3.5.2/contrib/untar.c rename to src/dependencies/libarchive-3.6.2/contrib/untar.c index 3d954f6..2550e51 100644 --- a/src/dependencies/libarchive-3.5.2/contrib/untar.c +++ b/src/dependencies/libarchive-3.6.2/contrib/untar.c @@ -36,6 +36,10 @@ /* This is for mkdir(); this may need to be changed for some platforms. */ #include /* For mkdir() */ +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#endif + /* Parse an octal number, ignoring leading and trailing nonsense. */ static int parseoct(const char *p, size_t n) @@ -78,7 +82,11 @@ create_dir(char *pathname, int mode) pathname[strlen(pathname) - 1] = '\0'; /* Try creating the directory. */ +#if defined(_WIN32) && !defined(__CYGWIN__) + r = _mkdir(pathname); +#else r = mkdir(pathname, mode); +#endif if (r != 0) { /* On failure, try creating parent directory. */ @@ -87,7 +95,11 @@ create_dir(char *pathname, int mode) *p = '\0'; create_dir(pathname, 0755); *p = '/'; +#if defined(_WIN32) && !defined(__CYGWIN__) + r = _mkdir(pathname); +#else r = mkdir(pathname, mode); +#endif } } if (r != 0) diff --git a/src/dependencies/libarchive-3.5.2/cpio/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/cpio/CMakeLists.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/cpio/CMakeLists.txt diff --git a/src/dependencies/libarchive-3.5.2/cpio/bsdcpio.1 b/src/dependencies/libarchive-3.6.2/cpio/bsdcpio.1 similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/bsdcpio.1 rename to src/dependencies/libarchive-3.6.2/cpio/bsdcpio.1 diff --git a/src/dependencies/libarchive-3.5.2/cpio/cmdline.c b/src/dependencies/libarchive-3.6.2/cpio/cmdline.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/cmdline.c rename to src/dependencies/libarchive-3.6.2/cpio/cmdline.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/config_freebsd.h b/src/dependencies/libarchive-3.6.2/cpio/config_freebsd.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/config_freebsd.h rename to src/dependencies/libarchive-3.6.2/cpio/config_freebsd.h diff --git a/src/dependencies/libarchive-3.5.2/cpio/cpio.c b/src/dependencies/libarchive-3.6.2/cpio/cpio.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/cpio.c rename to src/dependencies/libarchive-3.6.2/cpio/cpio.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/cpio.h b/src/dependencies/libarchive-3.6.2/cpio/cpio.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/cpio.h rename to src/dependencies/libarchive-3.6.2/cpio/cpio.h diff --git a/src/dependencies/libarchive-3.5.2/cpio/cpio_platform.h b/src/dependencies/libarchive-3.6.2/cpio/cpio_platform.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/cpio_platform.h rename to src/dependencies/libarchive-3.6.2/cpio/cpio_platform.h diff --git a/src/dependencies/libarchive-3.5.2/cpio/cpio_windows.c b/src/dependencies/libarchive-3.6.2/cpio/cpio_windows.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/cpio_windows.c rename to src/dependencies/libarchive-3.6.2/cpio/cpio_windows.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/cpio_windows.h b/src/dependencies/libarchive-3.6.2/cpio/cpio_windows.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/cpio_windows.h rename to src/dependencies/libarchive-3.6.2/cpio/cpio_windows.h diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/cpio/test/CMakeLists.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/cpio/test/CMakeLists.txt diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/list.h b/src/dependencies/libarchive-3.6.2/cpio/test/list.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/list.h rename to src/dependencies/libarchive-3.6.2/cpio/test/list.h index 92f9ec8..9c170a0 100644 --- a/src/dependencies/libarchive-3.5.2/cpio/test/list.h +++ b/src/dependencies/libarchive-3.6.2/cpio/test/list.h @@ -1,34 +1,35 @@ DEFINE_TEST(test_0) DEFINE_TEST(test_basic) DEFINE_TEST(test_cmdline) +DEFINE_TEST(test_extract_cpio_Z) DEFINE_TEST(test_extract_cpio_bz2) DEFINE_TEST(test_extract_cpio_grz) DEFINE_TEST(test_extract_cpio_gz) DEFINE_TEST(test_extract_cpio_lrz) -DEFINE_TEST(test_extract_cpio_lz4) DEFINE_TEST(test_extract_cpio_lz) +DEFINE_TEST(test_extract_cpio_lz4) DEFINE_TEST(test_extract_cpio_lzma) DEFINE_TEST(test_extract_cpio_lzo) DEFINE_TEST(test_extract_cpio_xz) -DEFINE_TEST(test_extract_cpio_Z) DEFINE_TEST(test_extract_cpio_zstd) DEFINE_TEST(test_format_newc) DEFINE_TEST(test_gcpio_compat) DEFINE_TEST(test_missing_file) DEFINE_TEST(test_option_0) +DEFINE_TEST(test_option_B_upper) +DEFINE_TEST(test_option_C_upper) +DEFINE_TEST(test_option_J_upper) +DEFINE_TEST(test_option_L_upper) +DEFINE_TEST(test_option_Z_upper) DEFINE_TEST(test_option_a) DEFINE_TEST(test_option_b64encode) -DEFINE_TEST(test_option_B_upper) DEFINE_TEST(test_option_c) -DEFINE_TEST(test_option_C_upper) DEFINE_TEST(test_option_d) DEFINE_TEST(test_option_f) DEFINE_TEST(test_option_grzip) DEFINE_TEST(test_option_help) -DEFINE_TEST(test_option_J_upper) DEFINE_TEST(test_option_l) DEFINE_TEST(test_option_lrzip) -DEFINE_TEST(test_option_L_upper) DEFINE_TEST(test_option_lz4) DEFINE_TEST(test_option_lzma) DEFINE_TEST(test_option_lzop) @@ -42,7 +43,6 @@ DEFINE_TEST(test_option_xz) DEFINE_TEST(test_option_y) DEFINE_TEST(test_option_z) DEFINE_TEST(test_option_zstd) -DEFINE_TEST(test_option_Z_upper) DEFINE_TEST(test_owner_parse) DEFINE_TEST(test_passthrough_dotdot) DEFINE_TEST(test_passthrough_reverse) diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test.h b/src/dependencies/libarchive-3.6.2/cpio/test/test.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test.h rename to src/dependencies/libarchive-3.6.2/cpio/test/test.h diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_0.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_0.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_0.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_0.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_basic.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_basic.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_basic.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_basic.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_cmdline.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_cmdline.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_cmdline.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_cmdline.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.Z.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.Z.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.bz2.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.bz2.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.bz2.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.bz2.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.grz.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.grz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.grz.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.grz.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.gz.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.gz.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lrz.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lrz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lrz.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lrz.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lz.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lz.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lz.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lz4.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lz4.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lzma.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lzma.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lzma.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lzma.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lzo.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lzo.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.lzo.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.lzo.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.xz.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.xz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.xz.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.xz.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.zst.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.zst.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract.cpio.zst.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract.cpio.zst.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_Z.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_Z.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_Z.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_Z.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_bz2.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_bz2.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_bz2.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_bz2.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_grz.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_grz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_grz.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_grz.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_gz.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_gz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_gz.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_gz.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lrz.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lrz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lrz.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lrz.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lz.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lz.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lz.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lz4.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lz4.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lzma.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lzma.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lzma.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lzma.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lzo.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lzo.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_lzo.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_lzo.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_xz.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_xz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_xz.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_xz.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_zstd.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_zstd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_extract_cpio_zstd.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_extract_cpio_zstd.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_format_newc.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_format_newc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_format_newc.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_format_newc.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.bin.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.bin.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.bin.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.bin.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.crc.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.crc.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.crc.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.crc.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.newc.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.newc.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.newc.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.newc.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.ustar.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.ustar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref.ustar.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref.ustar.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.bin.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.bin.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.bin.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.bin.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.crc.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.crc.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.crc.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.crc.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.newc.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.newc.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.newc.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.newc.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_missing_file.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_missing_file.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_missing_file.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_missing_file.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_0.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_0.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_0.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_0.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_B_upper.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_B_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_B_upper.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_B_upper.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_C_upper.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_C_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_C_upper.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_C_upper.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_J_upper.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_J_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_J_upper.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_J_upper.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_L_upper.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_L_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_L_upper.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_L_upper.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_Z_upper.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_Z_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_Z_upper.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_Z_upper.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_a.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_a.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_a.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_a.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_b64encode.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_b64encode.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_b64encode.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_b64encode.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_c.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_c.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_c.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_c.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_d.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_d.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_d.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_d.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_f.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_f.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_f.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_f.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_f.cpio.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_f.cpio.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_f.cpio.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_f.cpio.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_grzip.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_grzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_grzip.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_grzip.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_help.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_help.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_help.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_help.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_l.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_l.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_l.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_l.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_lrzip.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_lrzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_lrzip.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_lrzip.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_lz4.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_lz4.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_lzma.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_lzma.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_lzma.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_lzma.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_lzop.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_lzop.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_lzop.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_lzop.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_m.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_m.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_m.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_m.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_m.cpio.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_m.cpio.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_m.cpio.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_m.cpio.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_passphrase.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_passphrase.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_passphrase.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_passphrase.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_passphrase.zip.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_passphrase.zip.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_passphrase.zip.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_passphrase.zip.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_t.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_t.c similarity index 86% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_t.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_t.c index eaa73fa..0f2dda2 100644 --- a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_t.c +++ b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_t.c @@ -36,6 +36,14 @@ DEFINE_TEST(test_option_t) time_t mtime; char date[32]; char date2[32]; + struct tm *tmptr; +#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S) + struct tm tmbuf; +#endif +#if defined(HAVE__LOCALTIME64_S) + errno_t terr; + __time64_t tmptime; +#endif /* List reference archive, make sure the TOC is correct. */ extract_reference_file("test_option_t.cpio"); @@ -87,11 +95,23 @@ DEFINE_TEST(test_option_t) #ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); #endif +#if defined(HAVE_LOCALTIME_R) + tmptr = localtime_r(&mtime, &tmbuf); +#elif defined(HAVE__LOCALTIME64_S) + tmptime = mtime; + terr = _localtime64_s(&tmbuf, &tmptime); + if (terr) + tmptr = NULL; + else + tmptr = &tmbuf; +#else + tmptr = localtime(&mtime); +#endif #if defined(_WIN32) && !defined(__CYGWIN__) - strftime(date2, sizeof(date2)-1, "%b %d %Y", localtime(&mtime)); + strftime(date2, sizeof(date2)-1, "%b %d %Y", tmptr); _snprintf(date, sizeof(date)-1, "%12.12s file", date2); #else - strftime(date2, sizeof(date2)-1, "%b %e %Y", localtime(&mtime)); + strftime(date2, sizeof(date2)-1, "%b %e %Y", tmptr); snprintf(date, sizeof(date)-1, "%12.12s file", date2); #endif assertEqualMem(p + 42, date, strlen(date)); diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_t.cpio.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_t.cpio.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_t.cpio.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_t.cpio.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_t.stdout.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_t.stdout.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_t.stdout.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_t.stdout.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_tv.stdout.uu b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_tv.stdout.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_tv.stdout.uu rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_tv.stdout.uu diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_u.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_u.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_u.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_u.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_uuencode.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_uuencode.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_uuencode.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_uuencode.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_version.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_version.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_version.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_version.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_xz.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_xz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_xz.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_xz.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_y.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_y.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_y.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_y.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_z.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_z.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_z.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_z.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_option_zstd.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_option_zstd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_option_zstd.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_option_zstd.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_owner_parse.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_owner_parse.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_owner_parse.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_owner_parse.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_passthrough_dotdot.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_passthrough_dotdot.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_passthrough_dotdot.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_passthrough_dotdot.c diff --git a/src/dependencies/libarchive-3.5.2/cpio/test/test_passthrough_reverse.c b/src/dependencies/libarchive-3.6.2/cpio/test/test_passthrough_reverse.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/cpio/test/test_passthrough_reverse.c rename to src/dependencies/libarchive-3.6.2/cpio/test/test_passthrough_reverse.c diff --git a/src/dependencies/libarchive-3.5.2/doc/html/.ignore_me b/src/dependencies/libarchive-3.6.2/doc/html/.ignore_me similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/html/.ignore_me rename to src/dependencies/libarchive-3.6.2/doc/html/.ignore_me diff --git a/src/dependencies/libarchive-3.5.2/doc/html/Makefile b/src/dependencies/libarchive-3.6.2/doc/html/Makefile similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/Makefile rename to src/dependencies/libarchive-3.6.2/doc/html/Makefile index 5fdc652..d15a786 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/Makefile +++ b/src/dependencies/libarchive-3.6.2/doc/html/Makefile @@ -107,15 +107,15 @@ archive_write_set_passphrase.3.html: ../../libarchive/archive_write_set_passphra cpio.5.html: ../../libarchive/cpio.5 groff -mdoc -T html ../../libarchive/cpio.5 > cpio.5.html +libarchive-formats.5.html: ../../libarchive/libarchive-formats.5 + groff -mdoc -T html ../../libarchive/libarchive-formats.5 > libarchive-formats.5.html + libarchive.3.html: ../../libarchive/libarchive.3 groff -mdoc -T html ../../libarchive/libarchive.3 > libarchive.3.html libarchive_changes.3.html: ../../libarchive/libarchive_changes.3 groff -mdoc -T html ../../libarchive/libarchive_changes.3 > libarchive_changes.3.html -libarchive-formats.5.html: ../../libarchive/libarchive-formats.5 - groff -mdoc -T html ../../libarchive/libarchive-formats.5 > libarchive-formats.5.html - libarchive_internals.3.html: ../../libarchive/libarchive_internals.3 groff -mdoc -T html ../../libarchive/libarchive_internals.3 > libarchive_internals.3.html @@ -130,4 +130,4 @@ bsdtar.1.html: ../../tar/bsdtar.1 bsdcpio.1.html: ../../cpio/bsdcpio.1 groff -mdoc -T html ../../cpio/bsdcpio.1 > bsdcpio.1.html -all: archive_entry.3.html archive_entry_acl.3.html archive_entry_linkify.3.html archive_entry_misc.3.html archive_entry_paths.3.html archive_entry_perms.3.html archive_entry_stat.3.html archive_entry_time.3.html archive_read.3.html archive_read_add_passphrase.3.html archive_read_data.3.html archive_read_disk.3.html archive_read_extract.3.html archive_read_filter.3.html archive_read_format.3.html archive_read_free.3.html archive_read_header.3.html archive_read_new.3.html archive_read_open.3.html archive_read_set_options.3.html archive_util.3.html archive_write.3.html archive_write_blocksize.3.html archive_write_data.3.html archive_write_disk.3.html archive_write_filter.3.html archive_write_finish_entry.3.html archive_write_format.3.html archive_write_free.3.html archive_write_header.3.html archive_write_new.3.html archive_write_open.3.html archive_write_set_options.3.html archive_write_set_passphrase.3.html cpio.5.html libarchive.3.html libarchive_changes.3.html libarchive-formats.5.html libarchive_internals.3.html mtree.5.html tar.5.html bsdtar.1.html bsdcpio.1.html +all: archive_entry.3.html archive_entry_acl.3.html archive_entry_linkify.3.html archive_entry_misc.3.html archive_entry_paths.3.html archive_entry_perms.3.html archive_entry_stat.3.html archive_entry_time.3.html archive_read.3.html archive_read_add_passphrase.3.html archive_read_data.3.html archive_read_disk.3.html archive_read_extract.3.html archive_read_filter.3.html archive_read_format.3.html archive_read_free.3.html archive_read_header.3.html archive_read_new.3.html archive_read_open.3.html archive_read_set_options.3.html archive_util.3.html archive_write.3.html archive_write_blocksize.3.html archive_write_data.3.html archive_write_disk.3.html archive_write_filter.3.html archive_write_finish_entry.3.html archive_write_format.3.html archive_write_free.3.html archive_write_header.3.html archive_write_new.3.html archive_write_open.3.html archive_write_set_options.3.html archive_write_set_passphrase.3.html cpio.5.html libarchive-formats.5.html libarchive.3.html libarchive_changes.3.html libarchive_internals.3.html mtree.5.html tar.5.html bsdtar.1.html bsdcpio.1.html diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry.3.html index f0d0023..1a290a7 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_acl.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_acl.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry_acl.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry_acl.3.html index fe89601..38b01ab 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_acl.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_acl.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_linkify.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_linkify.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry_linkify.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry_linkify.3.html index c6f214c..c5d862d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_linkify.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_linkify.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_misc.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_misc.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry_misc.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry_misc.3.html index a0365c1..9802419 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_misc.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_misc.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_paths.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_paths.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry_paths.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry_paths.3.html index 127c394..ba90e2c 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_paths.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_paths.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_perms.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_perms.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry_perms.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry_perms.3.html index 7a912cd..8190857 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_perms.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_perms.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_stat.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_stat.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry_stat.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry_stat.3.html index 5b0e476..7ea2698 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_stat.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_stat.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_time.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_time.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_entry_time.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_entry_time.3.html index fd62535..78e8048 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_entry_time.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_entry_time.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read.3.html index 13a14b1..2c5d8b9 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_add_passphrase.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_add_passphrase.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_add_passphrase.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_add_passphrase.3.html index d39b665..a706623 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_add_passphrase.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_add_passphrase.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_data.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_data.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_data.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_data.3.html index a610e15..375809a 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_data.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_data.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_disk.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_disk.3.html similarity index 71% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_disk.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_disk.3.html index c1dc2d6..710bb0a 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_disk.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_disk.3.html @@ -1,5 +1,5 @@ - + @@ -26,6 +26,8 @@ ARCHIVE_READ_DISK(3)

NAME

archive_read_disk_new, +archive_read_disk_open, +archive_read_disk_open_w, archive_read_disk_set_behavior, archive_read_disk_set_symlink_logical, archive_read_disk_set_symlink_physical, @@ -35,8 +37,15 @@ ARCHIVE_READ_DISK(3)

archive_read_disk_uname, archive_read_disk_set_uname_lookup, archive_read_disk_set_gname_lookup, -archive_read_disk_set_standard_lookup — -functions for reading objects from disk

+archive_read_disk_set_standard_lookup, +archive_read_disk_descend, +archive_read_disk_can_descend, +archive_read_disk_current_filesystem, +archive_read_disk_current_filesystem_is_synthetic, +archive_read_disk_current_filesystem_is_remote, +archive_read_disk_set_matching, +archive_read_disk_set_metadata_filter_callback, +— functions for reading objects from disk

LIBRARY

@@ -57,6 +66,18 @@ archive *

int

+

archive_read_disk_open(struct archive *, +const char *);

+ +

int

+ + +

archive_read_disk_open_w(struct archive *, +const wchar_t *);

+ +

int

+ +

archive_read_disk_set_behavior(struct archive *, int);

@@ -117,6 +138,46 @@ archive *

struct archive_entry *, int fd, const struct stat *);

+

int

+ + +

archive_read_disk_descend(struct archive *);

+ +

int

+ + +

archive_read_disk_can_descend(struct archive *);

+ +

int

+ + +

archive_read_disk_current_filesystem(struct archive *);

+ +

int

+ + +

archive_read_disk_current_filesystem_is_synthetic(struct archive *);

+ +

int

+ + +

archive_read_disk_current_filesystem_is_remote(struct archive *);

+ +

int

+ + +

archive_read_disk_set_matching(struct archive *, +struct archive *, +void (*excluded_func)(struct archive *, void *, struct archive entry *), +void *);

+ +

int

+ + +

archive_read_disk_set_metadata_filter_callback(struct archive *, +int (*metadata_filter_func)(struct archive *, void*, struct archive_entry *), +void *);

+

DESCRIPTION

These functions provide an API @@ -132,6 +193,20 @@ struct archive object suitable for reading object information from disk.

+

archive_read_disk_open()

+ +

Opens the file or directory +from the given path and prepares the struct archive to read +it from disk.

+ + +

archive_read_disk_open_w()

+ +

Opens the file or directory +from the given path as a wide character string and prepares +the struct archive to read it from disk.

+ +

archive_read_disk_set_behavior()

Configures various behavior @@ -182,6 +257,12 @@ extended file attributes.

traversed files. By default, access time of traversed files is not restored.

+

ARCHIVE_READDISK_NO_SPARSE

+ +

Do not read sparse file +information. By default, sparse file information is read +from disk.

+

archive_read_disk_set_symlink_logical(), archive_read_disk_set_symlink_physical(), @@ -255,6 +336,65 @@ group names using the currently-registered lookup functions above. This affects the file ownership fields and ACL values in the struct archive_entry object.

+ +

archive_read_disk_descend()

+ +

If the current entry can be +descended, this function will mark the directory as the next +entry for archive_read_header(3) to visit.

+ + +

archive_read_disk_can_descend()

+ +

Returns 1 if the current entry +is an unvisited directory and 0 otherwise.

+ + +

archive_read_disk_current_filesystem()

+ +

Returns the index of the most +recent filesystem entry that has been visited through +archive_read_disk

+ + +

archive_read_disk_current_filesystem_is_synthetic()

+ +

Returns 1 if the current +filesystem is a virtual filesystem. Returns 0 if the current +filesystem is not a virtual filesystem. Returns -1 if it is +unknown.

+ + +

archive_read_disk_current_filesystem_is_remote()

+ +

Returns 1 if the current +filesystem is a remote filesystem. Returns 0 if the current +filesystem is not a remote filesystem. Returns -1 if it is +unknown.

+ + +

archive_read_disk_set_matching()

+ +

Allows the caller to set struct +archive *_ma to compare each entry during +archive_read_header(3) calls. If matched based on calls to +archive_match_path_excluded, archive_match_time_excluded, or +archive_match_owner_excluded, then the callback function +specified by the _excluded_func parameter will execute. This +function will recieve data provided to the fourth parameter, +void *_client_data.

+ + +

archive_read_disk_set_metadata_filter_callback()

+ +

Allows the caller to set a +callback function during calls to archive_read_header(3) to +filter out metadata for each entry. The callback function +recieves the struct archive object, void* custom filter +data, and the struct archive_entry. If the callback function +returns an error, ARCHIVE_RETRY will be returned and the +entry will not be further processed.

+

More information about the struct archive object and the overall design of the library can be found in the libarchive(3) overview.

diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_extract.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_extract.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_extract.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_extract.3.html index c98352c..4518d58 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_extract.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_extract.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_filter.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_filter.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_filter.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_filter.3.html index d38e9df..3d5768e 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_filter.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_filter.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_format.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_format.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_format.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_format.3.html index cbc8261..18a5ed4 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_format.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_format.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_free.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_free.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_free.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_free.3.html index 2f54cca..8c8db9b 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_free.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_free.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_header.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_header.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_header.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_header.3.html index e6711d6..1ff31af 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_header.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_header.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_new.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_new.3.html similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_new.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_new.3.html index 3cd3b64..b8d0dd8 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_new.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_new.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_open.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_open.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_open.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_open.3.html index 0ed14df..0a98cf4 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_open.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_open.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_set_options.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_set_options.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_read_set_options.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_read_set_options.3.html index ce14464..8a5ad07 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_read_set_options.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_read_set_options.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_util.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_util.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_util.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_util.3.html index acd2ee7..61522d5 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_util.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_util.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write.3.html index 9657293..7bbe17f 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_blocksize.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_blocksize.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_blocksize.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_blocksize.3.html index e87406f..6f29624 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_blocksize.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_blocksize.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_data.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_data.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_data.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_data.3.html index 3a6c693..9f02ba9 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_data.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_data.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_disk.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_disk.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_disk.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_disk.3.html index 9d8aaad..a029620 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_disk.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_disk.3.html @@ -1,5 +1,5 @@ - + @@ -198,17 +198,17 @@ whose final location would be altered by a symlink on disk. This is intended to help guard against a variety of mischief caused by archives that (deliberately or otherwise) extract files outside of the current directory. The default is not -to perform this check. If

+to perform this check. If ARCHIVE_EXTRACT_UNLINK is +specified together with this option, the library will remove +any intermediate symlinks it finds and return an error only +if such symlink could not be removed.

ARCHIVE_EXTRACT_SPARSE

Scan data for blocks of NUL bytes and try to recreate them with holes. This results in sparse files, independent of whether the archive format -supports or uses them. ARCHIVE_EXTRACT_UNLINK is -specified together with this option, the library will remove -any intermediate symlinks it finds and return an error only -if such symlink could not be removed.

+supports or uses them.

ARCHIVE_EXTRACT_TIME

diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_filter.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_filter.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_filter.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_filter.3.html index a1b24ef..d1eebe9 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_filter.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_filter.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_finish_entry.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_finish_entry.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_finish_entry.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_finish_entry.3.html index 843e0b0..2c6cddd 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_finish_entry.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_finish_entry.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_format.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_format.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_format.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_format.3.html index 50f5bd1..30de938 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_format.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_format.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_free.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_free.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_free.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_free.3.html index e3c2621..6b941b3 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_free.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_free.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_header.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_header.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_header.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_header.3.html index 9195154..50c27df 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_header.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_header.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_new.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_new.3.html similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_new.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_new.3.html index c02916f..5aaa246 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_new.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_new.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_open.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_open.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_open.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_open.3.html index 01f3603..465ac6e 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_open.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_open.3.html @@ -1,5 +1,5 @@ - + @@ -221,7 +221,7 @@ processing is complete. If the open callback fails, the close callback is not invoked. The callback should return ARCHIVE_OK on success. On failure, the callback should invoke archive_set_error() to register an -error code and message and return

+error code and message and return ARCHIVE_FATAL.

typedef int archive_free_callback(struct archive diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_set_options.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_set_options.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_set_options.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_set_options.3.html index 1c23d5e..cf19860 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_set_options.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_set_options.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_set_passphrase.3.html b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_set_passphrase.3.html similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/html/archive_write_set_passphrase.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/archive_write_set_passphrase.3.html index 30734c9..be16d9c 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/archive_write_set_passphrase.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/archive_write_set_passphrase.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/bsdcpio.1.html b/src/dependencies/libarchive-3.6.2/doc/html/bsdcpio.1.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/bsdcpio.1.html rename to src/dependencies/libarchive-3.6.2/doc/html/bsdcpio.1.html index d68897c..9719392 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/bsdcpio.1.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/bsdcpio.1.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/bsdtar.1.html b/src/dependencies/libarchive-3.6.2/doc/html/bsdtar.1.html similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/html/bsdtar.1.html rename to src/dependencies/libarchive-3.6.2/doc/html/bsdtar.1.html index 7ae3e72..5507ce4 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/bsdtar.1.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/bsdtar.1.html @@ -1,5 +1,5 @@ - + @@ -534,6 +534,12 @@ attributes using copyfile(3) in AppleDouble format. This is the reverse of --mac-metadata. and the default behavior if tar is run as non-root in x mode.

+

--no-read-sparse

+ +

(c, r, u modes only) Do not +read sparse file information from disk. This is the reverse +of --read-sparse.

+

--no-safe-writes

(x mode only) Do not create @@ -736,6 +742,13 @@ improve compression ratio.

the zstd compression level. Supported values depend on the library version, common values are from 1 to 22.

+

zstd:threads

+ +

Specify the number of worker +threads to use. Setting threads to a special value 0 makes +zstd(1) use as many threads as there are CPU cores on the +system.

+

lzop:compression-level

A decimal integer from 1 to 9 @@ -746,6 +759,13 @@ specifying the lzop compression level.

A decimal integer from 0 to 9 specifying the xz compression level.

+

xz:threads

+ +

Specify the number of worker +threads to use. Setting threads to a special value 0 makes +xz(1) use as many threads as there are CPU cores on the +system.

+

mtree:keyword

The mtree writer module allows @@ -856,6 +876,12 @@ entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a performance optimization.

+

--read-sparse

+ +

(c, r, u modes only) Read +sparse file information from disk. This is the reverse of +--no-read-sparse and the default behavior.

+

-S

(x mode only) @@ -1043,31 +1069,31 @@ variables affect the execution of tar:

TAR_READER_OPTIONS

-

The default options for format +

The default options for format readers and compression readers. The --options option overrides this.

TAR_WRITER_OPTIONS

-

The default options for format +

The default options for format writers and compression writers. The --options option overrides this.

LANG

-

The locale to +

The locale to use. See environ(7) for more information.

TAPE

-

The default +

The default device. The -f option overrides this. Please see the description of the -f option above for more details.

TZ

-

The timezone to +

The timezone to use when displaying dates. See environ(7) for more information.

diff --git a/src/dependencies/libarchive-3.5.2/doc/html/cpio.5.html b/src/dependencies/libarchive-3.6.2/doc/html/cpio.5.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/cpio.5.html rename to src/dependencies/libarchive-3.6.2/doc/html/cpio.5.html index 672be05..f1e897d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/cpio.5.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/cpio.5.html @@ -1,5 +1,5 @@ - + @@ -434,7 +434,7 @@ part of the specification for the pax(1) utility.

written by Dick Haight while working in AT&T’s Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the “Programmer’s Work Bench” derived -from AT&T UNIX 6th Edition UNIX that was used internally +from Version 6 AT&T UNIX that was used internally at AT&T. Both the new binary and old character formats were in use by 1980, according to the System III source released by SCO under their “Ancient Unix” diff --git a/src/dependencies/libarchive-3.5.2/doc/html/libarchive-formats.5.html b/src/dependencies/libarchive-3.6.2/doc/html/libarchive-formats.5.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/libarchive-formats.5.html rename to src/dependencies/libarchive-3.6.2/doc/html/libarchive-formats.5.html index 037207b..9a6b204 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/libarchive-formats.5.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/libarchive-formats.5.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/libarchive.3.html b/src/dependencies/libarchive-3.6.2/doc/html/libarchive.3.html similarity index 92% rename from src/dependencies/libarchive-3.5.2/doc/html/libarchive.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/libarchive.3.html index 647e86a..803d066 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/libarchive.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/libarchive.3.html @@ -1,5 +1,5 @@ - + @@ -71,12 +71,7 @@ formats,

-

ISO9660 CD images (including -RockRidge and Joliet extensions),

- -

- -

Zip archives,

+

7-Zip archives,

@@ -89,6 +84,11 @@ and BSD extensions),

+

ISO9660 CD images (including +RockRidge and Joliet extensions),

+ +

+

LHA archives,

@@ -98,17 +98,28 @@ descriptions,

-

RAR archives,

+

RAR and most RAR5 archives,

-

XAR archives.

+

WARC archives,

+ +

+ +

XAR archives,

+ +

+ +

Zip archives.

The library automatically -detects archives compressed with gzip(1), bzip2(1), xz(1), -lzip(1), or compress(1) and decompresses them transparently. -It can similarly detect and decode archives processed with -uuencode(1) or which have an rpm(1) header.

+detects archives compressed with compress(1), bzip2(1), +grzip(1), gzip(1), lrzip(1), lz4(1), lzip(1), lzop(1), +xz(1), or zstd(1) and decompresses them transparently. +Decompression of some formats requires external decompressor +utilities. It can similarly detect and decode archives +processed with uuencode(1) or which have an rpm(1) +header.

When writing an archive, you can specify the compression to be used and the @@ -130,7 +141,11 @@ format” archives,

-

Zip archive,

+

7-Zip archives,

+ +

+ +

ar archives,

@@ -143,20 +158,16 @@ archives,

-

7-Zip archives,

- -

- -

ar archives,

- -

-

mtree file tree descriptions,

-

XAR archives.

+

XAR archives,

+ +

+ +

Zip archive.

Pax interchange format is an extension of the tar archive format that eliminates diff --git a/src/dependencies/libarchive-3.5.2/doc/html/libarchive_changes.3.html b/src/dependencies/libarchive-3.6.2/doc/html/libarchive_changes.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/libarchive_changes.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/libarchive_changes.3.html index 0ac6352..d53a5ae 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/libarchive_changes.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/libarchive_changes.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/libarchive_internals.3.html b/src/dependencies/libarchive-3.6.2/doc/html/libarchive_internals.3.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/libarchive_internals.3.html rename to src/dependencies/libarchive-3.6.2/doc/html/libarchive_internals.3.html index 2220bca..2aabffc 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/libarchive_internals.3.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/libarchive_internals.3.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/mtree.5.html b/src/dependencies/libarchive-3.6.2/doc/html/mtree.5.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/mtree.5.html rename to src/dependencies/libarchive-3.6.2/doc/html/mtree.5.html index 812aba3..d33fc9f 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/mtree.5.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/mtree.5.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/html/tar.5.html b/src/dependencies/libarchive-3.6.2/doc/html/tar.5.html similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/html/tar.5.html rename to src/dependencies/libarchive-3.6.2/doc/html/tar.5.html index d009950..2ed3045 100644 --- a/src/dependencies/libarchive-3.5.2/doc/html/tar.5.html +++ b/src/dependencies/libarchive-3.6.2/doc/html/tar.5.html @@ -1,5 +1,5 @@ - + diff --git a/src/dependencies/libarchive-3.5.2/doc/man/.ignore_me b/src/dependencies/libarchive-3.6.2/doc/man/.ignore_me similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/.ignore_me rename to src/dependencies/libarchive-3.6.2/doc/man/.ignore_me diff --git a/src/dependencies/libarchive-3.5.2/doc/man/Makefile b/src/dependencies/libarchive-3.6.2/doc/man/Makefile similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/man/Makefile rename to src/dependencies/libarchive-3.6.2/doc/man/Makefile index 82bac3b..1d56a6d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/man/Makefile +++ b/src/dependencies/libarchive-3.6.2/doc/man/Makefile @@ -107,15 +107,15 @@ archive_write_set_passphrase.3: ../mdoc2man.awk ../../libarchive/archive_write_s cpio.5: ../mdoc2man.awk ../../libarchive/cpio.5 awk -f ../mdoc2man.awk < ../../libarchive/cpio.5 > cpio.5 +libarchive-formats.5: ../mdoc2man.awk ../../libarchive/libarchive-formats.5 + awk -f ../mdoc2man.awk < ../../libarchive/libarchive-formats.5 > libarchive-formats.5 + libarchive.3: ../mdoc2man.awk ../../libarchive/libarchive.3 awk -f ../mdoc2man.awk < ../../libarchive/libarchive.3 > libarchive.3 libarchive_changes.3: ../mdoc2man.awk ../../libarchive/libarchive_changes.3 awk -f ../mdoc2man.awk < ../../libarchive/libarchive_changes.3 > libarchive_changes.3 -libarchive-formats.5: ../mdoc2man.awk ../../libarchive/libarchive-formats.5 - awk -f ../mdoc2man.awk < ../../libarchive/libarchive-formats.5 > libarchive-formats.5 - libarchive_internals.3: ../mdoc2man.awk ../../libarchive/libarchive_internals.3 awk -f ../mdoc2man.awk < ../../libarchive/libarchive_internals.3 > libarchive_internals.3 @@ -130,4 +130,4 @@ bsdtar.1: ../mdoc2man.awk ../../tar/bsdtar.1 bsdcpio.1: ../mdoc2man.awk ../../cpio/bsdcpio.1 awk -f ../mdoc2man.awk < ../../cpio/bsdcpio.1 > bsdcpio.1 -all: archive_entry.3 archive_entry_acl.3 archive_entry_linkify.3 archive_entry_misc.3 archive_entry_paths.3 archive_entry_perms.3 archive_entry_stat.3 archive_entry_time.3 archive_read.3 archive_read_add_passphrase.3 archive_read_data.3 archive_read_disk.3 archive_read_extract.3 archive_read_filter.3 archive_read_format.3 archive_read_free.3 archive_read_header.3 archive_read_new.3 archive_read_open.3 archive_read_set_options.3 archive_util.3 archive_write.3 archive_write_blocksize.3 archive_write_data.3 archive_write_disk.3 archive_write_filter.3 archive_write_finish_entry.3 archive_write_format.3 archive_write_free.3 archive_write_header.3 archive_write_new.3 archive_write_open.3 archive_write_set_options.3 archive_write_set_passphrase.3 cpio.5 libarchive.3 libarchive_changes.3 libarchive-formats.5 libarchive_internals.3 mtree.5 tar.5 bsdtar.1 bsdcpio.1 +all: archive_entry.3 archive_entry_acl.3 archive_entry_linkify.3 archive_entry_misc.3 archive_entry_paths.3 archive_entry_perms.3 archive_entry_stat.3 archive_entry_time.3 archive_read.3 archive_read_add_passphrase.3 archive_read_data.3 archive_read_disk.3 archive_read_extract.3 archive_read_filter.3 archive_read_format.3 archive_read_free.3 archive_read_header.3 archive_read_new.3 archive_read_open.3 archive_read_set_options.3 archive_util.3 archive_write.3 archive_write_blocksize.3 archive_write_data.3 archive_write_disk.3 archive_write_filter.3 archive_write_finish_entry.3 archive_write_format.3 archive_write_free.3 archive_write_header.3 archive_write_new.3 archive_write_open.3 archive_write_set_options.3 archive_write_set_passphrase.3 cpio.5 libarchive-formats.5 libarchive.3 libarchive_changes.3 libarchive_internals.3 mtree.5 tar.5 bsdtar.1 bsdcpio.1 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry_acl.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry_acl.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry_acl.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry_acl.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry_linkify.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry_linkify.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry_linkify.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry_linkify.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry_misc.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry_misc.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry_misc.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry_misc.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry_paths.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry_paths.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry_paths.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry_paths.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry_perms.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry_perms.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry_perms.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry_perms.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry_stat.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry_stat.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry_stat.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry_stat.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_entry_time.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_entry_time.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_entry_time.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_entry_time.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_add_passphrase.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_add_passphrase.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_add_passphrase.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_add_passphrase.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_data.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_data.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_data.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_data.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_disk.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_disk.3 similarity index 71% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_disk.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_disk.3 index bd02537..9d89316 100644 --- a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_disk.3 +++ b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_disk.3 @@ -2,6 +2,8 @@ .SH NAME .ad l \fB\%archive_read_disk_new\fP, +\fB\%archive_read_disk_open\fP, +\fB\%archive_read_disk_open_w\fP, \fB\%archive_read_disk_set_behavior\fP, \fB\%archive_read_disk_set_symlink_logical\fP, \fB\%archive_read_disk_set_symlink_physical\fP, @@ -11,7 +13,14 @@ \fB\%archive_read_disk_uname\fP, \fB\%archive_read_disk_set_uname_lookup\fP, \fB\%archive_read_disk_set_gname_lookup\fP, -\fB\%archive_read_disk_set_standard_lookup\fP +\fB\%archive_read_disk_set_standard_lookup\fP, +\fB\%archive_read_disk_descend\fP, +\fB\%archive_read_disk_can_descend\fP, +\fB\%archive_read_disk_current_filesystem\fP, +\fB\%archive_read_disk_current_filesystem_is_synthetic\fP, +\fB\%archive_read_disk_current_filesystem_is_remote\fP, +\fB\%archive_read_disk_set_matching\fP, +\fB\%archive_read_disk_set_metadata_filter_callback\fP, \- functions for reading objects from disk .SH LIBRARY .ad l @@ -26,6 +35,14 @@ Streaming Archive Library (libarchive, -larchive) .br \fIint\fP .br +\fB\%archive_read_disk_open\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_open_w\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ wchar_t\ *\fP, \fI\%\fP); +.br +\fIint\fP +.br \fB\%archive_read_disk_set_behavior\fP(\fI\%struct\ archive\ *\fP, \fI\%int\fP); .br \fIint\fP @@ -63,6 +80,34 @@ Streaming Archive Library (libarchive, -larchive) \fIint\fP .br \fB\%archive_read_disk_entry_from_file\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive_entry\ *\fP, \fI\%int\ fd\fP, \fI\%const\ struct\ stat\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_descend\fP(\fI\%struct\ archive\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_can_descend\fP(\fI\%struct\ archive\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_current_filesystem\fP(\fI\%struct\ archive\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_current_filesystem_is_synthetic\fP(\fI\%struct\ archive\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_current_filesystem_is_remote\fP(\fI\%struct\ archive\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_set_matching\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive\ *\fP, \fI\%void\ (*excluded_func)(struct\ archive\ *,\ void\ *,\ struct\ archive\ entry\ *)\fP, \fI\%void\ *\fP); +.br +\fIint\fP +.br +\fB\%archive_read_disk_set_metadata_filter_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%int\ (*metadata_filter_func)(struct\ archive\ *,\ void*,\ struct\ archive_entry\ *)\fP, \fI\%void\ *\fP); .SH DESCRIPTION .ad l These functions provide an API for reading information about @@ -77,6 +122,16 @@ Allocates and initializes a Tn struct archive object suitable for reading object information from disk. .TP +\fB\%archive_read_disk_open\fP() +Opens the file or directory from the given path and prepares the +Tn struct archive +to read it from disk. +.TP +\fB\%archive_read_disk_open_w\fP() +Opens the file or directory from the given path as a wide character string and prepares the +Tn struct archive +to read it from disk. +.TP \fB\%archive_read_disk_set_behavior\fP() Configures various behavior options when reading entries from disk. The flags field consists of a bitwise OR of one or more of the @@ -129,6 +184,10 @@ for more information on extended file attributes. \fBARCHIVE_READDISK_RESTORE_ATIME\fP Restore access time of traversed files. By default, access time of traversed files is not restored. +.TP +\fBARCHIVE_READDISK_NO_SPARSE\fP +Do not read sparse file information. +By default, sparse file information is read from disk. .RE .TP \fB\%archive_read_disk_set_symlink_logical\fP(), @@ -212,6 +271,44 @@ using the currently-registered lookup functions above. This affects the file ownership fields and ACL values in the Tn struct archive_entry object. +.TP +\fB\%archive_read_disk_descend\fP() +If the current entry can be descended, this function will mark the directory as the next entry for +\fBarchive_read_header\fP(3) +to visit. +.TP +\fB\%archive_read_disk_can_descend\fP() +Returns 1 if the current entry is an unvisited directory and 0 otherwise. +.TP +\fB\%archive_read_disk_current_filesystem\fP() +Returns the index of the most recent filesystem entry that has been visited through archive_read_disk +.TP +\fB\%archive_read_disk_current_filesystem_is_synthetic\fP() +Returns 1 if the current filesystem is a virtual filesystem. Returns 0 if the current filesystem is not a virtual filesystem. Returns -1 if it is unknown. +.TP +\fB\%archive_read_disk_current_filesystem_is_remote\fP() +Returns 1 if the current filesystem is a remote filesystem. Returns 0 if the current filesystem is not a remote filesystem. Returns -1 if it is unknown. +.TP +\fB\%archive_read_disk_set_matching\fP() +Allows the caller to set +Tn struct archive +*_ma to compare each entry during +\fBarchive_read_header\fP(3) +calls. If matched based on calls to +Tn archive_match_path_excluded, +Tn archive_match_time_excluded, +or +Tn archive_match_owner_excluded, +then the callback function specified by the _excluded_func parameter will execute. This function will recieve data provided to the fourth parameter, void *_client_data. +.TP +\fB\%archive_read_disk_set_metadata_filter_callback\fP() +Allows the caller to set a callback function during calls to +\fBarchive_read_header\fP(3) +to filter out metadata for each entry. The callback function recieves the +Tn struct archive +object, void* custom filter data, and the +Tn struct archive_entry. +If the callback function returns an error, ARCHIVE_RETRY will be returned and the entry will not be further processed. .RE More information about the \fIstruct\fP archive diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_extract.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_extract.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_extract.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_extract.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_filter.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_filter.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_filter.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_filter.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_format.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_format.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_format.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_format.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_free.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_free.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_free.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_free.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_header.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_header.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_header.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_header.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_new.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_new.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_new.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_new.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_open.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_open.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_open.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_open.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_read_set_options.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_read_set_options.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_read_set_options.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_read_set_options.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_util.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_util.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_util.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_util.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_blocksize.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_blocksize.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_blocksize.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_blocksize.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_data.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_data.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_data.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_data.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_disk.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_disk.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_disk.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_disk.3 index a4ee482..fa13fe4 100644 --- a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_disk.3 +++ b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_disk.3 @@ -155,15 +155,15 @@ caused by archives that (deliberately or otherwise) extract files outside of the current directory. The default is not to perform this check. If +\fBARCHIVE_EXTRACT_UNLINK\fP +is specified together with this option, the library will +remove any intermediate symlinks it finds and return an +error only if such symlink could not be removed. .TP \fBARCHIVE_EXTRACT_SPARSE\fP Scan data for blocks of NUL bytes and try to recreate them with holes. This results in sparse files, independent of whether the archive format supports or uses them. -\fBARCHIVE_EXTRACT_UNLINK\fP -is specified together with this option, the library will -remove any intermediate symlinks it finds and return an -error only if such symlink could not be removed. .TP \fBARCHIVE_EXTRACT_TIME\fP The timestamps (mtime, ctime, and atime) should be restored. diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_filter.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_filter.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_filter.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_filter.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_finish_entry.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_finish_entry.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_finish_entry.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_finish_entry.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_format.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_format.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_format.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_format.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_free.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_free.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_free.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_free.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_header.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_header.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_header.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_header.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_new.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_new.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_new.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_new.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_open.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_open.3 similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_open.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_open.3 index f14f33d..9aeafc0 100644 --- a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_open.3 +++ b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_open.3 @@ -190,6 +190,7 @@ On failure, the callback should invoke \fB\%archive_set_error\fP() to register an error code and message and return +\fBARCHIVE_FATAL\fP. .RS 5 .IP \fItypedef int\fP diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_set_options.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_set_options.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_set_options.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_set_options.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/archive_write_set_passphrase.3 b/src/dependencies/libarchive-3.6.2/doc/man/archive_write_set_passphrase.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/archive_write_set_passphrase.3 rename to src/dependencies/libarchive-3.6.2/doc/man/archive_write_set_passphrase.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/bsdcpio.1 b/src/dependencies/libarchive-3.6.2/doc/man/bsdcpio.1 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/bsdcpio.1 rename to src/dependencies/libarchive-3.6.2/doc/man/bsdcpio.1 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/bsdtar.1 b/src/dependencies/libarchive-3.6.2/doc/man/bsdtar.1 similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/man/bsdtar.1 rename to src/dependencies/libarchive-3.6.2/doc/man/bsdtar.1 index 512db63..ab77947 100644 --- a/src/dependencies/libarchive-3.5.2/doc/man/bsdtar.1 +++ b/src/dependencies/libarchive-3.6.2/doc/man/bsdtar.1 @@ -519,6 +519,12 @@ and the default behavior if \fB\%tar\fP is run as non-root in x mode. .TP +\fB\-Fl\fP no-read-sparse +(c, r, u modes only) +Do not read sparse file information from disk. +This is the reverse of +\fB\-Fl\fP read-sparse. +.TP \fB\-Fl\fP no-safe-writes (x mode only) Do not create temporary files and use @@ -712,12 +718,24 @@ a compression dictionary to improve compression ratio. A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. .TP +\fBzstd:threads\fP +Specify the number of worker threads to use. +Setting threads to a special value 0 makes +\fBzstd\fP(1) +use as many threads as there are CPU cores on the system. +.TP \fBlzop:compression-level\fP A decimal integer from 1 to 9 specifying the lzop compression level. .TP \fBxz:compression-level\fP A decimal integer from 0 to 9 specifying the xz compression level. .TP +\fBxz:threads\fP +Specify the number of worker threads to use. +Setting threads to a special value 0 makes +\fBxz\fP(1) +use as many threads as there are CPU cores on the system. +.TP \fBmtree:\fP \fIkeyword\fP The mtree writer module allows you to specify which mtree keywords will be included in the output. @@ -824,6 +842,13 @@ there can be multiple entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a performance optimization. .TP +\fB\-Fl\fP read-sparse +(c, r, u modes only) +Read sparse file information from disk. +This is the reverse of +\fB\-Fl\fP no-read-sparse +and the default behavior. +.TP \fB\-S\fP (x mode only) Extract files as sparse files. diff --git a/src/dependencies/libarchive-3.5.2/doc/man/cpio.5 b/src/dependencies/libarchive-3.6.2/doc/man/cpio.5 similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/man/cpio.5 rename to src/dependencies/libarchive-3.6.2/doc/man/cpio.5 index 4dd0bc8..f049dad 100644 --- a/src/dependencies/libarchive-3.5.2/doc/man/cpio.5 +++ b/src/dependencies/libarchive-3.6.2/doc/man/cpio.5 @@ -367,7 +367,7 @@ while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the ``Programmer's Work Bench'' derived from -At 6th Edition UNIX +At v6 that was used internally at AT&T. Both the new binary and old character formats were in use by 1980, according to the System III source released diff --git a/src/dependencies/libarchive-3.5.2/doc/man/libarchive-formats.5 b/src/dependencies/libarchive-3.6.2/doc/man/libarchive-formats.5 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/libarchive-formats.5 rename to src/dependencies/libarchive-3.6.2/doc/man/libarchive-formats.5 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/libarchive.3 b/src/dependencies/libarchive-3.6.2/doc/man/libarchive.3 similarity index 95% rename from src/dependencies/libarchive-3.5.2/doc/man/libarchive.3 rename to src/dependencies/libarchive-3.6.2/doc/man/libarchive.3 index 310ad15..5e9fe79 100644 --- a/src/dependencies/libarchive-3.5.2/doc/man/libarchive.3 +++ b/src/dependencies/libarchive-3.6.2/doc/man/libarchive.3 @@ -36,30 +36,40 @@ GNU-format tar archives, .IP \(bu most common cpio archive formats, .IP \(bu -ISO9660 CD images (including RockRidge and Joliet extensions), -.IP \(bu -Zip archives, +7-Zip archives, .IP \(bu ar archives (including GNU/SysV and BSD extensions), .IP \(bu Microsoft CAB archives, .IP \(bu +ISO9660 CD images (including RockRidge and Joliet extensions), +.IP \(bu LHA archives, .IP \(bu mtree file tree descriptions, .IP \(bu -RAR archives, +RAR and most RAR5 archives, .IP \(bu -XAR archives. +WARC archives, +.IP \(bu +XAR archives, +.IP \(bu +Zip archives. .RE The library automatically detects archives compressed with -\fBgzip\fP(1), +\fBcompress\fP(1), \fBbzip2\fP(1), -\fBxz\fP(1), +\fBgrzip\fP(1), +\fBgzip\fP(1), +\fBlrzip\fP(1), +\fBlz4\fP(1), \fBlzip\fP(1), +\fBlzop\fP(1), +\fBxz\fP(1), or -\fBcompress\fP(1) -and decompresses them transparently. +\fBzstd\fP(1) +and decompresses them transparently. Decompression of some formats +requires external decompressor utilities. It can similarly detect and decode archives processed with \fBuuencode\fP(1) or which have an @@ -81,19 +91,19 @@ archives, .IP \(bu cpio archives, .IP \(bu -Zip archive, +7-Zip archives, +.IP \(bu +ar archives, .IP \(bu two different variants of shar archives, .IP \(bu ISO9660 CD images, .IP \(bu -7-Zip archives, -.IP \(bu -ar archives, -.IP \(bu mtree file tree descriptions, .IP \(bu -XAR archives. +XAR archives, +.IP \(bu +Zip archive. .RE Pax interchange format is an extension of the tar archive format that eliminates essentially all of the limitations of historic tar formats diff --git a/src/dependencies/libarchive-3.5.2/doc/man/libarchive_changes.3 b/src/dependencies/libarchive-3.6.2/doc/man/libarchive_changes.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/libarchive_changes.3 rename to src/dependencies/libarchive-3.6.2/doc/man/libarchive_changes.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/libarchive_internals.3 b/src/dependencies/libarchive-3.6.2/doc/man/libarchive_internals.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/libarchive_internals.3 rename to src/dependencies/libarchive-3.6.2/doc/man/libarchive_internals.3 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/mtree.5 b/src/dependencies/libarchive-3.6.2/doc/man/mtree.5 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/mtree.5 rename to src/dependencies/libarchive-3.6.2/doc/man/mtree.5 diff --git a/src/dependencies/libarchive-3.5.2/doc/man/tar.5 b/src/dependencies/libarchive-3.6.2/doc/man/tar.5 similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/man/tar.5 rename to src/dependencies/libarchive-3.6.2/doc/man/tar.5 diff --git a/src/dependencies/libarchive-3.5.2/doc/mdoc2man.awk b/src/dependencies/libarchive-3.6.2/doc/mdoc2man.awk similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/mdoc2man.awk rename to src/dependencies/libarchive-3.6.2/doc/mdoc2man.awk diff --git a/src/dependencies/libarchive-3.5.2/doc/mdoc2wiki.awk b/src/dependencies/libarchive-3.6.2/doc/mdoc2wiki.awk similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/mdoc2wiki.awk rename to src/dependencies/libarchive-3.6.2/doc/mdoc2wiki.awk diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/.ignore_me b/src/dependencies/libarchive-3.6.2/doc/pdf/.ignore_me similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/pdf/.ignore_me rename to src/dependencies/libarchive-3.6.2/doc/pdf/.ignore_me diff --git a/src/dependencies/libarchive-3.5.2/doc/pdf/Makefile b/src/dependencies/libarchive-3.6.2/doc/pdf/Makefile similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/pdf/Makefile rename to src/dependencies/libarchive-3.6.2/doc/pdf/Makefile index 48a5311..b5bf21e 100644 --- a/src/dependencies/libarchive-3.5.2/doc/pdf/Makefile +++ b/src/dependencies/libarchive-3.6.2/doc/pdf/Makefile @@ -107,15 +107,15 @@ archive_write_set_passphrase.3.pdf: ../../libarchive/archive_write_set_passphras cpio.5.pdf: ../../libarchive/cpio.5 groff -mdoc -T ps ../../libarchive/cpio.5 | ps2pdf - - > cpio.5.pdf +libarchive-formats.5.pdf: ../../libarchive/libarchive-formats.5 + groff -mdoc -T ps ../../libarchive/libarchive-formats.5 | ps2pdf - - > libarchive-formats.5.pdf + libarchive.3.pdf: ../../libarchive/libarchive.3 groff -mdoc -T ps ../../libarchive/libarchive.3 | ps2pdf - - > libarchive.3.pdf libarchive_changes.3.pdf: ../../libarchive/libarchive_changes.3 groff -mdoc -T ps ../../libarchive/libarchive_changes.3 | ps2pdf - - > libarchive_changes.3.pdf -libarchive-formats.5.pdf: ../../libarchive/libarchive-formats.5 - groff -mdoc -T ps ../../libarchive/libarchive-formats.5 | ps2pdf - - > libarchive-formats.5.pdf - libarchive_internals.3.pdf: ../../libarchive/libarchive_internals.3 groff -mdoc -T ps ../../libarchive/libarchive_internals.3 | ps2pdf - - > libarchive_internals.3.pdf @@ -130,4 +130,4 @@ bsdtar.1.pdf: ../../tar/bsdtar.1 bsdcpio.1.pdf: ../../cpio/bsdcpio.1 groff -mdoc -T ps ../../cpio/bsdcpio.1 | ps2pdf - - > bsdcpio.1.pdf -all: archive_entry.3.pdf archive_entry_acl.3.pdf archive_entry_linkify.3.pdf archive_entry_misc.3.pdf archive_entry_paths.3.pdf archive_entry_perms.3.pdf archive_entry_stat.3.pdf archive_entry_time.3.pdf archive_read.3.pdf archive_read_add_passphrase.3.pdf archive_read_data.3.pdf archive_read_disk.3.pdf archive_read_extract.3.pdf archive_read_filter.3.pdf archive_read_format.3.pdf archive_read_free.3.pdf archive_read_header.3.pdf archive_read_new.3.pdf archive_read_open.3.pdf archive_read_set_options.3.pdf archive_util.3.pdf archive_write.3.pdf archive_write_blocksize.3.pdf archive_write_data.3.pdf archive_write_disk.3.pdf archive_write_filter.3.pdf archive_write_finish_entry.3.pdf archive_write_format.3.pdf archive_write_free.3.pdf archive_write_header.3.pdf archive_write_new.3.pdf archive_write_open.3.pdf archive_write_set_options.3.pdf archive_write_set_passphrase.3.pdf cpio.5.pdf libarchive.3.pdf libarchive_changes.3.pdf libarchive-formats.5.pdf libarchive_internals.3.pdf mtree.5.pdf tar.5.pdf bsdtar.1.pdf bsdcpio.1.pdf +all: archive_entry.3.pdf archive_entry_acl.3.pdf archive_entry_linkify.3.pdf archive_entry_misc.3.pdf archive_entry_paths.3.pdf archive_entry_perms.3.pdf archive_entry_stat.3.pdf archive_entry_time.3.pdf archive_read.3.pdf archive_read_add_passphrase.3.pdf archive_read_data.3.pdf archive_read_disk.3.pdf archive_read_extract.3.pdf archive_read_filter.3.pdf archive_read_format.3.pdf archive_read_free.3.pdf archive_read_header.3.pdf archive_read_new.3.pdf archive_read_open.3.pdf archive_read_set_options.3.pdf archive_util.3.pdf archive_write.3.pdf archive_write_blocksize.3.pdf archive_write_data.3.pdf archive_write_disk.3.pdf archive_write_filter.3.pdf archive_write_finish_entry.3.pdf archive_write_format.3.pdf archive_write_free.3.pdf archive_write_header.3.pdf archive_write_new.3.pdf archive_write_open.3.pdf archive_write_set_options.3.pdf archive_write_set_passphrase.3.pdf cpio.5.pdf libarchive-formats.5.pdf libarchive.3.pdf libarchive_changes.3.pdf libarchive_internals.3.pdf mtree.5.pdf tar.5.pdf bsdtar.1.pdf bsdcpio.1.pdf diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry.3.pdf new file mode 100644 index 0000000..9a070ef Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_acl.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_acl.3.pdf new file mode 100644 index 0000000..d6906b5 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_acl.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_linkify.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_linkify.3.pdf new file mode 100644 index 0000000..f9be2ea Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_linkify.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_misc.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_misc.3.pdf new file mode 100644 index 0000000..e128b5d Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_misc.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_paths.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_paths.3.pdf new file mode 100644 index 0000000..b1ad00a Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_paths.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_perms.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_perms.3.pdf new file mode 100644 index 0000000..fbe486e Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_perms.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_stat.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_stat.3.pdf new file mode 100644 index 0000000..6a9951f Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_stat.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_time.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_time.3.pdf new file mode 100644 index 0000000..e651560 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_entry_time.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read.3.pdf new file mode 100644 index 0000000..cf55fad Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_add_passphrase.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_add_passphrase.3.pdf new file mode 100644 index 0000000..21abb48 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_add_passphrase.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_data.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_data.3.pdf new file mode 100644 index 0000000..b4f510c Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_data.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_disk.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_disk.3.pdf new file mode 100644 index 0000000..9e962d7 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_disk.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_extract.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_extract.3.pdf new file mode 100644 index 0000000..8dd2740 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_extract.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_filter.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_filter.3.pdf new file mode 100644 index 0000000..89baee5 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_filter.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_format.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_format.3.pdf new file mode 100644 index 0000000..e210ec7 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_format.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_free.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_free.3.pdf new file mode 100644 index 0000000..5c6afd4 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_free.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_header.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_header.3.pdf new file mode 100644 index 0000000..9bc535a Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_header.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_new.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_new.3.pdf new file mode 100644 index 0000000..687ed5b Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_new.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_open.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_open.3.pdf new file mode 100644 index 0000000..93d8a17 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_open.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_set_options.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_set_options.3.pdf new file mode 100644 index 0000000..3ca9fd2 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_read_set_options.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_util.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_util.3.pdf new file mode 100644 index 0000000..662117f Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_util.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write.3.pdf new file mode 100644 index 0000000..67303b9 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_blocksize.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_blocksize.3.pdf new file mode 100644 index 0000000..cb7266d Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_blocksize.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_data.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_data.3.pdf new file mode 100644 index 0000000..79e358f Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_data.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_disk.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_disk.3.pdf new file mode 100644 index 0000000..d036370 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_disk.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_filter.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_filter.3.pdf new file mode 100644 index 0000000..7246036 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_filter.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_finish_entry.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_finish_entry.3.pdf new file mode 100644 index 0000000..afc3a48 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_finish_entry.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_format.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_format.3.pdf new file mode 100644 index 0000000..18fa0dc Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_format.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_free.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_free.3.pdf new file mode 100644 index 0000000..cef2d84 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_free.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_header.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_header.3.pdf new file mode 100644 index 0000000..10ccaa1 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_header.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_new.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_new.3.pdf new file mode 100644 index 0000000..b1e906a Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_new.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_open.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_open.3.pdf new file mode 100644 index 0000000..869c354 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_open.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_set_options.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_set_options.3.pdf new file mode 100644 index 0000000..a040ffa Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_set_options.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_set_passphrase.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_set_passphrase.3.pdf new file mode 100644 index 0000000..de81ac7 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/archive_write_set_passphrase.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/bsdcpio.1.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/bsdcpio.1.pdf new file mode 100644 index 0000000..31b0f11 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/bsdcpio.1.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/bsdtar.1.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/bsdtar.1.pdf new file mode 100644 index 0000000..54f3779 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/bsdtar.1.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/cpio.5.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/cpio.5.pdf new file mode 100644 index 0000000..1aa1d25 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/cpio.5.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive-formats.5.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive-formats.5.pdf new file mode 100644 index 0000000..fa85830 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive-formats.5.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive.3.pdf new file mode 100644 index 0000000..651a796 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive_changes.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive_changes.3.pdf new file mode 100644 index 0000000..b3d0e87 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive_changes.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive_internals.3.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive_internals.3.pdf new file mode 100644 index 0000000..d98e0ad Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/libarchive_internals.3.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/mtree.5.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/mtree.5.pdf new file mode 100644 index 0000000..2bc759a Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/mtree.5.pdf differ diff --git a/src/dependencies/libarchive-3.6.2/doc/pdf/tar.5.pdf b/src/dependencies/libarchive-3.6.2/doc/pdf/tar.5.pdf new file mode 100644 index 0000000..2858ac2 Binary files /dev/null and b/src/dependencies/libarchive-3.6.2/doc/pdf/tar.5.pdf differ diff --git a/src/dependencies/libarchive-3.5.2/doc/text/.ignore_me b/src/dependencies/libarchive-3.6.2/doc/text/.ignore_me similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/text/.ignore_me rename to src/dependencies/libarchive-3.6.2/doc/text/.ignore_me diff --git a/src/dependencies/libarchive-3.5.2/doc/text/Makefile b/src/dependencies/libarchive-3.6.2/doc/text/Makefile similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/text/Makefile rename to src/dependencies/libarchive-3.6.2/doc/text/Makefile index d533e84..cace75d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/Makefile +++ b/src/dependencies/libarchive-3.6.2/doc/text/Makefile @@ -107,15 +107,15 @@ archive_write_set_passphrase.3.txt: ../../libarchive/archive_write_set_passphras cpio.5.txt: ../../libarchive/cpio.5 nroff -mdoc ../../libarchive/cpio.5 | col -b > cpio.5.txt +libarchive-formats.5.txt: ../../libarchive/libarchive-formats.5 + nroff -mdoc ../../libarchive/libarchive-formats.5 | col -b > libarchive-formats.5.txt + libarchive.3.txt: ../../libarchive/libarchive.3 nroff -mdoc ../../libarchive/libarchive.3 | col -b > libarchive.3.txt libarchive_changes.3.txt: ../../libarchive/libarchive_changes.3 nroff -mdoc ../../libarchive/libarchive_changes.3 | col -b > libarchive_changes.3.txt -libarchive-formats.5.txt: ../../libarchive/libarchive-formats.5 - nroff -mdoc ../../libarchive/libarchive-formats.5 | col -b > libarchive-formats.5.txt - libarchive_internals.3.txt: ../../libarchive/libarchive_internals.3 nroff -mdoc ../../libarchive/libarchive_internals.3 | col -b > libarchive_internals.3.txt @@ -130,4 +130,4 @@ bsdtar.1.txt: ../../tar/bsdtar.1 bsdcpio.1.txt: ../../cpio/bsdcpio.1 nroff -mdoc ../../cpio/bsdcpio.1 | col -b > bsdcpio.1.txt -all: archive_entry.3.txt archive_entry_acl.3.txt archive_entry_linkify.3.txt archive_entry_misc.3.txt archive_entry_paths.3.txt archive_entry_perms.3.txt archive_entry_stat.3.txt archive_entry_time.3.txt archive_read.3.txt archive_read_add_passphrase.3.txt archive_read_data.3.txt archive_read_disk.3.txt archive_read_extract.3.txt archive_read_filter.3.txt archive_read_format.3.txt archive_read_free.3.txt archive_read_header.3.txt archive_read_new.3.txt archive_read_open.3.txt archive_read_set_options.3.txt archive_util.3.txt archive_write.3.txt archive_write_blocksize.3.txt archive_write_data.3.txt archive_write_disk.3.txt archive_write_filter.3.txt archive_write_finish_entry.3.txt archive_write_format.3.txt archive_write_free.3.txt archive_write_header.3.txt archive_write_new.3.txt archive_write_open.3.txt archive_write_set_options.3.txt archive_write_set_passphrase.3.txt cpio.5.txt libarchive.3.txt libarchive_changes.3.txt libarchive-formats.5.txt libarchive_internals.3.txt mtree.5.txt tar.5.txt bsdtar.1.txt bsdcpio.1.txt +all: archive_entry.3.txt archive_entry_acl.3.txt archive_entry_linkify.3.txt archive_entry_misc.3.txt archive_entry_paths.3.txt archive_entry_perms.3.txt archive_entry_stat.3.txt archive_entry_time.3.txt archive_read.3.txt archive_read_add_passphrase.3.txt archive_read_data.3.txt archive_read_disk.3.txt archive_read_extract.3.txt archive_read_filter.3.txt archive_read_format.3.txt archive_read_free.3.txt archive_read_header.3.txt archive_read_new.3.txt archive_read_open.3.txt archive_read_set_options.3.txt archive_util.3.txt archive_write.3.txt archive_write_blocksize.3.txt archive_write_data.3.txt archive_write_disk.3.txt archive_write_filter.3.txt archive_write_finish_entry.3.txt archive_write_format.3.txt archive_write_free.3.txt archive_write_header.3.txt archive_write_new.3.txt archive_write_open.3.txt archive_write_set_options.3.txt archive_write_set_passphrase.3.txt cpio.5.txt libarchive-formats.5.txt libarchive.3.txt libarchive_changes.3.txt libarchive_internals.3.txt mtree.5.txt tar.5.txt bsdtar.1.txt bsdcpio.1.txt diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry.3.txt index f3d57db..a231826 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry.3.txt @@ -24,7 +24,7 @@ SYNOPSIS DESCRIPTION These functions create and manipulate data objects that represent entries - within an archive. You can think of a struct archive_entry as a heavy- + within an archive. You can think of a struct archive_entry as a heavy- duty version of struct stat: it includes everything from struct stat plus associated pathname, textual group and user names, etc. These objects are used by libarchive(3) to represent the metadata associated with a @@ -89,4 +89,4 @@ HISTORY AUTHORS The libarchive library was written by Tim Kientzle . -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_acl.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_acl.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry_acl.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry_acl.3.txt index f0e118c..563a23d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_acl.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_acl.3.txt @@ -206,7 +206,7 @@ DESCRIPTION ARCHIVE_ENTRY_ACL_TYPE_NFS4 Supports all formats that can be created with archive_entry_acl_to_text() or respectively archive_entry_acl_to_text_w(). Existing ACL entries are - preserved. To get a clean new ACL from text archive_entry_acl_clear() + preserved. To get a clean new ACL from text archive_entry_acl_clear() must be called first. Entries prefixed with “default:” are treated as ARCHIVE_ENTRY_ACL_TYPE_DEFAULT unless type is ARCHIVE_ENTRY_ACL_TYPE_NFS4. Invalid entries, non-parseable ACL entries @@ -218,7 +218,7 @@ DESCRIPTION archive_entry_acl_reset() prepare reading the list of ACL entries with archive_entry_acl_next(). The function returns 0 if no non-extended ACLs - are found. In this case, the access permissions should be obtained by + are found. In this case, the access permissions should be obtained by archive_entry_mode(3) or set using chmod(2). Otherwise, the function re‐ turns the same value as archive_entry_acl_count(). @@ -257,13 +257,13 @@ DESCRIPTION are prefixed with “default:”. archive_entry_acl_types() get ACL entry types contained in an archive en‐ - try's ACL. As POSIX.1e and NFSv4 ACL entries cannot be mixed, this func‐ + try's ACL. As POSIX.1e and NFSv4 ACL entries cannot be mixed, this func‐ tion is a very efficient way to detect if an ACL already contains POSIX.1e or NFSv4 ACL entries. RETURN VALUES archive_entry_acl_count() and archive_entry_acl_reset() returns the num‐ - ber of ACL entries that match the given type mask. For POSIX.1e ACLS if + ber of ACL entries that match the given type mask. For POSIX.1e ACLS if the type mask includes ARCHIVE_ENTRY_ACL_TYPE_ACCESS and at least one ex‐ tended ACL entry exists, the three classic Unix permissions are counted. diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_linkify.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_linkify.3.txt similarity index 82% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry_linkify.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry_linkify.3.txt index 6c8a5dd..a67576b 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_linkify.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_linkify.3.txt @@ -30,12 +30,12 @@ DESCRIPTION Hardlinks are handled in different ways by the archive formats. The ba‐ sic strategies are: - 1. Ignore hardlinks and store the body for each reference (old cpio, + 1. Ignore hardlinks and store the body for each reference (old cpio, zip). - 2. Store the body the first time an inode is seen (ustar, pax). + 2. Store the body the first time an inode is seen (ustar, pax). - 3. Store the body the last time an inode is seen (new cpio). + 3. Store the body the last time an inode is seen (new cpio). The archive_entry_linkresolver functions help by providing a unified in‐ terface and handling the complexity behind the scene. @@ -48,7 +48,7 @@ DESCRIPTION The archive_entry_linkresolver_new() function allocates a new link re‐ solver. The instance can be freed using - archive_entry_linkresolver_free(). All deferred entries are flushed and + archive_entry_linkresolver_free(). All deferred entries are flushed and the internal storage is freed. The archive_entry_linkresolver_set_strategy() function selects the opti‐ @@ -61,23 +61,23 @@ DESCRIPTION archive_entry that should be written. Depending on the strategy one of the following actions is taken: - 1. For the simple archive formats *entry is left unmodified and *sparse + 1. For the simple archive formats *entry is left unmodified and *sparse is set to NULL. - 2. For tar like archive formats, *sparse is set to NULL. If *entry is + 2. For tar like archive formats, *sparse is set to NULL. If *entry is NULL, no action is taken. If the hardlink count of *entry is larger than 1 and the file type is a regular file or symbolic link, the in‐ - ternal list is searched for a matching inode. If such an inode is + ternal list is searched for a matching inode. If such an inode is found, the link count is decremented and the file size of *entry is set to 0 to notify that no body should be written. If no such inode is found, a copy of the entry is added to the internal cache with a link count reduced by one. - 3. For new cpio like archive formats a value for *entry of NULL is used + 3. For new cpio like archive formats a value for *entry of NULL is used to flush deferred entries. In that case *entry is set to an arbi‐ trary deferred entry and the entry itself is removed from the inter‐ nal list. If the internal list is empty, *entry is set to NULL. In - either case, *sparse is set to NULL and the function returns. If + either case, *sparse is set to NULL and the function returns. If the hardlink count of *entry is one or the file type is a directory or device, *sparse is set to NULL and no further action is taken. Otherwise, the internal list is searched for a matching inode. If @@ -92,15 +92,15 @@ DESCRIPTION The general usage is therefore: - 1. For each new archive entry, call archive_entry_linkify(). + 1. For each new archive entry, call archive_entry_linkify(). - 2. Keep in mind that the entries returned may have a size of 0 now. + 2. Keep in mind that the entries returned may have a size of 0 now. - 3. If *entry is not NULL, archive it. + 3. If *entry is not NULL, archive it. - 4. If *sparse is not NULL, archive it. + 4. If *sparse is not NULL, archive it. - 5. After all entries have been written to disk, call + 5. After all entries have been written to disk, call archive_entry_linkify() with *entry set to NULL and archive the re‐ turned entry as long as it is not NULL. @@ -110,4 +110,4 @@ RETURN VALUES SEE ALSO archive_entry(3) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_misc.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_misc.3.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry_misc.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry_misc.3.txt diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_paths.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_paths.3.txt similarity index 96% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry_paths.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry_paths.3.txt index b883257..e4f0716 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_paths.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_paths.3.txt @@ -107,7 +107,7 @@ DESCRIPTION wise, make the entry a hardlink and alter the destination for that. pathname Path in the archive - sourcepath Path on the disk for use by archive_read_disk(3). + sourcepath Path on the disk for use by archive_read_disk(3). symlink Destination of the symbolic link. Path names can be provided in one of three different ways: @@ -124,7 +124,7 @@ DESCRIPTION The sourcepath is a pure filesystem concept and never stored in an ar‐ chive directly. - For that reason, it is only available as multibyte string. The link path + For that reason, it is only available as multibyte string. The link path is a convenience function for conditionally setting hardlink or symlink destination. It doesn't have a corresponding get accessor function. @@ -133,4 +133,4 @@ DESCRIPTION SEE ALSO archive_entry(3), libarchive(3) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_perms.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_perms.3.txt similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry_perms.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry_perms.3.txt index ace02cc..1f50b2c 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_perms.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_perms.3.txt @@ -146,7 +146,7 @@ DESCRIPTION Converting a bitmap to a textual string is a platform-specific operation; bits that are not meaningful on the current platform will be ignored. - The canonical text format is a comma-separated list of flag names. The + The canonical text format is a comma-separated list of flag names. The archive_entry_copy_fflags_text() and archive_entry_copy_fflags_text_w() functions parse the provided text and set the internal bitmap values. This is a platform-specific operation; names that are not meaningful on @@ -166,4 +166,4 @@ BUGS case it is possible that the ids can not be correctly restored from ar‐ chives and get truncated. -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_stat.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_stat.3.txt similarity index 96% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry_stat.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry_stat.3.txt index 9969685..d20fd02 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_stat.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_stat.3.txt @@ -126,7 +126,7 @@ DESCRIPTION General accessor functions The functions archive_entry_filetype() and archive_entry_set_filetype() - get respectively set the filetype. The file type is one of the following + get respectively set the filetype. The file type is one of the following constants: AE_IFREG Regular file AE_IFLNK Symbolic link @@ -135,7 +135,7 @@ DESCRIPTION AE_IFBLK Block device AE_IFDIR Directory AE_IFIFO Named pipe (fifo) - Not all file types are supported by all platforms. The constants used by + Not all file types are supported by all platforms. The constants used by stat(2) may have different numeric values from the corresponding con‐ stants above. @@ -173,7 +173,7 @@ DESCRIPTION Block and character devices are characterised either using a device num‐ ber or a pair of major and minor number. The combined device number can be obtained with archive_device_rdev() and set with - archive_device_set_rdev(). The major and minor numbers are accessed by + archive_device_set_rdev(). The major and minor numbers are accessed by archive_device_rdevmajor(), archive_device_rdevminor() archive_device_set_rdevmajor() and archive_device_set_rdevminor(). @@ -186,4 +186,4 @@ SEE ALSO stat(2), archive_entry_acl(3), archive_entry_perms(3), archive_entry_time(3), libarchive(3) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_time.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_time.3.txt similarity index 96% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_entry_time.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_entry_time.3.txt index 49052c3..2ab6bbb 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_entry_time.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_entry_time.3.txt @@ -93,7 +93,7 @@ DESCRIPTION truncated automatically depending on the archive format (for archiving) or the filesystem capabilities (for restoring). - All timestamp fields are optional. The XXX_unset() functions can be used + All timestamp fields are optional. The XXX_unset() functions can be used to mark the corresponding field as missing. The current state can be queried using XXX_is_set(). Unset time fields have a second and nanosec‐ ond field of 0. @@ -107,4 +107,4 @@ HISTORY AUTHORS The libarchive library was written by Tim Kientzle . -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read.3.txt index a9c3ad1..f5f33d3 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read.3.txt @@ -1,4 +1,4 @@ -ARCHIVE_READ(3) BSD Library Functions Manual ARCHIVE_READ(3) +ARCHIVE_READ(3) BSD Library Functions Manual ARCHIVE_READ(3) NAME archive_read — functions for reading streaming archives @@ -63,7 +63,7 @@ DESCRIPTION file, then the header will be followed by the file data. You can use archive_read_data() (which works much like the read(2) system call) to read this data from the archive, or archive_read_data_block() which pro‐ - vides a slightly more efficient interface. You may prefer to use the + vides a slightly more efficient interface. You may prefer to use the higher-level archive_read_data_skip(), which reads and discards the data for this entry, archive_read_data_into_fd(), which copies the data to the provided file descriptor, or archive_read_extract(), which recreates the @@ -153,4 +153,4 @@ BUGS format of an empty file by inspecting the contents, so this library treats empty files as having a special “empty” format. -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_add_passphrase.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_add_passphrase.3.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_add_passphrase.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_add_passphrase.3.txt diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_data.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_data.3.txt similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_data.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_data.3.txt index b39ebe0..14603ed 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_data.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_data.3.txt @@ -70,4 +70,4 @@ SEE ALSO archive_read_format(3), archive_read_header(3), archive_read_open(3), archive_read_set_options(3), archive_util(3), libarchive(3), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_disk.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_disk.3.txt similarity index 69% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_disk.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_disk.3.txt index b9f8d90..3600d9d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_disk.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_disk.3.txt @@ -1,14 +1,19 @@ ARCHIVE_READ_DISK(3) BSD Library Functions Manual ARCHIVE_READ_DISK(3) NAME - archive_read_disk_new, archive_read_disk_set_behavior, - archive_read_disk_set_symlink_logical, + archive_read_disk_new, archive_read_disk_open, archive_read_disk_open_w, + archive_read_disk_set_behavior, archive_read_disk_set_symlink_logical, archive_read_disk_set_symlink_physical, archive_read_disk_set_symlink_hybrid, archive_read_disk_entry_from_file, archive_read_disk_gname, archive_read_disk_uname, archive_read_disk_set_uname_lookup, archive_read_disk_set_gname_lookup, - archive_read_disk_set_standard_lookup — functions for reading objects - from disk + archive_read_disk_set_standard_lookup, archive_read_disk_descend, + archive_read_disk_can_descend, archive_read_disk_current_filesystem, + archive_read_disk_current_filesystem_is_synthetic, + archive_read_disk_current_filesystem_is_remote, + archive_read_disk_set_matching, + archive_read_disk_set_metadata_filter_callback, — functions for reading + objects from disk LIBRARY Streaming Archive Library (libarchive, -larchive) @@ -19,6 +24,12 @@ SYNOPSIS struct archive * archive_read_disk_new(void); + int + archive_read_disk_open(struct archive *, const char *); + + int + archive_read_disk_open_w(struct archive *, const wchar_t *); + int archive_read_disk_set_behavior(struct archive *, int); @@ -52,6 +63,31 @@ SYNOPSIS archive_read_disk_entry_from_file(struct archive *, struct archive_entry *, int fd, const struct stat *); + int + archive_read_disk_descend(struct archive *); + + int + archive_read_disk_can_descend(struct archive *); + + int + archive_read_disk_current_filesystem(struct archive *); + + int + archive_read_disk_current_filesystem_is_synthetic(struct archive *); + + int + archive_read_disk_current_filesystem_is_remote(struct archive *); + + int + archive_read_disk_set_matching(struct archive *, struct archive *, + void (*excluded_func)(struct archive *, void *, struct archive entry *), + void *); + + int + archive_read_disk_set_metadata_filter_callback(struct archive *, + int (*metadata_filter_func)(struct archive *, void*, struct archive_entry *), + void *); + DESCRIPTION These functions provide an API for reading information about objects on disk. In particular, they provide an interface for populating struct @@ -61,6 +97,14 @@ DESCRIPTION Allocates and initializes a struct archive object suitable for reading object information from disk. + archive_read_disk_open() + Opens the file or directory from the given path and prepares the + struct archive to read it from disk. + + archive_read_disk_open_w() + Opens the file or directory from the given path as a wide charac‐ + ter string and prepares the struct archive to read it from disk. + archive_read_disk_set_behavior() Configures various behavior options when reading entries from disk. The flags field consists of a bitwise OR of one or more of @@ -70,7 +114,7 @@ DESCRIPTION (file flag) set. By default, the nodump file attribute is ignored. ARCHIVE_READDISK_MAC_COPYFILE - Mac OS X specific. Read metadata (ACLs and extended at‐ + Mac OS X specific. Read metadata (ACLs and extended at‐ tributes) with copyfile(3). By default, metadata is read using copyfile(3). ARCHIVE_READDISK_NO_ACL @@ -93,12 +137,15 @@ DESCRIPTION ARCHIVE_READDISK_RESTORE_ATIME Restore access time of traversed files. By default, ac‐ cess time of traversed files is not restored. + ARCHIVE_READDISK_NO_SPARSE + Do not read sparse file information. By default, sparse + file information is read from disk. archive_read_disk_set_symlink_logical(), archive_read_disk_set_symlink_physical(), archive_read_disk_set_symlink_hybrid() This sets the mode used for handling symbolic links. The - “logical” mode follows all symbolic links. The “physical” mode + “logical” mode follows all symbolic links. The “physical” mode does not follow any symbolic links. The “hybrid” mode currently behaves identically to the “logical” mode. @@ -118,7 +165,7 @@ DESCRIPTION This convenience function installs a standard set of user and group name lookup functions. These functions use getpwuid(3) and getgrgid(3) to convert ids to names, defaulting to NULL if the - names cannot be looked up. These functions also implement a sim‐ + names cannot be looked up. These functions also implement a sim‐ ple memory cache to reduce the number of calls to getpwuid(3) and getgrgid(3). @@ -136,7 +183,7 @@ DESCRIPTION If a pointer to a struct stat is provided, information from that structure will be used instead of reading from the disk where ap‐ - propriate. This can provide performance benefits in scenarios + propriate. This can provide performance benefits in scenarios where struct stat information has already been read from the disk as a side effect of some other operation. (For example, direc‐ tory traversal libraries often provide this information.) @@ -145,6 +192,46 @@ DESCRIPTION group names using the currently-registered lookup functions above. This affects the file ownership fields and ACL values in the struct archive_entry object. + + archive_read_disk_descend() + If the current entry can be descended, this function will mark + the directory as the next entry for archive_read_header(3) to + visit. + + archive_read_disk_can_descend() + Returns 1 if the current entry is an unvisited directory and 0 + otherwise. + + archive_read_disk_current_filesystem() + Returns the index of the most recent filesystem entry that has + been visited through archive_read_disk + + archive_read_disk_current_filesystem_is_synthetic() + Returns 1 if the current filesystem is a virtual filesystem. Re‐ + turns 0 if the current filesystem is not a virtual filesystem. + Returns -1 if it is unknown. + + archive_read_disk_current_filesystem_is_remote() + Returns 1 if the current filesystem is a remote filesystem. Re‐ + turns 0 if the current filesystem is not a remote filesystem. Re‐ + turns -1 if it is unknown. + + archive_read_disk_set_matching() + Allows the caller to set struct archive *_ma to compare each en‐ + try during archive_read_header(3) calls. If matched based on + calls to archive_match_path_excluded, + archive_match_time_excluded, or archive_match_owner_excluded, + then the callback function specified by the _excluded_func param‐ + eter will execute. This function will recieve data provided to + the fourth parameter, void *_client_data. + + archive_read_disk_set_metadata_filter_callback() + Allows the caller to set a callback function during calls to + archive_read_header(3) to filter out metadata for each entry. The + callback function recieves the struct archive object, void* cus‐ + tom filter data, and the struct archive_entry. If the callback + function returns an error, ARCHIVE_RETRY will be returned and the + entry will not be further processed. More information about the struct archive object and the overall design of the library can be found in the libarchive(3) overview. diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_extract.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_extract.3.txt similarity index 96% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_extract.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_extract.3.txt index aaf1237..db60036 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_extract.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_extract.3.txt @@ -1,4 +1,4 @@ -ARCHIVE_READ_EXTRACT(3) BSD Library Functions Manual ARCHIVE_READ_EXTRACT(3) +ARCHIVE_READ_EXTRACT(3) BSD Library Functions Manual ARCHIVE_READ_EXTRACT(3) NAME archive_read_extract, archive_read_extract2, @@ -70,4 +70,4 @@ SEE ALSO archive_read_format(3), archive_read_open(3), archive_read_set_options(3), archive_util(3), libarchive(3), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_filter.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_filter.3.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_filter.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_filter.3.txt diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_format.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_format.3.txt similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_format.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_format.3.txt index cd80251..934c005 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_format.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_format.3.txt @@ -126,4 +126,4 @@ BUGS Using the “raw” handler together with any other handler will often work but can produce surprising results. -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_free.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_free.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_free.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_free.3.txt index 508b267..f0f66a7 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_free.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_free.3.txt @@ -49,4 +49,4 @@ SEE ALSO archive_read_new(3), archive_read_open(3), archive_read_set_options(3), archive_util(3), libarchive(3) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_header.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_header.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_header.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_header.3.txt index 855711a..6a27946 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_header.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_header.3.txt @@ -42,4 +42,4 @@ SEE ALSO archive_read_filter(3), archive_read_format(3), archive_read_open(3), archive_read_set_options(3), archive_util(3), libarchive(3), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_new.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_new.3.txt similarity index 94% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_new.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_new.3.txt index 706285c..e799af8 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_new.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_new.3.txt @@ -24,4 +24,4 @@ SEE ALSO archive_read_format(3), archive_read_set_options(3), archive_util(3), libarchive(3), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_open.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_open.3.txt similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_open.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_open.3.txt index 7ef2937..1288da6 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_open.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_open.3.txt @@ -53,7 +53,7 @@ DESCRIPTION other devices that require strict I/O blocking. archive_read_open_fd() Like archive_read_open(), except that it accepts a file descrip‐ - tor and block size rather than a set of function pointers. Note + tor and block size rather than a set of function pointers. Note that the file descriptor will not be automatically closed at end- of-archive. This function is safe for use with tape drives or other blocked devices. @@ -127,4 +127,4 @@ SEE ALSO archive_read_format(3), archive_read_set_options(3), archive_util(3), libarchive(3), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_set_options.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_set_options.3.txt similarity index 95% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_read_set_options.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_read_set_options.3.txt index fa516fd..69976aa 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_read_set_options.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_read_set_options.3.txt @@ -1,4 +1,4 @@ -ARCHIVE_READ_OPTIONS(3) BSD Library Functions Manual ARCHIVE_READ_OPTIONS(3) +ARCHIVE_READ_OPTIONS(3) BSD Library Functions Manual ARCHIVE_READ_OPTIONS(3) NAME archive_read_set_filter_option, archive_read_set_format_option, @@ -43,7 +43,7 @@ DESCRIPTION returned. If module is NULL, option and value will be provided to every - registered module. If any module returns ARCHIVE_FATAL, this + registered module. If any module returns ARCHIVE_FATAL, this value will be returned immediately. Otherwise, ARCHIVE_OK will be returned if any module accepts the option, and ARCHIVE_FAILED in all other cases. @@ -51,7 +51,7 @@ DESCRIPTION archive_read_set_option() Calls archive_read_set_format_option(), then archive_read_set_filter_option(). If either function returns - ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately. Oth‐ + ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately. Oth‐ erwise, greater of the two values will be returned. archive_read_set_options() @@ -94,7 +94,7 @@ OPTIONS the original PWB cpio format, and handle file mode bits accordingly. The default is to assume v7 format. Format iso9660 - joliet Support Joliet extensions. Defaults to enabled, use + joliet Support Joliet extensions. Defaults to enabled, use !joliet to disable. rockridge Support RockRidge extensions. Defaults to enabled, use @@ -138,4 +138,4 @@ ERRORS SEE ALSO tar(1), archive_read(3), archive_write_set_options(3), libarchive(3) -BSD January 31, 2020 BSD +BSD January 31, 2020 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_util.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_util.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_util.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_util.3.txt index 4827c0a..01910d7 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_util.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_util.3.txt @@ -1,4 +1,4 @@ -ARCHIVE_UTIL(3) BSD Library Functions Manual ARCHIVE_UTIL(3) +ARCHIVE_UTIL(3) BSD Library Functions Manual ARCHIVE_UTIL(3) NAME archive_clear_error, archive_compression, archive_compression_name, @@ -131,7 +131,7 @@ DESCRIPTION returned by archive_errno() and archive_error_string(). This function should be used within I/O callbacks to set system-spe‐ cific error codes and error descriptions. This function accepts - a printf-like format string and arguments. However, you should + a printf-like format string and arguments. However, you should be careful to use only the following printf format specifiers: “%c”, “%d”, “%jd”, “%jo”, “%ju”, “%jx”, “%ld”, “%lo”, “%lu”, “%lx”, “%o”, “%u”, “%s”, “%x”, “%%”. Field-width specifiers and @@ -147,4 +147,4 @@ HISTORY AUTHORS The libarchive library was written by Tim Kientzle . -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write.3.txt similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write.3.txt index f8d08b3..7e54288 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write.3.txt @@ -49,7 +49,7 @@ DESCRIPTION Individual archive entries are written in a three-step process: You first initialize a struct archive_entry structure with information about the - new entry. At a minimum, you should set the pathname of the entry and + new entry. At a minimum, you should set the pathname of the entry and provide a struct stat with a valid st_mode field, which specifies the type of object and st_size field, which specifies the size of the data portion of the object. @@ -172,7 +172,7 @@ AUTHORS BUGS There are many peculiar bugs in historic tar implementations that may - cause certain programs to reject archives written by this library. For + cause certain programs to reject archives written by this library. For example, several historic implementations calculated header checksums in‐ correctly and will thus reject valid archives; GNU tar does not fully support pax interchange format; some old tar implementations required @@ -189,4 +189,4 @@ BUGS restore device nodes with large device numbers from archives created by this library. -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_blocksize.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_blocksize.3.txt similarity index 96% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_blocksize.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_blocksize.3.txt index 8f92638..ed38c90 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_blocksize.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_blocksize.3.txt @@ -28,13 +28,13 @@ DESCRIPTION Sets the block size used for writing the archive data. Every call to the write callback function, except possibly the last one, will use this value for the length. The default is to use a - block size of 10240 bytes. Note that a block size of zero will + block size of 10240 bytes. Note that a block size of zero will suppress internal blocking and cause writes to be sent directly to the write callback as they occur. archive_write_get_bytes_per_block() Retrieve the block size to be used for writing. A value of -1 - here indicates that the library should use default values. A + here indicates that the library should use default values. A value of zero indicates that internal blocking is suppressed. archive_write_set_bytes_in_last_block() @@ -71,4 +71,4 @@ SEE ALSO tar(1), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_data.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_data.3.txt similarity index 93% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_data.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_data.3.txt index 96f8d1c..a863390 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_data.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_data.3.txt @@ -26,7 +26,7 @@ DESCRIPTION like archive_write_data() except that it performs a seek on the file being written to the specified offset before writing the data. This is useful when restoring sparse files from archive - formats that support sparse files. Returns number of bytes writ‐ + formats that support sparse files. Returns number of bytes writ‐ ten or -1 on error. (Note: This is currently not supported for archive_write handles, only for archive_write_disk handles. @@ -41,7 +41,7 @@ ERRORS BUGS In libarchive 3.x, this function sometimes returns zero on success in‐ stead of returning the number of bytes written. Specifically, this oc‐ - curs when writing to an archive_write_disk handle. Clients should treat + curs when writing to an archive_write_disk handle. Clients should treat any value less than zero as an error and consider any non-negative value as success. diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_disk.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_disk.3.txt similarity index 92% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_disk.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_disk.3.txt index 1536edc..6716274 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_disk.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_disk.3.txt @@ -37,7 +37,7 @@ SYNOPSIS DESCRIPTION These functions provide a complete API for creating objects on disk from - struct archive_entry descriptions. They are most naturally used when ex‐ + struct archive_entry descriptions. They are most naturally used when ex‐ tracting objects from an archive using the archive_read() interface. The general process is to read struct archive_entry objects from an archive, then write those objects to a struct archive object created using the @@ -72,7 +72,7 @@ DESCRIPTION (Linux) or chflags(1) (FreeBSD, Mac OS X) for more infor‐ mation on file attributes. ARCHIVE_EXTRACT_MAC_METADATA - Mac OS X specific. Restore metadata using copyfile(3). + Mac OS X specific. Restore metadata using copyfile(3). By default, copyfile(3) metadata is ignored. ARCHIVE_EXTRACT_NO_OVERWRITE Existing files on disk will not be overwritten. By de‐ @@ -87,7 +87,7 @@ DESCRIPTION ARCHIVE_EXTRACT_PERM Full permissions (including SGID, SUID, and sticky bits) should be restored exactly as specified, without obeying - the current umask. Note that SUID and SGID bits can only + the current umask. Note that SUID and SGID bits can only be restored if the user and group ID of the object on disk are correct. If ARCHIVE_EXTRACT_OWNER is not speci‐ fied, then SUID and SGID bits will only be restored if @@ -98,7 +98,7 @@ DESCRIPTION ARCHIVE_EXTRACT_SAFE_WRITES Extract files atomically, by first creating a unique tem‐ porary file and then renaming it to its required destina‐ - tion name. This avoids a race where an application might + tion name. This avoids a race where an application might see a partial file (or no file) during extraction. ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS Refuse to extract an absolute path. The default is to @@ -114,15 +114,14 @@ DESCRIPTION help guard against a variety of mischief caused by ar‐ chives that (deliberately or otherwise) extract files outside of the current directory. The default is not to - perform this check. If + perform this check. If ARCHIVE_EXTRACT_UNLINK is speci‐ + fied together with this option, the library will remove + any intermediate symlinks it finds and return an error + only if such symlink could not be removed. ARCHIVE_EXTRACT_SPARSE Scan data for blocks of NUL bytes and try to recreate them with holes. This results in sparse files, indepen‐ dent of whether the archive format supports or uses them. - ARCHIVE_EXTRACT_UNLINK is specified together with this - option, the library will remove any intermediate symlinks - it finds and return an error only if such symlink could - not be removed. ARCHIVE_EXTRACT_TIME The timestamps (mtime, ctime, and atime) should be re‐ stored. By default, they are ignored. Note that restor‐ @@ -157,11 +156,11 @@ DESCRIPTION This convenience function installs a standard set of user and group lookup functions. These functions use getpwnam(3) and getgrnam(3) to convert names to ids, defaulting to the ids if the - names cannot be looked up. These functions also implement a sim‐ + names cannot be looked up. These functions also implement a sim‐ ple memory cache to reduce the number of calls to getpwnam(3) and getgrnam(3). More information about the struct archive object and the overall design - of the library can be found in the libarchive(3) overview. Many of these + of the library can be found in the libarchive(3) overview. Many of these functions are also documented under archive_write(3). RETURN VALUES @@ -194,7 +193,7 @@ AUTHORS The libarchive library was written by Tim Kientzle . BUGS - Directories are actually extracted in two distinct phases. Directories + Directories are actually extracted in two distinct phases. Directories are created during archive_write_header(), but final permissions are not set until archive_write_close(). This separation is necessary to cor‐ rectly handle borderline cases such as a non-writable directory contain‐ @@ -207,7 +206,7 @@ BUGS The library attempts to create objects with filenames longer than PATH_MAX by creating prefixes of the full path and changing the current - directory. Currently, this logic is limited in scope; the fixup pass + directory. Currently, this logic is limited in scope; the fixup pass does not work correctly for such objects and the symlink security check option disables the support for very long pathnames. @@ -217,14 +216,14 @@ BUGS with a single request. Of course, this does not work if the ARCHIVE_EXTRACT_NODOTDOT option is specified. - Implicit directories are always created obeying the current umask. Ex‐ + Implicit directories are always created obeying the current umask. Ex‐ plicit objects are created obeying the current umask unless ARCHIVE_EXTRACT_PERM is specified, in which case they current umask is ignored. SGID and SUID bits are restored only if the correct user and group could be set. If ARCHIVE_EXTRACT_OWNER is not specified, then no attempt is - made to set the ownership. In this case, SGID and SUID bits are restored + made to set the ownership. In this case, SGID and SUID bits are restored only if the user and group of the final object happen to match those specified in the entry. @@ -236,4 +235,4 @@ BUGS There should be a corresponding archive_read_disk interface that walks a directory hierarchy and returns archive entry objects. -BSD January 19, 2020 BSD +BSD January 19, 2020 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_filter.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_filter.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_filter.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_filter.3.txt index 99523f3..60e02d1 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_filter.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_filter.3.txt @@ -1,4 +1,4 @@ -ARCHIVE_WRITE_FILTER(3) BSD Library Functions Manual ARCHIVE_WRITE_FILTER(3) +ARCHIVE_WRITE_FILTER(3) BSD Library Functions Manual ARCHIVE_WRITE_FILTER(3) NAME archive_write_add_filter_b64encode, archive_write_add_filter_by_name, @@ -98,4 +98,4 @@ SEE ALSO tar(1), archive_write(3), archive_write_format(3), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5) -BSD August 14, 2014 BSD +BSD August 14, 2014 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_finish_entry.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_finish_entry.3.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_finish_entry.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_finish_entry.3.txt diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_format.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_format.3.txt similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_format.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_format.3.txt index 1acbe7b..747d4d4 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_format.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_format.3.txt @@ -1,4 +1,4 @@ -ARCHIVE_WRITE_FORMAT(3) BSD Library Functions Manual ARCHIVE_WRITE_FORMAT(3) +ARCHIVE_WRITE_FORMAT(3) BSD Library Functions Manual ARCHIVE_WRITE_FORMAT(3) NAME archive_write_set_format, archive_write_set_format_7zip, @@ -120,7 +120,7 @@ DESCRIPTION archive_write_set_format_filter_by_ext() archive_write_set_format_filter_by_ext_def() - Sets both filters and format based on the output filename. Sup‐ + Sets both filters and format based on the output filename. Sup‐ ported extensions: .7z, .zip, .jar, .cpio, .iso, .a, .ar, .tar, .tgz, .tar.gz, .tar.bz2, .tar.xz diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_free.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_free.3.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_free.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_free.3.txt index 34a047f..38415eb 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_free.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_free.3.txt @@ -55,4 +55,4 @@ SEE ALSO tar(1), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_header.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_header.3.txt similarity index 91% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_header.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_header.3.txt index 430c018..4185941 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_header.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_header.3.txt @@ -1,4 +1,4 @@ -ARCHIVE_WRITE_HEADER(3) BSD Library Functions Manual ARCHIVE_WRITE_HEADER(3) +ARCHIVE_WRITE_HEADER(3) BSD Library Functions Manual ARCHIVE_WRITE_HEADER(3) NAME archive_write_header — functions for creating archives @@ -32,4 +32,4 @@ SEE ALSO tar(1), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_new.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_new.3.txt similarity index 94% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_new.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_new.3.txt index 38608c8..355d075 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_new.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_new.3.txt @@ -23,4 +23,4 @@ SEE ALSO tar(1), archive_write(3), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5) -BSD February 2, 2012 BSD +BSD February 2, 2012 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_open.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_open.3.txt similarity index 96% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_open.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_open.3.txt index c8dbec0..03019b0 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_open.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_open.3.txt @@ -64,12 +64,12 @@ DESCRIPTION A convenience form of archive_write_open() that accepts a file‐ name. A NULL argument indicates that the output should be writ‐ ten to standard output; an argument of “-” will open a file with - that name. If you have not invoked + that name. If you have not invoked archive_write_set_bytes_in_last_block(), then archive_write_open_filename() will adjust the last-block padding depending on the file: it will enable padding when writing to standard output or to a character or block device node, it will - disable padding otherwise. You can override this by manually in‐ + disable padding otherwise. You can override this by manually in‐ voking archive_write_set_bytes_in_last_block() before calling archive_write_open2(). The archive_write_open_filename() func‐ tion is safe for use with tape drives or other block-oriented de‐ @@ -81,7 +81,7 @@ DESCRIPTION final size_t * argument points to a variable that will be updated after each write to reflect how much of the buffer is currently in use. You should be careful to ensure that this variable re‐ - mains allocated until after the archive is closed. This function + mains allocated until after the archive is closed. This function will disable padding unless you have specifically set the block size. More information about the struct archive object and the overall design @@ -93,7 +93,7 @@ DESCRIPTION CLIENT CALLBACKS To use this library, you will need to define and register callback func‐ - tions that will be invoked to write data to the resulting archive. These + tions that will be invoked to write data to the resulting archive. These functions are registered by calling archive_write_open2(): typedef int archive_open_callback(struct archive *, void @@ -111,7 +111,7 @@ CLIENT CALLBACKS The write callback is invoked whenever the library needs to write raw bytes to the archive. For correct blocking, each call to the write call‐ - back function should translate into a single write(2) system call. This + back function should translate into a single write(2) system call. This is especially critical when writing archives to tape drives. On success, the write callback should return the number of bytes actually written. On error, the callback should invoke archive_set_error() to register an @@ -124,7 +124,7 @@ CLIENT CALLBACKS ing is complete. If the open callback fails, the close callback is not invoked. The callback should return ARCHIVE_OK on success. On failure, the callback should invoke archive_set_error() to register an error code - and message and return + and message and return ARCHIVE_FATAL. typedef int archive_free_callback(struct archive *, void *client_data) diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_set_options.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_set_options.3.txt similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_set_options.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_set_options.3.txt index 094fa40..557b24d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_set_options.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_set_options.3.txt @@ -46,15 +46,15 @@ DESCRIPTION be returned. If module is NULL, option and value will be provided to every - registered module. If any module returns ARCHIVE_FATAL, this + registered module. If any module returns ARCHIVE_FATAL, this value will be returned immediately. Otherwise, ARCHIVE_OK will be returned if any module accepts the option, and ARCHIVE_FAILED in all other cases. archive_write_set_option() Calls archive_write_set_format_option(), then - archive_write_set_filter_option(). If either function returns - ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately. Oth‐ + archive_write_set_filter_option(). If either function returns + ARCHIVE_FATAL, ARCHIVE_FATAL will be returned immediately. Oth‐ erwise, the greater of the two values will be returned. archive_write_set_options() @@ -228,7 +228,7 @@ OPTIONS period will have that period replaced by an underscore character in the standard ISO9660 namespace. This does not impact names stored in the Rockridge or Joliet exten‐ - sion area. Default: disabled. + sion area. Default: disabled. allow-lowercase If enabled, allows filenames to contain lowercase charac‐ ters. If disabled, filenames will be forced to upper‐ @@ -239,7 +239,7 @@ OPTIONS characters, in violation of the ISO9660 specification. If disabled, additional periods will be converted to un‐ derscore characters. This does not impact names stored - in the Rockridge or Joliet extension area. Default: dis‐ + in the Rockridge or Joliet extension area. Default: dis‐ abled. allow-period If enabled, allows filenames to contain trailing period @@ -290,7 +290,7 @@ OPTIONS joliet Microsoft's Joliet extensions store a completely separate set of directory information about each file. In partic‐ ular, this information includes Unicode filenames of up - to 255 characters. Default: enabled. + to 255 characters. Default: enabled. limit-depth If enabled, libarchive will use directory relocation records to ensure that no pathname exceeds the ISO9660 @@ -306,7 +306,7 @@ OPTIONS If enabled, all 7-bit ASCII characters are permitted in filenames (except lowercase characters unless allow-lowercase is also specified). This violates - ISO9660 standards. This does not impact names stored in + ISO9660 standards. This does not impact names stored in the Rockridge or Joliet extension area. Default: dis‐ abled. rockridge @@ -328,7 +328,7 @@ OPTIONS fault: 6 zisofs Synonym for zisofs=direct. zisofs=direct - Compress each file in the archive. Unlike + Compress each file in the archive. Unlike zisofs=indirect, this is handled entirely within libarchive and does not require a separate utility. For best results, libarchive tests each file and will store @@ -489,4 +489,4 @@ AUTHORS Michihiro NAKAJIMA. BUGS -BSD January 31, 2020 BSD +BSD January 31, 2020 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_set_passphrase.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_set_passphrase.3.txt similarity index 94% rename from src/dependencies/libarchive-3.5.2/doc/text/archive_write_set_passphrase.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/archive_write_set_passphrase.3.txt index 2acea6e..2aa3ec1 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/archive_write_set_passphrase.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/archive_write_set_passphrase.3.txt @@ -19,7 +19,7 @@ SYNOPSIS DESCRIPTION archive_write_set_passphrase() - Set a passphrase for writing an encrypted archive. If passphrase + Set a passphrase for writing an encrypted archive. If passphrase is NULL or empty, this function will do nothing and ARCHIVE_FAILED will be returned. Otherwise, ARCHIVE_OK will be returned. diff --git a/src/dependencies/libarchive-3.5.2/doc/text/bsdcpio.1.txt b/src/dependencies/libarchive-3.6.2/doc/text/bsdcpio.1.txt similarity index 87% rename from src/dependencies/libarchive-3.5.2/doc/text/bsdcpio.1.txt rename to src/dependencies/libarchive-3.6.2/doc/text/bsdcpio.1.txt index 6a0d3be..d7eb886 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/bsdcpio.1.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/bsdcpio.1.txt @@ -1,4 +1,4 @@ -CPIO(1) BSD General Commands Manual CPIO(1) +CPIO(1) BSD General Commands Manual CPIO(1) NAME cpio — copy files to and from archives @@ -14,15 +14,15 @@ DESCRIPTION and can create tar, pax, cpio, ar, and shar archives. The first option to cpio is a mode indicator from the following list: - -i Input. Read an archive from standard input (unless overridden) + -i Input. Read an archive from standard input (unless overridden) and extract the contents to disk or (if the -t option is speci‐ fied) list the contents to standard output. If one or more file patterns are specified, only files matching one of the patterns will be extracted. - -o Output. Read a list of filenames from standard input and produce + -o Output. Read a list of filenames from standard input and produce a new archive on standard output (unless overridden) containing the specified items. - -p Pass-through. Read a list of filenames from standard input and + -p Pass-through. Read a list of filenames from standard input and copy the files to the specified directory. OPTIONS @@ -43,17 +43,17 @@ OPTIONS (o mode only) When writing a cpio archive, use the (newer, non- PWB) binary format. - -A (o mode only) Append to the specified archive. (Not yet imple‐ + -A (o mode only) Append to the specified archive. (Not yet imple‐ mented.) - -a (o and p modes) Reset access times on files after they are read. + -a (o and p modes) Reset access times on files after they are read. - -B (o mode only) Block output to records of 5120 bytes. + -B (o mode only) Block output to records of 5120 bytes. -C size (o mode only) Block output to records of size bytes. - -c (o mode only) Use the old POSIX portable character format. + -c (o mode only) Use the old POSIX portable character format. Equivalent to --format odc. -d, --make-directories @@ -80,7 +80,7 @@ OPTIONS mat. ustar The POSIX.1 tar format. - The default format is odc. See libarchive-formats(5) for more + The default format is odc. See libarchive-formats(5) for more complete information about the formats currently supported by the underlying libarchive(3) library. @@ -100,12 +100,12 @@ OPTIONS -J, --xz (o mode only) Compress the file with xz-compatible compression - before writing it. In input mode, this option is ignored; xz + before writing it. In input mode, this option is ignored; xz compression is recognized automatically on input. - -j Synonym for -y. + -j Synonym for -y. - -L (o and p modes) All symbolic links will be followed. Normally, + -L (o and p modes) All symbolic links will be followed. Normally, symbolic links are archived and copied as symbolic links. With this option, the target of the link will be archived or copied instead. @@ -127,10 +127,10 @@ OPTIONS zstd compression is recognized automatically on input. --lzma (o mode only) Compress the file with lzma-compatible compression - before writing it. In input mode, this option is ignored; lzma + before writing it. In input mode, this option is ignored; lzma compression is recognized automatically on input. - --lzop (o mode only) Compress the resulting archive with lzop(1). In + --lzop (o mode only) Compress the resulting archive with lzop(1). In input mode, this option is ignored. --passphrase passphrase @@ -160,7 +160,7 @@ OPTIONS Output mode. See above for description. -p, --pass-through - Pass-through mode. See above for description. + Pass-through mode. See above for description. --preserve-owner (i mode only) Restore file ownership. This is the default when @@ -170,17 +170,17 @@ OPTIONS Suppress unnecessary messages. -R [user][:][group], --owner [user][:][group] - Set the owner and/or group on files in the output. If group is + Set the owner and/or group on files in the output. If group is specified with no user (for example, -R :wheel) then the group will be set but not the user. If the user is specified with a trailing colon and no group (for example, -R root:) then the group will be set to the user's default group. If the user is specified with no trailing colon, then the user will be set but not the group. In -i and -p modes, this option can only be used - by the super-user. (For compatibility, a period can be used in + by the super-user. (For compatibility, a period can be used in place of the colon.) - -r (All modes.) Rename files interactively. For each file, a + -r (All modes.) Rename files interactively. For each file, a prompt is written to /dev/tty containing the name of the file and a line is read from /dev/tty. If the line read is blank, the file is skipped. If the line contains a single period, the file @@ -206,15 +206,15 @@ OPTIONS --version Print the program version information and exit. - -y (o mode only) Compress the archive with bzip2-compatible compres‐ + -y (o mode only) Compress the archive with bzip2-compatible compres‐ sion before writing it. In input mode, this option is ignored; bzip2 compression is recognized automatically on input. - -Z (o mode only) Compress the archive with compress-compatible com‐ + -Z (o mode only) Compress the archive with compress-compatible com‐ pression before writing it. In input mode, this option is ig‐ nored; compression is recognized automatically on input. - -z (o mode only) Compress the archive with gzip-compatible compres‐ + -z (o mode only) Compress the archive with gzip-compatible compres‐ sion before writing it. In input mode, this option is ignored; gzip compression is recognized automatically on input. @@ -226,12 +226,12 @@ ENVIRONMENT LANG The locale to use. See environ(7) for more information. - TZ The timezone to use when displaying dates. See environ(7) for + TZ The timezone to use when displaying dates. See environ(7) for more information. EXAMPLES The cpio command is traditionally used to copy file hierarchies in con‐ - junction with the find(1) command. The first example here simply copies + junction with the find(1) command. The first example here simply copies all files from src to dest: find src | cpio -pmud dest @@ -285,8 +285,8 @@ BUGS The cpio archive format has several basic limitations: It does not store user and group names, only numbers. As a result, it cannot be reliably used to transfer files between systems with dissimilar user and group - numbering. Older cpio formats limit the user and group numbers to 16 or - 18 bits, which is insufficient for modern systems. The cpio archive for‐ + numbering. Older cpio formats limit the user and group numbers to 16 or + 18 bits, which is insufficient for modern systems. The cpio archive for‐ mats cannot support files over 4 gigabytes, except for the “odc” variant, which can support files up to 8 gigabytes. diff --git a/src/dependencies/libarchive-3.5.2/doc/text/bsdtar.1.txt b/src/dependencies/libarchive-3.6.2/doc/text/bsdtar.1.txt similarity index 92% rename from src/dependencies/libarchive-3.5.2/doc/text/bsdtar.1.txt rename to src/dependencies/libarchive-3.6.2/doc/text/bsdtar.1.txt index 75d6f0c..29764d0 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/bsdtar.1.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/bsdtar.1.txt @@ -19,20 +19,20 @@ DESCRIPTION provided for compatibility with historical implementations. See COMPATI‐ BILITY below for details. - The other synopsis forms show the preferred usage. The first option to + The other synopsis forms show the preferred usage. The first option to tar is a mode indicator from the following list: - -c Create a new archive containing the specified items. The long + -c Create a new archive containing the specified items. The long option form is --create. - -r Like -c, but new entries are appended to the archive. Note that + -r Like -c, but new entries are appended to the archive. Note that this only works on uncompressed archives stored in regular files. - The -f option is required. The long option form is --append. - -t List archive contents to stdout. The long option form is --list. - -u Like -r, but new entries are added only if they have a modifica‐ + The -f option is required. The long option form is --append. + -t List archive contents to stdout. The long option form is --list. + -u Like -r, but new entries are added only if they have a modifica‐ tion date newer than the corresponding entry in the archive. Note that this only works on uncompressed archives stored in reg‐ ular files. The -f option is required. The long form is --update. - -x Extract to disk from the archive. If a file with the same name + -x Extract to disk from the archive. If a file with the same name appears more than once in the archive, each copy will be ex‐ tracted, with later copies overwriting (replacing) earlier copies. The long option form is --extract. @@ -159,13 +159,13 @@ OPTIONS group name that will be stored in the archive; the name will not be verified against the system group database. - -H (c and r modes only) Symbolic links named on the command line + -H (c and r modes only) Symbolic links named on the command line will be followed; the target of the link will be archived, not the link itself. - -h (c and r modes only) Synonym for -L. + -h (c and r modes only) Synonym for -L. - -I Synonym for -T. + -I Synonym for -T. --help Show usage. @@ -240,7 +240,7 @@ OPTIONS be created with --xz instead. Note that this tar implementation recognizes LZMA compression automatically when reading archives. - --lzop (c mode only) Compress the resulting archive with lzop(1). In + --lzop (c mode only) Compress the resulting archive with lzop(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes LZO compression automatically when reading archives. @@ -306,9 +306,13 @@ OPTIONS format. This is the reverse of --mac-metadata. and the default behavior if tar is run as non-root in x mode. + --no-read-sparse + (c, r, u modes only) Do not read sparse file information from + disk. This is the reverse of --read-sparse. + --no-safe-writes (x mode only) Do not create temporary files and use rename(2) to - replace the original ones. This is the reverse of --safe-writes. + replace the original ones. This is the reverse of --safe-writes. --no-same-owner (x mode only) Do not extract owner and group IDs. This is the @@ -329,7 +333,7 @@ OPTIONS --numeric-owner This is equivalent to --uname "" --gname "". On extract, it causes user and group names in the archive to be ignored in favor - of the numeric user and group ids. On create, it causes user and + of the numeric user and group ids. On create, it causes user and group names to not be stored in the archive. -O, --to-stdout @@ -338,14 +342,14 @@ OPTIONS mode, the file listing will be written to stderr rather than the usual stdout. - -o (x mode) Use the user and group of the user running the program + -o (x mode) Use the user and group of the user running the program rather than those specified in the archive. Note that this has no significance unless -p is specified, and the program is being run by the root user. In this case, the file modes and flags from the archive will be restored, but ACLs or owner information in the archive will be discarded. - -o (c, r, u mode) A synonym for --format ustar + -o (c, r, u mode) A synonym for --format ustar --older date (c, r, u modes only) Only include files and directories older @@ -390,7 +394,7 @@ OPTIONS Examples of supported options: iso9660:joliet - Support Joliet extensions. This is enabled by default, + Support Joliet extensions. This is enabled by default, use !joliet or iso9660:!joliet to disable. iso9660:rockridge Support Rock Ridge extensions. This is enabled by de‐ @@ -426,12 +430,20 @@ OPTIONS A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. + zstd:threads + Specify the number of worker threads to use. Setting + threads to a special value 0 makes zstd(1) use as many + threads as there are CPU cores on the system. lzop:compression-level A decimal integer from 1 to 9 specifying the lzop com‐ pression level. xz:compression-level A decimal integer from 0 to 9 specifying the xz compres‐ sion level. + xz:threads + Specify the number of worker threads to use. Setting + threads to a special value 0 makes xz(1) use as many + threads as there are CPU cores on the system. mtree:keyword The mtree writer module allows you to specify which mtree keywords will be included in the output. Supported key‐ @@ -441,7 +453,7 @@ OPTIONS lent to: “device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname”. mtree:all - Enables all of the above keywords. You can also use + Enables all of the above keywords. You can also use mtree:!all to disable all keywords. mtree:use-set Enable generation of /set lines in the output. @@ -502,9 +514,13 @@ OPTIONS tries overwrite earlier entries. This option is provided as a performance optimization. - -S (x mode only) Extract files as sparse files. For every block on + --read-sparse + (c, r, u modes only) Read sparse file information from disk. + This is the reverse of --no-read-sparse and the default behavior. + + -S (x mode only) Extract files as sparse files. For every block on disk, check first if it contains only NULL bytes and seek over it - otherwise. This works similar to the conv=sparse option of dd. + otherwise. This works similar to the conv=sparse option of dd. -s pattern Modify file or archive member names according to pattern. The @@ -541,7 +557,7 @@ OPTIONS times. --same-owner - (x mode only) Extract owner and group IDs. This is the reverse + (x mode only) Extract owner and group IDs. This is the reverse of --no-same-owner and the default behavior if tar is run as root. @@ -558,7 +574,7 @@ OPTIONS cause the current directory to be changed to the directory speci‐ fied on the following line. Names are terminated by newlines un‐ less --null is specified. Note that --null also disables the - special handling of lines containing “-C”. Note: If you are + special handling of lines containing “-C”. Note: If you are generating lists of files using find(1), you probably want to use -n as well. @@ -569,7 +585,7 @@ OPTIONS -U, --unlink, --unlink-first (x mode only) Unlink files before creating them. This can be a minor performance optimization if most files already exist, but - can make things slower if most files do not already exist. This + can make things slower if most files do not already exist. This flag also causes tar to remove intervening directory symlinks in‐ stead of reporting an error. See the SECURITY section below for more details. @@ -605,7 +621,7 @@ OPTIONS Ask for confirmation for every action. -X filename, --exclude-from filename - Read a list of exclusion patterns from the specified file. See + Read a list of exclusion patterns from the specified file. See --exclude for more information about the handling of exclusions. --xattrs @@ -613,7 +629,7 @@ OPTIONS tributes. This is the reverse of --no-xattrs and the default be‐ havior in c, r, and u modes or if tar is run in x mode as root. - -y (c mode only) Compress the resulting archive with bzip2(1). In + -y (c mode only) Compress the resulting archive with bzip2(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes bzip2 compression automatically when reading archives. @@ -625,7 +641,7 @@ OPTIONS when reading archives. -z, --gunzip, --gzip - (c mode only) Compress the resulting archive with gzip(1). In + (c mode only) Compress the resulting archive with gzip(1). In extract or list modes, this option is ignored. Note that this tar implementation recognizes gzip compression automatically when reading archives. @@ -634,20 +650,20 @@ ENVIRONMENT The following environment variables affect the execution of tar: TAR_READER_OPTIONS - The default options for format readers and compression read‐ - ers. The --options option overrides this. + The default options for format readers and compression readers. + The --options option overrides this. TAR_WRITER_OPTIONS - The default options for format writers and compression writ‐ - ers. The --options option overrides this. + The default options for format writers and compression writers. + The --options option overrides this. - LANG The locale to use. See environ(7) for more information. + LANG The locale to use. See environ(7) for more information. - TAPE The default device. The -f option overrides this. Please see - the description of the -f option above for more details. + TAPE The default device. The -f option overrides this. Please see + the description of the -f option above for more details. - TZ The timezone to use when displaying dates. See environ(7) for - more information. + TZ The timezone to use when displaying dates. See environ(7) for + more information. EXIT STATUS The tar utility exits 0 on success, and >0 if an error occurs. @@ -675,7 +691,7 @@ EXAMPLES include directory change instructions of the form -Cfoo/baz and archive inclusions of the form @archive-file. For example, the command line tar -c -f new.tar foo1 @old.tgz -C/tmp foo2 - will create a new archive new.tar. tar will read the file foo1 from the + will create a new archive new.tar. tar will read the file foo1 from the current directory and add it to the output archive. It will then read each entry from old.tgz and add those entries to the output archive. Fi‐ nally, it will switch to the /tmp directory and add foo2 to the output @@ -712,7 +728,7 @@ COMPATIBILITY separate words. The order of the arguments must match the order of the corresponding characters in the bundled command word. For example, tar tbf 32 file.tar - specifies three flags t, b, and f. The b and f flags both require argu‐ + specifies three flags t, b, and f. The b and f flags both require argu‐ ments, so there must be two additional items on the command line. The 32 is the argument to the b flag, and file.tar is the argument to the f flag. @@ -746,18 +762,18 @@ SECURITY in their pathname. • Archive entries can exploit symbolic links to restore files to - other directories. An archive can restore a symbolic link to an‐ + other directories. An archive can restore a symbolic link to an‐ other directory, then use that link to restore a file into that - directory. To guard against this, tar checks each extracted path + directory. To guard against this, tar checks each extracted path for symlinks. If the final path element is a symlink, it will be removed and replaced with the archive entry. If -U is specified, any intermediate symlink will also be unconditionally removed. If neither -U nor -P is specified, tar will refuse to extract the entry. To protect yourself, you should be wary of any archives that come from - untrusted sources. You should examine the contents of an archive with + untrusted sources. You should examine the contents of an archive with tar -tf filename - before extraction. You should use the -k option to ensure that tar will + before extraction. You should use the -k option to ensure that tar will not overwrite any existing files or the -U option to remove any pre-ex‐ isting files. You should generally not extract archives while running with super-user privileges. Note that the -P option to tar disables the @@ -837,4 +853,4 @@ BUGS is a consequence of the incompatible ways that different archive formats store hardlink information.) -BSD January 31, 2020 BSD +BSD January 31, 2020 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/cpio.5.txt b/src/dependencies/libarchive-3.6.2/doc/text/cpio.5.txt similarity index 85% rename from src/dependencies/libarchive-3.5.2/doc/text/cpio.5.txt rename to src/dependencies/libarchive-3.6.2/doc/text/cpio.5.txt index d9c9cfd..bf4d677 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/cpio.5.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/cpio.5.txt @@ -1,4 +1,4 @@ -CPIO(5) BSD File Formats Manual CPIO(5) +CPIO(5) BSD File Formats Manual CPIO(5) NAME cpio — format of cpio archive files @@ -11,7 +11,7 @@ DESCRIPTION General Format Each file system object in a cpio archive comprises a header record with basic numeric metadata followed by the full pathname of the entry and the - file data. The header record stores a series of integer values that gen‐ + file data. The header record stores a series of integer values that gen‐ erally follow the fields in struct stat. (See stat(2) for details.) The variants differ primarily in how they store those integers (binary, oc‐ tal, or hexadecimal). The header is followed by the pathname of the en‐ @@ -34,9 +34,9 @@ DESCRIPTION short h_gid; short h_nlink; short h_majmin; - long h_mtime; + long h_mtime; short h_namesize; - long h_filesize; + long h_filesize; }; The short fields here are 16-bit integer values, while the long fields @@ -107,7 +107,7 @@ DESCRIPTION only used an unsigned 24 bit integer for the file size inter‐ nally. - The pathname immediately follows the fixed header. If h_namesize is odd, + The pathname immediately follows the fixed header. If h_namesize is odd, an additional NUL byte is added after the pathname. The file data is then appended, again with an additional NUL appended if needed to get the next header at an even offset. @@ -125,7 +125,7 @@ DESCRIPTION start of the header. The 32 bit integers are still always stored with the most significant word first, though, so each of those two, in the struct shown above, was stored as an array of two 16 bit integers, in the - traditional order. Those 16 bit integers, like all the others in the + traditional order. Those 16 bit integers, like all the others in the struct, were accessed using a macro that byte swapped them if necessary. Next, 7th Edition had more file types to store, and the IALLOC and ILARG @@ -169,22 +169,22 @@ DESCRIPTION 6-character or 11-character octal values. struct cpio_odc_header { - char c_magic[6]; - char c_dev[6]; - char c_ino[6]; - char c_mode[6]; - char c_uid[6]; - char c_gid[6]; - char c_nlink[6]; - char c_rdev[6]; - char c_mtime[11]; - char c_namesize[6]; - char c_filesize[11]; + char c_magic[6]; + char c_dev[6]; + char c_ino[6]; + char c_mode[6]; + char c_uid[6]; + char c_gid[6]; + char c_nlink[6]; + char c_rdev[6]; + char c_mtime[11]; + char c_namesize[6]; + char c_filesize[11]; }; The fields are identical to those in the new binary format. The name and - file body follow the fixed header. Unlike the binary formats, there is - no additional padding after the pathname or file contents. If the files + file body follow the fixed header. Unlike the binary formats, there is + no additional padding after the pathname or file contents. If the files being archived are themselves entirely ASCII, then the resulting archive will be entirely ASCII, except for the NUL byte that terminates the name field. @@ -195,20 +195,20 @@ DESCRIPTION bers. struct cpio_newc_header { - char c_magic[6]; - char c_ino[8]; - char c_mode[8]; - char c_uid[8]; - char c_gid[8]; - char c_nlink[8]; - char c_mtime[8]; - char c_filesize[8]; - char c_devmajor[8]; - char c_devminor[8]; - char c_rdevmajor[8]; - char c_rdevminor[8]; - char c_namesize[8]; - char c_check[8]; + char c_magic[6]; + char c_ino[8]; + char c_mode[8]; + char c_uid[8]; + char c_gid[8]; + char c_nlink[8]; + char c_mtime[8]; + char c_filesize[8]; + char c_devmajor[8]; + char c_devminor[8]; + char c_rdevmajor[8]; + char c_rdevminor[8]; + char c_namesize[8]; + char c_check[8]; }; Except as specified below, the fields here match those specified for the @@ -252,27 +252,27 @@ SEE ALSO STANDARDS The cpio utility is no longer a part of POSIX or the Single Unix Stan‐ dard. It last appeared in Version 2 of the Single UNIX Specification - (“SUSv2”). It has been supplanted in subsequent standards by pax(1). + (“SUSv2”). It has been supplanted in subsequent standards by pax(1). The portable ASCII format is currently part of the specification for the pax(1) utility. HISTORY The original cpio utility was written by Dick Haight while working in - AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, - the “Programmer's Work Bench” derived from AT&T UNIX 6th Edition UNIX - that was used internally at AT&T. Both the new binary and old character - formats were in use by 1980, according to the System III source released - by SCO under their “Ancient Unix” license. The character format was - adopted as part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did "newc" - appear? Who invented it? When did HP come out with their variant? When - did Sun introduce ACLs and extended attributes? XXX + AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, + the “Programmer's Work Bench” derived from Version 6 AT&T UNIX that was + used internally at AT&T. Both the new binary and old character formats + were in use by 1980, according to the System III source released by SCO + under their “Ancient Unix” license. The character format was adopted as + part of IEEE Std 1003.1-1988 (“POSIX.1”). XXX when did "newc" appear? + Who invented it? When did HP come out with their variant? When did Sun + introduce ACLs and extended attributes? XXX BUGS The “CRC” format is mis-named, as it uses a simple checksum and not a cyclic redundancy check. The binary formats are limited to 16 bits for user id, group id, device, - and inode numbers. They are limited to 16 megabyte and 2 gigabyte file + and inode numbers. They are limited to 16 megabyte and 2 gigabyte file sizes for the older and newer variants, respectively. The old ASCII format is limited to 18 bits for the user id, group id, de‐ diff --git a/src/dependencies/libarchive-3.5.2/doc/text/libarchive-formats.5.txt b/src/dependencies/libarchive-3.6.2/doc/text/libarchive-formats.5.txt similarity index 96% rename from src/dependencies/libarchive-3.5.2/doc/text/libarchive-formats.5.txt rename to src/dependencies/libarchive-3.6.2/doc/text/libarchive-formats.5.txt index 92fb8d5..36f136b 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/libarchive-formats.5.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/libarchive-formats.5.txt @@ -45,13 +45,13 @@ DESCRIPTION interchange format archives. Pax interchange format archives are an extension of the older ustar format that adds a separate entry with additional attributes stored as key/value pairs immediately - before each regular entry. The presence of these additional en‐ + before each regular entry. The presence of these additional en‐ tries is the only difference between pax interchange format and the older ustar format. The extended attributes are of unlimited length and are stored as UTF-8 Unicode strings. Keywords defined in the standard are in all lowercase; vendors are allowed to de‐ fine custom keys by preceding them with the vendor name in all - uppercase. When writing pax archives, libarchive uses many of + uppercase. When writing pax archives, libarchive uses many of the SCHILY keys defined by Joerg Schilling's “star” archiver and a few LIBARCHIVE keys. The libarchive library can read most of the SCHILY keys and most of the GNU keys introduced by GNU tar. @@ -80,7 +80,7 @@ DESCRIPTION ustar The libarchive library can both read and write this format. This format has the following limitations: - • Device major and minor numbers are limited to 21 bits. Nodes + • Device major and minor numbers are limited to 21 bits. Nodes with larger numbers will not be added to the archive. • Path names in the archive are limited to 255 bytes. (Shorter if there is no / character in exactly the right place.) @@ -94,7 +94,7 @@ DESCRIPTION tions. The ustar format is old and widely supported. It is rec‐ ommended when compatibility is the primary concern. - v7 The libarchive library can read and write the legacy v7 tar for‐ + v7 The libarchive library can read and write the legacy v7 tar for‐ mat. This format has the following limitations: • Only regular files, directories, and symbolic links can be archived. Block and character device nodes, FIFOs, and sock‐ @@ -159,7 +159,7 @@ DESCRIPTION archive format” and sometimes unofficially referred to as the “old character format”. This format stores the header contents as octal values in ASCII. It is standard, portable, and immune - from byte-order confusion. File sizes and mtime are limited to + from byte-order confusion. File sizes and mtime are limited to 33 bits (8GB file size), other fields are limited to 18 bits. SVR4/newc @@ -175,7 +175,7 @@ DESCRIPTION of AT&T in 1981. This makes cpio older than tar, although cpio was not included in Version 7 AT&T Unix. As a result, the tar command became much better known in universities and research groups that used Version - 7. The combination of the find and cpio utilities provided very precise + 7. The combination of the find and cpio utilities provided very precise control over file selection. Unfortunately, the format has many limita‐ tions that make it unsuitable for widespread use. Only the POSIX format permits files over 4GB, and its 18-bit limit for most other fields makes @@ -199,7 +199,7 @@ DESCRIPTION shardump This format is similar to shar but encodes files using uuencode(1) so that the result will be a plain text file regard‐ - less of the file contents. It also includes additional shell + less of the file contents. It also includes additional shell commands that attempt to reproduce as many file attributes as possible, including owner, mode, and flags. The additional com‐ mands used to restore file attributes make shardump archives less @@ -220,7 +220,7 @@ DESCRIPTION Libarchive reads ISO9660 images using a streaming strategy. This allows it to read compressed images directly (decompressing on the fly) and al‐ lows it to read images directly from network sockets, pipes, and other - non-seekable data sources. This strategy works well for optimized + non-seekable data sources. This strategy works well for optimized ISO9660 images created by many popular programs. Such programs collect all directory information at the beginning of the ISO9660 image so it can be read from a physical disk with a minimum of seeking. However, not all @@ -247,9 +247,9 @@ DESCRIPTION The streaming reader processes Zip archives as they are read. It can read archives of arbitrary size from tape or network sockets, and can de‐ - code Zip archives that have been separately compressed or encoded. How‐ + code Zip archives that have been separately compressed or encoded. How‐ ever, self-extracting Zip archives and archives with certain types of - modifications cannot be correctly handled. Such archives require that + modifications cannot be correctly handled. Such archives require that the reader first process the Central Directory, which is ordinarily lo‐ cated at the end of a Zip archive and is thus inaccessible to the stream‐ ing reader. If the program using libarchive has enabled seek support, @@ -272,7 +272,7 @@ DESCRIPTION primarily in their handling of filenames longer than 15 characters: the GNU/SVR4 variant writes a filename table at the beginning of the archive; the BSD format stores each long filename in an extension area adjacent to - the entry. Libarchive can read both extensions, including archives that + the entry. Libarchive can read both extensions, including archives that may include both types of long filenames. Programs using libarchive can write GNU/SVR4 format if they provide an entry called // containing a filename table to be written into the archive before any of the entries. @@ -289,7 +289,7 @@ DESCRIPTION many of the keywords cannot currently be stored in an archive_entry ob‐ ject. When writing, libarchive supports use of the archive_write_set_options(3) interface to specify which keywords should - be included in the output. If libarchive was compiled with access to + be included in the output. If libarchive was compiled with access to suitable cryptographic libraries (such as the OpenSSL libraries), it can compute hash entries such as sha512 or md5 from file data being written to the mtree writer. diff --git a/src/dependencies/libarchive-3.5.2/doc/text/libarchive.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/libarchive.3.txt similarity index 89% rename from src/dependencies/libarchive-3.5.2/doc/text/libarchive.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/libarchive.3.txt index b570d04..9cf869e 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/libarchive.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/libarchive.3.txt @@ -20,31 +20,35 @@ OVERVIEW • the POSIX “pax interchange” format, • GNU-format tar archives, • most common cpio archive formats, - • ISO9660 CD images (including RockRidge and Joliet extensions), - • Zip archives, + • 7-Zip archives, • ar archives (including GNU/SysV and BSD extensions), • Microsoft CAB archives, + • ISO9660 CD images (including RockRidge and Joliet extensions), • LHA archives, • mtree file tree descriptions, - • RAR archives, - • XAR archives. - The library automatically detects archives compressed with gzip(1), - bzip2(1), xz(1), lzip(1), or compress(1) and decompresses them transpar‐ - ently. It can similarly detect and decode archives processed with - uuencode(1) or which have an rpm(1) header. + • RAR and most RAR5 archives, + • WARC archives, + • XAR archives, + • Zip archives. + The library automatically detects archives compressed with compress(1), + bzip2(1), grzip(1), gzip(1), lrzip(1), lz4(1), lzip(1), lzop(1), xz(1), + or zstd(1) and decompresses them transparently. Decompression of some + formats requires external decompressor utilities. It can similarly de‐ + tect and decode archives processed with uuencode(1) or which have an + rpm(1) header. When writing an archive, you can specify the compression to be used and - the format to use. The library can write + the format to use. The library can write • POSIX-standard “ustar” archives, • POSIX “pax interchange format” archives, • cpio archives, - • Zip archive, - • two different variants of shar archives, - • ISO9660 CD images, • 7-Zip archives, • ar archives, + • two different variants of shar archives, + • ISO9660 CD images, • mtree file tree descriptions, - • XAR archives. + • XAR archives, + • Zip archive. Pax interchange format is an extension of the tar archive format that eliminates essentially all of the limitations of historic tar formats in a standard fashion that is supported by POSIX-compliant pax(1) implemen‐ @@ -69,7 +73,7 @@ WRITING AN ARCHIVE WRITING ENTRIES TO DISK The archive_write_disk(3) API allows you to write archive_entry(3) ob‐ - jects to disk using the same API used by archive_write(3). The + jects to disk using the same API used by archive_write(3). The archive_write_disk(3) API is used internally by archive_read_extract(); using it directly can provide greater control over how entries get writ‐ ten to disk. This API also makes it possible to share code between ar‐ @@ -97,7 +101,7 @@ DESCRIPTION Users familiar with historic formats should be aware that the newer vari‐ ants have eliminated most restrictions on the length of textual fields. Clients should not assume that filenames, link names, user names, or - group names are limited in length. In particular, pax interchange format + group names are limited in length. In particular, pax interchange format can easily accommodate pathnames in arbitrary character sets that exceed PATH_MAX. @@ -115,7 +119,7 @@ RETURN VALUES cated and initialized struct archive object. archive_read_data() and archive_write_data() return a count of the number - of bytes actually read or written. A value of zero indicates the end of + of bytes actually read or written. A value of zero indicates the end of the data for this entry. A negative value indicates an error, in which case the archive_errno() and archive_error_string() functions can be used to obtain more information. diff --git a/src/dependencies/libarchive-3.5.2/doc/text/libarchive_changes.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/libarchive_changes.3.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/text/libarchive_changes.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/libarchive_changes.3.txt diff --git a/src/dependencies/libarchive-3.5.2/doc/text/libarchive_internals.3.txt b/src/dependencies/libarchive-3.6.2/doc/text/libarchive_internals.3.txt similarity index 95% rename from src/dependencies/libarchive-3.5.2/doc/text/libarchive_internals.3.txt rename to src/dependencies/libarchive-3.6.2/doc/text/libarchive_internals.3.txt index d649ab8..38ba442 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/libarchive_internals.3.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/libarchive_internals.3.txt @@ -1,4 +1,4 @@ -LIBARCHIVE_INTERNALS(3) BSD Library Functions Manual LIBARCHIVE_INTERNALS(3) +LIBARCHIVE_INTERNALS(3) BSD Library Functions Manual LIBARCHIVE_INTERNALS(3) NAME libarchive_internals — description of libarchive internal interfaces @@ -32,7 +32,7 @@ READ ARCHITECTURE archive object to read entries and bodies from an archive stream. Inter‐ nally, the archive object is cast to an archive_read object, which holds all read-specific data. The API has four layers: The lowest layer is the - I/O layer. This layer can be overridden by clients, but most clients use + I/O layer. This layer can be overridden by clients, but most clients use the packaged I/O callbacks provided, for example, by archive_read_open_memory(3), and archive_read_open_fd(3). The compres‐ sion layer calls the I/O layer to read bytes and decompresses them for @@ -55,11 +55,11 @@ READ ARCHITECTURE The client read callback is expected to provide a block of data on each call. A zero-length return does indicate end of file, but otherwise - blocks may be as small as one byte or as large as the entire file. In + blocks may be as small as one byte or as large as the entire file. In particular, blocks may be of different sizes. The client skip callback returns the number of bytes actually skipped, - which may be much smaller than the skip requested. The only requirement + which may be much smaller than the skip requested. The only requirement is that the skip not be larger. In particular, clients are allowed to return zero for any skip that they don't want to handle. The skip call‐ back must never be invoked with a negative value. @@ -96,7 +96,7 @@ READ ARCHITECTURE pression handler invokes the internal __archive_read_register_compression() function to provide bid and initialization functions. This function returns NULL on error or - else a pointer to a struct decompressor_t. This structure con‐ + else a pointer to a struct decompressor_t. This structure con‐ tains a void * config slot that can be used for storing any cus‐ tomization information. Bid The bid function is invoked with a pointer and size of a block of @@ -148,7 +148,7 @@ READ ARCHITECTURE The header read is usually the most complex part of any format. There are a few strategies worth mentioning: For formats such as tar or cpio, reading and parsing the header is straightforward - since headers alternate with data. For formats that store all + since headers alternate with data. For formats that store all header data at the beginning of the file, the first header read request may have to read all headers into memory and store that data, sorted by the location of the file data. Subsequent header @@ -162,7 +162,7 @@ READ ARCHITECTURE ber that the decompressor will return as much data as it has. Generally, you will want to request one byte, examine the return value to see how much data is available, and possibly trim that - to the amount you can use. You should invoke consume for each + to the amount you can use. You should invoke consume for each block just before you return it. Skip All Data The skip data call should skip over all file data and trailing @@ -202,7 +202,7 @@ WRITE_DISK ARCHITECTURE GENERAL SERVICES The archive_read, archive_write, and archive_write_disk objects all con‐ tain an initial archive object which provides common support for a set of - standard services. (Recall that ANSI/ISO C90 guarantees that you can + standard services. (Recall that ANSI/ISO C90 guarantees that you can cast freely between a pointer to a structure and a pointer to the first element of that structure.) The archive object has a magic value that indicates which API this object is associated with, slots for storing er‐ @@ -212,7 +212,7 @@ MISCELLANEOUS NOTES Connecting existing archiving libraries into libarchive is generally quite difficult. In particular, many existing libraries strongly assume that you are reading from a file; they seek forwards and backwards as - necessary to locate various pieces of information. In contrast, + necessary to locate various pieces of information. In contrast, libarchive never seeks backwards in its input, which sometimes requires very different approaches. @@ -244,4 +244,4 @@ HISTORY AUTHORS The libarchive library was written by Tim Kientzle . -BSD January 26, 2011 BSD +BSD January 26, 2011 BSD diff --git a/src/dependencies/libarchive-3.5.2/doc/text/mtree.5.txt b/src/dependencies/libarchive-3.6.2/doc/text/mtree.5.txt similarity index 94% rename from src/dependencies/libarchive-3.5.2/doc/text/mtree.5.txt rename to src/dependencies/libarchive-3.6.2/doc/text/mtree.5.txt index f9e309f..c916e30 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/mtree.5.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/mtree.5.txt @@ -33,7 +33,7 @@ DESCRIPTION rectory. dot-dot As a special case, a relative entry with the filename .. - changes the current directory to the parent directory. Op‐ + changes the current directory to the parent directory. Op‐ tions on dot-dot entries are always ignored. Full If the first whitespace-delimited word has a / character af‐ @@ -51,7 +51,7 @@ DESCRIPTION /set This command defines default values for one or more keywords. It is followed on the same line by one or more whitespace- - separated keyword definitions. These definitions apply to + separated keyword definitions. These definitions apply to all following files that do not specify a value for that key‐ word. @@ -92,7 +92,7 @@ DESCRIPTION file. flags The file flags as a symbolic name. See chflags(1) for infor‐ - mation on these names. If no flags are to be set the string + mation on these names. If no flags are to be set the string “none” may be used to override the current default. gid The file group as a numeric value. @@ -121,7 +121,7 @@ DESCRIPTION not in the file hierarchy. resdevice The “resident” device number of the file, e.g. the ID of the - device that contains the file. Its format is the same as the + device that contains the file. Its format is the same as the one for device. ripemd160digest @@ -134,7 +134,7 @@ DESCRIPTION sha1 The FIPS 160-1 (“SHA-1”) message digest of the file. - sha1digest A synonym for sha1. + sha1digest A synonym for sha1. sha256 The FIPS 180-2 (“SHA-256”) message digest of the file. @@ -163,7 +163,7 @@ DESCRIPTION fifo fifo file regular file link symbolic link - socket socket + socket socket uid The file owner as a numeric value. @@ -173,7 +173,7 @@ SEE ALSO cksum(1), find(1), mtree(8) HISTORY - The mtree utility appeared in 4.3BSD-Reno. The MD5 digest capability was + The mtree utility appeared in 4.3BSD-Reno. The MD5 digest capability was added in FreeBSD 2.1, in response to the widespread use of programs which can spoof cksum(1). The SHA-1 and RIPEMD160 digests were added in FreeBSD 4.0, as new attacks have demonstrated weaknesses in MD5. The diff --git a/src/dependencies/libarchive-3.5.2/doc/text/tar.5.txt b/src/dependencies/libarchive-3.6.2/doc/text/tar.5.txt similarity index 97% rename from src/dependencies/libarchive-3.5.2/doc/text/tar.5.txt rename to src/dependencies/libarchive-3.6.2/doc/text/tar.5.txt index 72aaee1..0069724 100644 --- a/src/dependencies/libarchive-3.5.2/doc/text/tar.5.txt +++ b/src/dependencies/libarchive-3.6.2/doc/text/tar.5.txt @@ -62,9 +62,9 @@ DESCRIPTION User id and group id of owner, as octal numbers in ASCII. size Size of file, as octal number in ASCII. For regular files only, - this indicates the amount of data that follows the header. In + this indicates the amount of data that follows the header. In particular, this field was ignored by early tar implementations - when extracting hardlinks. Modern writers should always store a + when extracting hardlinks. Modern writers should always store a zero length for hardlink entries. mtime Modification time of file, as an octal number in ASCII. This in‐ @@ -77,7 +77,7 @@ DESCRIPTION the checksum, set the checksum field to all spaces, then sum all bytes in the header using unsigned arithmetic. This field should be stored as six octal digits followed by a null and a space - character. Note that many early implementations of tar used + character. Note that many early implementations of tar used signed arithmetic for the checksum field, which can cause inter‐ operability problems when transferring archives between systems. Modern robust readers compute the checksum both ways and accept @@ -119,7 +119,7 @@ DESCRIPTION IEEE Std 1003.1-1988 (“POSIX.1”) defined a standard tar file format to be read and written by compliant implementations of tar(1). This format is often called the “ustar” format, after the magic value used in the - header. (The name is an acronym for “Unix Standard TAR”.) It extends + header. (The name is an acronym for “Unix Standard TAR”.) It extends the historic format with new fields: struct header_posix_ustar { @@ -189,7 +189,7 @@ DESCRIPTION name, prefix If the pathname is too long to fit in the 100 bytes provided by the standard format, it can be split at any / character with the - first portion going into the prefix field. If the prefix field + first portion going into the prefix field. If the prefix field is not empty, the reader will prepend the prefix value and a / character to the regular name field to obtain the full pathname. The standard does not require a trailing / character on directory @@ -222,7 +222,7 @@ DESCRIPTION allows file sizes up to 64 GB. Another extension, utilized by GNU tar, star, and other newer tar imple‐ - mentations, permits binary numbers in the standard numeric fields. This + mentations, permits binary numbers in the standard numeric fields. This is flagged by setting the high bit of the first byte. The remainder of the field is treated as a signed twos-complement value. This permits 95-bit values for the length and time fields and 63-bit values for the @@ -266,7 +266,7 @@ DESCRIPTION mal, not octal. A description of some common keys follows: atime, ctime, mtime - File access, inode change, and modification times. These fields + File access, inode change, and modification times. These fields can be negative or include a decimal point and a fractional value. @@ -279,7 +279,7 @@ DESCRIPTION character ASCII string “BINARY”, then all textual values are as‐ sumed to be in a platform-dependent multi-byte encoding. Note that there are only two valid values for this key: “BINARY” or - “ISO-IR 10646 2000 UTF-8”. No other values are permitted by the + “ISO-IR 10646 2000 UTF-8”. No other values are permitted by the standard, and the latter value should generally not be used as it is the default when this key is not specified. In particular, this flag should not be used as a general mechanism to allow @@ -326,7 +326,7 @@ DESCRIPTION The file flags. SCHILY.realsize - The full size of the file on disk. XXX explain? XXX + The full size of the file on disk. XXX explain? XXX SCHILY.dev, SCHILY.ino, SCHILY.nlinks The device number, inode number, and link count for the entry. @@ -526,8 +526,8 @@ DESCRIPTION char offset[12]; char numbytes[12]; } sparse[21]; - char isextended[1]; - char padding[7]; + char isextended[1]; + char padding[7]; }; realsize @@ -540,9 +540,9 @@ DESCRIPTION GNU tar pax archives GNU tar 1.14 (XXX check this XXX) and later will write pax interchange - format archives when you specify the --posix flag. This format follows + format archives when you specify the --posix flag. This format follows the pax interchange format closely, using some SCHILY tags and introduc‐ - ing new keywords to store sparse file information. There have been three + ing new keywords to store sparse file information. There have been three iterations of the sparse file support, referred to as “0.0”, “0.1”, and “1.0”. @@ -552,7 +552,7 @@ DESCRIPTION to indicate the number of blocks in the file, a pair of GNU.sparse.offset and GNU.sparse.numbytes to indicate the offset and size of each block, and a single GNU.sparse.size to indicate - the full size of the file. This is not the same as the size in + the full size of the file. This is not the same as the size in the tar header because the latter value does not include the size of any holes. This format required that the order of attributes be preserved and relied on readers accepting multiple appearances @@ -623,7 +623,7 @@ DESCRIPTION Summary of tar type codes The following list is a condensed summary of the type codes used in tar - header records generated by different tar implementations. More details + header records generated by different tar implementations. More details about specific implementations can be found above: NUL Early tar programs stored a zero byte for regular files. 0 POSIX standard type code for a regular file. @@ -656,7 +656,7 @@ STANDARDS The tar utility is no longer a part of POSIX or the Single Unix Standard. It last appeared in Version 2 of the Single UNIX Specification (“SUSv2”). It has been supplanted in subsequent standards by pax(1). The ustar for‐ - mat is currently part of the specification for the pax(1) utility. The + mat is currently part of the specification for the pax(1) utility. The pax interchange file format is new with IEEE Std 1003.1-2001 (“POSIX.1”). HISTORY diff --git a/src/dependencies/libarchive-3.5.2/doc/update.sh b/src/dependencies/libarchive-3.6.2/doc/update.sh similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/update.sh rename to src/dependencies/libarchive-3.6.2/doc/update.sh diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/.ignore_me b/src/dependencies/libarchive-3.6.2/doc/wiki/.ignore_me similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/.ignore_me rename to src/dependencies/libarchive-3.6.2/doc/wiki/.ignore_me diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/Makefile b/src/dependencies/libarchive-3.6.2/doc/wiki/Makefile similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/wiki/Makefile rename to src/dependencies/libarchive-3.6.2/doc/wiki/Makefile index 206afa1..0b8cb5d 100644 --- a/src/dependencies/libarchive-3.5.2/doc/wiki/Makefile +++ b/src/dependencies/libarchive-3.6.2/doc/wiki/Makefile @@ -107,15 +107,15 @@ ManPageArchiveWriteSetPassphrase3.wiki: ../mdoc2wiki.awk ../../libarchive/archiv ManPageCpio5.wiki: ../mdoc2wiki.awk ../../libarchive/cpio.5 awk -f ../mdoc2wiki.awk < ../../libarchive/cpio.5 > ManPageCpio5.wiki +ManPageLibarchiveFormats5.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive-formats.5 + awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive-formats.5 > ManPageLibarchiveFormats5.wiki + ManPageLibarchive3.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive.3 awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive.3 > ManPageLibarchive3.wiki ManPageLibarchiveChanges3.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive_changes.3 awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive_changes.3 > ManPageLibarchiveChanges3.wiki -ManPageLibarchiveFormats5.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive-formats.5 - awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive-formats.5 > ManPageLibarchiveFormats5.wiki - ManPageLibarchiveInternals3.wiki: ../mdoc2wiki.awk ../../libarchive/libarchive_internals.3 awk -f ../mdoc2wiki.awk < ../../libarchive/libarchive_internals.3 > ManPageLibarchiveInternals3.wiki @@ -130,4 +130,4 @@ ManPageBsdtar1.wiki: ../mdoc2wiki.awk ../../tar/bsdtar.1 ManPageBsdcpio1.wiki: ../mdoc2wiki.awk ../../cpio/bsdcpio.1 awk -f ../mdoc2wiki.awk < ../../cpio/bsdcpio.1 > ManPageBsdcpio1.wiki -all: ManPageArchiveEntry3.wiki ManPageArchiveEntryAcl3.wiki ManPageArchiveEntryLinkify3.wiki ManPageArchiveEntryMisc3.wiki ManPageArchiveEntryPaths3.wiki ManPageArchiveEntryPerms3.wiki ManPageArchiveEntryStat3.wiki ManPageArchiveEntryTime3.wiki ManPageArchiveRead3.wiki ManPageArchiveReadAddPassphrase3.wiki ManPageArchiveReadData3.wiki ManPageArchiveReadDisk3.wiki ManPageArchiveReadExtract3.wiki ManPageArchiveReadFilter3.wiki ManPageArchiveReadFormat3.wiki ManPageArchiveReadFree3.wiki ManPageArchiveReadHeader3.wiki ManPageArchiveReadNew3.wiki ManPageArchiveReadOpen3.wiki ManPageArchiveReadSetOptions3.wiki ManPageArchiveUtil3.wiki ManPageArchiveWrite3.wiki ManPageArchiveWriteBlocksize3.wiki ManPageArchiveWriteData3.wiki ManPageArchiveWriteDisk3.wiki ManPageArchiveWriteFilter3.wiki ManPageArchiveWriteFinishEntry3.wiki ManPageArchiveWriteFormat3.wiki ManPageArchiveWriteFree3.wiki ManPageArchiveWriteHeader3.wiki ManPageArchiveWriteNew3.wiki ManPageArchiveWriteOpen3.wiki ManPageArchiveWriteSetOptions3.wiki ManPageArchiveWriteSetPassphrase3.wiki ManPageCpio5.wiki ManPageLibarchive3.wiki ManPageLibarchiveChanges3.wiki ManPageLibarchiveFormats5.wiki ManPageLibarchiveInternals3.wiki ManPageMtree5.wiki ManPageTar5.wiki ManPageBsdtar1.wiki ManPageBsdcpio1.wiki +all: ManPageArchiveEntry3.wiki ManPageArchiveEntryAcl3.wiki ManPageArchiveEntryLinkify3.wiki ManPageArchiveEntryMisc3.wiki ManPageArchiveEntryPaths3.wiki ManPageArchiveEntryPerms3.wiki ManPageArchiveEntryStat3.wiki ManPageArchiveEntryTime3.wiki ManPageArchiveRead3.wiki ManPageArchiveReadAddPassphrase3.wiki ManPageArchiveReadData3.wiki ManPageArchiveReadDisk3.wiki ManPageArchiveReadExtract3.wiki ManPageArchiveReadFilter3.wiki ManPageArchiveReadFormat3.wiki ManPageArchiveReadFree3.wiki ManPageArchiveReadHeader3.wiki ManPageArchiveReadNew3.wiki ManPageArchiveReadOpen3.wiki ManPageArchiveReadSetOptions3.wiki ManPageArchiveUtil3.wiki ManPageArchiveWrite3.wiki ManPageArchiveWriteBlocksize3.wiki ManPageArchiveWriteData3.wiki ManPageArchiveWriteDisk3.wiki ManPageArchiveWriteFilter3.wiki ManPageArchiveWriteFinishEntry3.wiki ManPageArchiveWriteFormat3.wiki ManPageArchiveWriteFree3.wiki ManPageArchiveWriteHeader3.wiki ManPageArchiveWriteNew3.wiki ManPageArchiveWriteOpen3.wiki ManPageArchiveWriteSetOptions3.wiki ManPageArchiveWriteSetPassphrase3.wiki ManPageCpio5.wiki ManPageLibarchiveFormats5.wiki ManPageLibarchive3.wiki ManPageLibarchiveChanges3.wiki ManPageLibarchiveInternals3.wiki ManPageMtree5.wiki ManPageTar5.wiki ManPageBsdtar1.wiki ManPageBsdcpio1.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntry3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntry3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntry3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntry3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryAcl3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryAcl3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryAcl3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryAcl3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryLinkify3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryLinkify3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryLinkify3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryLinkify3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryMisc3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryMisc3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryMisc3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryMisc3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryPaths3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryPaths3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryPaths3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryPaths3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryPerms3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryPerms3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryPerms3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryPerms3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryStat3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryStat3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryStat3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryStat3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryTime3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryTime3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveEntryTime3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveEntryTime3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveRead3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveRead3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveRead3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveRead3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadAddPassphrase3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadAddPassphrase3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadAddPassphrase3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadAddPassphrase3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadData3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadData3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadData3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadData3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadDisk3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadDisk3.wiki similarity index 73% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadDisk3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadDisk3.wiki index 7fb056a..eec92b2 100644 --- a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadDisk3.wiki +++ b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadDisk3.wiki @@ -1,6 +1,8 @@ ARCHIVE_READ_DISK(3) manual page == NAME == '''archive_read_disk_new''', +'''archive_read_disk_open''', +'''archive_read_disk_open_w''', '''archive_read_disk_set_behavior''', '''archive_read_disk_set_symlink_logical''', '''archive_read_disk_set_symlink_physical''', @@ -10,7 +12,14 @@ ARCHIVE_READ_DISK(3) manual page '''archive_read_disk_uname''', '''archive_read_disk_set_uname_lookup''', '''archive_read_disk_set_gname_lookup''', -'''archive_read_disk_set_standard_lookup''' +'''archive_read_disk_set_standard_lookup''', +'''archive_read_disk_descend''', +'''archive_read_disk_can_descend''', +'''archive_read_disk_current_filesystem''', +'''archive_read_disk_current_filesystem_is_synthetic''', +'''archive_read_disk_current_filesystem_is_remote''', +'''archive_read_disk_set_matching''', +'''archive_read_disk_set_metadata_filter_callback''', - functions for reading objects from disk == LIBRARY == Streaming Archive Library (libarchive, -larchive) @@ -23,6 +32,14 @@ Streaming Archive Library (libarchive, -larchive)
''int''
+'''archive_read_disk_open'''(''struct archive *'', ''const char *''); +
+''int'' +
+'''archive_read_disk_open_w'''(''struct archive *'', ''const wchar_t *'', ''''); +
+''int'' +
'''archive_read_disk_set_behavior'''(''struct archive *'', ''int'');
''int'' @@ -60,6 +77,34 @@ Streaming Archive Library (libarchive, -larchive) ''int''
'''archive_read_disk_entry_from_file'''(''struct archive *'', ''struct archive_entry *'', ''int fd'', ''const struct stat *''); +
+''int'' +
+'''archive_read_disk_descend'''(''struct archive *''); +
+''int'' +
+'''archive_read_disk_can_descend'''(''struct archive *''); +
+''int'' +
+'''archive_read_disk_current_filesystem'''(''struct archive *''); +
+''int'' +
+'''archive_read_disk_current_filesystem_is_synthetic'''(''struct archive *''); +
+''int'' +
+'''archive_read_disk_current_filesystem_is_remote'''(''struct archive *''); +
+''int'' +
+'''archive_read_disk_set_matching'''(''struct archive *'', ''struct archive *'', ''void (*excluded_func)(struct archive *, void *, struct archive entry *)'', ''void *''); +
+''int'' +
+'''archive_read_disk_set_metadata_filter_callback'''(''struct archive *'', ''int (*metadata_filter_func)(struct archive *, void*, struct archive_entry *)'', ''void *''); == DESCRIPTION == These functions provide an API for reading information about objects on disk. @@ -71,6 +116,14 @@ objects. Allocates and initializes a '''struct archive''' object suitable for reading object information from disk. +

'''archive_read_disk_open'''()
+Opens the file or directory from the given path and prepares the +'''struct archive''' +to read it from disk. +
'''archive_read_disk_open_w'''()
+Opens the file or directory from the given path as a wide character string and prepares the +'''struct archive''' +to read it from disk.
'''archive_read_disk_set_behavior'''()
Configures various behavior options when reading entries from disk. The flags field consists of a bitwise OR of one or more of the @@ -116,6 +169,9 @@ for more information on extended file attributes.
'''ARCHIVE_READDISK_RESTORE_ATIME'''
Restore access time of traversed files. By default, access time of traversed files is not restored. +
'''ARCHIVE_READDISK_NO_SPARSE'''
+Do not read sparse file information. +By default, sparse file information is read from disk.
'''archive_read_disk_set_symlink_logical'''(), @@ -200,6 +256,37 @@ using the currently-registered lookup functions above. This affects the file ownership fields and ACL values in the '''struct archive_entry''' object. +
'''archive_read_disk_descend'''()
+If the current entry can be descended, this function will mark the directory as the next entry for +[[ManPageArchiveReadHeader3]] +to visit. +
'''archive_read_disk_can_descend'''()
+Returns 1 if the current entry is an unvisited directory and 0 otherwise. +
'''archive_read_disk_current_filesystem'''()
+Returns the index of the most recent filesystem entry that has been visited through archive_read_disk +
'''archive_read_disk_current_filesystem_is_synthetic'''()
+Returns 1 if the current filesystem is a virtual filesystem. Returns 0 if the current filesystem is not a virtual filesystem. Returns -1 if it is unknown. +
'''archive_read_disk_current_filesystem_is_remote'''()
+Returns 1 if the current filesystem is a remote filesystem. Returns 0 if the current filesystem is not a remote filesystem. Returns -1 if it is unknown. +
'''archive_read_disk_set_matching'''()
+Allows the caller to set +'''struct archive''' +*_ma to compare each entry during +[[ManPageArchiveReadHeader3]] +calls. If matched based on calls to +'''archive_match_path_excluded ,''' +'''archive_match_time_excluded ,''' +or +'''archive_match_owner_excluded ,''' +then the callback function specified by the _excluded_func parameter will execute. This function will recieve data provided to the fourth parameter, void *_client_data. +
'''archive_read_disk_set_metadata_filter_callback'''()
+Allows the caller to set a callback function during calls to +[[ManPageArchiveReadHeader3]] +to filter out metadata for each entry. The callback function recieves the +'''struct archive''' +object, void* custom filter data, and the +'''struct archive_entry .''' +If the callback function returns an error, ARCHIVE_RETRY will be returned and the entry will not be further processed.
More information about the ''struct'' archive diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadExtract3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadExtract3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadExtract3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadExtract3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadFilter3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadFilter3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadFilter3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadFilter3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadFormat3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadFormat3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadFormat3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadFormat3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadFree3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadFree3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadFree3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadFree3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadHeader3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadHeader3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadHeader3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadHeader3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadNew3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadNew3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadNew3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadNew3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadOpen3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadOpen3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadOpen3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadOpen3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadSetOptions3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadSetOptions3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveReadSetOptions3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveReadSetOptions3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveUtil3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveUtil3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveUtil3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveUtil3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWrite3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWrite3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWrite3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWrite3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteBlocksize3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteBlocksize3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteBlocksize3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteBlocksize3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteData3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteData3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteData3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteData3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteDisk3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteDisk3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteDisk3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteDisk3.wiki index 1fca52c..e208be7 100644 --- a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteDisk3.wiki +++ b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteDisk3.wiki @@ -137,14 +137,14 @@ caused by archives that (deliberately or otherwise) extract files outside of the current directory. The default is not to perform this check. If -
'''ARCHIVE_EXTRACT_SPARSE'''
-Scan data for blocks of NUL bytes and try to recreate them with holes. -This results in sparse files, independent of whether the archive format -supports or uses them. '''ARCHIVE_EXTRACT_UNLINK''' is specified together with this option, the library will remove any intermediate symlinks it finds and return an error only if such symlink could not be removed. +
'''ARCHIVE_EXTRACT_SPARSE'''
+Scan data for blocks of NUL bytes and try to recreate them with holes. +This results in sparse files, independent of whether the archive format +supports or uses them.
'''ARCHIVE_EXTRACT_TIME'''
The timestamps (mtime, ctime, and atime) should be restored. By default, they are ignored. diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFilter3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFilter3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFilter3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFilter3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFinishEntry3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFinishEntry3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFinishEntry3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFinishEntry3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFormat3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFormat3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFormat3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFormat3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFree3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFree3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteFree3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteFree3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteHeader3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteHeader3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteHeader3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteHeader3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteNew3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteNew3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteNew3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteNew3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteOpen3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteOpen3.wiki similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteOpen3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteOpen3.wiki index 31abd29..092683c 100644 --- a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteOpen3.wiki +++ b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteOpen3.wiki @@ -178,6 +178,7 @@ On failure, the callback should invoke '''archive_set_error'''() to register an error code and message and return +'''ARCHIVE_FATAL'''.
  • ''typedef int'' diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteSetOptions3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteSetOptions3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteSetOptions3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteSetOptions3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteSetPassphrase3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteSetPassphrase3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageArchiveWriteSetPassphrase3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageArchiveWriteSetPassphrase3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageBsdcpio1.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageBsdcpio1.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageBsdcpio1.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageBsdcpio1.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageBsdtar1.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageBsdtar1.wiki similarity index 98% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageBsdtar1.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageBsdtar1.wiki index 4736bbb..3a0cea8 100644 --- a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageBsdtar1.wiki +++ b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageBsdtar1.wiki @@ -463,6 +463,11 @@ This is the reverse of and the default behavior if '''tar''' is run as non-root in x mode. +
--no-read-sparse
+(c, r, u modes only) +Do not read sparse file information from disk. +This is the reverse of +--read-sparse.
--no-safe-writes
(x mode only) Do not create temporary files and use @@ -626,10 +631,20 @@ a compression dictionary to improve compression ratio.
'''zstd:compression-level'''
A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. +
'''zstd:threads'''
+Specify the number of worker threads to use. +Setting threads to a special value 0 makes +[[zstd(1)|http://www.freebsd.org/cgi/man.cgi?query=zstd&sektion=1]] +use as many threads as there are CPU cores on the system.
'''lzop:compression-level'''
A decimal integer from 1 to 9 specifying the lzop compression level.
'''xz:compression-level'''
A decimal integer from 0 to 9 specifying the xz compression level. +
'''xz:threads'''
+Specify the number of worker threads to use. +Setting threads to a special value 0 makes +[[xz(1)|http://www.freebsd.org/cgi/man.cgi?query=xz&sektion=1]] +use as many threads as there are CPU cores on the system.
'''mtree:'''''keyword''
The mtree writer module allows you to specify which mtree keywords will be included in the output. @@ -723,6 +738,12 @@ By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a performance optimization. +
--read-sparse
+(c, r, u modes only) +Read sparse file information from disk. +This is the reverse of +--no-read-sparse +and the default behavior.
-S
(x mode only) Extract files as sparse files. diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageCpio5.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageCpio5.wiki similarity index 99% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageCpio5.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageCpio5.wiki index 4850863..a15d3c5 100644 --- a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageCpio5.wiki +++ b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageCpio5.wiki @@ -326,7 +326,7 @@ while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the "Programmer's Work Bench" derived from -At 6th Edition UNIX +At v6 that was used internally at AT&T. Both the new binary and old character formats were in use by 1980, according to the System III source released diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchive3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchive3.wiki similarity index 92% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchive3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchive3.wiki index 40f0340..fa79427 100644 --- a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchive3.wiki +++ b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchive3.wiki @@ -34,30 +34,40 @@ GNU-format tar archives,
  • most common cpio archive formats,
  • -ISO9660 CD images (including RockRidge and Joliet extensions), -
  • -Zip archives, +7-Zip archives,
  • ar archives (including GNU/SysV and BSD extensions),
  • Microsoft CAB archives,
  • +ISO9660 CD images (including RockRidge and Joliet extensions), +
  • LHA archives,
  • mtree file tree descriptions,
  • -RAR archives, +RAR and most RAR5 archives,
  • -XAR archives. +WARC archives, +
  • +XAR archives, +
  • +Zip archives.
  • The library automatically detects archives compressed with -[[gzip(1)|http://www.freebsd.org/cgi/man.cgi?query=gzip&sektion=1]], +[[compress(1)|http://www.freebsd.org/cgi/man.cgi?query=compress&sektion=1]], [[bzip2(1)|http://www.freebsd.org/cgi/man.cgi?query=bzip2&sektion=1]], -[[xz(1)|http://www.freebsd.org/cgi/man.cgi?query=xz&sektion=1]], +[[grzip(1)|http://www.freebsd.org/cgi/man.cgi?query=grzip&sektion=1]], +[[gzip(1)|http://www.freebsd.org/cgi/man.cgi?query=gzip&sektion=1]], +[[lrzip(1)|http://www.freebsd.org/cgi/man.cgi?query=lrzip&sektion=1]], +[[lz4(1)|http://www.freebsd.org/cgi/man.cgi?query=lz4&sektion=1]], [[lzip(1)|http://www.freebsd.org/cgi/man.cgi?query=lzip&sektion=1]], +[[lzop(1)|http://www.freebsd.org/cgi/man.cgi?query=lzop&sektion=1]], +[[xz(1)|http://www.freebsd.org/cgi/man.cgi?query=xz&sektion=1]], or -[[compress(1)|http://www.freebsd.org/cgi/man.cgi?query=compress&sektion=1]] -and decompresses them transparently. +[[zstd(1)|http://www.freebsd.org/cgi/man.cgi?query=zstd&sektion=1]] +and decompresses them transparently. Decompression of some formats +requires external decompressor utilities. It can similarly detect and decode archives processed with [[uuencode(1)|http://www.freebsd.org/cgi/man.cgi?query=uuencode&sektion=1]] or which have an @@ -79,19 +89,19 @@ archives,
  • cpio archives,
  • -Zip archive, +7-Zip archives, +
  • +ar archives,
  • two different variants of shar archives,
  • ISO9660 CD images,
  • -7-Zip archives, -
  • -ar archives, -
  • mtree file tree descriptions,
  • -XAR archives. +XAR archives, +
  • +Zip archive.
  • Pax interchange format is an extension of the tar archive format that eliminates essentially all of the limitations of historic tar formats diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchiveChanges3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchiveChanges3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchiveChanges3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchiveChanges3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchiveFormats5.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchiveFormats5.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchiveFormats5.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchiveFormats5.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchiveInternals3.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchiveInternals3.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageLibarchiveInternals3.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageLibarchiveInternals3.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageMtree5.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageMtree5.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageMtree5.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageMtree5.wiki diff --git a/src/dependencies/libarchive-3.5.2/doc/wiki/ManPageTar5.wiki b/src/dependencies/libarchive-3.6.2/doc/wiki/ManPageTar5.wiki similarity index 100% rename from src/dependencies/libarchive-3.5.2/doc/wiki/ManPageTar5.wiki rename to src/dependencies/libarchive-3.6.2/doc/wiki/ManPageTar5.wiki diff --git a/src/dependencies/libarchive-3.5.2/examples/minitar/README b/src/dependencies/libarchive-3.6.2/examples/minitar/README similarity index 100% rename from src/dependencies/libarchive-3.5.2/examples/minitar/README rename to src/dependencies/libarchive-3.6.2/examples/minitar/README diff --git a/src/dependencies/libarchive-3.5.2/examples/minitar/minitar.c b/src/dependencies/libarchive-3.6.2/examples/minitar/minitar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/examples/minitar/minitar.c rename to src/dependencies/libarchive-3.6.2/examples/minitar/minitar.c diff --git a/src/dependencies/libarchive-3.5.2/examples/tarfilter.c b/src/dependencies/libarchive-3.6.2/examples/tarfilter.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/examples/tarfilter.c rename to src/dependencies/libarchive-3.6.2/examples/tarfilter.c diff --git a/src/dependencies/libarchive-3.5.2/examples/untar.c b/src/dependencies/libarchive-3.6.2/examples/untar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/examples/untar.c rename to src/dependencies/libarchive-3.6.2/examples/untar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/libarchive/CMakeLists.txt similarity index 94% rename from src/dependencies/libarchive-3.5.2/libarchive/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/libarchive/CMakeLists.txt index 87901c5..ff7ade0 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/CMakeLists.txt +++ b/src/dependencies/libarchive-3.6.2/libarchive/CMakeLists.txt @@ -5,6 +5,10 @@ # ############################################ +if (ANDROID) + include_directories(${PROJECT_SOURCE_DIR}/contrib/android/include) +endif() + # Public headers SET(include_HEADERS archive.h @@ -78,6 +82,7 @@ SET(libarchive_SOURCES archive_read_set_format.c archive_read_set_options.c archive_read_support_filter_all.c + archive_read_support_filter_by_code.c archive_read_support_filter_bzip2.c archive_read_support_filter_compress.c archive_read_support_filter_gzip.c @@ -238,10 +243,10 @@ ELSEIF(ARCHIVE_ACL_SUNOS) ENDIF() # Libarchive is a shared library -#ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) -#TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) -#TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) -#SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) +ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) +TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) +TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) +SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) # archive_static is a static library ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) @@ -255,7 +260,7 @@ ENDIF(NOT WIN32 OR CYGWIN) IF(ENABLE_INSTALL) # How to install the libraries - INSTALL(TARGETS archive_static + INSTALL(TARGETS archive archive_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive.h b/src/dependencies/libarchive-3.6.2/libarchive/archive.h similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive.h index ca83cbd..217ac19 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive.h @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3005002 +#define ARCHIVE_VERSION_NUMBER 3006002 #include #include /* for wchar_t */ @@ -97,7 +97,7 @@ typedef ssize_t la_ssize_t; #endif /* Large file support for Android */ -#ifdef __ANDROID__ +#if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__) #include "android_lf.h" #endif @@ -120,6 +120,8 @@ typedef ssize_t la_ssize_t; # define __LA_DECL __declspec(dllimport) # endif # endif +#elif defined __LIBARCHIVE_ENABLE_VISIBILITY +# define __LA_DECL __attribute__((visibility("default"))) #else /* Static libraries or non-Windows needs no special declaration. */ # define __LA_DECL @@ -155,7 +157,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.5.2" +#define ARCHIVE_VERSION_ONLY_STRING "3.6.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); @@ -1024,6 +1026,8 @@ __LA_DECL int archive_read_disk_set_atime_restored(struct archive *); #define ARCHIVE_READDISK_NO_ACL (0x0020) /* Default: File flags are read from disk. */ #define ARCHIVE_READDISK_NO_FFLAGS (0x0040) +/* Default: Sparse file information is read from disk. */ +#define ARCHIVE_READDISK_NO_SPARSE (0x0080) __LA_DECL int archive_read_disk_set_behavior(struct archive *, int flags); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_acl.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_acl.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_acl.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_acl.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_acl_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_acl_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_acl_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_acl_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2.h similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_blake2.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_blake2.h index dd6fe6f..8f6b5e9 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2.h @@ -21,8 +21,10 @@ #if defined(_MSC_VER) #define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop)) -#else +#elif defined(__GNUC__) #define BLAKE2_PACKED(x) x __attribute__((packed)) +#else +#define BLAKE2_PACKED(x) _Pragma("pack 1") x _Pragma("pack 0") #endif #if defined(__cplusplus) diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2_impl.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2_impl.h similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_blake2_impl.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_blake2_impl.h index 0f05def..eb8619c 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2_impl.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2_impl.h @@ -154,7 +154,7 @@ static BLAKE2_INLINE uint64_t rotr64( const uint64_t w, const unsigned c ) /* prevents compiler optimizing out memset() */ static BLAKE2_INLINE void secure_zero_memory(void *v, size_t n) { - static void *(*const volatile memset_v)(void *, int, size_t) = &memset; + static void *(__LA_LIBC_CC *const volatile memset_v)(void *, int, size_t) = &memset; memset_v(v, 0, n); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2s_ref.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2s_ref.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_blake2s_ref.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_blake2s_ref.c index d92ffd0..93d3281 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2s_ref.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2s_ref.c @@ -13,6 +13,8 @@ https://blake2.net. */ +#include "archive_platform.h" + #include #include #include diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2sp_ref.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_blake2sp_ref.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c index aef1010..b913a4d 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_blake2sp_ref.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c @@ -13,6 +13,8 @@ https://blake2.net. */ +#include "archive_platform.h" + #include #include #include diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_check_magic.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_check_magic.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_check_magic.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_check_magic.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_cmdline.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_cmdline.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_cmdline.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_cmdline.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_cmdline_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_cmdline_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_cmdline_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_cmdline_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_crc32.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_crc32.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_crc32.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_crc32.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_cryptor.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_cryptor.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_cryptor.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_cryptor.c index d4bca90..112baf1 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_cryptor.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_cryptor.c @@ -401,14 +401,6 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) memcpy(ctx->key, key, key_len); memset(ctx->nonce, 0, sizeof(ctx->nonce)); ctx->encr_pos = AES_BLOCK_SIZE; -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) - if (!EVP_CIPHER_CTX_reset(ctx->ctx)) { - EVP_CIPHER_CTX_free(ctx->ctx); - ctx->ctx = NULL; - } -#else - EVP_CIPHER_CTX_init(ctx->ctx); -#endif return 0; } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_cryptor_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_cryptor_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_cryptor_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_cryptor_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_digest.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_digest.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_digest.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_digest.c index 410df01..3361b19 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_digest.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_digest.c @@ -49,16 +49,16 @@ * Initialize a Message digest. */ static int -win_crypto_init(Digest_CTX *ctx, ALG_ID algId) +win_crypto_init(Digest_CTX *ctx, DWORD prov, ALG_ID algId) { ctx->valid = 0; if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL, - PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { + prov, CRYPT_VERIFYCONTEXT)) { if (GetLastError() != (DWORD)NTE_BAD_KEYSET) return (ARCHIVE_FAILED); if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL, - PROV_RSA_FULL, CRYPT_NEWKEYSET)) + prov, CRYPT_NEWKEYSET)) return (ARCHIVE_FAILED); } @@ -243,7 +243,8 @@ __archive_md5init(archive_md5_ctx *ctx) { if ((*ctx = EVP_MD_CTX_new()) == NULL) return (ARCHIVE_FAILED); - EVP_DigestInit(*ctx, EVP_md5()); + if (!EVP_DigestInit(*ctx, EVP_md5())) + return (ARCHIVE_FAILED); return (ARCHIVE_OK); } @@ -275,7 +276,7 @@ __archive_md5final(archive_md5_ctx *ctx, void *md) static int __archive_md5init(archive_md5_ctx *ctx) { - return (win_crypto_init(ctx, CALG_MD5)); + return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_MD5)); } static int @@ -434,7 +435,8 @@ __archive_ripemd160init(archive_rmd160_ctx *ctx) { if ((*ctx = EVP_MD_CTX_new()) == NULL) return (ARCHIVE_FAILED); - EVP_DigestInit(*ctx, EVP_ripemd160()); + if (!EVP_DigestInit(*ctx, EVP_ripemd160())) + return (ARCHIVE_FAILED); return (ARCHIVE_OK); } @@ -624,7 +626,8 @@ __archive_sha1init(archive_sha1_ctx *ctx) { if ((*ctx = EVP_MD_CTX_new()) == NULL) return (ARCHIVE_FAILED); - EVP_DigestInit(*ctx, EVP_sha1()); + if (!EVP_DigestInit(*ctx, EVP_sha1())) + return (ARCHIVE_FAILED); return (ARCHIVE_OK); } @@ -656,7 +659,7 @@ __archive_sha1final(archive_sha1_ctx *ctx, void *md) static int __archive_sha1init(archive_sha1_ctx *ctx) { - return (win_crypto_init(ctx, CALG_SHA1)); + return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_SHA1)); } static int @@ -887,7 +890,8 @@ __archive_sha256init(archive_sha256_ctx *ctx) { if ((*ctx = EVP_MD_CTX_new()) == NULL) return (ARCHIVE_FAILED); - EVP_DigestInit(*ctx, EVP_sha256()); + if (!EVP_DigestInit(*ctx, EVP_sha256())) + return (ARCHIVE_FAILED); return (ARCHIVE_OK); } @@ -915,7 +919,7 @@ __archive_sha256final(archive_sha256_ctx *ctx, void *md) static int __archive_sha256init(archive_sha256_ctx *ctx) { - return (win_crypto_init(ctx, CALG_SHA_256)); + return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_256)); } static int @@ -1122,7 +1126,8 @@ __archive_sha384init(archive_sha384_ctx *ctx) { if ((*ctx = EVP_MD_CTX_new()) == NULL) return (ARCHIVE_FAILED); - EVP_DigestInit(*ctx, EVP_sha384()); + if (!EVP_DigestInit(*ctx, EVP_sha384())) + return (ARCHIVE_FAILED); return (ARCHIVE_OK); } @@ -1150,7 +1155,7 @@ __archive_sha384final(archive_sha384_ctx *ctx, void *md) static int __archive_sha384init(archive_sha384_ctx *ctx) { - return (win_crypto_init(ctx, CALG_SHA_384)); + return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_384)); } static int @@ -1381,7 +1386,8 @@ __archive_sha512init(archive_sha512_ctx *ctx) { if ((*ctx = EVP_MD_CTX_new()) == NULL) return (ARCHIVE_FAILED); - EVP_DigestInit(*ctx, EVP_sha512()); + if (!EVP_DigestInit(*ctx, EVP_sha512())) + return (ARCHIVE_FAILED); return (ARCHIVE_OK); } @@ -1409,7 +1415,7 @@ __archive_sha512final(archive_sha512_ctx *ctx, void *md) static int __archive_sha512init(archive_sha512_ctx *ctx) { - return (win_crypto_init(ctx, CALG_SHA_512)); + return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_512)); } static int diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_digest_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_digest_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_digest_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_digest_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_darwin.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_darwin.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_freebsd.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_freebsd.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_linux.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_linux.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_sunos.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_disk_acl_sunos.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_endian.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_endian.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_endian.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_endian.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry.c index ca7a4bd..ae6dc33 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry.c @@ -568,6 +568,13 @@ archive_entry_nlink(struct archive_entry *entry) return (entry->ae_stat.aest_nlink); } +/* Instead, our caller could have chosen a specific encoding + * (archive_mstring_get_mbs, archive_mstring_get_utf8, + * archive_mstring_get_wcs). So we should try multiple + * encodings. Try mbs first because of history, even though + * utf8 might be better for pathname portability. + * Also omit wcs because of type mismatch (char * versus wchar *) + */ const char * archive_entry_pathname(struct archive_entry *entry) { @@ -575,6 +582,13 @@ archive_entry_pathname(struct archive_entry *entry) if (archive_mstring_get_mbs( entry->archive, &entry->ae_pathname, &p) == 0) return (p); +#if HAVE_EILSEQ /*{*/ + if (errno == EILSEQ) { + if (archive_mstring_get_utf8( + entry->archive, &entry->ae_pathname, &p) == 0) + return (p); + } +#endif /*}*/ if (errno == ENOMEM) __archive_errx(1, "No memory"); return (NULL); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry.h similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry.h index bfba54f..e579e9f 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry.h @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3005002 +#define ARCHIVE_VERSION_NUMBER 3006002 /* * Note: archive_entry.h is for use outside of libarchive; the @@ -99,7 +99,7 @@ typedef ssize_t la_ssize_t; #endif /* Large file support for Android */ -#ifdef __ANDROID__ +#if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__) #include "android_lf.h" #endif @@ -122,6 +122,8 @@ typedef ssize_t la_ssize_t; # define __LA_DECL __declspec(dllimport) # endif # endif +#elif defined __LIBARCHIVE_ENABLE_VISIBILITY +# define __LA_DECL __attribute__((visibility("default"))) #else /* Static libraries on all platforms and shared libraries on non-Windows. */ # define __LA_DECL diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_acl.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_acl.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_acl.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_acl.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_copy_bhfi.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_copy_bhfi.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_copy_bhfi.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_copy_bhfi.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_copy_stat.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_copy_stat.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_copy_stat.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_copy_stat.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_link_resolver.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_link_resolver.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_link_resolver.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_link_resolver.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_linkify.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_linkify.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_linkify.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_linkify.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_locale.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_locale.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_locale.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_locale.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_misc.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_misc.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_misc.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_misc.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_paths.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_paths.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_paths.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_paths.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_perms.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_perms.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_perms.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_perms.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_sparse.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_sparse.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_sparse.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_sparse.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_stat.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_stat.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_stat.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_stat.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_stat.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_stat.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_stat.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_stat.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_strmode.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_strmode.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_strmode.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_strmode.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_time.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_time.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_time.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_time.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_entry_xattr.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_entry_xattr.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_entry_xattr.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_entry_xattr.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_getdate.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_getdate.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_getdate.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_getdate.c index 3ec5bba..39e224c 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_getdate.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_getdate.c @@ -714,7 +714,7 @@ Convert(time_t Month, time_t Day, time_t Year, ? 29 : 28; /* Checking for 2038 bogusly assumes that time_t is 32 bits. But I'm too lazy to try to check for time_t overflow in another way. */ - if (Year < EPOCH || Year > 2038 + if (Year < EPOCH || Year >= 2038 || Month < 1 || Month > 12 /* Lint fluff: "conversion from long may lose accuracy" */ || Day < 1 || Day > DaysInMonth[(int)--Month] diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_getdate.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_getdate.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_getdate.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_getdate.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_hmac.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_hmac.c similarity index 91% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_hmac.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_hmac.c index 2a9d04c..012fe15 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_hmac.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_hmac.c @@ -230,10 +230,23 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) static int __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) { +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + OSSL_PARAM params[2]; + + EVP_MAC *mac = EVP_MAC_fetch(NULL, "HMAC", NULL); + *ctx = EVP_MAC_CTX_new(mac); + if (*ctx == NULL) + return -1; + EVP_MAC_free(mac); + params[0] = OSSL_PARAM_construct_utf8_string("digest", "SHA1", 0); + params[1] = OSSL_PARAM_construct_end(); + EVP_MAC_init(*ctx, key, key_len, params); +#else *ctx = HMAC_CTX_new(); if (*ctx == NULL) return -1; HMAC_Init_ex(*ctx, key, key_len, EVP_sha1(), NULL); +#endif return 0; } @@ -241,22 +254,38 @@ static void __hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, size_t data_len) { +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + EVP_MAC_update(*ctx, data, data_len); +#else HMAC_Update(*ctx, data, data_len); +#endif } static void __hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) { +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + size_t len = *out_len; +#else unsigned int len = (unsigned int)*out_len; +#endif +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + EVP_MAC_final(*ctx, out, &len, *out_len); +#else HMAC_Final(*ctx, out, &len); +#endif *out_len = len; } static void __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) { +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + EVP_MAC_CTX_free(*ctx); +#else HMAC_CTX_free(*ctx); +#endif *ctx = NULL; } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_hmac_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_hmac_private.h similarity index 95% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_hmac_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_hmac_private.h index 13a67d4..50044a0 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_hmac_private.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_hmac_private.h @@ -74,9 +74,16 @@ typedef mbedtls_md_context_t archive_hmac_sha1_ctx; typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx; #elif defined(HAVE_LIBCRYPTO) +#include +#include +#if OPENSSL_VERSION_NUMBER >= 0x30000000L +typedef EVP_MAC_CTX *archive_hmac_sha1_ctx; + +#else #include "archive_openssl_hmac_private.h" typedef HMAC_CTX* archive_hmac_sha1_ctx; +#endif #else diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_match.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_match.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_match.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_match.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_openssl_evp_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_openssl_evp_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_openssl_hmac_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_openssl_hmac_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_options.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_options.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_options.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_options.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_options_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_options_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_options_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_options_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_pack_dev.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_pack_dev.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_pack_dev.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_pack_dev.c index f8286d8..d95444d 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_pack_dev.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_pack_dev.c @@ -77,7 +77,7 @@ static pack_t pack_12_20; static pack_t pack_14_18; static pack_t pack_8_24; static pack_t pack_bsdos; -static int compare_format(const void *, const void *); +static int __LA_LIBC_CC compare_format(const void *, const void *); static const char iMajorError[] = "invalid major number"; static const char iMinorError[] = "invalid minor number"; @@ -310,6 +310,7 @@ static const struct format { }; static int +__LA_LIBC_CC compare_format(const void *key, const void *element) { const char *name; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_pack_dev.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_pack_dev.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_pack_dev.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_pack_dev.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_pathmatch.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_pathmatch.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_pathmatch.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_pathmatch.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_pathmatch.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_pathmatch.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_pathmatch.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_pathmatch.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_platform.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_platform.h similarity index 85% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_platform.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_platform.h index b8bcb52..1038932 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_platform.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_platform.h @@ -69,8 +69,16 @@ * either Windows or Posix APIs. */ #if (defined(__WIN32__) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__) #include "archive_windows.h" +/* The C library on Windows specifies a calling convention for callback + * functions and exports; when we interact with them (capture pointers, + * call and pass function pointers) we need to match their calling + * convention. + * This only matters when libarchive is built with /Gr, /Gz or /Gv + * (which change the default calling convention.) */ +#define __LA_LIBC_CC __cdecl #else #define la_stat(path,stref) stat(path,stref) +#define __LA_LIBC_CC #endif /* @@ -155,6 +163,28 @@ #define INTMAX_MIN ((intmax_t)(~INTMAX_MAX)) #endif +/* Some platforms lack the standard PRIxN/PRIdN definitions. */ +#if !HAVE_INTTYPES_H || !defined(PRIx32) || !defined(PRId32) +#ifndef PRIx32 +#if SIZEOF_INT == 4 +#define PRIx32 "x" +#elif SIZEOF_LONG == 4 +#define PRIx32 "lx" +#else +#error No suitable 32-bit unsigned integer type found for this platform +#endif +#endif // PRIx32 +#ifndef PRId32 +#if SIZEOF_INT == 4 +#define PRId32 "d" +#elif SIZEOF_LONG == 4 +#define PRId32 "ld" +#else +#error No suitable 32-bit signed integer type found for this platform +#endif +#endif // PRId32 +#endif // !HAVE_INTTYPES_H || !defined(PRIx32) || !defined(PRId32) + /* * If we can't restore metadata using a file descriptor, then * for compatibility's sake, close files before trying to restore metadata. @@ -165,8 +195,9 @@ /* * glibc 2.24 deprecates readdir_r + * bionic c deprecates readdir_r too */ -#if defined(HAVE_READDIR_R) && (!defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)) +#if defined(HAVE_READDIR_R) && (!defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)) && (!defined(__ANDROID__)) #define USE_READDIR_R 1 #else #undef USE_READDIR_R diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_platform_acl.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_platform_acl.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_platform_acl.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_platform_acl.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_platform_xattr.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_platform_xattr.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_platform_xattr.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_platform_xattr.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd7.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd7.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd7.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd7.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd7_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd7_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd7_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd7_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd8.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd8.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd8.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd8.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd8_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd8_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd8_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd8_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_ppmd_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_ppmd_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_private.h similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_private.h index 55a8da1..b2a2cda 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_private.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_private.h @@ -107,14 +107,11 @@ struct archive { * Some public API functions depend on the "real" type of the * archive object. */ - struct archive_vtable *vtable; + const struct archive_vtable *vtable; int archive_format; const char *archive_format_name; - int compression_code; /* Currently active compression. */ - const char *compression_name; - /* Number of file entries processed. */ int file_count; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_random.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_random.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_random.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_random.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_random_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_random_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_random_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_random_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_rb.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_rb.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_rb.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_rb.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_rb.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_rb.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_rb.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_rb.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read.c similarity index 94% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read.c index c59f051..45a38ae 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read.c @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read.c 201157 2009-12-29 05:30:2 static int choose_filters(struct archive_read *); static int choose_format(struct archive_read *); static int close_filters(struct archive_read *); -static struct archive_vtable *archive_read_vtable(void); static int64_t _archive_filter_bytes(struct archive *, int); static int _archive_filter_code(struct archive *, int); static const char *_archive_filter_name(struct archive *, int); @@ -73,26 +72,18 @@ static int _archive_read_next_header2(struct archive *, struct archive_entry *); static int64_t advance_file_pointer(struct archive_read_filter *, int64_t); -static struct archive_vtable * -archive_read_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_filter_bytes = _archive_filter_bytes; - av.archive_filter_code = _archive_filter_code; - av.archive_filter_name = _archive_filter_name; - av.archive_filter_count = _archive_filter_count; - av.archive_read_data_block = _archive_read_data_block; - av.archive_read_next_header = _archive_read_next_header; - av.archive_read_next_header2 = _archive_read_next_header2; - av.archive_free = _archive_read_free; - av.archive_close = _archive_read_close; - inited = 1; - } - return (&av); -} +static const struct archive_vtable +archive_read_vtable = { + .archive_filter_bytes = _archive_filter_bytes, + .archive_filter_code = _archive_filter_code, + .archive_filter_name = _archive_filter_name, + .archive_filter_count = _archive_filter_count, + .archive_read_data_block = _archive_read_data_block, + .archive_read_next_header = _archive_read_next_header, + .archive_read_next_header2 = _archive_read_next_header2, + .archive_free = _archive_read_free, + .archive_close = _archive_read_close, +}; /* * Allocate, initialize and return a struct archive object. @@ -109,7 +100,7 @@ archive_read_new(void) a->archive.state = ARCHIVE_STATE_NEW; a->entry = archive_entry_new2(&a->archive); - a->archive.vtable = archive_read_vtable(); + a->archive.vtable = &archive_read_vtable; a->passphrases.last = &a->passphrases.first; @@ -245,24 +236,29 @@ client_seek_proxy(struct archive_read_filter *self, int64_t offset, int whence) } static int -client_close_proxy(struct archive_read_filter *self) +read_client_close_proxy(struct archive_read *a) { int r = ARCHIVE_OK, r2; unsigned int i; - if (self->archive->client.closer == NULL) + if (a->client.closer == NULL) return (r); - for (i = 0; i < self->archive->client.nodes; i++) + for (i = 0; i < a->client.nodes; i++) { - r2 = (self->archive->client.closer) - ((struct archive *)self->archive, - self->archive->client.dataset[i].data); + r2 = (a->client.closer) + ((struct archive *)a, a->client.dataset[i].data); if (r > r2) r = r2; } return (r); } +static int +client_close_proxy(struct archive_read_filter *self) +{ + return read_client_close_proxy(self->archive); +} + static int client_open_proxy(struct archive_read_filter *self) { @@ -298,9 +294,7 @@ client_switch_proxy(struct archive_read_filter *self, unsigned int iindex) r1 = (self->archive->client.closer) ((struct archive *)self->archive, self->data); self->data = data2; - if (self->archive->client.opener != NULL) - r2 = (self->archive->client.opener) - ((struct archive *)self->archive, self->data); + r2 = client_open_proxy(self); } return (r1 < r2) ? r1 : r2; } @@ -457,13 +451,18 @@ archive_read_prepend_callback_data(struct archive *_a, void *client_data) return archive_read_add_callback_data(_a, client_data, 0); } +static const struct archive_read_filter_vtable +none_reader_vtable = { + .read = client_read_proxy, + .close = client_close_proxy, +}; + int archive_read_open1(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter *filter, *tmp; int slot, e = ARCHIVE_OK; - unsigned int i; archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, "archive_read_open"); @@ -481,11 +480,7 @@ archive_read_open1(struct archive *_a) e = (a->client.opener)(&a->archive, a->client.dataset[0].data); if (e != 0) { /* If the open failed, call the closer to clean up. */ - if (a->client.closer) { - for (i = 0; i < a->client.nodes; i++) - (a->client.closer)(&a->archive, - a->client.dataset[i].data); - } + read_client_close_proxy(a); return (e); } } @@ -497,14 +492,11 @@ archive_read_open1(struct archive *_a) filter->upstream = NULL; filter->archive = a; filter->data = a->client.dataset[0].data; - filter->open = client_open_proxy; - filter->read = client_read_proxy; - filter->skip = client_skip_proxy; - filter->seek = client_seek_proxy; - filter->close = client_close_proxy; - filter->sswitch = client_switch_proxy; + filter->vtable = &none_reader_vtable; filter->name = "none"; filter->code = ARCHIVE_FILTER_NONE; + filter->can_skip = 1; + filter->can_seek = 1; a->client.dataset[0].begin_position = 0; if (!a->filter || !a->bypass_filter_bidding) @@ -570,12 +562,12 @@ choose_filters(struct archive_read *a) bidder = a->bidders; for (i = 0; i < number_bidders; i++, bidder++) { - if (bidder->bid != NULL) { - bid = (bidder->bid)(bidder, a->filter); - if (bid > best_bid) { - best_bid = bid; - best_bidder = bidder; - } + if (bidder->vtable == NULL) + continue; + bid = (bidder->vtable->bid)(bidder, a->filter); + if (bid > best_bid) { + best_bid = bid; + best_bidder = bidder; } } @@ -587,8 +579,6 @@ choose_filters(struct archive_read *a) __archive_read_free_filters(a); return (ARCHIVE_FATAL); } - a->archive.compression_name = a->filter->name; - a->archive.compression_code = a->filter->code; return (ARCHIVE_OK); } @@ -600,7 +590,7 @@ choose_filters(struct archive_read *a) filter->archive = a; filter->upstream = a->filter; a->filter = filter; - r = (best_bidder->init)(a->filter); + r = (best_bidder->vtable->init)(a->filter); if (r != ARCHIVE_OK) { __archive_read_free_filters(a); return (ARCHIVE_FATAL); @@ -614,10 +604,9 @@ choose_filters(struct archive_read *a) int __archive_read_header(struct archive_read *a, struct archive_entry *entry) { - if (a->filter->read_header) - return a->filter->read_header(a->filter, entry); - else + if (!a->filter->vtable->read_header) return (ARCHIVE_OK); + return a->filter->vtable->read_header(a->filter, entry); } /* @@ -1006,8 +995,8 @@ close_filters(struct archive_read *a) /* Close each filter in the pipeline. */ while (f != NULL) { struct archive_read_filter *t = f->upstream; - if (!f->closed && f->close != NULL) { - int r1 = (f->close)(f); + if (!f->closed && f->vtable != NULL) { + int r1 = (f->vtable->close)(f); f->closed = 1; if (r1 < r) r = r1; @@ -1112,11 +1101,10 @@ _archive_read_free(struct archive *_a) /* Release the bidder objects. */ n = sizeof(a->bidders)/sizeof(a->bidders[0]); for (i = 0; i < n; i++) { - if (a->bidders[i].free != NULL) { - int r1 = (a->bidders[i].free)(&a->bidders[i]); - if (r1 < r) - r = r1; - } + if (a->bidders[i].vtable == NULL || + a->bidders[i].vtable->free == NULL) + continue; + (a->bidders[i].vtable->free)(&a->bidders[i]); } /* Release passphrase list. */ @@ -1241,19 +1229,35 @@ __archive_read_register_format(struct archive_read *a, * initialization functions. */ int -__archive_read_get_bidder(struct archive_read *a, - struct archive_read_filter_bidder **bidder) +__archive_read_register_bidder(struct archive_read *a, + void *bidder_data, + const char *name, + const struct archive_read_filter_bidder_vtable *vtable) { + struct archive_read_filter_bidder *bidder; int i, number_slots; + archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "__archive_read_register_bidder"); + number_slots = sizeof(a->bidders) / sizeof(a->bidders[0]); for (i = 0; i < number_slots; i++) { - if (a->bidders[i].bid == NULL) { - memset(a->bidders + i, 0, sizeof(a->bidders[0])); - *bidder = (a->bidders + i); - return (ARCHIVE_OK); + if (a->bidders[i].vtable != NULL) + continue; + memset(a->bidders + i, 0, sizeof(a->bidders[0])); + bidder = (a->bidders + i); + bidder->data = bidder_data; + bidder->name = name; + bidder->vtable = vtable; + if (bidder->vtable->bid == NULL || bidder->vtable->init == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "Internal error: " + "no bid/init for filter bidder"); + return (ARCHIVE_FATAL); } + + return (ARCHIVE_OK); } archive_set_error(&a->archive, ENOMEM, @@ -1382,7 +1386,7 @@ __archive_read_filter_ahead(struct archive_read_filter *filter, *avail = 0; return (NULL); } - bytes_read = (filter->read)(filter, + bytes_read = (filter->vtable->read)(filter, &filter->client_buff); if (bytes_read < 0) { /* Read error. */ filter->client_total = filter->client_avail = 0; @@ -1561,8 +1565,8 @@ advance_file_pointer(struct archive_read_filter *filter, int64_t request) return (total_bytes_skipped); /* If there's an optimized skip function, use it. */ - if (filter->skip != NULL) { - bytes_skipped = (filter->skip)(filter, request); + if (filter->can_skip != 0) { + bytes_skipped = client_skip_proxy(filter, request); if (bytes_skipped < 0) { /* error */ filter->fatal = 1; return (bytes_skipped); @@ -1576,7 +1580,7 @@ advance_file_pointer(struct archive_read_filter *filter, int64_t request) /* Use ordinary reads as necessary to complete the request. */ for (;;) { - bytes_read = (filter->read)(filter, &filter->client_buff); + bytes_read = (filter->vtable->read)(filter, &filter->client_buff); if (bytes_read < 0) { filter->client_buff = NULL; filter->fatal = 1; @@ -1631,7 +1635,7 @@ __archive_read_filter_seek(struct archive_read_filter *filter, int64_t offset, if (filter->closed || filter->fatal) return (ARCHIVE_FATAL); - if (filter->seek == NULL) + if (filter->can_seek == 0) return (ARCHIVE_FAILED); client = &(filter->archive->client); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_add_passphrase.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_add_passphrase.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_add_passphrase.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_add_passphrase.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_add_passphrase.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_add_passphrase.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_append_filter.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_append_filter.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_append_filter.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_append_filter.c index da7c55b..25dc4b2 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_append_filter.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_append_filter.c @@ -135,7 +135,7 @@ archive_read_append_filter(struct archive *_a, int code) filter->archive = a; filter->upstream = a->filter; a->filter = filter; - r2 = (bidder->init)(a->filter); + r2 = (bidder->vtable->init)(a->filter); if (r2 != ARCHIVE_OK) { __archive_read_free_filters(a); return (ARCHIVE_FATAL); @@ -192,7 +192,7 @@ archive_read_append_filter_program_signature(struct archive *_a, filter->archive = a; filter->upstream = a->filter; a->filter = filter; - r = (bidder->init)(a->filter); + r = (bidder->vtable->init)(a->filter); if (r != ARCHIVE_OK) { __archive_read_free_filters(a); return (ARCHIVE_FATAL); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_data.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_data.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_data.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_data.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_data_into_fd.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_data_into_fd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_data_into_fd.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_data_into_fd.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk.3 similarity index 75% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk.3 index 82d6a5c..8b568d7 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk.3 +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk.3 @@ -29,6 +29,8 @@ .Os .Sh NAME .Nm archive_read_disk_new , +.Nm archive_read_disk_open , +.Nm archive_read_disk_open_w , .Nm archive_read_disk_set_behavior , .Nm archive_read_disk_set_symlink_logical , .Nm archive_read_disk_set_symlink_physical , @@ -38,7 +40,14 @@ .Nm archive_read_disk_uname , .Nm archive_read_disk_set_uname_lookup , .Nm archive_read_disk_set_gname_lookup , -.Nm archive_read_disk_set_standard_lookup +.Nm archive_read_disk_set_standard_lookup , +.Nm archive_read_disk_descend , +.Nm archive_read_disk_can_descend , +.Nm archive_read_disk_current_filesystem , +.Nm archive_read_disk_current_filesystem_is_synthetic , +.Nm archive_read_disk_current_filesystem_is_remote , +.Nm archive_read_disk_set_matching , +.Nm archive_read_disk_set_metadata_filter_callback , .Nd functions for reading objects from disk .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) @@ -47,6 +56,10 @@ Streaming Archive Library (libarchive, -larchive) .Ft struct archive * .Fn archive_read_disk_new "void" .Ft int +.Fn archive_read_disk_open "struct archive *" "const char *" +.Ft int +.Fn archive_read_disk_open_w "struct archive *" "const wchar_t *" +.Ft int .Fn archive_read_disk_set_behavior "struct archive *" "int" .Ft int .Fn archive_read_disk_set_symlink_logical "struct archive *" @@ -81,6 +94,29 @@ Streaming Archive Library (libarchive, -larchive) .Fa "int fd" .Fa "const struct stat *" .Fc +.Ft int +.Fn archive_read_disk_descend "struct archive *" +.Ft int +.Fn archive_read_disk_can_descend "struct archive *" +.Ft int +.Fn archive_read_disk_current_filesystem "struct archive *" +.Ft int +.Fn archive_read_disk_current_filesystem_is_synthetic "struct archive *" +.Ft int +.Fn archive_read_disk_current_filesystem_is_remote "struct archive *" +.Ft int +.Fo archive_read_disk_set_matching +.Fa "struct archive *" +.Fa "struct archive *" +.Fa "void (*excluded_func)(struct archive *, void *, struct archive entry *)" +.Fa "void *" +.Fc +.Ft int +.Fo archive_read_disk_set_metadata_filter_callback +.Fa "struct archive *" +.Fa "int (*metadata_filter_func)(struct archive *, void*, struct archive_entry *)" +.Fa "void *" +.Fc .Sh DESCRIPTION These functions provide an API for reading information about objects on disk. @@ -92,6 +128,14 @@ objects. Allocates and initializes a .Tn struct archive object suitable for reading object information from disk. +.It Fn archive_read_disk_open +Opens the file or directory from the given path and prepares the +.Tn struct archive +to read it from disk. +.It Fn archive_read_disk_open_w +Opens the file or directory from the given path as a wide character string and prepares the +.Tn struct archive +to read it from disk. .It Fn archive_read_disk_set_behavior Configures various behavior options when reading entries from disk. The flags field consists of a bitwise OR of one or more of the @@ -137,6 +181,9 @@ for more information on extended file attributes. .It Cm ARCHIVE_READDISK_RESTORE_ATIME Restore access time of traversed files. By default, access time of traversed files is not restored. +.It Cm ARCHIVE_READDISK_NO_SPARSE +Do not read sparse file information. +By default, sparse file information is read from disk. .El .It Xo .Fn archive_read_disk_set_symlink_logical , @@ -221,6 +268,37 @@ using the currently-registered lookup functions above. This affects the file ownership fields and ACL values in the .Tn struct archive_entry object. +.It Fn archive_read_disk_descend +If the current entry can be descended, this function will mark the directory as the next entry for +.Xr archive_read_header 3 +to visit. +.It Fn archive_read_disk_can_descend +Returns 1 if the current entry is an unvisited directory and 0 otherwise. +.It Fn archive_read_disk_current_filesystem +Returns the index of the most recent filesystem entry that has been visited through archive_read_disk +.It Fn archive_read_disk_current_filesystem_is_synthetic +Returns 1 if the current filesystem is a virtual filesystem. Returns 0 if the current filesystem is not a virtual filesystem. Returns -1 if it is unknown. +.It Fn archive_read_disk_current_filesystem_is_remote +Returns 1 if the current filesystem is a remote filesystem. Returns 0 if the current filesystem is not a remote filesystem. Returns -1 if it is unknown. +.It Fn archive_read_disk_set_matching +Allows the caller to set +.Tn struct archive +*_ma to compare each entry during +.Xr archive_read_header 3 +calls. If matched based on calls to +.Tn archive_match_path_excluded , +.Tn archive_match_time_excluded , +or +.Tn archive_match_owner_excluded , +then the callback function specified by the _excluded_func parameter will execute. This function will recieve data provided to the fourth parameter, void *_client_data. +.It Fn archive_read_disk_set_metadata_filter_callback +Allows the caller to set a callback function during calls to +.Xr archive_read_header 3 +to filter out metadata for each entry. The callback function recieves the +.Tn struct archive +object, void* custom filter data, and the +.Tn struct archive_entry . +If the callback function returns an error, ARCHIVE_RETRY will be returned and the entry will not be further processed. .El More information about the .Va struct archive diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_entry_from_file.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_entry_from_file.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c index 9c9cf38..ab0270b 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_entry_from_file.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c @@ -303,9 +303,11 @@ archive_read_disk_entry_from_file(struct archive *_a, if (r1 < r) r = r1; } - r1 = setup_sparse(a, entry, &fd); - if (r1 < r) - r = r1; + if ((a->flags & ARCHIVE_READDISK_NO_SPARSE) == 0) { + r1 = setup_sparse(a, entry, &fd); + if (r1 < r) + r = r1; + } /* If we opened the file earlier in this function, close it. */ if (initial_fd != fd) diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_posix.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_posix.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_posix.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_posix.c index 3ee6269..5a94ec5 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_posix.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_posix.c @@ -34,9 +34,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_PARAM_H #include #endif -#ifdef HAVE_SYS_MOUNT_H -#include -#endif #ifdef HAVE_SYS_STAT_H #include #endif @@ -54,6 +51,8 @@ __FBSDID("$FreeBSD$"); #endif #ifdef HAVE_LINUX_FS_H #include +#elif HAVE_SYS_MOUNT_H +#include #endif /* * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. @@ -109,6 +108,11 @@ __FBSDID("$FreeBSD$"); #define O_CLOEXEC 0 #endif +#if defined(__hpux) && !defined(HAVE_DIRFD) +#define dirfd(x) ((x)->__dd_fd) +#define HAVE_DIRFD +#endif + /*- * This is a new directory-walking system that addresses a number * of problems I've had with fts(3). In particular, it has no @@ -369,22 +373,14 @@ static int open_on_current_dir(struct tree *, const char *, int); static int tree_dup(int); -static struct archive_vtable * -archive_read_disk_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_free = _archive_read_free; - av.archive_close = _archive_read_close; - av.archive_read_data_block = _archive_read_data_block; - av.archive_read_next_header = _archive_read_next_header; - av.archive_read_next_header2 = _archive_read_next_header2; - inited = 1; - } - return (&av); -} +static const struct archive_vtable +archive_read_disk_vtable = { + .archive_free = _archive_read_free, + .archive_close = _archive_read_close, + .archive_read_data_block = _archive_read_data_block, + .archive_read_next_header = _archive_read_next_header, + .archive_read_next_header2 = _archive_read_next_header2, +}; const char * archive_read_disk_gname(struct archive *_a, la_int64_t gid) @@ -461,7 +457,7 @@ archive_read_disk_new(void) return (NULL); a->archive.magic = ARCHIVE_READ_DISK_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; - a->archive.vtable = archive_read_disk_vtable(); + a->archive.vtable = &archive_read_disk_vtable; a->entry = archive_entry_new2(&a->archive); a->lookup_uname = trivial_lookup_uname; a->lookup_gname = trivial_lookup_gname; @@ -1290,7 +1286,7 @@ archive_read_disk_descend(struct archive *_a) ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, "archive_read_disk_descend"); - if (t->visit_type != TREE_REGULAR || !t->descend) + if (!archive_read_disk_can_descend(_a)) return (ARCHIVE_OK); /* @@ -2106,6 +2102,8 @@ tree_push(struct tree *t, const char *path, int filesystem_id, struct tree_entry *te; te = calloc(1, sizeof(*te)); + if (te == NULL) + __archive_errx(1, "Out of memory"); te->next = t->stack; te->parent = t->current; if (te->parent) @@ -2436,7 +2434,7 @@ tree_dir_next_posix(struct tree *t) #else /* HAVE_FDOPENDIR */ if (tree_enter_working_dir(t) == 0) { t->d = opendir("."); -#if HAVE_DIRFD || defined(dirfd) +#ifdef HAVE_DIRFD __archive_ensure_cloexec_flag(dirfd(t->d)); #endif } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_set_standard_lookup.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_set_standard_lookup.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_set_standard_lookup.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_set_standard_lookup.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_windows.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_windows.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_windows.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_windows.c index 877bc44..f9d1395 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_disk_windows.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_disk_windows.c @@ -418,8 +418,9 @@ la_linkname_from_pathw(const wchar_t *path, wchar_t **outbuf, int *linktype) FILE_FLAG_OPEN_REPARSE_POINT; int ret; - h = CreateFileW(path, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, flag, - NULL); + h = CreateFileW(path, 0, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, + OPEN_EXISTING, flag, NULL); if (h == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); return (-1); @@ -449,22 +450,14 @@ entry_symlink_from_pathw(struct archive_entry *entry, const wchar_t *path) return; } -static struct archive_vtable * -archive_read_disk_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_free = _archive_read_free; - av.archive_close = _archive_read_close; - av.archive_read_data_block = _archive_read_data_block; - av.archive_read_next_header = _archive_read_next_header; - av.archive_read_next_header2 = _archive_read_next_header2; - inited = 1; - } - return (&av); -} +static const struct archive_vtable +archive_read_disk_vtable = { + .archive_free = _archive_read_free, + .archive_close = _archive_read_close, + .archive_read_data_block = _archive_read_data_block, + .archive_read_next_header = _archive_read_next_header, + .archive_read_next_header2 = _archive_read_next_header2, +}; const char * archive_read_disk_gname(struct archive *_a, la_int64_t gid) @@ -541,7 +534,7 @@ archive_read_disk_new(void) return (NULL); a->archive.magic = ARCHIVE_READ_DISK_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; - a->archive.vtable = archive_read_disk_vtable(); + a->archive.vtable = &archive_read_disk_vtable; a->entry = archive_entry_new2(&a->archive); a->lookup_uname = trivial_lookup_uname; a->lookup_gname = trivial_lookup_gname; @@ -1081,7 +1074,9 @@ next_entry(struct archive_read_disk *a, struct tree *t, else flags |= FILE_FLAG_SEQUENTIAL_SCAN; t->entry_fh = CreateFileW(tree_current_access_path(t), - GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, flags, NULL); + GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, flags, NULL); if (t->entry_fh == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); archive_set_error(&a->archive, errno, @@ -1090,9 +1085,11 @@ next_entry(struct archive_read_disk *a, struct tree *t, } /* Find sparse data from the disk. */ - if (archive_entry_hardlink(entry) == NULL && - (st->dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0) - r = setup_sparse_from_disk(a, entry, t->entry_fh); + if ((a->flags & ARCHIVE_READDISK_NO_SPARSE) == 0) { + if (archive_entry_hardlink(entry) == NULL && + (st->dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0) + r = setup_sparse_from_disk(a, entry, t->entry_fh); + } } return (r); } @@ -1300,7 +1297,7 @@ archive_read_disk_descend(struct archive *_a) ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, "archive_read_disk_descend"); - if (t->visit_type != TREE_REGULAR || !t->descend) + if (!archive_read_disk_can_descend(_a)) return (ARCHIVE_OK); if (tree_current_is_physical_dir(t)) { @@ -2052,7 +2049,8 @@ tree_current_file_information(struct tree *t, BY_HANDLE_FILE_INFORMATION *st, if (sim_lstat && tree_current_is_physical_link(t)) flag |= FILE_FLAG_OPEN_REPARSE_POINT; - h = CreateFileW(tree_current_access_path(t), 0, FILE_SHARE_READ, NULL, + h = CreateFileW(tree_current_access_path(t), 0, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, flag, NULL); if (h == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); @@ -2281,7 +2279,8 @@ archive_read_disk_entry_from_file(struct archive *_a, } else desiredAccess = GENERIC_READ; - h = CreateFileW(path, desiredAccess, FILE_SHARE_READ, NULL, + h = CreateFileW(path, desiredAccess, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, flag, NULL); if (h == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); @@ -2343,7 +2342,8 @@ archive_read_disk_entry_from_file(struct archive *_a, if (fd >= 0) { h = (HANDLE)_get_osfhandle(fd); } else { - h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, + h = CreateFileW(path, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (h == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); @@ -2371,9 +2371,11 @@ archive_read_disk_entry_from_file(struct archive *_a, return (ARCHIVE_OK); } - r = setup_sparse_from_disk(a, entry, h); - if (fd < 0) - CloseHandle(h); + if ((a->flags & ARCHIVE_READDISK_NO_SPARSE) == 0) { + r = setup_sparse_from_disk(a, entry, h); + if (fd < 0) + CloseHandle(h); + } return (r); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_extract.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_extract.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_extract.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_extract.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_extract.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_extract.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_extract.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_extract.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_extract2.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_extract2.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_extract2.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_extract2.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_filter.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_filter.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_filter.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_filter.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_format.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_format.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_format.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_format.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_free.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_free.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_free.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_free.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_header.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_header.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_header.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_header.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_new.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_new.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_new.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_new.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_open.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_open.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_open.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_open.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_fd.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_fd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_fd.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_fd.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_file.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_file.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_file.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_file.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_filename.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_filename.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_filename.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_filename.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_memory.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_memory.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_open_memory.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_open_memory.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_private.h similarity index 92% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_private.h index c842e6f..383405d 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_private.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_private.h @@ -42,6 +42,16 @@ struct archive_read; struct archive_read_filter_bidder; struct archive_read_filter; +struct archive_read_filter_bidder_vtable { + /* Taste the upstream filter to see if we handle this. */ + int (*bid)(struct archive_read_filter_bidder *, + struct archive_read_filter *); + /* Initialize a newly-created filter. */ + int (*init)(struct archive_read_filter *); + /* Release the bidder's configuration data. */ + void (*free)(struct archive_read_filter_bidder *); +}; + /* * How bidding works for filters: * * The bid manager initializes the client-provided reader as the @@ -62,16 +72,16 @@ struct archive_read_filter_bidder { void *data; /* Name of the filter */ const char *name; - /* Taste the upstream filter to see if we handle this. */ - int (*bid)(struct archive_read_filter_bidder *, - struct archive_read_filter *); - /* Initialize a newly-created filter. */ - int (*init)(struct archive_read_filter *); - /* Set an option for the filter bidder. */ - int (*options)(struct archive_read_filter_bidder *, - const char *key, const char *value); - /* Release the bidder's configuration data. */ - int (*free)(struct archive_read_filter_bidder *); + const struct archive_read_filter_bidder_vtable *vtable; +}; + +struct archive_read_filter_vtable { + /* Return next block. */ + ssize_t (*read)(struct archive_read_filter *, const void **); + /* Close (just this filter) and free(self). */ + int (*close)(struct archive_read_filter *self); + /* Read any header metadata if available. */ + int (*read_header)(struct archive_read_filter *self, struct archive_entry *entry); }; /* @@ -86,25 +96,14 @@ struct archive_read_filter { struct archive_read_filter_bidder *bidder; /* My bidder. */ struct archive_read_filter *upstream; /* Who I read from. */ struct archive_read *archive; /* Associated archive. */ - /* Open a block for reading */ - int (*open)(struct archive_read_filter *self); - /* Return next block. */ - ssize_t (*read)(struct archive_read_filter *, const void **); - /* Skip forward this many bytes. */ - int64_t (*skip)(struct archive_read_filter *self, int64_t request); - /* Seek to an absolute location. */ - int64_t (*seek)(struct archive_read_filter *self, int64_t offset, int whence); - /* Close (just this filter) and free(self). */ - int (*close)(struct archive_read_filter *self); - /* Function that handles switching from reading one block to the next/prev */ - int (*sswitch)(struct archive_read_filter *self, unsigned int iindex); - /* Read any header metadata if available. */ - int (*read_header)(struct archive_read_filter *self, struct archive_entry *entry); + const struct archive_read_filter_vtable *vtable; /* My private data. */ void *data; const char *name; int code; + int can_skip; + int can_seek; /* Used by reblocking logic. */ char *buffer; @@ -242,8 +241,10 @@ int __archive_read_register_format(struct archive_read *a, int (*format_capabilities)(struct archive_read *), int (*has_encrypted_entries)(struct archive_read *)); -int __archive_read_get_bidder(struct archive_read *a, - struct archive_read_filter_bidder **bidder); +int __archive_read_register_bidder(struct archive_read *a, + void *bidder_data, + const char *name, + const struct archive_read_filter_bidder_vtable *vtable); const void *__archive_read_ahead(struct archive_read *, size_t, ssize_t *); const void *__archive_read_filter_ahead(struct archive_read_filter *, diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_set_format.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_set_format.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_set_format.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_set_format.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_set_options.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_set_options.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_set_options.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_set_options.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_set_options.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_set_options.c similarity index 85% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_set_options.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_set_options.c index 2e2eea6..2bd9b81 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_set_options.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_set_options.c @@ -112,37 +112,15 @@ static int archive_set_filter_option(struct archive *_a, const char *m, const char *o, const char *v) { - struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter *filter; - struct archive_read_filter_bidder *bidder; - int r, rv = ARCHIVE_WARN, matched_modules = 0; + (void)_a; /* UNUSED */ + (void)o; /* UNUSED */ + (void)v; /* UNUSED */ - for (filter = a->filter; filter != NULL; filter = filter->upstream) { - bidder = filter->bidder; - if (bidder == NULL) - continue; - if (bidder->options == NULL) - /* This bidder does not support option */ - continue; - if (m != NULL) { - if (strcmp(filter->name, m) != 0) - continue; - ++matched_modules; - } - - r = bidder->options(bidder, o, v); - - if (r == ARCHIVE_FATAL) - return (ARCHIVE_FATAL); - - if (r == ARCHIVE_OK) - rv = ARCHIVE_OK; - } /* If the filter name didn't match, return a special code for * _archive_set_option[s]. */ - if (m != NULL && matched_modules == 0) + if (m != NULL) return ARCHIVE_WARN - 1; - return (rv); + return ARCHIVE_WARN; } static int diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_all.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_all.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_all.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_all.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_by_code.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_by_code.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_bzip2.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c similarity index 93% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_bzip2.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c index 3885a7c..793d605 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_bzip2.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c @@ -70,7 +70,6 @@ static int bzip2_filter_close(struct archive_read_filter *); */ static int bzip2_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int bzip2_reader_init(struct archive_read_filter *); -static int bzip2_reader_free(struct archive_read_filter_bidder *); #if ARCHIVE_VERSION_NUMBER < 4000000 /* Deprecated; remove in libarchive 4.0 */ @@ -81,24 +80,21 @@ archive_read_support_compression_bzip2(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +bzip2_bidder_vtable = { + .bid = bzip2_reader_bid, + .init = bzip2_reader_init, +}; + int archive_read_support_filter_bzip2(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *reader; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_bzip2"); - - if (__archive_read_get_bidder(a, &reader) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "bzip2", + &bzip2_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - reader->data = NULL; - reader->name = "bzip2"; - reader->bid = bzip2_reader_bid; - reader->init = bzip2_reader_init; - reader->options = NULL; - reader->free = bzip2_reader_free; #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR) return (ARCHIVE_OK); #else @@ -108,12 +104,6 @@ archive_read_support_filter_bzip2(struct archive *_a) #endif } -static int -bzip2_reader_free(struct archive_read_filter_bidder *self){ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} - /* * Test whether we can handle this data. * @@ -183,6 +173,12 @@ bzip2_reader_init(struct archive_read_filter *self) #else +static const struct archive_read_filter_vtable +bzip2_reader_vtable = { + .read = bzip2_filter_read, + .close = bzip2_filter_close, +}; + /* * Setup the callbacks. */ @@ -209,9 +205,7 @@ bzip2_reader_init(struct archive_read_filter *self) self->data = state; state->out_block_size = out_block_size; state->out_block = out_block; - self->read = bzip2_filter_read; - self->skip = NULL; /* not supported */ - self->close = bzip2_filter_close; + self->vtable = &bzip2_reader_vtable; return (ARCHIVE_OK); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_compress.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c similarity index 94% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_compress.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c index e05132d..05b80a5 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_compress.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c @@ -133,7 +133,6 @@ struct private_data { static int compress_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int compress_bidder_init(struct archive_read_filter *); -static int compress_bidder_free(struct archive_read_filter_bidder *); static ssize_t compress_filter_read(struct archive_read_filter *, const void **); static int compress_filter_close(struct archive_read_filter *); @@ -150,25 +149,19 @@ archive_read_support_compression_compress(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +compress_bidder_vtable = { + .bid = compress_bidder_bid, + .init = compress_bidder_init, +}; + int archive_read_support_filter_compress(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_compress"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) - return (ARCHIVE_FATAL); - - bidder->data = NULL; - bidder->name = "compress (.Z)"; - bidder->bid = compress_bidder_bid; - bidder->init = compress_bidder_init; - bidder->options = NULL; - bidder->free = compress_bidder_free; - return (ARCHIVE_OK); + return __archive_read_register_bidder(a, NULL, "compress (.Z)", + &compress_bidder_vtable); } /* @@ -205,6 +198,12 @@ compress_bidder_bid(struct archive_read_filter_bidder *self, return (bits_checked); } +static const struct archive_read_filter_vtable +compress_reader_vtable = { + .read = compress_filter_read, + .close = compress_filter_close, +}; + /* * Setup the callbacks. */ @@ -233,9 +232,7 @@ compress_bidder_init(struct archive_read_filter *self) self->data = state; state->out_block_size = out_block_size; state->out_block = out_block; - self->read = compress_filter_read; - self->skip = NULL; /* not supported */ - self->close = compress_filter_close; + self->vtable = &compress_reader_vtable; /* XXX MOVE THE FOLLOWING OUT OF INIT() XXX */ @@ -305,16 +302,6 @@ compress_filter_read(struct archive_read_filter *self, const void **pblock) return (p - start); } -/* - * Clean up the reader. - */ -static int -compress_bidder_free(struct archive_read_filter_bidder *self) -{ - self->data = NULL; - return (ARCHIVE_OK); -} - /* * Close and release the filter. */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_grzip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c similarity index 86% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_grzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c index 84c86ae..d4d1737 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_grzip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c @@ -54,30 +54,21 @@ static int grzip_bidder_bid(struct archive_read_filter_bidder *, static int grzip_bidder_init(struct archive_read_filter *); -static int -grzip_reader_free(struct archive_read_filter_bidder *self) -{ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} +static const struct archive_read_filter_bidder_vtable +grzip_bidder_vtable = { + .bid = grzip_bidder_bid, + .init = grzip_bidder_init, +}; int archive_read_support_filter_grzip(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *reader; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_grzip"); - - if (__archive_read_get_bidder(a, &reader) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, NULL, + &grzip_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - reader->data = NULL; - reader->bid = grzip_bidder_bid; - reader->init = grzip_bidder_init; - reader->options = NULL; - reader->free = grzip_reader_free; /* This filter always uses an external program. */ archive_set_error(_a, ARCHIVE_ERRNO_MISC, "Using external grzip program for grzip decompression"); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_gzip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_gzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c index 9fa9e2b..4135a63 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_gzip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c @@ -94,24 +94,21 @@ archive_read_support_compression_gzip(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +gzip_bidder_vtable = { + .bid = gzip_bidder_bid, + .init = gzip_bidder_init, +}; + int archive_read_support_filter_gzip(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_gzip"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "gzip", + &gzip_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - bidder->data = NULL; - bidder->name = "gzip"; - bidder->bid = gzip_bidder_bid; - bidder->init = gzip_bidder_init; - bidder->options = NULL; - bidder->free = NULL; /* No data, so no cleanup necessary. */ /* Signal the extent of gzip support with the return value here. */ #if HAVE_ZLIB_H return (ARCHIVE_OK); @@ -291,6 +288,15 @@ gzip_read_header(struct archive_read_filter *self, struct archive_entry *entry) return (ARCHIVE_OK); } +static const struct archive_read_filter_vtable +gzip_reader_vtable = { + .read = gzip_filter_read, + .close = gzip_filter_close, +#ifdef HAVE_ZLIB_H + .read_header = gzip_read_header, +#endif +}; + /* * Initialize the filter object. */ @@ -317,12 +323,7 @@ gzip_bidder_init(struct archive_read_filter *self) self->data = state; state->out_block_size = out_block_size; state->out_block = out_block; - self->read = gzip_filter_read; - self->skip = NULL; /* not supported */ - self->close = gzip_filter_close; -#ifdef HAVE_ZLIB_H - self->read_header = gzip_read_header; -#endif + self->vtable = &gzip_reader_vtable; state->in_stream = 0; /* We're not actually within a stream yet. */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lrzip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c similarity index 86% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lrzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c index c82a8e2..a238989 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lrzip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c @@ -53,31 +53,21 @@ static int lrzip_bidder_bid(struct archive_read_filter_bidder *, static int lrzip_bidder_init(struct archive_read_filter *); -static int -lrzip_reader_free(struct archive_read_filter_bidder *self) -{ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} +static const struct archive_read_filter_bidder_vtable +lrzip_bidder_vtable = { + .bid = lrzip_bidder_bid, + .init = lrzip_bidder_init, +}; int archive_read_support_filter_lrzip(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *reader; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_lrzip"); - - if (__archive_read_get_bidder(a, &reader) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "lrzip", + &lrzip_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - reader->data = NULL; - reader->name = "lrzip"; - reader->bid = lrzip_bidder_bid; - reader->init = lrzip_bidder_init; - reader->options = NULL; - reader->free = lrzip_reader_free; /* This filter always uses an external program. */ archive_set_error(_a, ARCHIVE_ERRNO_MISC, "Using external lrzip program for lrzip decompression"); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lz4.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lz4.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c index 43ee6c2..1e99542 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lz4.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c @@ -99,7 +99,6 @@ static int lz4_filter_close(struct archive_read_filter *); */ static int lz4_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int lz4_reader_init(struct archive_read_filter *); -static int lz4_reader_free(struct archive_read_filter_bidder *); #if defined(HAVE_LIBLZ4) static ssize_t lz4_filter_read_default_stream(struct archive_read_filter *, const void **); @@ -107,24 +106,21 @@ static ssize_t lz4_filter_read_legacy_stream(struct archive_read_filter *, const void **); #endif +static const struct archive_read_filter_bidder_vtable +lz4_bidder_vtable = { + .bid = lz4_reader_bid, + .init = lz4_reader_init, +}; + int archive_read_support_filter_lz4(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *reader; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_lz4"); - - if (__archive_read_get_bidder(a, &reader) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "lz4", + &lz4_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - reader->data = NULL; - reader->name = "lz4"; - reader->bid = lz4_reader_bid; - reader->init = lz4_reader_init; - reader->options = NULL; - reader->free = lz4_reader_free; #if defined(HAVE_LIBLZ4) return (ARCHIVE_OK); #else @@ -134,12 +130,6 @@ archive_read_support_filter_lz4(struct archive *_a) #endif } -static int -lz4_reader_free(struct archive_read_filter_bidder *self){ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} - /* * Test whether we can handle this data. * @@ -218,6 +208,12 @@ lz4_reader_init(struct archive_read_filter *self) #else +static const struct archive_read_filter_vtable +lz4_reader_vtable = { + .read = lz4_filter_read, + .close = lz4_filter_close, +}; + /* * Setup the callbacks. */ @@ -238,9 +234,7 @@ lz4_reader_init(struct archive_read_filter *self) self->data = state; state->stage = SELECT_STREAM; - self->read = lz4_filter_read; - self->skip = NULL; /* not supported */ - self->close = lz4_filter_close; + self->vtable = &lz4_reader_vtable; return (ARCHIVE_OK); } @@ -456,7 +450,9 @@ lz4_filter_read_descriptor(struct archive_read_filter *self) chsum = (chsum >> 8) & 0xff; chsum_verifier = read_buf[descriptor_bytes-1] & 0xff; if (chsum != chsum_verifier) +#ifndef DONT_FAIL_ON_CRC_ERROR goto malformed_error; +#endif __archive_read_filter_consume(self->upstream, descriptor_bytes); @@ -527,7 +523,9 @@ lz4_filter_read_data_block(struct archive_read_filter *self, const void **p) unsigned int chsum_block = archive_le32dec(read_buf + 4 + compressed_size); if (chsum != chsum_block) +#ifndef DONT_FAIL_ON_CRC_ERROR goto malformed_error; +#endif } @@ -658,10 +656,12 @@ lz4_filter_read_default_stream(struct archive_read_filter *self, const void **p) state->xxh32_state); state->xxh32_state = NULL; if (checksum != checksum_stream) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, "lz4 stream checksum error"); return (ARCHIVE_FATAL); +#endif } } else if (ret > 0) __archive_xxhash.XXH32_update(state->xxh32_state, diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lzop.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lzop.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c index a1c392f..4ebdd3b 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_lzop.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c @@ -101,23 +101,21 @@ static int lzop_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int lzop_bidder_init(struct archive_read_filter *); +static const struct archive_read_filter_bidder_vtable +lzop_bidder_vtable = { + .bid = lzop_bidder_bid, + .init = lzop_bidder_init, +}; + int archive_read_support_filter_lzop(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *reader; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_lzop"); - - if (__archive_read_get_bidder(a, &reader) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, NULL, + &lzop_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - reader->data = NULL; - reader->bid = lzop_bidder_bid; - reader->init = lzop_bidder_init; - reader->options = NULL; - reader->free = NULL; /* Signal the extent of lzop support with the return value here. */ #if defined(HAVE_LZO_LZOCONF_H) && defined(HAVE_LZO_LZO1X_H) return (ARCHIVE_OK); @@ -171,6 +169,13 @@ lzop_bidder_init(struct archive_read_filter *self) return (r); } #else + +static const struct archive_read_filter_vtable +lzop_reader_vtable = { + .read = lzop_filter_read, + .close = lzop_filter_close +}; + /* * Initialize the filter object. */ @@ -190,9 +195,7 @@ lzop_bidder_init(struct archive_read_filter *self) } self->data = state; - self->read = lzop_filter_read; - self->skip = NULL; /* not supported */ - self->close = lzop_filter_close; + self->vtable = &lzop_reader_vtable; return (ARCHIVE_OK); } @@ -280,7 +283,9 @@ consume_header(struct archive_read_filter *self) else checksum = adler32(adler32(0, NULL, 0), p, len); if (archive_be32dec(p + len) != checksum) +#ifndef DONT_FAIL_ON_CRC_ERROR goto corrupted; +#endif __archive_read_filter_consume(self->upstream, len + 4); if (flags & EXTRA_FIELD) { /* Skip extra field */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_none.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_none.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_none.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_none.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_program.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_program.c similarity index 94% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_program.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_program.c index bf5b6f2..885b2c2 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_program.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_program.c @@ -98,7 +98,7 @@ struct program_bidder { static int program_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *upstream); static int program_bidder_init(struct archive_read_filter *); -static int program_bidder_free(struct archive_read_filter_bidder *); +static void program_bidder_free(struct archive_read_filter_bidder *); /* * The actual filter needs to track input and output data. @@ -123,42 +123,20 @@ static ssize_t program_filter_read(struct archive_read_filter *, static int program_filter_close(struct archive_read_filter *); static void free_state(struct program_bidder *); -static int -set_bidder_signature(struct archive_read_filter_bidder *bidder, - struct program_bidder *state, const void *signature, size_t signature_len) -{ - - if (signature != NULL && signature_len > 0) { - state->signature_len = signature_len; - state->signature = malloc(signature_len); - memcpy(state->signature, signature, signature_len); - } - - /* - * Fill in the bidder object. - */ - bidder->data = state; - bidder->bid = program_bidder_bid; - bidder->init = program_bidder_init; - bidder->options = NULL; - bidder->free = program_bidder_free; - return (ARCHIVE_OK); -} +static const struct archive_read_filter_bidder_vtable +program_bidder_vtable = { + .bid = program_bidder_bid, + .init = program_bidder_init, + .free = program_bidder_free, +}; int archive_read_support_filter_program_signature(struct archive *_a, const char *cmd, const void *signature, size_t signature_len) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; struct program_bidder *state; - /* - * Get a bidder object from the read core. - */ - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) - return (ARCHIVE_FATAL); - /* * Allocate our private state. */ @@ -169,20 +147,31 @@ archive_read_support_filter_program_signature(struct archive *_a, if (state->cmd == NULL) goto memerr; - return set_bidder_signature(bidder, state, signature, signature_len); + if (signature != NULL && signature_len > 0) { + state->signature_len = signature_len; + state->signature = malloc(signature_len); + memcpy(state->signature, signature, signature_len); + } + + if (__archive_read_register_bidder(a, state, NULL, + &program_bidder_vtable) != ARCHIVE_OK) { + free_state(state); + return (ARCHIVE_FATAL); + } + return (ARCHIVE_OK); + memerr: free_state(state); archive_set_error(_a, ENOMEM, "Can't allocate memory"); return (ARCHIVE_FATAL); } -static int +static void program_bidder_free(struct archive_read_filter_bidder *self) { struct program_bidder *state = (struct program_bidder *)self->data; free_state(state); - return (ARCHIVE_OK); } static void @@ -393,6 +382,12 @@ child_read(struct archive_read_filter *self, char *buf, size_t buf_len) } } +static const struct archive_read_filter_vtable +program_reader_vtable = { + .read = program_filter_read, + .close = program_filter_close, +}; + int __archive_read_program(struct archive_read_filter *self, const char *cmd) { @@ -439,9 +434,7 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd) } self->data = state; - self->read = program_filter_read; - self->skip = NULL; - self->close = program_filter_close; + self->vtable = &program_reader_vtable; /* XXX Check that we can read at least one byte? */ return (ARCHIVE_OK); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_rpm.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c similarity index 92% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_rpm.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c index ddd6839..67a979c 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_rpm.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c @@ -72,25 +72,19 @@ archive_read_support_compression_rpm(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +rpm_bidder_vtable = { + .bid = rpm_bidder_bid, + .init = rpm_bidder_init, +}; + int archive_read_support_filter_rpm(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_rpm"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) - return (ARCHIVE_FATAL); - - bidder->data = NULL; - bidder->name = "rpm"; - bidder->bid = rpm_bidder_bid; - bidder->init = rpm_bidder_init; - bidder->options = NULL; - bidder->free = NULL; - return (ARCHIVE_OK); + return __archive_read_register_bidder(a, NULL, "rpm", + &rpm_bidder_vtable); } static int @@ -133,6 +127,12 @@ rpm_bidder_bid(struct archive_read_filter_bidder *self, return (bits_checked); } +static const struct archive_read_filter_vtable +rpm_reader_vtable = { + .read = rpm_filter_read, + .close = rpm_filter_close, +}; + static int rpm_bidder_init(struct archive_read_filter *self) { @@ -140,9 +140,6 @@ rpm_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_RPM; self->name = "rpm"; - self->read = rpm_filter_read; - self->skip = NULL; /* not supported */ - self->close = rpm_filter_close; rpm = (struct rpm *)calloc(sizeof(*rpm), 1); if (rpm == NULL) { @@ -153,6 +150,7 @@ rpm_bidder_init(struct archive_read_filter *self) self->data = rpm; rpm->state = ST_LEAD; + self->vtable = &rpm_reader_vtable; return (ARCHIVE_OK); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_uu.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_uu.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c index 689c18c..209b2a1 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_uu.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c @@ -76,25 +76,19 @@ archive_read_support_compression_uu(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +uudecode_bidder_vtable = { + .bid = uudecode_bidder_bid, + .init = uudecode_bidder_init, +}; + int archive_read_support_filter_uu(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_uu"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) - return (ARCHIVE_FATAL); - - bidder->data = NULL; - bidder->name = "uu"; - bidder->bid = uudecode_bidder_bid; - bidder->init = uudecode_bidder_init; - bidder->options = NULL; - bidder->free = NULL; - return (ARCHIVE_OK); + return __archive_read_register_bidder(a, NULL, "uu", + &uudecode_bidder_vtable); } static const unsigned char ascii[256] = { @@ -357,6 +351,12 @@ uudecode_bidder_bid(struct archive_read_filter_bidder *self, return (0); } +static const struct archive_read_filter_vtable +uudecode_reader_vtable = { + .read = uudecode_filter_read, + .close = uudecode_filter_close, +}; + static int uudecode_bidder_init(struct archive_read_filter *self) { @@ -366,9 +366,6 @@ uudecode_bidder_init(struct archive_read_filter *self) self->code = ARCHIVE_FILTER_UU; self->name = "uu"; - self->read = uudecode_filter_read; - self->skip = NULL; /* not supported */ - self->close = uudecode_filter_close; uudecode = (struct uudecode *)calloc(sizeof(*uudecode), 1); out_buff = malloc(OUT_BUFF_SIZE); @@ -388,6 +385,7 @@ uudecode_bidder_init(struct archive_read_filter *self) uudecode->in_allocated = IN_BUFF_SIZE; uudecode->out_buff = out_buff; uudecode->state = ST_FIND_HEAD; + self->vtable = &uudecode_reader_vtable; return (ARCHIVE_OK); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_xz.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c similarity index 93% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_xz.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c index 11807cf..e313d39 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_xz.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c @@ -108,24 +108,21 @@ archive_read_support_compression_xz(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +xz_bidder_vtable = { + .bid = xz_bidder_bid, + .init = xz_bidder_init, +}; + int archive_read_support_filter_xz(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_xz"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "xz", + &xz_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - bidder->data = NULL; - bidder->name = "xz"; - bidder->bid = xz_bidder_bid; - bidder->init = xz_bidder_init; - bidder->options = NULL; - bidder->free = NULL; #if HAVE_LZMA_H && HAVE_LIBLZMA return (ARCHIVE_OK); #else @@ -143,24 +140,21 @@ archive_read_support_compression_lzma(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +lzma_bidder_vtable = { + .bid = lzma_bidder_bid, + .init = lzma_bidder_init, +}; + int archive_read_support_filter_lzma(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_lzma"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "lzma", + &lzma_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - bidder->data = NULL; - bidder->name = "lzma"; - bidder->bid = lzma_bidder_bid; - bidder->init = lzma_bidder_init; - bidder->options = NULL; - bidder->free = NULL; #if HAVE_LZMA_H && HAVE_LIBLZMA return (ARCHIVE_OK); #else @@ -179,24 +173,21 @@ archive_read_support_compression_lzip(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +lzip_bidder_vtable = { + .bid = lzip_bidder_bid, + .init = lzip_bidder_init, +}; + int archive_read_support_filter_lzip(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_lzip"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "lzip", + &lzip_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - bidder->data = NULL; - bidder->name = "lzip"; - bidder->bid = lzip_bidder_bid; - bidder->init = lzip_bidder_init; - bidder->options = NULL; - bidder->free = NULL; #if HAVE_LZMA_H && HAVE_LIBLZMA return (ARCHIVE_OK); #else @@ -293,8 +284,8 @@ lzma_bidder_bid(struct archive_read_filter_bidder *self, /* Second through fifth bytes are dictionary size, stored in * little-endian order. The minimum dictionary size is * 1 << 12(4KiB) which the lzma of LZMA SDK uses with option - * -d12 and the maximum dictionary size is 1 << 27(128MiB) - * which the one uses with option -d27. + * -d12 and the maximum dictionary size is 1 << 29(512MiB) + * which the one uses with option -d29. * NOTE: A comment of LZMA SDK source code says this dictionary * range is from 1 << 12 to 1 << 30. */ dicsize = archive_le32dec(buffer+1); @@ -377,7 +368,7 @@ lzip_has_member(struct archive_read_filter *filter) /* Dictionary size. */ log2dic = buffer[5] & 0x1f; - if (log2dic < 12 || log2dic > 27) + if (log2dic < 12 || log2dic > 29) return (0); bits_checked += 8; @@ -470,6 +461,12 @@ set_error(struct archive_read_filter *self, int ret) } } +static const struct archive_read_filter_vtable +xz_lzma_reader_vtable = { + .read = xz_filter_read, + .close = xz_filter_close, +}; + /* * Setup the callbacks. */ @@ -494,9 +491,7 @@ xz_lzma_bidder_init(struct archive_read_filter *self) self->data = state; state->out_block_size = out_block_size; state->out_block = out_block; - self->read = xz_filter_read; - self->skip = NULL; /* not supported */ - self->close = xz_filter_close; + self->vtable = &xz_lzma_reader_vtable; state->stream.avail_in = 0; @@ -562,7 +557,7 @@ lzip_init(struct archive_read_filter *self) /* Get dictionary size. */ log2dic = h[5] & 0x1f; - if (log2dic < 12 || log2dic > 27) + if (log2dic < 12 || log2dic > 29) return (ARCHIVE_FATAL); dicsize = 1U << log2dic; if (log2dic > 12) @@ -617,9 +612,11 @@ lzip_tail(struct archive_read_filter *self) /* Check the crc32 value of the uncompressed data of the current * member */ if (state->crc32 != archive_le32dec(f)) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, "Lzip: CRC32 error"); return (ARCHIVE_FAILED); +#endif } /* Check the uncompressed size of the current member */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_zstd.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c similarity index 93% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_zstd.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c index af7eeb7..39f25f1 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_filter_zstd.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c @@ -79,24 +79,21 @@ static int zstd_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int zstd_bidder_init(struct archive_read_filter *); +static const struct archive_read_filter_bidder_vtable +zstd_bidder_vtable = { + .bid = zstd_bidder_bid, + .init = zstd_bidder_init, +}; + int archive_read_support_filter_zstd(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *bidder; - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_zstd"); - - if (__archive_read_get_bidder(a, &bidder) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "zstd", + &zstd_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - bidder->data = NULL; - bidder->name = "zstd"; - bidder->bid = zstd_bidder_bid; - bidder->init = zstd_bidder_init; - bidder->options = NULL; - bidder->free = NULL; #if HAVE_ZSTD_H && HAVE_LIBZSTD return (ARCHIVE_OK); #else @@ -160,6 +157,12 @@ zstd_bidder_init(struct archive_read_filter *self) #else +static const struct archive_read_filter_vtable +zstd_reader_vtable = { + .read = zstd_filter_read, + .close = zstd_filter_close, +}; + /* * Initialize the filter object */ @@ -192,9 +195,7 @@ zstd_bidder_init(struct archive_read_filter *self) state->out_block_size = out_block_size; state->out_block = out_block; state->dstream = dstream; - self->read = zstd_filter_read; - self->skip = NULL; /* not supported */ - self->close = zstd_filter_close; + self->vtable = &zstd_reader_vtable; state->eof = 0; state->in_frame = 0; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_7zip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_7zip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c index 63cbb7d..0ba4bee 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_7zip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c @@ -287,6 +287,7 @@ struct _7zip { const unsigned char *next_in; int64_t avail_in; int64_t total_in; + int64_t stream_in; unsigned char *next_out; int64_t avail_out; int64_t total_out; @@ -775,7 +776,7 @@ archive_read_format_7zip_read_header(struct archive_read *a, } /* Set up a more descriptive format name. */ - sprintf(zip->format_name, "7-Zip"); + snprintf(zip->format_name, sizeof(zip->format_name), "7-Zip"); a->archive.archive_format_name = zip->format_name; return (ret); @@ -986,15 +987,30 @@ ppmd_read(void *p) struct _7zip *zip = (struct _7zip *)(a->format->data); Byte b; - if (zip->ppstream.avail_in == 0) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated RAR file data"); - zip->ppstream.overconsumed = 1; - return (0); + if (zip->ppstream.avail_in <= 0) { + /* + * Ppmd7_DecodeSymbol might require reading multiple bytes + * and we are on boundary; + * last resort to read using __archive_read_ahead. + */ + ssize_t bytes_avail = 0; + const uint8_t* data = __archive_read_ahead(a, + zip->ppstream.stream_in+1, &bytes_avail); + if(bytes_avail < zip->ppstream.stream_in+1) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated 7z file data"); + zip->ppstream.overconsumed = 1; + return (0); + } + zip->ppstream.next_in++; + b = data[zip->ppstream.stream_in]; + } else { + b = *zip->ppstream.next_in++; } - b = *zip->ppstream.next_in++; zip->ppstream.avail_in--; zip->ppstream.total_in++; + zip->ppstream.stream_in++; return (b); } @@ -1485,6 +1501,7 @@ decompress(struct archive_read *a, struct _7zip *zip, } zip->ppstream.next_in = t_next_in; zip->ppstream.avail_in = t_avail_in; + zip->ppstream.stream_in = 0; zip->ppstream.next_out = t_next_out; zip->ppstream.avail_out = t_avail_out; if (zip->ppmd7_stat == 0) { @@ -2840,8 +2857,10 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip, /* CRC check. */ if (crc32(0, (const unsigned char *)p + 12, 20) != archive_le32dec(p + 8)) { +#ifdef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, -1, "Header CRC error"); return (ARCHIVE_FATAL); +#endif } next_header_offset = archive_le64dec(p + 12); @@ -2891,8 +2910,10 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip, /* Check the EncodedHeader CRC.*/ if (r == 0 && zip->header_crc32 != next_header_crc) { archive_set_error(&a->archive, -1, +#ifndef DONT_FAIL_ON_CRC_ERROR "Damaged 7-Zip archive"); r = -1; +#endif } if (r == 0) { if (zip->si.ci.folders[0].digest_defined) @@ -2943,9 +2964,11 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip, /* Check the Header CRC.*/ if (check_header_crc && zip->header_crc32 != next_header_crc) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, -1, "Malformed 7-Zip archive"); return (ARCHIVE_FATAL); +#endif } break; default: diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_all.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_all.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_all.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_all.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_ar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_ar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_ar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_ar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_by_code.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_by_code.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_cab.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_cab.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c index 950f3d2..4d5029b 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_cab.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c @@ -996,7 +996,7 @@ archive_read_format_cab_read_header(struct archive_read *a, cab->end_of_entry_cleanup = cab->end_of_entry = 1; /* Set up a more descriptive format name. */ - sprintf(cab->format_name, "CAB %d.%d (%s)", + snprintf(cab->format_name, sizeof(cab->format_name), "CAB %d.%d (%s)", hd->major, hd->minor, cab->entry_cffolder->compname); a->archive.archive_format_name = cab->format_name; @@ -1134,7 +1134,7 @@ cab_checksum_update(struct archive_read *a, size_t bytes) } if (sumbytes) { int odd = sumbytes & 3; - if (sumbytes - odd > 0) + if ((int)(sumbytes - odd) > 0) cfdata->sum_calculated = cab_checksum_cfdata_4( p, sumbytes - odd, cfdata->sum_calculated); if (odd) @@ -1171,12 +1171,14 @@ cab_checksum_finish(struct archive_read *a) cfdata->sum_calculated = cab_checksum_cfdata( cfdata->memimage + CFDATA_cbData, l, cfdata->sum_calculated); if (cfdata->sum_calculated != cfdata->sum) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Checksum error CFDATA[%d] %" PRIx32 ":%" PRIx32 " in %d bytes", cab->entry_cffolder->cfdata_index -1, cfdata->sum, cfdata->sum_calculated, cfdata->compressed_size); return (ARCHIVE_FAILED); +#endif } return (ARCHIVE_OK); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_cpio.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_cpio.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_iso9660.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_iso9660.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_iso9660.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_iso9660.c index db14d41..33bf330 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_iso9660.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_iso9660.c @@ -1007,7 +1007,8 @@ read_children(struct archive_read *a, struct file_info *parent) p = b; b += iso9660->logical_block_size; step -= iso9660->logical_block_size; - for (; *p != 0 && p < b && p + *p <= b; p += *p) { + for (; *p != 0 && p + DR_name_offset < b && p + *p <= b; + p += *p) { struct file_info *child; /* N.B.: these special directory identifiers @@ -1756,7 +1757,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent, size_t name_len; const unsigned char *rr_start, *rr_end; const unsigned char *p; - size_t dr_len; + size_t dr_len = 0; uint64_t fsize, offset; int32_t location; int flags; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_lha.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_lha.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c index bff0f01..bcfd42e 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_lha.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c @@ -739,7 +739,7 @@ archive_read_format_lha_read_header(struct archive_read *a, if (lha->directory || lha->compsize == 0) lha->end_of_entry = 1; - sprintf(lha->format_name, "lha -%c%c%c-", + snprintf(lha->format_name, sizeof(lha->format_name), "lha -%c%c%c-", lha->method[0], lha->method[1], lha->method[2]); a->archive.archive_format_name = lha->format_name; @@ -1039,9 +1039,11 @@ lha_read_file_header_2(struct archive_read *a, struct lha *lha) } if (header_crc != lha->header_crc) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "LHa header CRC error"); return (ARCHIVE_FATAL); +#endif } return (err); } @@ -1107,9 +1109,11 @@ lha_read_file_header_3(struct archive_read *a, struct lha *lha) return (err); if (header_crc != lha->header_crc) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "LHa header CRC error"); return (ARCHIVE_FATAL); +#endif } return (err); invalid: diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_mtree.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_mtree.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c index c87a154..2bc3ba0 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_mtree.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c @@ -692,7 +692,7 @@ detect_form(struct archive_read *a, int *is_form_d) { const char *p; ssize_t avail, ravail; - ssize_t detected_bytes = 0, len, nl; + ssize_t len, nl; int entry_cnt = 0, multiline = 0; int form_D = 0;/* The archive is generated by `NetBSD mtree -D' * (In this source we call it `form D') . */ @@ -728,8 +728,6 @@ detect_form(struct archive_read *a, int *is_form_d) * character of previous line was '\' character. */ if (bid_keyword_list(p, len, 0, 0) <= 0) break; - if (multiline == 1) - detected_bytes += len; if (p[len-nl-1] != '\\') { if (multiline == 1 && ++entry_cnt >= MAX_BID_ENTRY) @@ -745,7 +743,6 @@ detect_form(struct archive_read *a, int *is_form_d) keywords = bid_entry(p, len, nl, &last_is_path); if (keywords >= 0) { - detected_bytes += len; if (form_D == 0) { if (last_is_path) form_D = 1; @@ -997,9 +994,11 @@ process_add_entry(struct archive_read *a, struct mtree *mtree, struct mtree_entry *alt; alt = (struct mtree_entry *)__archive_rb_tree_find_node( &mtree->rbtree, entry->name); - while (alt->next_dup) - alt = alt->next_dup; - alt->next_dup = entry; + if (alt != NULL) { + while (alt->next_dup) + alt = alt->next_dup; + alt->next_dup = entry; + } } } @@ -1074,7 +1073,7 @@ read_mtree(struct archive_read *a, struct mtree *mtree) continue; /* Non-printable characters are not allowed */ for (s = p;s < p + len - 1; s++) { - if (!isprint((unsigned char)*s)) { + if (!isprint((unsigned char)*s) && *s != '\t') { r = ARCHIVE_FATAL; break; } @@ -1253,9 +1252,17 @@ parse_file(struct archive_read *a, struct archive_entry *entry, archive_entry_filetype(entry) == AE_IFDIR) { mtree->fd = open(path, O_RDONLY | O_BINARY | O_CLOEXEC); __archive_ensure_cloexec_flag(mtree->fd); - if (mtree->fd == -1 && - (errno != ENOENT || - archive_strlen(&mtree->contents_name) > 0)) { + if (mtree->fd == -1 && ( +#if defined(_WIN32) && !defined(__CYGWIN__) + /* + * On Windows, attempting to open a file with an + * invalid name result in EINVAL (Error 22) + */ + (errno != ENOENT && errno != EINVAL) +#else + errno != ENOENT +#endif + || archive_strlen(&mtree->contents_name) > 0)) { archive_set_error(&a->archive, errno, "Can't open %s", path); r = ARCHIVE_WARN; @@ -1629,11 +1636,11 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, || strcmp(key, "contents") == 0) { parse_escapes(val, NULL); archive_strcpy(&mtree->contents_name, val); - break; + return (ARCHIVE_OK); } if (strcmp(key, "cksum") == 0) - break; - __LA_FALLTHROUGH; + return (ARCHIVE_OK); + break; case 'd': if (strcmp(key, "device") == 0) { /* stat(2) st_rdev field, e.g. the major/minor IDs @@ -1647,65 +1654,64 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, archive_entry_set_rdev(entry, dev); return r; } - __LA_FALLTHROUGH; + break; case 'f': if (strcmp(key, "flags") == 0) { *parsed_kws |= MTREE_HAS_FFLAGS; archive_entry_copy_fflags_text(entry, val); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; archive_entry_set_gid(entry, mtree_atol(&val, 10)); - break; + return (ARCHIVE_OK); } if (strcmp(key, "gname") == 0) { *parsed_kws |= MTREE_HAS_GNAME; archive_entry_copy_gname(entry, val); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'i': if (strcmp(key, "inode") == 0) { archive_entry_set_ino(entry, mtree_atol(&val, 10)); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'l': if (strcmp(key, "link") == 0) { + parse_escapes(val, NULL); archive_entry_copy_symlink(entry, val); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'm': if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) { return parse_digest(a, entry, val, ARCHIVE_ENTRY_DIGEST_MD5); } if (strcmp(key, "mode") == 0) { - if (val[0] >= '0' && val[0] <= '7') { - *parsed_kws |= MTREE_HAS_PERM; - archive_entry_set_perm(entry, - (mode_t)mtree_atol(&val, 8)); - } else { + if (val[0] < '0' || val[0] > '7') { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Symbolic or non-octal mode \"%s\" unsupported", val); - return ARCHIVE_WARN; + return (ARCHIVE_WARN); } - break; + *parsed_kws |= MTREE_HAS_PERM; + archive_entry_set_perm(entry, (mode_t)mtree_atol(&val, 8)); + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'n': if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; archive_entry_set_nlink(entry, (unsigned int)mtree_atol(&val, 10)); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'r': if (strcmp(key, "resdevice") == 0) { /* stat(2) st_dev field, e.g. the device ID where the @@ -1723,7 +1729,7 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, return parse_digest(a, entry, val, ARCHIVE_ENTRY_DIGEST_RMD160); } - __LA_FALLTHROUGH; + break; case 's': if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) { @@ -1747,9 +1753,9 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, } if (strcmp(key, "size") == 0) { archive_entry_set_size(entry, mtree_atol(&val, 10)); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 't': if (strcmp(key, "tags") == 0) { /* @@ -1757,7 +1763,7 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, * Ignore the tags for now, but the interface * should be extended to allow inclusion/exclusion. */ - break; + return (ARCHIVE_OK); } if (strcmp(key, "time") == 0) { int64_t m; @@ -1783,79 +1789,85 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, else if (m < my_time_t_min) m = my_time_t_min; archive_entry_set_mtime(entry, (time_t)m, ns); - break; + return (ARCHIVE_OK); } if (strcmp(key, "type") == 0) { switch (val[0]) { case 'b': if (strcmp(val, "block") == 0) { - archive_entry_set_filetype(entry, AE_IFBLK); - break; + *parsed_kws |= MTREE_HAS_TYPE; + archive_entry_set_filetype(entry, + AE_IFBLK); + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'c': if (strcmp(val, "char") == 0) { + *parsed_kws |= MTREE_HAS_TYPE; archive_entry_set_filetype(entry, AE_IFCHR); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'd': if (strcmp(val, "dir") == 0) { + *parsed_kws |= MTREE_HAS_TYPE; archive_entry_set_filetype(entry, AE_IFDIR); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'f': if (strcmp(val, "fifo") == 0) { + *parsed_kws |= MTREE_HAS_TYPE; archive_entry_set_filetype(entry, AE_IFIFO); - break; + return (ARCHIVE_OK); } if (strcmp(val, "file") == 0) { + *parsed_kws |= MTREE_HAS_TYPE; archive_entry_set_filetype(entry, AE_IFREG); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; case 'l': if (strcmp(val, "link") == 0) { + *parsed_kws |= MTREE_HAS_TYPE; archive_entry_set_filetype(entry, AE_IFLNK); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; default: - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Unrecognized file type \"%s\"; " - "assuming \"file\"", val); - archive_entry_set_filetype(entry, AE_IFREG); - return (ARCHIVE_WARN); + break; } - *parsed_kws |= MTREE_HAS_TYPE; - break; + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Unrecognized file type \"%s\"; " + "assuming \"file\"", val); + archive_entry_set_filetype(entry, AE_IFREG); + return (ARCHIVE_WARN); } - __LA_FALLTHROUGH; + break; case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; archive_entry_set_uid(entry, mtree_atol(&val, 10)); - break; + return (ARCHIVE_OK); } if (strcmp(key, "uname") == 0) { *parsed_kws |= MTREE_HAS_UNAME; archive_entry_copy_uname(entry, val); - break; + return (ARCHIVE_OK); } - __LA_FALLTHROUGH; + break; default: - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unrecognized key %s=%s", key, val); - return (ARCHIVE_WARN); + break; } - return (ARCHIVE_OK); + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Unrecognized key %s=%s", key, val); + return (ARCHIVE_WARN); } static int diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_rar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c similarity index 79% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_rar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c index c2666b2..793e8e9 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_rar.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c @@ -135,6 +135,16 @@ #define MAX_SYMBOL_LENGTH 0xF #define MAX_SYMBOLS 20 +/* Virtual Machine Properties */ +#define VM_MEMORY_SIZE 0x40000 +#define VM_MEMORY_MASK (VM_MEMORY_SIZE - 1) +#define PROGRAM_WORK_SIZE 0x3C000 +#define PROGRAM_GLOBAL_SIZE 0x2000 +#define PROGRAM_SYSTEM_GLOBAL_ADDRESS PROGRAM_WORK_SIZE +#define PROGRAM_SYSTEM_GLOBAL_SIZE 0x40 +#define PROGRAM_USER_GLOBAL_ADDRESS (PROGRAM_SYSTEM_GLOBAL_ADDRESS + PROGRAM_SYSTEM_GLOBAL_SIZE) +#define PROGRAM_USER_GLOBAL_SIZE (PROGRAM_GLOBAL_SIZE - PROGRAM_SYSTEM_GLOBAL_SIZE) + /* * Considering L1,L2 cache miss and a calling of write system-call, * the best size of the output buffer(uncompressed buffer) is 128K. @@ -213,6 +223,69 @@ struct data_block_offsets int64_t end_offset; }; +struct rar_program_code +{ + uint8_t *staticdata; + uint32_t staticdatalen; + uint8_t *globalbackup; + uint32_t globalbackuplen; + uint64_t fingerprint; + uint32_t usagecount; + uint32_t oldfilterlength; + struct rar_program_code *next; +}; + +struct rar_filter +{ + struct rar_program_code *prog; + uint32_t initialregisters[8]; + uint8_t *globaldata; + uint32_t globaldatalen; + size_t blockstartpos; + uint32_t blocklength; + uint32_t filteredblockaddress; + uint32_t filteredblocklength; + struct rar_filter *next; +}; + +struct memory_bit_reader +{ + const uint8_t *bytes; + size_t length; + size_t offset; + uint64_t bits; + int available; + int at_eof; +}; + +struct rar_virtual_machine +{ + uint32_t registers[8]; + uint8_t memory[VM_MEMORY_SIZE + sizeof(uint32_t)]; +}; + +struct rar_filters +{ + struct rar_virtual_machine *vm; + struct rar_program_code *progs; + struct rar_filter *stack; + int64_t filterstart; + uint32_t lastfilternum; + int64_t lastend; + uint8_t *bytes; + size_t bytes_ready; +}; + +struct audio_state +{ + int8_t weight[5]; + int16_t delta[4]; + int8_t lastdelta; + int error[11]; + int count; + uint8_t lastbyte; +}; + struct rar { /* Entries from main RAR header */ @@ -273,15 +346,16 @@ struct rar struct huffman_code lengthcode; unsigned char lengthtable[HUFFMAN_TABLE_SIZE]; struct lzss lzss; - char output_last_match; unsigned int lastlength; unsigned int lastoffset; unsigned int oldoffset[4]; unsigned int lastlowoffset; unsigned int numlowoffsetrepeats; - int64_t filterstart; char start_new_table; + /* Filters */ + struct rar_filters filters; + /* PPMd Variant H members */ char ppmd_valid; char ppmd_eod; @@ -343,23 +417,43 @@ static int read_symlink_stored(struct archive_read *, struct archive_entry *, static int read_data_stored(struct archive_read *, const void **, size_t *, int64_t *); static int read_data_compressed(struct archive_read *, const void **, size_t *, - int64_t *, size_t); + int64_t *, size_t); static int rar_br_preparation(struct archive_read *, struct rar_br *); static int parse_codes(struct archive_read *); static void free_codes(struct archive_read *); static int read_next_symbol(struct archive_read *, struct huffman_code *); static int create_code(struct archive_read *, struct huffman_code *, - unsigned char *, int, char); + unsigned char *, int, char); static int add_value(struct archive_read *, struct huffman_code *, int, int, int); static int new_node(struct huffman_code *); static int make_table(struct archive_read *, struct huffman_code *); static int make_table_recurse(struct archive_read *, struct huffman_code *, int, struct huffman_table_entry *, int, int); -static int64_t expand(struct archive_read *, int64_t); -static int copy_from_lzss_window(struct archive_read *, const void **, - int64_t, int); +static int expand(struct archive_read *, int64_t *); +static int copy_from_lzss_window_to_unp(struct archive_read *, const void **, + int64_t, int); static const void *rar_read_ahead(struct archive_read *, size_t, ssize_t *); +static int parse_filter(struct archive_read *, const uint8_t *, uint16_t, + uint8_t); +static int run_filters(struct archive_read *); +static void clear_filters(struct rar_filters *); +static struct rar_filter *create_filter(struct rar_program_code *, + const uint8_t *, uint32_t, + uint32_t[8], size_t, uint32_t); +static void delete_filter(struct rar_filter *filter); +static struct rar_program_code *compile_program(const uint8_t *, size_t); +static void delete_program_code(struct rar_program_code *prog); +static uint32_t membr_next_rarvm_number(struct memory_bit_reader *br); +static inline uint32_t membr_bits(struct memory_bit_reader *br, int bits); +static int membr_fill(struct memory_bit_reader *br, int bits); +static int read_filter(struct archive_read *, int64_t *); +static int rar_decode_byte(struct archive_read*, uint8_t *); +static int execute_filter(struct archive_read*, struct rar_filter *, + struct rar_virtual_machine *, size_t); +static int copy_from_lzss_window(struct archive_read *, void *, int64_t, int); +static inline void vm_write_32(struct rar_virtual_machine*, size_t, uint32_t); +static inline uint32_t vm_read_32(struct rar_virtual_machine*, size_t); /* * Bit stream reader. @@ -913,9 +1007,11 @@ archive_read_format_rar_read_header(struct archive_read *a, crc32_val = crc32(0, (const unsigned char *)p + 2, (unsigned)skip - 2); if ((crc32_val & 0xffff) != archive_le16dec(p)) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Header CRC error"); return (ARCHIVE_FATAL); +#endif } __archive_read_consume(a, skip); break; @@ -971,9 +1067,11 @@ archive_read_format_rar_read_header(struct archive_read *a, skip -= to_read; } if ((crc32_val & 0xffff) != crc32_expected) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Header CRC error"); return (ARCHIVE_FATAL); +#endif } if (head_type == ENDARC_HEAD) return (ARCHIVE_EOF); @@ -1244,6 +1342,7 @@ archive_read_format_rar_cleanup(struct archive_read *a) rar = (struct rar *)(a->format->data); free_codes(a); + clear_filters(&rar->filters); free(rar->filename); free(rar->filename_save); free(rar->dbo); @@ -1337,9 +1436,11 @@ read_header(struct archive_read *a, struct archive_entry *entry, /* File Header CRC check. */ crc32_val = crc32(crc32_val, h, (unsigned)(header_size - 7)); if ((crc32_val & 0xffff) != archive_le16dec(rar_header.crc)) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Header CRC error"); return (ARCHIVE_FATAL); +#endif } /* If no CRC error, Go on parsing File Header. */ p = h; @@ -1662,6 +1763,7 @@ read_header(struct archive_read *a, struct archive_entry *entry, memset(rar->lengthtable, 0, sizeof(rar->lengthtable)); __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->ppmd_valid = rar->ppmd_eod = 0; + rar->filters.filterstart = INT64_MAX; /* Don't set any archive entries for non-file header types */ if (head_type == NEWSUB_HEAD) @@ -1856,9 +1958,11 @@ read_data_stored(struct archive_read *a, const void **buff, size_t *size, *size = 0; *offset = rar->offset; if (rar->file_crc != rar->crc_calculated) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "File CRC error"); return (ARCHIVE_FATAL); +#endif } rar->entry_eof = 1; return (ARCHIVE_EOF); @@ -1886,13 +1990,13 @@ read_data_stored(struct archive_read *a, const void **buff, size_t *size, static int read_data_compressed(struct archive_read *a, const void **buff, size_t *size, - int64_t *offset, size_t looper) + int64_t *offset, size_t looper) { if (looper++ > MAX_COMPRESS_DEPTH) return (ARCHIVE_FATAL); struct rar *rar; - int64_t start, end, actualend; + int64_t start, end; size_t bs; int ret = (ARCHIVE_OK), sym, code, lzss_offset, length, i; @@ -1901,6 +2005,33 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, do { if (!rar->valid) return (ARCHIVE_FATAL); + + if (rar->filters.bytes_ready > 0) + { + /* Flush unp_buffer first */ + if (rar->unp_offset > 0) + { + *buff = rar->unp_buffer; + *size = rar->unp_offset; + rar->unp_offset = 0; + *offset = rar->offset_outgoing; + rar->offset_outgoing += *size; + } + else + { + *buff = rar->filters.bytes; + *size = rar->filters.bytes_ready; + + rar->offset += *size; + *offset = rar->offset_outgoing; + rar->offset_outgoing += *size; + + rar->filters.bytes_ready -= *size; + rar->filters.bytes += *size; + } + goto ending_block; + } + if (rar->ppmd_eod || (rar->dictionary_size && rar->offset >= rar->unp_size)) { @@ -1922,9 +2053,11 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, *size = 0; *offset = rar->offset; if (rar->file_crc != rar->crc_calculated) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "File CRC error"); return (ARCHIVE_FATAL); +#endif } rar->entry_eof = 1; return (ARCHIVE_EOF); @@ -1936,7 +2069,7 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, bs = rar->unp_buffer_size - rar->unp_offset; else bs = (size_t)rar->bytes_uncopied; - ret = copy_from_lzss_window(a, buff, rar->offset, (int)bs); + ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, (int)bs); if (ret != ARCHIVE_OK) return (ret); rar->offset += bs; @@ -1954,6 +2087,13 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, continue; } + if (rar->filters.lastend == rar->filters.filterstart) + { + if (!run_filters(a)) + return (ARCHIVE_FATAL); + continue; + } + if (!rar->br.next_in && (ret = rar_br_preparation(a, &(rar->br))) < ARCHIVE_WARN) return (ret); @@ -2045,13 +2185,17 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, { start = rar->offset; end = start + rar->dictionary_size; - rar->filterstart = INT64_MAX; + if (rar->filters.filterstart < end) { + end = rar->filters.filterstart; + } - if ((actualend = expand(a, end)) < 0) - return ((int)actualend); + ret = expand(a, &end); + if (ret != ARCHIVE_OK) + return (ret); - rar->bytes_uncopied = actualend - start; - if (rar->bytes_uncopied == 0) { + rar->bytes_uncopied = end - start; + rar->filters.lastend = end; + if (rar->filters.lastend != rar->filters.filterstart && rar->bytes_uncopied == 0) { /* Broken RAR files cause this case. * NOTE: If this case were possible on a normal RAR file * we would find out where it was actually bad and @@ -2065,7 +2209,7 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, bs = rar->unp_buffer_size - rar->unp_offset; else bs = (size_t)rar->bytes_uncopied; - ret = copy_from_lzss_window(a, buff, rar->offset, (int)bs); + ret = copy_from_lzss_window_to_unp(a, buff, rar->offset, (int)bs); if (ret != ARCHIVE_OK) return (ret); rar->offset += bs; @@ -2080,6 +2224,7 @@ read_data_compressed(struct archive_read *a, const void **buff, size_t *size, *size = rar->unp_buffer_size; *offset = rar->offset_outgoing; rar->offset_outgoing += *size; +ending_block: /* Calculate File CRC. */ rar->crc_calculated = crc32(rar->crc_calculated, *buff, (unsigned)*size); return ret; @@ -2691,8 +2836,8 @@ make_table_recurse(struct archive_read *a, struct huffman_code *code, int node, return ret; } -static int64_t -expand(struct archive_read *a, int64_t end) +static int +expand(struct archive_read *a, int64_t *end) { static const unsigned char lengthbases[] = { 0, 1, 2, 3, 4, 5, 6, @@ -2739,25 +2884,22 @@ expand(struct archive_read *a, int64_t end) struct rar *rar = (struct rar *)(a->format->data); struct rar_br *br = &(rar->br); - if (rar->filterstart < end) - end = rar->filterstart; + if (rar->filters.filterstart < *end) + *end = rar->filters.filterstart; while (1) { - if (rar->output_last_match && - lzss_position(&rar->lzss) + rar->lastlength <= end) - { - lzss_emit_match(rar, rar->lastoffset, rar->lastlength); - rar->output_last_match = 0; + if(lzss_position(&rar->lzss) >= *end) { + return (ARCHIVE_OK); } - if(rar->is_ppmd_block || rar->output_last_match || - lzss_position(&rar->lzss) >= end) - return lzss_position(&rar->lzss); + if(rar->is_ppmd_block) { + *end = lzss_position(&rar->lzss); + return (ARCHIVE_OK); + } if ((symbol = read_next_symbol(a, &rar->maincode)) < 0) return (ARCHIVE_FATAL); - rar->output_last_match = 0; if (symbol < 256) { @@ -2778,7 +2920,8 @@ expand(struct archive_read *a, int64_t end) goto truncated_data; rar->start_new_table = rar_br_bits(br, 1); rar_br_consume(br, 1); - return lzss_position(&rar->lzss); + *end = lzss_position(&rar->lzss); + return (ARCHIVE_OK); } else { @@ -2789,9 +2932,9 @@ expand(struct archive_read *a, int64_t end) } else if(symbol==257) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Parsing filters is unsupported."); - return (ARCHIVE_FAILED); + if (!read_filter(a, end)) + return (ARCHIVE_FATAL); + continue; } else if(symbol==258) { @@ -2864,7 +3007,7 @@ expand(struct archive_read *a, int64_t end) goto truncated_data; offs += rar_br_bits(br, offsetbits[offssymbol] - 4) << 4; rar_br_consume(br, offsetbits[offssymbol] - 4); - } + } if(rar->numlowoffsetrepeats > 0) { @@ -2908,7 +3051,8 @@ expand(struct archive_read *a, int64_t end) rar->lastoffset = offs; rar->lastlength = len; - rar->output_last_match = 1; + + lzss_emit_match(rar, rar->lastoffset, rar->lastlength); } truncated_data: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, @@ -2922,8 +3066,31 @@ bad_data: } static int -copy_from_lzss_window(struct archive_read *a, const void **buffer, - int64_t startpos, int length) +copy_from_lzss_window(struct archive_read *a, void *buffer, + int64_t startpos, int length) +{ + int windowoffs, firstpart; + struct rar *rar = (struct rar *)(a->format->data); + + windowoffs = lzss_offset_for_position(&rar->lzss, startpos); + firstpart = lzss_size(&rar->lzss) - windowoffs; + if (firstpart < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad RAR file data"); + return (ARCHIVE_FATAL); + } + if (firstpart < length) { + memcpy(buffer, &rar->lzss.window[windowoffs], firstpart); + memcpy(buffer, &rar->lzss.window[0], length - firstpart); + } else { + memcpy(buffer, &rar->lzss.window[windowoffs], length); + } + return (ARCHIVE_OK); +} + +static int +copy_from_lzss_window_to_unp(struct archive_read *a, const void **buffer, + int64_t startpos, int length) { int windowoffs, firstpart; struct rar *rar = (struct rar *)(a->format->data); @@ -3003,3 +3170,628 @@ rar_read_ahead(struct archive_read *a, size_t min, ssize_t *avail) } return h; } + +static int +parse_filter(struct archive_read *a, const uint8_t *bytes, uint16_t length, uint8_t flags) +{ + struct rar *rar = (struct rar *)(a->format->data); + struct rar_filters *filters = &rar->filters; + + struct memory_bit_reader br = { 0 }; + struct rar_program_code *prog; + struct rar_filter *filter, **nextfilter; + + uint32_t numprogs, num, blocklength, globaldatalen; + uint8_t *globaldata; + size_t blockstartpos; + uint32_t registers[8] = { 0 }; + uint32_t i; + + br.bytes = bytes; + br.length = length; + + numprogs = 0; + for (prog = filters->progs; prog; prog = prog->next) + numprogs++; + + if ((flags & 0x80)) + { + num = membr_next_rarvm_number(&br); + if (num == 0) + { + delete_filter(filters->stack); + filters->stack = NULL; + delete_program_code(filters->progs); + filters->progs = NULL; + } + else + num--; + if (num > numprogs) { + return 0; + } + filters->lastfilternum = num; + } + else + num = filters->lastfilternum; + + prog = filters->progs; + for (i = 0; i < num; i++) + prog = prog->next; + if (prog) + prog->usagecount++; + + blockstartpos = membr_next_rarvm_number(&br) + (size_t)lzss_position(&rar->lzss); + if ((flags & 0x40)) + blockstartpos += 258; + if ((flags & 0x20)) + blocklength = membr_next_rarvm_number(&br); + else + blocklength = prog ? prog->oldfilterlength : 0; + + registers[3] = PROGRAM_SYSTEM_GLOBAL_ADDRESS; + registers[4] = blocklength; + registers[5] = prog ? prog->usagecount : 0; + registers[7] = VM_MEMORY_SIZE; + + if ((flags & 0x10)) + { + uint8_t mask = (uint8_t)membr_bits(&br, 7); + for (i = 0; i < 7; i++) + if ((mask & (1 << i))) + registers[i] = membr_next_rarvm_number(&br); + } + + if (!prog) + { + uint32_t len = membr_next_rarvm_number(&br); + uint8_t *bytecode; + struct rar_program_code **next; + + if (len == 0 || len > 0x10000) + return 0; + bytecode = malloc(len); + if (!bytecode) + return 0; + for (i = 0; i < len; i++) + bytecode[i] = (uint8_t)membr_bits(&br, 8); + prog = compile_program(bytecode, len); + if (!prog) { + free(bytecode); + return 0; + } + free(bytecode); + next = &filters->progs; + while (*next) + next = &(*next)->next; + *next = prog; + } + prog->oldfilterlength = blocklength; + + globaldata = NULL; + globaldatalen = 0; + if ((flags & 0x08)) + { + globaldatalen = membr_next_rarvm_number(&br); + if (globaldatalen > PROGRAM_USER_GLOBAL_SIZE) + return 0; + globaldata = malloc(globaldatalen + PROGRAM_SYSTEM_GLOBAL_SIZE); + if (!globaldata) + return 0; + for (i = 0; i < globaldatalen; i++) + globaldata[i + PROGRAM_SYSTEM_GLOBAL_SIZE] = (uint8_t)membr_bits(&br, 8); + } + + if (br.at_eof) + { + free(globaldata); + return 0; + } + + filter = create_filter(prog, globaldata, globaldatalen, registers, blockstartpos, blocklength); + free(globaldata); + if (!filter) + return 0; + + for (i = 0; i < 7; i++) + archive_le32enc(&filter->globaldata[i * 4], registers[i]); + archive_le32enc(&filter->globaldata[0x1C], blocklength); + archive_le32enc(&filter->globaldata[0x20], 0); + archive_le32enc(&filter->globaldata[0x2C], prog->usagecount); + + nextfilter = &filters->stack; + while (*nextfilter) + nextfilter = &(*nextfilter)->next; + *nextfilter = filter; + + if (!filters->stack->next) + filters->filterstart = blockstartpos; + + return 1; +} + +static struct rar_filter * +create_filter(struct rar_program_code *prog, const uint8_t *globaldata, uint32_t globaldatalen, uint32_t registers[8], size_t startpos, uint32_t length) +{ + struct rar_filter *filter; + + filter = calloc(1, sizeof(*filter)); + if (!filter) + return NULL; + filter->prog = prog; + filter->globaldatalen = globaldatalen > PROGRAM_SYSTEM_GLOBAL_SIZE ? globaldatalen : PROGRAM_SYSTEM_GLOBAL_SIZE; + filter->globaldata = calloc(1, filter->globaldatalen); + if (!filter->globaldata) + return NULL; + if (globaldata) + memcpy(filter->globaldata, globaldata, globaldatalen); + if (registers) + memcpy(filter->initialregisters, registers, sizeof(filter->initialregisters)); + filter->blockstartpos = startpos; + filter->blocklength = length; + + return filter; +} + +static int +run_filters(struct archive_read *a) +{ + struct rar *rar = (struct rar *)(a->format->data); + struct rar_filters *filters = &rar->filters; + struct rar_filter *filter = filters->stack; + struct rar_filter *f; + size_t start, end; + int64_t tend; + uint32_t lastfilteraddress; + uint32_t lastfilterlength; + int ret; + + if (filters == NULL || filter == NULL) + return (0); + + start = filters->filterstart; + end = start + filter->blocklength; + + filters->filterstart = INT64_MAX; + tend = (int64_t)end; + ret = expand(a, &tend); + if (ret != ARCHIVE_OK) + return 0; + + /* Check if filter stack was modified in expand() */ + ret = ARCHIVE_FATAL; + f = filters->stack; + while (f) + { + if (f == filter) + { + ret = ARCHIVE_OK; + break; + } + f = f->next; + } + if (ret != ARCHIVE_OK) + return 0; + + if (tend < 0) + return 0; + end = (size_t)tend; + if (end != start + filter->blocklength) + return 0; + + if (!filters->vm) + { + filters->vm = calloc(1, sizeof(*filters->vm)); + if (!filters->vm) + return 0; + } + + ret = copy_from_lzss_window(a, filters->vm->memory, start, filter->blocklength); + if (ret != ARCHIVE_OK) + return 0; + if (!execute_filter(a, filter, filters->vm, rar->offset)) + return 0; + + lastfilteraddress = filter->filteredblockaddress; + lastfilterlength = filter->filteredblocklength; + filters->stack = filter->next; + filter->next = NULL; + delete_filter(filter); + + while ((filter = filters->stack) != NULL && (int64_t)filter->blockstartpos == filters->filterstart && filter->blocklength == lastfilterlength) + { + memmove(&filters->vm->memory[0], &filters->vm->memory[lastfilteraddress], lastfilterlength); + if (!execute_filter(a, filter, filters->vm, rar->offset)) + return 0; + + lastfilteraddress = filter->filteredblockaddress; + lastfilterlength = filter->filteredblocklength; + filters->stack = filter->next; + filter->next = NULL; + delete_filter(filter); + } + + if (filters->stack) + { + if (filters->stack->blockstartpos < end) + return 0; + filters->filterstart = filters->stack->blockstartpos; + } + + filters->lastend = end; + filters->bytes = &filters->vm->memory[lastfilteraddress]; + filters->bytes_ready = lastfilterlength; + + return 1; +} + +static struct rar_program_code * +compile_program(const uint8_t *bytes, size_t length) +{ + struct memory_bit_reader br = { 0 }; + struct rar_program_code *prog; + // uint32_t instrcount = 0; + uint8_t xor; + size_t i; + + xor = 0; + for (i = 1; i < length; i++) + xor ^= bytes[i]; + if (!length || xor != bytes[0]) + return NULL; + + br.bytes = bytes; + br.length = length; + br.offset = 1; + + prog = calloc(1, sizeof(*prog)); + if (!prog) + return NULL; + prog->fingerprint = crc32(0, bytes, length) | ((uint64_t)length << 32); + + if (membr_bits(&br, 1)) + { + prog->staticdatalen = membr_next_rarvm_number(&br) + 1; + prog->staticdata = malloc(prog->staticdatalen); + if (!prog->staticdata) + { + delete_program_code(prog); + return NULL; + } + for (i = 0; i < prog->staticdatalen; i++) + prog->staticdata[i] = (uint8_t)membr_bits(&br, 8); + } + + return prog; +} + +static void +delete_filter(struct rar_filter *filter) +{ + while (filter) + { + struct rar_filter *next = filter->next; + free(filter->globaldata); + free(filter); + filter = next; + } +} + +static void +clear_filters(struct rar_filters *filters) +{ + delete_filter(filters->stack); + delete_program_code(filters->progs); + free(filters->vm); +} + +static void +delete_program_code(struct rar_program_code *prog) +{ + while (prog) + { + struct rar_program_code *next = prog->next; + free(prog->staticdata); + free(prog->globalbackup); + free(prog); + prog = next; + } +} + +static uint32_t +membr_next_rarvm_number(struct memory_bit_reader *br) +{ + uint32_t val; + switch (membr_bits(br, 2)) + { + case 0: + return membr_bits(br, 4); + case 1: + val = membr_bits(br, 8); + if (val >= 16) + return val; + return 0xFFFFFF00 | (val << 4) | membr_bits(br, 4); + case 2: + return membr_bits(br, 16); + default: + return membr_bits(br, 32); + } +} + +static inline uint32_t +membr_bits(struct memory_bit_reader *br, int bits) +{ + if (bits > br->available && (br->at_eof || !membr_fill(br, bits))) + return 0; + return (uint32_t)((br->bits >> (br->available -= bits)) & (((uint64_t)1 << bits) - 1)); +} + +static int +membr_fill(struct memory_bit_reader *br, int bits) +{ + while (br->available < bits && br->offset < br->length) + { + br->bits = (br->bits << 8) | br->bytes[br->offset++]; + br->available += 8; + } + if (bits > br->available) + { + br->at_eof = 1; + return 0; + } + return 1; +} + +static int +read_filter(struct archive_read *a, int64_t *end) +{ + struct rar *rar = (struct rar *)(a->format->data); + uint8_t flags, val, *code; + uint16_t length, i; + + if (!rar_decode_byte(a, &flags)) + return 0; + length = (flags & 0x07) + 1; + if (length == 7) + { + if (!rar_decode_byte(a, &val)) + return 0; + length = val + 7; + } + else if (length == 8) + { + if (!rar_decode_byte(a, &val)) + return 0; + length = val << 8; + if (!rar_decode_byte(a, &val)) + return 0; + length |= val; + } + + code = malloc(length); + if (!code) + return 0; + for (i = 0; i < length; i++) + { + if (!rar_decode_byte(a, &code[i])) + { + free(code); + return 0; + } + } + if (!parse_filter(a, code, length, flags)) + { + free(code); + return 0; + } + free(code); + + if (rar->filters.filterstart < *end) + *end = rar->filters.filterstart; + + return 1; +} + +static int +execute_filter_delta(struct rar_filter *filter, struct rar_virtual_machine *vm) +{ + uint32_t length = filter->initialregisters[4]; + uint32_t numchannels = filter->initialregisters[0]; + uint8_t *src, *dst; + uint32_t i, idx; + + if (length > PROGRAM_WORK_SIZE / 2) + return 0; + + src = &vm->memory[0]; + dst = &vm->memory[length]; + for (i = 0; i < numchannels; i++) + { + uint8_t lastbyte = 0; + for (idx = i; idx < length; idx += numchannels) + lastbyte = dst[idx] = lastbyte - *src++; + } + + filter->filteredblockaddress = length; + filter->filteredblocklength = length; + + return 1; +} + +static int +execute_filter_e8(struct rar_filter *filter, struct rar_virtual_machine *vm, size_t pos, int e9also) +{ + uint32_t length = filter->initialregisters[4]; + uint32_t filesize = 0x1000000; + uint32_t i; + + if (length > PROGRAM_WORK_SIZE || length < 4) + return 0; + + for (i = 0; i <= length - 5; i++) + { + if (vm->memory[i] == 0xE8 || (e9also && vm->memory[i] == 0xE9)) + { + uint32_t currpos = (uint32_t)pos + i + 1; + int32_t address = (int32_t)vm_read_32(vm, i + 1); + if (address < 0 && currpos >= (uint32_t)-address) + vm_write_32(vm, i + 1, address + filesize); + else if (address >= 0 && (uint32_t)address < filesize) + vm_write_32(vm, i + 1, address - currpos); + i += 4; + } + } + + filter->filteredblockaddress = 0; + filter->filteredblocklength = length; + + return 1; +} + +static int +execute_filter_rgb(struct rar_filter *filter, struct rar_virtual_machine *vm) +{ + uint32_t stride = filter->initialregisters[0]; + uint32_t byteoffset = filter->initialregisters[1]; + uint32_t blocklength = filter->initialregisters[4]; + uint8_t *src, *dst; + uint32_t i, j; + + if (blocklength > PROGRAM_WORK_SIZE / 2 || stride > blocklength) + return 0; + + src = &vm->memory[0]; + dst = &vm->memory[blocklength]; + for (i = 0; i < 3; i++) { + uint8_t byte = 0; + uint8_t *prev = dst + i - stride; + for (j = i; j < blocklength; j += 3) + { + if (prev >= dst) + { + uint32_t delta1 = abs(prev[3] - prev[0]); + uint32_t delta2 = abs(byte - prev[0]); + uint32_t delta3 = abs(prev[3] - prev[0] + byte - prev[0]); + if (delta1 > delta2 || delta1 > delta3) + byte = delta2 <= delta3 ? prev[3] : prev[0]; + } + byte -= *src++; + dst[j] = byte; + prev += 3; + } + } + for (i = byteoffset; i < blocklength - 2; i += 3) + { + dst[i] += dst[i + 1]; + dst[i + 2] += dst[i + 1]; + } + + filter->filteredblockaddress = blocklength; + filter->filteredblocklength = blocklength; + + return 1; +} + +static int +execute_filter_audio(struct rar_filter *filter, struct rar_virtual_machine *vm) +{ + uint32_t length = filter->initialregisters[4]; + uint32_t numchannels = filter->initialregisters[0]; + uint8_t *src, *dst; + uint32_t i, j; + + if (length > PROGRAM_WORK_SIZE / 2) + return 0; + + src = &vm->memory[0]; + dst = &vm->memory[length]; + for (i = 0; i < numchannels; i++) + { + struct audio_state state; + memset(&state, 0, sizeof(state)); + for (j = i; j < length; j += numchannels) + { + int8_t delta = (int8_t)*src++; + uint8_t predbyte, byte; + int prederror; + state.delta[2] = state.delta[1]; + state.delta[1] = state.lastdelta - state.delta[0]; + state.delta[0] = state.lastdelta; + predbyte = ((8 * state.lastbyte + state.weight[0] * state.delta[0] + state.weight[1] * state.delta[1] + state.weight[2] * state.delta[2]) >> 3) & 0xFF; + byte = (predbyte - delta) & 0xFF; + prederror = delta << 3; + state.error[0] += abs(prederror); + state.error[1] += abs(prederror - state.delta[0]); state.error[2] += abs(prederror + state.delta[0]); + state.error[3] += abs(prederror - state.delta[1]); state.error[4] += abs(prederror + state.delta[1]); + state.error[5] += abs(prederror - state.delta[2]); state.error[6] += abs(prederror + state.delta[2]); + state.lastdelta = (int8_t)(byte - state.lastbyte); + dst[j] = state.lastbyte = byte; + if (!(state.count++ & 0x1F)) + { + uint8_t k, idx = 0; + for (k = 1; k < 7; k++) + { + if (state.error[k] < state.error[idx]) + idx = k; + } + memset(state.error, 0, sizeof(state.error)); + switch (idx) + { + case 1: if (state.weight[0] >= -16) state.weight[0]--; break; + case 2: if (state.weight[0] < 16) state.weight[0]++; break; + case 3: if (state.weight[1] >= -16) state.weight[1]--; break; + case 4: if (state.weight[1] < 16) state.weight[1]++; break; + case 5: if (state.weight[2] >= -16) state.weight[2]--; break; + case 6: if (state.weight[2] < 16) state.weight[2]++; break; + } + } + } + } + + filter->filteredblockaddress = length; + filter->filteredblocklength = length; + + return 1; +} + + +static int +execute_filter(struct archive_read *a, struct rar_filter *filter, struct rar_virtual_machine *vm, size_t pos) +{ + if (filter->prog->fingerprint == 0x1D0E06077D) + return execute_filter_delta(filter, vm); + if (filter->prog->fingerprint == 0x35AD576887) + return execute_filter_e8(filter, vm, pos, 0); + if (filter->prog->fingerprint == 0x393CD7E57E) + return execute_filter_e8(filter, vm, pos, 1); + if (filter->prog->fingerprint == 0x951C2C5DC8) + return execute_filter_rgb(filter, vm); + if (filter->prog->fingerprint == 0xD8BC85E701) + return execute_filter_audio(filter, vm); + + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "No support for RAR VM program filter"); + return 0; +} + +static int +rar_decode_byte(struct archive_read *a, uint8_t *byte) +{ + struct rar *rar = (struct rar *)(a->format->data); + struct rar_br *br = &(rar->br); + if (!rar_br_read_ahead(a, br, 8)) + return 0; + *byte = (uint8_t)rar_br_bits(br, 8); + rar_br_consume(br, 8); + return 1; +} + +static inline void +vm_write_32(struct rar_virtual_machine* vm, size_t offset, uint32_t u32) +{ + archive_le32enc(vm->memory + offset, u32); +} + +static inline uint32_t +vm_read_32(struct rar_virtual_machine* vm, size_t offset) +{ + return archive_le32dec(vm->memory + offset); +} diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_rar5.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c similarity index 94% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_rar5.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c index 5d62d16..38979cb 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_rar5.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c @@ -632,7 +632,7 @@ static int run_arm_filter(struct rar5* rar, struct filter_info* flt) { /* 0xEB = ARM's BL (branch + link) instruction. */ offset = read_filter_data(rar, (rar->cstate.solid_offset + flt->block_start + i) & - rar->cstate.window_mask) & 0x00ffffff; + (uint32_t)rar->cstate.window_mask) & 0x00ffffff; offset -= (uint32_t) ((i + flt->block_start) / 4); offset = (offset & 0x00ffffff) | 0xeb000000; @@ -1012,7 +1012,16 @@ static int read_var_sized(struct archive_read* a, size_t* pvalue, return ret; } -static int read_bits_32(struct rar5* rar, const uint8_t* p, uint32_t* value) { +static int read_bits_32(struct archive_read* a, struct rar5* rar, + const uint8_t* p, uint32_t* value) +{ + if(rar->bits.in_addr >= rar->cstate.cur_block_size) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_PROGRAMMER, + "Premature end of stream during extraction of data (#1)"); + return ARCHIVE_FATAL; + } + uint32_t bits = ((uint32_t) p[rar->bits.in_addr]) << 24; bits |= p[rar->bits.in_addr + 1] << 16; bits |= p[rar->bits.in_addr + 2] << 8; @@ -1023,7 +1032,16 @@ static int read_bits_32(struct rar5* rar, const uint8_t* p, uint32_t* value) { return ARCHIVE_OK; } -static int read_bits_16(struct rar5* rar, const uint8_t* p, uint16_t* value) { +static int read_bits_16(struct archive_read* a, struct rar5* rar, + const uint8_t* p, uint16_t* value) +{ + if(rar->bits.in_addr >= rar->cstate.cur_block_size) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_PROGRAMMER, + "Premature end of stream during extraction of data (#2)"); + return ARCHIVE_FATAL; + } + int bits = (int) ((uint32_t) p[rar->bits.in_addr]) << 16; bits |= (int) p[rar->bits.in_addr + 1] << 8; bits |= (int) p[rar->bits.in_addr + 2]; @@ -1039,8 +1057,8 @@ static void skip_bits(struct rar5* rar, int bits) { } /* n = up to 16 */ -static int read_consume_bits(struct rar5* rar, const uint8_t* p, int n, - int* value) +static int read_consume_bits(struct archive_read* a, struct rar5* rar, + const uint8_t* p, int n, int* value) { uint16_t v; int ret, num; @@ -1051,7 +1069,7 @@ static int read_consume_bits(struct rar5* rar, const uint8_t* p, int n, return ARCHIVE_FATAL; } - ret = read_bits_16(rar, p, &v); + ret = read_bits_16(a, rar, p, &v); if(ret != ARCHIVE_OK) return ret; @@ -1099,6 +1117,44 @@ static int bid_standard(struct archive_read* a) { return -1; } +static int bid_sfx(struct archive_read *a) +{ + const char *p; + + if ((p = __archive_read_ahead(a, 7, NULL)) == NULL) + return -1; + + if ((p[0] == 'M' && p[1] == 'Z') || memcmp(p, "\x7F\x45LF", 4) == 0) { + /* This is a PE file */ + char signature[sizeof(rar5_signature_xor)]; + ssize_t offset = 0x10000; + ssize_t window = 4096; + ssize_t bytes_avail; + + rar5_signature(signature); + + while (offset + window <= (1024 * 512)) { + const char *buff = __archive_read_ahead(a, offset + window, &bytes_avail); + if (buff == NULL) { + /* Remaining bytes are less than window. */ + window >>= 1; + if (window < 0x40) + return 0; + continue; + } + p = buff + offset; + while (p + 8 < buff + bytes_avail) { + if (memcmp(p, signature, sizeof(signature)) == 0) + return 30; + p += 0x10; + } + offset = p - buff; + } + } + + return 0; +} + static int rar5_bid(struct archive_read* a, int best_bid) { int my_bid; @@ -1109,6 +1165,10 @@ static int rar5_bid(struct archive_read* a, int best_bid) { if(my_bid > -1) { return my_bid; } + my_bid = bid_sfx(a); + if (my_bid > -1) { + return my_bid; + } return -1; } @@ -1712,14 +1772,29 @@ static int process_head_file(struct archive_read* a, struct rar5* rar, } } - /* If we're currently switching volumes, ignore the new definition of - * window_size. */ - if(rar->cstate.switch_multivolume == 0) { - /* Values up to 64M should fit into ssize_t on every - * architecture. */ - rar->cstate.window_size = (ssize_t) window_size; + if(rar->cstate.window_size < (ssize_t) window_size && + rar->cstate.window_buf) + { + /* If window_buf has been allocated before, reallocate it, so + * that its size will match new window_size. */ + + uint8_t* new_window_buf = + realloc(rar->cstate.window_buf, window_size); + + if(!new_window_buf) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "Not enough memory when trying to realloc the window " + "buffer."); + return ARCHIVE_FATAL; + } + + rar->cstate.window_buf = new_window_buf; } + /* Values up to 64M should fit into ssize_t on every + * architecture. */ + rar->cstate.window_size = (ssize_t) window_size; + if(rar->file.solid > 0 && rar->file.solid_window_size == 0) { /* Solid files have to have the same window_size across whole archive. Remember the window_size parameter @@ -2273,6 +2348,62 @@ static int skip_base_block(struct archive_read* a) { return ret; } +static int try_skip_sfx(struct archive_read *a) +{ + const char *p; + + if ((p = __archive_read_ahead(a, 7, NULL)) == NULL) + return ARCHIVE_EOF; + + if ((p[0] == 'M' && p[1] == 'Z') || memcmp(p, "\x7F\x45LF", 4) == 0) + { + char signature[sizeof(rar5_signature_xor)]; + const void *h; + const char *q; + size_t skip, total = 0; + ssize_t bytes, window = 4096; + + rar5_signature(signature); + + while (total + window <= (1024 * 512)) { + h = __archive_read_ahead(a, window, &bytes); + if (h == NULL) { + /* Remaining bytes are less than window. */ + window >>= 1; + if (window < 0x40) + goto fatal; + continue; + } + if (bytes < 0x40) + goto fatal; + p = h; + q = p + bytes; + + /* + * Scan ahead until we find something that looks + * like the RAR header. + */ + while (p + 8 < q) { + if (memcmp(p, signature, sizeof(signature)) == 0) { + skip = p - (const char *)h; + __archive_read_consume(a, skip); + return (ARCHIVE_OK); + } + p += 0x10; + } + skip = p - (const char *)h; + __archive_read_consume(a, skip); + total += skip; + } + } + + return ARCHIVE_OK; +fatal: + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Couldn't find out RAR header"); + return (ARCHIVE_FATAL); +} + static int rar5_read_header(struct archive_read *a, struct archive_entry *entry) { @@ -2281,6 +2412,8 @@ static int rar5_read_header(struct archive_read *a, if(rar->header_initialized == 0) { init_header(a); + if ((ret = try_skip_sfx(a)) < ARCHIVE_WARN) + return ret; rar->header_initialized = 1; } @@ -2425,13 +2558,13 @@ static int create_decode_tables(uint8_t* bit_length, static int decode_number(struct archive_read* a, struct decode_table* table, const uint8_t* p, uint16_t* num) { - int i, bits, dist; + int i, bits, dist, ret; uint16_t bitfield; uint32_t pos; struct rar5* rar = get_context(a); - if(ARCHIVE_OK != read_bits_16(rar, p, &bitfield)) { - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = read_bits_16(a, rar, p, &bitfield))) { + return ret; } bitfield &= 0xfffe; @@ -2537,14 +2670,6 @@ static int parse_tables(struct archive_read* a, struct rar5* rar, for(i = 0; i < HUFF_TABLE_SIZE;) { uint16_t num; - if((rar->bits.in_addr + 6) >= rar->cstate.cur_block_size) { - /* Truncated data, can't continue. */ - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated data in huffman tables (#2)"); - return ARCHIVE_FATAL; - } - ret = decode_number(a, &rar->cstate.bd, p, &num); if(ret != ARCHIVE_OK) { archive_set_error(&a->archive, @@ -2561,8 +2686,8 @@ static int parse_tables(struct archive_read* a, struct rar5* rar, /* 16..17: repeat previous code */ uint16_t n; - if(ARCHIVE_OK != read_bits_16(rar, p, &n)) - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = read_bits_16(a, rar, p, &n))) + return ret; if(num == 16) { n >>= 13; @@ -2590,8 +2715,8 @@ static int parse_tables(struct archive_read* a, struct rar5* rar, /* other codes: fill with zeroes `n` times */ uint16_t n; - if(ARCHIVE_OK != read_bits_16(rar, p, &n)) - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = read_bits_16(a, rar, p, &n))) + return ret; if(num == 18) { n >>= 13; @@ -2696,33 +2821,35 @@ static int parse_block_header(struct archive_read* a, const uint8_t* p, ^ (uint8_t) (*block_size >> 16); if(calculated_cksum != hdr->block_cksum) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Block checksum error: got 0x%x, expected 0x%x", hdr->block_cksum, calculated_cksum); return ARCHIVE_FATAL; +#endif } return ARCHIVE_OK; } /* Convenience function used during filter processing. */ -static int parse_filter_data(struct rar5* rar, const uint8_t* p, - uint32_t* filter_data) +static int parse_filter_data(struct archive_read* a, struct rar5* rar, + const uint8_t* p, uint32_t* filter_data) { - int i, bytes; + int i, bytes, ret; uint32_t data = 0; - if(ARCHIVE_OK != read_consume_bits(rar, p, 2, &bytes)) - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = read_consume_bits(a, rar, p, 2, &bytes))) + return ret; bytes++; for(i = 0; i < bytes; i++) { uint16_t byte; - if(ARCHIVE_OK != read_bits_16(rar, p, &byte)) { - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = read_bits_16(a, rar, p, &byte))) { + return ret; } /* Cast to uint32_t will ensure the shift operation will not @@ -2765,16 +2892,17 @@ static int parse_filter(struct archive_read* ar, const uint8_t* p) { uint16_t filter_type; struct filter_info* filt = NULL; struct rar5* rar = get_context(ar); + int ret; /* Read the parameters from the input stream. */ - if(ARCHIVE_OK != parse_filter_data(rar, p, &block_start)) - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = parse_filter_data(ar, rar, p, &block_start))) + return ret; - if(ARCHIVE_OK != parse_filter_data(rar, p, &block_length)) - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = parse_filter_data(ar, rar, p, &block_length))) + return ret; - if(ARCHIVE_OK != read_bits_16(rar, p, &filter_type)) - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = read_bits_16(ar, rar, p, &filter_type))) + return ret; filter_type >>= 13; skip_bits(rar, 3); @@ -2814,8 +2942,8 @@ static int parse_filter(struct archive_read* ar, const uint8_t* p) { if(filter_type == FILTER_DELTA) { int channels; - if(ARCHIVE_OK != read_consume_bits(rar, p, 5, &channels)) - return ARCHIVE_EOF; + if(ARCHIVE_OK != (ret = read_consume_bits(ar, rar, p, 5, &channels))) + return ret; filt->channels = channels + 1; } @@ -2823,10 +2951,11 @@ static int parse_filter(struct archive_read* ar, const uint8_t* p) { return ARCHIVE_OK; } -static int decode_code_length(struct rar5* rar, const uint8_t* p, - uint16_t code) +static int decode_code_length(struct archive_read* a, struct rar5* rar, + const uint8_t* p, uint16_t code) { int lbits, length = 2; + if(code < 8) { lbits = 0; length += code; @@ -2838,7 +2967,7 @@ static int decode_code_length(struct rar5* rar, const uint8_t* p, if(lbits > 0) { int add; - if(ARCHIVE_OK != read_consume_bits(rar, p, lbits, &add)) + if(ARCHIVE_OK != read_consume_bits(a, rar, p, lbits, &add)) return -1; length += add; @@ -2933,7 +3062,7 @@ static int do_uncompress_block(struct archive_read* a, const uint8_t* p) { continue; } else if(num >= 262) { uint16_t dist_slot; - int len = decode_code_length(rar, p, num - 262), + int len = decode_code_length(a, rar, p, num - 262), dbits, dist = 1; @@ -2975,12 +3104,12 @@ static int do_uncompress_block(struct archive_read* a, const uint8_t* p) { uint16_t low_dist; if(dbits > 4) { - if(ARCHIVE_OK != read_bits_32( - rar, p, &add)) { + if(ARCHIVE_OK != (ret = read_bits_32( + a, rar, p, &add))) { /* Return EOF if we * can't read more * data. */ - return ARCHIVE_EOF; + return ret; } skip_bits(rar, dbits - 4); @@ -3015,11 +3144,11 @@ static int do_uncompress_block(struct archive_read* a, const uint8_t* p) { /* dbits is one of [0,1,2,3] */ int add; - if(ARCHIVE_OK != read_consume_bits(rar, - p, dbits, &add)) { + if(ARCHIVE_OK != (ret = read_consume_bits(a, rar, + p, dbits, &add))) { /* Return EOF if we can't read * more data. */ - return ARCHIVE_EOF; + return ret; } dist += add; @@ -3076,7 +3205,11 @@ static int do_uncompress_block(struct archive_read* a, const uint8_t* p) { return ARCHIVE_FATAL; } - len = decode_code_length(rar, p, len_slot); + len = decode_code_length(a, rar, p, len_slot); + if (len == -1) { + return ARCHIVE_FATAL; + } + rar->cstate.last_len = len; if(ARCHIVE_OK != copy_string(a, len, dist)) @@ -3600,6 +3733,16 @@ static int do_uncompress_file(struct archive_read* a) { rar->cstate.initialized = 1; } + /* Don't allow extraction if window_size is invalid. */ + if(rar->cstate.window_size == 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Invalid window size declaration in this file"); + + /* This should never happen in valid files. */ + return ARCHIVE_FATAL; + } + if(rar->cstate.all_filters_applied == 1) { /* We use while(1) here, but standard case allows for just 1 * iteration. The loop will iterate if process_block() didn't @@ -3770,6 +3913,13 @@ static int do_unpack(struct archive_read* a, struct rar5* rar, case GOOD: /* fallthrough */ case BEST: + /* No data is returned here. But because a sparse-file aware + * caller (like archive_read_data_into_fd) may treat zero-size + * as a sparse file block, we need to update the offset + * accordingly. At this point the decoder doesn't have any + * pending uncompressed data blocks, so the current position in + * the output file should be last_write_ptr. */ + if (offset) *offset = rar->cstate.last_write_ptr; return uncompress_file(a); default: archive_set_error(&a->archive, diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_raw.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_raw.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_raw.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_raw.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_tar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_tar.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_tar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_tar.c index 7e8feba..93c3fd5 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_tar.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_tar.c @@ -407,14 +407,13 @@ archive_read_format_tar_bid(struct archive_read *a, int best_bid) /* * Check format of mode/uid/gid/mtime/size/rdevmajor/rdevminor fields. */ - if (bid > 0 && ( - validate_number_field(header->mode, sizeof(header->mode)) == 0 + if (validate_number_field(header->mode, sizeof(header->mode)) == 0 || validate_number_field(header->uid, sizeof(header->uid)) == 0 || validate_number_field(header->gid, sizeof(header->gid)) == 0 || validate_number_field(header->mtime, sizeof(header->mtime)) == 0 || validate_number_field(header->size, sizeof(header->size)) == 0 || validate_number_field(header->rdevmajor, sizeof(header->rdevmajor)) == 0 - || validate_number_field(header->rdevminor, sizeof(header->rdevminor)) == 0)) { + || validate_number_field(header->rdevminor, sizeof(header->rdevminor)) == 0) { bid = 0; } @@ -573,11 +572,15 @@ archive_read_format_tar_read_header(struct archive_read *a, l = wcslen(wp); if (l > 0 && wp[l - 1] == L'/') { archive_entry_set_filetype(entry, AE_IFDIR); + tar->entry_bytes_remaining = 0; + tar->entry_padding = 0; } } else if ((p = archive_entry_pathname(entry)) != NULL) { l = strlen(p); if (l > 0 && p[l - 1] == '/') { archive_entry_set_filetype(entry, AE_IFDIR); + tar->entry_bytes_remaining = 0; + tar->entry_padding = 0; } } } @@ -1396,6 +1399,7 @@ read_mac_metadata_blob(struct archive_read *a, struct tar *tar, struct archive_entry *entry, const void *h, size_t *unconsumed) { int64_t size; + size_t msize; const void *data; const char *p, *name; const wchar_t *wp, *wname; @@ -1434,6 +1438,11 @@ read_mac_metadata_blob(struct archive_read *a, struct tar *tar, /* Read the body as a Mac OS metadata blob. */ size = archive_entry_size(entry); + msize = (size_t)size; + if (size < 0 || (uintmax_t)msize != (uintmax_t)size) { + *unconsumed = 0; + return (ARCHIVE_FATAL); + } /* * TODO: Look beyond the body here to peek at the next header. @@ -1447,13 +1456,13 @@ read_mac_metadata_blob(struct archive_read *a, struct tar *tar, * Q: Is the above idea really possible? Even * when there are GNU or pax extension entries? */ - data = __archive_read_ahead(a, (size_t)size, NULL); + data = __archive_read_ahead(a, msize, NULL); if (data == NULL) { *unconsumed = 0; return (ARCHIVE_FATAL); } - archive_entry_copy_mac_metadata(entry, data, (size_t)size); - *unconsumed = (size_t)((size + 511) & ~ 511); + archive_entry_copy_mac_metadata(entry, data, msize); + *unconsumed = (msize + 511) & ~ 511; tar_flush_unconsumed(a, unconsumed); return (tar_read_header(a, tar, entry, unconsumed)); } @@ -2098,6 +2107,21 @@ pax_attribute(struct archive_read *a, struct tar *tar, /* "size" is the size of the data in the entry. */ tar->entry_bytes_remaining = tar_atol10(value, strlen(value)); + if (tar->entry_bytes_remaining < 0) { + tar->entry_bytes_remaining = 0; + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Tar size attribute is negative"); + return (ARCHIVE_FATAL); + } + if (tar->entry_bytes_remaining == INT64_MAX) { + /* Note: tar_atol returns INT64_MAX on overflow */ + tar->entry_bytes_remaining = 0; + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Tar size attribute overflow"); + return (ARCHIVE_FATAL); + } /* * The "size" pax header keyword always overrides the * "size" field in the tar header. diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_warc.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_warc.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_xar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_xar.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_xar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_xar.c index 503ff58..ec5b06e 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_xar.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_xar.c @@ -624,7 +624,9 @@ read_toc(struct archive_read *a) __archive_read_consume(a, xar->toc_chksum_size); xar->offset += xar->toc_chksum_size; if (r != ARCHIVE_OK) +#ifndef DONT_FAIL_ON_CRC_ERROR return (ARCHIVE_FATAL); +#endif } /* @@ -827,10 +829,12 @@ xar_read_header(struct archive_read *a, struct archive_entry *entry) xattr->a_sum.val, xattr->a_sum.len, xattr->e_sum.val, xattr->e_sum.len); if (r != ARCHIVE_OK) { +#ifndef DONT_FAIL_ON_CRC_ERROR archive_set_error(&(a->archive), ARCHIVE_ERRNO_MISC, "Xattr checksum error"); r = ARCHIVE_WARN; break; +#endif } if (xattr->name.s == NULL) { archive_set_error(&(a->archive), ARCHIVE_ERRNO_MISC, diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_zip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_zip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c index 21d41cc..9d6c900 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_read_support_format_zip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c @@ -58,6 +58,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_zip.c 201102 #ifdef HAVE_LZMA_H #include #endif +#ifdef HAVE_ZSTD_H +#include +#endif #include "archive.h" #include "archive_digest_private.h" @@ -191,6 +194,11 @@ struct zip { char bzstream_valid; #endif +#if HAVE_ZSTD_H && HAVE_LIBZSTD + ZSTD_DStream *zstdstream; + char zstdstream_valid; +#endif + IByteIn zipx_ppmd_stream; ssize_t zipx_ppmd_read_compressed; CPpmd8 ppmd8; @@ -435,6 +443,7 @@ static const struct { {17, "reserved"}, /* Reserved by PKWARE */ {18, "ibm-terse-new"}, /* File is compressed using IBM TERSE (new) */ {19, "ibm-lz777"},/* IBM LZ77 z Architecture (PFS) */ + {93, "zstd"}, /* Zstandard (zstd) Compression */ {95, "xz"}, /* XZ compressed data */ {96, "jpeg"}, /* JPEG compressed data */ {97, "wav-pack"}, /* WavPack compressed data */ @@ -1144,7 +1153,8 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, (intmax_t)zip_entry->compressed_size); ret = ARCHIVE_WARN; } - if (zip_entry->uncompressed_size == 0) { + if (zip_entry->uncompressed_size == 0 || + zip_entry->uncompressed_size == 0xffffffff) { zip_entry->uncompressed_size = zip_entry_central_dir.uncompressed_size; } else if (zip_entry->uncompressed_size @@ -1186,7 +1196,7 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, { // symlink target string appeared to be compressed int status = ARCHIVE_FATAL; - const void *uncompressed_buffer; + const void *uncompressed_buffer = NULL; switch (zip->entry->compression) { @@ -1657,7 +1667,7 @@ zipx_lzma_alone_init(struct archive_read *a, struct zip *zip) */ /* Read magic1,magic2,lzma_params from the ZIPX stream. */ - if((p = __archive_read_ahead(a, 9, NULL)) == NULL) { + if(zip->entry_bytes_remaining < 9 || (p = __archive_read_ahead(a, 9, NULL)) == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Truncated lzma data"); return (ARCHIVE_FATAL); @@ -2238,6 +2248,140 @@ zip_read_data_zipx_bzip2(struct archive_read *a, const void **buff, #endif +#if HAVE_ZSTD_H && HAVE_LIBZSTD +static int +zipx_zstd_init(struct archive_read *a, struct zip *zip) +{ + size_t r; + + /* Deallocate already existing Zstd decompression context if it + * exists. */ + if(zip->zstdstream_valid) { + ZSTD_freeDStream(zip->zstdstream); + zip->zstdstream_valid = 0; + } + + /* Allocate a new Zstd decompression context. */ + zip->zstdstream = ZSTD_createDStream(); + + r = ZSTD_initDStream(zip->zstdstream); + if (ZSTD_isError(r)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Error initializing zstd decompressor: %s", + ZSTD_getErrorName(r)); + + return ARCHIVE_FAILED; + } + + /* Mark the zstdstream field to be released in cleanup phase. */ + zip->zstdstream_valid = 1; + + /* (Re)allocate the buffer that will contain decompressed bytes. */ + free(zip->uncompressed_buffer); + + zip->uncompressed_buffer_size = ZSTD_DStreamOutSize(); + zip->uncompressed_buffer = + (uint8_t*) malloc(zip->uncompressed_buffer_size); + if (zip->uncompressed_buffer == NULL) { + archive_set_error(&a->archive, ENOMEM, + "No memory for Zstd decompression"); + + return ARCHIVE_FATAL; + } + + /* Initialization done. */ + zip->decompress_init = 1; + return ARCHIVE_OK; +} + +static int +zip_read_data_zipx_zstd(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset) +{ + struct zip *zip = (struct zip *)(a->format->data); + ssize_t bytes_avail = 0, in_bytes, to_consume; + const void *compressed_buff; + int r; + size_t ret; + uint64_t total_out; + ZSTD_outBuffer out; + ZSTD_inBuffer in; + + (void) offset; /* UNUSED */ + + /* Initialize decompression context if we're here for the first time. */ + if(!zip->decompress_init) { + r = zipx_zstd_init(a, zip); + if(r != ARCHIVE_OK) + return r; + } + + /* Fetch more compressed bytes */ + compressed_buff = __archive_read_ahead(a, 1, &bytes_avail); + if(bytes_avail < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated zstd file body"); + return (ARCHIVE_FATAL); + } + + in_bytes = zipmin(zip->entry_bytes_remaining, bytes_avail); + if(in_bytes < 1) { + /* zstd doesn't complain when caller feeds avail_in == 0. + * It will actually return success in this case, which is + * undesirable. This is why we need to make this check + * manually. */ + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated zstd file body"); + return (ARCHIVE_FATAL); + } + + /* Setup buffer boundaries */ + in.src = compressed_buff; + in.size = in_bytes; + in.pos = 0; + out = (ZSTD_outBuffer) { zip->uncompressed_buffer, zip->uncompressed_buffer_size, 0 }; + + /* Perform the decompression. */ + ret = ZSTD_decompressStream(zip->zstdstream, &out, &in); + if (ZSTD_isError(ret)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Error during zstd decompression: %s", + ZSTD_getErrorName(ret)); + return (ARCHIVE_FATAL); + } + + /* Check end of the stream. */ + if (ret == 0) { + if ((in.pos == in.size) && (out.pos < out.size)) { + zip->end_of_entry = 1; + ZSTD_freeDStream(zip->zstdstream); + zip->zstdstream_valid = 0; + } + } + + /* Update the pointers so decompressor can continue decoding. */ + to_consume = in.pos; + __archive_read_consume(a, to_consume); + + total_out = out.pos; + + zip->entry_bytes_remaining -= to_consume; + zip->entry_compressed_bytes_read += to_consume; + zip->entry_uncompressed_bytes_read += total_out; + + /* Give libarchive its due. */ + *size = total_out; + *buff = zip->uncompressed_buffer; + + /* Seek for optional marker, like in other entries. */ + r = consume_optional_marker(a, zip); + if(r != ARCHIVE_OK) + return r; + + return ARCHIVE_OK; +} +#endif + #ifdef HAVE_ZLIB_H static int zip_deflate_init(struct archive_read *a, struct zip *zip) @@ -2857,6 +3001,11 @@ archive_read_format_zip_read_data(struct archive_read *a, case 95: /* ZIPx XZ compression. */ r = zip_read_data_zipx_xz(a, buff, size, offset); break; +#endif +#if HAVE_ZSTD_H && HAVE_LIBZSTD + case 93: /* ZIPx Zstd compression. */ + r = zip_read_data_zipx_zstd(a, buff, size, offset); + break; #endif /* PPMd support is built-in, so we don't need any #if guards. */ case 98: /* ZIPx PPMd compression. */ @@ -2948,6 +3097,12 @@ archive_read_format_zip_cleanup(struct archive_read *a) } #endif +#if HAVE_ZSTD_H && HAVE_LIBZSTD + if (zip->zstdstream_valid) { + ZSTD_freeDStream(zip->zstdstream); + } +#endif + free(zip->uncompressed_buffer); if (zip->ppmd8_valid) diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_string.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_string.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_string.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_string.c index 7460ded..69458e1 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_string.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_string.c @@ -745,7 +745,7 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as, dp = &defchar_used; count = WideCharToMultiByte(to_cp, 0, ws, wslen, as->s + as->length, - (int)as->buffer_length - as->length - 1, NULL, dp); + (int)as->buffer_length - (int)as->length - 1, NULL, dp); if (count == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { /* Expand the MBS buffer and retry. */ @@ -3988,10 +3988,10 @@ int archive_mstring_get_mbs_l(struct archive *a, struct archive_mstring *aes, const char **p, size_t *length, struct archive_string_conv *sc) { - int r, ret = 0; - - (void)r; /* UNUSED */ + int ret = 0; #if defined(_WIN32) && !defined(__CYGWIN__) + int r; + /* * Internationalization programming on Windows must use Wide * characters because Windows platform cannot make locale UTF-8. diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_string.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_string.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_string.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_string.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_string_composition.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_string_composition.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_string_composition.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_string_composition.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_string_sprintf.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_string_sprintf.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_string_sprintf.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_string_sprintf.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_util.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_util.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_util.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_util.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_util.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_util.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_util.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_util.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_version_details.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_version_details.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_version_details.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_version_details.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_virtual.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_virtual.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_virtual.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_virtual.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_windows.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_windows.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_windows.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_windows.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_windows.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_windows.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_windows.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_windows.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write.c index 38c14cb..27626b5 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write.c @@ -60,8 +60,6 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write.c 201099 2009-12-28 03:03: #include "archive_private.h" #include "archive_write_private.h" -static struct archive_vtable *archive_write_vtable(void); - static int _archive_filter_code(struct archive *, int); static const char *_archive_filter_name(struct archive *, int); static int64_t _archive_filter_bytes(struct archive *, int); @@ -79,26 +77,18 @@ struct archive_none { char *next; }; -static struct archive_vtable * -archive_write_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_close = _archive_write_close; - av.archive_filter_bytes = _archive_filter_bytes; - av.archive_filter_code = _archive_filter_code; - av.archive_filter_name = _archive_filter_name; - av.archive_filter_count = _archive_write_filter_count; - av.archive_free = _archive_write_free; - av.archive_write_header = _archive_write_header; - av.archive_write_finish_entry = _archive_write_finish_entry; - av.archive_write_data = _archive_write_data; - inited = 1; - } - return (&av); -} +static const struct archive_vtable +archive_write_vtable = { + .archive_close = _archive_write_close, + .archive_filter_bytes = _archive_filter_bytes, + .archive_filter_code = _archive_filter_code, + .archive_filter_name = _archive_filter_name, + .archive_filter_count = _archive_write_filter_count, + .archive_free = _archive_write_free, + .archive_write_header = _archive_write_header, + .archive_write_finish_entry = _archive_write_finish_entry, + .archive_write_data = _archive_write_data, +}; /* * Allocate, initialize and return an archive object. @@ -114,7 +104,7 @@ archive_write_new(void) return (NULL); a->archive.magic = ARCHIVE_WRITE_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; - a->archive.vtable = archive_write_vtable(); + a->archive.vtable = &archive_write_vtable; /* * The value 10240 here matches the traditional tar default, * but is otherwise arbitrary. @@ -211,6 +201,10 @@ __archive_write_allocate_filter(struct archive *_a) struct archive_write_filter *f; f = calloc(1, sizeof(*f)); + + if (f == NULL) + return (NULL); + f->archive = _a; f->state = ARCHIVE_WRITE_FILTER_STATE_NEW; if (a->filter_first == NULL) @@ -558,6 +552,10 @@ archive_write_open2(struct archive *_a, void *client_data, a->client_data = client_data; client_filter = __archive_write_allocate_filter(_a); + + if (client_filter == NULL) + return (ARCHIVE_FATAL); + client_filter->open = archive_write_client_open; client_filter->write = archive_write_client_write; client_filter->close = archive_write_client_close; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_b64encode.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_b64encode.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_by_name.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_by_name.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_bzip2.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_bzip2.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_compress.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_compress.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_grzip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_grzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_gzip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_gzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_lrzip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_lrzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_lz4.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_lz4.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_lzop.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_lzop.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_none.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_none.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_none.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_none.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_program.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_program.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_uuencode.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_uuencode.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_xz.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_xz.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c index 9dd2c30..04bee90 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_xz.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c @@ -251,13 +251,13 @@ archive_compressor_xz_init_stream(struct archive_write_filter *f, int ds, log2dic, wedges; /* Calculate a coded dictionary size */ - if (dict_size < (1 << 12) || dict_size > (1 << 27)) { + if (dict_size < (1 << 12) || dict_size > (1 << 29)) { archive_set_error(f->archive, ARCHIVE_ERRNO_MISC, "Unacceptable dictionary size for lzip: %d", dict_size); return (ARCHIVE_FATAL); } - for (log2dic = 27; log2dic >= 12; log2dic--) { + for (log2dic = 29; log2dic >= 12; log2dic--) { if (dict_size & (1 << log2dic)) break; } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_zstd.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c similarity index 91% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_zstd.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c index c74a35c..e85b766 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_add_filter_zstd.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c @@ -50,7 +50,8 @@ __FBSDID("$FreeBSD$"); struct private_data { int compression_level; -#if HAVE_ZSTD_H && HAVE_LIBZSTD + int threads; +#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR ZSTD_CStream *cstream; int64_t total_in; ZSTD_outBuffer out; @@ -76,7 +77,7 @@ static int archive_compressor_zstd_write(struct archive_write_filter *, const void *, size_t); static int archive_compressor_zstd_close(struct archive_write_filter *); static int archive_compressor_zstd_free(struct archive_write_filter *); -#if HAVE_ZSTD_H && HAVE_LIBZSTD +#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR static int drive_compressor(struct archive_write_filter *, struct private_data *, int, const void *, size_t); #endif @@ -107,7 +108,8 @@ archive_write_add_filter_zstd(struct archive *_a) f->code = ARCHIVE_FILTER_ZSTD; f->name = "zstd"; data->compression_level = CLEVEL_DEFAULT; -#if HAVE_ZSTD_H && HAVE_LIBZSTD + data->threads = 0; +#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR data->cstream = ZSTD_createCStream(); if (data->cstream == NULL) { free(data); @@ -134,7 +136,7 @@ static int archive_compressor_zstd_free(struct archive_write_filter *f) { struct private_data *data = (struct private_data *)f->data; -#if HAVE_ZSTD_H && HAVE_LIBZSTD +#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR ZSTD_freeCStream(data->cstream); free(data->out.dst); #else @@ -187,7 +189,7 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key, if (string_is_numeric(value) != ARCHIVE_OK) { return (ARCHIVE_WARN); } -#if HAVE_ZSTD_H && HAVE_LIBZSTD +#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR maximum = ZSTD_maxCLevel(); #if ZSTD_VERSION_NUMBER >= MINVER_MINCLEVEL if (ZSTD_versionNumber() >= MINVER_MINCLEVEL) { @@ -204,6 +206,20 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key, } data->compression_level = level; return (ARCHIVE_OK); + } else if (strcmp(key, "threads") == 0) { + int threads = atoi(value); + if (string_is_numeric(value) != ARCHIVE_OK) { + return (ARCHIVE_WARN); + } + + int minimum = 0; + + if (threads < minimum) { + return (ARCHIVE_WARN); + } + + data->threads = threads; + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options @@ -212,7 +228,7 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key, return (ARCHIVE_WARN); } -#if HAVE_ZSTD_H && HAVE_LIBZSTD +#if HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR /* * Setup callback. */ @@ -252,6 +268,8 @@ archive_compressor_zstd_open(struct archive_write_filter *f) return (ARCHIVE_FATAL); } + ZSTD_CCtx_setParameter(data->cstream, ZSTD_c_nbWorkers, data->threads); + return (ARCHIVE_OK); } @@ -335,7 +353,7 @@ drive_compressor(struct archive_write_filter *f, } } -#else /* HAVE_ZSTD_H && HAVE_LIBZSTD */ +#else /* HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR */ static int archive_compressor_zstd_open(struct archive_write_filter *f) @@ -366,6 +384,14 @@ archive_compressor_zstd_open(struct archive_write_filter *f) archive_strcat(&as, " --ultra"); } + if (data->threads != 0) { + struct archive_string as2; + archive_string_init(&as2); + archive_string_sprintf(&as2, " --threads=%d", data->threads); + archive_string_concat(&as, &as2); + archive_string_free(&as2); + } + f->write = archive_compressor_zstd_write; r = __archive_write_program_open(f, data->pdata, as.s); archive_string_free(&as); @@ -389,4 +415,4 @@ archive_compressor_zstd_close(struct archive_write_filter *f) return __archive_write_program_close(f, data->pdata); } -#endif /* HAVE_ZSTD_H && HAVE_LIBZSTD */ +#endif /* HAVE_ZSTD_H && HAVE_LIBZSTD_COMPRESSOR */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_blocksize.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_blocksize.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_blocksize.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_blocksize.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_data.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_data.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_data.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_data.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk.3 index 2fa016e..97f3fcd 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk.3 +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk.3 @@ -163,14 +163,14 @@ caused by archives that (deliberately or otherwise) extract files outside of the current directory. The default is not to perform this check. If -.It Cm ARCHIVE_EXTRACT_SPARSE -Scan data for blocks of NUL bytes and try to recreate them with holes. -This results in sparse files, independent of whether the archive format -supports or uses them. .Cm ARCHIVE_EXTRACT_UNLINK is specified together with this option, the library will remove any intermediate symlinks it finds and return an error only if such symlink could not be removed. +.It Cm ARCHIVE_EXTRACT_SPARSE +Scan data for blocks of NUL bytes and try to recreate them with holes. +This results in sparse files, independent of whether the archive format +supports or uses them. .It Cm ARCHIVE_EXTRACT_TIME The timestamps (mtime, ctime, and atime) should be restored. By default, they are ignored. diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_posix.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_posix.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_posix.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_posix.c index fcd733a..09a5eef 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_posix.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_posix.c @@ -173,6 +173,7 @@ struct fixup_entry { struct fixup_entry *next; struct archive_acl acl; mode_t mode; + __LA_MODE_T filetype; int64_t atime; int64_t birthtime; int64_t mtime; @@ -357,6 +358,7 @@ struct archive_write_disk { static int la_opendirat(int, const char *); static int la_mktemp(struct archive_write_disk *); +static int la_verify_filetype(mode_t, __LA_MODE_T); static void fsobj_error(int *, struct archive_string *, int, const char *, const char *); static int check_symlinks_fsobj(char *, int *, struct archive_string *, @@ -396,8 +398,6 @@ static struct fixup_entry *sort_dir_list(struct fixup_entry *p); static ssize_t write_data_block(struct archive_write_disk *, const char *, size_t); -static struct archive_vtable *archive_write_disk_vtable(void); - static int _archive_write_disk_close(struct archive *); static int _archive_write_disk_free(struct archive *); static int _archive_write_disk_header(struct archive *, @@ -464,6 +464,39 @@ la_opendirat(int fd, const char *path) { #endif } +static int +la_verify_filetype(mode_t mode, __LA_MODE_T filetype) { + int ret = 0; + + switch (filetype) { + case AE_IFREG: + ret = (S_ISREG(mode)); + break; + case AE_IFDIR: + ret = (S_ISDIR(mode)); + break; + case AE_IFLNK: + ret = (S_ISLNK(mode)); + break; + case AE_IFSOCK: + ret = (S_ISSOCK(mode)); + break; + case AE_IFCHR: + ret = (S_ISCHR(mode)); + break; + case AE_IFBLK: + ret = (S_ISBLK(mode)); + break; + case AE_IFIFO: + ret = (S_ISFIFO(mode)); + break; + default: + break; + } + + return (ret); +} + static int lazy_stat(struct archive_write_disk *a) { @@ -489,25 +522,16 @@ lazy_stat(struct archive_write_disk *a) return (ARCHIVE_WARN); } -static struct archive_vtable * -archive_write_disk_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_close = _archive_write_disk_close; - av.archive_filter_bytes = _archive_write_disk_filter_bytes; - av.archive_free = _archive_write_disk_free; - av.archive_write_header = _archive_write_disk_header; - av.archive_write_finish_entry - = _archive_write_disk_finish_entry; - av.archive_write_data = _archive_write_disk_data; - av.archive_write_data_block = _archive_write_disk_data_block; - inited = 1; - } - return (&av); -} +static const struct archive_vtable +archive_write_disk_vtable = { + .archive_close = _archive_write_disk_close, + .archive_filter_bytes = _archive_write_disk_filter_bytes, + .archive_free = _archive_write_disk_free, + .archive_write_header = _archive_write_disk_header, + .archive_write_finish_entry = _archive_write_disk_finish_entry, + .archive_write_data = _archive_write_disk_data, + .archive_write_data_block = _archive_write_disk_data_block, +}; static int64_t _archive_write_disk_filter_bytes(struct archive *_a, int n) @@ -822,6 +846,7 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry) fe = current_fixup(a, archive_entry_pathname(entry)); if (fe == NULL) return (ARCHIVE_FATAL); + fe->filetype = archive_entry_filetype(entry); fe->fixup |= TODO_MODE_BASE; fe->mode = a->mode; } @@ -832,6 +857,7 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry) fe = current_fixup(a, archive_entry_pathname(entry)); if (fe == NULL) return (ARCHIVE_FATAL); + fe->filetype = archive_entry_filetype(entry); fe->mode = a->mode; fe->fixup |= TODO_TIMES; if (archive_entry_atime_is_set(entry)) { @@ -865,6 +891,7 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry) fe = current_fixup(a, archive_entry_pathname(entry)); if (fe == NULL) return (ARCHIVE_FATAL); + fe->filetype = archive_entry_filetype(entry); fe->fixup |= TODO_ACLS; archive_acl_copy(&fe->acl, archive_entry_acl(entry)); } @@ -877,6 +904,7 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry) fe = current_fixup(a, archive_entry_pathname(entry)); if (fe == NULL) return (ARCHIVE_FATAL); + fe->filetype = archive_entry_filetype(entry); fe->mac_metadata = malloc(metadata_size); if (fe->mac_metadata != NULL) { memcpy(fe->mac_metadata, metadata, @@ -891,6 +919,7 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry) fe = current_fixup(a, archive_entry_pathname(entry)); if (fe == NULL) return (ARCHIVE_FATAL); + fe->filetype = archive_entry_filetype(entry); fe->fixup |= TODO_FFLAGS; /* TODO: Complete this.. defer fflags from below. */ } @@ -1956,7 +1985,7 @@ archive_write_disk_new(void) a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC; /* We're ready to write a header immediately. */ a->archive.state = ARCHIVE_STATE_HEADER; - a->archive.vtable = archive_write_disk_vtable(); + a->archive.vtable = &archive_write_disk_vtable; a->start_time = time(NULL); /* Query and restore the umask. */ umask(a->user_umask = umask(0)); @@ -1967,6 +1996,8 @@ archive_write_disk_new(void) free(a); return (NULL); } + a->path_safe.s[0] = 0; + #ifdef HAVE_ZLIB_H a->decmpfs_compression_level = 5; #endif @@ -2462,7 +2493,8 @@ _archive_write_disk_close(struct archive *_a) struct archive_write_disk *a = (struct archive_write_disk *)_a; struct fixup_entry *next, *p; struct stat st; - int fd, ret; + char *c; + int fd, ret, openflags; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, @@ -2475,24 +2507,70 @@ _archive_write_disk_close(struct archive *_a) while (p != NULL) { fd = -1; a->pst = NULL; /* Mark stat cache as out-of-date. */ - if (p->fixup & - (TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) { - fd = open(p->name, - O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC); - if (fd == -1) { - /* If we cannot lstat, skip entry */ - if (lstat(p->name, &st) != 0) + + /* We must strip trailing slashes from the path to avoid + dereferencing symbolic links to directories */ + c = p->name; + while (*c != '\0') + c++; + while (c != p->name && *(c - 1) == '/') { + c--; + *c = '\0'; + } + + if (p->fixup == 0) + goto skip_fixup_entry; + else { + /* + * We need to verify if the type of the file + * we are going to open matches the file type + * of the fixup entry. + */ + openflags = O_BINARY | O_NOFOLLOW | O_RDONLY + | O_CLOEXEC; +#if defined(O_DIRECTORY) + if (p->filetype == AE_IFDIR) + openflags |= O_DIRECTORY; +#endif + fd = open(p->name, openflags); + +#if defined(O_DIRECTORY) + /* + * If we support O_DIRECTORY and open was + * successful we can skip the file type check + * for directories. For other file types + * we need to verify via fstat() or lstat() + */ + if (fd == -1 || p->filetype != AE_IFDIR) { +#if HAVE_FSTAT + if (fd > 0 && ( + fstat(fd, &st) != 0 || + la_verify_filetype(st.st_mode, + p->filetype) == 0)) { + goto skip_fixup_entry; + } else +#endif + if (lstat(p->name, &st) != 0 || + la_verify_filetype(st.st_mode, + p->filetype) == 0) { goto skip_fixup_entry; - /* - * If we deal with a symbolic link, mark - * it in the fixup mode to ensure no - * modifications are made to its target. - */ - if (S_ISLNK(st.st_mode)) { - p->mode &= ~S_IFMT; - p->mode |= S_IFLNK; } } +#else +#if HAVE_FSTAT + if (fd > 0 && ( + fstat(fd, &st) != 0 || + la_verify_filetype(st.st_mode, + p->filetype) == 0)) { + goto skip_fixup_entry; + } else +#endif + if (lstat(p->name, &st) != 0 || + la_verify_filetype(st.st_mode, + p->filetype) == 0) { + goto skip_fixup_entry; + } +#endif } if (p->fixup & TODO_TIMES) { set_times(a, fd, p->mode, p->name, @@ -2504,14 +2582,13 @@ _archive_write_disk_close(struct archive *_a) if (p->fixup & TODO_MODE_BASE) { #ifdef HAVE_FCHMOD if (fd >= 0) - fchmod(fd, p->mode); + fchmod(fd, p->mode & 07777); else #endif #ifdef HAVE_LCHMOD - lchmod(p->name, p->mode); + lchmod(p->name, p->mode & 07777); #else - if (!S_ISLNK(p->mode)) - chmod(p->name, p->mode); + chmod(p->name, p->mode & 07777); #endif } if (p->fixup & TODO_ACLS) @@ -2664,7 +2741,7 @@ new_fixup(struct archive_write_disk *a, const char *pathname) fe->next = a->fixup_list; a->fixup_list = fe; fe->fixup = 0; - fe->mode = 0; + fe->filetype = 0; fe->name = strdup(pathname); return (fe); } @@ -2718,7 +2795,7 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr, char *tail; char *head; int last; - char c; + char c = '\0'; int r; struct stat st; int chdir_fd; @@ -3787,6 +3864,7 @@ set_fflags(struct archive_write_disk *a) le = current_fixup(a, a->name); if (le == NULL) return (ARCHIVE_FATAL); + le->filetype = archive_entry_filetype(a->entry); le->fixup |= TODO_FFLAGS; le->fflags_set = set; /* Store the mode if it's not already there. */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_set_standard_lookup.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_set_standard_lookup.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_set_standard_lookup.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_set_standard_lookup.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_windows.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_windows.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_windows.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_windows.c index 0c60017..88df3ce 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_disk_windows.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_disk_windows.c @@ -213,7 +213,7 @@ static int check_symlinks(struct archive_write_disk *); static int create_filesystem_object(struct archive_write_disk *); static struct fixup_entry *current_fixup(struct archive_write_disk *, const wchar_t *pathname); -static int cleanup_pathname(struct archive_write_disk *); +static int cleanup_pathname(struct archive_write_disk *, wchar_t *); static int create_dir(struct archive_write_disk *, wchar_t *); static int create_parent_dir(struct archive_write_disk *, wchar_t *); static int la_chmod(const wchar_t *, mode_t); @@ -238,8 +238,6 @@ static struct fixup_entry *sort_dir_list(struct fixup_entry *p); static ssize_t write_data_block(struct archive_write_disk *, const char *, size_t); -static struct archive_vtable *archive_write_disk_vtable(void); - static int _archive_write_disk_close(struct archive *); static int _archive_write_disk_free(struct archive *); static int _archive_write_disk_header(struct archive *, @@ -628,7 +626,7 @@ la_CreateSymbolicLinkW(const wchar_t *linkname, const wchar_t *target, static BOOLEAN (WINAPI *f)(LPCWSTR, LPCWSTR, DWORD); static int set; wchar_t *ttarget, *p; - int len; + size_t len; DWORD attrs = 0; DWORD flags = 0; DWORD newflags = 0; @@ -759,25 +757,16 @@ lazy_stat(struct archive_write_disk *a) return (ARCHIVE_WARN); } -static struct archive_vtable * -archive_write_disk_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_close = _archive_write_disk_close; - av.archive_filter_bytes = _archive_write_disk_filter_bytes; - av.archive_free = _archive_write_disk_free; - av.archive_write_header = _archive_write_disk_header; - av.archive_write_finish_entry - = _archive_write_disk_finish_entry; - av.archive_write_data = _archive_write_disk_data; - av.archive_write_data_block = _archive_write_disk_data_block; - inited = 1; - } - return (&av); -} +static const struct archive_vtable +archive_write_disk_vtable = { + .archive_close = _archive_write_disk_close, + .archive_filter_bytes = _archive_write_disk_filter_bytes, + .archive_free = _archive_write_disk_free, + .archive_write_header = _archive_write_disk_header, + .archive_write_finish_entry = _archive_write_disk_finish_entry, + .archive_write_data = _archive_write_disk_data, + .archive_write_data_block = _archive_write_disk_data_block, +}; static int64_t _archive_write_disk_filter_bytes(struct archive *_a, int n) @@ -854,7 +843,7 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry) * dir restores; the dir restore logic otherwise gets messed * up by nonsense like "dir/.". */ - ret = cleanup_pathname(a); + ret = cleanup_pathname(a, a->name); if (ret != ARCHIVE_OK) return (ret); @@ -1373,7 +1362,7 @@ archive_write_disk_new(void) a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC; /* We're ready to write a header immediately. */ a->archive.state = ARCHIVE_STATE_HEADER; - a->archive.vtable = archive_write_disk_vtable(); + a->archive.vtable = &archive_write_disk_vtable; a->start_time = time(NULL); /* Query and restore the umask. */ umask(a->user_umask = umask(0)); @@ -1381,6 +1370,7 @@ archive_write_disk_new(void) free(a); return (NULL); } + a->path_safe.s[0] = 0; return (&a->archive); } @@ -1671,9 +1661,22 @@ create_filesystem_object(struct archive_write_disk *a) /* Since link(2) and symlink(2) don't handle modes, we're done here. */ linkname = archive_entry_hardlink_w(a->entry); if (linkname != NULL) { - wchar_t *linkfull, *namefull; - - linkfull = __la_win_permissive_name_w(linkname); + wchar_t *linksanitized, *linkfull, *namefull; + size_t l = (wcslen(linkname) + 1) * sizeof(wchar_t); + linksanitized = malloc(l); + if (linksanitized == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate memory for hardlink target"); + return (-1); + } + memcpy(linksanitized, linkname, l); + r = cleanup_pathname(a, linksanitized); + if (r != ARCHIVE_OK) { + free(linksanitized); + return (r); + } + linkfull = __la_win_permissive_name_w(linksanitized); + free(linksanitized); namefull = __la_win_permissive_name_w(a->name); if (linkfull == NULL || namefull == NULL) { errno = EINVAL; @@ -2152,6 +2155,8 @@ check_symlinks(struct archive_write_disk *a) return (ARCHIVE_FAILED); } } + if (!c) + break; pn[0] = c; pn++; } @@ -2184,12 +2189,12 @@ guidword(wchar_t *p, int n) * set) any '..' in the path. */ static int -cleanup_pathname(struct archive_write_disk *a) +cleanup_pathname(struct archive_write_disk *a, wchar_t *name) { wchar_t *dest, *src, *p, *top; wchar_t separator = L'\0'; - p = a->name; + p = name; if (*p == L'\0') { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid empty pathname"); @@ -2201,7 +2206,7 @@ cleanup_pathname(struct archive_write_disk *a) if (*p == L'/') *p = L'\\'; } - p = a->name; + p = name; /* Skip leading "\\.\" or "\\?\" or "\\?\UNC\" or * "\\?\Volume{GUID}\" @@ -2256,6 +2261,9 @@ cleanup_pathname(struct archive_write_disk *a) return (ARCHIVE_FAILED); } else p += 4; + /* Network drive path like "\\\\file" */ + } else if (p[0] == L'\\' && p[1] == L'\\') { + p += 2; } /* Skip leading drive letter from archives created diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_filter.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_filter.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_filter.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_filter.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_finish_entry.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_finish_entry.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_finish_entry.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_finish_entry.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_format.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_format.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_format.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_format.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_free.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_free.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_free.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_free.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_header.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_header.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_header.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_header.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_new.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_new.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_new.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_new.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_open.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_open.3 similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_open.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_open.3 index 29bffe4..6bceb96 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_open.3 +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_open.3 @@ -218,6 +218,7 @@ On failure, the callback should invoke .Fn archive_set_error to register an error code and message and return +.Cm ARCHIVE_FATAL . .Bl -item -offset indent .It .Ft typedef int diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_fd.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_fd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_fd.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_fd.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_file.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_file.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_file.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_file.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_filename.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_filename.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_filename.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_filename.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_memory.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_memory.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_open_memory.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_open_memory.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_7zip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_7zip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_ar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_ar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_ar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_ar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_by_name.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_by_name.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_by_name.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_by_name.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c similarity index 86% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c index 29a7cad..47152cc 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c @@ -1,3 +1,4 @@ +#include "archive_platform.h" #include "archive.h" /* diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio_binary.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c similarity index 95% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio_binary.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c index c1e2f65..d6ce35a 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio_binary.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c @@ -124,7 +124,7 @@ PACKED(struct cpio_binary_header { * ...but it feels a little better to do it like this: */ -static uint16_t swap16(uint16_t in) { +static uint16_t la_swap16(uint16_t in) { union { uint16_t s[2]; uint8_t c[4]; @@ -141,7 +141,7 @@ static uint16_t swap16(uint16_t in) { /* NOTREACHED */ } -static uint32_t swap32(uint32_t in) { +static uint32_t la_swap32(uint32_t in) { union { uint32_t l; uint16_t s[2]; @@ -156,8 +156,8 @@ static uint32_t swap32(uint32_t in) { U.s[1] = t; } else if (U.c[3]) { /* Big-endian */ U.l = in; - U.s[0] = swap16(U.s[0]); - U.s[1] = swap16(U.s[1]); + U.s[0] = la_swap16(U.s[0]); + U.s[1] = la_swap16(U.s[1]); } else { /* PDP-endian */ U.l = in; } @@ -426,8 +426,8 @@ write_header(struct archive_write *a, struct archive_entry *entry) /* Include trailing null */ pathlength = (int)len + 1; - h.h_magic = swap16(070707); - h.h_dev = swap16(archive_entry_dev(entry)); + h.h_magic = la_swap16(070707); + h.h_dev = la_swap16(archive_entry_dev(entry)); ino = synthesize_ino_value(cpio, entry); if (ino < 0) { @@ -441,7 +441,7 @@ write_header(struct archive_write *a, struct archive_entry *entry) ret_final = ARCHIVE_FATAL; goto exit_write_header; } - h.h_ino = swap16(ino); + h.h_ino = la_swap16((uint16_t)ino); h.h_mode = archive_entry_mode(entry); if (((h.h_mode & AE_IFMT) == AE_IFSOCK) || ((h.h_mode & AE_IFMT) == AE_IFIFO)) { @@ -460,20 +460,20 @@ write_header(struct archive_write *a, struct archive_entry *entry) /* we could turn off AE_IFREG here, but it does no harm, */ /* and allows v7 cpio to read the entry without confusion */ } - h.h_mode = swap16(h.h_mode); + h.h_mode = la_swap16(h.h_mode); - h.h_uid = swap16(archive_entry_uid(entry)); - h.h_gid = swap16(archive_entry_gid(entry)); - h.h_nlink = swap16(archive_entry_nlink(entry)); + h.h_uid = la_swap16((uint16_t)archive_entry_uid(entry)); + h.h_gid = la_swap16((uint16_t)archive_entry_gid(entry)); + h.h_nlink = la_swap16((uint16_t)archive_entry_nlink(entry)); if (archive_entry_filetype(entry) == AE_IFBLK || archive_entry_filetype(entry) == AE_IFCHR) - h.h_majmin = swap16(archive_entry_rdev(entry)); + h.h_majmin = la_swap16(archive_entry_rdev(entry)); else h.h_majmin = 0; - h.h_mtime = swap32(archive_entry_mtime(entry)); - h.h_namesize = swap16(pathlength); + h.h_mtime = la_swap32((uint32_t)archive_entry_mtime(entry)); + h.h_namesize = la_swap16(pathlength); /* Non-regular files don't store bodies. */ if (archive_entry_filetype(entry) != AE_IFREG) @@ -502,7 +502,7 @@ write_header(struct archive_write *a, struct archive_entry *entry) ret_final = ARCHIVE_FATAL; goto exit_write_header; } - h.h_filesize = swap32(strlen(p)); /* symlink */ + h.h_filesize = la_swap32((uint32_t)strlen(p)); /* symlink */ } else { if ((a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) && (archive_entry_size(entry) > 256*256*256-1)) { @@ -516,7 +516,7 @@ write_header(struct archive_write *a, struct archive_entry *entry) ret_final = ARCHIVE_FAILED; goto exit_write_header; } - h.h_filesize = swap32(archive_entry_size(entry)); /* file */ + h.h_filesize = la_swap32((uint32_t)archive_entry_size(entry)); /* file */ } ret = __archive_write_output(a, &h, HSIZE); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio_newc.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio_newc.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio_odc.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_cpio_odc.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_filter_by_ext.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_filter_by_ext.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_gnutar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_gnutar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_iso9660.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_iso9660.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c index faabd28..58b7216 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_iso9660.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c @@ -6802,6 +6802,7 @@ isoent_rr_move(struct archive_write *a) * This comparing rule is according to ISO9660 Standard 6.9.1 */ static int +__LA_LIBC_CC _compare_path_table(const void *v1, const void *v2) { const struct isoent *p1, *p2; @@ -6844,6 +6845,7 @@ _compare_path_table(const void *v1, const void *v2) } static int +__LA_LIBC_CC _compare_path_table_joliet(const void *v1, const void *v2) { const struct isoent *p1, *p2; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_mtree.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_mtree.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_pax.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_pax.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_pax.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_pax.c index a2b2710..cf1f477 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_pax.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_pax.c @@ -1028,10 +1028,8 @@ archive_write_pax_header(struct archive_write *a, archive_string_init(&entry_name); archive_strcpy(&entry_name, archive_entry_pathname(entry_main)); - /* If file size is too large, add 'size' to pax extended attrs. */ + /* If file size is too large, we need pax extended attrs. */ if (archive_entry_size(entry_main) >= (((int64_t)1) << 33)) { - add_pax_attr_int(&(pax->pax_header), "size", - archive_entry_size(entry_main)); need_extension = 1; } @@ -1347,6 +1345,12 @@ archive_write_pax_header(struct archive_write *a, mapsize + pax->sparse_map_padding + sparse_total); } + /* If file size is too large, add 'size' to pax extended attrs. */ + if (archive_entry_size(entry_main) >= (((int64_t)1) << 33)) { + add_pax_attr_int(&(pax->pax_header), "size", + archive_entry_size(entry_main)); + } + /* Format 'ustar' header for main entry. * * The trouble with file size: If the reader can't understand @@ -1713,7 +1717,7 @@ build_pax_attribute_name(char *dest, const char *src) * to having clients override it. */ #if HAVE_GETPID && 0 /* Disable this for now; see above comment. */ - sprintf(buff, "PaxHeader.%d", getpid()); + snprintf(buff, sizeof(buff), "PaxHeader.%d", getpid()); #else /* If the platform can't fetch the pid, don't include it. */ strcpy(buff, "PaxHeader"); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_private.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_private.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_private.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_private.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_raw.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_raw.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_shar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_shar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_shar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_shar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_ustar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_ustar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_ustar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_ustar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_v7tar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_v7tar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_warc.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_warc.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_xar.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_xar.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_zip.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_zip.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c index f4352d5..8c14a70 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_format_zip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c @@ -740,12 +740,16 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) /* We may know the size, but never the CRC. */ zip->entry_flags |= ZIP_ENTRY_FLAG_LENGTH_AT_END; } else { - /* We don't know the size. In this case, we prefer - * deflate (it has a clear end-of-data marker which - * makes length-at-end more reliable) and will - * enable Zip64 extensions unless we're told not to. + /* We don't know the size. Use the default + * compression unless specified otherwise. + * We enable Zip64 extensions unless we're told not to. */ - zip->entry_compression = COMPRESSION_DEFAULT; + + zip->entry_compression = zip->requested_compression; + if(zip->entry_compression == COMPRESSION_UNSPECIFIED){ + zip->entry_compression = COMPRESSION_DEFAULT; + } + zip->entry_flags |= ZIP_ENTRY_FLAG_LENGTH_AT_END; if ((zip->flags & ZIP_FLAG_AVOID_ZIP64) == 0) { zip->entry_uses_zip64 = 1; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_options.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_options.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_options.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_options.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_options.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_options.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_options.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_options.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_passphrase.3 b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_passphrase.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_passphrase.3 rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_passphrase.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_passphrase.c b/src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_write_set_passphrase.c rename to src/dependencies/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/archive_xxhash.h b/src/dependencies/libarchive-3.6.2/libarchive/archive_xxhash.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/archive_xxhash.h rename to src/dependencies/libarchive-3.6.2/libarchive/archive_xxhash.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/config_freebsd.h b/src/dependencies/libarchive-3.6.2/libarchive/config_freebsd.h similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/config_freebsd.h rename to src/dependencies/libarchive-3.6.2/libarchive/config_freebsd.h index ac651f0..758621c 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/config_freebsd.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/config_freebsd.h @@ -236,6 +236,14 @@ #define HAVE_ZLIB_H 1 #define TIME_WITH_SYS_TIME 1 +#if __FreeBSD_version >= 800505 +#define HAVE_LIBLZMA 1 +#define HAVE_LZMA_H 1 +#if __FreeBSD_version >= 1002504 +#define HAVE_LZMA_STREAM_ENCODER_MT 1 +#endif +#endif + #if __FreeBSD_version >= 1100056 #define HAVE_FUTIMENS 1 #define HAVE_UTIMENSAT 1 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/cpio.5 b/src/dependencies/libarchive-3.6.2/libarchive/cpio.5 similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/cpio.5 rename to src/dependencies/libarchive-3.6.2/libarchive/cpio.5 index 837a456..c71018b 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/cpio.5 +++ b/src/dependencies/libarchive-3.6.2/libarchive/cpio.5 @@ -354,7 +354,7 @@ while working in AT&T's Unix Support Group. It appeared in 1977 as part of PWB/UNIX 1.0, the .Dq Programmer's Work Bench derived from -.At 6th Edition UNIX +.At v6 that was used internally at AT&T. Both the new binary and old character formats were in use by 1980, according to the System III source released diff --git a/src/dependencies/libarchive-3.5.2/libarchive/filter_fork.h b/src/dependencies/libarchive-3.6.2/libarchive/filter_fork.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/filter_fork.h rename to src/dependencies/libarchive-3.6.2/libarchive/filter_fork.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/filter_fork_posix.c b/src/dependencies/libarchive-3.6.2/libarchive/filter_fork_posix.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/filter_fork_posix.c rename to src/dependencies/libarchive-3.6.2/libarchive/filter_fork_posix.c index ac255c4..62085a7 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/filter_fork_posix.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/filter_fork_posix.c @@ -76,7 +76,7 @@ int __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout, pid_t *out_child) { - pid_t child; + pid_t child = -1; int stdin_pipe[2], stdout_pipe[2], tmp; #if HAVE_POSIX_SPAWNP posix_spawn_file_actions_t actions; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/filter_fork_windows.c b/src/dependencies/libarchive-3.6.2/libarchive/filter_fork_windows.c similarity index 87% rename from src/dependencies/libarchive-3.5.2/libarchive/filter_fork_windows.c rename to src/dependencies/libarchive-3.6.2/libarchive/filter_fork_windows.c index 8d11179..0b96397 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/filter_fork_windows.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/filter_fork_windows.c @@ -31,6 +31,43 @@ #include "filter_fork.h" +/* There are some editions of Windows ("nano server," for example) that + * do not host user32.dll. If we want to keep running on those editions, + * we need to delay-load WaitForInputIdle. */ +static void * +la_GetFunctionUser32(const char *name) +{ + static HINSTANCE lib; + static int set; + if (!set) { + set = 1; + lib = LoadLibrary(TEXT("user32.dll")); + } + if (lib == NULL) { + return NULL; + } + return (void *)GetProcAddress(lib, name); +} + +static int +la_WaitForInputIdle(HANDLE hProcess, DWORD dwMilliseconds) +{ + static DWORD (WINAPI *f)(HANDLE, DWORD); + static int set; + + if (!set) { + set = 1; + f = la_GetFunctionUser32("WaitForInputIdle"); + } + + if (!f) { + /* An inability to wait for input idle is + * not _good_, but it is not catastrophic. */ + return WAIT_FAILED; + } + return (*f)(hProcess, dwMilliseconds); +} + int __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout, HANDLE *out_child) @@ -149,7 +186,7 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout, if (CreateProcessA(fullpath.s, cmdline.s, NULL, NULL, TRUE, 0, NULL, NULL, &staInfo, &childInfo) == 0) goto fail; - WaitForInputIdle(childInfo.hProcess, INFINITE); + la_WaitForInputIdle(childInfo.hProcess, INFINITE); CloseHandle(childInfo.hProcess); CloseHandle(childInfo.hThread); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/libarchive-formats.5 b/src/dependencies/libarchive-3.6.2/libarchive/libarchive-formats.5 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/libarchive-formats.5 rename to src/dependencies/libarchive-3.6.2/libarchive/libarchive-formats.5 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/libarchive.3 b/src/dependencies/libarchive-3.6.2/libarchive/libarchive.3 similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/libarchive.3 rename to src/dependencies/libarchive-3.6.2/libarchive/libarchive.3 index 1ef4b7c..6490562 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/libarchive.3 +++ b/src/dependencies/libarchive-3.6.2/libarchive/libarchive.3 @@ -62,30 +62,40 @@ GNU-format tar archives, .It most common cpio archive formats, .It -ISO9660 CD images (including RockRidge and Joliet extensions), -.It -Zip archives, +7-Zip archives, .It ar archives (including GNU/SysV and BSD extensions), .It Microsoft CAB archives, .It +ISO9660 CD images (including RockRidge and Joliet extensions), +.It LHA archives, .It mtree file tree descriptions, .It -RAR archives, +RAR and most RAR5 archives, .It -XAR archives. +WARC archives, +.It +XAR archives, +.It +Zip archives. .El The library automatically detects archives compressed with -.Xr gzip 1 , +.Xr compress 1 , .Xr bzip2 1 , -.Xr xz 1 , +.Xr grzip 1 , +.Xr gzip 1 , +.Xr lrzip 1 , +.Xr lz4 1 , .Xr lzip 1 , +.Xr lzop 1 , +.Xr xz 1 , or -.Xr compress 1 -and decompresses them transparently. +.Xr zstd 1 +and decompresses them transparently. Decompression of some formats +requires external decompressor utilities. It can similarly detect and decode archives processed with .Xr uuencode 1 or which have an @@ -107,19 +117,19 @@ archives, .It cpio archives, .It -Zip archive, +7-Zip archives, +.It +ar archives, .It two different variants of shar archives, .It ISO9660 CD images, .It -7-Zip archives, -.It -ar archives, -.It mtree file tree descriptions, .It -XAR archives. +XAR archives, +.It +Zip archive. .El Pax interchange format is an extension of the tar archive format that eliminates essentially all of the limitations of historic tar formats diff --git a/src/dependencies/libarchive-3.5.2/libarchive/libarchive_changes.3 b/src/dependencies/libarchive-3.6.2/libarchive/libarchive_changes.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/libarchive_changes.3 rename to src/dependencies/libarchive-3.6.2/libarchive/libarchive_changes.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/libarchive_internals.3 b/src/dependencies/libarchive-3.6.2/libarchive/libarchive_internals.3 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/libarchive_internals.3 rename to src/dependencies/libarchive-3.6.2/libarchive/libarchive_internals.3 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/mtree.5 b/src/dependencies/libarchive-3.6.2/libarchive/mtree.5 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/mtree.5 rename to src/dependencies/libarchive-3.6.2/libarchive/mtree.5 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/tar.5 b/src/dependencies/libarchive-3.6.2/libarchive/tar.5 similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/tar.5 rename to src/dependencies/libarchive-3.6.2/libarchive/tar.5 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/libarchive/test/CMakeLists.txt similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/test/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/libarchive/test/CMakeLists.txt index 53cc3e2..bbbff22 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/CMakeLists.txt +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/CMakeLists.txt @@ -63,6 +63,7 @@ IF(ENABLE_TEST) test_compat_solaris_pax_sparse.c test_compat_solaris_tar_acl.c test_compat_star_acl.c + test_compat_tar_directory.c test_compat_tar_hardlink.c test_compat_uudecode.c test_compat_uudecode_large.c @@ -152,6 +153,7 @@ IF(ENABLE_TEST) test_read_format_rar_encryption_header.c test_read_format_rar_encryption_partially.c test_read_format_rar_invalid1.c + test_read_format_rar_filter.c test_read_format_rar5.c test_read_format_raw.c test_read_format_tar.c @@ -160,6 +162,7 @@ IF(ENABLE_TEST) test_read_format_tar_empty_with_gnulabel.c test_read_format_tar_empty_pax.c test_read_format_tar_filename.c + test_read_format_tar_invalid_pax_size.c test_read_format_tbz.c test_read_format_tgz.c test_read_format_tlz.c @@ -276,6 +279,7 @@ IF(ENABLE_TEST) test_write_format_zip_compression_store.c test_write_format_zip_empty.c test_write_format_zip_empty_zip64.c + test_write_format_zip_entry_size_unset.c test_write_format_zip_file.c test_write_format_zip_file_zip64.c test_write_format_zip_large.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/README b/src/dependencies/libarchive-3.6.2/libarchive/test/README similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/README rename to src/dependencies/libarchive-3.6.2/libarchive/test/README diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/list.h b/src/dependencies/libarchive-3.6.2/libarchive/test/list.h similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/list.h rename to src/dependencies/libarchive-3.6.2/libarchive/test/list.h index 0146e92..42a36b4 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/list.h +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/list.h @@ -122,6 +122,7 @@ DEFINE_TEST(test_compat_solaris_pax_sparse) DEFINE_TEST(test_compat_solaris_tar_acl) DEFINE_TEST(test_compat_star_acl_posix1e) DEFINE_TEST(test_compat_star_acl_nfs4) +DEFINE_TEST(test_compat_tar_directory) DEFINE_TEST(test_compat_tar_hardlink) DEFINE_TEST(test_compat_uudecode) DEFINE_TEST(test_compat_uudecode_large) @@ -206,15 +207,15 @@ DEFINE_TEST(test_read_format_ar) DEFINE_TEST(test_read_format_cab) DEFINE_TEST(test_read_format_cab_filename) DEFINE_TEST(test_read_format_cpio_afio) +DEFINE_TEST(test_read_format_cpio_bin) +DEFINE_TEST(test_read_format_cpio_bin_Z) DEFINE_TEST(test_read_format_cpio_bin_be) DEFINE_TEST(test_read_format_cpio_bin_bz2) -DEFINE_TEST(test_read_format_cpio_bin) DEFINE_TEST(test_read_format_cpio_bin_gz) DEFINE_TEST(test_read_format_cpio_bin_le) DEFINE_TEST(test_read_format_cpio_bin_lzip) DEFINE_TEST(test_read_format_cpio_bin_lzma) DEFINE_TEST(test_read_format_cpio_bin_xz) -DEFINE_TEST(test_read_format_cpio_bin_Z) DEFINE_TEST(test_read_format_cpio_filename_eucJP_UTF8) DEFINE_TEST(test_read_format_cpio_filename_UTF8_eucJP) DEFINE_TEST(test_read_format_cpio_filename_UTF8_UTF8_jp) @@ -233,9 +234,9 @@ DEFINE_TEST(test_read_format_cpio_filename_KOI8R_CP1251) DEFINE_TEST(test_read_format_cpio_filename_UTF8_CP1251) DEFINE_TEST(test_read_format_cpio_odc) DEFINE_TEST(test_read_format_cpio_svr4_bzip2_rpm) -DEFINE_TEST(test_read_format_cpio_svr4c_Z) DEFINE_TEST(test_read_format_cpio_svr4_gzip) DEFINE_TEST(test_read_format_cpio_svr4_gzip_rpm) +DEFINE_TEST(test_read_format_cpio_svr4c_Z) DEFINE_TEST(test_read_format_empty) DEFINE_TEST(test_read_format_gtar_filename_eucJP_UTF8) DEFINE_TEST(test_read_format_gtar_filename_CP866_KOI8R) @@ -250,20 +251,20 @@ DEFINE_TEST(test_read_format_gtar_gz) DEFINE_TEST(test_read_format_gtar_lzma) DEFINE_TEST(test_read_format_gtar_sparse) DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) +DEFINE_TEST(test_read_format_iso_Z) +DEFINE_TEST(test_read_format_iso_multi_extent) +DEFINE_TEST(test_read_format_iso_xorriso) DEFINE_TEST(test_read_format_isojoliet_bz2) DEFINE_TEST(test_read_format_isojoliet_long) DEFINE_TEST(test_read_format_isojoliet_rr) DEFINE_TEST(test_read_format_isojoliet_versioned) -DEFINE_TEST(test_read_format_iso_multi_extent) DEFINE_TEST(test_read_format_isorr_bz2) DEFINE_TEST(test_read_format_isorr_ce) DEFINE_TEST(test_read_format_isorr_new_bz2) DEFINE_TEST(test_read_format_isorr_rr_moved) -DEFINE_TEST(test_read_format_iso_xorriso) -DEFINE_TEST(test_read_format_iso_Z) DEFINE_TEST(test_read_format_isozisofs_bz2) -DEFINE_TEST(test_read_format_lha_bugfix_0) DEFINE_TEST(test_read_format_lha) +DEFINE_TEST(test_read_format_lha_bugfix_0) DEFINE_TEST(test_read_format_lha_filename) DEFINE_TEST(test_read_format_lha_filename_UTF16) DEFINE_TEST(test_read_format_mtree) @@ -274,8 +275,31 @@ DEFINE_TEST(test_read_format_mtree_nomagic_v2_form) DEFINE_TEST(test_read_format_mtree_nomagic_v2_netbsd_form) DEFINE_TEST(test_read_format_mtree_nonexistent_contents_file) DEFINE_TEST(test_read_format_mtree_noprint) +DEFINE_TEST(test_read_format_mtree_tab) DEFINE_TEST(test_read_format_mtree_crash747) DEFINE_TEST(test_read_format_pax_bz2) +DEFINE_TEST(test_read_format_rar_set_format) +DEFINE_TEST(test_read_format_rar_basic) +DEFINE_TEST(test_read_format_rar_subblock) +DEFINE_TEST(test_read_format_rar_noeof) +DEFINE_TEST(test_read_format_rar_unicode_UTF8) +DEFINE_TEST(test_read_format_rar_unicode_CP932) +DEFINE_TEST(test_read_format_rar_compress_normal) +DEFINE_TEST(test_read_format_rar_multi_lzss_blocks) +DEFINE_TEST(test_read_format_rar_compress_best) +DEFINE_TEST(test_read_format_rar_ppmd_lzss_conversion) +DEFINE_TEST(test_read_format_rar_binary) +DEFINE_TEST(test_read_format_rar_windows) +DEFINE_TEST(test_read_format_rar_multivolume) +DEFINE_TEST(test_read_format_rar_multivolume_skip) +DEFINE_TEST(test_read_format_rar_sfx) +DEFINE_TEST(test_read_format_rar_multivolume_stored_file) +DEFINE_TEST(test_read_format_rar_multivolume_stored_file_skip) +DEFINE_TEST(test_read_format_rar_multivolume_seek_data) +DEFINE_TEST(test_read_format_rar_multivolume_seek_multiple_files) +DEFINE_TEST(test_read_format_rar_multivolume_uncompressed_files) +DEFINE_TEST(test_read_format_rar_ppmd_use_after_free) +DEFINE_TEST(test_read_format_rar_ppmd_use_after_free2) DEFINE_TEST(test_read_format_rar5_set_format) DEFINE_TEST(test_read_format_rar5_stored) DEFINE_TEST(test_read_format_rar5_compressed) @@ -315,35 +339,19 @@ DEFINE_TEST(test_read_format_rar5_distance_overflow) DEFINE_TEST(test_read_format_rar5_nonempty_dir_stream) DEFINE_TEST(test_read_format_rar5_fileattr) DEFINE_TEST(test_read_format_rar5_different_window_size) +DEFINE_TEST(test_read_format_rar5_window_buf_and_size_desync) DEFINE_TEST(test_read_format_rar5_arm_filter_on_window_boundary) DEFINE_TEST(test_read_format_rar5_different_solid_window_size) DEFINE_TEST(test_read_format_rar5_different_winsize_on_merge) DEFINE_TEST(test_read_format_rar5_block_size_is_too_small) -DEFINE_TEST(test_read_format_rar_set_format) -DEFINE_TEST(test_read_format_rar_basic) -DEFINE_TEST(test_read_format_rar_subblock) -DEFINE_TEST(test_read_format_rar_noeof) -DEFINE_TEST(test_read_format_rar_unicode_UTF8) -DEFINE_TEST(test_read_format_rar_unicode_CP932) -DEFINE_TEST(test_read_format_rar_compress_normal) -DEFINE_TEST(test_read_format_rar_multi_lzss_blocks) -DEFINE_TEST(test_read_format_rar_compress_best) -DEFINE_TEST(test_read_format_rar_ppmd_lzss_conversion) -DEFINE_TEST(test_read_format_rar_binary) -DEFINE_TEST(test_read_format_rar_windows) -DEFINE_TEST(test_read_format_rar_multivolume) -DEFINE_TEST(test_read_format_rar_multivolume_skip) -DEFINE_TEST(test_read_format_rar_sfx) -DEFINE_TEST(test_read_format_rar_multivolume_stored_file) -DEFINE_TEST(test_read_format_rar_multivolume_stored_file_skip) -DEFINE_TEST(test_read_format_rar_multivolume_seek_data) -DEFINE_TEST(test_read_format_rar_multivolume_seek_multiple_files) -DEFINE_TEST(test_read_format_rar_multivolume_uncompressed_files) -DEFINE_TEST(test_read_format_rar_ppmd_use_after_free) -DEFINE_TEST(test_read_format_rar_ppmd_use_after_free2) +DEFINE_TEST(test_read_format_rar5_sfx) +DEFINE_TEST(test_read_format_rar5_decode_number_out_of_bounds_read) +DEFINE_TEST(test_read_format_rar5_bad_window_size_in_multiarchive_file) +DEFINE_TEST(test_read_format_rar5_read_data_block_uninitialized_offset) DEFINE_TEST(test_read_format_rar_encryption_data) DEFINE_TEST(test_read_format_rar_encryption_header) DEFINE_TEST(test_read_format_rar_encryption_partially) +DEFINE_TEST(test_read_format_rar_filter) DEFINE_TEST(test_read_format_rar_invalid1) DEFINE_TEST(test_read_format_raw) DEFINE_TEST(test_read_format_tar) @@ -352,6 +360,7 @@ DEFINE_TEST(test_read_format_tar_empty_filename) DEFINE_TEST(test_read_format_tar_empty_pax) DEFINE_TEST(test_read_format_tar_empty_with_gnulabel) DEFINE_TEST(test_read_format_tar_filename) +DEFINE_TEST(test_read_format_tar_invalid_pax_size) DEFINE_TEST(test_read_format_tbz) DEFINE_TEST(test_read_format_tgz) DEFINE_TEST(test_read_format_tlz) @@ -360,7 +369,6 @@ DEFINE_TEST(test_read_format_tz) DEFINE_TEST(test_read_format_ustar_filename) DEFINE_TEST(test_read_format_warc) DEFINE_TEST(test_read_format_xar) -DEFINE_TEST(test_read_format_zip_utf8_paths) DEFINE_TEST(test_read_format_zip) DEFINE_TEST(test_read_format_zip_ppmd_one_file) DEFINE_TEST(test_read_format_zip_ppmd_one_file_blockread) @@ -374,6 +382,10 @@ DEFINE_TEST(test_read_format_zip_bzip2_one_file) DEFINE_TEST(test_read_format_zip_bzip2_one_file_blockread) DEFINE_TEST(test_read_format_zip_bzip2_multi) DEFINE_TEST(test_read_format_zip_bzip2_multi_blockread) +DEFINE_TEST(test_read_format_zip_zstd_one_file) +DEFINE_TEST(test_read_format_zip_zstd_one_file_blockread) +DEFINE_TEST(test_read_format_zip_zstd_multi) +DEFINE_TEST(test_read_format_zip_zstd_multi_blockread) DEFINE_TEST(test_read_format_zip_xz_multi) DEFINE_TEST(test_read_format_zip_xz_multi_blockread) DEFINE_TEST(test_read_format_zip_ppmd8_crash_1) @@ -384,6 +396,7 @@ DEFINE_TEST(test_read_format_zip_lzma_stream_end) DEFINE_TEST(test_read_format_zip_lzma_stream_end_blockread) DEFINE_TEST(test_read_format_zip_7z_lzma) DEFINE_TEST(test_read_format_zip_7z_deflate) +DEFINE_TEST(test_read_format_zip_utf8_paths) DEFINE_TEST(test_read_format_zip_comment_stored) DEFINE_TEST(test_read_format_zip_encryption_data) DEFINE_TEST(test_read_format_zip_encryption_header) @@ -463,8 +476,8 @@ DEFINE_TEST(test_ustar_filename_encoding_EUCJP_CP932) DEFINE_TEST(test_ustar_filename_encoding_CP932_UTF8) DEFINE_TEST(test_ustar_filenames) DEFINE_TEST(test_warn_missing_hardlink_target) -DEFINE_TEST(test_write_disk_appledouble) DEFINE_TEST(test_write_disk) +DEFINE_TEST(test_write_disk_appledouble) DEFINE_TEST(test_write_disk_failures) DEFINE_TEST(test_write_disk_fixup) DEFINE_TEST(test_write_disk_hardlink) @@ -473,11 +486,11 @@ DEFINE_TEST(test_write_disk_lookup) DEFINE_TEST(test_write_disk_mac_metadata) DEFINE_TEST(test_write_disk_no_hfs_compression) DEFINE_TEST(test_write_disk_perms) +DEFINE_TEST(test_write_disk_secure) DEFINE_TEST(test_write_disk_secure744) DEFINE_TEST(test_write_disk_secure745) DEFINE_TEST(test_write_disk_secure746a) DEFINE_TEST(test_write_disk_secure746b) -DEFINE_TEST(test_write_disk_secure) DEFINE_TEST(test_write_disk_sparse) DEFINE_TEST(test_write_disk_symlink) DEFINE_TEST(test_write_disk_times) @@ -524,22 +537,22 @@ DEFINE_TEST(test_write_format_cpio_odc) DEFINE_TEST(test_write_format_gnutar) DEFINE_TEST(test_write_format_gnutar_filenames) DEFINE_TEST(test_write_format_gnutar_linknames) -DEFINE_TEST(test_write_format_iso9660_boot) DEFINE_TEST(test_write_format_iso9660) +DEFINE_TEST(test_write_format_iso9660_boot) DEFINE_TEST(test_write_format_iso9660_empty) DEFINE_TEST(test_write_format_iso9660_filename) DEFINE_TEST(test_write_format_iso9660_zisofs) -DEFINE_TEST(test_write_format_mtree_absolute_path) DEFINE_TEST(test_write_format_mtree) DEFINE_TEST(test_write_format_mtree_no_leading_dotslash) +DEFINE_TEST(test_write_format_mtree_absolute_path) DEFINE_TEST(test_write_format_mtree_classic) DEFINE_TEST(test_write_format_mtree_classic_indent) DEFINE_TEST(test_write_format_mtree_fflags) DEFINE_TEST(test_write_format_mtree_no_separator) DEFINE_TEST(test_write_format_mtree_quoted_filename) DEFINE_TEST(test_write_format_pax) -DEFINE_TEST(test_write_format_raw_b64) DEFINE_TEST(test_write_format_raw) +DEFINE_TEST(test_write_format_raw_b64) DEFINE_TEST(test_write_format_shar_empty) DEFINE_TEST(test_write_format_tar) DEFINE_TEST(test_write_format_tar_empty) @@ -558,6 +571,7 @@ DEFINE_TEST(test_write_format_zip_winzip_aes256_encryption) DEFINE_TEST(test_write_format_zip_compression_store) DEFINE_TEST(test_write_format_zip_empty) DEFINE_TEST(test_write_format_zip_empty_zip64) +DEFINE_TEST(test_write_format_zip_size_unset) DEFINE_TEST(test_write_format_zip_file) DEFINE_TEST(test_write_format_zip_file_zip64) DEFINE_TEST(test_write_format_zip_large) diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/read_open_memory.c b/src/dependencies/libarchive-3.6.2/libarchive/test/read_open_memory.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/read_open_memory.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/read_open_memory.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test.h b/src/dependencies/libarchive-3.6.2/libarchive/test/test.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test.h rename to src/dependencies/libarchive-3.6.2/libarchive/test/test.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_nfs4.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_nfs4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_nfs4.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_nfs4.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_pax.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_pax.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_pax.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_pax.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_pax_nfs4.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_pax_nfs4.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_pax_nfs4.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_pax_nfs4.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_pax_posix1e.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_pax_posix1e.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_pax_posix1e.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_pax_posix1e.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_platform_nfs4.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_platform_nfs4.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_platform_nfs4.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_platform_nfs4.c index ae4bb5a..6a5b439 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_platform_nfs4.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_platform_nfs4.c @@ -907,7 +907,7 @@ DEFINE_TEST(test_acl_platform_nfs4) assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); for (i = 0; i < acls_dir_cnt; ++i) { - sprintf(buff, "dir%d", i); + snprintf(buff, sizeof(buff), "dir%d", i); archive_entry_set_pathname(ae, buff); archive_entry_set_filetype(ae, AE_IFDIR); archive_entry_set_perm(ae, 0654); @@ -960,7 +960,7 @@ DEFINE_TEST(test_acl_platform_nfs4) /* Verify single-permission dirs on disk. */ for (i = 0; i < dircnt; ++i) { - sprintf(buff, "dir%d", i); + snprintf(buff, sizeof(buff), "dir%d", i); assertEqualInt(0, stat(buff, &st)); assertEqualInt(st.st_mtime, 123456 + i); #if ARCHIVE_ACL_SUNOS_NFS4 diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_platform_posix1e.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_platform_posix1e.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_platform_posix1e.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_platform_posix1e.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_posix1e.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_posix1e.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_posix1e.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_posix1e.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_text.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_text.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_acl_text.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_acl_text.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_api_feature.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_api_feature.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_api_feature.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_api_feature.c index 60773ad..d7d1a2d 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_api_feature.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_api_feature.c @@ -32,7 +32,7 @@ DEFINE_TEST(test_archive_api_feature) /* This is the (hopefully) final versioning API. */ assertEqualInt(ARCHIVE_VERSION_NUMBER, archive_version_number()); - sprintf(buff, "libarchive %d.%d.%d", + snprintf(buff, sizeof(buff), "libarchive %d.%d.%d", archive_version_number() / 1000000, (archive_version_number() / 1000) % 1000, archive_version_number() % 1000); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_clear_error.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_clear_error.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_clear_error.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_clear_error.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_cmdline.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_cmdline.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_cmdline.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_cmdline.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_digest.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_digest.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_digest.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_digest.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_getdate.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_getdate.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_getdate.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_getdate.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_match_owner.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_match_owner.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_match_owner.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_match_owner.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_match_path.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_match_path.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_match_path.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_match_path.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_match_time.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_match_time.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_match_time.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_match_time.c index c6864b3..23754a1 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_match_time.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_match_time.c @@ -321,6 +321,11 @@ test_newer_ctime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -435,6 +440,11 @@ test_newer_ctime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -782,6 +792,11 @@ test_older_ctime_than_file_mbs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -897,6 +912,11 @@ test_older_ctime_than_file_wcs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -1073,6 +1093,11 @@ test_ctime_between_files_mbs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { @@ -1132,6 +1157,11 @@ test_ctime_between_files_wcs(void) struct archive_entry *ae; struct archive *m; +#if defined(_WIN32) && !defined(__CYGWIN__) + skipping("Can't set ctime on Windows"); + return; +#endif + if (!assert((m = archive_match_new()) != NULL)) return; if (!assert((ae = archive_entry_new()) != NULL)) { diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_pathmatch.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_pathmatch.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_pathmatch.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_pathmatch.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_add_passphrase.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_add_passphrase.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_add_passphrase.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_add_passphrase.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_close_twice.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_close_twice.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_close_twice.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_close_twice.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_close_twice_open_fd.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_close_twice_open_fd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_close_twice_open_fd.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_close_twice_open_fd.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_close_twice_open_filename.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_close_twice_open_filename.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_close_twice_open_filename.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_close_twice_open_filename.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_multiple_data_objects.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_multiple_data_objects.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_multiple_data_objects.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_multiple_data_objects.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_next_header_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_next_header_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_next_header_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_next_header_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_next_header_raw.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_next_header_raw.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_next_header_raw.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_next_header_raw.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_open2.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_open2.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_open2.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_open2.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_filter_option.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_filter_option.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_filter_option.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_filter_option.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_format_option.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_format_option.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_format_option.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_format_option.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_option.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_option.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_option.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_option.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_options.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_options.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_set_options.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_set_options.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_support.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_support.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_read_support.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_read_support.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_set_error.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_set_error.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_set_error.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_set_error.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_string.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_string.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_string.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_string.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_string_conversion.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_string_conversion.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_string_conversion.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_string_conversion.c index fb5359b..7faf58b 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_string_conversion.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_string_conversion.c @@ -847,6 +847,7 @@ test_archive_string_set_get(void) assertEqualInt(0, archive_mstring_update_utf8(a, &mstr, "EEEEE---H")); check_string(a, &mstr, sc, "EEEEE---H", L"EEEEE---H"); + archive_mstring_clean(&mstr); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_string_conversion.txt.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_string_conversion.txt.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_string_conversion.txt.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_string_conversion.txt.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_add_filter_by_name.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_add_filter_by_name.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_add_filter_by_name.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_add_filter_by_name.c index ba8c1d0..49f91ac 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_add_filter_by_name.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_add_filter_by_name.c @@ -142,12 +142,6 @@ canAlways(void) return 1; } -static int -cannot(void) -{ - return 0; -} - DEFINE_TEST(test_archive_write_add_filter_by_name_b64encode) { test_filter_by_name("b64encode", ARCHIVE_FILTER_UU, canAlways); @@ -185,12 +179,12 @@ DEFINE_TEST(test_archive_write_add_filter_by_name_lz4) DEFINE_TEST(test_archive_write_add_filter_by_name_lzip) { - test_filter_by_name("lzip", ARCHIVE_FILTER_LZIP, cannot); + test_filter_by_name("lzip", ARCHIVE_FILTER_LZIP, canLzip); } DEFINE_TEST(test_archive_write_add_filter_by_name_lzma) { - test_filter_by_name("lzma", ARCHIVE_FILTER_LZMA, cannot); + test_filter_by_name("lzma", ARCHIVE_FILTER_LZMA, canLzma); } DEFINE_TEST(test_archive_write_add_filter_by_name_lzop) @@ -205,7 +199,7 @@ DEFINE_TEST(test_archive_write_add_filter_by_name_uuencode) DEFINE_TEST(test_archive_write_add_filter_by_name_xz) { - test_filter_by_name("xz", ARCHIVE_FILTER_XZ, cannot); + test_filter_by_name("xz", ARCHIVE_FILTER_XZ, canXz); } DEFINE_TEST(test_archive_write_add_filter_by_name_zstd) diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_filter_option.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_filter_option.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_filter_option.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_filter_option.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_format_by_name.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_format_by_name.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_format_by_name.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_format_by_name.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_format_filter_by_ext.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_format_filter_by_ext.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_format_filter_by_ext.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_format_filter_by_ext.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_format_option.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_format_option.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_format_option.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_format_option.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_option.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_option.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_option.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_option.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_options.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_options.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_options.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_options.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_passphrase.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_passphrase.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_archive_write_set_passphrase.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_archive_write_set_passphrase.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_bad_fd.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_bad_fd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_bad_fd.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_bad_fd.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_bzip2.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_bzip2.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_bzip2.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_bzip2.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_bzip2_1.tbz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_bzip2_1.tbz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_bzip2_1.tbz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_bzip2_1.tbz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_bzip2_2.tbz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_bzip2_2.tbz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_bzip2_2.tbz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_bzip2_2.tbz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_cpio.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_cpio.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_cpio.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_cpio.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_cpio_1.cpio.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_cpio_1.cpio.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_cpio_1.cpio.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_cpio_1.cpio.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gtar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gtar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gtar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gtar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gtar_1.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gtar_1.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gtar_1.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gtar_1.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gtar_2.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gtar_2.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gtar_2.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gtar_2.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gzip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gzip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gzip_1.tgz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gzip_1.tgz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gzip_1.tgz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gzip_1.tgz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gzip_2.tgz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gzip_2.tgz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_gzip_2.tgz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_gzip_2.tgz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_1.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_1.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_1.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_1.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_2.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_2.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_2.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_2.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_3.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_3.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_3.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_3.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B4.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B4.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B4.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B4.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B4BD.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B4BD.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B4BD.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B4BD.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B4BDBX.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B4BDBX.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B4BDBX.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B4BDBX.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B5.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B5.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B5.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B5.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B6.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B6.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B6.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B6.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B6BD.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B6BD.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B6BD.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B6BD.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B7.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B7.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B7.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B7.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzip_1.tlz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzip_1.tlz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzip_1.tlz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzip_1.tlz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzip_2.tlz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzip_2.tlz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzip_2.tlz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzip_2.tlz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma_1.tlz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma_1.tlz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma_1.tlz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma_1.tlz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma_2.tlz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma_2.tlz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma_2.tlz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma_2.tlz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma_3.tlz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma_3.tlz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzma_3.tlz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzma_3.tlz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop_1.tar.lzo.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop_1.tar.lzo.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop_1.tar.lzo.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop_1.tar.lzo.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop_2.tar.lzo.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop_2.tar.lzo.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop_2.tar.lzo.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop_2.tar.lzo.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop_3.tar.lzo.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop_3.tar.lzo.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_lzop_3.tar.lzo.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_lzop_3.tar.lzo.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_mac-1.tar.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_mac-1.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_mac-1.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_mac-1.tar.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_mac-2.tar.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_mac-2.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_mac-2.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_mac-2.tar.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_mac.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_mac.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_mac.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_mac.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_perl_archive_tar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_perl_archive_tar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_perl_archive_tar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_perl_archive_tar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_perl_archive_tar.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_perl_archive_tar.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_perl_archive_tar.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_perl_archive_tar.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_plexus_archiver_tar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_plexus_archiver_tar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_plexus_archiver_tar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_plexus_archiver_tar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_plexus_archiver_tar.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_plexus_archiver_tar.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_plexus_archiver_tar.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_plexus_archiver_tar.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_pax_sparse.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_pax_sparse.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_pax_sparse.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_pax_sparse.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_tar_acl.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_tar_acl.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_tar_acl.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_tar_acl.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_tar_acl.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_tar_acl.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_solaris_tar_acl.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_solaris_tar_acl.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_star_acl.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_star_acl.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_star_acl.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_star_acl.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_star_acl_nfs4.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_star_acl_nfs4.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_star_acl_nfs4.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_star_acl_nfs4.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_star_acl_posix1e.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_star_acl_posix1e.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_compat_star_acl_posix1e.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_star_acl_posix1e.tar.uu diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_tar_directory.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_tar_directory.c new file mode 100644 index 0000000..5750db3 --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_tar_directory.c @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2021 Samanta Navarro + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Background: Original tar file format did not use its linkflag to + * specify directories. Instead regular files simply have a slash + * appended to their names. No data blocks follow directories in + * archives. This means that a possibly specified file size must not + * be used to determine the amount of data blocks to skip. + */ + +static void +test_compat_tar_directory_1(void) +{ + char name[] = "test_compat_tar_directory_1.tar"; + struct archive_entry *ae; + struct archive *a; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); + + /* Read first entry, which is a directory in a regular file header. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("directory1/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(1, archive_entry_size(ae)); + + /* Read second entry, which is a ustar directory entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("directory2/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(0, archive_entry_size(ae)); + + /* Verify the end-of-archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify that the format detection worked. */ + assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + +DEFINE_TEST(test_compat_tar_directory) +{ + test_compat_tar_directory_1(); +} + + diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_tar_directory_1.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_tar_directory_1.tar.uu new file mode 100644 index 0000000..3e1ead9 --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_compat_tar_directory_1.tar.uu @@ -0,0 +1,50 @@ +$FreeBSD$ +begin 644 test_compat_tar_directory_1.tar +M9&ER96-T;W)Y,2\````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````#`P,#`W,#``,#`P,#`P,``P,#`P,#`P`#`P,#`P,#`P,#`Q +M`#`P,#`P,#`P,#`P`#`P-C4Q-0`@```````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````!D:7)E8W1OYPW_("`@("``_R````````````````````````````!__P`` +M``````!T72`@/EW_(/\@("`@("`@("`@("`@("`@("`@("`@("`@(/\@("`@ +M("`@("#_("`@("`@("`@("`@("`@("`@("`@("`@("#_("`@("`@("`@_R`@ +M("`@("`@("`@("`@("`@("`@("`@("`@_R`@("`@("`@(/\@("`@("`@("`@ +M("`@("`@("`@("`@("`@(/\@("`@("`@("#_("`@("`@("`@("`@("`@("`@ +E("`@("`@("#_("`@("`@("`@_R`@("`@("`@("`@("`@("`@(``` +` +end diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_different_window_size.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_different_window_size.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_different_window_size.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_different_window_size.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_distance_overflow.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_distance_overflow.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_distance_overflow.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_distance_overflow.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_extra_field_version.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_extra_field_version.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_extra_field_version.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_extra_field_version.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_fileattr.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_fileattr.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_fileattr.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_fileattr.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_hardlink.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_hardlink.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_hardlink.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_hardlink.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_invalid_dict_reference.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_invalid_dict_reference.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_invalid_dict_reference.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_invalid_dict_reference.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_leftshift1.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_leftshift1.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_leftshift1.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_leftshift1.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_leftshift2.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_leftshift2.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_leftshift2.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_leftshift2.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part01.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part01.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part01.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part01.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part02.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part02.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part02.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part02.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part03.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part03.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part03.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part03.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part04.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part04.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part04.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part04.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part05.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part05.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part05.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part05.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part06.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part06.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part06.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part06.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part07.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part07.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part07.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part07.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part08.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part08.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive.part08.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive.part08.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part01.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part01.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part01.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part01.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part02.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part02.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part02.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part02.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part03.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part03.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part03.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part03.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part04.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part04.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part04.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiarchive_solid.part04.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiple_files.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiple_files.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiple_files.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiple_files.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiple_files_solid.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiple_files_solid.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_multiple_files_solid.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_multiple_files_solid.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_nonempty_dir_stream.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_nonempty_dir_stream.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_nonempty_dir_stream.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_nonempty_dir_stream.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_owner.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_owner.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_owner.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_owner.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_readtables_overflow.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_readtables_overflow.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_readtables_overflow.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_readtables_overflow.rar.uu diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_sfx.exe.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_sfx.exe.uu new file mode 100644 index 0000000..fdf83af --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_sfx.exe.uu @@ -0,0 +1,7048 @@ +begin 644 - +M35J0``,````$````__\``+@`````````0``````````````````````````` +M````````````````````$`$```X?N@X`M`G-(;@!3,TA5&AIP"0!F<`=7YK! +M,`&9P!U?G<$U`9G`'5^1K`+`&9P"]Y"L`C`9G`)@&8P"L`F<"Q +M7YS!%P&9P+%?F<$G`9G`M%]FP"@.1`#HD[X``&A@(T,`Z"#:`0!9P\S, +MS,S,S,S,S,QH<"-#`.@*V@$`6&I%`.CAW```:(`C0P#HT-D!`%G#S,S,S,S,S,S,S+F" +MVT4`Z,'<``!HD"-#`.BPV0$`6,5$`.A]2@``:+`C0P#H<-D!`%G#S,S,S,S, +MS,S,S%6+[('L6`0``%-65XM]%(VUJ/O__[L``@``A?]T05-7B\90Z!GP``"+ +MQE#H8R<"`%F-M:K[__^--$:-A:C[__^+SBO(B\/1^2O!4%=6Z._O``!6Z#LG +M`@!9C31&@\8"C86H^___B\XKR(O#T?DKP5!HH@```.A"SP``4%;HP.\``%;H +M#"<"`%F-C:C[__^--$:#Q@*+QBO!T?@KV%-HL#5#`%;HF>\``%;HY28"`#/) +M:EAFB4Q&`HU%J%Y645#H/>0!`(M%"(/$$(I=&(M]$(E%K*'0#D0`B46PC86H +M^___B46TBT4,B478C46HB76HB7W$QT7(``@``,=%W`P(`0!0A-MT"/\5/"!& +M`.L&_Q5$($8`B_"%]G4L_Q5`($8`/0(P``!U'3/`9HD'C46H4(3;=`C_%3P@ +M1@#K!O\51"!&`(OPA?9?7@^5P%N+Y5W"%`!5B^R!["P"``"-1?Q0_Q6(($8` +MA@.1``D`0^VP%#_=1C_=0CH/O"$``(B&N"$` +M`(3`="-H\((``.CMT`$`68E%[,9%_`6%P'0)B\CH-9X``.L'B\/K`XM%"(F& +MO"$``(J`H6$``(..P"$``/^#CL0A``#_@X[((0``_VI`B$8BC88((@``4U#' +MAK!L```"````B9ZT;```B9ZX;```B9[`;```B9[0(0``B9[4(0``B)Z\;``` +M9HF>Q&P``(F>V"$``(F>H&P``(F>I&P``(F>J&P``(F>K&P``.@IX0$`:C2- +MAD@B``!34.@:X0$`:B"-AI!%``!34.@+X0$`BTWT@\0DB9[8;```,\")GN!L +M``")GN1L``")GNAL``")GNQL``")GO!L``")GO1L``!FB8;Z;```B\:(GM9L +M``"(GOAL``"(GN`A``!>6V2)#0````"+Y5W"!`!1,\")#"2)@2@0``")@2P0 +M``")@3`0``")@300``"(@3@0``")@4`0``")@400``")@4@0``")@4P0``") +M@5`0``")@500``"+P5G#5E>+\;BT-4,`:@A9B_[SJVH@,_^-1B!74.A%X`$` +MBT0D&(/$#(E^0(E^1(E&2(O&7U["!`!5B^QDH0````!J_VB!'T,`4&2))0`` +M``!6B_&#/@!T&(!^$`!T"O]V"/\VZ.'9``#_-NBE(@(`68M-]&2)#0````!> +MB^5=PU6+[&2A`````&K_:($?0P!09(DE`````%:+\8,^`'0;@'X0`'0-BT8( +M`\!0_S;HE]D``/\VZ%LB`@!9BTWT9(D-`````%Z+Y5W#5HOQ@+ZX(0```,<& +MN#5#`'0@5XN^O"$``(7_=!2+S^CDG```:/""``!7Z,/.`0!965^-COA5``#H +M,O___XV.J#(``.@G____C8[H(```Z"BT``"-CB@0``#H\4D``(O.7NDW@0`` +M@<$H$```Z?[^___,S,S,S,S,S,S,S,Q6B_'H>_____9$)`@!=`UH`'T``%;H +M6\X!`%E9B\9>P@0`BT0D!%:+\0%&!(M.!#M."`^&G0```(M&#%-5O5`/1`!7 +MABK5P``BT8(BUX$P>@"@\`@`T8( +M.]AW`HO8@'X0`%-T.NA1(0(`B_A9A?]U!XO-Z'Q7``"#/@!T./]V"/\V5^C@ +MWP$`@\0,_W8(_S;H5M@``/\VZ!HA`@!9ZQ;_-N@@(0(`B_A9687_=0>+S>@_ +M5P``B3Y?78E>"%M>P@0`BT0D!%:+\0%&!(M.!#M."`^&I@```(M&#%-5O5`/ +M1`!7ACT5@``BT8(BUX$P>@"@\`@ +M`T8(.]AW`HO8@'X0`(T$&U!T0.B7(`(`B_A9A?]U!XO-Z,)6``"#/@!T/HM& +M"`/`4/\V5^@CWP$`BT8(@\0,`\!0_S;HEM<``/\VZ%H@`@!9ZQ;_-NA@(`(` +MB_A9687_=0>+S>A_5@``B3Y?78E>"%M>P@0`BT0D!#M!"'8+*T$$4.@N____ +MZP.)003"!`!6_W0D"(OQZ#+^3/;4XLW.)\D(@``=#V+A\!L``"+3A"#P!13 +M4/\58#)#`(O/_U80B\_H22$``(7`=!6#O]PA``!U=0R+1"00.5@$#Y?`ZSTR +MP.LYZ)L'``"+3A!24/\58#)#`(O/_U80:#`V0P"+S^AW)0``ABL-;7<($`+B3'T,`Z(3+`0"#["Q3B]E65VH'BP.-N_@A``!7 +MQH.\;````,:#Q&P```"+<`R+SO\58#)#`(O+_]:#^`=T!S+`Z9L#``!J!S/V +M5XFSP&P``.BL`P``AB) +M@[!L``"#^`%U-H7V?C*#^1Q]+8-][!]^)XM%R"O!@'@<4G42@'@=4W4,@'@> +M1G4&@'@?6'0*BT7L1COP?*?K0HL#`\YJ`&H`B8O`;```BW`048O._Q5@,D,` +MB\O_UHN#L&P``(/X`G0%@_@#=12+`VH'5XMP#(O._Q5@,D,`B\O_UH.[P&P` +M``"-3``"%P`^5P(A%\CP!=,6*1?.*B\5L``"$R70* +M@'T(``^$S_W__X"[Q&P```!U!(3`=1F$R74+C4,D4&H;Z.]0``"`?0@`#X2I +M_?__@'WR`(J#)"(``(B#MFP```^$#`$``("[X"$```!T#8"[O&P````/A?8` +M``"+`XMP%(O._Q5@,D,`B\O_UHOPB_J+@Z!L``")1>B+@Z1L``")1>R+@ZAL +M``")1>2+@ZQL``")1>"+@]PA``")1=SK1+`!Z4____^+@]PA``"#^`-U(8"[ +MM6P```!T#H"[:%8```!U!3/`0.L",\"(@[EL``#K"H/X`G09@_@%=#.+R^CJ +M`0``B\OH&AT``(7`=;CK'X"[M6P```!T#H"[&#,```!U!3/`0.L",\"(@[EL +M``"+1>B)@Z!L``"+1>R)@Z1L``"+1>2)@ZAL``"+1>")@ZQL``"+1=R)@]PA +M``"+`VH`5U:+6V2)#0````"+Y5W"!`#,S,S,S,R# +M>03_#Y7`PS/)@WPD"`%R2HM$)`2`.%)U08-\)`@'`%A=32`>`)R=2Z` +M>`,A=2B`>`0:=2*`>`4'=1R*0`:$P'4$:@+K$#P!=01J`^L(=@<\!7,#:@19 +MB\'""`"XI1]#`.@JQP$`@^P84S/;B\&)1?")7=R)7>")7>2)7>B(7>Q34XU- +MW(E=_%&+R.AN'```A,`/A(,```!65XM]X(U-W&H!Z(?X__^+3>"+1=R+=0B( +M7`'_C4L;```_[>H;```BW`0B\[_%6`R0P"+S__67U[#N+BI30``BP>+<`B+SO\58#)#`(O/_]8RP%[K`K`! +M7\($`.D)]O__BT0D!#M!"'8+*T$$4.@G]___ZP.)003"!`!6B_&-1B10:AKH +M8$T``&H#N5`/1`#&AL1L```!Z,9/``!>PX.Y?#,```!T&#/`.(%Q,P``#Y3` +M2(/@\(/`((F!I"(``,-6BW0D"%>+^8N6_!```(/Z`G45,\`XAO$0```/E,!( +M@^#P@\`@B48D@_H!=0YH``@``(U&*%#HW)4``(U&*#/V9CDP=$-3:EQ::E]; +M9CD0=0R#O[!L```#=0-FB1AF@S@Z=0-FB1@/MPB#^2]T#F8[RG4,@[^P;``` +M`W0#9HD0@\`"9CDP=<5;7U["!`!6B_%7B[[`;````[X`(@``@[ZP;````G4( +MBX84(@``ZQ'_MA0B``#H<_C__P.&5"(``#/2`\=?$])>PXJ!<3,``,.XL"`` +M`.@_Q0$`5XN\)+@@``")3"0,BU<8B\(KA"2\(```.T<<#X)1!@``*]")1QR# +M^@(/@D,&``!3BYPDQ"```%56B\_HLZ<``(O(A=(/C"4&``!_"(7)#X0;!@`` +MBT<8BW<<*\8/A`T&``"%T@^/!08``'P(.\@/A_L%``"-+`Z+SXEL)"CH<:<` +M`"MO'(OPB\(SR8E$)"2)3"0@#XS6!0``?PB%[0^"S`4``(-[!`$/A8(```"# +M_@%U?87`=7F+S\9#'@'H,J<``(E$)!RH`70OB\_H(Z<``(O("\IT'HM,)!B+ +MB:!L```#R(M$)!B+@*1L```3PHE+((E#)(M$)!RH`G0KB\_H\*8``(O("\IT +M'HM,)!B+B:!L```#R(M$)!B+@*1L```3PHE+,(E#-(M,)""+1"0D@WL$`G0* +M@WL$`P^%&P4``(7`#X<3!0``<@F#_@D#@.$!B(L' +M(0``QH,((@```,9%``"H`70EB\_H\:4``(OPN/\````[\'("B_!658O/Z#VE +M``"+1"0+S^C(I0``B_"X_P```#OP<@*+\%:-JP@B``"+SU7H +M#J4``,8$+@"`NP8A````=`V+S^B8I0``B8,((P``@+L'(0```'0-B\_H@J4` +M`(F##",``,:#!2$```'IUP,``(O/Z&FE``"+SXF#`!$``.AA7HP``:@!0C8M`$```Z/+K``#K +M$NB$HP``4E"-BT`0``#H'>P``(I,)!.*1"04@.$$B$PD%G0MB\^$P'05Z!FC +M``!J`%"-BT@0``#HM.L``.L2Z$:C``!24(V+2!```.C?ZP``BD0D$XK(@.$( +MB$PD%W0T@'PD%`"+SW05Z-JB``!J`%"-BU`0``#H=>L``.L2Z`>C``!24(V+ +M4!```.B@ZP``BD0D$X!\)!0`#X00`@``J!`/A`@"``"`?"05`'0GB\_HDZ(` +M`+W___\_O@#*FCLCQ3O&#G!`` +M``4```#&@YL0```!BTPD*(E/'(M'&"O!@_@"#X/*^?__7EU;7X'$L"```,(, +M`%6#[%RXR1]#`.C9O0$`N"0@``#HJ[X!`%-6B]F-32174XE=(.C3GP``,\EJ +M!XE-'(E-_%\XB[QL``!T<(N3P&P``#/``]<3P3F#I&P``'QB3%0``BP.-311J"%&+<`R+SO\58#)#`(O+_]:#^`AU/3/)C444 +M45%145"+@[PA``"-LR@0```%)%```%!J!%&+SNBU.0``B75$ZP.(35]7C4TD +MZ$^A``"#?3P`=0R+R^C'%@``Z;()``"-323H<)\```^WP(U-)(F#Y"$``,:# +M]"$```#H0)\``(U-)`^V\.A-GP``#[?`C4TDB8/L(0``P>@.)`&(@_0A``#H +M,9\```^WR(F+\"$``(FSZ"$``#O/#Z"$```4```#K(L>#Z"$```,```#K%L>#Z"$```(```#K +M"L>#Z"$```$```"+@^@A``")@]PA``"#^'5U!&H&ZQ*#^`%U"?:#["$```)U +M[HU!^5"-323H9J```/^S\"$``(O+Z"GP__^+BZ!L```#R(N#I&P``(F+J&P` +M`(N+Z"$``(/0`(F#K&P``(E-4(/Y`0^$'0<```^.[08``(/Y`P^.C````(/Y +M!0^%VP8``(V[D$4``(VSY"$``/.EBH.810``BY.810``)`&(@ZQ%``"+RHO" +MT>G!Z`*`X0'!Z@,D`8#B`8B+K44``(B#KD4``(B3KT4``(3)=`Z-323H+IX` +M`(F#I$4``("[KT4````/A&`'``"-323HWIT```^WP(F#J$4``(F#V&P``.E$ +M!P``,\"#^0)J``^5P(UX_X'GL-S__X''T$4```/[B\^)?4CH&(0``&H%68VS +MY"$``#/2\Z6+=4A"BWU0BD8(BTX((L*(AI@0``"+P='H(L*(AID0``"+P<'H +M`B+"B(:;$```B\'!Z`HBPHB&H!```(/_`G4+]L$0=`:+PC/2ZP0STHO"B(;P +M$```@_\"=`KVP1!T!3/`0.L"B\*(AOH0``"XX````"/(.\@/E,"(AO$0``"! +M^>````!U!XO"BU8(ZQ*+5@BX```!`(O*P>D%@^$'T^")AO00``"-322+PL'J +M"\'H`X#B`20!B);S$```B(;R$```Z`>=``"-322)1A3H_)P``(U-)(E%5.BD +MG```C4TDB$88QX9P$````@```.C& +M`!$```$```!FB88$$0``@_\"=`HY3B1]!3/`0.L"B\&(AO@0``"+1@C!Z`@D +M`8B&^1```'0LC4TDZ*B;``"-322+^.B>FP``@WU4_XO0=0R#^O]U!S/`0#/) +MZQ$SR8O!ZPN#?53_B]&+^0^4P(B&FA```#/``T84B898$```$_DSP`-%5(F^ +M7!```!/1B89@$```@+Z:$````(F69!```'01N/___W^)AF`0``")AF00``"+ +M14R__Q\``(E]5#O'-A=#?__]0C4TDZ'&;```SP(-]4`*(A#W0 +MW___=78SR8U^*&:)#_=&"``"``!T/XU-`.@O/@``C870W___4.CW"P(`BU54 +M0%D[T'8@:``(``!7B\HKR%&-C=#?__\#P5"+P8U-`%)0Z`L^```SP&8Y!W44 +M:@%H``@``%>-A=#?__]0Z-#0``!6B\OHP_+__^E6`0``C48H:``(``!0B450 +MC870W___4.@@Z0``BWX,*WU,@^\@]T8(``0``'0#@^\(A?\/C@8!``"-AB@0 +M``!7B\B)15CH&?+__U?_MB@0``"-323HEYH``&@X-D,`C7XH5^C\"@(`65F% +MP`^%T0```(.^+!```!0/@L0```"+15B+.`^V1PN9B\B+\@^V1PH/I,X(F<'A +M"`/(#[9'"1/RF0^DS@C!X0@#R`^V1P@3\ID/I,X(P>$(`\B+P1/RB\X/I,$) +MP>`)B8/`(0``BP.)B\0A``"+B#XP-V+VH#6"O#P>`#B448B_"-323H%Y@``(O. +M#[;`T^"#Q@B+3>@+R(E-Z(/K`77ABW5,:\%DBTRU!(E%Z(U%T%#HX=\``(M% +M6$:)=4R#_@0/C%W___^+72"+=4@SP%!0_[9<$```_[98$```_[.L;```_[.H +M;```Z!$.``")@ZAL``"-322)DZQL``"*AO(0``"(12#_=2#HD9@```^WP#D& +M#X0:`0``:@&Y4`]$`,:#Q&P```'HF#\``(!]7P`/A?T```!7C4,D4&H#["$```"````/A-\```"-323HCY<```&#J&P``(.3K&P```#I +MQ0```(V[""(``(O/Z$A^``!J!5F-L^0A``#SI8U-).@HEP``C4TD9HF#'"(` +M`.A.EP``BHL0(@``B]"`X0&)DR`B``"(B[5L``"+BQ`B``#!Z0.`X0&(B[1L +M``"+BQ`B``"+P<'H`B0!B(.W;```B\'!Z`8D`8B#NVP``(O!P>@')`&(@[QL +M``"%TG4+,\!F.8,<(@``=`,SP$"(@[AL``"+P='H)`&(@R0B``"+P<'H""0! +MP>D$@.$!B(.Y;```B(NZ;```:@=?:@"-323H7Y<```^WP#F#Y"$```^$G@`` +M`(N#Z"$``(/X>0^$CP```(/X=@^$A@```(/X!753@+NN10```'1*BP.+`8O+Z%UI +M``#VV!K`]M`B15Z(15Z#[P%UZ(3`=2YJ`[E0#T0`QH/$;````>CR/0``@'U? +M`'05C4,D4%!J!.B8.P``QH/%;````>L&BT4\B44@")`$Y +M-XB#]"$``(M%9(F#\"$``(N#Z"$``(F#W"$```^5P(A%:X3`=#B+R^AEZ___ +M:@.Y4`]$`,:#Q&P```'H.3L``(!]:@!T&(U#)%!0:@3HWS@``,:#Q6P```'I +M=04``#/`]H/L(0```8E%6(E%5'0HC4TPZ"R4``"+R(E55#/`B4U8.]!R$@^' +M004``#N+\"$```^#-04``/:#["$```*+\(EU9(E%7'00C4TPZ/.3``"+\(E% +M9(E57/^S\"$``(O+Z#[D__^+BZ!L``!J`%I24O]U7`/(BX.D;```5A/"4%'H +MSP@``(F#J&P``#/`B9.L;```0(N3Z"$``#O0#X0%!```#XZ\!```@_H##XXZ +M`0``@_H$=#V#^@4/A:4$``!268V[D$4``(VSY"$``/.EC4TPZ&R3```D`8B# +MK$4``#/`9HF#KD4``(B#K44``.EQ!```:@59C;M((@``C;/D(0``\Z6-33#H +M-Y,``(7`="A0:$`V0P"-10!J%%#HS0D``(/$$(U%`(O+4(U#)%#H9@D``.D[ +M!```C4TPZ`.3```D`8U-,(B#7"(``.BFD0``#[;`B8-@(@``@_@8=@A0:$@V +M0P#KL&H0C8-D(@``4(U-,.@ND@``@+M<(@```'1?:@B-LW0B``!6C4TPZ!22 +M``!J!(U%9%"-33#H!I(``(U%C%#H6<4``&H(5HU%C%#HD\4``(U%"%"-18Q0 +MZ$_$``!J!(U%"%"-1610Z"G*`0"#Q`SWV!K`_L"(@UPB``#&@[QL```!Z7D# +M```SP(/Z`FH`#Y7`C7C_@>>PW/__@& +MD'@.$' +MB$X@B\B#X3^#P3*)3AR#^3)T!\=&'`\G``"-33#H_9```(U-,(A&&.CRD``` +MBXOL(0``,]+!Z09"B_C'AOP0```"````BD88(LJ(CO@0```ZPG4(B9;\$``` +MZPN$P'4'@Z;\$````(M."(O!P>@#(L*(AI@0``"+P<'I!<'H!"+*(L*(COH0 +M``"#?6`"BTUDB(:9$```=0GVP4!T!(O"ZP(SP(B&\!```(J&E!```"+"P>D* +MB(;Q$```@^$/#[;`N@```@#3XO?8&\#WT"/"B8;T$```#[:&FQ```/?8&\"# +MX`6)AIP0``"X_Q\``#OX<@*+^%>-A8S?__]0C4TPZ'V/``#&A#V,W___`(V% +MC-___V@`"```C7XH5U#H8MX``(M-6(O!"T54=`U648U%,(O+4.CJY___BT5@ +M@_@"=1!6B\OH"^?__XM%8(/X`G08:#`V0P!7Z)G_`0!9687`=0?&@[9L```! +M@'UK``^$S@```%>-0R10:ASH+S0``.F]````C8L((@``Z&EU``!J!8OWC;L( +M(@``6?.EC4TPZ'R/``"+T#/`0(K*(LB(B[5L``"+RL'I`B+(B(NT;```B\K! +MZ00BR(O"B(NW;```,\G!Z`-!(L&(B[IL``"(@[ML```SP(B#N&P``/;"`G05 +MC4TPZ"B/``")@]AL```SR3/`0>L&B8/8;```@+NU;````'0(.8/8;```=`*+ +MR(B+N6P``(M-6(O!"T54=!.-@P@B``!048U%,(O+4.CBYO__BT5(B45@ZP>+ +MR^B_Y?__C4TPZ*;;__^+3?2+16!?7EMDB0T`````C65L7<-7B_F`O\5L```` +M=`0SP%_#BP=6BW`4B\[_%6`R0P"+S__6B8>@;```,\F+A[!L``!(B9>D;``` +M7H/H`70.@^@!=4&+S^B,]___ZP>+S^CJ[/__B\B%R70KBX>L;```.X>D;``` +M?QE\#HN'J&P``#N'H&P``'<)B\_H)>7__S/)A'W"$``/\```"+P5_# +MN/`?0P#HB*H!`+C@Y@``Z%JK`0!6B_&`OL1L````=!R-1B10:AWH5#(``&H# +MN5`/1`#HP30``.E4`@``@+[P10``!0^'/`(``#/`@[ZP;````P^5P$B#X!6# +MP!TYANQ%```/AQT"``"+ABA6```+ABQ6``!U#SB&:58``'4'L`'I#0(``%.- +MGN@@``!7B\OHU(\``%.-C109___H,.```#/;C8T4&?__4_^VQ%8``(E=_.@E +M\P``BWT(.5T,=5,YGC16``!\'G\,@;XP5@```````780C48D4&H>Z)\Q``#I +MCP$``(7_=0G&AA$A```!ZR#_MC!6``"+S^CXX____[8P5@``C8[H(```_S?H +M)I```#B>:U8``'1:BY:\(0``.)HD40``#X1(`0``#[:.<%8``(V&DE8``%"- +MAIM6``#WV5#_MKQ6``"-AH%6```;R5"-AG%6```CR(V")%```%%0_[9L5@`` +MC8[H(```4^A?CP``:@'_MD!6``"-CJ`A``#H+W```(N&*%8``(V.Z"```/]U +M#(F&""$``(N&+%8``%:)A@PA``"(GA`A``#H9X\``(I%$(V.Z"```(B&$2$` +M`(J&:58``(B&-R$``(V&T$4``(E!.(E9/(N&,%8``(N6-%8``(F%7&7__XF5 +M8&7__XB==&7__SB>\$4``'4*4E!1Z*Q7``#K$E/_MNQ%``"-C109___H;NX` +M``^VEII6``"-AIM6``#WVHV.H"$``!O2(]"-AD!6``!24.A!;P``A,!U*XV& +M^$4``%"-1B10:A_H5S```&H#N5`/1`#HDS(``(7_=`N+S^BF````ZP*S`8V- +M%!G__^BNX```7XK#6^L-C48D4&H>Z.\O```RP(M-]%YDB0T`````B^5=P@P` +M58OL@^Q,5XOYBX>\(0``@+@D40```'56!210``!0C4,```7HN'O"$``,:`)U$```%?B^5=PU:+\8,^`'0+_S;HM_H!`(,F`%F# +M9@0`@V8(`%[#58OLBU4,4X72?#>+30A_!(7)+\3/;Z.#[__^+^(7_=#F+;"04@_T%=`F#OMPA```%="=#]L-_=07HX\H` +M`#FNW"$``'0=B\[H=^#__XO.Z*?[__^+^(7_=75O"!`"+Q^OU4U97 +MB_$SV^L\@[[<(0``!70^0_;#?W4%Z)W*``"#OMPA```#=1;_="00C8;X10`` +M4.CF^0$`65F%P'06\($`(O'Z_96 +MB_'HA%L``#F&H&P``'48.9:D;```=1`YAJAL``!U"#F6K&P``'07C48D4&HX +MZ!4N``!J`;E0#T0`Z((P``!>P_]T)`B-023_="0(4&HBZ.H]``!J`;E0#T0` +MZ&$P``#""`"X@.Y#`,-5B^S_=1C_=13_=1#_=0S_=0CHX_____]P!/\PZ,$: +M`@"#Q!R%P'D#@\C_7<.-1"004&H`_W0D%/]T)!3_="04Z+O___^#Q!3#S,S, +MS,R+3"0$Z`,```#"!`!358O9O0`"``!65XMS"(M[!.LF@SW0@40``7P/@?X` +M!```<@`2!]G]2#E&+@OP```"!]XQH!9N+7"1DB4PD +M*+F%KF>[B4PD,(L0BT`$@?*KV8,?BTPD7#49S>!;B40D1#/MBT0D:(E$)#R+ +M1"1@B40D'(M$)%B)1"0LBT0D5(E$)#B+1"10B40D((M$)$R);"00B6PD2(ML +M)$2)1"04BT0D$,=$)"0Z]4^EB5PD0(E,)#0/MH"`-D,`BX2$C`````/!BTPD +M%`/(BT0D*(E,)!0SSHMT)#3!P1`#P3/PB40D*(M$)!#!S@R)="0T#[:`@39# +M`(N$A(P````#QHMT)!0#\(M$)#2)="04,_&+3"0HP) +M1"0TBT0D$(M,)"`/MH""-D,`BX2$C`````-$)!P#R(M$)#")3"0@,\^+?"0< +MP<$0`\$S^(E$)#"+1"00P<\,B7PD'`^V@(,V0P"+A(2,`````\>+?"0@`_B+ +M1"0);"0\BVPD$`^VA8@V0P"+A(2,`````T0D'`/(BT0D +M&(E,)!0SRHM4)!S!P1`#P3/0B40D&`^VA8DV0P"+;"04P+@?0```")1"0\#R@@#RAH$(N! +M^`````\I;"1`#RED)'`/*!B+10QF#^\=H.Y#`(M(&(M0$(MP"(LX9@]NT68/ +M;L)F#V[.9@]BRF8/;O=F#V+P9@]B\68/_O2)="0DBW`49@_^]68/[]Z)?"0L +MBW@,#RC[9@]R\Q!F#W+7$(E,)!R+2`1F#^_[#RCOB50D(&8/_BV0[D,`BU`< +M#RC%9@_O1"1`#RC@9@]NSV8/"QF#^_? +MBT`D#RC#9@]RT!!F#W+S$(E\)`QF#^_#BWPD.&8/;DPD#`\H\`\I1"109@_^ +M]`\HQF8/;MAF#^_%9@]NUP\HX&8/8LIF#W+0#&8/#O@`!``!`=D6+AO@` +M``"#`$"+CO@```"#.4`;P/?8`4$$_[;P````5N@HZ?__BX[P````@X8``0`` +MP/^V``$``(U!0%!1Z%V@`0"#Q`R+AO@```"+E@`!```!$(N.^````#D1&\#W +MV`%!!("^!`$```!T"HN&_````(-(!/^+AOP````S_X,(_[B`````BXX``0`` +M*\%0BX;P`````\%74.BBG@$`@\0,_[;P````5NBAZ/__BTPD$(N&]````(L$ +M!XD$#X/'!(/_('SL7U[""`"#/="!1``"?!P/*`50-T,`#RD%D.Y#``\H!4`W +M0P`/*06@[D,`5HMT)`B+SNB)`P``,]*+CO0```"+@B`W0P")!`J#P@2#^B!\ +MZ8N&]````($P(``(`HN.]````(M$)`PQ00B+CO0```"+1"00#0`@``#!X!`Q +M00Q>P@P`45>+?"04A?\/A+(```!358ML)!A6BW0D&(N.``$``+N`````BX;P +M````*]D#P8E\)!`[^W9F4U50Z!R?`0"+AO@```"#Q`P!G@`!``"#`$"+CO@` +M``"#.4`;P/?8`4$$@SW0@40``O^V\````%9\!^AH[/__ZP7HC.?__XN.\``` +M`&I`C4%`4%'HS)X!`(.&``$``,"#Q`PK^^L75U50Z+:>`0`!O@`!``"#Q`R+ +M7"00,_\#ZX7_#X5<____7EU;7UG"#`"![``!``!35597B[PD%`$``(UL)!`S +M]HO?BX=("P``.\9V&BO&@_A`=@-J0%A0C8=("0```\904^C^_O__55/HH_W_ +M_X/&0(/%(('#"`$``('^``(``'+!:@B!QT`(``"-="046VH@5E?HS?[__X/& +M((/K`77O_[0D&`$``%?H9/W__U]>75N!Q``!``#""`!355:+="00,^U7:``" +M``!5C89("0``4.B)G`$`@\0,B:Y("P``C89`"```:@%54.C[_?__B_V+WE57 +M4^CO_?__1X'#"`$``(/_"'+L7\:&1`D```'&ACP(```!7EU;P@0`@^QX4XN< +M)(0```!5BZPDA````%:^``(``%>+A4@+```K\(N\))0```")1"0:D!75>CM_?__@\=` +M@<4(`0``@^X!=>F+O"24`````UPD("M\)"`A="0FG0 +M"`$``(O(P>$&`]4#RXE4)"2-7"0HB4PD((/X"'-6B7L(B4L$B1.#_@%V$XN- +M3`L``%-HL#]``.@JL```ZP>+R^@1Y?__BT0D&(/##(M,)"!`BU0D)(/!0('" +M"`$``(E$)!C_1"00B4PD((E4)"0Y="00@DL@`` +MBT0D&(/X"`^"8?___XOW@>;_`0``*_X#WXM\)!R%]G035HV'2`D```/%4U#H +M,IP!`(/$#(T$-U]>B85("P``75N#Q'C"#`!6:/````"+\6H`5NBLF@$`@Z8` +M`0```(/$#,:&!`$```!>P[A(($,`Z/.)`0!15HOQB77PZ`!7``"#9?P`C8X< +MHP``Z.JE``"-CGRC``#&1?P!Z-NE``"-CMRC``#&1?P"Z,RE``"-CCRD``#& +M1?P#Z+VE``"-CIRD``#&1?P$Z*ZE``"+SL9%_`7HB0$``(M-](O&7F2)#0`` +M``"+Y5W#Z3"Z__^!P3RD``#II*4``+@$(```Z$**`0!35597:@!J`/^T)"@@ +M``#HT5@``(N,)!@@``"+V.A!I@``O0`(``#IH@```(U$)!!0Z$EB``"+\`^W +M#E'HSEX``("\)!P@````=`N$P'0;,\!FB0;K%(3`=!!5:+`U0P"-1"084.BQ +MI```:@!J`(U$)!B+^U#H:U@``(OP9H,^*G4Z#[=.`E'H@UX``(3`="QJ+EAJ +M7&:)A"04$```6%5FB80D%A```(V$)!@0``!34.B.I```C;PD$!```/^T)"@@ +M``!75NB=4@``A,!U)XN,)!@@``"-1"0055#H1J4``(3`#X5$____7UY=6X'$ +M!"```,(4`+`!Z^]5B^Q6:@;_=1"+\?]U"/]U#(V&?*,``%#HX/[__X3`=`2P +M`>LP@'T4`'0H@[[THP```'0?:@;_=1"-AMRC``#_=0C_=0Q0Z++^___VV!K` +M_L#K`C+`7EW"$`"!P3RD``#IR*0``%:+\>@Q5@``,\"-CARC``!FB8;Z@@`` +M9HF&&I,``&:)AO""``")AO2"``"(AOB"``#HN:0``(V.?*,``.BNI```C8[< +MHP``Z*.D``"-CIRD``#HF*0``(V./*0``.B-I```C8YP80``7ND>X/__45%3 +M55:+="0H5XOYA?9T#(-\)#``=@4SP&:)!HM,)!PSVT-3:@"*@?$0``"-:2B( +M1"08B\__="08B6PD(%7HZO[__X3`=32!QQRC``"+SXE\)!#H/Z0``(O/ZQ3_ +M="0D55?H-%$``(3`=1N+3"000^B5HP``B_B%_W7A,\!?7EU;65G"&`"+;"0@ +MA>UT$_]T)!17Z+*B``#WV!K`_L"(10"%]G0+_W0D,%=6Z,>B``"+P^O)4U56 +M5VBP[D,`B]GH)`$``+JP\D,`O@`!``"+B@#\__^+^FH'70^VP<'I"#,,A;#N +M0P")#XV_``0``(/M`77F@\($@^X!==-?7EV+PUO#58OLBU4,4XM="%:+=1"% +M]G0@]L('=!L/M@H/ML,SR,'K"#,"#_@@/@H<```!7 +MB_[![P,S&H/N"(M2!(O*P>D8B\+!Z!`/ML"+#(VP[D,`,PR%L/)#`(O"P>@( +M#[;`,PR%L/9#`(O#P>@8,PR%L/Y#`(O#P>@0#[;`,PR%L`)$`(O#P>@(#[;` +M,PR%L`9$``^VPHM5#(/""(E5##,,A;#Z0P`/ML,S#(6P"D0`B]F#[P%U@%^% +M]G08#[8*#[;#,\C!ZP@S'(VP[D,`0H/N`77H7HO#6UW"#`"+5"0$,\DY2@1U +M)U9J"(O!7J@!=`G1Z#4@@[CMZP+1Z(/N`77LB02*08'Y``$``'+;7L($`+B" +M($,`Z'.%`0!14U97:!!A0`!HD&!``&H$B_EH+`$``%>)??#H7(8!`&@084`` +M:)!@0`!J!&AX`0``C;>T!```,]M6B5W\Z#J&`0"-CYP*``#&1?P!Z/R```!H +ML`0``%-7B9^8"@``Z*R5`0!HX`4``%-6Z*"5`0!H``0``(V'I`L``(F?L`0` +M`%-0B9^4"@``Z(*5`0"+3?2#Q"2+QV2)#0````!?7EN+Y5W#S,S,S,S,S,S, +MS,S,45:+\8ET)`3HOHP``(O&7EG#58OL9*$`````:O]H@1]#`%!DB24````` +M5E>+^6BP!```5^@*CP``:.`%``"-M[0$``!6Z/F.``!H$&%``&H$:'@!``!6 +MZ-J%`0!H$&%``&H$:"P!``!7Z,B%`0"+3?1?9(D-`````%Z+Y5W#S,SI>HP` +M`(/L)%-55HMT)#0SVVH@78,^`G5#BT8$5U-34U.)1"0@C40D)%!J!(U$)"A0 +M5?]T)%SHI`8``(E>!(O3B_L/MD04%(O*@^$#P>$#T^`S^$([U7+JB7X$7X,^ +M`W4G4U-34XU$)""#Q@105595_W0D6.AF!@``58U$)!105NB[E0$`@\0,7EU; +M@\0DP@@`BX&8"@``@\#\@_@!=Q?_="0$@<&<"@``_W0D#/]T)`SHM8,``,(( +M`('L@`$``%-65XN\))@!``"+V8"_``$````/A+L```"+M"24`0``A?8/A*P` +M``!5O8````")LY@*``!5C40D%(O/4.@%C```58V$)!0!``!0C40D&%#HB[8` +M`(/N!'0^@^X!=53_M"2P`0``C40D%(O+_[0DL`$``/^T)+`!``#_M"2P`0`` +M_[0DL`$``%!7_[0DL`$``.@T`P``ZQO_M"2@`0``C40D%(O+4%?_M"2@`0`` +MZ#````!5C80D%`$``%#H1(T``&@``0``C40D%%#H-8T``+`!7>L",L!?7EN! +MQ(`!``#"(`"![!@"``!358O95E>)7"04,_^-LRH!``#_M"0P`@``C8[6_O__ +MZ+F*``"$P'0Q@[PD.`(```!U!8`^`.L<@#X`=!UJ"/^T)#P"``"-1MA0Z)6= +M`0"#Q`R%P`^$/0(``$>!QBP!``"#_P1RK6@(`0``C80D)`$``%#_M"0\`@`` +MZ+&U``#_M"0T`@``Z$+5`0"+Z`/M@[PD/`(```!9=!YJ"/^T)#P"``"-C"0H +M`0```\U1Z.B3`0"#Q`R#Q0B-1"1@4.BBE0``,]M5C80D)`$``%"-1"1H4.A= +ME@``B\.(7"00P>@(B$0D$8O#P>@0B$0D$HU$)!!J`U"-1"1H4.B7E0``]\/_ +M/P``=2]J&%F-1"0X4(V$),0```"-="1DC;PDQ````/.E4.AVE```BD0D2(O+ +MP>D.B$0,*$.!^P``!`!RAHU$)$Q0C40D9%#H490``(M<)!0STFH078UT)!@# +M\C/)BT043-/H@\$(B`9&@_D@+_3F>-`$``'4R_[0D?`(``(O. +MZ+R'``"$P'0@:A#_M"2(`@``C88"`0``4.BIF@$`@\0,A<`/A*(!``!'@<9X +M`0``@_\$-1"0D4(VS$@$``%;H?9`!`%>-1"104(V#.`$``%#H +M:Y`!`%>-1"1\4(V#6`$``%#H69`!`(/$,%5J`5=6Z,F'```YK"20`@``=!57 +MC40D6%#_M"28`@``Z#&0`0"#Q`R+M"24`@``A?9T*&H(55;HNHX!`(/$#(I$ +M+#2+S8/A!S`$,44[[W+O5XU$)#A0Z'Z(``"#O"2(`@```'0G_[0DB`(``(M, +M)!2-1"08:``!``!0_[0DA`(``('!G`H``.C$?```5XU$)!A0Z$*(``!?7EU; +M@<1D`@``PB``:B!?5XV&$@$``%"-1"0<4.B=CP$`@\0,C40D%%555U#H"H<` +M`%>-AC@!``!0C40D/%#H>X\!`%>-AE@!``!0C40D:%#H:8\!`(/$&.D5____ +M@>R\`0``4XN<),@!``!55E=J0%\[WW8]C80D9`$``%#HCI,``%/_M"34`0`` +MC80D;`$``%#HOY,``(U$)%10C80D:`$``%#H=I(``&H@C40D6%OK!XN$)-`! +M``"+K"3D`0``B40D$(7M=!R+E"3H`0``@#H`=!!J&EF+]8V\))0```#SI>MA +M,]*%VW0:B_"-1"04*_"-3"04`\J*!`XT-D*(`3O3-3"04*\,# +MRU!J-E'H0XT!`(/$#(V$))0```!0Z.62``!7C40D&%"-A"2<````4.@8DP`` +MBY0DZ`$``(7M=!:`.@!U$6H:68VT))0```"+_?.EQ@(!_[0DW`$``(V$))@` +M``#_M"3<`0``4.CMFA=MT'HM4)!"-1"04*]`S]HU, +M)!0#SHH$"C1<1H@!._-R[H/[0',7:D!8*\.-3"044`/+:EQ1Z'",`0"#Q`R- +MA"3\````4.@2D@``:D"-1"084(V$)`0!``!0Z$22``"+A"3P`0``A>UT%H`X +M`'41:AI9C;0D_````(O]\Z7&``%J((U$)'A0C80D!`$``%#H#Y(``/^T).`! +M``"-A"0``0``4.C$D```7UY=6X'$O`$``,(D`%6-;"2H@>R0`0``4U:+=6Q7 +M:D!8._!S`HO&4/]U:(U%N%#H+XT!`(/$#,=$-;@````!,\!04%!0C44<4(U& +M!%"-1;A0_W5D_W5@Z*;]__]J(%M3C44<4(U%_%#H]HP!`(M%?(/$#$C&158` +MB45(,_;&15<`:A!8B45,B450BT5PB44\BT5TB45`BT5XB45$BWPU2(7_=$^- +M15=0C84P____4(U%5E"-A0@`=1L[]0^#W@```(H$'D9"B$$$B50D%,=!"`@` +M```/MD$$P>@&@^@`#X1B`0``@^@!#X0L`0``@^@!#X3S````@^@!#X6(```` +M._4/@X`````/MAP>1D*)5"04A-L/B:$````[]7-JBT0D*(/C?XH,!D9"B$PD +M$XE4)!2#PP*+1"0T._@/@R8!```[?"0D#X,<`0``BT0D(&8/OA0'#[;!#[9, +M)!)F`]"X_P```&8CT$`/K\B+1"0P9@/1BDPD$TMFB11X1X7;?[6+5"04BTPD +M&(M$)#3`800"@T$(_HM<)"@[]0^"#/___SOX<@.->/^+1"0P,\EFB0QX7UY= +M6X/$#,(8`(/#`HM$)#0[^'/&.WPD)'/`BT0D($N+;"0P9@^^!`=FB41]`$>+ +M;"0LA=M_UNN>.]5SF@^V3!X!N``!```/K\@/M@0>@\8"9@/(BT0D,&:)#'A' +M@\("B50D%.EJ____._4/@V;___\/MDPD$K@``0``#[84'@^OR(M$)#!F`]%F +MB11X1XM4)!1&0NO*._4/@SG___\/M@0>BUPD,&:)!'M'1D*)5"04Z2'___^+ +M5"04BTPD&.D8____58OL@^Q,_W4(C4VTZ#NH__^+3?2#^0AS"HM%#(E$C;3_ +M1?2-3;3HFZ,``(OE7<((`%6+[(/L3/]U"(U-M.@*J/__BTWT@_D(L",L!>P@@`5HOQ@'X,`'42_W0D"&H* +MZ";___^+SNC@`0``:@*+SNB/`0``7L($`%;_="0,B_'_="0,:@GH,?___XO. +MZ+H!``!J"8O.Z&D!``!>P@@`_W0D!&H`Z,_____"!`#I&P(``%6+[('L``@` +M`(U%$%!J`/]U#(V%`/C__V@`!```4.C7T/__@\04C84`^/__4&H!Z*7^__^+ +M30CH7@$``(OE7PU6+[(/L3%:+ +M\8U-M&H'Z(NF__^-3;3H_:$``&H(B\[HIP```%Z+Y5W#5HOQZ#>:``#_="0, +M_W0D#&H(Z$/^__^+SNC,````:@:+SNA[````7L((`/]T)`1J`.C*____P@0` +M5O]T)`B+\6H`Z`T```!J#(O.Z!L!``!>P@0`5O]T)`R+\?]T)`QJ#.CT_?__ +MB\[H?0```&H,B\[H+````%[""`!6B_&`?@P`=1+_="0(:@OHF_W__XO.Z%4` +M``!J`HO.Z,T```!>P@0`BU0D!(O"@^@!=!&#Z`%T)H/H`704+?P```!U!8,Y +M`'4"B1'_003"!`"#.0MT]<P` +M"```C00D:``$``!0Z)+^__^$P'1B4U56:@U=:@I9C70D##/;5P^W!F8[Q70% +M9CO!=06#Q@+K[F8Y'G0W55;HTJ75N!Q``(``##58OL45:+=0B! +M_O\```!U#8!Y"`!U!UZ+Y5W"!`!6Z!3___]H0+-#`(U%_(EU_%#H$:@!`,S_ +M="0(_W0D"&HAZ*O\__]J`KE0#T0`Z.?^___""`!6_W0D#(OQ_W0D#.@-```` +M:@6+SNB4____7L((`%;_="0,B_'_="0,:@WH;?S__XO.Z/;^__]J!8O.Z*7^ +M__]>P@@`,\")@1`0``")@100``")@1@0``")@1P0``")@2`0``")@200``"+ +MP<-6BW0D"#/`5XOX9CD*````4U5J+H/&`C/;70^W1OY0Z)1)``"$P'1G +M#[<&9H7`=%]0Z())``"$P'559CDN=1X/MT8"4.AO20``A,!U"C/`9CE&`G4* +MZP(SP+,!ZP0SP(K89CDN=1YF.6X"=1@/MT8$4.A"20``A,!U"#/`9CE&!'4" +ML`&$VW4%A,!U`4B-O83O__^+QVCT-T,`4.B&Z`$`@\00]]@:P/[` +MB47PA,!T-&H$C;V,[___B\=H`#A#`%#H8>@!`(/$#(7`=1AJ7%AFB86$W___ +MC;V2[___C86&W___ZP:-A83?__]74.@3Z`$`C86$W___4.BTQ0$`BWT,@\0, +MB47LBT4(.)B780``=3PX7?`/A2\#``"-A@01``!0Z"I'``"$P`^%&P,``(V& +M!!$``%!7C48H4/]U".AM!P``A,`/A/\"``"+10@/MH!'80``4&H!5^C`+@`` +M5^@^,```A,!T'5?H2#```%#HD#```%>$P'0'Z'XO``#K!>C*+P``.)[Q$``` +M#X6V````.)X$(0``#X6J````4VB`````:@%34V@```!`5_\5)#!#`(/X_W40 +M5[E0#T0`Z,'Z___I@@(``%#_%1@P0P"+A@`1``"#^`,/A8P```"+3=2+5>B+ +M1>P#PLP#P&:)1@Z-A83?__]0BT7H@\`)C01&4.C&Y@$` +M@\00Z:$```!35_\5'#!#`(7`#X5X____5U-J%.A!^?__N5`/1`#IK0```(/X +M`G0)@_@!#X72`0``BTW4BU7HBT7L`\+'`0P``*"--!)FB7$*C01%$````&:) +M000SP(E!!HV%A.___U"-0110Z%7F`0"-1@*+==1FB48,BT7L`\!FB48.C86$ +MW___4(M%Z(/`"XT$1E#H+.8!`(M%\(/$$`^VP(/P`8E&$%-H```@`FH#4U-H +M````P%?_%20P0P"+R(E-\(/Y_W4;OE`/1`!7B\[H;_G__XO.:@GHR_K__^DG +M`0``4XU%T%`/MT8$4U.#P`A05FBD``D`4?\5$#!#`(7`=7;_=?#_%1@P0P!7 +M4VH5Z$SX____%0`P0P"#^`5T!STB!0``=1OHOHT``(3`=1)J&(U-A.A"H/__ +MC4V$Z+2;``"^4`]$`(O.Z*/Z__]J"8O.Z%+Z__^+=1!7.)[Q$```=`O_%2`P +M0P#IG````/\5*#!#`.F1````C8U)1>")1>2)1>B) +M1>R(1?"+?0B+SU!0B47\C47@4.A1Q/__A,`/A,H```"`/;(.1```=29H:#=# +M`.@X!@``A,!T!\8%L0Y$``%HD#=#`.@C!@``Q@6R#D0``8`]L0Y$``!6:@=> +M=`-J#UY3BUW@4U;_=0S_%0`@1@"%P'5V:``(``"-A93O__]0_W4,Z'U!``"$ +MP'034U:-A93O__]0_Q4`($8`A__^-393HSYD``&H! +MB\_H>?C__UM>C4W@Z'>>__^+3?1?9(D-`````(OE7<((`%6+[(/L3%;_=12+ +M=1!65NCO1P``5NC]*P``A,!U+/]U#&H6Z+WU__]J%XU-M.C_G?__C4VTZ'&9 +M``!J";E0#T0`Z!CX__\RP.M-BT4(4P^V@$=A``!0:@'_=0SH,RH``&H`5O]U +M#/\5+#!#`(7`#Y7#A-MU'_]U#&H6Z&;U__^^4`]$`(O.Z!OX__]J"8O.Z,KW +M__^*PUM>B^5=PA``N,H@0P#H4&T!`+C(8```Z")N`0!35HMU##/`5V8Y!G0M +M9CE&`G4GOP((``"-A>SO__]7:&`W0P!0Z/F(``!75HV%[.___U#HPX@``.L3 +MOP((``"-A>SO__]75E#HUH@``(M="(V%?+___V@`"```4%/HC0$``&:#O7R_ +M__\Z=!U6C4,D4&I3Z.ST__]J`[E0#T0`Z"CW___I+`$``(!]$`!T+(V-+)__ +M_^@.'P``:@&-A2R?__\S_U!7B\N)??SH!,+__XV-+)___^GU````5XV%?+__ +M_U"-A>SO__]0Z"R(``"-C7S/___H,?C__S/_C85\S___5U!6Z,$M``"+C83? +M__^(1?/VP0%T"H/A_E%6Z"``"`??,`QD7\`G0S:@56C8U4K___Z-0A``"$P'0AC86T +MW___4(V%K-___U"-A:3?__]0_[58K____Q44,$,`_[6$W___5NB*+```C8U4 +MK___Z#@>``"-C<3?___H+1X``(M-]%]>6V2)#0````"+Y5W"#`"+1"0,@[BP +M;````W45!8`B``!0_W0D%/]T)`SH\/?__^L",L#"$`!5B^RX`"```.@F;`$` +MBT4(5X.XL&P```*+B/A5``"+N/Q5``!U(8M%$-'O2#OX<@*+^%:+=0Q75E'H +MTIP``#/`9HD$?E[K-KC_'P``._AR`HOX5U&-A0#@__]0Z/-\`0"#Q`S&A#T` +MX/__`(V%`.#___]U$/]U#%#HSIP``%^+Y5W"#`!145-55E?_="0@Z,@_``"$ +MP`^%Y@```(M\)"A7Z+8_``"$P`^%U````(MT)"0SVXOKB5PD$&8Y'W1>:BZ# +MQP2+PUEF.4_\=31F.4_^=2X/MP=0Z"5```"$P'4%9CD?=14Y7"00=`X/MT?Z +M4.@,0```A,!T`46+1"00:BY9@\<"0(E$)!!F.5_\=;B%[7X*5NAT````A,!U +M9?]T)"#H(/;__XE$)!2+1"0___P!U'X"]Q.___P!T%H/N`HV%`/#__SOP +M=ZLRP%Z+Y5W"!`"P`>OU5HMT)`Q7BWPD#("_`6(```!U*H"_E&$```!T(8V& +M^$4``&@,.$,`4.A7O`$`65F%P'4*_W0D%%;HQOG__XV&^$4``&@4.$,`4.@V +MO`$`65F%P'42#[:'`6(``%#_="085NA?^___7U["#`#"#`!65XOYBP>+<`B+ +MSO\58#)#`(O/_]:+1"0,B4<$7U["!`!5B^R#[!2-1?Q34&H@,]O_%0PP0P!0 +M_Q4(($8`A#)@"-7A"#9@0`B\OH>$P``(M]"#/`@V7\ +M`(E^"&:)AO8```!FB8;X$```(8;D````:.#F``#H-6S&1?P!A+^8NWX````(7V=!2+SNBYGP``:.#F``!6Z`1G`0!9 +M68U/$%]>Z8%,``"+5"0$BT$$.T($=PUR!HL!.P)S!3/`0.L",\#"!`"+1"0$ +MBQ&+200[2`1W$W($.Q!W#3L0=04[2`1T!#/`ZP,SP$#"!`!35HMT)`R#OK!L +M```#=0R#OIPB```R#Y?`ZPJ#OIPB```=#Y7`@+Z@(@````^4P_[+(MAT&O]T +M)!"#QB2Y4`]$`%;HW_'__U9J).A@[O__#[;#7H/P`5O""`#H]"\``"T!!0`` +M]]@;P"4```P`!0``!`##N$@0``#H(6^"`` +M`&:+@/J"``!FB49W?__BTX(A,!UGSB9)U$``'0+@<$D4```Z`5N```YGN0```!U +M/(M&"&:#N/J"``!)="^A4`]$`(/X"W0E.)[X(```=0U7:D3H%>W__Z%0#T0` +MA>___U]>75N!Q$@0``##N`00``#HVF4!`%>+^8M'"("X +M`6(````/A=0!``"`N*AA````4XN<)!`0```/E,!55@^VP(VW^!```/^SI"(` +M`%!6Z&8U# +M)%!JL\,L"(1"03BT<(#[:`1V$``%!J`5;H6"```(M' +M"/^SI"(``("XJ&$````/E,`/ML!05NA&(@``B^B*1"03A>UT((3`#X2!```` +MBT<(@+BH80```'4,_[.D(@``5NA9)```QH?W$````8"_]Q````!T3%93_W<( +MZ*CZ__^+5PB-@]`R``"+BMAR``#WV1O)(\B-@\@R``!1BXK4<@``]]D;R2/( +MC8/`,@``48N*T'(``/?9&\DCR%%6Z&0B``!>75M?@<0$$```P@@`5HU#)%!J +M%.@?Z___O5`/1`"+S>BC[?__:@F+S>A2[?__Z7C___^X4!```.BY8P$`4U6+ +MZ;,!BT4(#[>0^H(``(/Z170)@_I8#X4B`0``@+@!8@````^%%0$``%97B[PD +M9!```(VU^!```&H!C8_`,@``4?^WY#(``(U,)!__M^`R``!1:``(``!6_[0D +MA!```%#H*A(``(3`#X7/````,MLX7"03#X7#````C4G__V@`"```5HU$)&A0Z-U]``!J`5;H_S@` +M`(M%"`^V@$=A``!0:@%6Z(`>``!J`8V'P#(``%#_M^0R``"-1"0?_[?@,@`` +M4&@`"```5O^T)(00``#_=0CH:A$``(3`=`2S`>L/5HU')+E0#T0`4.AZZO__ +M7UY=BL-;@<10$```P@@`5HOQBT8(@+@D40```'4?!210``!0_W0D$&H!Z&F2 +M``"$P'0,BTX(QH$G40```;`!7L((`%%3BUPD&%56BW0D'%>+^5.+1P@%$B`` +M`%!6Z!I]``"+1P@SR042(```B4PD$&8Y"'0D4.@].@``#[
    C$-@``A,!U +M$57HJ#4``(3`=0=35NBI+P``BT<(:CI9@[A<80``!`^WJ/J"``!U&8/]6'44 +M4>A\-0``A,!T"C/`QD0D$`%FB0:#_45T$XM'"(.X7&$```%T!U/_="0@ZPM3 +M_W0D(.CJ.0``4%;H8WP``(M'"("XHV$```!U!E;H"C<```^W!E#H])4``(!\ +M)!``#[?X=#IJ7UMF.5X"=1P/MT8$4.@?-@``A,!T#HU'OV:#^!EW!6HZ6.L1 +M9CD>=1!F.5X"=0IJ7%AFB09FB48"7UY=6UG"$`"X!"%#`.@]8`$`N$R=``#H +M#V$!`%:+\8V-J&+___]V".APCO__@V7\`(V&]@```%"-C:AB___H3QL``(3` +M#X0Y`0``:@&-C:AB___H:93__X3`=1%J`;E0#T0`Z$WJ___I%P$``("];<__ +M_P`/A0H!``!35S/;,_\XG5W/__]T>V@`"```C87,8O__4(V%\.___U#HC'L` +M`#B=8L___^L3`[VH[___$YVL[___@+UBS___``^4P`^VP%!H``@``(V%\.__ +M_U#H\#8``(V-J-___^@VZ___:@"-A:C?__]0C87P[___4.C!(```A,!UL0&^ +MF````!&>G````(V%J&+__XO.4.B/````BT8(:DE:7P^WB/J"``!;@_E4=`5F +M.\IU!\:``6(```&+1@AF.9#Z@@``=!J`N`%B````C8[V````40^4P`^VP%#H +M%9```(V-J&+__^BYF/__C8VH8O__Z+^S__^-3?-14(V%J&+__XO.4.B$```` +MA,!UWHV-J&+__^B_C___BTWT,\!>9(D-`````(OE7<-35HOQBTPD#.C3$P`` +MB49H,]N+1@B)5FR)GN@```")GNP````XF"11``!U#>B8CP``A,!U!(O#ZP,S +MP$"+SHB&]A```(A>7XB>]Q```,:&\0````&(GO0```#H\H<``%Y;P@0`N"0A +M0P#H05X!`+B@40``Z!-?`0!3BUT(,])7B_F)?>"+1P@/MX#Z@@``B47H.54, +M=2HX5U]T'%!2C4<04%/HL?\``(3`=1-J`;E0#T0`Z%[H__\RP.F3````,])6 +MB[/<(0``@_X"#X23````@_X#=1V`O_<0````#X03#```C8?X$```4%/_=PCH +MGO3__X/^!0^%^@L``("[K$4````/A`$,``"+=>@SP%90C4<04%/H/_\``(3` +M=1%J`;E0#T0`Z.SG___IVPL``(L#,\E1_[.D;```BW`0B\[_LZ!L``#_%6`R +M0P"+R__6L`%>BTWT7UMDB0T`````B^5=P@P`B)?W$```.9/<,@``?Q9\"#F3 +MV#(``',,B9/8,@``B9/<,@``.9/D,@``?Q9\"#F3X#(``',,B9/@,@``B9/D +M,@``BT\(.9%@80``=1N+@32C```YA^P```!R#8"_\0`````/A3X+``"^``@` +M`(A5[5:-A52N__]04FH&C47M4(V#@"(``%#H)]7__X7`#Y7`B$7NA,!T#H!] +M[0!U"#/`B(?Q````B\OH0I?__U:-A<3N__]0C8.H(@``4.@++```,\E!@+MS +M,P```(E-Y'13BT<(BX#$<@``.\%T9(!][0!U7H7`#Y3`_L@@1>XSP%"-A<3N +M__]0Z#4U``"+3PB+B<1R``!).\AU$C/)C87$[O__05%0Z!Z*@QDS``"(1U\SP(A' +M8(N+J&P``"N+V#(``(LS4(N#K&P``!N#W#(``%!1BTX0_Q5@,D,`B\O_5A`S +MTHK"BLJ(3?*(3=PX1>YU%HJ3M&P``(A5\HA5W(32#X3>"0``,]*+1PB+=>AJ +M28J(`6(``%B$R70'9COPL`%U`HK"_W7;__S/`4(V%5,[__U"- +MA_@0``!0Z$L<``"$P'0VC8/`,@``4(V-9-[__^CG\___A,!T,H"]8-[__P!T +M$%>-C63>___HL//__X3`=!DSP(A%\^L2BT<(@+A780````^5P/[(($7SC87$ +M[O__B\]04^C)\___A,!U(FH"N5`/1`#HX>3__XO+Z!J4__^`N[1L````#Y3` +MZ0;]__^`NQLS````=!>-A<3N__^+SU!3Z+WX__^$P`^$W````(MW"(V]Q/[_ +M_VI`@<8D4```6?.E9J4/MHL@,P``C478BWW@,])0C8-+,P``B57\4/^S;#,` +M`/?9C8,Q,P``4!O)C8,A,P``(\B-A<3^__]14/^S'#,``(U/$%+H)D```("[ +M&S,````/A),```"`NT$S````#X2&````:@B-1=A0C8-",P``4.C_=`$`@\0, +MA'__XM/ +M"('!)%```.@K8@``@TW\_XV-Q/[__^BI80``Z03____&A_@@```!Z;<'``!J +M!NATX?__:@NY4`]$`.BPX___,\"(1?.#3?S_C8W$_O__Z'%A``"-C9S>___H +MC0L``(N#@#,``,=%_`$```")1=1J4%J%P`^$C0```(/X!0^$A````(I-\XMU +MZ(3)#X3]````9COR#X3K````BT<(@+@!8@````^%VP```#/`B$7OC8?X$``` +M4.CN%@``A,!T-8!][P!U.3/)C8/`,@``45#_L^0R``"-1>__L^`R``!0:``( +M``"-A_@0``!04?]W".A*"```@'WO``^$A````#/`BLB(3?/K?HO+Z`B4__^$ +MP'10@'WS``^$G@```(M%Z&:#^%`/A)$```!J25EF.\$/A(4```!J15EF.\%T +M?8M'"#/)03F(7&$``'1O_X?D````C87$[O__4%.+S^@B\___ZUB*3?.$R70B +MC863I7OK__X3)#X3$!0``BT<(@+@!8@```'00QH?W$````8"X`6(```!U +M28I%\H3`=44SP&I0B$7O6&8[\'1`C8V\!A,!U!O^'Y``` +M`/^'Z````(VS\#(``#/`C8_(````B8>`````B8>$````B8>(````B8>,```` +MBT<(_[#@@@``_S;H)QX``(M'"(V/H````/^PX((``/\VZ!$>``"+@]@R``"- +M=Q"+B]PR``")1S"-A9S>__]0B4\TB\Y3Z%(]``"*5>\SR8I%\HA7.8A'.HE- +MW(E-Y(32#X6=````.(O$;```#X61````B[/D,@``BY/@,@``._%\?G\(@?I` +M0@\`=G2+B]@R``"+@]PR```/I,@*P>$*.\9\6'\$.\IV4C/`._!\(W\(@?H` +MX?4%2*1?(SR8UW$(M7"("ZH&$````/ +ME(6UWO__@'WO`'44A,!U$&I06&8Y1>AT!S/`0(K(ZP,SP$"#?=0`B$WPB$7L +MB$7Q#X0)`0``B[.`,P``@_X$=&>#_@5T8COP=$*#_@)T/8/^`W0XC8?X$``` +M4(U#)%!J1^B]W?__,\F*P8A%\8I-\,9%[`"$R0^$N0```(3`#X2Q````,\!` +MZ:L```"$R0^$A````(V'^!```%!3C4<04%+HX>G__^M@:``(``"-A52^__^+ +MSU"-@X0S``!04^CF\___BDWPA,ET3F:#O52^__\`=$2-A52^__]H``@``%"- +MA_@0``!0@_X$=0K_=PCH&>?__^L2C4,DB\]0C86`P``B$7QA,`/ +MA%K___^*3?#K`XI%\8.[L&P```(/A4S___^$R0^%3/___^D[____,\"(A_<0 +M``#K?H"[&#,```!U=8"[H"(```!U%/^SY#(``/^SX#(``%;HQ0,``.M8#[:# +M<#,``(N/X````%#_LW0S``#HT9T``(N'X````(N+X#(``(N3Y#(``(F(2$P` +M`#/)B9!,3```B(A@3```#[:#<#,``(N/X````%#_LYPB``#H09H``(O+Z.>- +M__^`NQDS````=3`/MI-*,P``C8-+,P``]]J-C\@````;TB/0C8/P,@``4E#H +M!!L``(3`=`:Q`3/`ZP0SP(K(@+MP,P```'4(B(?T````ZR:`NZ`B````=!TY +M@^0R``!\%7\(.8/@,@``=@N$R70'QH?T`````8!]\@"(1?!U7X!][`!T683) +M=54XBQLS``!T*#B+03,``'0(.(O$;```=!B`O_0`````=0^-A<3N__]0C4,D +M4&H$ZPV-A<3N__]0C4,D4&H#Z);;__]J`[E0#T0`QD7P`>C.W?__BD7P@WW4 +M`(I5\701@[N`,P``!'4(A-)T!+$!ZP(SR8!][P`/A4X!``"+=>AF.W70=`IF +M.W7,#X4[`0``@WW4`'09A,EU%8.[@#,```4/A20!``"$T@^$'`$``(3`=!.+ +M1PB`N*!A````#X0(`0``BD7PA,D/A;X```"+5>0SR3O1BTW<=P2%R70?A,!U +M$#F/B````'4(.9>,````=`N-C9S>___HR@T``(M7"(VST#(``(V[P#(``(N" +MV'(``(N*U'(``/?8&\`CQO?94!O)C8/(,@``(\B+@M!R``#WV%$;P(V-G-[_ +M_R/'4.@F#```C8V!3_W`(Z*KI__^+1>"+2`B+@=AR +M``#WV!O`(\90BX'0<@``C8V"P``BWW@BT<(@+BH80`` +M`'4L_[.D(@``C;?X$```5NCU$@``A,!U%E:-0R10:A'H(-K__[E0#T0`Z*;< +M___&A_<0```!@TW\_XV-G-[__^A^!```@'WN`(I%\XI5\G0&_X?L````@']@ +M`'4DA,`/A6'T__\X@[1L``!U#(O+Z%F+___I3?3__X32#X5%]/__,L#I0/3_ +M_[A!(4,`Z)51`0"X/!```.AG4@$`4_]U&/]U%/]U%.B'*P``C8VX[___Z-,# +M``#_=10SVXV-N.___XE=_.BA#```A,!U'/]U$/]U%/]U#&H2Z"WI____=0QJ +M$^@MV?__ZT-H```0`(U-X.A=?___QD7\`>L,BTT(4/]UX.B:#```Z!UU``#_ +M=>2-C;CO____=>#H10D``(7`==J-3>"S`>AI@?__C8VX[___Z(P#``"+3?2* +MPUMDB0T`````B^5=PA0`N%,A0P#HTU`!`(/L%%;H8NK__U"-3>#H[7[___]U +MY(M-"/]UX(-E_`#HRS<``(OPA?9^1%.+71!7BWT,B\:9.]-_!GP&.\=R`HOW +MA?9^$XM-"%;_=>#H@SD``(O&F2OX&]K_=>2+30C_=>#HB3<``(OPA?9_QE]; +MC4W@Z,N`__^+3?1>9(D-`````(OE7<(,`%-55E>+?"0DA?]T`\8'`(MT)!PR +MVU;H4`X``(ML)!CK5X3;=0Q6_L/HJP```(3`=4$SP#+;A>T/E,!0_W0D-/]T +M)#3_="0T_W0D,%;_="0LZ)]_``"%P'0C@_@!=#^#^`9U#VC_````N5`/1`#H +MZ=C__U;H\PT``(3`=:4SVSA<)#0/E<.#PQ&%[70<4U:+S>@A`P``A,!T#[`! +MZS2%_W0#Q@UT"U-6B\WH[0(` +M`.L&5NA'#0``7UY=6\(D`+AH(4,`Z&I/`0"X+%```.@\4`$`4U:+=0B-AH__^#Q!"-A?#O__]0Z)P,``"$P'0+,\!F +MB87P[___ZP=FBX7P[___@\=[@?\0)P``?)QFA<`/A*````"_``@``(V%R,__ +M_U=64.@=:@``5_]U\(V%R,___U#HVR<``(V%\.___U"-AL",L"+3?1?7EMDB0T`````B^5=P@0`@TD$_S/`QP$L +M.$,`9HE!)(A!"(E!#(A!$(F!)!```&:)02&(02")012+P<=!&``!`0#'01P` +M`0``PU6+[&2A`````&K_:($?0P!09(DE`````(-Y!/_'`2PX0P!T&(!Y$`!U +M$H!Y&`!T!^B2`0``ZP7H1````(M-]&2)#0````"+Y5W#S,S,S,S,5HOQZ*C_ +M___V1"0(`70-:"@0``!6Z.M,`0!968O&7L($`,S,S,S,S,S,S,S,S,S,4U:+ +M\;,!@WX$_W0B@'X0`'48@WX,`'42_W8$_Q48,$,`C5C_]]L:V_[#@TX$_X-F +M#`"$VW43.%X:=`Z-1B2Y4`]$`%#H3M7__UZ*PUO#N`00``#H:$T!`%.+G"00 +M$```B\-5T>A6)`&+\5?VPQ!U"H!^(@!U!#/MZP,S[47_M"08$```,\F)7AR$ +MP`^4P4F!X0```("!P0```,")3"04Z%DE```/MP"#^"YT!8/X('41]L,@=0R# +M3@3_,]N+?"00ZQV+?"00,]M34VH"4U57_[0D,!```/\5)#!#`(E&!(-^!/]U +M+V@`"```C40D&%#_M"0@$```Z/$>``"$P'054U-J`E-55XU$)"Q0_Q4D,$,` +MB48$:``(``#_M"0<$```C48DQD88`5")7@R(7A#HCF<``(-^!/]?7ET/EX($X``#E%#'8- +M4/]U"(O.Z*[____K.X-^#`%U#_\5`#!#`(/X;74$,\#K)H-^#`!U&+\`@``` +M.7T,=@[_%0`P0P"#^"%U`U?KP8/(_^L#BT7\7UZ+Y5W""`!145.+V5565XL# +MB5PD$(MP%(O._Q5@,D,`B\O_UHL+B^IJ`FH`:@"+<1"+SHE$)"#_%6`R0P"+ +MR__6BP.++TU]>75M96<-5B^Q15E>+^<9%_P!J`8U-_U&+!XMP#(O. +M_Q5@,D,`B\__UHI%_U]>B^5=PX-Y!/]U`S+`P_]Q!/\5/#!#`(/X`G0(@_@# +M=`,SP,,SP$##S,S,S+A4$```Z-9*`0!3BYPD8!```%57B_F#IR00````@'\B +M`'4)]L,$=00RR>L"L0&+P]'H5B0!#[;P]]X;]H'F````P('&````@/;#`70& +M@L#]].#XP&$R70#@\L",\"-3"0<.$<;#Y7`2"4````(B40D$.A, +MU?__@'\@`'0&@=!^#_?]T&H-,)!#_C40D$(-,)!3_:@!0:@!5_Q44 +M,$,`,\"#_?^(1Q@/E<.)1PR(1Q"#_?]T'&@`"```_[0D:!```(U/)(EO!%'H +M@F0``,9'(0!?78K#6X'$5!```,((`%97,_:+^5;_="04_W0D%.@D````A,!T +M&XO/Z'\#``"+!U965HMP$(O._Q5@,D,`B\__UE]>P@@`456+Z8-]!/]T>%.+ +M7"045XM\)!2%VW\X?`2%_W,RBTPD'(7)="Z#^0%U%HM%`%:+ZP>+S>A$_?__`_@3VC/)ZP2+3"0+^8!_(0!T!S/`Z1H!``"#9"0(`(-D)`P`559J`ETY;Q1U&8L' +MBW`4B\[_%6`R0P"+S__6B40D$(E4)!2^4`]$`%/_="0DB\__="0DZ`G\__^+ +MV(/[_P^%R````(!_&@")KR00```/A+@````Y;Q1T6S/`B$0D$HA$)!&(1"03 +M.4<4=2TY1PQU*(U$)!.+SE"-1"054(U$)!I0C4+^8%_'``!``!T#_9''`)U"?]W!/\53#!# +M`(M,)"PSVT.%R70+BP$+001T!(K3ZP(RTE:+="0TB%0D$X7V=`N+!@M&!(A< +M)!)U!<9$)!(`BVPD.(7M=`B+10`+101U`C+;A-)T"HU$)!10Z#9O``"`?"02 +M`'0,C40D)(O.4.@C;P``7H3;=`R-1"08B\U0Z!)O```/MD0D#XU,)!#WV!O` +M(\&-3"084`^VP_?8&\`CP8U,)"10#[9$)!;WV!O`(\%0_W<$_Q44,$,`7UU; +M@\0!'41@'X:`'1:C48DB\U0Z([/ +M__^#9"0,`(U$)`Q7:@%0:@#_=@3_%50P0P"+^#O[=1O_%0`P0P"%P'01@'X: +M`'0GC48DB\U0Z%7/__^+1"00,\F9`\^+T(O!@](`7UY=6UG#B\.+T^OUB\.+ +MT^ON_W$$_Q50,$,`2/?8&\!`P_]T)`C_="0(Z$+X__^$P'0$L`'K$/]T)`2Y +M4`]$`.C#S?__,L#""`!65XOY:@#_="00BP>+<`2+SO\58#)#`(O/_]9?7H3` +M=`2P`>L0_W0D!+E0#T0`Z'G.__\RP,($`%%14U6+;"08B]F%[74'L`'I!`$` +M`(-[#`%U"VKU_Q5`,$,`B4,$5E>_`$```(-D)!``@WL,`,9$)!0`=#TS]H7M +M=%N+Q2O&.\=R`HO':@"-3"0445"+1"0H`\90_W,$_Q5$,$,`2/?8&L`$`8E$ +M)!1T+`/W._5RR^L@:@"-1"044%7_="0H_W,$_Q5$,$,`2/?8&L#^P(E$)!2$ +MP'5Q@'L:`'1K@WL,`'5E:@"-75M96<((`+@$ +M$```Z#=$`0!6B[0D#!```(7V#X2X````,\!F.08/A*T```!35[,!B40D#(O^ +M58OHT?V!_0`(``!S7P^W!U#HR1@``(3`=#T[_G8YC48$._AU!V:#?@(Z="M5 +MC40D&%90Z-RX`0"#Q`PSP&:)1&P44&H!C40D'%#HC0$``(O8]]L:V_[#BT0D +M$(/'`H/``C/)B40D$&8Y#W65@+PD'!````!==296Z-(;```/MP!0Z%D8``"$ +MP'43,\!0:@%6Z$75N!Q"00``#"$`!5B^RX`!```.CL/P$`4_]U#/]U"/\56#!#`(7`#Y7# +MA-MU+6@`"```C84`\/__4/]U".CN$0``A,!T%?]U#(V%`/#__U#_%5@P0P"% +MP`^5PXK#6XOE7<((`(.)!!```/\SP&:)`8O!QH$`$````<.+@000``"#^/]T +M!U#_%6`P0P##5HMT)`S_="0(QH9$$````.A'%```A,!T!#+`ZT-6_W0D#&K_ +MZ`4!``"#^/]TZU#_%6`P0P#_M@@0``"#ID`0````Z-7\____M@@0``"(A@P0 +M``#HW/S__XB```+`!7L(,`%-65XM\)!"+\>F"````@+X`$````%=6=`]J +M_^BJ````B88$$```ZPO_M@00``#HEP```(/X_W1I_[<($```B9]`$```Z&_\ +M____MP@0``"(APP0``#H=OS__XB'#1```%>(G@`0``#H`!<``(O8:$@X0P!3 +MZ".1`0!9687`=!%H3#A#`%/H$I$!`%E9A#X5M____ +M,L!?7EO""`"P`>OV5F@`"```_W0D#(OQ5NA560``QH8`$````5["!`"X4!(` +M`.@_/@$`4U56B[0D8!(``(U$)`Q7B[PD;!(``(/+_[T`"```4#OS=7#_M"1L +M$@``_Q5D,$,`B_`[\P^%@````%6-A"1D`@``4/^T)'`2``#H'!```(3`=!F- +M1"004(V$)&0"``!0_Q5D,$,`B_`[\W5._Q4`,$,`@_@"=`^#^`-T"H/X$G0% +M,\!`ZP(SP(B'1!```.G0````5O\5:#!#`(7`=12+\_\5`#!#`(/X$@^5P(B' +M1!```#OS#X2I````5?^T)&P2``!7Z'A8``!5C40D0%!7Z#H6``"+3"0L,\`# +M1"0PB8<`$```BT0D$(/1`(F'"!```(M$)!2)AR@0``"+1"08B875N!Q%`2``#"#`"`?"0$`%:+\<9&"`!T'E>_`X```%?H +M;SX!`%=J`%")1@SH8$P!`(/$$%_K!(-F#`"+QE["!`"`>0@`=0G_<0SH3CX! +M`%G#5HOQ@WX,`'0/@'X(`'4)_W8,Z#4^`0!9BT0D"(E&#,9&"`%>P@0`BU$$ +M`U0D!(O"@^('P>@#`0&)403"!`#I`````%.+V597:@B+<("_C3[P^WQU]>6\,SP(E!"(D!B4$,B4$0B\'# +MS,S,S,S,S,S,S,S,5HOQZ*X#``#_="0(B\[H'`$``(O&7L($`%.+7"0(5597 +M:$"J0`!J"&@(`0``B^E35>B6`0``C;5`"```B\[H +M````C;-("0``N8````"-O4@)``#SI8N#2`L``(F%2`L``(N#3`L``(F%3`L` +M`(N#4`L``%^)A5`+``"+Q5Y=6\($`%-65XO9:@B+\U^+SN@4`P``@<8(`0`` +M@^\!=>Z-BT`(``#H_@(``%]>B\-;PU6+[&2A`````&K_:($?0P!09(DE```` +M`%:+\5>+?@R%_W04B\_H#E\``&@X`P``5^@2.@$`65EJ!(U&!%#HDT0``(-^ +M"`!T&;]4"P``5_]V".A_1```5_]V".CH.0$`65F+3?1?9(D-`````%Z+Y5W# +M5E>+?"0,B_$[]W0Q:+````#_M_````#_MO````#HOTL!`(N'``$``(/$#(F& +M``$``(J'!`$``(B&!`$``%^+QE["!`"#.0!T3XM4)`2#.@!T1H,Y`74%@SH! +M=`J#.0)U$(,Z`G4+BT$$.T($#Y3`ZRF#.0-U'H,Z`W49C4($:B!0C4$$4.BA +M5`$`@\0,]]@;P$#K!C+`ZP*P`<($`%>+?"04A?]T+5.+7"0058ML)!!6*^N+ +M3"0DC30K4_\58#)#`(O._U0D*`-<)!R#[P%UXUY=6U_"%`!5B^R#["2-1=Q0 +MZ+@```"#?0P`=`S_=0R-1=Q0Z*ZT____=0B-3=SH0?___XOE7<((`%6+[%%6 +MB_&#?@@`=2!H5`L``.B#.`$`B47\687`=`F+R.@S_O__ZP(SP(E&"(M%"(D& +M@_@!=02#9@0`@_@"=02#3@3_@_@#=0C_=@CH@JS__XM%#(/X"'(#:@A8B480 +M7HOE7<((`(M$)`2)`8/X`70%@_@"=02#800`@_@#=1-J((U!!&@`X$,`4.A) +M2@$`@\0,P@0`58OLBP&![%0+``!6BW4(B0:#.0%U!HM!!(E&!(,Y`G4(BT$$ +M]]")1@2#.0-U'O]Q"(V-K/3__^@0_?__C48$4(V%K/3__U#H8JO__UZ+Y5W" +M!`"XW")#`.CJ-P$`45:+\8,^`G41_W4,_W4(_W8$Z#NQ__^)1@2#/@-U7(-^ +M$`%V,%0!```(F>1!```(F>4!```(F>5!```(F>2!```(F>3!```(F> +MF!```(E>)(F>G!```(B>H!```(B>P1```(B>RA```(F>[!```(F>\!```(F> +M]!```&:)GO@0``"(GOH0``")G@`1``!FB9X$(0``7EO"!``SP&:)012)01AF +MB4$B4$@B4$DB4$HB4$LB4$PB4$TB4$XB4$\PU6+[(L-(.!#`('L%`$` +M`(/Y_W4\C87L_O__QX7L_O__%`$``%#_%6PP0P"+C?S^__^+A?#^__^+E?3^ +M__^)#2#@0P"C8`]$`(D59`]$`.L+H6`/1`"+%60/1`"#^0)U!\'@"`/"ZP6X +M`04``(OE7<.X!"```.C1-@$`BX0D$"```%-5B]C!ZQ]6@.,!#[?PB%PD#(ML +M)`Q7B[PD&"```(7V#X1'`0``5^CQB`$`B40D%%F#_@)T3(/^!'1'@_X#=$)0 +M_[0D("```%>$VW0*Z$"K`0"#Q`SK!>@D:P``AARA@$`65GK +M!>BT3@``7<(,`(!\)`@`=`:+1"0$ZPG_="0$Z$MH``#""`"XCB%#`.C=,@$` +M45:+\8EU\(V.)%```.C2.@``,\")1?R)AG!A``")AG1A``")AGAA``")AGQA +M``"(AH!A``")AK!A``"+SHF&M&$``(F&N&$``(F&O&$``(F&P&$``(F&Q&$` +M`(F&T&$``(F&U&$``(F&V&$``(F&W&$``,9%_`&)AN!A``")AN1A``#HA@`` +M`(M-](O&7F2)#0````"+Y5W#58OL9*$`````:O]H@1]#`%!DB24`````5HOQ +M@SX`=!R`?A``=`Z+1@C!X`-0_S;HCSP``/\VZ%.%`0!9BTWT9(D-`````%Z+ +MY5W#5FCP@@``B_%J`%;HA4(!`(/$#(V.<&$``.B7____C8XD4```7ND*.@`` +M5E=H\((``#/_B_%75NA90@$`@\0,QT8,`````KC___]_B;XP80``QX8T80`` +M`P```(F^*&$``&H"68F^D&$``(F.T'(``(F&\&$``(F&]&$``(F&^&$``(F& +M_&$``(F..&$``.@U6```7XF&X((``%[#5HMT)`A6Z(&$`0!9A6XOE7<(,`+@`$```Z%,Q`0!35HNT)`P0``!7:BY;#[<& +M9H7`=$.+R(U^!`^WP5#H_04``(3`=!QF.5_^=19F.1]U$0^W1P)0Z.0%``"$ +MP'0#C7<$#[='_H/'`HO(9H7`=#[?#4.AB!0``A,!T!8U] +M`NL%9CO>=0R#Q0(/MUT`9H7;==V+M"04$```:EQ;,\D[_G02B_>)M"04$``` +M9CD/#X5M____:BY;768Y'G4/9CE>`G4)9CE.!'4#@\8$@[PD%!````!T*&@` +M"```5HU$)!10Z"A+``#_M"08$```C40D$%#_M"0<$```Z!!+``!?B\9>6X'$ +M`!```,(,`%6+[+@`$```Z/0O`0#HI/C__ST`!@``+?"00A?]T-E:+ +M="0,3U;HT`<``"O&T?@[^'(,5NC"!P``B_@K_M'_5U:+="085NA9I`$`@\0, +M,\!FB01^7E_"#`!3BUPD##/`5XM\)`Q79HD#Z/H"``"$P'08#[<'4&B@.$,` +M_W0D'%/H?(C__X/$$.M75FI<7F8Y-W5-9CEW`G5'C4<$5E#HZ6`!`%E9A7UO"#`!7BWPD"&:#/P!U!(O'ZW]35E?H^(`!`$A9C1Q' +MZP<[WW80@^L"#[<#4.@82```A,!T[`^W`XOSZPH[]W9-@^X"#[<&4.C]1P`` +MA,!U[#OW=CE5:BY=#[<&9CO%="Q0Z.-'``"$P'4)@^X"._=WY^L95^B?!@`` +M55#H*6`!`%E9AB\-;7\($`%6+[(M%#%97BWT4A`F8Y`P^%!0$``(MU$(U'!COP#X;W````5FBL.$,`_W4,Z#I(``!6 +M:+@X0P#_=0SH!$@``%93Z<@```"-A0#P__^[_P<``%!3_Q5P,$,`A<`/A+D` +M```[PP^'L0````^W!E#HQ0$``(3`=#>-1P:+?1`[^`^&E@```%=HK#A#`/]U +M#.C91P``,\!FB84$\/__C84`\/__5U#_=0SHF$<``.M?:``(``"-A0#P__]0 +MZ'/Z__^-A0#P__]0Z/-^`0"#QP0#QXM]$%D[^'9#5VBL.$,`_W4,Z(9'``!7 +MC84`\/__4/]U#.A.1P``9H,^+G41#[=&`E#H,@$``(3`=`.#Q@175O]U#.@M +M1P``L`'K`C+`7UM>B^5=P@P`@WPD!#H/E,#"!`!6BW0D"`^W!E#HX$4```^W +MP(/`OV:#^!EW#&:#?@(Z=04SP$#K`C/`7L($`%:+="0(:EQ89CD&=09F.48" +M=!A6Z+O___^$P'03#[=&!%#HM````(3`=`4SP$#K`C/`7L($`%:+="0(5NB_ +M____A,!U$0^W!E#HC0```(3`=00SP.L#,\!`7L($`%-6BW0D##/;9CD>=!MF +M.5X"=!6-1@1J.E#H?5T!`%E9A_ +M``@``%=64.BW10``5NAV_O__A,!T!V:#?@0`=`U7C84`\/__4.A?^/__5_]U +M#(V%`/#__U#H844``/]U%(V%`/#__U#_=1#H=T4``%]>B^5=PA``45%358ML +M)!0SP%97B_");"04B]T/MP.)1"00#[?`4.@7____A,!U"&:#?"00`'5&C7[_ +MA?]^/VHN6P^W1'T`@_@@=`5F.\-U*68[PW4>#[=$??Y0Z.+^__^$P'45#[=$ +M??YF.\-U!8/_`70&3D^%_W_(BUPD%(M$)!!FB41U`#/`9CD#=`J#PP)&B5PD +M%.N$7UY=6UE9P@0`55:+="0,,^UF.2YT6U.*7"045XO]N8@X0P"$VW4%N9@X +M0P`/MP904>B26P$`65F%P'4*A-MT#F:#/B!S"&I?66:)#NL#:E]9B\>#X/Z# +M^`)^"6:#/CIU`V:)#H/&`H/'`F8Y+G6O7UM>7<((`%-55E>+?"045^BM^?__ +MBUPD&(OP,^V%]G464VA<.$,`5^@;1```5^B/^?__B_#K.F8Y;@)T'FAH.$,` +M5NB[70``A8UN!`^W10!0Z/5!``"$P'1,#[=&!E#HYT$``(3`=#Y6Z*9Z`0!(66HZ6XT$ +M1F;_`&8Y&'5$:C!=:BY:.\=V%F8Y4/YT$&:)*(/`_F;_`&8Y&'3HZR1J85EF +MB0CK'"OWT?XKWH/K`E-H@#A#`%7H!T,``.L%,\!FB0=?7EU;P@P`5E=J._]T +M)!`S_^@D7`$`B_!9687V=!>-1@)0Z%A<``"`?"00`(OX=`4SP&:)!HO'7U[" +M"`!6BW0D"%;H"WH!`%F%P'0&C31&@\;^B\9>P@0`4U:+="0,5U;H[7D!`(OX +M@^\!67@8C1Q^#[<#4.A3_/__A,!U((/K`H/O`7GK9H,^`'0*9H-^`CIU`X/& +M!(O&7UY;P@0`C4,"Z_56BW0D"%;HJ____XU.!#O!/!```@?N`````#X>#!```A=L/A'L$```S_XE\)#R%VW2U@V0D*`"- +M1"1(@V0D)``S]H-D)"``,^V#9"0<`"%T)!1J'%90B70D).B[-`$`(70D/(/$ +M#(E\)"P[?"0X#X.9`0``BT0D%(M4)"2+RBM,)""+?"0#Z`%T)H/H`705@^@!BT0D%'54@_@0 +M?4]`B40D%.M(BT0D%(/X\'P_2.ONBT0D%(/^$'TS1NL*BT0D%(/^\'PG3HET +M)!CK((M$)!2#_1!]%T7K%(M$)!2#_?!\"TWK"(MT)!B+1"04BTPD+`/+_T0D +M,(E,)"P[3"0X#X)O_O__BWPD/$>)?"0\._L/@AC^___IR/W__XM&!(M.%(M^ +M"(E$)""-6/V)3"0PC4']B5PD/(E\)$0]_?\!``^'6@(``#O9#X=2`@``@_\" +M#X=)`@``BP:)1"0LC2P(,\"+U8EL)!@KTXE$)"2)5"04,]L[P0^#NP```(T\ +M`HM$)#R+5"0@*\6+;"0\B40D*`/'.\)R;@^V!P^V3_V+\"OQB40D.`/SB4PD +M-(O&*\-0Z"N8`0")1"1$B\8K1"0\4.@;F`$`*W0D/%:)1"0HZ`V8`0"+3"1, +M@\0,BU0D'#O*?PX[R'\*BTPD,(M4)"#K%(M,)#`[T(M4)""+7"0X?@2+7"0T +MBT0D+"H80`^VVXE$)"R+1"0HB!PO@\<#`\<[P8M$)"@/@F;___^+;"08BT0D +M)(M4)!1`B40D)(/X`P^"+?___XM\)$2#P?[K#HI$+P$`!"\`1"\"@\<#._ER +M[NE__/__BT84BQZ->.N!_^O_`P`/AR\$1XE\)#@/M@.#X!^#Z!!X=8J`<.!#`(3`=&N+?"0L,\D/MM!J$HE,)#2) +M5"1`73/`0-/@A<)T.6H$C448B\Y04^C3````@_@%=1YJ%%5J%%53B\[HP``` +M`"O'B\XE__\/`%!3Z/L```"+5"0\BTPD,$&#Q2F)3"0P@_UD=K&+?"0XBU0D +M+(/#$$*#[P&)5"0LB7PD.`^%:____^FV^___BT84BPZ+=AR-6/R!^_S_`P!W +M7X/Z`@^4P#/_!.B(1"03A=L/A(W[__^*$4%'1H#ZZ'0$.M!U,HL1A=)Y$8T$ +M%H7`>!B-@@````&)`>L.C8(```#_A`("_#!XP@/MD07`H/*_PO#P>`0"\;3Z%DK3"087]/J7B/"6\(,`%6+ +M[(M%$%-6:B"#R_^+\%DK312#X`?3ZXO(TV4,BU4,T^,SR<'N`_?3`W4(B@0. +M(L/!ZP@*PH'+````_\'J"(@$#D&#^01RY%Y;7<(0`%:+\8,^`'4-:`0`!`#H +MR"$!`%F)!E[#BU0D!#/`4U:+="00,]M`BLL[\'8(,@P00#O&L&#[;;:@KHO^+__^L-:@;HMN+__\'K"H/C#XO#7UY;P@0`5HMT)`BZ +M```$`#ORBT0D$"O6.\)R`HO"ABN4P$` +M@\0,7L(,`%6+[%&+10@STHD1B5$(B5$,B%$0B4$4B\&)3?R)402)41R)41B) +M42"+Y5W"!`"+41P[41AS#8U"`8E!'(L!#[8$$,,SP,-6B_%7BWXPU.+V5>+ +M>QR-1P,[0QAS+HL35@^V=!<##[9$%P(/MDP7`<'F"`/&P>`(`\$/M@P7P>`( +M`\&-3P2)2QQ>ZP(SP%];PU97B_'HM?___XO.B_CHK/___S/)B]`#SU^#T@"+ +MP5[#4XO95597BW,8*W,75M96<.+QHO1Z_.+ +M1"0$BU$8.\)S#8L)@#P!`'T*0#O"7 +M__^+SO?9&\DC3"08`4T8ZSB+\`/"B448ZR^+7"08A=MT)U/H\DS__XM]%(M5 +M&`-5`%.+!U*+<`R+SO\58#)#`(O/_]:+\`%U&%^+QEY=6UG"!`"XXB%#`.@? +M&P$`45%35HOQ5XEU\(V.D````.C:W___,_^-CJ0```")??SHRM___XV.N``` +M`,9%_`'HN]___[O`$```QD7\`E/HFAH!`%F)1>S&1?P#AS&1?P$A6V2)#0````"+Y5W#4U:+\;O`$```5XM^0(7_=!"+S^B\E?__ +M4U?H6!H!`%E9BWY$A?]T$(O/Z*65__]35^A!&@$`65F-CK@```#H[=___XV. +MI````.CBW___7XV.D````%Y;Z=3?__^#24C_,]*($8A1#(E1((E1),=!*`$` +M``")44R(45")42R)43")41R)41B)431FB9',````B5%XB5%\B5%PB5%TB5%H +MB5%LB5%@B5%DB5$XB5$\B9&(````B9&,````B9&`````B9&$````PU6+[(!] +M"`!6_W4DB_'_=2#_=1S_=1C_=13_=1#_=0QT$HM.0&H!Z`F6__^(ALP```#K +M$(M.1&H`Z/>5__^(ALT```!>7<(@`(M$)`2%P'0#B4$LBT0D"(7`=`.)03"# +M24C_P@@`BT0D!(E!%(M$)`C&00P!B4$0P@@`58OL@'DH`'14BU$LA=)T35.+ +M70Q6B[&(````B\97B[F,````"\>+10AT#@.!@````!.9A````.L&BWT4BW40 +M5U934/^RY#(``/^RX#(``/]Q?/]Q>.C`20``7UY;7<(0`(/L$%-5BVPD((O9 +M5E>`N\T`````=`.#Y?"+3"0D,\")1"04B_")3"00A>T/A%H!``"+^8`[`(M3 +M+(E4)!QT'_]S!/]S"/]T)"SHDBH!`(MS!(/$##/`B4,$Z<(```"+2R0S_SOY +M?!!_!3MK('8)BWL@B7PD&.L&B_V);"08A?\/A)<```"`>T\`="F`N\T````` +M="`S]COQ?!I_!3MK('83`\>+R(/A\"O(`\^%R7X$B4PD&(L"BW`8B\[_%6`R +M0P"+3"0<_]:$P`^$MP```(M[+/]T)!C_="04BP>+<`R+SO\58#)#`(O/_]:+ +M\(M#.(7`=0F+1"0RL`=1F`N)D0````=!!6_W0D%(V+D````.C4 +MW___BWPD$(M,)!2+QID!0W`14W0#S@/^B4PD%"ONB7PD$"E#(!E3)(![3P!T +M1(M#(`M#)'4\A?9T#3B#S0```'0P]L$/="L/MT-,4&H!4_]T)"CH'+D``(3` +M=`V%[702BT0D%.FQ_O__QD-0`8/(_^M0BT,LA(-6?`"`?BH`=0U74XV.N````.BNWO__Z*`Z``!?7EO""`!1,\")#"2) +M`8E!!(E!"(E!#(A!$(E!%(E!&(E!'(E!((A!)(E!*(E!+(E!,(E!-(A!.(E! +M/(E!0(E!1(E!2(A!3(E!4(E!5(E!6(E!7(A!8(A!9(O!6<-5B^QDH0````!J +M_VB!'T,`4&2))0````!6B_&#/@!T&H!^$`!T#&M&"`Q0_S;HC2```/\VZ%%I +M`0!9BTWT9(D-`````%Z+Y5W#5HOQ5S/_.7XL=B=3B]^+1BC_=`,$Z"=I`0"+ +M1BC_=`,(Z!MI`0!'C5L,65D[?BQRW5N-3E#HLDT``(U./.BJ30``C4XHZ&W_ +M__^-3A3HFDT``%^+SE[ID4T``(M$)`16B_$!1@2+3@0[3@@/AJH```"+1@Q3 +M5;U0#T0`5X7`=!H[R'864&C8-4,`5>A[GO__@\0,B\WHY9[__XM&"(M>!,'H +M`H/`(`-&"#O8=P*+V(O#P>`"@'X0`%!T0NB&:`$`B_A9A?]U!XO-Z+&>__^# +M/@!T0(M&",'@`E#_-E?H$2__^)/E]=B5X(6U["!`"+1"0$5HOQ`48$ +MBTX$.TX(#X:D````BT8,4U6]4`]$`%>%P'0:.\AV%E!HV#5#`%7HMYW__X/$ +M#(O-Z"&>__^+1@B+7@3!Z`*#P"`#1@@[V'<"B]AKPPR`?A``4'0^Z,1G`0"+ +M^%F%_W4'B\WH[YW__X,^`'0\:T8(#%#_-E?H428!`&M&"`R#Q`Q0_S;HQ1X` +M`/\VZ(EG`0!9ZQ;_-NB/9P$`B_A9687_=0>+S>BNG?__B3Y?78E>"%M>P@0` +M58OLBU4,@^P,@#H`4U97B]ET>(M%"%*)1?3H];4!`%F+31")1?B+111J(E^% +MP'0RC5#_C111#[:%P'0.9CE\0?YU +M!S/29HE40?XSTF:)%$%F.3EU`X/!`E'H1Z(!`%%1B_R)1?R-=?2-2RBEI:7H +M0@L``%]>6XOE7<(0`,S,58UL))"+17B![*````"+"(M%?%97:_D,BS"-1=!J +M4/^W6.%#`%#HVRX``(U%T&HZ4.@Z1P$`65F%P'0#Q@``:_8,C44@:E#_MECA +M0P!0Z+,N``"-12!J.E#H$DC65P7 +MPQO`@^#^0%[#S(M$)`2+#90/1`"+$(M$)`B+`&O`#/]T"`1KP@S_=`@$Z)N- +M`0!96SP +M````C840____5O]U#(OQ_W4(:&0Y0P!J4%#H.6O__X/$%(U%L&I04(V%$/__ +M_U#H0T0``/]U%(U%L(O._W404.@,`0``7HOE7<(0`%6-;"2<@>RL````5HOQ +M@WXL`'<',L#II````(-]=`"+16R)15R-10C&10@`B45@=`YJ4(U%N%#_=73H +M[$,``(M%<(/H`'0N@^@!=!"#Z`%U-(U%N%!H8#E#`.L)C46X4&A<.4,`C44( +M:E!0Z%,+``"#Q!#K$&I0:%@Y0P"-10A0Z,XK``!HH-)``&H$_W88C458_W84 +M4.BKA@$`@\04A<`/A&[___]K``S_=7S_L%CA0P#_=7CH\XP!`(/$#+`!7HUE +M9%W"%`!5B^R#[%"-1;!6:E!0_W48B_'_=13_=0CH'/___X3`=!;_=1"-1;"+ +MSO]U#%#H#````(3`#Y7`7HOE7<(4`%6+[(/L#%>+^8-_+`!W!#+`ZSIHD--` +M`&H$_W=4_W=0_W4(Z!F&`0"#Q!2%P'3@5FLP#/]U$`-W*(U]]*6EI?]U_/]U +M#.A?*P``L`%>7XOE7<(,`%;_="0(B_'H&0```(O.Z#H'``"`?F0`7G0(:@'_ +M%3@A1@#"!`"X]R%#`.A)#P$`N/A"``#H&Q`!`%-65VI<6%#_=0B+\8E%P(EU +MQ.CN00$`63/;AC_ +M_U?_=0@SR6:)"(V%).W__U#HH"H``.L.:``(``#_=0A0Z+@J``"-C?S<___H +M,L'__VH$C84D[?__B5W\4(V-_-S__^BUQ/__A,`/A+T#``"+^SD]].5#`'8< +M5XO.Z#<&``!7C4X4Z"X&``!'.SWTY4,`L!BT7P`_B)?>#K!HM%\(M]X(M-V%.#P?`#P8V-_-S__U-0Z+_&__^+1=1` +MB474/0`!```/@MC^__^#__\/A#0"``!3B\>-C?S<__^94E#HD\;__V@"`"`` +MZ%Q@`0"+^(E]Y%F%_P^$"P(``&@``"``5XV-_-S__^@JQ?__B\B*1>N)3>"$ +MP'0'T>F)3>#K.(T$30(```!0Z!U@`0")1=!9A<`/A,X!``"+3>"('#E!45!7 +MZ/$]``!7Z/=?`0"+?=!9BTW@B7WDN```$``[R'<"B\$SR6ID9HD,1XV%M/[_ +M_VCT.$,`4.@!*```:`(``@#HQ%\!`(E%\%F%P'4,5^BQ7P$`6>EM`0``@WW@ +M`(O+B].)3>R(G7S___^+^XE5V`^&X@```,=%S`T```#'1<@*````QT70"0`` +M`(M%Y(7_#X0-`P``#[=4>/YF.U7,=`IF.U7(#X7X`@``:CI99CD,>`^%[P$` +M`(MUY(/(_XE%U,=%L/@X0P#'1;0(.4,`QT6X&#E#`,=%O"0Y0P")7=S_=)VP +MZ`%?`0!0_W2=L(U.`HE%W(T,>5'H8H$!`(/$$&H@6H7`=1:+3=P#SV8Y5$X" +M=PJ+PXUY`8E%U.L#BT740X/[!'*ZBW7$,]N%P`^%L@```&ID:/0X0P"-A;3^ +M__]0Z/P[?>`/@CG___^+1?"+5=A14(V%?/___XO.4%+H./?___]U +MY.B47@$`_W7PZ(Q>`0!963E>+'884XU./.C*`@``4XU.4.C!`@``0SM>+'+H +MBT8H:##30`!J!/]V0*.4#T0`_W8\Z#6#`0!H8--``&H$_W94_W90Z".#`0"# +MQ""-C?S<___HA;W__XM-]%]>6V2)#0````"+Y5W"!`"+1>0/CKD````/MPQX +M9CO*=`9F.TW0=0-'Z^Z-%'B)7=QJ(%B+RV8Y`G8?@_ECS]__^-A1C___]J9%"-A>S]__]0Z,<] +M```#?=R+1=2#^`-U(8V%[/W__V@X.4,`4.BV70$`]]A9&L#^P%F(1F3IS/[_ +M_X/X`;A`.4,`=`6X2#E#`(V-&/___U%0C86T_O__:F10Z`X%``"#Q!#IG_[_ +M_XT$>(E%W`^W`%#H2R0``(3`#X3?````:F3_==R-A23]__]0Z,DE``"-A23] +M__]H4#E#`%#H_'\!`(E%W%E9A<`/A+`````SR6:)"(V%4/[__VID4(V%)/W_ +M_U#H#CT``&IDC86T_O__4(V%&/___U#H(24``&IDC850_O__4(V%&/___U#H +MY20``&HRC848____4(V%?/___U#H]R0``&@0TT``:@3_=@2-A1C_____-E#H +MTG\!`(/$%(7`=`QK``R+@%#A0P")1=B+1=R-C23]__\KP='X0&H@`_B+1>1: +M#[<,>&8[RG0*9CM-T`^%K/W__T?KZHM-[(M%Y`^W%'A'9H72#X2A_?__9CM5 +MP'5.@?D```$`#X.&_?__#[<$>(/H(G0E@^@Z=!R#Z!)T$X/H!'0*2(/H`74T +M:@GK#FH-ZPIJ"NL&:ESK`FHBBT7P6F:)%$A!B4WL1^E$_?__:@U89CO0="1J +M"EAF.]!T'('Y```!``^#*/W__XM%\&:)%$A!B4WLZ1C]__]1_W7PC85\____ +MB\Y0_W78Z%OT__^(G7S___^+RXE=V.O65FH!B_'HPO+__XM6!(L.BT0D"%Z) +M1)'\P@0`5E=J`8OQZ&KS__]K5@0,BSZ-="0,@\?T`_JEI:5?7L(,`%9J`(OQ +M_Q6`,$,`:@5H.#E#`%#_%80P0P"%P'0$QD9D`5[#@'ED`'0>:NS_="0(_Q5` +M(48`#0``0`!0:NS_="0,_Q4\(48`P@0`@>Q`"0``4U565_^T)%@)``"-A"2T +M````B^EH=#E#`&I04(EL)"SH\6'__X/$$(U$)&!J4%"-A"2X````4.CY.@`` +MC40D8%#H05L!`(N\)%@)```SVUF)1"04.1WTY4,`=EN^5.%#`(,^`'9%4/]V +M!(U$)&A0Z,.#`0"#Q`R%P'4L:``$``"-A"14`0``B\U0_W8$Z'WW__^$P'01 +MC80D4`$``%#_-E?_%5`A1@"+1"040X/&##L=].5#`'*JC40D%(O-4(U$)!Q0 +M_[0D8`D``.AF]?__BMB-1"0L4%>(7"0;_Q5$(48`C40D4%!7_Q5((48`BTPD +M-"M,)"R+="0X02MT)#"+P8M4)%A&B^['1"0D9````"ML)%PKPHE$)"B$VP^$ +MG0```("\)%P)````#X7.````#Z]4)!AJ9%N+PIGW^XO8BT0D7`^O1"04`UPD +M*"O+B5PD/)GW?"0D`\6)1"0@B\$K="0@F2O"B]B+QIDKPM'[B_#1_@-T)#`# +M7"0L>0(SVX7V>0(S]FKP5_\50"%&`,'H"O?0@^`"#00"``!0_W0D)/]T)$16 +M4VH`5_\55"%&`(U$)"Q05_\51"%&`(I<)!.`O"1<"0```'4UBTPD'(V$)%`! +M``!H``0``%!H@#E#`/^T)&0)``#HSO3__X3`=`^-A"10`0``4%?_%5PA1@!J +M"/\53"%&`&H%5ROH_Q4T(48`B_B)?"0B`>0$`@\0$+@<&8#T0`4?]T)`SH`P```,($`%6+[%:+ +M=0PSP%!0_W40N>@.1`!FB096_W4(Z%'T__^$P'4J_W405O]U"/\UT`Y$`/\5 +M,"%&`(7`=1/_=1!6_W4(_S74#D0`_Q4P(48`B\9>7<(,`(`]H$]$``!6B_%U +M!>@(````QD8!`8O&7L-5B^R![`0#```SP%,SVT-6B].^&P$``(B4!?S\__^( +ME`7[_?__B(05_/[__T")1?R+PB2`#[;(C002]]D;R2/.,\B+1?PST3O3=L",]*-!!(SP@/`,\(#P#/"`\`ST(O*@?$`8P``P?D( +M,\J(BZ!/1`"(#)W!740`B`R=P%U$`(@,G<-91`"(#)W`640`B`R=PU5$`(@, +MG<)51`"(#)W"440`B`R=P5%$`(3)=!4/ML$/MH0%_/[__P^VA`45_?__ZP(S +MP(@$G<-=1`"(!)W"640`B`2=P55$`(@$G(#,];!X@(SU@/2B\+!^`@/ML@/ +MML(SR(/Q!0^VA`W\_O__C8W[_?__*\B*$>L",M*(DZ!01`"$TG05#[;"#[:$ +M!?S^__\/MH0%9/W__^L",\`/MLJ(!)W";40`B`2=P6E$`(@$GK]___K`C/` +MB`2=P6U$`(@$G40`B`2- +MPW5$`(@$C<)Q1`"$TG02#[:$#?S^__\/MH0%V_W__^L",\"(!)W#;40`B`2= +MPFE$`(@$G<%E1`"(!)W`840`0X@$C<-]1`"(!(W">40`B`2-P75$`(@$C6XOE7<.#["!35HOQN````(`SR0^B5XU\)`R)!S/` +MB5\$0(E/"(E7##/2BTPD#('A____?SO()7P2)3PB)5PR+1"04 +MP>@9)`$STH@&ZP*(%HM$)#B+^BV`````=".#Z$!T$(/H0'4C:B#'1@0.```` +MZQ=J&%_'1@0,````B]KK$&H0QT8$"@```%^+VH7_="-5BVPD.(O#C4PD$(/@ +M`XO3`\C!Z@**!"M#B`21.]]RY3/278M,)#R%R741:A!2C48(4.C<$`$`@\0, +MZPV*!`J(1!8(0H/Z$'SSC40D#(O.4.A)!@``@'PD,`!U!XO.Z(<%``!?7EN# +MQ"#"$`"+5"0,BTPD!%:+="0,BP8S`HD!BT8$,T($B4$$BT8(,T((B4$(BT8, +M,T(,B4$,7L(,`(/L7%57BWPD;(OIB6PD)(7_#X2C!```P>\$@'T``(E\)&QT +M$_]T)'!7_W0D<.B0!```Z8,$``"-10AJ$%")1"0XC40D7%#HBA$!`(/$#(7_ +M#X11!```BU0D:%-6C4((B40D)(M$)'@KT(E4)#2-2`B)3"0HBW4$@\+XB\8# +MRL'@!(/`&(E,)#`#Q5!1C40D5%#H./___XM4)$P/MDPD4P^VPHL@(P>D8#[;`P>L0BPR-P&U$ +M`#,,A@0#[;`,PR%P&E$``^VPL'J"#,,A@(#[;`,U0D&(M=+#-< +M)!2*@*!01`"(1"0]B\+!Z!`/ML"+="0@B50D5(E<)%"*@*!01`"(1"0^B\/! +MZ!B)3"18BH"@4$0`B$0D/P^VPXJ`H%!$`(A$)$"+QL'H"`^VP(J`H%!$`(A$ +M)$&+P<'H$`^VP(J`H%!$`(A$)$*+PL'H&(J`H%!$`(A$)$,/ML+!Z@B*@*!0 +M1`"(1"1$B\/!Z`@/ML#!ZQ"*@*!01`"(1"1%B\;!Z!`/ML#![AB*@*!01`"( +M1"1&B\'!Z!B*@*!01`"(1"1'#[;!BH"@4$0`B$0D2`^VPHM4)#PS51B*@*!0 +M1`"(1"1)#[;#BH"@4$0`B$0D2HJ&H%!$`(A$)$N+="1`BUPD1(M$)$@S120S +M=1PS72"`?0$`B40D('04,U0D7#-T)&`S7"1D,T0D:(E$)""+1"0PBP")1"1< +MBT0D)(M(_(E,)&"+"(E,)&2+2`2#P!")3"1HBTPD*(E$)"2)4?B+5"0@B5$$ +MBU0D-(EQ_(D9@\$0@^\!B4PD*(E\)'0/A<_[__]>6VH0C40D6%#_="0XZ!X- +M`0"#Q`Q?78/$7,(,`%&+T5:+="005XM\)!B-0AB)1"0(#Q!2"(7V=&2+3"00 +MB\&#P1")3"00BTH$#Q`8B\'!X`0#1"0(20\0"&8/[\N%R7X9B\'!X`0#1"0( +M#Q``28U`\&8/.-[(A6<(,`(/L(%57B^DS_T>);"04B7PD"#E]!`^.DP```%.- +M72A6B5PD%(U#`C/VB40D&(U\)""+Z&H$`_Y;#[9%`0^V3?^*E(;`?40`#[9% +M_C*4CL!U1``RE(;`<40`#[9%`(UM!#*4AL!Y1`"(%XU_!(/K`77'BT0D&$:# +M_@1\LHM<)!2-1"0@:A!04^C]"P$`BWPD'(/$#(ML)!Q'@\,0B7PD$(E<)!0[ +M?00/C'C___]>6U]=@\0@PX/L*%-55HOIC40D%%=J(/]T)$"+=02#[@:);"08 +M4(ET)"#HK@L!`(/$##/;,_\STH7V?D4[700/CYD!```[UGTLC6PD&(ULE0"# +M_P1]&XMT)!"-#)^+10!"@\4$1XE$CAB+="04.]9\X(ML)!"#_P1U`T,S_SO6 +M?+L[700/CU0!``"ZH%%$``^V1+05BDPD&#*(H$]$`(A,)!@/MD2T%HJ`H$]$ +M`#!$)!D/MD2T%XJ`H$]$`#!$)!H/MD2T%(J`H$]$`#!$)!N*`C!$)!A"B50D +M%(/^"'0O@_X!#XZD````C4;_C50D'(E$)!`SR8I$"OPP!`I!@_D$?/.#P@2# +M;"00`77GZWZ-3"0L/MD0D +M)(U,)"S'1"00`P```(J`H$]$`#!$)"@/MD0D)8J`H$]$`#!$)"D/MD0D)HJ` +MH$]$`#!$)"H/MD0D)XJ`H$]$`#!$)"MJ!%J*0?PP`4&#Z@%U]8-L)!`!=>LS +MTH7V?C\[701_/3O6?2J-1"08C020B40D$(/_!'T=BP"-#)^)1(T80HM$)!"# +MP`1'B40D$#O6?.&#_P1U`T,S_SO6?,$[702+5"04#XZQ_O__7UY=6X/$*,($ +M`%:+\6BT-4,`QH8!`0```.@9`@``B\9>PU:+\8,^`'0(_S;_%8@P0P`SP(D& +MB48(B48,7L/I;@```%6+[('L``(``(V%`/___U-6OH````!64.AD````BTT( +MC84`_O__5E#H5````(V%`/[__U"-A0#___]0Z.5*`0!9B]B-A0#___]9]]M6 +M&MM0_L/HZ`$``%:-A0#^__]0Z-L!``!>BL-;B^5=P@0`:``!``!1QH$``0`` +M`.B_`0``PX"Y``$```!T)%:+="0(5XM\)!!J`%=6:(````!1Z%4````SP&:) +M1'[^7U[K"8M$)`0SR6:)",((`%:+\8!^!`!U,VB<.4,`Z/\4``")!H7`=!]H +MM#E#`%#_%8PP0P!HR#E#`/\VB48(_Q6,,$,`B48,QD8$`5[#58OLBT4,5HMU +M%%>+^3O&<@*+Q@/`4/]U"/]U$.BC"`$`#[:'`0$``(/$#%#_=1B-!#90_W40 +MZ`8```!?7EW"%`!5B^Q6BS7(@40`A?9U$+G`@40`Z&G___^+-+?"0,,\"+\68Y!W47:``!``!05HB&``$` +M`.A'!@$`@\0,ZR!J`6B`````5E?&A@`!```!Z,!(`0!90(O.4%?HOO[__U]> +MP@0`BT0D!(7`=!&+3"0(A8):,\W!S@(# +MR@/!B40D*(M$)"#_,.AD<@$`BTPD)(M4)"S!P@6!PIEY@EJ)`0/0BT0D)(O. +M,\LC3"0HP4PD*`(SR_]P!`/*`^GH,'(!`(M,)"B+U8-$)"@4P<(%B4$$!9EY +M@EH#T(O.BT0D)#-,)"R#P`4C3"0PP4PD,`(SSHE$)"0#RHT$AP/9_S")1"0\ +MZ.IQ`0"+3"0\B].#Q!3!P@6)`8M,)!PS3"0@`]"+1"0H(\TS3"0<@<:9>8): +M`\K!S0(#\8-\)!0/#X73_O__BU8):`\'!S@*) +M1"08B\C1PHO&,\/!P04C1"00@<&9>8):`\J)5PB+5RPSPS-7%`/!,U<,`\6+ +M;"00B\@S%XE$)!R+QL'-`C/%B6PD$(ML)!@CQ='",\;!P04%F7F"6@/*B5<, +M`\$#P\'-`FH16HE$)!2);"08B50D*(U"!8O8B40D,(U*^XO"@^$/C6H#@^`/ +M@^4/@^,/B6PD+&H/BQ2/,Q2',Q2?,Q2OBT0D%#-$)!R+3"08T<*)%*^+;"0@ +M,\7!P04%H>O9;@/*P +M(\8CSB/N(]Z+="0DB6PD-&H/BQ2.,Q2&,Q2>,Q2NBT0D%#-$)!R+3"08T<*) +M%*Z+;"0@,\4#PL'!!0/'P#P`*#Y@^#X`^+%(J+3"0D,Q2!,Q29,Q2QT<*)%)F+3"00BUPD(,'!!8'! +MUL%BRHO#,T0D'#-$)!0#PL'+`@-$)!@#P8E<)""+7"0DB40D&(M$)"B-2/B# +MP/Z#X`^#X0^+%(LS%(,S%+N+1"0TBTPD&,'!!8'!UL%BRC,4@]'"B12[BWPD +M((O',T0D$#-$)!3!3"00`@/"`T0D'`/!B40D'(M$)"B-2/F#X0](@^`/BQ2+ +M,Q2#B\75N#Q"C"$`"#[$135597BWPD6&HX6XMW&(MO&(/F/XM' +M'`^DZ`/!Y0/&1#X@@$:)1"00._-T2G8<:D!9._%S$RO.C4<@40/&:@!0Z%3] +M``"#Q`PS]H7V=1%J`8U'(%"-1"0<4%?H.??__RO>C4<@4P/&:@!0Z"K]``"+ +M1"0<@\0,4.B!:@$`58E'6.AX:@$`65F)1UR-1R!J`5"-1"0<4%?H_?;__XM, +M)%R+]VH%*_%:BP0.B0&-202#Z@%U\U?H"@```%]>75N#Q$3""`"+1"0$@V`8 +M`(-@'`#'``$C16?'0`2)J\WOQT`(_MRZF,=`#'94,A#'0!#PX=+#P@0`@^Q` +M4XM<)%!65XM\)%"+3QB#X3\!7QB#5QP`C009@_@_=E55:D!>*_&-1R!6_W0D +M7`/!4.C,_0``@\0,C4<@:@%0C40D&%!7Z%?V__^-;C_K'8M$)%B#P,%J``/% +M4(U$)!A05^@[]O__@\9`@\5`.^MRWS/)7>L",_8[WG88BT0D5"O>`\934(U' +M(`/!4.AR_0``@\0,7UY;@\1`P@P`@^Q(4U6+;"145HMT)&!7BTT8:C]?(\\! +M=1B#51P`C00Q.\=V>FI`6RO9C44@4_]T)&0#P5#H+/T``(/$#(U%(&H!4(U$ +M)"!05>BW]?__C4,_.\9S1HM$)&`K^(E\)!2-%`.)5"00:@!2C40D(%!5Z)'U +M__^+5"00C70D&(M$)!2+^FH0@\)`@\-`6?.EBW0D9`/"B50D$#O&L" +M,]L[\W88BT0D8"OS`\-64(U%(`/!4.BL_```@\0,7UY=6X/$2,(,`%%35597 +MBWPD&&HX6XMW((MO((/F/XM')`^DZ`/!Y0/&1#XH@$:)1"00._-T/W8<:D!9 +M._%S$RO.C4[QT`(!;P@0`4XM<)!!6BW0D +M#%>+?B"#YS\!7B"#5B0`A=MT.55J0%TK[SO==P*+ZU7_="06\(,`('L'`$``%-5 +M5E>+O"0P`0``,_:-7RC_,^CT9@$`B42T,(U;!$99@_X0+S3/P]]$C +M3"08B\7!R`8S\(O"(\6+;"0@,\B+1"08`_&)5"08`[-0.D,`B]<#=!PL@\,$ +M`W0D)(E$)"0#[L'*#8O'P<`*,]"+Q\'(`C/0BT0D%(O((T0D$#-,)!`CSS/( +MBT0D$`/1B7PD$(M,)!2)3"0@B40D%(T\,H'[``$```^":/___XE\)!R+O"0P +M`0``BTPD'`$/BTPD$`%/!(O(`4\(BTPD(`%/#(M,)"@!3Q2+3"08`4\8`6\0 +MBTPD)`%/'%]>75N!Q!P!``#"!`!5B^R+30R+10@Y311_#'P%.440#H2R'___]UY(M=X%/_=0CH[````.L#BUT(BWT,5E=3Z`48``"-3>#H+1?_ +M_UN%]G0',\!FB41W_HM-]%]>9(D-`````(OE7<(0`%%6BW0D#%?K`X/&`@^W +M!E#H!`$``(3`=?`/MSYFA?]U!S/`Z8@```!358ML)!PSVXK#:B*(1"076H3` +M=10/M\=0Z-,```"$P'57BD0D$VHB6F8[^G4I9CE6`G48A>UT#XM$)"!(.]AS +M!F:)5%T`0X/&`NL>A,`/E,"(1"03ZQ>%[703BT0D($@[V',&9HE\70!#BD0D +M$X/&`@^W/F:%_W68A>UT!S/`9HE$70!=B\9;7UY9P@P`5E?_="0,Z(PY`0"+ +M?"080%D[^'8"B_B+="005U;_="04_Q4L(48`QD0^_P!?7L(,`(M$)`2#^$%\ +M!8/X6GX(@\"?@_@9=P4SP$#K`C/`P@0`BT0D!(/`T&H)63O(&\!`P@0`@WPD +M!"!T"X-\)`0)=`0SP.L#,\!`P@0`9HM$)`1F@_AI=05J25CK"0^WP%#HN!H` +M`,($`(/L=(M4)'PSR5.+7"1\0556,_:)3"0,5XO^.]9_%'P$.]YS#O?;B^F) +M;"04$];WVNL&B^Z)="04*:PDE````(NL))0````[S7,F5FH*4E/H?.H``(/! +M,(E<)!QFB4Q\((O8BTPD$$=!"\*)3"00==:+;"04A>UT"6HM6&:)1'P@1XN4 +M))````"%_W03C4Q\'F:+`8U)_F:)!')&._=R\3/`9HD$>E]>75N#Q'3"$`!6 +MBW0D"%;H1C@!`%F+3"00.\AV#RO(`\91_W0D$%#H!````%["#`"+3"0,AP@P`BTPD#(7) +M="J+1"0$5H/I`70:BU0D#"O0#[PSR6:)"%[" +M#`!15HOQ,\")="0$B0:)1@2)1@B)1@R(1A#HN````(O&7EG#4U97BWPD$(O9 +MA?]U!;^T-4,`BW,$5^C@-@$`64"+RU#H_!7__XL#5XT$<%#H'5D!`/]#&%E9 +M7UY;P@0`58OL48U%_%#H!P```(M%_(OE7<-6B_&+3A0[3@1R#XM$)`B%P'0# +M@R``,L#K'HL&5XT\2%?HA38!`$`!1A2+1"00687`=`*).+`!7U["!`!5B^Q1 +MC47\4.BW____A,!T$/]U#/]U_/]U".C^_O__L`&+Y5W""`!6B_ A0`Z)$[ +M__^#9A@`@V9<`%[#@V$4`,-5B^R#[!!35HUU\#/)N````(`/HHD&B5X$B4X( +MB58,BW7P:@>!YO___W]8._!R'S/)#Z)7C7WPB0>)7P2)3PB)5PSV1?0@7W0% +M:@58ZU&#_@%R2C/`C77P0#/)#Z*)!HE>!(E."(E6#/=%^```"`!T!&H$Z];W +M1?@``@``=`1J`^O)]T7\````!'0$:@+KO/=%_`````)T!3/`0.L",\!>6XOE +M7<-5B^R#[!!3,]MFQT7T``6-1?B)7?!04U-34U-3:"`"``!J(&H"C47P4/\5 +M&"!&`(O(B4W\AB^5=P@0`N,BS +M``#H?.(``%-55E=H8#M#`#+__Q6`,$,`B_"%]G1D:'0[0P!6_Q6,,$,`BIPD +MW+,``(OXA?]T&`^VR_?9&\F!X;0U0P!1B\__%6`R0P#_UVB(.T,`5O\5C#!# +M`(OPA?9T(3/)A-L/E,%)@>$`^/__@<$`$```48O._Q5@,D,`_]:W`:&`X$,` +M@\W_QT0D%*0[0P"^``@``,=$)!B\.T,`QT0D'-@[0P"`.'C'1"0@\#M#`,=$ +M)"0(/$,`QT0D*"`\0P#'1"0L.#Q#`,=$)#!0/$,`QT0D-&P\0P#'1"0X?#Q# +M`,=$)#R0/$,`QT0D0*@\0P#'1"1$P#Q#`,=$)$C8/$,`QT0D3/`\0P#'1"10 +M!#U#`,=$)%0$)(0```!`/D,`QX0DB````%@^0P#'A"2,````<#Y# +M`,>$))````",/D,`QX0DE````*0^0P#'A"28````O#Y#`,>$))P```#@/D,` +MQX0DH````/@^0P#'A"2D````$#]#`,>$)*@````@/T,`QX0DK````#P_0P#' +MA"2P````5#]#`,>$)+0```!P/T,`QX0DN````(@_0P#'A"2\````I#]#`,>$ +M),````"T/T,`QX0DQ````,P_0P#'A"3(````Y#]#`,>$),P```#X/T,`QX0D +MT````!!`0P#'A"34````*$!#`,>$)-@```!`0$,`QX0DW````%A`0P#'A"3@ +M````<$!#`,>$).0```",0$,`QX0DZ````*A`0P#'A"3L````Q$!#`,>$)/`` +M``#<0$,`QX0D]````/A`0P#'A"3X````$$%#`,>$)/P````P04,`QX0D``$` +M`$1!0P#'A"0$`0``7$%#``^$S````%#H-&T!`(OX687_#X2[````5HV$)!03 +M``!0:@#_%7PP0P`SP%!0:@-0:@%H````@(V$)"@3``!0_Q4D,$,`B_`[]71\ +M:@!J`%=6_Q54,$,`.\=U;&H`C40D%%!H_G\``(V$).0S``!05O\52#!#`(7` +M=$V+1"00T>@SR6@$`0``9HF,1-PS``"-A"0,`0``4(V$).`S``!0ZQN-A"0( +M`0``4.@F_/__:`0!``"-A"0,`0``4%?H9O?__XOXA?]UVE;_%1@P0P"^``@` +M`%:-A"04`P``4&H`_Q5\,$,`5HV$)!0#``!0Z`NW__]0C80DX",``%#HI?G_ +M_S/_,_;H4*?__ST`!@``<@O_=+04Z+O[___K`C/`AL$BWRT%(3_=38S]F@`"```_W2T.(V$ +M)!@#``!0Z.*V__^-A"00`P``4/\57#!#`#O%=0A&@_XU+\6I`7XD&.\=V +M`HD^,^TSVT4Y'G4"B2Z)G@0!```Y/G8"B3Z-AB`#``"(GA0#``!0_Q7(,$,` +M4U=34_\5[#!#`%-555.)AA@#``#_%>@P0P")AAP#```YGA@#``!T!(7`=1MH +MN$)#`+]0#T0`5^A89/__65EJ`HO/Z$AD__]?B9X,`P``B\:)GA`#``")G@@! +M``!>75O"!`!5B^QDH0````!J_VB!'T,`4&2))0````!35E>+\>BY`@``,__& +MAA0#```!5VI`_[88`P``_Q7@,$,`.;X$`0``=AZ-7@3_,^BG````_S/_%1@P +M0P!'C5L$.[X$`0``0P0P"#^/]U)U;_ +M%0`P0P!0:O]H4$)#`+Y0#T0`5N@48___@\00B\YJ`N@#8___7L($`%%35HOQ +M,]LY'G9P55>-?@2-1"004&H`5FB@#$$`:````0!J`/\5P#!#`(OHA>UU)V@H +M0D,`:%`/1`#HQ6+__UE9N5`/1`#H4V3__VH"N5`/1`#HJ&+__XDO_X8$`0`` +MH=B!1`"%P'0)4/\W_Q7$,$,`0X/'!#L>-OB`#``#_=?R+3?C_ +M%6`R0P#_5?A7_Q7,,$,`@ZX(`0```74,_[8<`P``_Q78,$,`5_\5T#!#`(U% +M^(O.4.@S____A,!UOU]>B^5=PU:+\8.^"`$```!T*_^V'`,``/\5W#!#`&H` +M_[8(`0``_[88`P``_Q7@,$,`_[8<`P``Z.']__]>PXM$)`0!`8M$)`@1003" +M"`"#[$A35597B_DSVU-J9/]W!/\WZ#[>``")1"08B50D'.AFH?__/0`&``!S +M$HU$)!!0C40D'%#_%0`Q0P#K:XU$)#A0C40D'%#_%0@Q0P"-1"1(4(U$)#Q0 +M4_\5]#!#`(U$)!!0C40D3%#_%?PP0P"-1"0@4(U$)#Q0_Q7\,$,`BTPD%#/` +M`TPD'"O#&TPD)"M$)"`;RP-$)!`3RP-$)!B)1"00$\N)3"04C40D*%"-1"04 +M4/\5"#%#`(MT)%PSVP^W1"0P0P^W3"0N#[=L)"H/MU0D*(E&#`^W1"0RB480 +M#[=$)#2)1A0/MT0D+(E&'(U!_XD6B6X$B4X(B48@.^MV(FH$NH3@0P!9@_DP +M=Q"+`H/!!`%&((/"!$,[W7+K#[=4)"B#_0)V#5+H/P```(3`=`/_1B!J`&@` +MRIH[_W<$_S?H@-T``%^)1AA>75N#Q$C"!`!J`&ID_W$$_S'H]=P``(M,)`2) +M`8E1!,($`/9$)`0#=2.+1"0$:F296??YA=)U$(M$)`2YD`$``)GW^872=04S +MP$#K`C/`P@0`58OL@^P85HU%Z(OQ4/\5\#!#`(U%^%"-1>A0_Q7\,$,`:@!J +M9/]U_/]U^.AJVP``B0:)5@1>B^5=PU6+[(/L)(M5"(O"@^`?@V7T``/`B47P +MB\+!Z`6#X#^)1>R+PL'H"X/@'XE%Z(O"P>@0@^`?B47DB\+!Z!6#X`_!ZAF) +M1>"!PKP'``"-1=R)5=Q0Z`8```"+Y5W"!`!5B^R#[$A3BUT(5E>+\6:+`V:) +M1=AFBT,$9HE%VF:+0PAFB47>9HM##&:)1>!FBT,09HE%XF:+0Q1FB47D,\!F +MB47F9HE%W(U%\%"-1=A0_Q7\,$,`A<`/A(H```#H]9[__S/_/0`&``!S%HU% +M^%"-1?!0_Q4$,4,`BT7\BTWXZU6-1.N^_S9HA0```.C@SO__4.N`_S9H!`(``.OO_W8$:(0```#KG/]V!&B#```` +MZY+_=@C_=@1HT@```.BPSO__4/\VZ!2?``"#Q!#IK0$``/]V!&IYZ6C_____ +M=@1HW````.E;_____S9HW0```.N;@_@X#X^Z````#X2M````@^@7@_@+#X=R +M`0``_R2%%Q1!`&C>````Z4K___]HX0```.E`____:+0```#H0,[__U#_-NDV +M____:FGK[VIJZ^O_=@1J:.GX_O__:&\$``#KVFAP!```Z]/_=@1H<00``.G= +M_O___W8$:G'IT_[___]V!&C(````Z/3-__]0C84`_O__:``!``!0Z,4L____ +M=@B-A0#^__]0:`Q#0P#_-N@XG@``@\0@Z=$```!J9^EX____@^@Y=$"#Z`%T +M-(/H`70B@^@)=!.#Z`$/A:T```!HA@```.E1____:$,#``#I1_____]V!&@& +M!```Z5'^__]J;^DS____:(P```#I*?___VA6!```Z1____\]@````'5JZ)"\ +M``"#?@0`="3_=@1HR@```.A%S?__4(V%`.K__V@`"@``4.@6+/__@\00ZQQH +M``H``&C)````Z!_-__]0C84`ZO__4.B7[?__:@!HE@```.@&S?__4(V%`.K_ +M_U#_-4R$1`#HW(T``%Z+Y5W#D%X100!($4$`;!%!`'D100"($4$`CQ%!`)81 +M00"@$4$`LA%!`+D100#`$4$`SQ%!`-@100#B$4$`N1-!`+D300"Y$T$`N1-! +M`.P100"Y$T$`#!)!`!8200!.$D$`6!)!`&(200!T$D$`>!)!`'P200"&$D$` +MC1)!`)0200"Y$T$`H1)!`*L200#IO\$``%6+[+@`%@``Z-?1``!35O]U"&B# +M````Z$3,__]0O@`)``"-A0#J__]64.@4*___@\00C84`_/__N5`/1`!H``(` +M`%#H%%K__X3`="96:!Q#0P"-A0#J__]0Z%_L__]6C84`_/__4(V%`.K__U#H +M2^S___\5`#!#`&HU:)8```"+\.C:R___4(V%`.K__U#_-4R$1`#HL(P``(/X +M!%8/E,/_%00P0P!>BL-;B^5=P@@`N``0``#H*M$``%-55HNT)!`0``!7:@)= +MBX8P80``.\5U"#/`0.GV````@+Z(80````^%VP```(/X`0^$T@```(N<)!@0 +M``"-1"00OP`(``!74U#HW>O___^T)"P0``"-1"04_[0D+!```/^T)"P0``#_ +MM"0L$```5U#HS<```(OXA?]T!#O]=193Z`6/__\[_74,QX8P80```0```.M_ +M@_\#=0N)KC!A``#I<____X/_!'5:C40D$%#HSZC__XN\)!P0``"-3"005SO! +MB\%04W4'Z"RI___K!>A7Z___4^B3C?__A,!T-O^T)"P0``#_M"0L$```_[0D +M+!```/^T)"P0``!74U;H]/[__^L2B\?K#O^T)!@0``#H=H[__S/`7UY=6X'$ +M`!```,(<`%6+[/]U)/]U(/]U'/]U&/]U%/]U$/]U#/]U".B.P```7<(@`/]T +M)`S_="0,:@#_="00Z*K```#"#`#IG)@``*!0A$0`PS+`PX!\)`0`_W0D"`^5 +MP(T$A50```!0Z$W!``#""`#IGL$``%-6BW0D$#/`5XM\)!BS`5=6:O__="0< +M9HD&4%#_%10Q0P#WV!K`(L.%_W0',\EFB4Q^_E]>6\(,`%6+[(/L%%97C47L +M,_905HOY_Q4,,4,`@WWL`0^7P(B'``$``%;_%1`Q0P"%P`^5P(@$/D:!_@`! +M``!RZ%]>B^5=PU6+[%8S]CEU$'8HBU4(5XM]#"OZ#[9*`0^V`L'A"`/!9HD$ +M%V:%P'0)1H/"`CMU$'+B7XM%#%Y=P@P`BT0D#%-55HMT)!"-:/]7BWPD&+,! +MZ3`!```/MM!&@?J`````#X+6````B\*#X.`]P````'4BB@Z*P23`/(`/A1(! +M``"#XA\/OL&#X#_!X@8+T$;IJ````(O"@^#P/>````!U.XH.BL$DP#R`#X7D +M````BF8!BL0DP#R`#X75````#[[)@^(/@^$_P>(&"\H/OL3!X0:#X#\+R(/& +M`NM?B\*#X/@]\`````^%IP```(H.BL$DP#R`#X69````BF8!BL0DP#R`#X6* +M````BGX"BL#X3_!X@8+R@^^Q,'A!H/@/PO(#[['P>$& +M@^`_"\B#Q@.+T8/M`7A3@?K__P``=C>#[0%X1H'Z__\0`'8$,MOK+(V"``#_ +M_X'B_P,``,'H"H'J`"0``"T`*```9HD'9HE7`H/'!.L&9HD7@\<"B@:$P`^% +MQO[__^L",MLSP&:)!XK#7UY=6\(,`%-6BW0D$#/`5XM\)!BS`5!05U9J__]T +M)"2(!E!0_Q48,4,`]]@:P"+#A?]T!<9$/O\`7UY;P@P`5HMT)`Q7,_^+SSE, +M)!1V'XM4)`R*`H@$3HI"`8A$3@%F.3IT"D&#P@([3"04P@P`BTPD +M"%-6BW0D%%>+?"003@^W!V:%P`^$[````(/N`0^(XP````^WT(/'`H'Z@``` +M`',%B!%!Z]B!^@`(``!S'(/N`7@7B\*`XC_!Z`:`RH`,P(@!B%$!@\$"Z[2- +M@@`H__\]_P,``'":+PL'H#`S@B`&+PL'H!H#B/R0_@,J`#("(00&( +M40*#P0/I3____X'Z```@``^#0____X/N`P^(.O___XO"P>@2#/"(`8O"P>@, +M)#\,@(A!`8O"P>@&@.(_)#^`RH`,@(A!`HA1`X/!!.D(____7U[&`0!;P@P` +M45-5BVPD$,9$)`L`9H-]`"UU"(/%`L9$)`L!#[=%`#/;:C!:,\EF.\)R-E97 +M9H/X.7/__ +M_P^W1"0$4/\5*"%&`,($`&K__W0D#&K__W0D$&@!$```:``$``#_%:@P0P"# +MZ`+""`!5B^Q65_]U".B0'0$`BW400%D[QG,._W4(Z'\=`0!9C7@!ZP*+_O]U +M#.AO'0$`0%D[QG,,_W4,Z&$=`0!9C7`!5O]U#%?_=0AH`1```&@`!```_Q6H +M,$,`7X/H`EY=P@P`5E>_@````(OQ5VH`5NB7V@``5XV&@````&H`4.B(V@`` +M@\08B\9?7L-1,\")#"2)@8Q*``")@40&``")@4P&``")@4@&``"+P5G#N%+\3/_1XEU\%>-3@3HN8W__S/;B5W\B5XDB5XHB5XLB5XP +MB%XTB5XXB5X\B5Y`B5Y$B%Y(B5Y,B5Y0B5Y4B5Y8B%Y-CHCF``#&1?P&Z%*-__^+10B+ +MSHF>F.8``(F>G.8``(F>H.8``(F>I.8``(B>J.8``(F>K.8``(F>L.8``(F> +MM.8``(F>N.8``(B>O.8``(F>P.8``(F>Q.8``(F>R.8``(F>S.8``(B>T.8` +M`%.)!HF>0$L``(B>1$P``&:)GE!,``"(GE),``")?AR)7A2)7B")7AB)GMCF +M``")GMSF``#H0BP``(M-](O&7UY;9(D-`````(OE7<($`,S,S,S,S,S,S,S, +M45:+\6H`B70D"(U.!.B(C/__@Z;42@```(O&7EG#S,Q6_W0D"(OQZ"0```#' +M!G150P"+QE["!`"#800`B\P@`QT$$.$-#`,`"4/\VZ%;2____-N@:&P$` +M68M-]&2)#0````!>B^5=PU6+[&2A`````&K_:($?0P!09(DE`````%:+\8,^ +M`'0<@'X0`'0.BT8(P>`$4/\VZ`O2____-NC/&@$`68M-]&2)#0````!>B^5= +MP^EK)@``@<&,2@``Z9`J``!6:@"+\>A;$@``BX9`2P``AZ?2*___,S,S,5HOQBX;42@``AZ=.*__]6BW0D"#NQ@````',$BP'K(3/2C8&$````0CLP<@U" +M@\`$@_H@L)BP21*T21?`/&7L($`%6+[/9%"`)DH0````!J_VB!'T,` +M4&2))0````!65XOQ=#%HL!Y!`(U^_/\W:.1*``!6Z(K'``#V10@!=!)I#^1* +M``"#P0115^A#S0``65F+Q^L:Z%/____V10@!=`UHY$H``%;HU\4``%E9B\:+ +M3?1?9(D-`````%Z+Y5W"!`#,S,S,S,S,S,S,S,Q6B_&-1@3'!FA50P!0Z$4! +M`0#V1"0,`5ET"FH,5NB3Q0``65F+QE["!`"+1"0$5HOQ`48$BTX$.TX(#X:J +M````BT8,4U6]4`]$`%>%P'0:.\AV%E!HV#5#`%7H>4[__X/$#(O-Z.-.__^+ +M1@B+7@3!Z`*#P"`#1@@[V'<"B]B+P\'@!(!^$`!0=$+HA!@!`(OX687_=0>+ +MS>BO3O__@SX`=$"+1@C!X`10_S97Z`_7``"+1@B#Q`S!X`10_S;H@<____\V +MZ$48`0!9ZQ;_-NA+&`$`B_A9687_=0>+S>AJ3O__B3Y?78E>"%M>P@0`4XO9 +M,\E6O@`@``!7.7-0+0``,\DYR)>P2).SE%$'<#BT404/]U#/^VE.8``.@GU@``C89DY@``@\0,B\B) +M1=CHW:3___9%"(!T'%/H1:7__XO8B5WPA=MU"E>+SNC[#@``ZPQ+ZP:+GM3F +M``")7?"+AISF``")1=P[V'=&.Y[$Y@``=SYJ.(F>U.8``.B)PP``B]B)7>!9 +MA=MT"(E[-(E[$.L%B]^)?>"+3?`[3=QU>H'Y`"```'8?:CA3Z(W#``!963+` +MBTWT7UY;9(D-`````(OE7<(,`(V.F.8``&H!Z-RM__]J..@OPP``B]")5>A9 +MA=)T"(EZ-(EZ$.L%B]>)?>B+CISF``"+AICF``!7B52(_(V.P.8``(N&G.8` +M`$B)0PSHS+K__^L/BX:8Y@``BP2(B47HB4L,B\>)?>0YAK#F``!V0HV.K.8` +M`(O?BQ&+R"O+BP2"B02*C8ZLY@``BQ&+1>0Y/()U`4.%VW0#B3R"0(E%Y#N& +ML.8``'+0B5WDA=N+7>!U(H&^L.8````@```/AR#___^-CJSF``!J`>@;K?__ +M,\!`ZP.+1>2+CK#F```KR(N&K.8``(DR)0R1T1HO.Z(.&___!Z`F+SFH'B47@Z%V&__^+5>"+ +MSXE-Y(U[%#/`0-/@A<)T#E;H^:+__XM-Y(M5X(D'08/'!(E-Y(/Y!W+=,_^+ +M1=PY1?`/A9(```!6Z-&B__^+\('^```!``^#\/W__X7V#X3H_?__BT7LBP@# +MSCM-$`^'V/W__U:-3<3HE>_^_XE]_(7V="R+3>R+`8/``ST`@```+^8"_J@````!U +M(L:'J@```/_H3@<``(N$G[@```"%P'0+BPB)C)^X````ZVZ-2RZ+PXT,CT"- +M202#^"9T)8,Y`'3R5HNTA[@```!34%:+#HF,A[@```"+S^BK(0``B\9>ZSC^ +MCZH````/MD0[!(N/7`$``&O0#(O!*X=0`0``.\)^%BO**9=4`0``BX=4`0`` +MB8]<`0``ZP(SP%];P@0`45%355:+="0@5XM\)!R)?"04BA:*PH3`#X3<```` +M/`)V9CP##X7,````@WPD(`.+J5A,``!V2FH"6VH$C5@'H"ZW4L#[9* +M`0^V`L'A"`/(B\7!Z`+!X0@KR`^V0O\#R(O!B$K_P>@(P>D0B`*(2@$#U@/N +MC0P3.TPD('+!B\?IK@```(N96$P``(#Z`FH$#Y3!@,'H7HA,)!,Y="0@=DR+ +MUHH'1T-"/.AT!#K!=3>+#XOK@>7___\`A!B-@0````&)!^L. +MC8$```#_A75M96<(,`%97B_F-MXQ*``"+SNB&(0``:@&+SN@A(0`` +M:@*+S^AJ(```7U[#:``!``"-@6P&``#&@6P*```!:@!0Z,C.``"#Q`S#55>+ +M?"04B^F%_W0C4XM<)!16BW0D%"O>C00SB\U0Z'[W__^*`(@&1H/O`77K7EM? +M7<(,`%%3BUPD%%6+;"005XL[*WPD&(E,)`R%[70R5HO'(T0D)%#H1O?___\S +MBTPD%(OPZ#GW__^*#D>("(L#BTPD$$`C1"0DB0.#[0%UT%Y?75M9PA``@>P( +M`0``4XO953/M5HN#4`8``$6`O"08`0```(NS1`8``%>+4`*-?"08=0Z#?@@` +MC7PD'(E$)!AT9(N,)"`!``"%R70%BW8(ZR&+=@AF.2YT%HN#4`8``(M.!(H` +MZP.#P08X`77YZP.-3@(Y40)U'(V$)!@!```[^`^#I@```(D/@\<$@WX(`'7` +MZP.+<0*-1"08._AU!XO&Z8D````/MRZ-0@&*"HE$)!(SP$"(3"009COH=$,[ +ML]Q+``!V9XM&!.L#@\`&.`AU^0^V4`$/MTX"2BO-*\J-+!([Z7<+:\(%.\@; +MP/?8ZPQKP0,ST@/)2`/%]_'^P.L#BD8#B$0D$8/O!(U$)!!0B\[_-U/HD58` +M`(OPA?9T#8U$)!@[^'7@Z7+___\SP%]>75N!Q`@!``#""`!55HOQBXY$!@`` +MBY;<2P``.\IV)(N&Y$L``#O(=QIF@SD!=!HY401V#SE!!'<*5NBP5P``A,!U +M#(/(_UY=PU;H;%8``+T`@```Z9P```"+CG!*``"+EGA*``"-!!$SP3T````! +M$H```C! +MX0@+P<&F<$H```B)AG1*``#KJHN&1`8``/^&7`8``(M("(F.1`8``#N.W$L` +M``^&<____SN.Y$L```^'9____P^W`3N&5`8``'3(5NA16```A,`/A$[___^+ +MEGA*``"+PHN.?$H```^OP0&&<$H``(N&@$H``"O!#Z_"B89X2@``@[Y0!@`` +M``^$+____X.^7`8```"+AE`&``!7#[8X=1F+0`([AMQ+``!V#HF&3`8``(F& +M1`8``.L7B\[H/5(``("^;`H```!U!XO.Z,7\__^+CG!*``"+EGA*``"-!!$S +MP3T````!$H```C!X0@+P<&F<$H```B)AG1*``#KJHO'7^E[_O__45-55HMT)!17B_F+ +MSNB$`0``B]C!Z`4D`8E$)!!T"XO.Z'`!``"+Z.L1@[^,2@```'4$,L#K9XML +M)!#VPT!T#8O.Z$\!``"+3"0+^0^V;#XI#[9$ +M/BH[Z'4&BT0D$.LU4XU&`5#HT/C__XO8A=MT(FO.#(MT)!115E/H9,L``(N$ +MK[@```"#Q`R)!HFTK[@```"+PUM?7EW""`!6BW0D"(V1@````#/`.S)R#4"# +MP@2#^"!R\S/`ZQ.+A(&`````*\8[1"0,<@2+1"0,7L((`%:+\8M.!('YXG\` +M`'X6B\[HZAT``(M.!('Y`(```'P$,\!>PXM&$`^V!`A!B4X$7L.#[`Q35HOQ +M,]M7BX:P````.X:T````=`*(&(U$)`R+^U6)1"08C9:X````B40D%+W__P`` +MZRN+"HL!B0*-1"00B4$(BT0D%(E!!(M$)!2)2`B)3"049HDI#[9$/@1FB4$" +M.1IUT4>#P@2#_R9\\XM4)!2-1"00.]!T2^LL#[=/`@^W0@(#R('Y```!`',H +MBT\(BT<$B4$$BT\$BT<(B4$(9HM'`F8!0@(/MT(":_@,`_IF.2]TQHM2!(U$ +M)!`[T'7GBU0D%%WIB0```(M*"(M"!(E!!(M*!(M""(E!"`^W3P*!^8````!V +M*(V1?____\'J!T)KPH`#R(N&3`$``(D'B;Y,`0``@<<`!@``@^H!=>)1"04Z&<6``"+;"0H,]LS_X7M='!6@_L@@%*_`[ +M="00<^3K1U9J`%#HJ<<``(M,)"0#_HM$)""#Q`R)!)F)O)F`````0SO] +M7UU;@\08P@0`._US\HU,)!SHCN[__V@$MT,`C40D(.L2C4PD'.AZ[O__:`2W +M0P"-1"0@4.@KZ@``S(/L%%.+7"0<5XOYA=MU"KE0#T0`Z"5`__^X```$`#O8 +MA^Q@`` +M@\0,@'PD#P!T0H._V.8```%R.8U+_S/;B4PD$$-6BW=\BY?8Y@``*_.+AT!+ +M``!*(]8CSD.*!`*(!"F+3"04.Y_8Y@``=M>+7"0H7HN'0$L``(7`=`=0Z-`( +M`0!9B:]`2P``C4/_B9_8Y@``B8?A?7L($ +M`%-6,]N+\5+^XF>Q.8``(F>U.8``#F>G.8``'8;BX:8Y@``:CC_ +M-+CHOK0``$=963N^G.8``'+EB9Z6\($`+B>(D,`Z(&T``!145-65XOY +M,]LY7R!U&;X`!$``5N@'MP``5E-0B4<@Z/G$``"#Q!`Y7Q@/A;L```"+=QPS +MR0/VNN1*``"+QHEU\/?B#Y#!]]D+R#/`@\$$#Y+`]]@+P5#HQ+8``%F)1>R) +M7?R%P'0;:+`>00!HT!Q!`%:-6`2),&CD2@``4^@(M0``@TW\_VG&Y$H``(E? +M&%!J`%/HA<0``(/$#(7V=$PSP(E%\(M?&`/8@[O42@```'4L:``,`P#'@]Q* +M````00``Z`H'`0")@]1*``!9A+V3/`:)@```!0B40D'(V#N``` +M`(E<)!A0Z/W#``"+JZP```"#Q`R)JU`!``"+&XO#F8/B!P/",]+!^`-J#%GW +M\3/2:_A4:@PKWXO#]_&-#"LSTD!K\`R+1"04B]@#]8F+7`$``(FP5`$``(FP +ML````(O'7_?W:@1KP`Q:4ED#QHF#M````#/`0(A$`P-`@^H!=?9`B$0+!$&# +MP`*#^0A\\T#K"(A$"P1!@\`#.\]\]$#K"(A$"P1!@\`$@_DF?/-JUS/`C7,J +M7XB#J@```"O[O8`````/MDP#!#/2C00W.\B+1"04#YS"`\*(!D:)1"04@^T! +M==]?7EU;65G#@>R(````C40D"%.+G"28````55:+M"2<````5VI`,_]74(D> +MZ/7"``"+K"2H````@\0,B\^%VW00#[8$*8/@#_]$A!A!.\MR\(T$&XE\)!A0 +MC8:(#```5U#HP,(``(U61(E^!#/`B3J#Q`R+]T"+VHE$)!"+Z`-TK!AJ$%DK +MS8O&T^`#]HE#Q(M$K!0#`T6)0P2-6P2#_1!RW&I`4HU$)&!0Z-?#``"+G"2P +M````@\0,B[0DH````(O7BZPDG````(7;=""*!"HD#W04#[;(BT2,6&:)E$:( +M#```0(E$C%A".]-RX('[*@$``'(<@?LK`0``=@B!^S(!``!U#,>&A`````H` +M``#K"L>&A`````<```"+CH0````SP$"+T-/BB50D%(72=&^-KH@$``!J$%DK +MCH0```"+U]/B@_@0-3@2-#($[$7()0(/!!(/X$'+SB40D$(B$/H@```"# +M^!!S)"L4AFH062O(T^H#5(9$.]-S$F:+A%:(#```9HE%`(M$)!#K!C/)9HE- +M`$>#Q0([?"04)="04B4PD$`/!B40D'#O(#X/'````:@-;BX[&8Y601U)HN&V.8``(M6?(/H +M!#O0W.8` +M`(N60$L``"/=BTY\18H$$X@$"HM&?(N>W.8``$`CPXE&?(/O`77:Z57^__\Y +M&0^%AP$``(M1"(MLEF");"08A=)T$XUZ&(T\OHM'_(D'C7_\@^H!=?.);F`/ +MMT$$B49T#[=Y!(M.?(O9BX;8Y@``*]T%_.___SO8#X,$`0``.\@/@_P```"+ +MAD!+```#V(TL"(T$.8E&?#E\)!AS28/_"')RB\_!Z0.*`X/O"(A%`(I#`8A% +M`8I#`HA%`HI#`XA%`XI#!(A%!(I#!8A%!8I#!HA%!HI#!X/#"(A%!X/%"(/I +M`77#ZRZ#_PAR*8O'P>@#B40D&(OP:@A35>A]OP``@\0,@\,(@\4(@^\(@^X! +M=>:+="04A?\/A&7]__^*`XA%`(/_`0^&5_W__XI#`8A%`8/_`@^&2/W__XI# +M`HA%`H/_`P^&.?W__XI#`XA%`X/_!`^&*OW__XI#!(A%!(/_!0^&&_W__XI# +M!8A%!6H#@_\,_?__BD,&B$4&Z0']__^%_P^$]_S__XNNW.8``(N60$L` +M`"/KBTY\0XH$*H@$"HM&?(NNW.8``$`CQ8E&?(/O`77:Z<;\__^#.0(/A0$! +M``"+?G2%_P^$M?S__XM.?(O9BX;8Y@``BU9@!?SO__\KVCO8#X.@````.\@/ +M@Y@```"+AD!+```#V(TL"(T$.8E&?#O7@#B40D&(OP:@A35>@&O@`` +M@\0,@\,(@\4(@^\(@^X!=>;IA/[__X7_#X3M^___BZ[+?"0HB^F);"08B5\,.%X(=1V+A80```"#Z`@( +MB\YJ"(E$)!CH#P`)! +MB4<,B4\$B\[H7&___\'H"(O.:@B)1"0@Z#5O__\Y7"00=CF+?"00B^N+SN@Y +M;___P>@(B\W3X(/%"(M.!`/8@\$(B\�?!Z`,!!HE.!(/O`775BWPD*(ML +M)!B+5"04B\O!^1"+P\'X"#+(B1\RRS+*@/%:.DPD'`^%,____XL&B4<(C4C_ +MBX6(`````\L[P7P"B\&)A8@```"*PL#H!B0!P.H'B$<0L`&(5Q%?7EU;@\00 +MP@@`4U97B_F-=P2+SNBH;O__BTX$B]`RV_?"`(```'0%L@%!ZPK!Z@ZS`2+3 +M@\$"B\&`\@'!Z`.#X08``(3;=`9?7C+`6\.+SU]>6^GJ```` +M5HMT)`A7B_F`?@@`=1:+AX0```"#Z!`Y!GX)Z(D.``"$P'1=4U:+S^A9```` +MBUPD%(O/5HE#!.A*````N0``0``[R!O)]]$CR(E+"(O.Z`AN___!Z`V+SFH# +MB`/HXVW__X`[`'48B\[H[FW__\'H"XO._L!J!8A##.C&;?__L`%;7U[""`!3 +M5HMT)`R+SE?HQVW__XM6!(OX@\("P>\.B\HSV\'I`X/B!P$.B58$@\;?__P>@(B\W3X(/%"(M.!`/8@\$(B\�?!Z`,!!HE.!(/O`775 +M75]>B\-;P@0`@>RL`0``5HOQ5XN&A````(U^!(/H&3D'?@WH$0T``(3`#X0! +M`P``BT8(B\_WV(/@!U#H(VW__XO/Z#-M__^I`(```'0BC8;$Y```QX97.8``(F>T)@``(F>U)@``*D` +M0```=15HE`$``(V&R.0``%-0Z-ZX``"#Q`QJ`HO/Z+EL__]5B\_HR&S__\'H +M#(O/#[;`:@2)1"04Z)YL__^+1"00@_@/=3>+S^BE;/__P>@,B\]J!`^VZ.A_ +M;/__A>UU!\9$'!0/ZQJ#Q0)-@_L4@#`0>#X0>)3P0/MXQ5B`0``.M@:@]90(E,)!`[P7,T-@\4#:@/K +M#^A8:___B^C![0F#Q0MJ!XO/Z#!K__^%VW1Y38'[E`$``'-?BD0<)XA$'"A# +MA>UUZNL^B\]U$>@B:___B^C![0V#Q0-J`^L/Z!%K__^+Z,'M"8/%"VH'B\_H +MZ6K__TV!^Y0!``!S',9$'"@`0X7M=>V-KE`\``"!^Y0!```/@H?^__^+!\:& +M8>8```$[AH0```!^!#+`ZWMH*P$``(V&H````(O.4(U$)#!0Z)+S__]J/(V& +MC`\``(O.4(V$)%L!``!0Z'KS__]J$8V&>!X``(O.4(V$))BRMP`` +M@\0,L`%=6U]>@<2L`0``PXM$)`B![,P!``"`>!$`58OI=0>P`>F6`@``5HNT +M)-@!``"`?@@`=1J+A80```"#Z!DY!GX-Z%0*``"$P`^$;0(``%@,B\YJ!`^VV.C-:?__@_L/=3>+SNC8:?__P>@,B\YJ!`^VV.BR:?__ +MA=MU!\9$/!@/ZQJ#PP)+@_\4%VW7P3^L$B%P\&$>#_Q1RI(N< +M).@!``"-1"08:A2!P[`[``"+S5-0B5PD(.AB\O__,_^`?@@`=1R+A80```"# +MZ`4Y!GX/B\WHL`D``(3`#X1@`0``B\[H6&G__XO0BX.$````@>+^_P``.U2# +M!',I:A!9*\C3Z@^VC!J(`````TX$B\'!Z`,!!H/A!XE.!`^WA%.(!```ZUMJ +M#UE`B4PD$#O!@#`0:+1"00B4X$:A!9*Q2#*\C3ZHM,@T0#RCL+&\`CP0^WA$.(#``` +M@_@0L)@\,+:@>+SNAB:/__A?]T>TN!_ZX!``!S6XI$/"N(1#PL1X7; +M=>KK/'41Z%9H__^+V,'K#8/#`VH#ZP_H16C__XO8P>L)@\,+:@>+SN@=:/__ +M2X'_K@$``',:QD0\+`!'A=MU[8M<)!2!_ZX!```/@I7^___&A6+F```!@'X( +M`'4.BP8[A80```!^!#+`ZV.+G"3H`0``C40D+&@R`0``4U"+S>C!\/__:D"- +M@^P.``"+S5"-A"1F`0``4.BI\/__:A"-@]@=``"+S5"-A"2F`0``4.B1\/__ +M:BR-B\0L``!1C8PDM@$``%&+S>AY\/__L`%;7UY=@<3,`0``P@P`N+`B0P#H +MXJ(``(/L((O!4U97C7@$B47LB\_H;&?__XM7!(/"",'H"(O*B47H:@=;P>D# +MB_`!#R/3(_.)5P1&._-U(HO/Z$%G__^+3P2+\(/!",'N"(O!`_/!Z`,!!R/+ +MB4\$ZR"#_@AU&XO/Z!IG__^+5P2+\(/"$(O*P>D#`0\CTXE7!(7V=00RP.M] +M5HU-U.B"T/[_,]N)7?R)7?"%]G1-BTWLBX&$````2#D'?!'HD`8``(3`=0B- +M1O\Y1?!R/XO/Z,-F__^+5?"+3=3!Z`B(!!&+3P2#P0B+P8/A!\'H`P$'0HE/ +M!(E5\#O6Q6_W74_W7HZ(7=__^*V(U-U.A2TO[_BL.+3?1?7EMDB0T` +M````B^5=P[C"(D,`Z,>A``"#[!Q35XOYZ(8"``"#R_^)1>P[PW4',L#IE0`` +M`%:+\(/F!T:#_@=U$(O/Z&("```[PW0KC7`'ZR*#_@AU'8O/Z$T"``"+\#OS +M=!2+S^A``@``.\-T"<'F"`/PA?9U!#+`ZTY6C4W8Z(?/_O\SVXE=_(E=\(7V +M=!^+S^@3`@``B]"#^O]T(8M%\(M-V(@4`4")1?`[QG+A5O]UV(O/_W7LZ+G< +M__^*V(U-V.B&T?[_BL->BTWT7UMDB0T`````B^5=PU97B_DS]H,\MP!T#?\T +MM^@[]```@R2W`%E&@_X@<```"+AF@&``"+TXF&9`8` +M`(O+B)YM"@``BX9$!@``BT`$B!0!0HN&1`8``(M`!,9$"`$!BX9$!@``BT`$ +MB5P(`H/!!H'Y``8``'S-C89P"@``B_N)1"00O4A#0P"+V`^W10"-3P*9]_EJ +M"(E$)!B+TUBY`$```"M,)!1FB0J-4A"#Z`%U[(/%`H/#`H']6$-#`'S+BT0D +M$+F`````1P/!B40D$#OY?+"+7"08@\8#C4,":A!KR"A89L=&_P,$9HE._8/& +M!(/H`77N0X/[&7S?7UY=6X/$&,.-3"0``!9B\B)3?`S +MP(E%_(7)=`C_=ASH#,/__XM-](E&%%YDB0T`````B^5=P@0`BT0D"(M4)`Q3 +M5XOY#[9<."D/MDPZ*3O9=0:+1"0,ZU!5BZR/N````(7M=#*+10")A(^X```` +M:\(,5HMT)!105E7H;;```(N,G[@```"#Q`R)#HO%B;2?N````%[K$5%3_W0D +M&(O/Z`H```"+1"0075];P@P`BT0D#%:+\5P@P`BT0D!%-6B_$SVT-7B)YL"@`` +MB89@!@``Z-_\__]J"8V&;@@``&;'AFP(`````FH$4.A%K@``:/4```"-AG<( +M``!J!E#H,JX``(/$&#/`B(0&;`<``$"#^`-\\XO(B]._``$``.L1B(P&;`<` +M`(/J`74$0T&+TT`[QWSK:D"-AFP)``!J`%#H\*T``&C`````C8:L"0``:@A0 +MZ-VM``"#Q!C&AD(&```'7UY;P@0`5HMT)`A7B_G!YA0Y-W4$L`'K1%/H0P`` +M`&H,63/2B\;W\8/``FO8#%/H4O```(F'K````%F%P'4.N5`/1`#H=B;__S+` +MZP^#P/2)-P/#B8=8`0``L`%;7U["!`"#.0!T#_^QK````(,A`.@,\```6<-3 +M,]M6B_$X7"0,=2MHE`$``(V&R.0``(B>8>8``%-0Z#BM``"#Q`S'AL3D```" +M````B9Y6\($`(!\)`0`=0?&@6+F```` +MP@0`5C/25XOY.%0D#'56:A!2C4=@4.CFK```,\!HG$H``%")1W")1W2)1WB- +MAZ````!0Z,FL``"+C]CF```STK@``$``B9>`````@\08B5=\.\AR`HO(BX?< +MY@``(\&)ASQ+``!J%(E74(VWC````(E7"(E7!%)6B9=83```B9=<3```B9>$ +M````B9>(````Z&RL``"##O^#Q`PSP(O/B(=%3```_W0D#.CW_O___W0D#(O/ +MZ#G___]?7L($`%:+\5>+CH0```"+^8M&!"OX>00RP.MU/0!```!^((7_?A"+ +M3A`#P5=04>@TT0``@\0,@V8$`(F^A````.L"B_F+#K@`@```*\=0BT80`\=0 +MZ&Z"__^+T(72?@8!EH0```"`OD5,````BX:$````C4CBB8Z(````=`L%#/[_ +M_XF&B````#/`@_K_#Y7`7U[#5HOQ5XN.A````(OYBU8$*_IY!S+`Z;,```"+ +MAI0````KP@&&C````%,SVX'Z`$```'X@A?]^$8M.$%>-!!%04>B/T```@\0, +MB5X$B;Z$````ZP*+^;@`@```._AT'(L.*\=0BT80`\=0Z,:!__^+V(7;?@8! +MGH0```"`OD5,````BX:$````C4CBB8Z(````=`L%#/[__XF&B````(N.C``` +M`(M&!(F&E````(/Y_W052`/(BX:(````.\%\`HO!B8:(````@_O_6P^5P%]> +MPU-5BVPD#(O95XM\)!0[_700QH-23````7,'QH-13````8"[1$P```!T1BO] +M([OANT___4(O+Z%P% +M```#[HV#1$L``".KW.8``"O^=ZS<[_7,BBX/8Y@``*\50BX-`2P```\50 +MZ"P%``!7_[-`2P``B\OK#(N#0$L``"O]5P/%4.@0!0``7UU;P@@`@^P44U56 +M5XOY,]N+3WR+KX`````KS2./W.8``#F?L.8```^&SP$``(N'K.8``(L$F(E$ +M)!2%P`^$K0$``(!X"`!T"<9`"`#IG@$``(L0BT`$B[?2`0``C2P0(^Z);"0@.]5R+87M="F+M]CF``"-CV3F``"+AT!+ +M```K\E8#PE!J`.BM>O__5?^W0$L``%;K#%"+AT!+```#PE!J`(V/9.8``.B, +M>O__BW0D%(O/@\805NCBWO__BT8@BW8DB40D%(N'K.8``&HXB70D%/\TF.AU +MF```BX>LY@``65F-2P&#))@`B4PD'#N/L.8```^#B0```(ML)!B+AZSF``"+ +M=)@$A?9T;SDN=6N+1"00.48$=6*`?@@`=5Q0_W0D&(V/9.8``&H`Z`EZ__^# +MQA"+SU;H8][__XM&((M<)!R+=B2)1"04BX>LY@``:CB)="04_S28Z/*7``"+ +MAZSF``!968,DF`"-0P&)1"0<.X>PY@``75N#Q!3#BX>LY@``BP28AWPK_8EL)"0CN]SF``"+UXE\)""(3"03B70D,#E+4`^&V0$``(E,)!B+0TP# +M1"08B40D+(`X"`^$@0$``(!X#0!T(XM`!"N#@````".#W.8``#O'#X=D`0`` +MBT0D+(A(#>E8`0``BW@$BT`(B40D%(O'*\4C@]SF```[P@^#.`$``#OO=!Q7 +M58O+Z'7\__^+4WR+[RO7B6PD)".3W.8``#/)BT0D%#O"#XBX/8Y@`` +M*\>`NT1,````B40D*%!T'U>-LT1+``!1B\[H)-C__XM$)"B+S@-$)!Q5:@!0 +MZS^+@T!+```#QU!1Z"FH``"+1"0T`T0D*%7_LT!+``!0Z!2H``"#Q!CK+X"[ +M1$P```"+1"044'0/5U&-BT1+``#HT-?__^L2BX-`2P```\=04>CCIP``@\0, +MBT0D+(O+BWPD%%!7_W0D).@DUO__BTM,BU0D&,8$"@B%P'0)BPM74.BX?O__ +M`;M83```BU-\BW0D,&H`61&+7$P``"O5(Y/75N#Q"3#4U:+\5>+GEQ,``"+EDQ,``"+OEA, +M``"+ADA,```[VG\V?`0[^',PBTPD%"O'B_D;TS/;.]I\"'\$._AV`HO(4?]T +M)!2+#NA'??__`;Y83```$9Y<3```7UY;P@@`@^P0@SWL@D0``%-55HOQ5XET +M)!1U48-D)!@`,_\S[8L#_Q-RN("^4$P` +M``#&AF!,```!=3G_="0DB\[H4/?__XO.Z`3X__^$P`^$?0P``(!\)"0`=`F` +MOF'F````=0^+SNBUZO__A,`/A%X,``"+AMSF``"-7@0A1GR+`SN&B````'X/ +MB\[HP/?__X3`#X0R#```BXZ`````B\$K1GPCAMSF```]!`$``',_.TY\=#J+ +MSNB@^?__BX9<3```.X9,3```#X\##```?!*+AEA,```[ADA,```/A^\+``"` +MOE!,````#X7$"P``@[YQ.0```^%.`,``(O.Z)OS__^%P'44B\[H[NG__X3`#X4Y____Z8L+ +M``"#^/\/A((+``"#^`(/A'D+``"#^`-U"8O.Z,GP___KTX/X!`^%L0$``#+` +M,_^(1"03,]N$P`^%4`L``(O.Z$'S__^#^/]U"+`!B$0D$^L>@_L#=0T/MLB* +M1"03B4PD'.L0#[;`P><(`_B*1"03BTPD'$.#^P1\O(3`#X4,"P``BX;8Y@`` +MC5<"C7D@!?SO__^+3GR+V2O:.]@/@P`!```[R`^#^````(N&0$L```/8C2P( +MC00/B49\.]=S28/_"')RB\_!Z0.*`X/O"(A%`(I#`8A%`8I#`HA%`HI#`XA% +M`XI#!(A%!(I#!8A%!8I#!HA%!HI#!X/#"(A%!X/%"(/I`77#ZRZ#_PAR*8O' +MP>@#B40D&(OP:@A35>B6HP``@\0,@\,(@\4(@^\(@^X!=>:+="04A?\/A/G] +M__^*`XA%`(/_`0^&Z_W__XI#`8A%`8/_`@^&W/W__XI#`HA%`H/_`P^&S?W_ +M_XI#`XA%`X/_!`^&OOW__XI#!(A%!(/_!0^&K_W__XI#!8A%!8/_!@^&H/W_ +M_XI#!HA%!NF5_?__A?\/A(W]__^+CMSF``"+ED!+``"+PR/!BTY\0XH$$(@$ +M"HM&?(N.W.8``$`CP8E&?(/O`778Z5K]__^#^`4/A38!``"+SNB9\?__@_C_ +M#X28"0``BUY\C7@$BX;8Y@``!?SO__^-:_\[Z`^#SP```#O8#X/'````BX9` +M2P``C0PHC108C00?B49\@_\!=D5J"%T[_7(^B]_!ZP.*`2O]B`**00&(0@&* +M00*(0@**00.(0@.*002(0@2*006(0@6*00:(0@:*00<#S8A"!P/5@^L!=<>% +M_P^$N?S__XH!B`*#_P$/AJS\__^*00&(0@&#_P(/AIW\__^*00*(0@*#_P,/ +MAH[\__^*00.(0@.#_P0/AG_\__^*002(0@2#_P4/AG#\__^*006(0@6#_P8/ +MAF'\__^*00:(0@;I5OS__X7_#X1._/__BX[45B@%``#K76H/7T`[QW,7C4@IC0R. +M.Q%R"T"#P02#^`]R\^L"B_B+2P0#SXO!@^$'B4L$P>@#`0,KE+Z@````:A!9 +M*\_3ZHN,ON0````#RCN.H````!O`(\$/MY1&*`T``(U&!('Z``$``',4BXY` +M2P``BT9\B!0!_T9\Z4?[__^!^@\!```/@FH#```/MKJEWT,`#[::P=]#`(/' +M`X7;=">+R.A"4___:A!9*\O3Z(M."`/X`\N-7@2+P<'H`P$#@^$'B4L$ZP.- +M7@2+R^@84___B]"+AA`0``"!XO[_```[E(:0#P``$5A04``#K7FH/6T`[PW,:C8CD`P``C0R. +M.Q%R"T"#P02#^`]R\^L"B]B+3@@#RXO!@^$'B4X(P>@#`48$*Y2>C`\``&H0 +M62O+T^J+C)[0#P```\H[CHP/```;P"/!#[>$1A0<```/M\"+'(7H@D0`#[:H +MZ(-$`$.)7"08A>T/A$8!``"#^`D/AA4!``"#_01V+8U.!.A&4O__:A19*\W3 +MZ(U-_`-."(UN!,'@!`/8B\'!Z`,!10"#X0>)303K`XUN!(N&U)@``(7`?@Q( +MB8;4F```Z;@```"+S>@!4O__B]"+AOP>``"!XO[_```[E(9\'@````!J$%DKS=/JBXRNO!X```/*.XYX'@``&\`CP0^WA$8`*P``#[?` +M@_@0=1+'AM28```/````BX;0F```ZP:)AM"8```#V.LDC4X$Z#91__]J$%DK +MS=/HBTX(`]@#S8O!P>@#`48$@^$'B4X(B5PD&('[`"```'(*1X'[```$`'(! +M1XM&:(E&;(M&9(E&:(M&8(E&9(E>8(M.?(OIBX;8Y@``*^L%_.___XE^=#OH +M#X.C````.\@/@YL```"+AD!+``"-'"B-+`B-!#F)1GPY?"08@#B40D +M&(OP:@A35>BBG0``@\0,@\,(@\4(@^\(@^X!=>;I!_K__X7_#X0$^/__BX[< +MY@``BY9`2P``B\4CP8M.?$6*!!"(!`J+1GR+CMSF``!`(\&)1GR#[P%UV.G1 +M]___@?H``0``=0R+SN@NX?__Z7SX__^!^@$!``!U#(O.Z$;H___I:/C__X'Z +M`@$```^%`P$``(M^=(7_#X22]___BTY\B]F+AMCF``"+5F`%_.___RO:.]@/ +M@Z`````[R`^#F````(N&0$L```/8C2P(C00/B49\.]=S4(/_"`^"3OG__XO/ +MP>D#B@.#[PB(10"*0P&(10&*0P*(10**0P.(10.*0P2(102*0P6(106*0P:( +M10:*0P>#PPB(10>#Q0B#Z0%UP^D'^?__@_\(#X+^^/__B\?!Z`.)1"08B_!J +M"%-5Z&N<``"#Q`R#PPB#Q0B#[PB#[@%UYNG0^/__A?\/A,WV__^+CMSF``"+ +MED!+``"+PR/!BTY\0XH$$(@$"HM&?(N.W.8``$`CP8E&?(/O`778Z9KV__^! +M^@$5NPQ``#K76H/7T`[QW,:C8A:"P`` +MC0R..Q%R"T"#P02#^`]R\^L"B_B+2P0#SXO!@^$'B4L$P>@#`0,KE+YD+0`` +M:A!9*\_3ZHN,OJ@M```#RCN.9"T``!O`(\$/MX1&[#D```^WP`^VN+3@0P`/ +MMIC0X$,`@\<"A=MT)(U.!.C&3?__:A!9*\O3Z(M."`/X`\N+P<'H`P%&!(/A +M!XE."(M.?(O9BX;8Y@``*]T%_.___XE^=#O8#X.B````.\@/@YH```"+AD!+ +M```#V(TL"(T$.8E&?#E\)!AS4(/_"`^"0??__XO/P>D#B@.#[PB(10"*0P&( +M10&*0P*(10**0P.(10.*0P2(102*0P6(106*0P:(10:*0P>#PPB(10>#Q0B# +MZ0%UP^GZ]O__@_\(#X+Q]O__B\?!Z`.)1"08B_!J"%-5Z%Z:``"#Q`R#PPB# +MQ0B#[PB#[@%UYNG#]O__A?\/A,#T__^+CMSF``"+ED!+``"+PR/!BTY\0XH$ +M$(@$"HM&?(N.W.8``$`CP8E&?(/O`778Z8WT__^!^A`!```/@X'T__\/MIHU +MX$,`#[:Z/>!#`$.%_W0CB\CHBDS__VH062O/T^B+3@@#V`//B\'!Z`,!1@2# +MX0>)3@B+1FB)1FR+1F2)1FB+1F")1F2)7F"+5GR+^HN&V.8``"O[!?SO___' +M1G0"````:@)=._AS(SO0GS +M\___BX[*!!"(!`J+1GR+CMSF``!`(\&)1GR# +M[0%UV.G`\___QH9@3````.L5B\_HR,C__X.F7.8```"+SNB+[?__7UY=6X/$ +M$,($`(/L(%-6B_%7B70D$("^4$P```#&AF!,```!=5?_="0PZ)7J__^+SNC8 +MZ___A,`/A#T&``"-OHP```"+SE>-7@13Z(3;__^$P`^$(P8``(V&H````(O. +M4%=3Z!CA__^$P`^$"P8``("^8N8````/A/X%``"-5GQ5B50D'.F["0``C59\ +MBX;+^_P``.Y2&I````',J:A!9*\C3Z@^VC#(H`0```TT$B\'!Z`,!10"#X0>) +M300/MYQ6*`4``.M;:@]?0#O'-2"F-#(X[$7(+0(/!!(/X#W+SZP*+^(M- +M!`//B\�>)303!Z`,!10`KE+Z@````:A!9*\_3ZHN,ON0````#RCN.H``` +M`!O`(\$/MYQ&*`T``('[``$``',Z@+Y$3````'0L"@\\$2XO+T^>#QP*%VW0CB\WH2$G_ +M_VH062O+T^B+300#^`/+B\'!Z`,!10"#X0>)302+S>@E2?__B]"+AA`0``"! +MXO[_```[E(:0#P``T`\```/*.XZ, +M#P``&\`CP0^WA$84'```#[?`@_@$L/B^B#X`'1[8/(`DV+S=/@0(E$ +M)!B+V(E<)!"%[0^$[@```(/]!`^"0`$``'8QC4X$Z.PA``!J)(O862O-T^N- +M3?P#3@B-;@2+P<'C!`-<)!C!Z`,!10"#X0>)303K`XUN!(O-Z!)(__^+T(N& +M_!X``('B_O\``#N4AGP>``!S*FH062O(T^H/MHPR`!\```--!(O!P>@#`44` +M@^$'B4T$#[>$5@`C``#K7FH/74`[Q7,:C8B?!P``C0R..Q%R"T"#P02#^`]R +M\^L"B^B+3@@#S8O!@^$'B4X(P>@#`48$*Y2N>!X``&H062O-T^J+C*Z\'@`` +M`\H[CG@>```;P"/!#[>$1@`K```/M\`#V(E<)!"-;@2!^P`!``!V$T>!^P`@ +M``!V"D>!^P``!`!V`4>+1FB)1FR+1F2)1FB+1F")1F2)7F"`OD1,````B7YT +M=%#_MMSF``"-3GQ14U>-CD1+``#H@<3__^G4^___C4X$Z*X@``!J((O862O- +MT^N+3@@#7"08`\V+P8E<)!#!Z`.-;@0!10"#X0>)303I=/___XN&V.8``(U6 +M?(L*!?SO__^+Z2OK.^@/@P8!```[R`^#_@```(N&0$L``(T<*(TL"(T$.8D" +M.7PD$'-)@_\(W.8``$`CPXD"@^\!==GI_P,``('[``$``'4VC40D((O.4%7H"M?_ +M_X3`=!2-1"0@B\Y0Z.6[__^$P`^%%_K__XO.Z$SI__]=7UY;@\0@P@0`@?L! +M`0``#X67`0``BWYTC59\A?\/A._Y__^`OD1,````=!+_MMSF``"-3GQ1_W9@ +MZ>S]__^+3GR+V8N&V.8``(M68`7\[___*]H[V`^#%P$``#O(#X,/`0``BX9` +M2P```]B-+`B-!#F)1GP[UW-(:@A:._IR;XO/P>D#B@,K^HA%`(I#`8A%`8I# +M`HA%`HI#`XA%`XI#!(A%!(I#!8A%!8I#!HA%!HI#!P/:B$4'`^J#Z0%UQNLN +M@_\(PD`@``4U565XO9 +MZ#'(____M"0X`@``B\OH3.#__XM#'#/2`\!T'S/)BT,8C8GD2@``0L9$".T` +MQD0([P"+0QP#P#O0QB-@Z````!J!5EHG$H``%"-LXP```"#QQCSI8M# +M&(/`,%#H68X``#/`@\0,,_:)1"0H,^V(1"03B6PD&(A$)!*+"[@``$``*\:# +MX/!0BT,@`\90Z$AC__^)1"0LA<`/B#8#```#\(ET)"`/A"H#``"%P`^.7`(` +M`('^``0``'S`Z4\"``"+0QPSR2%,)!2)3"0<`\`/A!0!``"+5"08,^V+>Q@# +M_8E,)"B`O]-*````B1]T"(FWS$H``.L\BT,@C4\$`\)0Z!9`__^+="0@,\F+ +MQHE/""M$)!B)3P2)A\Q*```/A,8```"(C]!*``"(3Q2(3RR+3"0<@WPD+`#& +MA]-*````#Y3`B8_@2@``@'\4`(B'TDH``'4QC4<8QD<4`5"-1P2+RU#H!M#_ +M_X3`='F`?RD`=0F`NV+F````=&J+3"01*```#1QB+5"08`]!!B\:)5"08 +M*\*)3"0<>`:`?R@`=1L]``0``'P4BT,<`\`[R`^"^?[__^L%QD0D$@&+3"04 +M,]*+P?=S'(OXA=)T`4#?"0<`8E!!'4*4HO+Z.H!``#K#E&+2Q1HT')! +M`.CJG___BU0D)`/O`U0D,(E4)"0[;"04````*_`#P59048ET)"SH-*\``(M%((/$#"M%!`%%&(-E +M)`"#92``BT,@@V4$`(E%$(M$)!2%P'0[BT,8:.1*``!54(NPU$H``(NXW$H` +M`.@SBP``BT,8B;#42@``BT,8BW0D+(FXW$H``,:%TTH```"#Q`PS[8EL)!CK +M&H7V>"%^\HM+(%:-!"E04>BWK@``Z]^+;"08@'PD$@`/A*;\__^+@]SF``"+ +MRR%#?.AZX?__:50D*.1*``"-NXP```"+0QAJ!5EHG$H``(UR&(/",`/P`\)0 +MC8.@````\Z50Z*2*``"#Q`Q?7EU;@<0D`@``P@0`@^PL55:+="0XB^F);"08 +M@'XL`'4EC48PQD8L`5"-1AA0C48$4.C(TO__A,!U#,:&T$H```'IR`4``(M& +M)(M.&`/!5XU^!#D'?@S&AM!*```!Z:L%``"+1B"+ELQ*``!(@Z;82@````/! +M@^H0B40D&(E4)!13B]@[PGP"B]J)7"00BP\[RWPS.\@/CW$%``!U#(M&"#M& +M'`^-8P4``#O*?`V`OM)*````#X1+!0``.X[,2@``#XT_!0``BX[<2@``C4'X +M.8;82@``=C"-!`F)AMQ*``!KP`Q0_[;42@``Z`_+``"+V%E9A=MU"KE0#T0` +MZ"L!__^)GM1*``"+AMA*``"+SVO8#`.>U$H``$")7"0HB8;82@``Z!L\__^+ +MT(N&M````('B_O\``#M4AC1S*6H062O(T^H/MHPRN`````-/!(O!P>@#`0># +MX0>)3P0/MXQ6N`0``.M5:@]=0#O%-3C2-#($[$7(+0(/!!(/X#W+SZP*+ +MZ(M/!`/-B\�>)3P3!Z`,!!RM4KC!J$%DKS=/JBTRN=(ML)"`#RCM.,!O` +M(\$/MXQ&N`P``+@``0``.\AS3(.^V$H```%V-8-[]`!U+P^W0_AJ`UIF.\)S +M(T!FB4/X#[?`B$P8_/^.V$H``(M4)!B+1"0L"62/!2X/( +M!(O+T^"-:`*);"04A=MT)HO/Z/4Z__]J$%DKR]/HBT\$`^@#RXEL)!2+P<'H +M`P$'@^$'B4\$B\_HSSK__XO0BX:@#P``@>+^_P``.Y2&(`\``',I:A!9*\C3 +MZ@^VC#*D#P```T\$B\'!Z`,!!X/A!XE/!`^WA%:D$P``ZUUJ#UM`.\-S&HV. +M(`\``(T,@3L1<@M`@\$$@_@/ +M'`\``&H062O+T^J+C)Y@#P```\H[CAP/```;P"/!#[>$1J0;```/M\"#^`1S +M!#/;ZP^+V(/@`='K@\@"2XO+T^!`B40D)(OHA=L/A`@!``"#^P0/@MD```!V +M+(O/Z)T3``!J)(OH62O+T^V+3P2#P?S!Y00#;"0D`\N+P<'H`P$'@^$'B4\$ +MB\_HRCG__XO0BX:,'@``@>+^_P``.Y2&#!X``',I:A!9*\C3Z@^VC#*0'@`` +M`T\$B\'!Z`,!!X/A!XE/!`^WA%:0(@``ZUUJ#UM`.\-S&HV.#!X``(T,@3L1 +M<@M`@\$$@_@/"!X``&H062O+ +MT^J+C)Y,'@```\H[C@@>```;P"/!#[>$1I`J```/M\`#Z.LFB\_HQA(``&H@ +MB^A9*\O3[8M/!`-L)"0#RXO!P>@#`0>#X0>)3P2!_0`!``!V(XM$)!1`B40D +M%(']`"```'820(E$)!2!_0``!`!V!4")1"04BT0D*(M,)!3'``$```!FB4@$ +MB6@(Z6@!```[R'5/C40D+(O-4%?H2LK__P^V1"0L9HE#!(M$)#")0PAJ!%J) +M$XN&V$H``&O(#`..U$H``$")AMA*```/MD0D.&:)002+1"0TB1&)00CI%?W_ +M_X'Y`0$``'4+QP,"````Z0+]__]J`UB)`XV!_O[__XO/B4,(Z$`X__^+T(N& +M>"T``('B_O\``#N4AO@L``!S*6H062O(T^H/MHPR?"T```-/!(O!P>@#`0># +MX0>)3P0/MX16?#$``.M=:@];0#O#)3P3!Z`,!!RN4GO0L``!J$%DKR]/JBXR>."T```/* +M.X[T+```&\`CP0^WA$9\.0``#[?8@_L(78/$+,($ +M`,S,S,S,S,S,S,Q65XM\)`PS]CEW!'8=4XO>BP^-!`N+"5#HS_G__T:-F^1* +M```[=P1RYUM?7L($`(/L*%97BWPD-(OQ@'\L`'4GC4T````@>+^_P``.U2'-',V:A!9*\C3Z@^VC#JX```` +M`TT$B\'!Z`,!10"#X0>-1P2)2`0/MY17N`0``.M>BUPD$.DB____:@];0#O# +M-2`V-#(\[$7(+0(/!!(/X#W+SZP*+V(M-!`/+B\�>)303!Z`,!10`K +M5)\P:A!9*\O3ZHM,GW0#RCM/,!O`(\$/MY1'N`P``(U'!+D``0``.]%S%XM& +M?(N.0$L``(@4`?]&?(U'!.FE_O__@?H&`0``#X(6!```C9KZ_O__@_L(L0B^N#XP/![0*#RP1-B\W3XX/#`H7M="B+R.CQ-/__:A!9*\W3Z(M/"`/8 +M`\V-;P2+P<'H`P%%`(/A!XE-!.L#C6\$B\WHQC3__XO0BX>@#P``@>+^_P`` +M.Y2'(`\``',J:A!9*\C3Z@^VC#JD#P```TT$B\'!Z`,!10"#X0>)300/MX17 +MI!,``.M>:@]=0#O%)3PC!Z`,!1P0KE*\<#P``:A!9*\W3ZHN,KV`/```#RCN/'`\``!O` +M(\$/MX1'I!L```^WT(/Z!',$,\#K#XO"@^(!T>B#R@)(B\C3XHE$)!B-2@&) +M3"0DB^F);"04$`VPD),'H`P$"@^$'B4H$ZP.-5P2+RNBJ,___ +MB]"+AXP>``"!XO[_```[E(<,'@`````#3PB+P<'H +M`P%'!(/A!XE/"`^WA%>0(@``ZVIJ#UE`B4PD&#O!@#`4<$BT0D&(E/"&H062N4 +MAP@>```KR-/JBXR'3!X```/*.X\('@``&\`CP0^WA$>0*@``#[?``^CK+(U/ +M!.B7#```:B"+Z%DK3"08T^V+3P@#3"08`VPD)(O!P>@#`4<$@^$'B4\(B6PD +M'(']``$``'830X']`"```'8*0X']```$`'8!0XM&:(E&;(M&9(E&:(M&8(E& +M9(EN8(M6?(O*BX;8Y@``*\T%_.___XE>=(E,)"0[R`^#*P$``#O0#X,C`0`` +MBX9`2P``C2P(C0P0C00:B4PD)(E&?#E<)!QS28/["')ZB]/!Z@.*10"#ZPB( +M`8I%`8A!`8I%`HA!`HI%`XA!`XI%!(A!!(I%!8A!!8I%!HA!!HI%!X/%"(A! +M!X/!"(/J`77#ZS:#^PAR,8O#P>@#B40D'(OX:@A54>A.?P``BTPD,(/$#(/! +M"(/%"(/K"(E,)"2#[P%UWHM\)#R-1P2%VP^$1/O__XI%`(@!C4<$@_L!#X8S +M^___BD4!B$$!C4<$@_L"#X8A^___BD4"B$$"C4<$@_L##X8/^___BD4#B$$# +MC4<$@_L$#X;]^O__BD4$B$$$C4<$@_L%#X;K^O__BD4%@_L&BUPD$(A!!8U' +M!`^&V?K__XI%!HA!!HU'!.G+^O__BVPD%(U'!(7;#X25^___BZ[=(ML)!2%VP^$$/O__XM&8(M6?(OJ*^B) +M1"0AH?0``BTPD,(/$#(/!"(/%"(/K"(E, +M)"2#[P%UWND5_O__C4<$A=L/A%WY__^+OMSF``"+ED!+```C_8M.?$6*!!>( +M!`J+1GR+OMSF``!`(\>)1GR#ZP%UVND8`@``@<+^_O__C4Y@C0R1BQF)7"0D +M=`V+0?R)`8U)_(/J`77SC6\$B5Y@B\WH@R___XO0BX=X+0``@>+^_P``.Y2' +M^"P``',J:A!9*\C3Z@^VC#I\+0```TT$B\'!Z`,!10"#X0>)300/MX17?#$` +M`.M>:@];0#O#)303!Z`,!10`KE)_T+```:A!9*\O3ZHN,GS@M```#RCN/]"P``!O`(\$/ +MMX1'?#D```^WV(/["',$,^WK$(OK@^,#P>T"@\L$38O-T^.#PP*%[70DC4\$ +MZ+DN__]J$%DKS=/HBT\(`]@#S8O!P>@#`4<$@^$'B4\(BU9\B^J+AMCF```K +M;"0D!?SO__^)7G0[Z`^#K@```#O0#X.F````BX9`2P```^B-#!"-!!J)3"0< +MB49\.5PD)'-0@_L(#X)^_/__B]/!Z@.*10"#ZPB(`8I%`8A!`8I%`HA!`HI% +M`XA!`XI%!(A!!(I%!8A!!8I%!HA!!HI%!X/%"(A!!X/!"(/J`77#Z3?\__^# +M^P@/@B[\__^+P\'H`XE$)"2+^&H(55'H2WL``(M,)"B#Q`R#P0B#Q0B#ZPB) +M3"0<@^\!==[I^/O__XU'!(7;#X1`]___B[[H(9HE$)"B` +M^A]S;8N&1`8``(M8"(7;=&!F.2MT3HM[!(I$)"0X!W0PB^^#QP8X!W7WBD)1"00@_@!=%RH`74@T>B-CHQ* +M``!0_W<$Z*"M__^)1P2%P`^$'O___XM$)!`/MU<"B\B+1"00P>$#.\H;R<'@ +M`D$Y1"04&\!`9B/(BT0D$`/`9@/).T0D%!O`]]AF`\AF`\KK46H!C8Z,2@`` +MZ$.F__^%P`^$S?[__XM/`HD(9HM/!F:)2`2)1P2*2`&`^1YS!P+)B$@!ZP3& +M0`%X#[9``6H#63M,)!0;R??99@..6`8``&8#R`^WP6:)3P*+3"0@08U0!@/( +M#Z]4)!QKP0:)3"08`]([T',@B\'!X`([T!O)03E4)!@;P/?80`/!9H-'`@.) +M1"08ZRMKP0\[T!O):T0D&`Q!.]`;P$`#R&M$)!@).]`;P(/!!$`#R&8!3P*) +M3"08BTPD$(I4)"1KP08#1P2($(M4)!B):`*(4`&-00%FB0>+?P@[OD0&```/ +MA:K^__^)GD0&``")GDP&``#I\?W__U97B_F+3"0,C8F,2@``Z`FE__^+\(7V +M="&+5"04,\!`9HD&BPJ)3@)FBT($9HE&!HM$)!")?@B)<`)?B\9>P@P`4U56 +MBW0D$(O15XN&4`8``(UJ`@^V`(J<,&P)``"(GFX*```/MD4`#[:,,&P)```/ +MMD4!P>`%`\B+0@@ST@^W``^VA#!K"```!?@$``"-/$B+AF0&``#!^!J#X"`# +M^`^VAFT*``#!KGA*```.`_@/ML,#^(N&=$H``"N&<$H``/>V>$H```^W#'X[ +MP7-#B:Y0!@``@'T!@`^2P`!%`8.F?$H````/MP1^B8:`2@``#[<,?HU!(,'H +M!RO(@^F`9HD,?O^&9`8``,:&;0H```'K78F.?$H```^W#'Z-02#!Z`&5`8```$````/MH!80T,`B898!@``#[9- +M`(J&;`H``(B$,6P&``"#IE`&````QH9M"@```%]>75O"!`!358O9,])6BW0D +M$%P2+R(N&=$H``"N&<$H``/?Q +MB8YX2@``BY:$2@``B^@[ZGP',L#IDP````^V3P$[Z7U%C00)B8Z`2@``.\*) +MOE`&``!J!`^7P(B&;0H```^VP`&&9`8``%@#R(A/`68!0P*#^7Q^"%:+R^@> +M`P``@Z9\2@```.M$BX90!@``A# +MQP8#R#O-?NZ)CH!*```/MD75O"!`"+ +MAE`&```/M@"*A#!L"0``B(9N"@``BH9L"@``B8Y\2@``#[8/B(0Q;`8```^W +M`X.F4`8```")AE0&``"-4/^*AFP*``"-?_H/M@^(A#%L!@``@^H!=>B+AH1* +M``")AH!*``#KDH'L%`0``%-55HNT)"0$``"+V5>)7"0<#[<[*[Y4!@``5U;H +MG0$``(M+!(U4)"2#Z0:)1"08B50D%#/MBI9L"@``@\$&#[8!.)0P;`8``'3Q +M#[9!`8M4)!0#Z(M<)!R-A"0D!```B6PD(#O0#X,``0``B0J#P@2)5"04@^\! +M=;P!KH1*```STHN&>$H``/>VA$H``#/2B\B+AG1*```KAG!*``#W\8F.>$H` +M`(N.A$H``(OH.^D/C;8```"+1"0@C50D)(M\)"0[Z'U*#[9/`>L:@\($C80D +M)`0``#O0#X..````BSH/MD<("_@/MD06`@^V5!8$P><("\?!X`@+P8M+!-/@ +M62I+!%_3ZEX+PEO#58OIN0`!``!6#[=%`&8[P71RBW0D$%.+7"005XOX,\`Y +MLU0&```/MHPS:P<```^?P(T4B(M%"#/)#[<`*\<[\`^!A$H```$```"+QEY=P@@`@^P44U6+;"0@ +M5E>+^8NU4`8```^W!XE$)""-6/\[=P1T+(UN^HM%`(L.9HM6!(D&9HM%!&:) +M1@2#[@:)30"-;?IFB54*.W<$==N+;"0HBT<$@$`!!#/`9H-'`@0/MDX!#[=7 +M`BO1.85(UV^D.`/@!T]P^W!P/3*\,SVT-FB0=F.\-U +M78MW!(L.9HM>!(E,)!C!Z0B*P='ZT.@JR(A,)!F#^@%^!HM,)!CKYHM$)""- +M0`'1Z`^VC"BU2@``BX2-1$L``(D&BT0D&(FTC41+``"-3P*)C5`&``")`6:) +M603K-HO"T?@KT`^W!V8!$8M,)"!!T>E`T>@[R'034%'_=P2-C8Q*``#H@<#_ +M_XE'!(M'!(F%4`8``%]>75N#Q!3"!`!358ML)`R+V5>+?"04B;U0!@``@$7^ +M_XL'BW`4B\[_%6`R0P"+S__6B40D)(E4)""%VW03B\_HL!+__P&#@````!&3 +MA````(L'BW`(B\[_%6`R0P"+S__6O@`(``"-1R164(U$)#!0Z"MY__^`O[IL +M````#Y3`#[;`4%:-1"0P4.BI-/__BT0D&,9$)!(`#[:(H6$``/?9&\F#X02) +M3"044>F.````A=MT#H.CB`````"#HXP`````@'PD$@!U3;X`"```C4/__:@%6C80D,!```%#H2#3__XL'C8PD*!```/]T)!3&1"06 +M`5&+<`2+SO\58#)#`(O/_]:$P'5\BT0D&("XB&$````/A80```!H``@``(U$ +M)"Q0Z(&+__^$P'1Q_W0D%(L'C4PD+%&+<`2+SO\58#)#`(O/_]:$P`^$5/__ +M_V:#O"0X(```5(U')%`/E<`/ML!0Z&R-__]J`8O/Z'6/_O^`?"03`(O/=&O_ +M="075N! +MQ!@@``#"$`!6B_$SP&H04(E&&(E&'(U&(%#'!FA#0P#'1@2,0T,`QT8(R$-# +M`,=&#`1$0P#'1A`@1$,`QT84`0```.B":P``@\0,B\9>PU%35HOQ,]MJ#(D> +MB5X$B5X(B5X,B5X0B5X4Z'Y:``")1"0,687`=!+'`&A$0P#'0`0!````B7`( +MZP*+PXE&&(O&B5X)(A>)HE>*%Y;6<-5B^QDH0````!J_VB!'T,` +M4&2))0````!65XOYBT\;_ +M___,S,S,S,R#;"0$".G6____S,S,S,S,@VPD!!#IQO___\S,S,S,S(-L)`0, +MZ;;____,S,S,S,R+3"0$BT$$0(E!!,($`%:+\8-^!`!T#?]V!/\5%"%&`(-F +M!`!>PU>+^8M/#(7)=&"#?Q@`=%I5Z`4/``"+Z(7M=$U3:"Q40P"+S^C>```` +MB]B%VW0Y5HLSC4\44?]W&(M.%%/_%6`R0P#_5A2+`U.+<`B+SO\58#)#`/_6 +MBT4`58MP"(O._Q5@,D,`_]9>6UU?P\S,S,S,S,S,S,S,S,S,N`%``(#""`#, +MS,S,S,S,S(-L)`0$Z>;____,S,S,S,RX`4``@,($`%97:"Q40P"+\>A7```` +MB_B%_W0CBQ?_=A17BW(8B\[_%6`R0P#_UHL'5XMP"(O._Q5@,D,`_]9?7L/, +MS,S,S,S,S,S,S,S,S(-L)`0(Z8;____,S,S,S,R+1"0,@R``,\!`P@P`58OL +M45&+20R%R74$,\#K;%?H_@T``(OXA?]T7X-E^`"-1?Q6BS=0:/Q30P!7BP[_ +M%6`R0P#_%H7`>"R+1?R-3?A1_W4(BS!0BTX0_Q5@,D,`_U80BT7\4(L(BW$( +MB\[_%6`R0P#_UHL'5XMP"(O._Q5@,D,`_]:+1?A>7XOE7<($`,RX`D``@,(( +M`,S,S,S,S,S,BT0D"(,@`#/`0,((`,S,S(M$)`B#8`@`QP`4````QT`$```` +M1#/`P@@`S,S,S,S,BT0D&(,(_[@&``*`PA@`S#/`0,(,`,S,S,S,S,S,S,RX +M`4``@,(0`,S,S,S,S,S,5HMT)`C_=A3_%1@A1@"%P'4#0.L+BT0D#(M.%(D( +M,\!>P@@`S,S,S,S,S,S,S,S,@VPD!`3IQO___\S,S,S,S%6+[(/L$%-6BW4, +M5XM]"(U/_/?9C4<$&\DSVR/(BT40B0Z)&(U%\%#_=Q3_%4@A1@"+312+1?A1 +M_W48B4$(BT7\B1F)602)00S_%0@A1@"+31S'`10```")602+1Q2)00B)60R) +M61"+!E"+"(MQ!(O._Q5@,D,`_]9?7C/`6XOE7<(8`,S,S,S,S,S,S,S,S+@# +M``*`PB0`S,S,S,S,S,R+1"0$BT@(ACO"P``,\#")`"+1"0$ZR!F@_D\=1=F@W@"+W40:@)99H,\2#YT%D&#^11R +M\X/``@^W"&:%R778,L#"!`"P`>OY45&+1"0,4U56BQ`S[5>+^8EL)!2-3"04 +MB6PD$(MR2%%0B\[_%6`R0P#_UHO8A=L/B(T```"+1"04A!J+1"00_W0D(%"+"(MQ%(O._Q5@,D,`_]:+V(M$)!!0BPB+<0B+SO\58#)# +M`/_6BT0D%%"+"(MQ"(O._Q5@,D,`_]:+1"04A=MX!(7`=4\Y;PAT2CEO('5% +M.6\<=$#_=QR+S^@P!@``B_"%]G0P:`0"``!55555:@'_=P3_%50A1@!J!?]W +M"/\5;"%&`%;_=PC_%5PA1@!6Z`VH``!97_?37L'K'UV*PUM96<((`(/L#%.+ +MV8-[$``/A#T!``"#9"0(`%97BWPD'%?HA_[__U>(1"03Z+:G``"-!$4``@`` +M4.C)IP``B_!9687V#X0'`0``56C@1$,`5NCDR0``:/!$0P!6Z%OC``!H>$5# +M`%;H4.,``(/$&(OO:B!89CD'=0F#Q0)F.44`=/=J!FC@1$,`5>B[B?__]]@: +MP`0!B40D&'0#C7T,5U;H%^,``(!\)"``65EU#6B814,`5N@#XP``65F`?"03 +M`'4*5HO+Z'\!``"+\%;H%:<``&OH!EF#Q0E5:D#_%1PQ0P"+^(7_="TSP(U- +M_5!048U/`U%J_U90:.G]``#_%1@Q0P"%P'0+9L<'[[O&1P*_ZP/&!P!6Z.>F +M``!9C40D%%!J`5?_%7PA1@!=AUT/XM-`(U#$%=0:!Q40P"+ +M,8O.58E$)!S_%6`R0P#_UHM-`(OX58MQ"(O._Q5@,D,`_]:%_U]Y"8M$)`R# +M(`#K-X-[$`!T,8O+Z)_Y__^+0Q`SR3E+(%&(2R6+,%%148M.+'0%_W,@ZP5H +MR$1#`%#_%6`R0P#_5BQ=7EM9P@0`S,S,S,S,S,PSP,((`%%158ML)!!75>B0 +MI0``:\@,@<$``@``4>BAI0``B_B)?"0465F%_W4'B\7IX0```%-6:.A%0P!7 +MZ+3'``!7Z%NE``"+V(/$##/`B_5F.44`#X2J````:@U9:@I:#[<&9CO!=5QF +M.58"=59J#5J-3@1F.1%J"HE,)!1:=41F.58&=3Y2C2Q?7V8Y?@9U)FBT14,` +M5>A9QP``BW0D&(/#!%E9:@V-1@2#Q0A9B40D$&8Y"'34BWPD%(/&`HML)!SK +M)3OU=B9J(%EF.\%U'F8Y3OYU&(T$7VA81D,`4.@1QP``65F#PP9J"EKK!6:) +M!%]#@\8",\!J#5EF.08/A5S___\SP%5FB01?Z*VD``!97HO'6U]=65G"!`#, +MS,Q5B^Q6BW40A?9U"K@#0`"`Z;^___,S,S,S,R#;"0$#.G6_O__S,S,S,S,58OL5HMU$(7V +M=0>X`T``@.M-:A!HG%-#`/]U#.A):P``@\0,A7<(, +M`%6+[(/L,%-6BW4(,]M7:`!_``!3B_G'1=`P````QT74*`@``,=%V"":00") +M7=R)7>")=>2)7>C_%00A1@")1>R-1=!0QT7P!@```(E=],=%^(1$0P")7?S_ +M%2`A1@")-U]>6XOE7<($`,S,S%:+="0(@VX4`8M&%'43B\[HM?3__VHP5N@H +M3P``65DSP%["!`#,S,S,S,S,S,S,S(-L)`0$Z<;____,S,S,S,R#;"0$".FV +M____S,S,S,S,@VPD!!#IIO___\S,S,S,S(-L)`0,Z9;____,S,S,S,R+3"0$ +M@VD$`8M!!'4,:@Q1Z,!.``!963/`P@0`@^P055:+="0<5U:+^>CEH0``C01% +M`@```%#H^*$``(OH65F%[0^$E`$``%:+S^B+^/__#[<.B_V(1"0/9H7)#X1X +M`0``4VH@QT0D'`T````SV\=$)"`*````6L=$)!0^````Z8H```!F@_D\#X2) +M````A,!T4V8[3"08=`=F.TPD''45._UT!F8Y5_YT!F:)%X/'`H/&`NM6A,!T +M+&:#^29U)C/`C10P#[<*9H7)=!*#^3MU!8UR`K,!@\`"@_@H#QP*#Q@**1"03,]L/MPYFAP0`=`G_L6A+?12#Z`%T%BV`````=23_-VKK_W4(_Q4\(48`ZQ5JZ_]U"/\50"%&`/]U +M"(O(Z)SW__]7_W40_W4,_W4(_Q4D(48`7UW"$`!5B^R#[!B-1>A35U#_=0B+ +MV?\5A"%&`(U['%=HC%-#`&H%:@"-1>A0_Q5X(48`BP>%P`^$A0```%:+,(U- +M_%%HO%-#`%"+#O\58#)#`/\6A":+ +M1?A0BPB+<2"+SO\58#)#`/_6BT7X4(L(BW$(B\[_%6`R0P#_UEY?6XOE7<($ +M`%:+\8-^(`!U#H!^)0!U"/]V'.A7]?__@'XF`,9&)0%T"HM.#&H!Z`4!``!> +MPU>+^8M7'(72=00SP%_#BP)64HMP!(O._Q5@,D,`_]:+1QQ>7\-5B^Q145>+ +M^8M''(7`#X3&````5HLPC4W\46B\4T,`4(L._Q5@,D,`_Q:%P'@]BT7\:@%0 +MBPB+<1B+SO\58#)#`/_6BT7\:@!0BPB+<0R+SO\58#)#`/_6BT7\4(L(BW$( +MB\[_%6`R0P#_UHM''(U-^%%HW%-#`%"+,(L._Q5@,D,`_Q:%P'@YBT7X4(L( +MBW$8B\[_%6`R0P#_UHM%^%"+"(MQ%(O._Q5@,D,`_]:+1?A0BPB+<0B+SO\5 +M8#)#`/_6BT<<4(L(BW$(B\[_%6`R0P#_UH-G'`!>7XOE7<-5B^Q15XOYBT<< +MA->R!7_W,855-5:OM0_Q5@,D,`_U8L +MBT0D$%?_6UG"!`!5B^Q15HOQC47\B77\ +M@V7\`(-]#`!0_W4(QP9P1D,`=`?H94<``.L%Z%A'``")1@B+1?R)1@2+QEZ+ +MY5W""`#,S%:+\?]V!,<&:$9#`.@M1P``]D0D"`%T&?9$)`@$=0A6Z`U'``#K +M"FH05NAQE```65F+QE["!`#,S,S,S,S,S,Q5B^Q148-E_`"-1?Q6B_%0_W8$ +MZ.!&``"%P'0#B48(:A#HQD8``(O0B57XA=)T%(M."(M%_,<":$9#`(E"!(E* +M".L",]*+PEZ+Y5W#58OL45%3C47\,]M0:&Q30P!J`5-H7%1#`/\5>"%&`(7` +M#X@.`0``BT7\C4WX5E%H3%1#`(LP4(L._Q5@,D,`_Q:%P`^(V````#A="'08 +MBT7X:@+_=1"+"%"+<12+SO\58#)#`/_6BT7\_W4,4(L(BW%0B\[_%6`R0P#_ +MUCE=&'06BT7\_W484(L(BW$BL-;B^5=PAP`:F3H&````(/X?7T/:F3H+0```(/X?7T#,\##,\!` +MPZ$HA$0`A5O\UT`Y$`/\5,#%#`(7`=`U0_Q4@,4,`B_"%]G4',\#I +MMP```%-55S/M:@*);"0<_Q4<,4,`B]B%VP^$E@```%/_%20Q0P"%P`^$@``` +M`%=64.A'5@``@\0,B6PD$(U$)!!055/_%7PA1@"%P'595?]T)!3HL/[__XM, +M)!"+^%&+$8MR"(O._Q5@,D,`_]:%_W0UBT<(B6\(A65G"!`!5B^R`/4P/1```BT44=`4-```8`%#_=1#_=0S_=0C_ +M%?0@1@!=PA``@^QPZ(S^__^$P'46_W0D?/]T)'S_="1\Z)P"``#ID0(``%.+ +M7"1XC40D,%50:AA3_Q5@($8`BT0D/(N,)(`````/K\&9]WPD.(OH.ZPDA``` +M`'P'BZPDA````%<[3"0\=0H[;"1`=00S_^L@C40D##/_4&B$1D,`,\!`4%=H +M;%1#`/\5>"%&`(7`>1!75U=74_\5Z"!&`.D4`@``BT0D#(U,)!!646H"BS!7 +M4U"+3E3_%6`R0P#_5E2%P(M$)!!X'R__A_@<$.``>`#XBD +M````BTPD$(U4)!Q248L!BW`LB\[_%6`R0P#_UHM$)!QJ`U7_M"20````BS#_ +M="0@4(M.(/\58#)#`/]6((N$)(@```#_="0HBTPD((EL)#P/K^B)1"0XP>`" +MB7PD,(E\)#2+,<'E`E50C40D.%!1BTX<_Q5@,D,`_U8B^5=P@0`_W0D!/\5.#%#`/?8 +M&\#WV,($`%6+[(/L'%97:)Q&0P"+\>B&7?__,_^)!E?_%8`A1@"-1?3'1?0( +M````4,=%^/\'``#_%30@1@!7C47DQT7D`0```%"-1?R)?>A0B7WLB7WPZ.L^ +M``!H,(1$`/\5B"!&`%^+QEZ+Y5W#58OL9*$`````:O]H@1]#`%!DB24````` +MH3"$1`!65XOYBQ!0BW((B\[_%6`R0P#_UO]W!.BE/@``_Q5T(48`BTWT7V2) +M#0````!>B^5=PU:+\8V.G*0``.A^;_[_C8X\I```Z'-O_O^-CMRC``#H:&_^ +M_XV.?*,``.A=;_[_C8X\0`0``='&#[P%U +M$@^WQ8/H`71-@^@!=#V#Z&5T!#/`ZVJAL`Q&`&H`_S#H:A?__U"AL`Q&`/\P +M:(X```#H>SG__U!6Z+AI_O^$P'0\H;`,1@#_,.LJ:@!6_Q6X($8`ZRBAL`Q& +M`/]P!/\P:F96_Q5H(48`:@'KX/\SB1VP#$8`:F96_Q50(48`,\!`7UY=6\(0 +M`(M$)`2+R%,SVV8Y&'0[5E=J7%\/MQ!F.]=U'@^W<`)F._=U"&:).8/`!.L3 +M@_YN=0AJ"EJ#P`3K`X/``F:)$8/!`F8Y&'7,7UXSP&:)`5O"!`!5B^RX)!`` +M`.A//@``9H,]:I1$```/A($```!6:@;_-?CE0P"^:I1$`%;HAA;__U#HW7+_ +M_X7`=6)H:(1$`.B<_?__:``(``!6C87<[___4.@(6?__C87<[___4.A.D``` +M,\EJ'E%FB8Q%WN___XU%X%#HI4T``(/$$,=%Y`,```!J%%AFB47PC87<[___ +MB47HC47@4/\5="!&`%Z+Y5W#BT0D!#/)AA<)0``_P5[``0``'4Q:F2- +MA=3^__]0:@]3_Q5L,4,`9HN%U/[__V:CJ.Q%`#/`9J.J[$4`QP40YD,`J.Q% +M`&HRC46<4/]U#/]U".C85O__BWT0,\"+=1165V@`YD,`9HD'C46<4&H`4_\5 +M>#%#`#/`9HE$=_Y?7EN+Y5W"$`"#[`Q355:+="0<5X7V#X34````#[<&9H7` +M#X3(````BUPD)#/M:B(S_XET)!PRR<=$)!@L````15H[;"0H#X."````9CO" +M=5IJ(HU6`EAF.0)U)83)=18[="08=1`/MT8$9CM$)!1T$&:%P'0+:B*+\EIF +MB11[ZSR*P8A$)!.$R70$,LGK%6HB6%!2Z#-N``!9A<"*1"0760^5P6HB6CK! +M=10/MP9F.T0D%'4$A,ET'6:)!'M'18/&`@^W!F:%P`^%=/___S/`9HD$>^L6 +M,\!FB01[@\8"#[<.4>B65?__A,!U\(O&ZPN+1"0D,\EFB0@SP%]>75N#Q`S" +M#`"X^2)#`.CW.@``4;@4?0``Z,@[``!35E___W0/C8W<@O__Z*]K_O\RP.MRB5W< +MB5W@B5WDB5WHB%WLC47+=>"-/#:-1P)0 +MZ,:-``!9B\B+11")"(7)=02+\^L3,\!79HD$#_]UW%'H4TP``(/$#(M%%(DP +MC4W,3^__]U".@)*```N%"K00##Z\;_=0CH^2<``+@8JT$` +MPU6+[+@,(```Z,,Z``"`/7"D1```#X24````:``(``"-A?3?__]0_W4(Z+(4 +M``"-1?A0:@%J`&CL4D,`:`$``(#_%2@@1@"%P'5DC47\QT7\`!```%"-A?3O +M__]0C47T4&H`C87TW___4/]U^/\5)"!&`(7`=2^+1?RY_P<``-'HB47\.\%R +M`HO!_W4,,\EFB8Q%].___XV%].___U#_=0CH+%7___]U^/\5!"!&`(OE7<(( +M`,S,S,S,S,S,S,S,S%6+[('L``$``%.+71!6BW4,5XM]"&H`:@!H;$]#`/]U +M%%-65^C"9O[_A,!U;8'N$`$``'19@^X!=0T/M\.#Z`%T%(/H`70$,\#K4FH` +M5_\5N"!&`.M$OH````"-A0#___]64&IF5_\5:"%&`(V%`/___[EX:D4`4.CK +M0O__5HV%`/___U#H*4/__VH!Z[__=11J9U?_%5`A1@`SP$!?7EN+Y5W"$`"X +M!"```.A@.0``BXPD%"```%,SVU:%R70"B!F+E"0@(```A=)T`H@:B[0D$"`` +M`(7V#X2T````#[<&9H7`#X2H````58NL)!@@``!7B[PD("```(E<)!`/M\"# +MQ@*#^#UU$X7_=!F%VW45AL#@\8",\!FB44`A?]T +M+V:)!X7;="AH`!```(U$)!A04_\58#%#`/^T)"P@``"-1"084%?HBU/__S/` +M9HD#7XO&7>L",\!>6X'$!"```,(8`%6+[%%14XU%^%#_%8@@1@"-1?Q0,\!0 +M4/]U#%#_%7P@1@"+V/?;&MN`PP%T+E;_=0C_=?S_%9`@1@#_=?Q(]]@:P(U8 +M`8M%^%"+"(MQ%(O._Q5@,D,`_]9>ZPB+10@SR6:)"(K#6XOE7<((`+@$(``` +MZ/PW``!35597:```"`#H88H``(OP687V=0JY4`]$`.B)P/[_BYPD&"```#/` +M,^UFB0:+_>MN9CDN=0AF@WPD%'MT86:#?"04?71[C40D%%#H_XD```/'63W[ +M_P,`=V>-1"044%;HO\4``%;HY(D``(OX@\0,A?]T%(U'_XT$1F:#."!U"(/H +M`H/O`77R@'PD$P!U$(T$?F@<0T,`4.@%K```65EH`!```(U$)!=0556-1"0D +M4/\SZ-O]__^)`X7`#X5P____7XO&7EU;@<0$(```P@0`58OL@^P10_Q6@($8`7HOE78```"![A`!``!T*H/N +M`74-#[?#@^@!=!F#Z`%T!S/`Z<@```!55_\5N"!&`.FX````:@'K\%?H*2`` +M`*%TQ40`AC___\UE.Q%`.@XB```_S60[$4`Z"V(``!963/`0%]> +M75O"$`!5B^R#[!A35VIE_S70#D0`_Q70($8`B_B%_P^4PX3;=`EJ9>C7[___ +MB_B%_W0/C47H4&H85_\58"!&`.L.QT7L70```,=%\"X!``#HK>[__X3`=#]6 +MA-MT%FIFZ)_O__^+\(7V=`E7_Q5,($8`B_[_=?#HQN[__U#_=>SHG.[__U!7 +MZ+GP__]7B_#_%4P@1@"+_EZ+QU];B^5=PX`]4(1$``!U2HM$)`A7,_]F.3AT +M/5;_%0`P0P"+\(U$)!105_]T)!B_L.Q%`&@`$```5^@2CO[_5VB(3T,`Z"WW +M__^#Q!R%]G0'5O\5!#!#`%Y?P\S,S,RX#B-#`.C:,P``N*@<`0#HK#0``%.+ +M71!6BW4,5XM]"&H`:@!H2%!#`/]U%%-65^AG8?[_A,!T"#/`0.FB"0``@>X0 +M`0``#X2@!@``@^X!=1(/M\.#Z`%T:8/H`70W@^AE=`*PXA%\NL#BD7RB@UQI$0`A,EU;832='W_ +M%40Q0P!0:)A00P"-A8SN__]64.@AB_[_@\00C8UDSO__Z#KC_O^#9?P`C86, +M[O__:A%0C8UDSO__Z"KD_O^(1?.$P'4._Q4`,$,`@_@%=0.(7?*#3?S_C8UD +MSO__Z#CC_O^*#7&D1`"`??,`#X4U`@``A,D/E<#^R")%\H3`#Y1%\X3`#X2X +M`0``5HV%C.[__U!J`/\5?#!#`&B`````C86,_O__N7+$1`!0Z`\Y__]H3H24$``(/$#.L&BT7LB47DC46H4/\5 +MA"!&`(OPC86,_O__:(````!0Z*0Y__]H#$,``(V%3./^_U#HDSG__X7V=#AH +M$"<``/]UX/\5K"!&`(-EZ`"+=>2`/@!U%&ID_Q6<,$,`BT7H0(E%Z(/X9'SG +MBT7@HZ3L10#K!HMUY(A=\X-][`!T$%;_%4PQ0P#_=>S_%1@P0P"`??,`#X2" +M^___:)H```#H`"K__U"-A8S>__]0:!!10P"-A62I__]H``H``%#HQ8C^_X/$ +M%+E0#T0`4^CBN/[_:C!HE@```.C(*?__4(V%9*G__U!7Z*/J____!5R$1`#I +M)_O__VH`:F=7B1U4A$0`Z-E;_O]J`&IF5^C/6_[_:.8```#HBRG__U!35_\5 +M4"%&`%-J:5?HLUO^_VBT-4,`:F57_Q50(48`:F57_Q5D(48`B_"%]G08:O!6 +M_Q5`(48`#8````!0:O!6_Q4\(48`:@7_-3B$1`!7Z`\)``!J`O\U.(1$`%?H +M`0D``&B0W$4`5X@=M`Q&`.@='```:@;_-3B$1`#&!;0,1@``5^C;"```@#U0 +MA$0``'4@@SU____-83<10#HW7X``%DY'6RD1`!T +M45?_%<@@1@`Y'6RD1`!T0H`]<:1$``!U.6H#_S4XA$0`5^B5!@``@SV0[$4` +M`'0B:@!H8*]!`&H`:'Q00P#_-=0.1`#_%;0@1@"%P`^$X/C__U/_-3B$1`!7 +MZ%T&``"`/6.$1```#X6C````@SV$W$4```^%E@```(,];*1$```/A8D````S +MP+ZJ````9HF%9&G__X'^J@```'4)@#V8[$4``'0_@?ZK````=0F`/9CL10`` +M=2YH`"```&B44$,`C85D:?__4.AT1O__:``@``!6Z`PF__]0C85D:?__4.A< +M1O__1H'^L````'ZGBPU`A$0`C85D:?__:@!J`%#_=>S_-=0.1`#HH]W__XMU +MZ(,];*1$``)U"6H`5O\58"%&`(`]:)1$``!T%&H`:F=7Z,M7_O]J`&IF5^C! +M5_[_H6RD1`"%P'0D@#U0A$0``'4;:@!3:!$!``!7.\-U"/\5`"%&`.L&_Q6H +M($8`@#U2A$0``'03:)````#H927__U!35_\54"%&`(O#BTWT7UY;9(D-```` +M`(OE7<(0`,S,S,S,S,S,S,S,N%`:``#HMBH``%.+G"1@&@``55:+M"1D&@`` +M,^U7B[PD9!H``%55:!A/0P#_M"1\&@``4U97Z&!7_O^$P'0(,\!`Z5`#``"! +M[A`!``!T;H/N`0^%/0,``&H"#[?#7BO&="*#Z&IT4H/H`71(@^@!=#^#Z`%T +M$8/H`70Q@^@!#X41`P``:@9>555H<0$``&IF5_\5P"!&`(7`=`=0_Q78($8` +M5E?_%;@@1@#KDVH#Z]9J!.O2,_9&Z\Z+]>O*:FQ7_Q5D(48`4/\5Q"!&`+X` +M"```C80D8`H``%;_M"1T&@``4.C:1/__5HV$)&0*``!04.CY`O__C80D8`H` +M`%!J95?_%5`A1@!H``$``&BT`@``C80DM`<``%!5C80D<`H``%#_%8`@1@!5 +M_[0DL`<``&AP`0``:F97_Q7`($8`C80D7`$``%"-A"1D"@``4/\59#!#`(O8 +M@_O_#X0V`@``C40D$%"-A"1T`0``4/\5`#%#`(U$)!A0C40D%%#_%0@Q0P!J +M,HU$)#1058U$)"10:@)>5F@`!```_Q5P,4,`:C*-A"28````4%6-1"0D4%5H +M``0``/\5=#%#`(U$)#!0C80DF````%!HF0```.AK(___4&A,3T,`C80DO`,` +M`&@``@``4.@V@O[_@\08C80DK`,``%!J:E?_%5`A1@!3_Q5@,$,`]H0D7`$` +M`!!U9&HRC80D_````#/)`XPD@`$``%"+A"2``0``$\504>@KZ___:)@```#H +M`2/__U"-A"3\````NP`"``!0:&!/0P"-A"2X`P``4U#HPX'^_X/$%(V$)*P# +M``!0:FA7_Q50(48`ZP6[``(``%7_M"2P!P``:'`!``!J9U?_%<`@1@"+#62$ +M1`"-1"0H4.B@4/__C40D$%"-1"0L4/\5`#%#`(U$)!A0C40D%%#_%0@Q0P!J +M,HU$)#1058U$)"105KX`!```5O\5<#%#`&HRC80DF````%!5C40D)%!55O\5 +M=#%#`(U$)#!0C80DF````%!HF0```.@V(O__4&A,3T,`C80DO`,``%-0Z`6! +M_O^#Q!B-A"2L`P``4&IK5_\54"%&`/:$)%P!```0BPV,W$4`BQ6(W$4`=`:+ +MP@O!=$MJ,HV$)/P```!045+H`>K__VB8````Z-@/[_@\04C80DK`,``%!J:5?_%5`A1@`SP%]>75N!Q%`: +M``#"$`"X`"```.@2)P``5E=H`!```(U$)`PS]E#_M"04(```Z'L___^+^(7_ +M#X3S````5;T`"```1H/^`0^$R````&:#?"0,+W0,9H-\)`PM#X6T````#[=$ +M)`Y0Z$1;__^#Z$0/A)````"#Z`%T:H/H"W14@^@##X6-````#[=$)!!0Z!U; +M__^#Z`!T*(/H,70C@^@!=!*#Z!YU;E6-1"064&ARM$0`ZUS'!6RD1``"```` +MZPK'!6RD1``!````Q@5Z:T4``>M"C40D$+ERQ$0`4.BA+___ZS$/MT0D$%#H +MP5K__X/X3'4A9H-\)!(`=1G&!7&D1``!ZQ!5C40D%%!H0+``"_``@``(V%L(+__U=0Z+;>__]7C86H(O__4(V% +M^,K__U"-A;""__]0Z.SY_O^-C:AR___H'.7^_XV%J"+__S/;4(V-J'+__XE= +M_.@_YO[_C8VPHO__Z(.O_O_I.@$``%.-A;"B__]0_Q58,$,`.)V\LO__#X2@ +M````5XV%^.[__U"-A;""__]0Z![U_O]7C87X[O__4.@A\O[_C86P@O__4.BA +M=@``B_!9@_X$3^_X3`#X6K +M_O__@TW\_XV-J'+__^BGX_[_Z1P*``"%VP^%%`H``*&$W$4`A<`/E,.$VW42 +M:+1%0P!0Z#.Q``"AA-Q%`%E9BGWSA/]T"(VU^,K__^L0C44,4.CFZO__B_"A +MA-Q%`(3;=0E0Z"YU``!9B_A6Z"5U```#QXT$10H```!0_S6$W$4`Z#MU``"# +MQ`R%P'07HX3<10"$VW0%,\EFB0A64.C)L```65F$_P^%APD``%;H_W0``%GI +M>PD``(7;#X5S"0``C87XRO__4/]U"/\57"%&`.E>"0``A=L/A58)``!F.3UR +MI$0`#X5)"0``,\"-O?C*__]J(F:)A?CN__]89CF%^,K__W4&C;WZRO__5^B% +M=```O@`(``!9.\8/@Q0)```/MP=J7%F#^"YU)V8Y3P)U(8/'!#/;9CD?#X3U +M"```5E>-A?CN__]0Z/@\___I^````&8[P0^$WP```&:%P'0+9H-_`CH/A,\` +M``"-1>0SVU!J`5-H(%)#`&@"``"`_Q4H($8`A3_%20@1@#_=>3_%00@1@"+1>RY_P<``-'H.\%R +M`HO!,\EFB8Q%^.[__V8YG?CN__]T+(V%^.[__U#HLG,``%EJ7%EF.8Q%]N[_ +M_W025FB44D,`C87X[O__4.@8//__5^B,!P``QP5LI$0``@```.D/!P``#[>%^,K_ +M_S/)*\%T+8/H,'07@^@!=".#Z`$/A>\&``#&!5.$1``!ZP:(#5.$1`"(#6"$ +M1`#IU08``(@-4X1$`,8%8(1$``'IPP8```^WA?C*__]0Z*:@``!9@_A&="*# +M^%5T$3/`HF&$1`"B8H1$`.F:!@``Q@5BA$0``>F.!@``Q@5AA$0``>F"!@`` +M,__&!9CL10`!1XV=^,K__V:#O?C*__\\#X6>````C87ZRO__:CY0Z%!1``!9 +M687`#X2&````C4@"B4WL,\EFB0B-A?C^__]J9%"-A?K*__]0Z&/B__^+V(7; +M=%UF@[WX_O__`'13:)A20P"-A?C^__]0Z*]3___WV&BD4D,`&\`C^(V%^/[_ +M_U#HF%/__X7`=0-J`U]HK%)#`(V%^/[__U#H@%/__X7`=0-J!E]J9(V%^/[_ +M_U!3ZYB+7>R#?1`%=16#_@D/A;<%``!J`5=3_W4(Z&H)``"#?1`$#X6A!0`` +M@_Xh!0``:@!74_]U".A+"0``Z8<%``#&!9GL10`!9CF]^,K__P^$LD:``"``"-A?K*__\#P5"-A?CJ__]0Z'XX__\SP&:)A'7X +MRO__9H.]^.K__P!U,&@`$```C86H0O[_4(V%^,K__U#H4CC__V@``@``C86H +M8O[_4(V%^.K__U#H.CC__XV%^,K__U#H?][__S/`9HF%^-K__XV%^.K__VHD +M4(V%^,K__U#_=0CH<=C__X/X!@^$\P,``&H!_W4(,\#&!5"$1``!9J-JE$0` +M_Q6X($8`@_L'#X70`P``@SULI$0``'4*QP5LI$0``@```,8%:)1$``'IL0,` +M`(/[`W4I9CF]^,K__W02C87XRO__4.ANJ@``6:.4[$4`C44,4.B2Y/__HY#L +M10#&!7MK10`!Z7<#``"#^P8/A6X#```SP&:)A?BR__\/MX6H0O[_4.A(G0`` +MO@`(``!95H/X4'0S@_A4C87XLO__=!1H@LM%`%#H1S?__\=%[!````#K+&B" +MJT4`4.@S-___QT7L!P```.L8:(*[10"-A?BR__]0Z!DW___'1>P"````,\!F +MB86H8O__9HF%^,+__XV%J&+^_U90C86PDO__4.CN-O__:B);9CF=L)+__W5/ +MOP`(``"-A:IB_O]74(V%L)+__U#HR3;__XV%LI+__U-0Z*5-``!9687`#X3U +M````,\EFB0B#P`)H``0``%"-A?C"__]0Z)@V___IU@```(V%L)+__U#HR=C^ +M_X3`#X6]````B]^-M;"2__]F.9VPDO__#X2H````:B!9#[<&9CO!=`AJ+UIF +M.\)U>8OX,\!FB0:-A;"2__]0Z(;8_O^$P'1:C86PDO__4.B*V/[_4.C2V/[_ +MA,!U1&HO6(O>9COX=1AFB87XPO__C48":/\#``!0C87ZPO__ZQ=J(%B#Q@)F +M.09T^&@`!```5HV%^,+__U#HZS7__V:).^L#9HD^:B!9,_^#Q@)F.3X/A6O_ +M__^_``@``(7;=`PSP&:)`^L%OP`(``!F@[VHXO[_`'045XV%J&+__U"-A:CB +M_O]0Z)?H_O]7C86H0O__4(V%L)+__U#H@^C^_V:#O?BR__\`=0__=>R-A?BR +M__]0Z/_A__]7C87XLO__4.@KZ/[_9H.]J(+^_P!T(5>-A:B"_O]0C87XLO__ +M4.@?-?__5XV%^++__U#H`.C^_U>-A?BR__]0C86H,O__4.@F-?__9H.]J,+^ +M_P"-A:C"_O]U!HV%J&+^_U=0Z&'R_O]0C87XLO__4.C4-/__C87XLO__4.A" +MZO[_A%J&+___?841O`(\(/ +MMY6H4O__]]I0C86HHO[_&])0(];HEMO__U!2C87XLO__4(V%J$+__U!3Z$C1 +M__]F.9VH,O__="-3C86H,O__4&H%:``0``#_%7@@1@#K#(/[!W4'Q@5PI$0` +M`6@`$```C47K4(U%\U"-A?C*__]0C86H`O__4/]U#.B#W___BUT0B44,A<`/ +MA8CS__]?7EN+3?1DB0T`````B^5=P@P`D#/!00`$PT$`I<-!`,+#00#0Q4$` +M$<9!`)[&00##QT$`;\E!`)[&00"IR4$`%,U!`%W&00"9QT$`4XM<)`A5:B!3 +MZ&]*``!9687`=&9J(EUF.2MU"U/HKO#^_V8Y*'135E=3Z+=J``"+^#/):@): +MC4<#]^(/D,'WV0O(4>@.&@``B_!3C4X"4>CEC```@\009HEL?@(SP&:)+F:) +M1'X$_W0D&%93Z",S__]6Z.@9``!97UY=B\-;P@@`@^Q<4U565^C:X/__:FC_ +M-5B$1`#_%60A1@"]L0```#/;B_"-?1$X'6.$1`!U-(L-0(1$`.C7O?__:@56 +M_Q5L(48`:O]355;_%0`A1@!HM#5#`%-75O\5`"%&`,8%8X1$``&X`.'U!5!0 +M55;_%0`A1@"-1"00QT0D$%P```!04V@Z!```5O\5`"%&`#/)B%PD*8I<)'!! +MB4PD%(3;=!^+1"08)?___[_'1"0DH`````O!QT0D%`$``$")1"08C40D$%!1 +M:$0$``!6_Q4`(48`_W0D=&H`5U;_%0`A1@"X`.'U!5!055;_%0`A1@"$VW0C +MBT0D&(/@_@T```!`B40D&(U$)!!0:@%H1`0``%;_%0`A1@!H'$-#`&H`5U;_ +M%0`A1@!?7EU;@\1\0`0``=#F#[P%U#0^WQ8/H`704@^@!=`0S +MP.M%:@!6_Q6X($8`ZS=H``@``/\UK.Q%`&IH5O\5:"%&`&H!Z]]3:F96B1VL +M[$4`_Q50(48`_S6L[$4`:FA6_Q50(48`,\!`7UY=6\(0`+ERQ$0`Z10>__^X +M&!```.@X%@``Z'W/__^$P`^$T0```%565VH%_[0D+!```/\5-"%&`(OP,_^+ +M[H7V#X2N````4X'_``(```^-H````&@`"```C40D+%!6_Q7L($8`:`A/0P"- +M1"0L4.AR2O__A#X1+`@`` +M5NB`9P``63WV!P``#X,Y`@``5VH\7U>-1"044U#HT20``(J,)&@0``"#Q`R) +M?"00QT0D%,`!``"$R70(QT0D%,`%```/MQ:-?@)5:B)=9CO5=`*+_HE\)"2+ +MPV:%TG0VB];'1"00(````&8Y*@^$B0$``(M4)!!F.11$`0``9H-\1@(O +M#X2(`0``0(T41F8Y&G74BT0D*%V%P'0%9CD8=16$R7419CD=6X'$0!```,(0`(,E5(1$``!J`?]T)`C&!5&$1``!Q@52A$0``?\5;"%& +M`&H`:@+_="0,Z$<__O^#/3R$1```=0F`/6.$1```=`F#/5R$1```=1-J`&H! +M:!$!``#_="00_Q4`(48`P@0`N#@C0P#HF!$``%&X`"$``.AI$@``4U97B67P +M:)!/0P!H,5$`(O.Z,Z'_O^#9?P`C8WPWO__:@)8HU`X10"C3#A%`*-(.$4` +MH&&$1`"BSR9%`*!BA$0`5L8%#"=%``'&!0\G10`!HM`F10#H/ZG^_XV-\-[_ +M_\9%_`'HIZK^_XV-\-[__^BXJ?[_BTWT7UYDB0T`````6XOE7<((`+Y0#T0` +MB\[H9YK^_VH(B\[H*9O^__]U".BZ_O__N)_400##Z\C_=0CHJO[__[AIU$$` +MPU6+[+@($```Z'01``"`/7"D1```='EF@SURI$0``'1O5F@`"```C87X[___ +M4&ARI$0`Z%KK__^-1?@S]E"-1?Q05F@&``(`5E96:.Q20P!H`0``@/\5$"!& +M`(7`=3#_=0CH;F,``%F-!$4"````4/]U"(V%^.___VH!5E#_=?S_%2`@1@#_ +M=?S_%00@1@!>B^5=P@0`58OLN``@``#HWQ```%;_=0AH7%!#`/\57#%#`&@` +M$```C84`X/__4/]U".@_*?__B_"%]G0B#[<.4>L'@\8"#[<&4.A`*O__A,!U +M\%9H;%!#`/\57#%#`%Z+Y5W"!`!5B^R#[!Q7:@K_=0C_%>0P0P"_`@$``#O' +M=496,_965E96C47D4/\5I"!&`(7`="%65E:-1>10_Q7@($8`C47D4/\5O"!& +M`(U%Y%#_%:`@1@!J"O]U"/\5Y#!#`#O'=+Y>7XOE7<($`%6+[%%1BT4(B47X +MBT4,B47\C47X4&C`ID$`_S58A$0`:)1/0P#_-=`.1`#_%;0@1@!(]]@;P$"+ +MY5W""`!5B^R`/6"$1```BT40HXC<10"+112CC-Q%`(M%&*-DA$0`=`0SP.MC +M@#U3A$0``'0%,\!`ZU535E>_<+M!`+L83T,`ZR/_=0AH4,]!`/\U3(1$`&@X +M3T,`_S70#D0`_Q6T($8`AF6````@WT(`HLU6(1$`'4-5O\5L"!&`/?8&\`C +M\%-H``@``(V%`/#__U#_=1#_=0SHG.#^_XV%`/#__U!H(*Q!`%9H;$]#`/\U +MU`Y$`/\5M"!&`(M=%(7`=!-J0%F^>&I%`(O[\Z4SP$!FI>L5:+0U0P"+R^C: +M%___Q@50A$0``3+`@+L``0```'0.:D!9B_._@)*___:``(``!H:(1$`.A4Q___C4PD'.@-S?__ +MN>"!1`#H"#[__[\$<0``,]M74VB`:T4`Z!H=``"#Q`S_%5@Q0P"+\(7V='Y6 +MZ"GF__\X'7&D1`!T:E5HK$]#`%.^'P`/`%;_%50Q0P"+Z(7M=$=74U-65?\5 +M2#%#`(O8A=MT+5=3:(!K10#H)QX``(/$#,8#`6B":T4`Z`O\__]J0%F^@MM% +M`+]RQ$0`\Z5FI5/_%4PQ0P`SVU7_%1@P0P!=ZP96Z.'[__]H``@``+^0W$4` +M5U/_%7PP0P!7:.!/0P#_%5PQ0P"-1"0,4/\50#%#``^W1"0:4`^W1"0<4`^W +M1"0>4`^W1"0@4`^W1"0B4`^W1"0B4`^W1"0D4&CP3T,`C80DG````&HR4.C% +M9?[_@\0HC40D?%!H-%!#`/\57#%#`%/_%8`P0P"+\&ID5HDUU`Y$`(DUT`Y$ +M`/\5U"!&`*-TQ40`Z'C6__]7N>@.1`"C?&M%`.C'^_[_C4PD4.A7L/__C4PD +M).A.L/__4VAPL4$`4XU$)%RC0(1$`(U$)#!H2%!#`%:C1(1$`/\5M"!&`(U, +M)"2)'42$1`")'4"$1`#HTK#__XU,)%#HR;#__Z&@[$4`AQ%``"+-5`/1`!T(H`]FNQ%``"A_.5#`'0.BS6<[$4`A6X'$U````,(0`+AL(48`Z0````!14E!H +MQ+U#`.B\!@``6EG_X+AD(48`Z>7___^X8"%&`.G;____N%PA1@#IT?___[A8 +M(48`Z7___^X6"!&`.G;____N$P@1@#IT?___[A0($8` +MZ7___^X#"!&`.G;____N``@1@#I +MT?___[@4($8`Z7___^XC"!& +M`.G;____N'0@1@#IT?___[B$($8`Z"%&`.GE +M____N(0A1@#IV____[B`(48`Z='___^X="%&`.G'____]P5@54,``!```'0F +MZ)X```"AX`Q&`$"CX`Q&`(/X`74,:.0,1@!J!.C4`0``Z7<"``##H=`,1@!3 +M,]M#.\-U!#+`6\.%P'0$BL-;PU9HC%1#`/\5@#!#`(OPA?9U!(OSZRIHJ%1# +M`%;_%8PP0P"%P'3L:,!40P!6H]0,1@#_%8PP0P"%P'37H]@,1@"+SKK0#$8` +M,\#P#[$*AR+3?PSS>C$#@``B^5=PXO_58OL@^Q`C47D:AQ0 +M_W4(_Q6@,4,`A-1``0`"%]G4$ +M,\#K/0^W@10`0`"-D1@`0``/MXD&`$```]!7B[X,`$``,_:%R707.WH,<@J+ +M0@@#0@P[^'(01H/"*#OQ7<((`(M%"(M*"(D(BT4,BTHDB0B+0@P% +M``!``.O@B_]5B^Q145:-1?A0C47\4.AH____B_"%]G4+BT4,QP`$````ZT.# +M/>@,1@``=2'W1?@```"`QP7H#$8``0```'4%:AE9S2G_=?Q6Z+O^____=0S_ +M=0C_=?Q6_Q6<,4,`AZPK' +M!=P,1@``````BTW\,\WHW0P``(OE7<.+_U6+[(/L.*%HYD,`,\6)1?Q35E?H +M\_S__XM-"+\``$``QT70)````(E-U(M!!(M9"`/'BU$,`]^+<1`#UP/WB5WX +MBWD4@<<``$``B47")?>2)?>B) +M?>R)??!U)(U%T(E%^.C\_O__C47X4&H!5VA7`&W`_Q64,4,`,\#IUP$``(M% +M#(L[*\+!^`*)1B%VW02C470B\M0:@+_%6`R0P#_TXOPA?8/A94` +M``"+10@SVSE8%'0M.5@<="B+1SR!/#A010``=1R+3_W7D5_\5C#!#`(OPA?9U3O\5`#!#`(LUW%1#`(E%\(7V +M=!:-1="+SE!J!/\58#)#`/_6B_"%]G4EC470B47TZ%;]__^-1?10:@%3:'\` +M;<#_%90Q0P#HSOK__XMU[(M%#(DPBQW85$,`A=MT&H-E\`"-1=!0:@6+RXE] +MZ(EU[/\58#)#`/_3Z`[]__^+QHM-_%]>,\U;Z%H*``"+Y5W""`"XF"!&`.D` +M````45)0:(2^0P#H9/W__UI9_^"X-"!&`.D`````45)0:*2^0P#H2?W__UI9 +M_^#_)5@R0P#_)50R0P#_)5`R0P#_)4PR0P#_)4@R0P#_)40R0P#_)4`R0P#_ +M)3PR0P#_)3@R0P!5B^SK'_]U".A^CP``687`=1*#?0C_=0?H3PH``.L%Z"L* +M``#_=0CH95,``%F%P'347<-5B^S_=0CH2PH``%E=P\QJ_U!DH0````!0BT0D +M#&2))0````");"0,C6PD#%#RP\S,S,S,S,S,S,S,S%=64S/_BT0D%`O`?11' +MBU0D$/?8]]J#V`")1"04B50D$(M$)!P+P'T41XM4)!CWV/?:@]@`B40D'(E4 +M)!@+P'48BTPD&(M$)!0STO?QB]B+1"00]_&+T^M!B]B+3"08BU0D%(M$)!#1 +MZ]'9T>K1V`O;=?3W\8OP]V0D'(O(BT0D&/?F`]%R#CM4)!1W"'('.T0D$'8! +M3C/2B\9/=0?WVO?8@]H`6UY?PA``S,S,S,S,48U,)`0KR!O`]]`CR(O$)0#P +M__\[R/)R"XO!692+`(D$)/+#+0`0``"%`.OG:A!H@+A#`.A'"0``,]N)7>"( +M7>>)7?P[71!T&HM-%.@?"0``BTT(_U44BT4,`44(0XE=X.OAL`&(1>?'1?S^ +M____Z`X```#H30D``,(4`(M=X(I%YX3`=0__=1A3_W4,_W4(Z'L```##:@QH +MH+A#`.C>"```QD7G`(M=#(O#BWT0#Z_'BW4(`_")=0B#9?P`B\=/B7T0A?'1?S^____Z!0```#HU0@``,(0 +M`(M]$(M=#(MU"(I%YX3`=0O_=1174U;H`0```,-J&&C`N$,`Z&0(```S]HEU +M_(M]"(EUY#MU$'1"*WT,B7T(BTT4Z#8(``"+S_]5%$;KXHM%[(E%X(M%X(L` +MB477<($`%6+[%WI%OW__^F:!P``58OL +MBT4(5HM(/`/(#[=!%(U1&`/0#[=!!FOP*`/R.]9T&8M-##M*#'(*BT((`T(, +M.\AR#(/"*#O6=>HSP%Y=PXO"Z_GH7PD``(7`=0,RP,-DH1@```!6OO@,1@"+ +M4`3K!#O0=!`SP(O*\`^Q#H7`=?`RP%[#L`%>PU6+[(-]"`!U!\8%%`U&``'H +M?`<``.@B.@``A,!U!#+`7OIL`%=PU6+[(/L +M#%:+=0B%]G0%@_X!=7SHW@@``(7`="J%]G4F:/P,1@#H7YD``%F%P'0$,L#K +M5V@(#48`Z$R9``#WV%D:P/[`ZT2A:.9#`(UU]%>#X!^__`Q&`&H@62O(@\C_ +MT\@S!6CF0P")1?2)1?B)1?REI:6_"`U&`(E%](E%^(UU](E%_+`!I:6E7UZ+ +MY5W#:@7H;`@``,QJ"&C@N$,`Z%H&``"#9?P`N$U:``!F.04``$``=5VA/`!` +M`(&X``!``%!%``!U3+D+`0``9CF(&`!``'4^BT4(N0``0``KP5!1Z&G^__]9 +M687`=">#>"0`?"''1?S^____L`'K'XM%[(L`,\F!.`4``,`/E,&+P<.+9>C' +M1?S^____,L#H(P8``,-5B^SHS0<``(7`=`^`?0@`=0DSP+GX#$8`AP%=PU6+ +M[(`]%`U&``!T!H!]#`!U$O]U".C.F0``_W4(Z,PX``!96;`!7<-5B^RA:.9# +M`(O(,P7\#$8`@^$?_W4(T\B#^/]U!^C.EP``ZPMH_`Q&`.@RF```6??861O` +M]]`C10A=PU6+[/]U".BZ____]]A9&\#WV$A=P\S,S,S,S,R`^4!S%8#Y(',& +M#Z7"T^##B]`SP(#A']/BPS/`,]+#S(M$)`B+3"00"\B+3"0,=0F+1"0$]^'" +M$`!3]^&+V(M$)`CW9"04`]B+1"0(]^$#TUO"$`#,S,S,S,S,S,S,S,Q75E4S +M_S/MBT0D%`O`?15'18M4)!#WV/?:@]@`B40D%(E4)!"+1"0<"\!]%$>+5"08 +M]]CWVH/8`(E$)!R)5"08"\!U*(M,)!B+1"04,]+W\8O8BT0D$/?QB_"+P_=D +M)!B+R(O&]V0D&`/1ZT>+V(M,)!B+5"04BT0D$-'KT=G1ZM'8"]MU]/?QB_#W +M9"0@P +M10``Z"M%``#HY08``.C1!@``4.@=F0``6>BUE0``A,!T!>A.D0``Z+<&```S +MP,-J!^AB!```S,S,S,S,S,S,S,S,S.C1!@``,\##S,S,S,S,S,SHC@4``.B& +M!@``4.@ZF0``6<-J%&@`N4,`Z"("``!J`>CE^O__683`=0=J!^@4!```,MN( +M7>>#9?P`Z);Z__^(1=RA]`Q&`#/)03O!=-R%P'5)B0WT#$8`:+0R0P!HF#)# +M`.B6EP``65F%P'01QT7\_O___[C_````Z?8```!HE#)#`&AD,D,`Z!27``!9 +M6<<%]`Q&``(```#K!8K9B%WG_W7A7^___65G'1?S^____B\;K/8M-[(L!BP")1>!1 +M4.BWA@``65G#BV7HZ(R)``"$P'4(_W7@Z%N*``"`?><`=07H,HH``,=%_/[_ +M__^+1>#H#0$``,/,S,S,S,SH9`0``.F(_O__.PUHYD,`\G4"\L/RZ>@%``#, +MS,S,S%6+[%;_=0B+\>@"+O__QP:`54,`B\9>7<($`(-A!`"+P8-A"`#'002( +M54,`QP&`54,`P\S,S,S,S,S,S,S,S,R-003'`6A50P!0Z(@Q``!9PU6+[(/L +M#(U-].B9+?__:`2W0P"-1?10Z$LI``#,58OL@^P,C4WTZ)____]H'+E#`(U% +M]%#H+BD``,SI_D@``/\E8#)#`,S,S,S,S,S,S,QH4"%"`&3_-0````"+1"00 +MB6PD$(UL)!`KX%-65Z%HYD,`,47\,\50B67H_W7XBT7\QT7\_O___XE%^(U% +M\&2C`````/+#BTWP9(D-`````%E?7UY;B^5=4?+#58OL@R48#48``(/L*%,S +MVT,)'7#F0P!J"NA#*@$`A<`/A&T!``"#9?``,\"##7#F0P`",\E65XD=&`U& +M`(U]V%,/HHOS6XD'B7<$B4\(B5<,BT78BTWDB47X@?%I;F5)BT7@-6YT96P+ +MR(M%W&H!-4=E;G4+R%AJ`%E3#Z*+\UN)!XEW!(E/"(E7#'5#BT78)?`__P\] +MP`8!`'0C/6`&`@!T'#UP!@(`=!4]4`8#`'0./6`&`P!T!SUP!@,`=1&+/1P- +M1@"#SP&)/1P-1@#K!HL]'`U&`(-]^`>+1>2)1>B+1>")1?R)1>Q\,FH'6#/) +M4P^BB_-;C5W8B0.)PD`P``4U9J%^BE*`$`APS3?PSR#O/=0>Y +M3^9`N^L0A6\/,S,S,S,S,S,S,4U:^-+%#`+LTL4,` +M._-S&%>+/H7_=`F+S^CB^O___]>#Q@0[\W+J7UY;PU6+[&H`_Q6T,4,`_W4( +M_Q6P,4,`:`D$`,#_%0PP0P!0_Q7,,4,`7<-5B^R!["0#``!J%^AI)0$`A+?"0$AL3#[HE<.9#``%S/F8/;L!F#W#``(/Y('(<\P]_ +M!_,/?T<0@\<@@^D@@_D@<^SWP1\```!T8HU\.>#S#W\'\P]_1Q"+1"0$B_K# +M]\$#````=`Z(!T>#Z0'WP0,```!U\O?!!````'0(B0>#QP2#Z03WP?C___]T +M((VD)`````"-FP````")!XE'!(/'"(/I"/?!^/___W7MBT0D!(OZP\S,S,S, +MS%=6BW0D$(M,)!2+?"0,B\&+T0/&._YV"#OX#X*4`@``@_D@#X+2!```@?F` +M````-?P0/NN<# +M$(/I,&8/;T8@9@]O;C"-=C"#^3!F#V_39@\Z#]D,9@]_'V8/;^!F#SH/P@QF +M#W]'$&8/;\UF#SH/[`QF#W]O((U_,'VWC78,Z:\```!F#V].^(UV^(U)`&8/ +M;UX0@^DP9@]O1B!F#V]N,(UV,(/Y,&8/;]-F#SH/V0AF#W\?9@]OX&8/.@_" +M"&8/?T<09@]OS68/.@_L"&8/?V\@C7\P?;>-=@CK5F8/;T[\C7;\B_]F#V]> +M$(/I,&8/;T8@9@]O;C"-=C"#^3!F#V_39@\Z#]D$9@]_'V8/;^!F#SH/P@1F +M#W]'$&8/;\UF#SH/[`1F#W]O((U_,'VWC78$@_D0?!/S#V\.@^D0C7809@]_ +M#XU_$.OH#[KA`G,-BP:#Z02-=@2)!XU_!`^ZX0-S$?,/?@Z#Z0B-=@AF#]8/ +MC7\(BP2-M/E!`/_@]\<#````=!.*!H@'28/&`8/'`??'`P```'7MB]&#^2`/ +M@JX"``#!Z0+SI8/B`_\DE;3Y00#_)(W$^4$`D,3Y00#,^4$`V/E!`.SY00"+ +M1"0,7E_#D(H&B`>+1"0,7E_#D(H&B`>*1@&(1P&+1"0,7E_#C4D`B@:(!XI& +M`8A'`8I&`HA'`HM$)`Q>7\.0C30QC3PY@_D@#X)1`0``#[HE<.9#``$/@I0` +M``#WQP,```!T%(O7@^(#*\J*1O^(1_].3X/J`77S@_D@#X(>`0``B]'!Z0*# +MX@.#[@2#[P3]\Z7\_R258/I!`)!P^D$`>/I!`(CZ00"<^D$`BT0D#%Y?PY"* +M1@.(1P.+1"0,7E_#C4D`BD8#B$<#BD8"B$<"BT0D#%Y?PY"*1@.(1P.*1@*( +M1P**1@&(1P&+1"0,7E_#]\#___]UW??!_/___W05@^\$@^X$BP:)!X/I!/?!_/___W7KA#Z0%U\8M$)`Q>7\/K`\S,S(O&@^`/A<`/A>,```"+T8/A?\'J +M!W1FC:0D`````(O_9@]O!F8/;TX09@]O5B!F#V]>,&8/?P=F#W]/$&8/?U<@ +M9@]_7S!F#V]F0&8/;VY09@]O=F!F#V]^<&8/?V=`9@]_;U!F#W]W8&8/?W]P +MC;:`````C;^`````2G6CAH%A=)T(8V;`````/,/;P;S#V].$/,/ +M?P?S#W]/$(UV((U_($IUY8/A'W0PB\'!Z0)T#XL6B1>#QP2#Q@2#Z0%U\8O( +M@^$#=!.*!H@'1D=)=?>-I"0`````C4D`BT0D#%Y?PXVD)`````"+_[H0```` +M*]`KRE&+PHO(@^$#=`F*%H@71D=)=??!Z`)T#8L6B1>-=@2-?P1(=?-9Z>G^ +M__]5B^R#[!BA:.9#`(U-Z(-EZ``SP8M-"(E%\(M%#(E%](M%%$#'1>P`_T$` +MB4WXB47\9*$`````B47HC47H9*,`````_W484?]U$.@])P``B\B+1>ADHP`` +M``"+P8OE7<-5B^R#[#A3@7T((P$``'42N-/]00"+30R)`3/`0.FV````@V7( +M`,=%S,7_00"A:.9#`(U-R#/!B470BT48B474BT4,B478BT4P`B67DB6WH9*$`````B47(C47(9*,`````QT7X`0```(M% +M"(E%\(M%$(E%].BJ)0``BT`(B47\BTW\_Q5@,D,`C47P4(M%"/\P_U7\65F# +M9?@`@WWL`'079(L=`````(L#BUW(B0-DB1T`````ZPF+1+?0B+3PR+T8M?$(E-_(7V>#9KP12#P`@#PX/Y_W1) +MBWT0@^@423EX_(M]"'T*BWT0.SB+?0A^!8/Y_W4'BU7\3HE-_(7V>=*+111! +MB0B+11B)$#M7#'<0.\IW#&O!%%]>`\-;B^5=P^B[=@``S%6+[%%3BT4,@\`, +MB47\9(L=`````(L#9*,`````BT4(BUT,BVW\BV/\_^!;B^5=P@@`58OL45%3 +M5E=DBS4`````B77XQT7\U?Y!`&H`_W4,_W7\_W4(_Q70,4,`BT4,BT`$@^#] +MBTT,B4$$9(L]`````(M=^(D[9(D=`````%]>6XOE7<((`%6+[%;\BW4,BTX( +M,\[HZ.___VH`5O]V%/]V#&H`_W40_W80_W4(Z)$Q``"#Q"!>7<-5B^R+30Q6 +MBW4(B0[H&B0``(M()(E.!.@/)```B7`DB\9>7<-5B^Q6Z/XC``"+=0@[<"1U +M$.CQ(P``C4@DBT8$B0%>7#^R`/@J$$``"+!CL"#X2`````#[;X#[8"*_AT%C/)A?\/ +MG\&-#$W_____A0<```^V?@D/MD() +M*_AT%C/)A?\/G\&-#$W_____A@& +M```/MGX-#[9"#2OX=!8SR87_#Y_!C0Q-_____X7)#X7&!@``#[9^#@^V0@XK +M^'06,\F%_P^?P8T,3?____^%R0^%I`8```^V3@\/MD(/*\AT$C/`A8-``"+1N,[0N-T=0^V^`^V0N,K^'02,\F% +M_P^?P8T,3?____^%R773#[9^Y`^V0N0K^'02,\F%_P^?P8T,3?____^%R76U +M#[9^Y0^V0N4K^'02,\F%_P^?P8T,3?____^%R767#[9.Y@^V0N8KR'02,\"% +MR0^?P(T,1?_____K`C/)A?7__P^V?N\/MD+O*_AT%C/)A?\/G\&-#$W_____AF,````BU4(BW4,#[8*#[8&*\AT$C/`A6UW#B_^D"4(`P`U"``420@`[ +M%D(`(0E"`"D-0@!N$4(`I!5"`(H(0@"1#$(`UA!"``T50@#R!T(`^@M"`#\0 +M0@!U%$(`6P="`&,+0@"H#T(`WA-"`,0&0@#,"D(`$0]"`$<30@`M!D(`-0I" +M`'H.0@"P$D(`E@5"`*X)0@#C#4(`&!)"`%.+W%%1@^3P@\0$58MK!(EL)`2+ +M[(M+"(/L((,]&`U&``%FBU,,?$8/M\)F#V[`\@]PP`!F#W#0`(O!)?\/```] +M\`\``'<\#Q`!9@_OR68/=LD#[+"X/I!%&+`8MP((O.BW@8Z)[6____UHE=^(E]_(7_=`SV +M!PAT!\=%]`!`F0&-1?10_W7P_W7D_W7@_Q64,4,`7UY;B^5=P@@`S,S,S,S, +MS,S,S(,]&`U&``%R7P^V1"0(B]#!X`@+T&8/;MKR#W#;``\6VXM4)`2Y#P`` +M`(/(_R/*T^`KT?,/;PIF#^_29@]TT68/=,MF#^O19@_7RB/(=0B#R/^#PA#K +MW`^\P0/"9@]^VC/).A`/1<'#,\"*1"0(4XO8P>`(BU0D"/?"`P```'05B@J# +MP@$ZRW19A,ET4??"`P```'7K"]A7B\/!XQ!6"]B+"K___OY^B\&+]S/+`_`# +M^8/Q_X/P_S//,\:#P@2!X0`!`8%U(24``0&!=-,E``$!`74(@>8```"`=<1> +M7ULSP,.-0O];PXM"_#K#=#:$P'3J.N-T)X3D=.+!Z!`ZPW05A,!TUSKC=`:$ +MY'3/ZY%>7XU"_UO#C4+^7E];PXU"_5Y?6\.-0OQ>7UO#58OL5C/V@ST8#48` +M`GTMBTT(B]%FBP&#P0)FA7,!```/NB4< +M#48``7,)\Z2+1"0,7E_#B\-=@SI +MKP```&8/;T[XC7;XC4D`9@]O7A"#Z3!F#V]&(&8/;VXPC78P@_DP9@]OTV8/ +M.@_9"&8/?Q]F#V_@9@\Z#\((9@]_1Q!F#V_-9@\Z#^P(9@]_;R"-?S!]MXUV +M".M69@]O3OR-=OR+_V8/;UX0@^DP9@]O1B!F#V]N,(UV,(/Y,&8/;]-F#SH/ +MV01F#W\?9@]OX&8/.@_"!&8/?T<09@]OS68/.@_L!&8/?V\@C7\P?;>-=@2# +M^1!\$_,/;PZ#Z1"-=A!F#W\/C7\0Z^@/NN$"V+T8/Y(`^"K@(``,'I`O.E@^(#_R25=!U"`/\DC80=0@"0 +MA!U"`(P=0@"8'4(`K!U"`(M$)`Q>7\.0B@:(!XM$)`Q>7\.0B@:(!XI&`8A' +M`8M$)`Q>7\.-20"*!H@'BD8!B$#X@,KRHI&_XA'_TY/@^H! +M=?.#^2`/@AX!``"+T<'I`H/B`X/N!(/O!/WSI?S_))4@'D(`D#`>0@`X'D(` +M2!Y"`%P>0@"+1"0,7E_#D(I&`XA'`XM$)`Q>7\.-20"*1@.(1P.*1@*(1P*+ +M1"0,7E_#D(I&`XA'`XI&`HA'`HI&`8A'`8M$)`Q>7\/WQP\```!T#TE.3XH& +MB`?WQP\```!U\8'Y@````')H@>Z`````@>^`````\P]O!O,/;TX0\P]O5B#S +M#V]>,/,/;V9`\P]O;E#S#V]V8/,/;WYP\P]_!_,/?T\0\P]_5R#S#W]?,/,/ +M?V=`\P]_;U#S#W]W8/,/?W]P@>F`````]\&`____=9"#^2!R(X/N((/O(/,/ +M;P;S#V].$/,/?P?S#W]/$(/I(/?!X/___W7=]\'\____=!6#[P2#[@2+!HD' +M@^D$]\'\____=>N%R70/@^\!@^X!B@:(!X/I`77QBT0D#%Y?P^L#S,S,B\:# +MX`^%P`^%XP```(O1@^%_P>H'=&:-I"0`````B_]F#V\&9@]O3A!F#V]6(&8/ +M;UXP9@]_!V8/?T\09@]_5R!F#W]?,&8/;V9`9@]O;E!F#V]V8&8/;WYP9@]_ +M9T!F#W]O4&8/?W=@9@]_?W"-MH````"-OX````!*=:.%R71?B]'!Z@6%TG0A +MC9L`````\P]O!O,/;TX0\P]_!_,/?T\0C78@C7\@2G7E@^$?=#"+P<'I`G0/ +MBQ:)%X/'!(/&!(/I`77QB\B#X0-T$XH&B`=&1TEU]XVD)`````"-20"+1"0, +M7E_#C:0D`````(O_NA`````KT"O*48O"B\B#X0-T"8H6B!=&1TEU]\'H`G0- +MBQ:)%XUV!(U_!$AU\UGIZ?[__U6+[%>+?0B`?P0`=$B+#X7)=$*-40&*`4&$ +MP'7Y*\I35HU9`5/H]1<``(OP687V=!G_-U-6Z.9F``"+10R+SH/$##/VB0C& +M0`0!5NC*%P``65Y;ZPN+30R+!XD!QD$$`%]=PU6+[%:+=0B`?@0`=`C_-NBC +M%P``68,F`,9&!`!>7+?0R+!H/X_G0-BTX$ +M`\\S##CHR\W__XM&"(M.#`//,PPX7UY=Z;C-___,S,S,S,S,S,S,S,S,S%6+ +M[(/L'%-6BW4,5\9%_P#'1?0!````BUX(C480,QUHYD,`4%.)1>R)7?CHD/__ +M_XM]$%?HQQ```(M%"(/$#/9`!&8/A;H```")1>2-1>2)?>B+?@R)1OR#__X/ +MA,D```"-1P*-!$>+3(,$C02#BQB)1?"%R71EC580Z(\1``"Q`8A-_X7`>&9^ +M58M%"($X8W-MX'4W@SW(54,``'0N:,A50P#HV/@``(/$!(7`=!J+-3KV!O`@\@!7,_96Z!!D``!97E?_%00P +M0P!?B\-;PVA`(T(`Z&$1``"C@.9#`%F#^/]U`S+`PVA4$$8`4.CV$0``65F% +MP'4'Z`4```#KY;`!PZ&`YD,`@_C_=`Y0Z&(1``"##8#F0P#_6;`!P\S,S,S, +MS%6+[(/L!%-1BT4,@\`,B47\BT4(5?]U$(M-$(MM_.C)$P``5E?_T%]>B]U= +MBTT058OK@?D``0``=06Y`@```%'HIQ,``%U96\G"#`#,S,S,:@AHR+E#`.@$ +MR___BT4(AX$X8W-MX'5S@W@0`W5M@7@4(`63&702@7@4(063&70)@7@4 +M(@63&752BT@#9?P`4O]P&.C/"```QT7\_O___^LN,\`X +M10P/E<##BV7HZ")0``#V`1!T&(M`&(L(AC2]_[_QP;054,`B\9>7<($`(-A +M!`"+P8-A"`#'003854,`QP'054,`P\S,S,S,S,S,S,S,S,Q5B^Q6B_&-1@3' +M!FA50P!0Z%+[___V10@!670*:@Q6Z*&___]968O&7EW"!`!J.&B`N4,`Z/?) +M__^+11B)1>2#9<0`BUT,BT/\B474BWT(_W<8C46X4.A6V?__65F)1=#H=_W_ +M_XM`$(E%S.AL_?__BT`4B47(Z&']__^)>!#H6?W__XM-$(E(%(-E_``SP$") +M1<")1?S_=2#_=1S_=1C_=113Z)S6__^#Q!2)1>2#9?P`Z9````#_=>SHWP$` +M`%G#BV7HZ!/]__^#8"``BU44BUT,@7H$@````'\&#[Y#".L#BT,(B47@BWH0 +M,\F)3=@Y2@QV.FO9%(E=W#M$.P2+70Q^(HM=W#M$.PB+70Q_%FO!%(M$.`1` +MB47@BTH(BP3!B47@ZPE!B4W8.TH,2#?<0`=2F%VW0E_W<8Z%38__]9 +MA+?0QT$O]U(/]U'%?_=0CH,P8``(/$$(-]+`#_=0AU`U?K`_]U+.C5 +MUO__5HMU)/\V_W48_W445^@,"```BT8$0&@``0``_W4HB4<(BT4<_W`,_W48 +M_W405_]U".BA_?__@\0L7H7`=`=74.A>UO__7UW#58OLBT4(BP"!.&-S;>!U +M-H-X$`-U,(%X%"`%DQET$H%X%"$%DQET"8%X%"(%DQEU%8-X'`!U#^@"^___ +M,\E!B4@@B\%=PS/`7<-5B^R#[$13BUT,5E>+?1C&1=@`QD7_`(%_!(````!_ +M!@^^0PCK`XM#"(E%^(/X_P^,[@(``#M'!`^-Y0(``(MU"($^8W-MX`^%GP(` +M`(-^$`,/A!U*X-^$`-U)8%^%"`%DQET$H%^%"$%DQET"8%^%"(% +MDQEU"H-^'``/A$("``#H#OK__X-X'`!T0>@#^O__BT`!6 +M@V`<`.AZ`P``65F$P'4>_W7@Z`@$``!9A,`/A`,"``#I`P(``(M-$(E-].L& +MBTWTBT7X@3YCR+6?R%VXE=Y(M=#`^.E@```(M&'(M-[(M`#(L0@\`$B470BT7D +MB57,BWW0B7WPBWT8B57A.!P``@\0,A2)3>R%P'XNBU7,Z[/_==B+1?#_=23& +M1?\!_W4@_W7(_S#_=>Q7_W44_W7T4U;HY/S__X/$+(M5Z(M-X(M%^$*#P12) +M5>B)3>`[5=0/@B;___^`?1P`=`IJ`5;HM/G__UE9@'W_``^%@0```(L')?__ +M_Q\](063&7)S@W\<`'4,]D<@!'1G@WT@`'5A]D<@!'5M_W<<5NC$`0``65F$ +MP'5,Z"KX___H)?C__^@@^/__B7`0Z!CX__^#?20`BTWT5HE(%'5?4^M?BTT0 +M@W\,`'8<@'T<`'4H_W4D_W4@4%?_=1114U;H6@```(/$(.C>]___@W@<`'4' +M7UY;B^5=P^BC20``:@%6Z`CY__]968U-O.BY^?__:%RZ0P"-1;Q0Z!CM____ +M=23H\]+__VK_5_]U%%/H,`0``(/$$/]W'.B:^___S%6+[%%15XM]"($_`P`` +M@`^$^P```%-6Z'#W__^+71B#>`@`=$5J`/\5U#%#`(OPZ%CW__\Y<`AT,8$_ +M34]#X'0I@3]20T/@="'_=23_=2!3_W44_W40_W4,5^CUT/__@\0PP`#X2A````C47\4(U%^%#_=1S_=2!3Z*G1__^+3?B#Q!2+5?P[RG-Y +MC7`,BT4<.T;T?&,[1OA_7HL&BWX$P>`$BWP'](7_=!.+5@2+7`+TBU7\@'L( +M`(M=&'4XBWX$@\?P`\>+?0CV`$!U*&H!_W4DC4[T_W4@46H`4%/_=13_=1#_ +M=0Q7Z-SZ__^+5?R#Q"R+3?B+11Q!@\84B4WX.\IRC5Y;7XOE7%]@^$@@```(L^,]N%_WYQBT4(B].)7?R+0!R+0`R+"(/` +M!(E-\(E%Z(O(BT7PB4WTB47XA+?0@S]CDW?B6+WHM'!&AD[D,` +MBT0#!(/`!%#H4?7__UE9A2% +MP'03B\CHN\#___]5Y(O(ZQ#H0D8``(M%"/;!"'04BT@8A@3A-3T/@=!:!.&-S;>!U(>B(\___@V`8`.E610``Z'KS__^#>!@`?@CH +M;_/___](&#/`7<-J$&A8N4,`Z+"___^+11"!>`2`````BT4(?P8/OG`(ZP.+ +M<`B)=>3H///___]`&(-E_``[=11T7(/^_WY2BTT0.W$$?4J+00B+%/")5>#' +M1?P!````@WSP!`!T)XM%"(E0"&@#`0``4(M!"/]T\`3HZ//__^L-_W7LZ#W_ +M__]9PXMEZ(-E_`"+=>")=>3KI.BK1```QT7\_O___^@4````.W44=>J+10B) +M<`CH4K___\.+=>3HK_+__X-X&`!^".BD\O___T@8PU6+[%-65_]U$.B&`0`` +M6>B,\O__BTT8,_:+50B[____'[\B!9,9.7`@=2*!.F-S;>!T&H$Z)@``@'02 +MBP$CPSO'<@KV02`!#X6G````]D($9G0E.7$$#X28````.74<#X6/````:O]1 +M_W44_W4,Z,7^__^#Q!#K?#EQ#'4:BP$CPSTA!9,9<@4Y<1QU"CO'!U.8-Z$`-R,SEZ%'8NBT(7<.+ZHOQB\%J`>C#!```,\`SVS/),](S___F58OL4U97:@!2:*(S +M0@!1Z-#F``!?7EM=PU6+;"0(4E'_="04Z*G^__^#Q`Q=P@@`5E>_@!!&`#/V +M:@!HH`\``%?H?@(``(/$#(7`=!7_!9@01@"#QAB#QQB#_AARV[`!ZP?H!0`` +M`#+`7U[#5HLUF!!&`(7V="!KQAA7C;AH$$8`5_\5U#!#`/\-F!!&`(/O&(/N +M`77K7[`!7L-5B^RA:.9#`(/@'VH@62O(BT4(T\@S!6CF0P!=PU6+[(M%"#/) +M4U97C1R%K!!&`#/`\`^Q"XL5:.9#`(//_XO*B_*#X1\S\-/.._=T:87V=`2+ +MQNMCBW40.W44=!K_-NA9````687`=2^#Q@0[=11U[(L5:.9#`#/`AM5BQR=Z%5#`%9H``@``&H`4_\5[#%#`(OPA?9U)_\5`#!# +M`(/X5W4-5E93_Q7L,4,`B_#K`C/VA?9U"8/(_X<',\#K$8O&AP>%P'0'5O\5 +MB#!#`(O&7E];7<-5B^Q6:(Q60P!HA%9#`&B,5D,`:@3HQ?[__XOP@\00A?9T +M#_]U"(O.Z`RZ____UEY=PUY=_R7<,4,`58OL5FB@5D,`:)A60P!HH%9#`&H% +MZ(O^__^#Q!"+\/]U"(7V=`N+SNC2N?___];K!O\5Z#%#`%Y=PU6+[%9HL%9# +M`&BH5D,`:+!60P!J!NA1_O__@\00B_#_=0B%]G0+B\[HF+G____6ZP;_%>`Q +M0P!>7<-5B^Q6:,160P!HO%9#`&C$5D,`:@?H%_[__X/$$(OP_W4,_W4(A?9T +M"XO.Z%NY____UNL&_Q7D,4,`7EW#58OL5FC85D,`:-!60P!HV%9#`&H(Z-K] +M__^+\(/$$(7V=!3_=1"+SO]U#/]U".@;N?___];K#/]U#/]U"/\5V#%#`%Y= +MPZ%HYD,`NM`01@!6@^`?,_9J(%DKR+BL$$8`T\XSR3,U:.9#`#O0&]*#XO># +MP@E!B3"-0`0[RG7V7L-5B^R`?0@`=2=6OIP01@"#/@!T$(,^_W0(_S;_%8@P +M0P"#)@"#Q@2!_JP01@!UX%Y=PZ%HYD,`@^`?:B!9*\@SP-/(,P5HYD,`H]`0 +M1@##S,S,S,S,S,S,S,S,S,S,58OL4U9756H`:@!H2#="`/]U".@JXP``75]> +M6XOE7<.+3"0$]T$$!@```+@!````=#*+1"04BTC\,\CHBK?__U6+:!"+4"A2 +MBU`D4N@4````@\0(78M$)`B+5"00B0*X`P```,-35E>+1"0055!J_FA0-T(` +M9/\U`````*%HYD,`,\10C40D!&2C`````(M$)"B+6`B+<`R#_O]T.H-\)"S_ +M=`8[="0L=BV--':+#+.)3"0,B4@,@WRS!`!U%V@!`0``BT2S".A)````BT2S +M".A?````Z[>+3"0$9(D-`````(/$&%]>6\,SP&2+#0````"!>010-T(`=1"+ +M40R+4@PY40AU!;@!````PU-1NY#F0P#K"U-1NY#F0P"+3"0,B4L(B4,$B6L, +M55%06%E=65O"!`#_T,-6Z._J__^+<`2%]G0)B\[H);?____6Z+$\``#,B_]5 +MB^R+10AFBPB#P`)FAEM4```B_]5B^R+50Q6BW4(5P^W.@^W#BO/=14K\F:%_W0.@\("#[06#R/]=PS/`A#`[ +M\W8LZV*+A8S[__^#R`!T4X7;=!N%]GD',\!FB0?K$(N%F/O__SO#=%`SR6:) +M#$>-C>3[___HY00``("]B/O__P!T#8N-?/O__X.A4`,``/U?B\9>BTW\,\U; +MZ)&R__^+Y5W#A=MU!8/._^O#BX68^___.\-ULVK^7C/`9HE$7_[KK8.Y!`0` +M``!U!K@``@``PXN!``0``-'HPXO_58OL48/(_S/25HMU"/?V5X/@_HOY@_@" +MB^5=P@0`B_]5B^R+111(@^@!="Z#Z`%T)8/H"70@@WT4 +M#70>BD40/&-T"#QS=`0RR>L"L0$SP(3)#Y3`7<.P`5W#,L!=PXO_58OLBT44 +M2(/H`70]@^@!=#2#Z`ET+X-]%`UT*8M%"#/)@^`$L@$+P74"BM%F@WT08W0' +M9H-]$'-U`K$!,\`ZT0^4P%W#L`%=PS+`7<.+_U:+\5>+O@0$``#HPO[__X7_ +M=00#QNL"`\=?7L.+_U6+[%-6B_%7C4Y`B[D$!```A?]U`HOYZ)?^__^+70A( +M`_B)?C2+3BB%R7\$A=MT,#/2B\/W=0Q)@,(PB4XHB]B`^CE^$8!]$``/E,#^ +MR"3@!&$L.@+0BT8TB!#_3C3KQ8M&-"OXB7XX0%^)1C1>6UW"#`"+_U6+[%%1 +M4U:+\5>-3D"+N00$``"%_W4"B_GH(/[__XM5#$B+70@#^(E^-(M.*(7)?P:+ +MPPO"=#IJ`/]U$(U!_U)3B48HZ&G=``"`P3")7?R+V(#Y.7X1@'T4``^4P/[( +M).`$82PZ`LB+1C2("/].-.NYBT8T*_B)?CA`7XE&-%Y;B^5=PA``B_]5B^Q6 +M,_8Y=1!^'%>+?12+30A7_W4,Z$D8``"#/_]T!D8[=1!\Z5]>7<.+_U6+[%8S +M]CEU$'XA4V8/OET,5XM]%(M-"%=3Z%L8``"#/_]T!D8[=1!\ZU];7EW#B_]5 +MB^Q1,\")3?R)`8E!!(E!"(E!#(E!$(E!%(E!&(E!'(E!((E!)(E!*&:)03") +M03B(03R)@4`$``")@40$``"+P8OE7<.+_U6+[%$STHE-_#/`B1%FB4$RB\&) +M402)40B)40R)41")412)41B)41R)42")422)42B(43")43B(43R)D4`$``") +MD40$``"+Y5W#B_]5B^Q6B_'H8/___XM%"(L`B89(!```BT4,B0:+11")1@2+ +M11B)1@B+112)1A"+11R)1A2+QEY=PA@`B_]5B^Q6B_'H:____XM%"(L`B89( +M!```BT4,B0:+11")1@2+11B)1@B+112)1A"+11R)1A2+QEY=PA@`B_]5B^Q6 +M_W42P`` +MB48,B\9>7<(8`(O_58OL5XOYBTT(QD<,`(7)=`J+`8E'!(M!!.L6H6P21@"% +MP'42H1#H0P")1P2A%.A#`(E'".M$5NC140``C5<$B0=2C7<(BTA,B0J+2$A0 +MB0[H#5,``%;_-^@R4P``BP^#Q!"+@5`#``!>J`)U#8/(`HF!4`,``,9'#`&+ +MQU]=P@0`B_]6B_'_M@0$``#HQ48``(.F!`0```!97L.+_U6+[%:+\?\VZ*Q& +M``"+50B#)@!9BP*)!HO&@R(`7EW"!`"+_U6+[(M%#(M-"%.+`(N`B````(L` +MBACK!3K#=`=!B@&$P'7UB@%!A,!T*.L)/&5T"SQ%=`=!B@&$P'7QB]%)@#DP +M=/HX&74!28H"04*(`83`=?9;7<.+_U6+[(I-"(U!X#Q:=P\/OL$/MH@X7D,` +M@^$/ZP(SR8M%#`^VA,A87D,`P>@$7<((`(O_58OLBTT(C4'@9H/X6G)1A"P`>L",L"#/P!U!H7;=`*)'U]>6XOE7<($`(O_5HOQ +MC8Y(!```Z-43``"$P'4%@\C_7L-3,]LY7A`/A;L```#H%DD``,<`%@```.CJ +M1P``@\C_Z;D```")7CB)7ASIA0```/]&$#E>&`^,C````/]V'`^V1C&+SE#H +M(?[__XE&'(/X"'2Z@_@'=\7_)(4V1$(`B\[H.`(``.M%@TXH_XE>)(A>,(E> +M((E>+(A>/.LXB\[HH`$``.LGB\[HMPH``.L>B5XHZR&+SNCG`@``ZQ"+SN@O +M`P``ZP>+SN@+!@``A,`/A&C___^+1A"*`(A&,83`#X5K_____T80_X90!``` +M@[Y0!````@^%2O___XM&&%M>PXU)`+%#0@"Z0T(`ST-"`-A#0@#A0T(`YD-" +M`.]#0@#X0T(`B_]6B_&-CD@$``#HN1(``(3`=06#R/]>PU,SVSE>$`^%P``` +M`.CZ1P``QP`6````Z,Y&``"#R/_IO@```(E>.(E>'.F&````@T80`CE>&`^, +MD````/]V'`^W1C*+SE#H-OW__XE&'(/X"'2Y@_@'=\3_)(5614(`B\[H.@$` +M`.M%@TXH_XE>)(A>,(E>((E>+(A>/.LXB\[HP````.LGB\[HQ0D``.L>B5XH +MZR&+SNCR`0``ZQ"+SNA[`P``ZP>+SN@=!P``A,`/A&?___^+1A`/MP!FB48R +M9H7`#X5G____@T80`O^&4`0``(.^4`0```(/A47___^+1AA;7L.+_\Y$0@#7 +M1$(`[$1"`/5$0@#^1$(``T5"``Q%0@`514(`#[Y!,8/H('0M@^@#="*#Z`AT +M%TB#Z`%T"X/H`W4<@TD@".L6@TD@!.L0@TD@`>L*@TD@(.L$@TD@`K`!PP^W +M03*#Z"!T+8/H`W0B@^@(=!=(@^@!=`N#Z`-U'(-)(`CK%H-)(`3K$(-)(`'K +M"H-)("#K!(-)(`*P`PXU&&%`/MD8QC8Y(!```4.CF$```L`%>PXU1&,9!/`%2#[=1,H'!2`0` +M`%+H#!$``+`!PXO_5HOQ5[\`@```BT8(BDXQQD8\``^VT8L`BP!FA3Q0=#B- +M1AA048V.2`0``.B5$```BTX0B@&(1C&-00&`?C$`B480=13HO$4``,<`%@`` +M`.B01```,L#K`K`!7U["!`"`>3$J=`J-02A0Z)W[___#@T$4!(M!%(M`_(E! +M*(7`>02#22C_L`'#9H-Y,BIT"HU!*%#HT/O__\.#010$BT$4BT#\B4$HA2P`=>L```"+01"` +M.&AU$$#'02P!````B4$0Z=,```#'02P"````Z<<```#'02P-````Z;L```#' +M02P(````Z:\```"+41"*`CPS=1B`>@$R=1*-0@+'02P*````B4$0Z8X````\ +M-G45@'H!-'4/C4("QT$L"P```(E!$.MU/&1T%#QI=!`\;W0,/'5T"#QX=`0\ +M6'5=QT$L"0```.M4QT$L!0```.M+@_AL="J#^'1T'(/X=W0.@_AZ=3?'02P& +M````ZR['02P,````ZR7'02P'````ZQR+01"`.&QU#4#'02P$````B4$0ZP?' +M02P#````L`'##[=!,H/X1G4:BP&#X`B#R``/A6(!``#'01P'````Z8@#``"# +M^$YU)HL!:@A:(\*#R``/A4$!``")41SHK$,``,<`%@```.B`0@``,L##@WDL +M`'7G@_AJ#X_-````#X2^````@_A)=%.#^$QT0H/X5'0Q:FA:.\(/A?P```"+ +M01!F.1!U$H/``L=!+`$```")01#IX@```,=!+`(```#IU@```,=!+`T```#I +MR@```,=!+`@```#IO@```(M1$`^W`H/X,W499H-Z`C)U$HU"!,=!+`H```") +M01#IF@```(/X-G469H-Z`C1U#XU"!,=!+`L```")01#K?X/X9'09@_AI=!2# +M^&]T#X/X=70*@_AX=`6#^%AU8<=!+`D```#K6,=!+`4```#K3VIL6CO"="J# +M^'1T'(/X=W0.@_AZ=3G'02P&````ZS#'02P,````ZR?'02P'````ZQZ+01!F +M.1!U#X/``L=!+`0```")01#K!\=!+`,```"P`<.+_U6+[%%35HOQ,]M#,\D/ +MOD8Q@_AD?VP/A),```"#^%A_/G0W@_A!#X23````@_A#=#Z#^$1^'8/X1P^. +M@````(/X4W4/B\[HH0L``(3`#X6?````,L#IS0$``%-J$.M7@^A:=!6#Z`=T +M5DB#Z`%UY%&+SNA8"```Z]*+SNB]!```Z\F#^'!_370_@_AG?C&#^&ET'(/X +M;G0.@_AO=;:+SN@1"P``ZZ6+SNB4"@``ZYR#3B`046H*B\[H.@D``.N,B\[H +M/04``.N#B\[H!0L``.EW____@^AS#X1G____2(/H`730@^@##X5G____4>EI +M____@'XP`'0'BL/I*`$``(M6(#/`5V:)1?R+^(A%_HO"P>@$A,-T)XO"P>@& +MA,-T!L9%_"WK%H33=`;&1?PKZPR+PM'HA,-T!L9%_""+^XI.,8#Y>'0%@/E8 +M=0F+PL'H!83#=0(RVX#Y870)@/E!=`0RP.L"L`&$VW4$A,!T)\9$/?PP@/E8 +M=`F`^4%T!#+`ZP*P`83`#Y3`_L@DX`1XB$0]_8/'`HM>)"M>."O?]L(,=1:- +M1AA04XV&2`0``&H@4.@3\___@\00_W8,C4884%>-1?R-CD@$``!0Z!@-``"+ +M3B"-?AB+P<'H`Z@!=!O!Z0+VP0%U$U=3C89(!```:C!0Z-+R__^#Q!!J`(O. +MZ+,+``"#/P!\'8M&(,'H`J@!=!-74XV&2`0``&H@4.BG\O__@\00L`%?7EN+ +MY5W#B_]5B^R#[`RA:.9#`#/%B47\4U:+\3/;:D%::E@/MT8R68/X9']K#X22 +M````.\%_/G0V.\(/A)0```"#^$-T/X/X1'X=@_A'#XZ!````@_A3=0^+SNC8 +M"0``A,`/A:`````RP.GD`0``:@%J$.M7@^A:=!6#Z`=T5DB#Z`%UXU.+SNBK +M!@``Z]&+SNCC`@``Z\B#^'!_370_@_AG?C&#^&ET'(/X;G0.@_AO=;6+SNC4 +M"```ZZ2+SNA7"```ZYN#3B`04VH*B\[H_08``.N+B\[H6@0``.N"B\[HR`@` +M`.EV____@^AS#X1F____2(/H`730@^@##X5F____4^EI____.%XP#X5``0`` +MBU8@,\E7B\*)7?3!Z`1!9HE=^&H@7X3!="B+PL'H!H3!=`EJ+5AFB47TZQ2$ +MT70$:BOK\8O"T>B$P70&9HE]](O9#[=.,H/Y>'0(:EA89CO(=0V+PL'H!:@! +M=`2T`>L",N2#^6%T#&I!7V8[SW0$,L#K`K`!:C!?A.1U!(3`=#!J6%AFB7Q= +M]&8[R'0,:D%89CO(=`0RP.L"L`&$P`^4P/[().`$>&:89HE$7?:#PP*+?B0K +M?C@K^_;"#'46C4884%>-AD@$``!J(%#H[/#__X/$$/]V#(U&&%!3C47TC8Y( +M!```4.A8"P``BTX@C5X8B\'!Z`.H`70;P>D"]L$!=1-35XV&2`0``&HP4.BK +M\/__@\00:@"+SN@'"@``@SL`?!V+1B#!Z`*H`7034U>-AD@$``!J(%#H@/#_ +M_X/$$%^P`8M-_%XSS5OH:*#__XOE7<.`>3$J=`J-0210Z-OS___#@T$4!(M! +M%(M`_(E!)(7`>0>#22`$]UDDL`'#9H-Y,BIT"HU!)%#H"_3__\.#010$BT$4 +MBT#\B4$DA#1A0$BT84BWC\A?]T-HM? +M!(7;="__=BP/MD8Q4/]V!/\VZ+/M__^#Q!")7C2$P`^W!W0+T>B)1CC&1CP! +MZQ>)1CCK#L=&-+1>0P#'1C@&````QD8\`%]>L`%;PXO_4U:+\5>#1A0$BT84 +MBWC\A?]T-HM?!(7;="__=BP/MT8R4/]V!/\VZ)#M__^#Q!")7C2$P`^W!W0+ +MT>B)1CC&1CP!ZQ>)1CCK#L=&-+1>0P#'1C@&````QD8\`%]>L`%;PXO_58OL +M45%6B_%7@TX@$(M&*(7`>1V*1C$\870-/$%T"<=&*`8```#K'<=&*`T```#K +M%'42BD8Q/&=T!#Q'=0?'1B@!````BT8HC7Y`4[M=`0``B\\#PU#H..S__X3` +M=0R+S^@5[/__*\.)1BB+AP0$``"%P'4"B\>#9?@`@V7\`(E&-(-&%`B+3A2+ +M0?B)1?B+0?R+SXE%_.C?Z___BY\$!```B\B%VW4"B]__=@@/OD8Q_W8$_S;_ +M=BA048O/Z.;L__]0B\_HL>O__U"-1?A34.A)3```BT8@@\0HP>@%6Z@!=!.# +M?B@`=0W_=@C_=C3H'_'__UE9BD8Q/&=T!#Q'=1>+1B#!Z`6H`74-_W8(_W8T +MZ$#P__]968M&-(`X+74(@TX@0$")1C2+5C2*`CQI=`P\270(/&YT!#Q.=03& +M1C%SC7H!B@I"A,EU^2O7L`%?B58X7HOE7<.+_U6+[%%15E>+\6IG66I'@TX@ +M$(M&*%J%P'D@#[=&,H/X870.@_A!=`G'1B@&````ZR#'1B@-````ZQ=U%0^W +M1C)F.\%T!68[PG4'QT8H`0```(M&*(U^0%.[70$``(O/`\-0Z-+J__^$P'4, +MB\_HK^K__RO#B48HBX<$!```A>K__XN?!`0``(O(A=MU`HO?_W8(#[Y&,O]V!/\V_W8H +M4%&+S^B`Z___4(O/Z$OJ__]0C47X4U#HXTH``(M&((/$*,'H!5NH`703@WXH +M`'4-_W8(_W8TZ+GO__]960^W1C)J9UEF.\%T"&I'668[P747BT8@P>@%J`%U +M#?]V"/]V-.C1[O__65F+1C2`."UU"(-.($!`B48TBU8TB@(\:70,/$ET"#QN +M=`0\3G4':G-89HE&,HUZ`8H*0H3)=?DKU[`!7XE6.%Z+Y5W#B_]6B_%7_W8L +M#[9&,5#_=@3_-N@WZO__@\00C7Y`A,!T.8-&%`2+1A13BY\$!```#[=`_(7; +M=0*+WU"+S^AOZ?__4(U&.%-0Z/([``"#Q!!;AP@0` +MB_]5B^Q14U:+\5?&1CP!@T84!(M&%/]V+`^W6/P/MT8R4/]V!/\VZ-/I__^# +MQ!"-?D"$P'4RBX\$!```B%W\B$7]A17&1C`!ZP^+AP0$``"%P'4"B\=FB1B+AP0$``"%P'0"B_B)?C2P +M`5_'1C@!````7EN+Y5W"!`"+_U6+[%-6B_'_=BSHV?K__UF+V(O+@^D!='B# +MZ0%T5DF#Z0%T,X/I!'07Z$@$J`&+1A2+2/B+4/SK6(M&((-&%`3!Z`2H`8M&%'0%BT#\ZS^+2/PSTNL[ +MBT8@@T84!,'H!*@!BT84=`8/OT#\ZR$/MT#\ZQN+1B"#1A0$P>@$J`&+1A1T +M!@^^0/SK!`^V0/R9B\A7BWX@B\?!Z`2H`707A=)_$WP$A@'J`%T&H-^ +M.`!T"(M&-(`X,'0,_TXTBTXTQ@$P_T8XL`%>6UW""`"+_U:+\5>#1A0$BT84 +MBWC\Z()*``"%P'44Z`\W``#'`!8```#HXS4``#+`ZT3_=BSH:_G__UF#Z`%T +M*X/H`70=2(/H`700@^@$=)5P3K%8M&&(D'ZPYFBT889HD'ZP6* +M1AB(!\9&,`&P`5]>PXM1((O"P>@%J`%T"8'*@````(E1(&H`:@CH)/[__\-J +M`6H0QT$H"````,=!+`H```#H#/[__\.+_U-6B_%7@T84!(M&%(M^*(M8_(E> +M-(/__W4%O____W__=BP/MD8Q4/]V!/\VZ/_F__^#Q!"$P'0:A=MU!\=&-+Q> +M0P!7_W8TQD8\`>@=$@``ZQ2%VW4'QT8TM%Y#`%?_=C3HX!```%E97XE&.+`! +M7EO#B_]35HOQ5X-&%`2+1A2+?BB+6/R)7C2#__]U!;____]__W8L#[=&,E#_ +M=@3_-NC,YO__@\00A,!T'(7;=0?'1C2\7D,`5_]V-,9&/`'HJA$``%E9ZQ6% +MVW4'QT8TM%Y#`&H`5XO.Z`D```!?B48XL`%>6\.+_U6+[%97B_DS]HM7-#EU +M"'XE4XH"A,!T'0^VR+L`@```BT<(BP"+`&:%'$AT`4)"1CMU"'S=6U^+QEY= +MP@@`@SD`=1/H434``,<`%@```.@E-```,L##L`'#B_]5B^R+T8L*BT$(.T$$ +MBT4,=12`>0P`=`3_`.L#@PC_BP**0`SK%O\`BP+_0`B+`HL(BD4(B`&+`O\` +ML`%=P@@`B_]5B^R+T8L*BT$(.T$$BT4,=12`>0P`=`3_`.L#@PC_BP**0`SK +M&?\`BP+_0`B+`HL(9HM%"&:)`8L"@P`"L`%=P@@`B_]5B^R#[!"A:.9#`#/% +MB47\4U:+\5>`?CP`=%V+1CB%P'Y6BWXT,]N%P'1E#[<'C7\"@V7P`%!J!HU% +M]%"-1?!0Z!(W``"#Q!"%P'4F.47P="'_=@R-1AA0_W7PC47T4(V.2`0``.C& +M````0SM>.'6[ZQZ#3AC_ZQC_=@R-1AA0_W8XC8Y(!```_W8TZ*````"+3?RP +M`5]>,\U;Z)B6__^+Y5W"!`"+_U6+[%%14U:+\5>`?CP`=5:+1CB%P'Y/BUXT +M,_^%P'1>,\!FB47\BT8(4(L`_W`$C47\4U#H0C0``(/$$(E%^(7`?AV-3AA1 +M_W7\C8Y(!```Z+W^__\#7?A'.WXX=<+K'H-.&/_K&/]V#(U&&%#_=CB-CD@$ +M``#_=C3HG@```%]>L`%;B^5=P@0`B_]5B^Q14597BWT4B\&)1?B+#X,G`(L` +MB4W\BW`$.7`(=1B`>`P`=`J+31"+10P!`>M*BT40@PC_ZT4K<`A3BUT,._-R +M`HOS5O]U"/\PZ`J>__^+3?B#Q`R+`0$PBP$!<`B+`8!X#`"+11!T!`$8ZPL[ +M\W0%@PC_ZP(!,%N+3?R#/P!U!H7)=`*)#U]>B^5=PA``B_]5B^Q145.+712+ +MP5>)1?B+"X,C`(L0B4W\BWH$.7H(=1B`>@P`=`J+31"+10P!`>M1BT40@PC_ +MZTPK>@B+10P[^'("B_A6C30_5O]U"/\RZ'2=__^+3?B#Q`R+`0$PBP%>`7@( +MBP&`>`P`BT40=`>+30P!".L,.WT,=`6#"/_K`@$XBTW\@SL`=0:%R70"B0M? +M6XOE7<(0`(O_58OL_W4@_W4<_W48_W44_W40_W4,_W4(Z$S?__^#Q!Q=PXO_ +M58OL_W4@_W4<_W48_W44_W40_W4,_W4(Z*3@__^#Q!Q=P\S,S,S,S,S,B_]5 +MB^R#[!"-1?A0_Q7P,4,`A7<.+_U6+[(M-$%>+?0B%R70MBU4,*]GSJQ/)9O.KBT4(7UW#B_]5B^R+10@SR5-6 +M5V8Y"'0LBW4,#[<^B\YFA?]T%0^W&(O79CO3=!>#P0(/MQ%FA=)U\(/``C/) +M9CD(==HSP%]>6UW#B_]5B^R+10B9,\(KPEW#B_]5B^Q14:%HYD,`,\6)1?R+ +M10Q7BWT0A1&+10R+WBO:A?^+??AU#$_K"8M]^(T$%HE% +M##O#=J\S]HO&7EN+3?PSS5_H@I+__XOE7<.%_W3GBTT84/]U"/\58#)#`/]5 +M&(OP]]Y9&_;WUB-U#%GKRLR+_U6+[%&A:.9#`#/%B47\BTT(4XM=##O9=FR+ +M11!65XT4`8ORB_D[\W>7UZ+3?PSS5OHR)'__XOE7M>7UW#S,S,S,S,S(O_58OL@>P<`0``H6CF0P`SQ8E%_(M-"(M5#(F- +M_/[__U:+=12)M0#___]7BWT0B;T$____A@AD?__B^5=PX7_=-R%]G38QX7X_O__`````(/Z`@^"$@,` +M`$H/K]=3`]&)E0C___^+PC/2*\'W]XU8`8/["'<65E?_M0C___]1Z'W^__^# +MQ!#IMP(``-'K#Z_?`]E348O.B9WP_O___Q5@,D,`_]:#Q`B%P'X05U/_M?S^ +M___HZ/[__X/$#/^U"/___XO._[7\_O___Q5@,D,`_]:#Q`B%P'X55_^U"/__ +M__^U_/[__^BV_O__@\0,_[4(____B\Y3_Q5@,D,`_]:#Q`B%P'X05_^U"/__ +M_U/HCO[__X/$#(N%"/___XOXB[7\_O__BY4$____B87L_O__D#O>=C<#\HFU +M]/[__SOS+ +MSO\58#)#`/_6@\0(AC^__^) +MO>3^__\[]W0SB]Z+UXNUZ/[__RO?B@*-4@&*3!/_B$03_XA*_X/N`77KB[7T +M_O__BYWP_O__BY4$____BX4(____.]\/A?K^__^+WHF=\/[__^GM_O__`_H[ +MWW,RC:0D`````"OZ._MV)8N-`/___U-7_Q5@,D,`_Y4`____BY4$____@\0( +MA+SO\58#)#`/_6BY4$____@\0( +MA+O03____I*_W__XNU`/___^L&B[T$____BX7X_O__@^@!B87X_O__>!:+ +MC(4,____BU2%A(F-_/[__^GV_/__6XM-_%\SS5[HY(W__XOE76\/,S,S,S,S, +MS(M,)`Q7A#ZP%U[8M$)!!;7E_#]\<#````=!:(!X/'`8/I`0^$F````/?' +M`P```'7JB]G!Z0)U=(@'@\]\(``/\`=`SWP@```/]U +MQ(D7ZQB!XO__``")%^L.@>+_````B1?K!#/2B1>#QP0SP(/I`70,,\")!X/' +M!(/I`77V@^,##X5W____BT0D$%M>7\.+_U6+[(M5"(O"5KX`_P``B\HCQL'A +M$`/!B\K!Z0@CSL'@"`/!P>H8`\)>7<.+_U6+[(/L'(U-Y%/_=1#H$=W__XM= +M"('[``$``'-+C47H4%/H:P(``%E9A,!T)(!]\`"+1>B+@)@````/M@P8=`J+ +M1>2#H%`#``#]B\'I\@```(!]\`!T"HM-Y(.A4`,``/V+P^G;````,\!FB47\ +MB$7^BT7H@W@$`7XNB\.-3>C!^`B)1?11#[;`4.A+/@``65F%P'03BT7TB$7\ +M,\!J`HA=_8A%_EGK%NA**```,\G'`"H````SP(A=_$&(1?UFB47XC57XB$7Z +MBT7H:@'_<`AJ`U)1C4W\4?]U#/^PJ````(U%Z%#H&$$``(/$)(7`=1@X1?`/ +MA&?___^+1>2#H%`#``#]Z5C___^#^`%U%H!]\``/MD7X="N+3>2#H5`#``#] +MZQ\/ME7X#[9%^<'B"`O0@'WP`'0*BTWD@Z%0`P``_8O"6XOE7<.+_U6+[(/L +M'(U-Y%/_=1#HQ]O__XM="('[``$``'-+C47H4%/H/@$``%E9A,!T)(!]\`"+ +M1>B+@)0````/M@P8=`J+1>2#H%`#``#]B\'I\@```(!]\`!T"HM-Y(.A4`,` +M`/V+P^G;````,\!FB47\B$7^BT7H@W@$`7XNB\.-3>C!^`B)1?11#[;`4.@! +M/0``65F%P'03BT7TB$7\,\!J`HA=_8A%_EGK%N@`)P``,\G'`"H````SP(A= +M_$&(1?UFB47XC57XB$7ZBT7H:@'_<`AJ`U)1C4W\4?]U#/^PJ````(U%Z%#H +MSC\``(/$)(7`=1@X1?`/A&?___^+1>2#H%`#``#]Z5C___^#^`%U%H!]\``/ +MMD7X="N+3>2#H5`#``#]ZQ\/ME7X#[9%^<'B"`O0@'WP`'0*BTWD@Z%0`P`` +M_8O"6XOE7<.+_U6+[/]U#&H"_W4(Z%(```"#Q`SWV!O`]]A=PXO_58OL_W4, +M:@'_=0CH-0```(/$#/?8&\#WV%W#B_]5B^R+11"%P'0-BP"+"(M%"`^W!$'K +M#.C*.P``BTT(#[<$2"-%#%W#B_]5B^R+31"%R706BP&#>`0!?@Y1_W4,_W4( +MZ/T[``#K#%'_=0S_=0CHJ/___X/$#%W#B_]5B^S_=0QH``$``/]U".@*_O__ +M@\0,7<.+_U6+[/]U#&@``@``_W4(Z*;\__^#Q`Q=PXO_58OLH6P21@"%P'00 +M:@#_=0CHM/___UE9B\CK#HM-"(U!OX/X&7<#@\$@B\%=PXO_58OLH6P21@"% +MP'00:@#_=0CHGO___UE9B\CK#HM-"(U!GX/X&7<#@\'@B\%=PXO_58OLH1@- +M1@!65X/X!7Q\BW4(B]:#XA]J(%@KPO?:&](CT(M%##O"#X!\K^,7T5\D#^>L/Q?5T +M`<7]U\"%P'4'@\$@.\]U[8M%#`/&ZP:`.0!T!4$[R'7V*\[%^'?IE````(/X +M`7QUBW4(B]:#X@]J$%@KPO?:&](CT(M%##O"#X`\K^`/YZQ(/*`%F#W3!9@_7P(7` +M=0>#P1`[SW7JBT4,`\;K!H`Y`'0%03O(=?8KSNL:BU4(B\J+10P#PCO0=`J` +M.0!T!4$[R'7V*\I?B\%>7<.+_U6+[%&A&`U&`(M-"%97@_@%#XR\````]L$! +M=">+10R+T8T$03O(#X1]`0``,_]F.3H/A'(!``"#P@([T'7PZ68!``"+\8/F +M'VH@6"O&]]X;]B/PBT4,T>X[QG,"B_"-%'$S_XE5_(O1.TW\=`UF.3IT"(/" +M`CM5_'7S*]'1^CO6#X4G`0``C111B\@KSHO!@^`?*\C%]%?)C0Q*ZP_%]74" +MQ?W7P(7`=0>#PB`[T77MBT4(BTT,C0Q(ZPAF.3IT!X/"`CO1=?0KT-'ZQ?AW +MZ=H```"#^`$/C+,```#VP0%T)XM%#(O1C01!.\@/A+@````S_V8Y.@^$K0`` +M`(/"`CO0=?#IH0```(OQ@^8/:A!8*\;WWAOV(_"+10S1[CO&#P@([T77T*]#K'(M%#(O1C01!.\AT#C/_9CDZ=`>#P@([T'7T*]'1^E^+ +MPEZ+Y5W#B_]5B^R+10BH!'0$L`%=PZ@!=!N#X`)T"8%]#````(!WZH7`=0F! +M?0S___]_=]TRP%W#B_]5B^R+10B+31"+50R)$(E(!(7)=`*)$5W#B_]5B^R# +M["B-30Q35^BA[/__A,!T(8M]%(7_=#"#_P)\!8/_)'XFZ.(A``#'`!8```#H +MMB```#/;BU40A=)T!8M-#(D*7XO#6XOE7<-6_W4(C4W8Z.'5__^+10PS]HEU +M](E%Z.L#BT4,BAA`B44,C47<4`^VPVH(4(A=_.B,^___@\0,A1HA=_(EU#.L#BW4,A?]T!8/_ +M$'5XBL,L,#P)=P@/OL.#P-#K(XK#+&$\&7<(#[[#@\"IZQ.*PRQ!/!EW"`^^ +MPX/`R>L#@\C_AL3BL,L03P9=P@/ +MOLN#P1HA=_(EU#.N8_W7\C4T,B57XZ%('``"+7?CVPPAU"HM%Z#/; +MB44,ZT&+=?164^C;_?__65F$P'0HZ"P@``#'`"(```#VPP%U!8/._^L:]L," +M=`>[````@.L0N____W_K"?;#`G0"]]Z+WH!]Y`!>#X0@_O__BT78@Z!0`P`` +M_>D1_O__B_]5B^R#[!R-30Q35^AYZO__A,!T(XM%%&H"7X7`="\[QWP%@_@D +M?B;HN!\``,<`%@```.B,'@``,]N+51"%TG0%BTT,B0I?B\-;B^5=PU;_=0B- +M3>3HM]/__XM%##/VB77XB47TZP.+10P/MS`#QVH(5HE%#.CA.```65F%P'7G +M,]LX71@/E<-F@_XM=00+W^L&9H/^*W4.BWT,#[`7``#K,[@0&```9COPX&O\``&8[\',*#[?&+1#_``#K`X/(_X/X_W4P +M:D%89CO&=PAJ6EAF._!V"8U&GV8[1?QW%(U&GV8[1?P/M\9W`X/H((/`R>L# +M@\C_A#QP*)?0R#^'AT'H/X6'09A#QP*)?0R#R/\STO=U%(O( +M:C!89COP#X)5`@``:CI89COP`7``#K,[@0&```9COPX&O\` +M`&8[\',*#[?&+1#_``#K`X/(_X/X_W4P:D%89CO&=PAJ6EAF._!V"8U&GV8[ +M1?QW%(U&GV8[1?P/M\9W`X/H((/`R>L#@\C_@_C_=#$[111S+(MU^(/+"#OQ +M<@MU!#O"=@6#RP3K"0^O=10#\(EU^`^W-X/'`HE]#.DY_?__5HU-#.B2```` +M]L,(=0J+1?0SVXE%#.M!BW7X5E/H]O;__UE9A,!T*.A'&0``QP`B````]L,! +M=06#SO_K&O;#`G0'NP```(#K$+O___]_ZPGVPP)T`O?>B]Z`??``7@^$9?G_ +M_XM%Y(.@4`,``/WI5OG__XO_58OL_PF*10B+"83`=!0X`700Z.@8``#'`!8` +M``#HO!<``%W"!`"+_U6+[(,!_F:+10B+"6:%P'059CD!=!#HO!@``,<`%@`` +M`.B0%P``7<($`(O_58OL46H!:@I148O$:@#_=0A0Z&OV__^#Q`QJ`.A\]O__ +M@\04B^5=PXO_58OL@WT(`'4$,\!=PXM-"%O__B^5=PVH,:)BZ0P#HPWK__X-EY`!J`.@),@``68-E_`"+ +M-6CF0P"+SH/A'S,U(!%&`-/.B77DQT7\_O___^@+````B\;HT'K__\.+=>1J +M`.@@,@``6<-J#&BXND,`Z&&G``#H<1T``(MP#(7V=!Z#9?P`B\[_%6`R0P#_ +MUNL',\!`PXMEZ,=%_/[____H&!,``,R+_U6+[%%1H6CF0P`SQ8E%_%;HLQT` +M`(OPA?8/A$,!``"+%HO*4S/;5XV"D````#O0=`Z+?0@Y.70)@\$,.\AU]8O+ +MA".L0_W$$B5D(B\__ +M%6`R0P#_UXM%^%F)1@2#R/]?6XM-_#/-7N@<>/__B^5=PXO_58OL,\"!?0AC +MCH-_W_ +M_XMU$&H"Z$LO``!9P^C@( +MJ`%U$/]U"/\5##!#`%#_%B3#HIQ$``(O&Z?0```!35^C@ +M.P``:`0!``"^,!%&`#/_5E?_%?@Q0P"+'>`61@")->@61@"%VW0%@#L`=0*+ +MWHU%](E]_%"-1?R)??105U=3Z+$```!J`?]U]/]U_.@9`@``B_"#Q""%]G4, +MZ%X2``!J#%^)..LQC47T4(U%_%"+1?R-!(905E/H>0```(/$%(-]"`%U%HM% +M_$BCU!9&`(O&B_>CV!9&`(O?ZTJ-1?B)??A05NA.-@``B]A9687;=`6+1?CK +M)HM5^(O/B\(Y.G0(C4`$03DX=?B+QXD-U!9&`(E%^(O?B178%D8`4.A@#0`` +M68E]^%;H5@T``%E?B\-;7HOE7<.+_U6+[%&+1113BUT85HMU"%>#(P"+?1#' +M``$```"+10R%P'0(B3B#P`2)10PRR8A-_X`^(G4-A,FP(@^4P4:(3?_K-?\# +MA?]T!8H&B`='B@9&B$7^#[[`4.@;/@``687`=`S_`X7_=`6*!H@'1T:*1?Z$ +MP'09BDW_A,EUM3P@=`0\"76MA?]T!\9'_P#K`4[&1?\`@#X`#X3"````B@8\ +M('0$/`EU`T;K\X`^``^$K````(M-#(7)=`B).8/!!(E-#(M%%/\`,])",\#K +M`D9`@#Y<=/F`/B)U,:@!=1Z*3?^$R70/C4X!@#DB=02+\>L+BDW_,]*$R0^4 +M1?_1Z.L+2(7_=`3&!UQ'_P.%P'7QB@:$P'0[@'W_`'4(/"!T,3P)="V%TG0C +MA?]T`X@'1P^^!E#H0CT``%F%P'0,1O\#A?]T!8H&B`='_P-&Z7?___^%_W0$ +MQ@<`1_\#Z37___^+30Q?7EN%R70#@R$`BT44_P"+Y5W#B_]5B^Q6BW4(@?[_ +M__\_<@0SP.L]5X//_XM-##/2B\?W=1`[R',-#Z]-$,'F`BO^._EW!#/`ZQF- +M!#%J`5#H7PP``&H`B_#HBPL``(/$#(O&7UY=PXO_58OL7>D'_?__@STX$D8` +M`'0#,\##5E?H!CD``.@!/0``B_"%]G4%@\__ZRI6Z#````!9A+_NL,4.@S +M"@``C7\$BP=9A- +M?@3K$8M-"%;_%6`R0P#_50A9@\8$._=UZXM-_%\SS5[HX'#__XOE7<($`(O_ +M58OLBT4(BP`[!4021@!T!U#H>?___UE=P\S,S,S,B_]5B^R+10B+`#L%0!)& +M`'0'4.A9____65W#:"!^0@"Y.!)&`.AV____:$!^0@"Y/!)&`.AG_____S5$ +M$D8`Z"W_____-4`21@#H(O___UE9P^GP_?__:@QH`+M#`.@-3'1?S^____Z`T```"+QN@@3'1?S^____Z`T```"+QNC/A3BP"+&(7;=0B#R/_IZ0```(L5:.9#`%97BSN+\HM;!(/F'S/Z +MB77LB\XSVM//T\N%_P^$O@```(/__P^$M0```(E]](E=\&H@62O.,\#3R#/" +M@^L$.]]R8#D#=/6+,XM-[#/RT\Z+SHD#_Q5@,D,`_]:+1>B+%6CF0P"+\H/F +M'XEU[(L`BP"+"(M`!#/*B4WX,\*+SM--^-/(BTWX.TWT=0MJ(%D[1?!TH(M- +M^(E-](OYB47PB]CKCH/__W0-5^A[!P``BQ5HYD,`68O",]*#X!]J(%DKR-/* +MBTWH,Q5HYD,`BP&+`(D0BP&+`(E0!(L!BP")4`A?,\!>BTW\,\U;Z#9N__^+ +MY5W#B_]5B^R#[`R+P8E%^%:+`(LPA?9U"(/(_^D>`0``H6CF0P"+R%.+'H/A +M'U>+?@0SV(MV"#/X,_#3S]/.T\L[_@^%M````"OSN``"``#!_@([\'<"B\:- +M/#"%_W4#:B!?._YR'6H$5U/H[C@``&H`B47\Z+\&``"+3?R#Q!"%R74H:@2- +M?@174^C..```:@")1?SHGP8``(M-_(/$$(7)=0B#R/_ID0```(T$L8O9B47\ +MC32YH6CF0P"+??R#X!]J(%DKR#/`T\B+SS,%:.9#`(E%](O&*\>#P`/!Z`([ +M]QO2]](CT(E5_'00BU7T,\!`B1&-200[1?QU]8M%^(M`!/\PZ+K]__]3B0?H +M4K+__XM=^(L+BPF)`8U'!%#H0++__XL+5HL)B4$$Z#.R__^+"X/$$(L)B4$( +M,\!?6UZ+Y5W#B_]5B^S_=0AH2!)&`.A>````65E=PXO_58OL48U%"(E%_(U% +M_%!J`N@#_?__65F+Y5W#B_]5B^Q6BW4(A?9U!8/(_^LHBP8[1@AU'Z%HYD,` +M@^`?:B!9*\@SP-/(,P5HYD,`B0:)1@2)1@@SP%Y=PXO_58OL45&-10B)1?B- +M10R)1?R-1?A0:@+HROS__UE9B^5=P\S,S&A8YT,`N9`21@#H40$``+`!P\S, +MS,S,S,S,S,S,S,S,:$@21@#HZ%5J +M__^+Y5W#B_]5B^S_=0CHT_K__UFC9!)&`%W#B_]35NC9,```BS7@%D8`A?9U +M!;YH$D8`,MN*!CP@?PB$P'0JA-MT(#PB=06$VP^4PP^^P%#H,S0``%F%P'0! +M1D;KUSP@?P=&B@:$P'7UB\9>6\.+_U6+[%%1H6CF0P`SQ8E%_(M%#%-6BW4( +M*\:#P`-7,__!Z`(Y=0P;V_?3(]AT'(L&B47XA2+3?Q?7C/-6^B1:?__B^5=PXO_58OL4:%HYD,`,\6)1?Q6BW4(5^L7 +MBSZ%_W0.B\__%6`R0P#_UX7`=0J#Q@0[=0QUY#/`BTW\7S/-7NA,:?__B^5= +MPXO_58OLBT4(/0!```!T(ST`@```=!P]```!`'05Z*8&``#'`!8```#H>@4` +M`&H66%W#N0`71@"'`3/`7<,SP+EL$D8`0(#X?WK`X/)`HF.4`,``.L'@PV@[4,`_UY=PZ%P$D8`PXO_58OL +MBT4(A7<.+_U6+[(-]"`!U!#/`7<.+30B-40&*`4&$P'7Y*\I35XU9`5/H +M++'__XOX687_=01?6UW#_W4(4U?H&````(/$#(7`=02+Q^OG,\!04%!04.C& +M`P``S(O_58OLBU4(5H72=!&+30R%R70*BW40A?9U%\8"`.BS!```:A9>B3#H +MB`,``(O&7EW#5XOZ*_**!#Z(!T>$P'0%@^D!=?%?AP61@#_%0`R0P"%P'485NA6!```B_#_ +M%0`P0P!0Z,\#``!9B09>7<.+_U6+[%:+=0B#_N!W,(7V=1=&ZQ3H8O[__X7` +M="!6Z$'L__]9AC_`P``QP`,```` +M,\!>7P6 +M1@#_%00R0P"%P'39ZPWH7P,``,<`#````#/`7EW#B_]5B^Q7BWT(A?]U"_]U +M#.C]_O__6>LD5HMU#(7V=0E7Z++^__]9ZQ"#_N!V)>@A`P``QP`,````,\!> +M7UW#Z$K]__^%P'3F5N@IZ___687`=-M65VH`_S7L%D8`_Q4(,D,`A:?__66I0C87@_/__ +M:@!0Z"QL__]HS`(``(V%,/W__VH`4.@9;/__C87@_/__@\08B878_/__C84P +M_?__B87<_/__B87@_?__B8W<_?__B978_?__B9W4_?__B;70_?__B;W,_?__ +M9HR5^/W__V:,C>S]__]FC)W(_?__9HR%Q/W__V:,I<#]__]FC*V\_?__G(^% +M\/W__XM%!(F%Z/W__XU%!(F%]/W__\>%,/W__P$``0"+0/R)A>3]__^+10R) +MA>#\__^+11")A>3\__^+102)A>S\____%:PQ0P!J`(OX_Q6T,4,`C878_/__ +M4/\5L#%#`(7`=1.%_W4/@WT(_W0)_W4(Z)=H__]9BTW\,\U?Z#1D__^+Y5W# +MB_]5B^S_=0BY>!)&`.@D^?__7<.+_U6+[%&A:.9#`#/%B47\5NA%"```A +MZ-%C__^+Y5W#_W48BS5HYD,`B\[_=10S-7@21@"#X1__=1#3SO]U#/]U"(7V +M=;[H$0```,PSP%!04%!0Z'G___^#Q!3#:A?H_(X``(7`=`5J!5G-*59J`;X7 +M!`#`5FH"Z`;^__^#Q`Q6_Q4,,$,`4/\5S#%#`%[#B_]5B^R#[!#_=0R-3?#H +M][3__XU%]%!J!/]U".B\VO__@\0,@'W\`'0*BTWP@Z%0`P``_8OE7<.+_U6+ +M[*%L$D8`A7HM% +M"(7`=`.#"/]6@?____]_=A'H0_[__VH67HDPZ!C]___K4_]U&(U-[.A8LO__ +MBT7P,_8YL*@```!U76:+112Y_P```&8[P78VA=MT#X7_=`M75E/H=V?__X/$ +M#.CY_?__:BI>B3"`??@`=`J+3>R#H5`#``#]B\9>7UN+Y5W#A=MT!H7_=%^( +M`XM%"(7`=-;'``$```#KSHU-_(EU_%%65U-J`8U-%%%6_W`(_Q48,4,`B\B% +MR700.77\=9^+10B%P'2BB0CKGO\5`#!#`(/X>G6)A=MT#X7_=`M75E/H[6;_ +M_X/$#.AO_?__:B)>B3#H1/S__^EL____B_]5B^QJ`/]U%/]U$/]U#/]U".C' +M_O__@\047<-J"&B`NT,`Z&U@__^+10C_,.BT%P``68-E_`"+30R+002+`/\P +MBP'_,.@%`P``65G'1?S^____Z`@```#H?F#__\(,`(M%$/\PZ,P7``!9PVH( +M:*"[0P#H'6#__XM%"/\PZ&07``!9@V7\`(M%#(L`BP"+2$B%R708@\C_\`_! +M`74/@?D@ZT,`=`=1Z#?X__]9QT7\_O___^@(````Z!U@___"#`"+11#_,.AK +M%P``6<-J"&C`NT,`Z+Q?__^+10C_,.@#%P``68-E_`!J`(M%#(L`_S#H60(` +M`%E9QT7\_O___^@(````Z-)?___"#`"+11#_,.@@%P``6<-J"&A@NT,`Z'%? +M__^+10C_,.BX%@``68-E_`"+10R+`(L`BT!(\/\`QT7\_O___^@(````Z(I? +M___"#`"+11#_,.C8%@``6<.+_U6+[(/L#(M%"(U-_XE%^(E%](U%^%#_=0R- +M1?10Z.C^__^+Y5W#B_]5B^R#[`R+10B-3?^)1?B)1?2-1?A0_W4,C47T4.AP +M_O__B^5=PXO_58OL@^P,BT4(C4W_B47XB47TC47X4/]U#(U%]%#H^?[__XOE +M7<.+_U6+[(/L#(M%"(U-_XE%^(E%](U%^%#_=0R-1?10Z!S___^+Y5W#B_]5 +MB^Q148M%"#/)06I#B4@8BT4(QP#07D,`BT4(B8A0`P``BT4(6<=`2"#K0P"+ +M10AFB4ALBT4(9HF(<@$``(M%"(.@3`,```"-10B)1?R-1?Q0:@7H??___XU% +M"(E%^(U%#(E%_(U%^%!J!.@6____@\00B^5=P\S,S,S,S,S,S,S,S(O_58OL +M@WT(`'02_W4(Z`X```#_=0CH0_;__UE97<($`(O_58OL48M%"(L(@?G07D,` +M=`I1Z"3V__^+10A9_W`\Z!CV__^+10C_<##H#?;__XM%"/]P-.@"]O__BT4( +M_W`XZ/?U__^+10C_<"CH[/7__XM%"/]P+.CA]?__BT4(_W!`Z-;U__^+10C_ +M<$3HR_7__XM%"/^P8`,``.B]]?__C44(B47\C47\4&H%Z"G^__^-10B)1?R- +M1?Q0:@3H:/[__X/$-(OE7<.+_U6+[%:+=0B#?DP`="C_=DSHW30``(M&3%D[ +M!9`21@!T%#U8YT,`=`V#>`P`=0=0Z/(R``!9BT4,B49,7H7`=`=0Z&,R``!9 +M7<.+_U97_Q4`,$,`B_"AK.9#`(/X_W0,4.A:%@``B_B%_W5):&0#``!J`>CF +M]?__B_A9687_=0E0Z`WU__]9ZSA7_S6LYD,`Z($6``"%P'4#5^OE:)`21@!7 +MZ`G^__]J`.CE]/__@\0,A?]T#%;_%00P0P"+QU]>PU;_%00P0P#H3O7__\R+ +M_U-65_\5`#!#`(OP,]NAK.9#`(/X_W0,4.C3%0``B_B%_W51:&0#``!J`>A? +M]?__B_A9687_=0E3Z(;T__]9ZRM7_S6LYD,`Z/H5``"%P'4#5^OE:)`21@!7 +MZ(+]__]3Z%_T__^#Q`R%_W4)5O\5!#!#`.L)5O\5!#!#`(O?7UZ+PUO#S,QH +MH)%"`.BU%```HZSF0P"#^/]U`S+`P^A=____A+30BAH.U#`(6!4`,``'4'Z*TS``")!EY=PXO_58OL5HMU#(L&.P5`[4,` +M=!>+30BAH.U#`(6!4`,``'4'Z%\A``")!EY=PXO_58OLBT4(N?\'``!35C/2 +MBQB+<`2+QL'H%"/!5SO!=4,[TG4_B_Z+PX'G__\/``O'=0-`ZS"+SHO"@>$` +M``"`"\&X```(`'0-.]IU"3OX=05J!%CK$"/P"]9T!&H"Z_-J`^OO,\!?7EM= +MPXO_58OLBT4(,]*+2`2+PH'A````@`O!=`%"BL)=PXO_58OL@^PP4U97BWT< +M,]N%_WD"B_N+=0R-3=#_=2B('NB2J___C4<+.440=Q3H6??__VHB7XDXZ"[V +M___IJ`(``(M5"(L"BTH$B47@B\'!Z!0E_P<``#W_!P``=5([VW5.4_]U)%-7 +M_W48_W44_W405E+HBP(``(OX@\0DA?]T!X@>Z6("``!J95;H$```"`B\,+P70$Q@8M1HM* +M!#/;.%T@:C`/E,/'1?3_`P``2S/`@^/@@>$``/!_@\,G"\&)7>18=1^(!D:+ +M0@2+"B7__P\`"\AU!2%-].L-QT7T_@,``.L$Q@8Q1HO.1HE-Z(7_=07&`0#K +M#XM%U(N`B````(L`B@"(`8M"!"7__P\`B47P=PF#.@`/AL4```"#9?P`N0`` +M#P!J,%B)1?B)3?"%_WY3BP*+4@0C1?PCT8M-^('B__\/``^_R>A/4?__:C!9 +M9@/!#[?`@_@Y=@(#PXM-\(M5"(@&1HM%_`^LR`2)1?R+1?C!Z02#Z`1/B4WP +MB47X9H7`>:EFA@-4___!#")5>2(!D9J +M,%@"R#/_B`[&1@$`@'W<`'0*BTW0@Z%0`P``_8O'7UY;B^5=PXO_58OL@^P, +MC47T5HMU'%?_=1C_=12-?@%0BT4(5_]P!/\PZ$4[``"#R?^#Q!@Y31!T%XM- +M$#/`@WWT+0^4P"O(,\"%]@^?P"O(C47T4%>+?0Q1,\F#??0M#Y3!,\"%]@^? +MP`//`\%0Z&PU``"#Q!"%P'0%Q@<`ZQS_=2B-1?1J`%#_=23_=2!6_W405^@) +M````@\0@7UZ+Y5W#B_]5B^R#[!!65XM]$(7_?@2+Q^L",\"#P`DY10QW%^C* +M\___:B)>B3#HG_+__XO&7UZ+Y5W#4_]U)(U-\.C8I___BE4@BUT(A-)T)8M- +M'#/`A?\/G\!0,\"#.2T/E,`#PU#_=0Q3Z`0$``"*52"#Q!"+11R+\X,X+74& +MQ@,MC7,!A?]^%8I&`8@&1HM%](N`B````(L`B@"(!C/`A-(/E,`#QP/P@\C_ +M.44,=`>+PRO&`T4,:+AA0P!05NA8[O__@\0,6X7`=7:-3@(X111T`\8&18M5 +M'(M""(`X,'0OBU($@^H!>0;WVL9&`2UJ9%\[UWP(B\*9]_\`1@)J"E\[UWP( +MB\*9]_\`1@,`5@2#?1@"=12`.3!U#VH#C4$!4%'H8('__X/$#(!]_`!T"HM% +M\(.@4`,``/TSP.GR_O__,\!04%!04.B3\?__S(O_58OL@^P,,\!65_]U&(U] +M]/]U%*NKJXU%](M]'%"+10A7_W`$_S#H6CD``(/)_X/$&#E-$'0.BTT0,\"# +M??0M#Y3`*\B+=0R-1?10BT7X`\=0,\"#??0M40^4P`/&4.B.,P``@\00AB^5=PXO_58OL@^P0C4WP +M4U97_W46XOE7<.+ +M_U6+[(/L2*%HYD,`,\6)1?R+512+31!3BET,#[;#@\`$.]!S%6H,Q@$`6(M- +M_#/-6^C`4O__B^5=PX3;=`C&`2U!2L8!`+AX84,`QT72484,`B474@^,"B478B47HB47X +MBT4(5KZ`84,`QT7LH&%#`%>-/(7\____B77,C00?B770B77@B77PQT7TK&%# +M`(MTA;R-1@&)1;B*!D:$P'7Y*W6X._(;P$<#QP/#_W2%O%)1Z,/J__^#Q`Q? +M7H7`#X1!____,\!04%!04.AO[O__S(O_58OLBU44A=)T)E:+=1"+SE>->0&* +M`4&$P'7Y*\^-00%0C0065E#HZ'W__X/$#%]>7<.+_U6+[%%15E>+?0R%_W46 +MZ#;O__]J%EZ),.@+[O__B\;I'@$``%.+71"%VW0,@WT4`'0&@WT8`'<6Z`SO +M__]J%EZ),.CA[?__B\;I\P```(MU'(/^0703@_Y%=`Z#_D9T"<9%_`"#_D=U +M!,9%_`&+122#X`B#R`!U,O]U".BS]O__B47X687`="+_=?Q35_]U".@*]___ +M60^VP%#_=?CH,/[__X/$%.F7````BT4D@^`0@\@`=`1J`^L":@)8@_YA?RAT +M"H/N070%@^X$ZQ__=2Q0_W7\_W4@_W48_W444U?_=0CHUO;__^M5@^YE_W4L +M=#:#[@%T&5#_=?S_=2#_=1C_=1135_]U".C]_/__ZR__=2#_=1C_=1135_]U +M".B$^___@\0+QJ-\$D8`:@10Z`+J__]J`*.`$D8`Z"OI__^# +MQ`R#/8`21@``=2MJ!%:)-7P21@#HW.G__VH`HX`21@#H!>G__X/$#(,]@!)& +M``!U!8/(_U[#5S/_OK#F0P!J`&B@#P``C48@4.BX"@``H8`21@"+U\'Z!HDT +MN(O'@^`_:\@PBP25F!)&`(M$"!B#^/]T"8/X_G0$AP\S,S,S,S,S,B_]6Z,](``#H?4<``#/VH8`21@#_-`;H +MG$D``*&`$D8`68L$!H/`(%#_%=0P0P"#Q@2#_@QUV/\U@!)&`.A,Z/__@R6` +M$D8``%E>PXO_58OLBT4(@\`@4/\5S#!#`%W#B_]5B^R+10B#P"!0_Q70,$,` +M7<.+#6CF0P`SP(/)`3D-A!)&``^4P,.+_U6+[(/L2(U%N%#_%;@Q0P!F@WWJ +M``^$E0```(M%[(7`#X2*````4U:+,(U8!(T$,XE%_+@`(```._!\`HOP5NA9 +M'P``H9@41@!9._!^`HOP5S/_A?9T5HM%_(L(@_G_=$"#^?YT.XH3]L(!=#3V +MP@AU"U'_%3PP0P"%P'0AB\>+SX/@/\'Y!FO0,(M%_`,4C9@21@"+`(E"&(H# +MB$(HBT7\1X/`!$.)1?P[_G6M7UY;B^5=PXO_4U97,_^+QXO/@^`_P?D&:_`P +M`S2-F!)&`(-^&/]T#(-^&/YT!H!.*(#K>XO'QD8H@8/H`'00@^@!=`=J](/H +M`>L&:O7K`FKV6%#_%4`P0P"+V(/[_W0-A=MT"5/_%3PP0P#K`C/`A#_P,/A57___]?7EO#S,S,S,S,S,S,S,QJ#&C@NT,` +MZ#1.__]J!^A^!0``63/;B%WGB5W\4^@&'@``687`=0_H7?[__^@.____LP&( +M7>?'1?S^____Z`L```"*P^@]3O__PXI=YVH'Z(T%``!9P\S,S,S,S,S,S,R+ +M_U8S]HN&F!)&`(7`=`Y0Z'X=``"#II@21@``68/&!('^``(``'+=L`%>PXO_ +M58OLBT4(,\F)"(M%"(E(!(M%"(E("(M%"(-($/^+10B)2!2+10B)2!B+10B) +M2!R+10B#P`R'"%W#B_]5B^Q1Z'/P__^+2$R)3?R-3?Q14.BX\?__BT7\65F+ +M`(OE7<.+_U6+[(/L$/]U#(U-\.@VGO__BT7T#[9-"(L`#[<$2"4`@```@'W\ +M`'0*BTWP@Z%0`P``_8OE7<.+_U6+[(/L)*%HYD,`,\6)1?Q3_W40BUT(C4W@ +MZ.^=__^-0P$]``$``'<+BT7DBP`/MP18ZWJ+PXU-Y,'X"(E%W%$/ML!0Z'S_ +M__]9687`=!.+1=R(1?`SP&H"B%WQB$7R6>L+,\"(7?`SR8A%\4&)1?1FB47X +MBT7D:@'_<`B-1?1048U%\%"-1>1J`5#HT"```(/$'(7`=1,X1>QT"HM%X(.@ +M4`,``/TSP.L7#[=%]"-%#(!][`!T"HM-X(.A4`,``/V+3?PSS5OHEDO__XOE +M7<.+_U6+[%%1H6CF0P`SQ8E%_%-6BW485X7V?A16_W44Z#!&``!9.\99C7`! +M?`*+\(M])(7_=0N+10B+`(MX"(E])#/`.44H:@!J`%;_=10/E<"-!,4!```` +M4%?_%10Q0P")1?B%P`^$C0$``(T4`(U*"#O1&\"%P712C4H(.]$;P"/!C4H( +M/0`$``!W'3O1&\`CP>@!>0``B]R%VP^$3`$``,<#S,P``.L=.]$;P"/!4.@; +MY/__B]A9A=L/A"T!``#'`]W=``"#PPCK`C/;A=L/A!@!``#_=?A35O]U%&H! +M5_\5%#%#`(7`#X3_````BWWX,\!04%!04%=3_W40_W4,Z,\%``"+\(7V#X3> +M````]T40``0``'0XBT4@A<`/A,P````[\`^/P@```#/)45%14/]U'%=3_W40 +M_W4,Z),%``"+\(7V#X6D````Z9T```"-%#:-2@@[T1O`A<%T2HU*"#O1&\`C +MP8U*"#T`!```=QD[T1O`(\'H''@``(O\A?]T9,<'S,P``.L9.]$;P"/!4.@Z +MX___B_A9A?]T2<<'W=T``(/'".L",_^%_W0X:@!J`&H`5E?_=?A3_W40_W4, +MZ`\%``"%P'0=,\!04#E%('4Z4%!65U#_=23_%1@Q0P"+\(7V=2Y7Z'P```!9 +M,_93Z',```!9B\:-9>Q?7EN+3?PSS>B*2?__B^5=P_]U(/]U'.O`5^A.```` +M6>O2B_]5B^R#[!#_=0B-3?#H#IO___]U*(U%]/]U)/]U(/]U'/]U&/]U%/]U +M$/]U#%#HK_W__X/$)(!]_`!T"HM-\(.A4`,``/V+Y5W#B_]5B^R+10B%P'02 +M@^@(@3C=W0``=0=0Z!'B__]97<.+_U6+[%%19HM%"+G__P``9CO!=00SP.M" +MN0`!``!F.\%S#@^WR*$7<-7B_HK\@^W!#YFB0>- +M?P)FA-N(@41@!7_Q74,$,`_PW8%48` +M@^\8@^X!=>M?L`%>PXO_58OL:T4(&`6@%$8`4/\5T#!#`%W#B_]5B^R+10A3 +M5E>-'(4P%D8`BP.+%6CF0P"#S_^+RHOR@^$?,_#3SCOW=&F%]G0$B\;K8XMU +M$#MU%'0:_S;H60```%F%P'4O@\8$.W44=>R+%6CF0P`SP(7`="G_=0Q0_Q6, +M,$,`B_"%]G035NA/C/__68<#Z[F+%6CF0P#KV8L5:.9#`(O":B"#X!]9*\C3 +MSS/ZASLSP%]>6UW#B_]5B^R+10A7C3R%X!5&`(L/AM7 +M4XLPQ0P"+\(7V=2?_%0`P0P"#^%=U#5964_\5 +M[#%#`(OPZP(S]H7V=0F#R/^'!S/`ZQ&+QH<'AZ"M&__^+Y5W"!`"+_U6+ +M[%&A:.9#`#/%B47\5FA`@Q0P"+3?PSS5[HU47__XOE7<($`(O_58OL4:%H +MYD,`,\6)1?Q6:$AS0P!H0'-#`&BP5D,`:@7H%O[__X/$$(OP_W4(A?9T#(O. +M_Q5@,D,`_];K!O\5X#%#`(M-_#/-7NA_1?__B^5=P@0`B_]5B^Q1H6CF0P`S +MQ8E%_%9H4'-#`&A(Z"9%__^+Y5W""`"+_U6+[%&A:.9#`#/% +MB47\5FATZ#Q$__^+Y5W")`"+_U6+ +M[%&A:.9#`#/%B47\5FB4L,:@)8N;`61@"'`3+`7HM-_#/-Z#%#__^+Y5W#S,S,B_]5B^R` +M?0@`=2=6ON`51@"#/@!T$(,^_W0(_S;_%8@P0P"#)@"#Q@2!_C`61@!UX%ZP +M`5W#S,S,S,S,S,S,S(O_58OLBT4,.T4(=@6#R/]=PQO`]]A=PXO_58OLBT4, +M@^P@5H7`=1;H/>#__VH67HDPZ!+?__^+QNE8`0``BW4(,\E35XD(B_F+V8E] +MX(E=Y(E-Z#D.=%:-1?QFQT7\*C]0_S:(3?[H!#\``%E9A@".]^)5?0;]O?6(_!T,(O7 +MB]F+"HU!`8E%_(H!083`=?DK3?Q#BT7X`]F#P@1`B47X.\9UW8M5](E=_(M= +MY&H!_W7\4N@*S___B_"#Q`R%]G4%@\__ZV>+1?2-!(:)1?"+T(E5]#O[=$Z+ +MQBO'B47LBP^-00&)1?B*`4&$P'7Y*TWXC4$!4/\WB47XBT7P*\(#1?Q04N@# +M/@``@\00A#H,`(``(O'7UM>B^5=PS/`4%!04%#HLMW__\R+_U6+[%&+30B-40&* +M`4&$P'7Y*\J#R/]7BWT002O'B4W\.\AV!6H,6.M94U:-7P$#V6H!4^C7VO__ +MB_!9687_=!)7_W4,4U;H;#T``(/$$(7`=37_=?PKWXT$/O]U"%-0Z%,]``"# +MQ!"%P'4)M;C^___K&8H! +M/"]T%SQ<=!,\.G0/45/H-#T``%E9B\@[RW7CBA&`^CIU%XU#`3O(=!!6,_]7 +M5U/H"____X/$$.MZ,_^`^B]T#H#Z7'0)@/HZ=`2+Q^L#,\!`#[;`*\M!]]AH +M0`$``!O`(\&)A;3^__^-A;S^__]74.@"1___@\0,C86\_O__5U=74%=3_Q44 +M,D,`B_"+A;C^__^#_O]U+5!75U/HG_[__X/$$(OX@_[_=`=6_Q5@,$,`B\>+ +M3?Q?7C/-6^C!/___B^5=PXM(!"L(P?D"B8VP_O__@+WH_O__+G48BHWI_O__ +MA,ET*8#Y+G4)@+WJ_O__`'0;4/^UM/[__XV%Z/[__U-0Z#C^__^#Q!"%P'65 +MC86\_O__4%;_%1@R0P"%P(N%N/[__W6LBQ"+0`2+C;#^__\KPL'X`CO(#X1G +M____:!"L0@`KP6H$4(T$BE#HMJW__X/$$.E,____B_]65XOYBS?K"_\VZ!O8 +M__]9@\8$.W<$=?#_-^@+V/__65]>PXO_58OL5E>+\>@G````B_B%_W0-_W4( +MZ.O7__]9B\?K#HM.!(M%"(D!@T8$!#/`7UY=P@0`B_]6B_%7BWX(.7X$=`0S +MP.MR@SX`=2MJ!&H$Z'W8__]J`(D&Z*G7__^+!H/$#(7`=05J#%CK38E&!(/` +M$(E&".O,*S[!_P*!_____W]WXU-J!(TPB#Q`R)NQP"``"Y`0$``(U[#*NKJ[\@ZT,`*_N* +M!#>(!D:#Z0%U]8V+&0$``+H``0``B@0YB`%!@^H!=?5?7EM=PXO_58OL@>P@ +M!P``H6CF0P`SQ8E%_%-6BW4(C87H^/__5U#_=@3_%0PQ0P`SV[\``0``A<`/ +MA/````"+PXB$!?S^__]`.\=R](J%[OC__XV-[OC__\:%_/[__R#K'P^V40$/ +MML#K#3O'$3?SX__^H`70.@$P.&1"*A`W\_?__ZQ"H`G05@$P.&2"*A`W\_/__B(0. +M&0$``.L'B)P.&0$``$$[SW+!ZUEJGXV6&0$``(O+6"O"B87@^/__`]$#PHF% +MY/C__X/`((/X&7<*@$P.&1"-02#K$X.]Y/C__QEW#HT$#H!(&2"-0>"(`NL" +MB!J+A>#X__^-EAD!``!!.\]RNHM-_%]>,\U;Z&ATU___QP`6````B_-7Z.K2__]97XO&7EN+Y5W#@'T,`'4%Z,;0 +M__^+1?R+0$CP#\$82W45BT7\@7A((.M#`'0)_W!(Z+32__]9QPB`^___ +M@'T,`%E9=(6A0.U#`*,4Z$,`Z7;____,S,S,S,S,S(`]T!9&``!U$FH!:OWH +MY?[__UE9Q@70%D8``;`!PVH,:`"\0P#HYCG__S/VB77DZ.'<__^+^(L-H.U# +M`(6/4`,``'01.7=,=`R+=TB%]G5HZ)'2__]J!>@%\?__68EU_(MW2(EUY#LU +M0.U#`'0PA?9T&(/(__`/P09U#X'^(.M#`'0'5NC5T?__6:%`[4,`B4=(BS5` +M[4,`B77D\/\&QT7\_O___^@%````ZZ"+=>1J!>C[\/__6<.+QNB7.?__PXO_ +M58OL@^P@H6CF0P`SQ8E%_%-6_W4(BW4,Z*S[__^+V%F%VW4.5N@2_/__63/` +MZ:T!``!7,_^+SXO'B4WD.9@HZ$,`#X3J````08/`,(E-Y#WP````A04_\5 +M##%#`(7`#X2$````:`$!``"-1AA74.CL/O__B5X$@\0,,]N)OAP"``!#.5WH +M=E&`?>X`C47N="&*2`&$R70:#[;1#[8(ZP:`3`X9!$$[RG;V@\`"@#@`==^- +M1AJY_@```(`("$"#Z0%U]_]V!.B2^O__@\0$B88<`@``B5X(ZP.)?@@SP(U^ +M#*NKJ^F^````.3W,%D8`=`M6Z!?[___IL0```(/(_^FL````:`$!``"-1AA7 +M4.A-/O__@\0,:T7D,(E%X(V`..A#`(E%Y(`X`(O(=#6*00&$P'0K#[81#[;` +MZQ>!^@`!``!S$XJ'(.A#``A$%AE"#[9!`3O0=N6#P0*`.0!USHM%Y$>#P`B) +M1>2#_P1RN%.)7@3'1@@!````Z-_Y__^#Q`2)AAP"``"+1>"-3@QJ!HV0+.A# +M`%]FBP*-4@)FB0&-20*#[P%U[U;HQOK__UDSP%^+3?Q>,\U;Z*TV__^+Y5W# +MB_]5B^Q6BW44A?9U!#/`ZVV+10B%P'43Z`S4__]J%EZ),.CATO__B\;K4U>+ +M?1"%_W04.74,<@]65U#HOS[__X/$##/`ZS;_=0QJ`%#H33W__X/$#(7_=0GH +MR]/__VH6ZPPY=0QS$^B]T___:B)>B3#HDM+__XO&ZP-J%EA?7EW#B_]5B^R# +M[!!6_W4(C4WPZ,"'__\/MG4,BT7XBDT4A$PP&74;,](Y51!T#HM%](L`#[<$ +M<"-%$.L"B\*%P'0#,])"@'W\`%YT"HM-\(.A4`,``/V+PHOE7<.+_U6+[&H$ +M:@#_=0AJ`.B4____@\007+V%L"B]^%]G0' +M5O\5+#)#`%]>B\-;B^5=PXO_58OL7>D`````B_]5B^Q6BW4,A?9T&VK@,])8 +M]_8[11!S#^@NTO__QP`,````,\#K0E.+70A7A=MT"U/H&C(``%F+^.L",_\/ +MKW405E/HK\[__XO865F%VW05._YS$2OWC00[5FH`4.A?.___@\0,7XO#6UY= +MP\S,S,S,_Q60,4,`A<"C[!9&``^5P,/,S,S,S,S,S,S,S,S,S,R#)>P61@`` +ML`'#B_]5B^Q1H6CF0P`SQ8E%_%>+?0@[?0QU!+`!ZU=6B_=3BQZ%VW0.B\O_ +M%6`R0P#_TX3`=`B#Q@@[=0QUY#MU#'4$L`'K+#OW=":#QOR#?OP`=!.+'H7; +M=`UJ`(O+_Q5@,D,`_]-9@^X(C48$.\=UW3+`6UZ+3?PSS5_HL3/__XOE7<.+ +M_U6+[%&A:.9#`#/%B47\5HMU##EU"'0C@\;\5XL^A?]T#6H`B\__%6`R0P#_ +MUUF#[@B-1@0[10AUXE^+3?RP`3/-7NAD,___B^5=PVH,:&"\0P#H"C3__X-E +MY`"+10C_,.A-Z___68-E_`"+-6CF0P"+SH/A'S,U^!9&`-/.B77DQT7\_O__ +M_^@-````B\;H%#3__\(,`(MUY(M-$/\QZ%_K__]9PXO_58OL@^P,BT4(C4W_ +MB47XB47TC47X4/]U#(U%]%#H@O___XOE7<.+_U6+[(M%"$B#Z`%T+8/H!'03 +M@^@)=!R#Z`9T$(/H`70$,\!=P[CX%D8`7<.X]!9&`%W#N/P61@!=P[CP%D8` +M7<.+_U6+[&L-8%]#``R+10P#R#O!=`^+50@Y4`1T"8/`##O!=?0SP%W#B_]5 +MB^Q1C47_4&H#Z%W___]968OE7<.+_U6+[/]U"+GP%D8`Z%''____=0BY]!9& +M`.A$Q____W4(N?@61@#H-\?___]U"+G\%D8`Z"K'__]=P^C8U?__@\`(PVHL +M:$"\0P#HLU\``#/;B5W4(5W,L0&(3>.+=0AJ"%\[]W\8=#6-1O^#Z`%T(DB# +MZ`%T)TB#Z`%U3.L4@_X+=!J#_@]T"H/^%'X[@_X6?S96Z.;^__^#Q`3K1>CY +MU?__B]B)7=2%VW4(@\C_Z9(!``#_,U;H!?___UE9,\F%P`^5P87)=1+H#\__ +M_\<`%@```.CCS?__Z]&#P`@RR8A-XXE%V(-ET`"$R70+:@/H;^G__UF*3>.# +M9=P`QD7B`(-E_`"+1=B$R704BQ5HYD,`B\J#X1\S$-/*BDWCZP*+$(O"B47< +M,]*#^`$/E,*)5*$T@^%B@```(7`=1.$R70(:@/H:.G__UEJ`^@YN___ +M._=T"H/^"W0%@_X$=2.+0P2)1="#8P0`._=U.^C&_O__BP")1+3=S_%6`R0P#_5=Q9ZRMJ"%^+=0B+7=2*1>*)1,` +M=`AJ`^BCZ/__6<-6BTW<_Q5@,D,`_U7<63OW=`J#_@MT!8/^!'45BT70B4,$ +M._=U"^C:T___BTW,B4@(,\#H`5X``,.+_U6+[%%14U=J,&I`Z,[)__^+^#/; +MB7WX65F%_W4$B_OK2(V'``P``#OX=#Y6C7<@B_A3:*`/``"-1N!0Z*_J__^# +M3OC_B1Z-=C")7M2-1N#'1M@```H*QD;<"H!FW?B(7MX[QW7,BWWX7E/HI,C_ +M_UF+QU];B^5=PXO_58OL5HMU"(7V="53C9X`#```5XO^._-T#E?_%=0P0P"# +MQS`[^W7R5NALR/__65];7EW#:A1H@+Q#`.@,,/__@7T(`"```!O`]]AU%^C$ +MS/__:@E>B3#HF1J!^@MY___68EU_(O^H9@41@") +M?>`Y10A\'SDTO9@21@!U,>CT_O__B02]F!)&`(7`=11J#%Z)=>3'1?S^____ +MZ!4```#KK*&8%$8`@\!`HY@41@!'Z[N+=>1J!^@CY___6<.+_U6+[(M%"(O( +M@^`_P?D&:\`P`P2-F!)&`%#_%%]GAG.S68%$8`L#4&KV_Q6,,4,`BP2]F!)&`(-,`QC_,\#K%NB) +MR___QP`)````Z&O+__^#(`"#R/]?7EM=PXO_58OLBTT(@_G^=17H3LO__X,@ +M`.A9R___QP`)````ZT.%R7@G.PV8%$8`D".\8;V_?3(]ET$/\VZ/C$__]'C78$ +M63O[=?!?7EM=PXO_58OL5HMU"(7V#X30````:@=6Z*O___^-1AQJ!U#HH/__ +M_XU&.&H,4.B5____C49H:@Q0Z(K___^-AI@```!J`E#H?/____^VH````.B7 +MQ/___[:D````Z(S$____MJ@```#H@<3__XV&M````&H'4.A-____C8;0```` +M:@=0Z#____^#Q$2-ANP```!J#%#H+O___XV&'`$``&H,4.@@____C89,`0`` +M:@)0Z!+_____ME0!``#H+<3___^V6`$``.@BQ/___[9<`0``Z!?$____MF`! +M``#H#,3__X/$*%Y=PXO_58OL@^P8H6CF0P`SQ8E%_%-65_]U"(U-Z.B.?/__ +MBTT%]G0T4U=6Z#0Q__^#Q`S_=?A6_W44_W40:@'_ +M=1S_%10Q0P"%P'00_W484%;_=0S_%0PR0P"+^%;HXN#__UF`??0`=`J+1>B# +MH%`#``#]B\>-9=Q?7EN+3?PSS>CI*?__B^5=PXO_58OLBT4(\/]`#(M(?(7) +M=`/P_P&+B(0```"%R70#\/\!BXB`````A@7GX&.A#`'0)BQ&%TG0#\/\"@WGT`'0*BU'\A=)T`_#_`H/!$(/N +M`776_["<````Z$X!``!97EW#B_]5B^Q14U:+=0A7BX:(````A@S@`=5F+AH0```"%P'08@S@`=1-0Z"["____MH@```#HEOO_ +M_UE9BX:`````A7<.+_U6+[(M-"(7)=!:! +M^2!E0P!T#H/(__`/P8&P````2%W#N/___W]=PXO_58OLBT4(A+=TR%]G5#:@3H[][__UF#9?P`_S60$D8`C4=,4.@P +M````65F+\(EUY,=%_/[____H#````(7V=1'H1,#__XMUY&H$Z`7?__]9PXO& +MZ*$G___#B_]5B^Q6BW4,5X7V=#R+10B%P'0UBS@[_G4$B\;K+5:),.B8_/__ +M687_=.]7Z-;^__^#?PP`677B@?]8YT,`=-I7Z/7\__]9Z]$SP%]>7<.+_U6+ +M[(M-"#/`]L$0=`6X@````%-65[\``@``]L$(=`(+Q_;!!'0%#0`$``#VP0)T +M!0T`"```]L$!=`4-`!```+X``0``]\$```@`=`(+QHO1NP`#```CTW0?.]9T +M%CO7=`L[TW43#0!@``#K#`T`0```ZP4-`"```+H````#7R/*7EN!^0````%T +M&('Y`````G0+.\IU$0T`@```7<.#R$!=PPU`@```7<.+_U6+[(/L#-U]_-OB +M@ST8#48``0^,@P```&:+1?PSR8O15[\```@`J#]T*:@!=`-J$%JH!'0#@\H( +MJ`AT`X/*!*@0=`.#R@*H('0#@\H!J`)T`@O7#ZY=^(M%^(/@P(E%]`^N5?2+ +M1?BH/W0IJ`%T`VH06:@$=`.#R0BH"'0#@\D$J!!T`X/)`J@@=`.#R0&H`G0" +M"\\+RHO!7^L]9HM-_#/`]L$_=#+VP0%T`VH06/;!!'0#@\@(]L$(=`.#R`3V +MP1!T`X/(`O;!('0#@\@!]L$"=`4-```(`(OE7<.+_U6+[(/L$)O9??AFBT7X +M,\FH`70#:A!9J`1T`X/)"*@(=`.#R02H$'0#@\D"J"!T`X/)`:@"=`:!R0`` +M"`!35@^W\+L`#```B]97OP`"```CTW0F@?H`!```=!B!^@`(``!T##O3=1*! +MR0`#``#K"@O/ZP:!R0`!``"!Y@`#``!T##OW=0Z!R0```0#K!H')```"`+H` +M$```9H7"=`:!R0``!`"+?0R+]XM%"/?6(_$CQPOP._$/A*8```!6Z#\"``!9 +M9HE%_-EM_)O9??QFBT7\,_:H`70#:A!>J`1T`X/."*@(=`.#S@2H$'0#@\X" +MJ"!T`X/.`:@"=`:!S@``"``/M]"+RB/+="J!^0`$``!T'('Y``@``'0,.\MU +M%H'.``,``.L.@0-J$%FI``(``'0#@\D(J0`$``!T`X/)!*D`"```=`.#R0*% +MPG0#@\D!J0`!``!T!H')```(`(O0NP!@```CTW0J@?H`(```=!R!^@!```!T +M##O3=1:!R0`#``#K#H')``(``.L&@L.@ALOO__:B+KS(MU%(7V=+Y3C5H! +MB\-7BWX(Q@(PA+?0R+ +M#X7)=0I?,\`STEN+Y5W#5HUP_XU!_XEU](7`#X4M`0``BT\$B4W8@_D!=2^+ +MC]__]0:,P!``!1Z#/I__^#Q!"+QC/27E];B^5= +MPX7V=4F+C]__]J`%"->P3'A>3]__\`````:,P!``!7QP,`````Z/?H +M__\STHO&]W78@\00,\D[RHD7&\E>]]DSTE^)"UN+Y5W#,__'1?@`````QT7\ +M`````(E]\(/^_W1$BT7T1D")1>2--+.-9"0`:@!1,\`+!E=0Z%),``")5<"- +M=OPSTHE=\(OY`]"+3?B#T0")5?B#;>0!B4W\BTW8=% +MY/W__P````!0C7,$QP,`````:,P!``!6Z%7H__^+1?"#Q!"+5?PSR3O(B3Z) +M0PB+1?@;R??97D%?B0M;B^5=PSO&=T>+UHU(`2O0B4W(B\X[\GPRB\%&*\*- +M-+.-/(>#QP2+!SL&=0U)@^\$@^X$.\I][^L1BW4,B\$KPHM$A@0[1(L$+1<@#1>2+3<2+1(/XT^@+\(M%_(EU[&H` +M_W7,4%+H@DH``(E=V#/VB]B)==B+PHE=_(E%Z(OYB5V\B47`AQJ`/]UX(E-_.BD&/__.]9R*7<%.T7\=B*+1>B# +MP_^)7;R#T/\#?B#5=@`B47`=0J#__]VO^L#BT7HB5W\AR)3?2+`(E%V(M%P/=EV(O(BT6\ +M]V78`]$#^(L#B\\3\HO^,_8[P7,%@\0#PXM-M(OXBT7X@]8`@VWP!$J+70B#Z01(B7VXB57DB4VT +MB47XA=(/B>[]___K`C/_BU7T0HO".P-S'(U(`8T,B^L&C9L`````QP$````` +MC4D$0#L#QD"0``H6CF0P`SQ8E%_%.+71B-C6SX__]65XM]%(F]@/C__XF=A/C__^CS +M^O__BW4,,\"+SH'A````@`O!L"UU`@3S#[[`B\Z)!X'A``#P?S/`B5\("\&+ +M?0AU(HO.B\>!X?__#P`+P744BX6`^/__:+1]0P"#8`0`Z=,2``"-10A0Z'C` +M__]9AD4B\$E_P<``(/(`'4&L@$S]NL),M*^```0`#/`BYV8 +M^/__@>?__P\``]@3_C/`A-(/E<"!X?\'``!`C;',^___`_")M;3X___H,1H` +M`%%1W1PDZ#<;``!96>B`2```B864^/__/?___W]T!ST```"`=0@SP(F%E/C_ +M_XF=,/[__S/;A?^)O33^__\/E<-#B9TL_O__A?8/B.T#``"#I9#Z__\`:@)> +MQX64^O__```0`(FUC/K__SO>#X4``@``,\F+A`V0^O__.X0-,/[__P^%Z@$` +M`(/!!(/Y"'7DBX6T^/__,]*#P`*+\(/@'VH@62O(B86D^/__,\#![@5`B;6P +M^/__B8V0^/__Z!`5__^#I9SX__\`2`^]SXF%J/C___?0B86,^/__=`-!ZP(S +MR6H@6"O!C58".86D^/__B96L^/__#Y?`@_ISB(6[^/__#Y?!@_IS=0B$P'0$ +ML`'K`C+`A,D/A>\```"$P`^%YP```&IR63O1<@B+T8F-K/C__XO*B8V@^/__ +M@_K_#X26````B_*-A3#^__^+E;#X__\K\HT$L(F%M/C__SO*)A(TP_O__28N%M/C__TZ#Z`2)C:#X__^)A;3X__^# +M^?]T"(N=+/[__^N/BY6L^/__B[6P^/__A?9T#(O.C;TP_O__,\#SJX"]N_C_ +M_P"[S`$``'0+C4(!B84L_O__ZS.)E2S^___K*S/`N\P!``!0B86,^O__B84L +M_O__C860^O__4(V%,/[__U-0Z(#A__^#Q!"#I93Z__\`,\EJ!%A!B860^O__ +MB8V,^O__B8U<_/__4(V%D/K__U"-A6#\__]34.A)X?__@\00Z5P$``"+A;3X +M__\STD"+^(/@'VH@62O(B86P^/__,\#![P5`B;VT^/__B8V0^/__Z#`3__^+ +MC)TL_O__2(.EG/C__P`/OL",\EJ(%@KP8T4 +M.SF%L/C__XF5H/C__P^7P(/Z0```!J+C9#X___3Z(N-I/C__POX +MBX6L^/__@^D$B8VD^/__B;R%,/[__TA.B86L^/__@_C_=`B+G2S^___KE8N5 +MH/C__XN]M/C__VH"7H7_=`R+SS/`C;TP_O__\ZN`O;OX__\`N\P!``!T"XU" +M`8F%+/[__^LSB94L_O__ZRLSP+O,`0``4(F%C/K__XF%+/[__XV%D/K__U"- +MA3#^__]34.B`"P>H> +M,]"+A:SX__].B1"#Z`2)A:SX__^#_O]T"(N=+/[__^NM,\`XA;OX__\/E<`# +MP2N-M/C__XOYB84L_O__P>\%C860^O__B_>)C:CX___!Y@)6:@!0Z`T<__^+ +MC:CX__\SP$"#X1_3X(F$-9#Z__^-1P'I0`$``(N$G2S^__^#I9SX__\`#[W` +M=`6-2`'K`C/):B!8*\&#^`$/DL"#^W.(A;OX__\/E\&#^W-U"(3`=`2P`>L" +M,L"$R0^%FP```(3`#X63````:G)9.]ES`HO+@_G_=&F-O3#^__^+\8T\CXF] +MK/C__SOSHN]D/K__X7_=1,SP(F%O/C__XF%7/S_ +M_^F?`@``@_\!#X2N`@``@[U<_/__``^$H0(``(N%7/S__S/)B86H^/__,_:+ +MQ_>DM6#\__\#P8F$M6#\__^#T@!&B\H[M:CX__]UX.FL````B8R%8/S___^% +M7/S__^E:`@``@[U<_/__`0^'O@```(N]8/S__XO!P>`"4(V%D/K__XF-7/S_ +M_U"-A6#\__]34.B.V___@\00A?]U&C/`B86,^O__B85<_/__4(V%D/K__^GU +M`0``@_\!#X3]`0``@[U<_/__``^$\`$``(N%7/S__S/)B86H^/__,_:+Q_>D +MM6#\__\#P8F$M6#\__^#T@!&B\H[M:CX__]UX(7)#X2X`0``BX5<_/__@_AS +M#X(]____,\")A8SZ__^)A5S\__]0C860^O__Z>P!```[C5S\__^-O9#Z__\/ +MDL"$P`^%@P```(V]8/S__XV5D/K__XF5L/C__X3`=0:+C5S\__^)C:SX__^$ +MP'0,BX5<_/__B86@^/__,](S]HF5O/C__X7)#X01`0``C87`^/__*_B)O7SX +M__^-!+>+A`7`^/__B86H^/__A````(82UP/C__XU6`8F5O/C_ +M_^G)````C95@_/__ZX$SP#/_B\Z)A;3X__\YA:#X__\/A)0```"#^7-T5SO* +M=1>#I(W`^/__`$`#QHF%O/C__XN%M/C__XN5L/C__XL$@O>EJ/C__P/'@](` +M`82-P/C__XN%M/C__X/2`$!!B86T^/__B_J+E;SX__\[A:#X__]UI(7_=#2# +M^7,/A+0````[RG41@Z2-P/C__P"-00&)A;SX__^+QS/_`82-P/C__XN5O/C_ +M_Q/_0>O(@_ES#X2`````B[U\^/__BXVL^/__1COQ#X7]_O__B\*)E5S\___! +MX`)0C87`^/__4(V%8/S__U-0Z&K9__^#Q!"P`83`=&R+A9#X__\KA:3X__^) +MA9#X__\/A97\__^+C9SX__^%R0^$$P4``(L\C8Q]0P"%_W5=,\")A9SV__^) +MA5S\__]0ZSHSP(F%G/;__XF%7/S__U"-A:#V__]0C85@_/__4U#H_-C__X/$ +M$#+`ZY"#I9SV__\`@Z5<_/__`&H`C86@]O__4(V%8/S__^FA!```@_\!#X2B +M!```BX5<_/__B86<^/__A<`/A(X$```S]C/)B\?WI(U@_/__`\:)A(U@_/__ +M@](`08OR.XV<^/__=>"%]@^$8@0``(N%7/S__X/XDM3#^__\#P8F$M3#^__^#T@!&B\H[M9SX__]UX.E2____.XTL_O__C;V0 +M^O__#Y+`A,`/A8,```"-O3#^__^-E9#Z__^)E9#X__^$P'4&BXTL_O__B8VP +M^/__A,!T#(N%+/[__XF%H/C__S/2,_:)E;SX__^%R0^$$0$``(V%P/C__ROX +MB;U\^/__C02WBX0%P/C__XF%G/C__X7`=24[\@^%W@```"&$M<#X__^-5@&) +ME;SX___IR0```(V5,/[__^N!,\`S_XO.B86D^/__.86@^/__#X24````@_ES +M=%<[RG47@Z2-P/C__P!``\:)A;SX__^+A:3X__^+E9#X__^+!(+WI9SX__\# +MQX/2``&$C<#X__^+A:3X__^#T@!`08F%I/C__XOZBY6\^/__.X6@^/__=:2% +M_W0T@_ES#X0*`0``.\IU$8.DC<#X__\`C4$!B86\^/__B\`"4(V%P/C__U"-A3#^__]34.@NU?__@\00L`&$P`^$P0```(N%K/C_ +M_RN%M/C__XF%K/C__P^%NOS__XN-J/C__X7)#X33````BP2-C'U#`(F%G/C_ +M_X7`#X28````@_@!#X2U````BXTL_O__A"%_W1_BX4L_O__@_ASG_ +M_UE9:@I:.\(/A9$```#_A93X__^-=P&+A5S\___&!S&)M;3X__^%P`^$BP`` +M`#/_B_`SR8N$C6#\___WXFH*`\>)A(U@_/__@](`08OZ6CO.=>&+M;3X__^% +M_W1) +MM;3X__^+A93X__^+C8#X__^)002+C8CX__^%P'@*@?G___]_=P(#R(M%'$@[ +MP7("B\$#A83X__^)A8CX__\[\`^$TP```(N%+/[__X7`#X3%````,_^+\#/) +MBX2-,/[__[H`RIH[]^(#QXF$C3#^__^#T@!!B_H[SG7?B[6T^/__A?]T0(N% +M+/[__X/X@1 +M"/__B^5=PS/`4%!04%#H<*3__\QJ$&C`O$,`Z*H(__^#9>0`:@CH\+___UF# +M9?P`:@->B77@.S5\$D8`=%BA@!)&`(L$L(7`=$F+0`S!Z`VH`706H8`21@#_ +M-+#H3!,``%F#^/]T`_]%Y*&`$D8`BP2P@\`@4/\5U#!#`*&`$D8`_S2PZ(^@ +M__]9H8`21@"#)+``1NN=QT7\_O___^@)````BT7DZ&8(___#:@CHN;___UG# +MB_]5B^R+30A6C7$,BP8D`SP"=`0SP.M+BP:HP'3VBT$$5XLY*_B)`8-A"`"% +M_WXP5U!1Z*>V__]94.BT#@``@\0,._AT"VH06/`)!H/(_^L1BP;!Z`*H`70& +M:OU8\"$&,\!?7EW#B_]5B^Q6BW4(A?9U"5;H/0```%GK+E;H?O___UF%P'0% +M@\C_ZQZ+1@S!Z`NH`7025NA#MO__4.B7$P``65F%P'7?,\!>7<-J`>@"```` +M6<-J'&C@O$,`Z%0'__^#9>0`@V7<`&H(Z):^__]9@V7\`(LU@!)&`*%\$D8` +MC02&B474BUT(B77@._!T=(L^B7W8A?]T5E?H(K?__UG'1?P!````BT<,P>@- +MJ`%T,H/[`7415^A)____68/X_W0A_T7DZQR%VW48BT<,T>BH`70/5^@K____ +M68/X_W4#"47<@V7\`.@.````BT74@\8$ZY6+70B+=>#_==CHT[;__UG#QT7\ +M_O___^@4````@_L!BT7D=`.+1=SHVP;__\.+70AJ".@KOO__6<.+_U6+[%:+ +M=0A7C7X,BP?!Z`VH`70DBP?!Z`:H`70;_W8$Z*^>__]9N+_^___P(00```!S"8L$Q=A]0P!=PS/`7<.+_U6+ +M[%&+512+30A6A=)U#87)=0TY30QU(3/`ZRZ%R709BT4,AOI +MBW40A?9U&<8!`.AZH?__:A9>B3#H3Z#__XO&7HOE7<-3*_&+V%>+^8/Z_W41 +MB@0^B`='A,!T)8/K`77QZQZ*!#Z(!T>$P'0*@^L!=`6#Z@%U[(72BU44=0/& +M!P!?A=M;=8>#^O]U#8M%#&I0QD0!_P!8ZZ?&`0#H#:'__VHBZY&+_U6+[%WI +M1/___\S,S,Q5B^Q6,\!04%!04%!04(M5#(U)`(H""L!T"8/"`0^K!"3K\8MU +M"(O_B@8*P'0,@\8!#Z,$)'/QC4;_@\0@7LG#B_]5B^QJ`/]U#/]U".@%```` +M@\0,7<.+_U6+[(/L$(-]"`!U%.B0H/__QP`6````Z&2?__\SP.MG5HMU#(7V +M=1+H=*#__\<`%@```.A(G___ZP4Y=0AR!#/`ZT/_=1"-3?#H?U3__XM5^(-Z +M"`!T'(U._TDY30AW"@^V`?9$$!D$=?"+QBO!@^`!*_!.@'W\`'0*BTWP@Z%0 +M`P``_8O&7HOE7CKG___QP`6````Z+^>__^#R/]=P_]U"&H`_S7L%D8`_Q6(,4,`7<-J +M"&@(O4,`Z/("__^#/1@-1@`!?%N+10BH0'1*@SVP[4,``'1!@V7\``^N50CK +M+HM%[(L`@3@%``#`=`N!.!T``,!T`S/`PS/`0,.+9>B#);#M0P``@V4(OP^N +M50C'1?S^____ZPJ#X+^)10@/KE4(Z,\"___#B_]5B^Q1W7W\V^(/OT7\B^5= +MPXO_58OL45&;V7W\BTT,BT4(]]%F(TW\(T4,9@O(9HE-^-EM^`^_1?R+Y5W# +MB_]5B^R+30B#[`SVP0%T"MLM2)Y#`-M=_)OVP0AT$)O?X-LM2)Y#`-U=])N; +MW^#VP1!T"MLM5)Y#`-U=])OVP01T"=GNV>C>\=W8F_;!('0&V>O=7?2;B^5= +MPXO_58OL49O=??P/OT7\B^5=PXO_58OL5N@Z$P``BW4(B0;HB^5=PXO_58OL45 ?@`C47X +M@V7\`%#H@O___UF%P'0%,\!`ZRF+30B+5?B+1?R)002-1?B)$8/*'U")5?CH +M>/___UF%P'79Z,[:__\SP(OE7EI%``` +MD(,])!=&``!T,H/L"`^N7"0$BT0D!"6`?P``/8`?``!U#]D\)&:+!"1F@^!_ +M9H/X?XUD)`AU!>D5%```@^P,W10DZ"(;``#H#0```(/$#,.-5"0$Z,T:``!2 +MF]D\)'1,BT0D#&:!/"1_`G0&V2UHH$,`J0``\']T7JD```"`=4'9[-G)V?&# +M/0P71@``#X7L&@``C0U@GD,`NAL```#IZ1H``*D```"`=1?KU*G__P\`=1V# +M?"0(`'46)0```(!TQ=W8VRT@H$,`N`$```#K(N@X&@``ZQNI__\/`'7%@WPD +M"`!UOMW8VRW*GT,`N`(```"#/0P71@``#X6`&@``C0U@GD,`NAL```#H>1L` +M`%K#@STD%T8```^$OAT``(/L"`^N7"0$BT0D!"6`?P``/8`?``!U#]D\)&:+ +M!"1F@^!_9H/X?XUD)`@/A8T=``#K`/,/?D0D!&8/*!6`GD,`9@\HR&8/*/AF +M#W/0-&8/?L!F#U0%H)Y#`&8/^M!F#]/*J0`(``!T3#W_"P``?'UF#_/*/3(, +M``!_"V8/UDPD!-U$)`3#9@\N_WLDNNP#``"#[!")5"0,B]2#PA2)5"0(B50D +M!(D4).CY&@``@\00W40D!,/S#WY$)`1F#_/*9@\HV&8/PL$&/?\#``!\)3TR +M!```?[!F#U0%<)Y#`/(/6,AF#]9,)`3=1"0$P]T%L)Y#`,-F#\(=D)Y#``9F +M#U0=<)Y#`&8/UEPD!-U$)`3#B_]5B^R#[#BA:.9#`#/%B47\BT4,B\B#X#_! +M^093:]@P5HL$C9@21@!7BWT0B7W0B4W4BT08&(E%V(M%%`/'B47<_Q6$,4,` +MBW4(BTWB+1=2(;>6+%(68 +M$D8`BDP:+?;!!'09BD0:+H#A^XA%](U%]&H"B&WUB$P:+5#K.NB;L/__#[8/ +MN@"```!FA11(="0[?=P/@\$```!J`HU%Z%=0Z""<__^#Q`R#^/\/A-(```!' +MZQAJ`5>-1>A0Z`6<__^#Q`R#^/\/A+<````SR8U%[%%1:@50:@&-1>A'4%'_ +M=Q0_W78_Q5$,$,`A4*=2QJ#5AJ`&:)1>2-1>!0:@&-1>10_W78 +M_Q5$,$,`A+#)68$D8` +MB$09+HL$E9@21@"`3!@M!/]&!.L(_Q4`,$,`B0:+3?R+QE]>,\U;Z$[\_O^+ +MY5W#B_]5B^Q14U:+=0@SP%>+?0R)!HE&!(E&"(M%$`/'B47\._AS/P^W'U/H +MAAL``%EF.\-U*(-&!`*#^PIU%6H-6U/H;AL``%EF.\-U$/]&!/]&"(/'`CM] +M_'++ZPC_%0`P0P")!E^+QEY;B^5=PXO_58OL45:+=0A6Z#GV__]9A-A?SK__]04?\51#!#`(7`=!^+A?3K__\!1@0[ +MQW(:BX7XZ___BXWPZ___.]ARE^L(_Q4`,$,`B0:+3?R+QE]>,\U;Z(SZ_O^+ +MY5W#B_]5B^RX$!0``.BO\?[_H6CF0P`SQ8E%_(M-#(O!P?@&@^$_:\DP4XM= +M$(L$A9@21@!6BW4(5XM,"!B+110#PXF-\.O__S/2B87XZ___B1:)5@2)5@CK +M=8V]_.O__SO8#QP)FB0>-1?J#QP([ +M^(N%^.O__W+1C87\Z___*_B-A?3K__]J`%"#Y_Z-A?SK__]74%'_%40P0P"% +MP'0?BX7TZ___`48$.\=R&HN%^.O__XN-\.O__SO8^?[_B^5=PXO_58OLN!@4``#HP?#^_Z%HYD,`,\6)1?R+30R+ +MP<'X!H/A/VO),%-6BP2%F!)&`#/;BW4(5XM$"!B+31"+^8F%[.O__XM%%`/! +MB1Z)7@2)A?3K__^)7@@[R`^#N@```(NU].O__XV%4/G__SO^AE +ME?__QP`)````Z$>5__^#(`#K%/]U$/]U#%;H1P```(/$#(OXB7WDQT7\_O__ +M_^@*````B\?K*8MU"(M]Y%;H_LC__UG#Z`N5__^#(`#H%I7__\<`"0```.CJ +MD___@\C_Z'_X_O_#B_]5B^R#[#"A:.9#`#/%B47\BTT0B4WX5HMU"%>+?0R) +M?="%R74',\#IS@$``(7_=1_HN)3__R$XZ,24___'`!8```#HF)/__X/(_^FK +M`0``4XO&B][!^P:#X#]KT#")7>2+!)V8$D8`B474B57HBEP0*8#[`G0%@/L! +M=2B+P??0J`%U'>AEE/__@R``Z'"4___'`!8```#H1)/__^E1`0``BT74]D00 +M*"!T#VH":@!J`%;HT@$``(/$$%;HY/K__UF$P'0YA-MT(O[+@/L!#X?N```` +M_W7XC47L5U#H5OK__X/$#(OPZ9P```#_=?B-1>Q75E#HB_C__X/$$.OFBT7D +MBPR%F!)&`(M%Z/9$`2B`=$8/OL.#Z`!T+H/H`709@^@!#X6:````_W7XC47L +M5U90Z,/[___KP?]U^(U%[%=64.BA_/__Z['_=?B-1>Q75E#HQ/K__^NABT0! +M&#/)48E-[(E-\(E-](U-\%'_=?A74/\51#!#`(7`=0G_%0`P0P")1>R-=>R- +M?=BEI:6+1=R%P'5CBT78AO7^_XOE7<.+_U6+ +M[%%15HMU"%=6Z'''__^#S_]9.\=U$>C7DO__QP`)````B\>+U^M-_W44C4WX +M4?]U$/]U#%#_%7PQ0P"%P'4/_Q4`,$,`4.AQDO__6>O3BT7XBU7\(\([QW3' +MBT7XB\Z#YC_!^09K]C"+#(V8$D8`@&0Q*/U?7HOE7<.+_U6+[/]U%/]U$/]U +M#/]U".AL____@\007<.+_U6+[%:+=0B%]G45Z$N2___'`!8```#H'Y'__X/( +M_^M1BT8,5X//_\'H#:@!=#E6Z$?M__]6B_CHS>[__U;H&*3__U#H]`(``(/$ +M$(7`>06#S__K$X-^'`!T#?]V'.A]C?__@V8<`%E6Z'"G__]9B\=?7EW#:A!H +M2+U#`.@1]?[_BW4(B77@,\"%]@^5P(7`=17HQ9'__\<`%@```.B9D/__@\C_ +MZSN+1@S!Z`Q6J`%T".@GI___6>OH@V7D`.C;I/__68-E_`!6Z#'___]9B_") +M=>3'1?S^____Z`L```"+QNCQ]/[_PXMUY/]UX.B_I/__6<-J#&AHO4,`Z)'T +M_O\S]HEUY(M%"/\PZ`+%__]9B77\BT4,BP"+.(O7P?H&B\>#X#]KR#"+!)68 +M$D8`]D0(*`%T(5?HK<7__UE0_Q5,,$,`AC\D/__B_#_%0`P0P")!N@` +MD?__QP`)````@\[_B77DQT7\_O___^@-````B\;H7?3^_\(,`(MUY(M-$/\Q +MZ*K$__]9PXO_58OL@^P,BT4(C4W_B47XB47TC47X4/]U#(U%]%#H1/___XOE +M7<.+_U6+[%%6BW4(@_[^=0WHDY#__\<`"0```.M+A?9X-SLUF!1&`',OB\:+ +MUH/@/\'Z!FO(,(L$E9@21@#V1`@H`704C44(B47\C47\4%;HA?___UE9ZQ/H +M2Y#__\<`"0```.@?C___@\C_7HOE70`BT4(_S#H93'1?S^____Z`T```"+QNC5\O[_P@P`BW7DBT40_S#H(L/__UG#B_]5B^R# +M[`R+10B-3?^)1?B)1?2-1?A0_W4,C47T4.A:____B^5=PXO_58OL45:+=0B# +M_OYU%>CXCO__@R``Z`./___'``D```#K4X7V>#<[-9@41@!S+XO&B]:#X#_! +M^@9KR#"+!)68$D8`]D0(*`%T%(U%"(E%_(U%_%!6Z'W___]96>L;Z*B.__^# +M(`#HLX[__\<`"0```.B'C?__@\C_7HOE7<.+_U6+[%97BWT(5^@=P___68/X +M_W4$,_;K3J&8$D8`@_\!=0GV@(@````!=0N#_P)U'/9`6`%T%FH"Z.["__]J +M`8OPZ.7"__]963O&=,A7Z-G"__]94/\5&#!#`(7`=;;_%0`P0P"+\%?H+L+_ +M_UF+SX/G/\'Y!FO7,(L,C9@21@#&1!$H`(7V=`Q6Z-J-__]9@\C_ZP(SP%]> +M7<.+_U6+[(M5"#/)]\*`?@``=&>$TGD#:A!95[\``@``A==T`X/)"/?"``0` +M`'0#@\D$]\(`"```=`.#R0+WP@`0``!T`X/)`5:^`&```(O"(\8[QEYU"(') +M``,``.L:]\(`0```=`B!R0`!``#K"O?"`"```'0""\]?B\%=PXO_58OLBU4( +M,\GWPCT,``!T7?;"`70#:A!9]L($=`.#R0CVP@AT`X/)!/;"$'0#@\D"]L(@ +M=`.#R0%6O@`,``"+PB/&.\9>=0B!R0`#``#K'O?"``@``'0(@]\(``@``=`B!R0`$``#K#O?"``$``'0&@=0.#R1"X`0`!`"/0.]!U`X/)((O! +M7<.+_U6+[%%1,\`A1?AFB47\V7W\@ST8#48``7P$#ZY=^`^W1?Q64.BO_?__ +M_W7XB_#H*/W__UD+QEDE'P,``%Z+Y5W#B_]5B^Q143/`,\EFB47\B4WXW7W\ +M@ST8#48``7P$#ZY=^`^W5?R+P?;"/70R]L(!=`6X$``0`/;"!'0%#0@`"`#V +MP@AT!0T$``0`]L(0=`4-`@`"`/;"('0%#0$``0"+5?CVPCUT-O;"`70%N1`` +M`!#VP@1T!H')"```"/;""'0&@ +M6XOE7<.+_U6+[(/L(%-65S/_B7W@B7WDB7WHB7WLB7WPB7WTB7WXV77@NQ\` +M'Q]3Z`3^____=0B+\/?6(W7DZ/7]__]9"_!9B77DV67@@ST8#48``7PGB7W\ +M#ZY=_%/H=/W___]U"(OP]]8C=?SH9?W__UD+\%F)=?P/KE7\7UY;B^5=P\S, +MS,S,S,S,S,S,S&H*Z%47``"C)!=&`#/`P\Q5B^R#[`B#Y/#='"3S#WX$).@( +M````R<-F#Q)$)`2Z`````&8/*.AF#Q3`9@]SU31F#\7-`&8/*`W`GD,`9@\H +M%=">0P!F#R@=,)]#`&8/*"7@GD,`9@\H-?">0P!F#U3!9@]6PV8/6.!F#\7$ +M`"7P!P``9@\HH/"D0P!F#RBXX*!#`&8/5/!F#US&9@]9]&8/7/+R#UC^9@]9 +MQ&8/*.!F#UC&@>'_#P``@^D!@?G]!P``#X>^````@>G^`P```\KR#RKQ9@\4 +M]L'A"@/!N1````"Z`````(/X``]$T68/*`V`GT,`9@\HV&8/*!60GT,`9@]9 +MR&8/6=MF#UC*9@\H%:"?0P#R#UG;9@\H+0"?0P!F#UGU9@\HJA"?0P!F#U3E +M9@]8_F8/6/QF#UG(\@]9V&8/6,IF#R@5L)]#`&8/6=!F#RCW9@\5]F8/6L-QH5P_____C+MV>K>R>@K`0``V>C> +MP?:%8?___P%T!-GHWO'VPD!U`MG]"NUT`MG@Z;("``#H1@$```O`=!0R[8/X +M`G0"]M79R=GAZZ_IM0(``.E+`P``W=C=V-LMP)]#`,:%W9R=GD +MF]V]8/___YOVA6'___]!==+9\W9R0K)=:[9\2;W;U@ +M____F_:%8?___P%U#]W8VRW`GT,`"NUT`MG@P\:%GT,`WMF;W;U@____ +MF_:%8?___T%UE=G`V?S9Y)O=O6#___^;BI5A____V=`VX`0```,.X```` +M`.OXN`(```#K\5:#['2+]%:#[`C='"2#[`C='"2;W78(Z(('``"#Q!3=9@C= +M!H/$=%Z%P'0%Z=`!``##S,S,S,S,S,S,@'H.!7419HN=7/___X#/`H#G_K,_ +MZP1FNS\39HF=7O___]FM7O___[M.H$,`V>6)E6S___^;W;U@____QH5P____ +M`)N*C6'____0X=#YT,&*P20/UP^^P('A!`0``(O:`]B#PQ#_(X!Z#@5U$6:+ +MG5S___^`SP*`Y_ZS/^L$9KL_$V:)G5[____9K5[___^[3J!#`-GEB95L____ +MF]V]8/___\:%*X-#AT/G0P8K!)`_7T.30Y`K$#[[`@>$$!```B]H#V(/#$/\CZ,X` +M``#9R=W8P^C$````Z_;=V-W8V>[#W=C=V-GNA.UT`MG@P]W8W=C9Z,/;O6+_ +M___;K6+____VA6G___]`=`C&A7#___\`P\:%(``P``@\I_9HE4)`;9;"0&PZD```@` +M=`:X`````,/9H/@ +M('05F]_@9H/@('0,N`@```#HV0```%K#V2PD6L.#[`C=%"2+1"0$@\0()0`` +M\'_K%(/L"-T4)(M$)`2#Q`@E``#P?W0]/0``\']T7V:+!"1F/7\"="IF@^`@ +M=2&;W^!F@^`@=!BX"````(/Z'70'Z'L```!:P^A=````6L/9+"1:P]T%C*!# +M`-G)V?W=V=G`V>'<'7R@0P";W^">N`0```!SQ]P-G*!#`.N_W06$H$,`VW`V4H$,`ZY;,S,S,58OL@\3@B47@ +MBT48B47PBT4#=7?B)3>2+11"+312)1>B)3>R-10B- +M3>!045+HO@0``(/$#-U%^&:!?0A_`G0#V6T(R<.+_U6+[(/L)*%HYD,`,\6) +M1?R#/1`71@``5E=T$/\U(!=&`/\5,#)#`(OXZP6_8(1"`(M%%(/X&@^/(0$` +M``^$#P$``(/X#@^/IP````^$C@```&H"62O!='B#Z`%T:H/H!716@^@!#X6; +M`0``QT7@J*!#`(M%"(O/BW40QT7<`0```-T`BT4,W5WDW0"-1=S=7>S=!E#= +M7?3_%6`R0P#_UUF%P`^%60$``.@X@/__QP`A````Z4D!``")3=S'1>"HH$,` +MZ00!``#'1>"DH$,`ZZ*)3=S'1>"DH$,`Z>P```#'1=P#````QT7@L*!#`.G9 +M````@^@/=%&#Z`ET0X/H`0^%`0$``,=%X+2@0P"+10B+SXMU$,=%W`0```#= +M`(M%#-U=Y-T`C47"PH$,`Z[O9Z(M%$-T8Z:D```"#Z!MT6X/H`71*@^@5=#F#Z`ET*(/H`W07 +M+:L#``!T"8/H`0^%@````(M%"-T`Z\;'1>"XH$,`Z=G^___'1>#`H$,`Z#(H$,`Z<'^___'1>"TH$,`Z;7^___'1=P"````QT7@M*!#`(M%"(O/ +MBW40W0"+10S=7>3=`(U%W-U=[-T&4-U=]/\58#)#`/_7687`=0OHZG[__\<` +M(@```-U%]-T>BTW\7S/-7NA3X?[_B^5=PXO_58OL45%35K[__P``5F@_&P`` +MZ'??___=10B+V%E9#[=-#KCP?P``(\A14=T<)&8[R'4WZ$0+``!(65F#^`)W +M#E93Z$??___=10A96>MCW44(W070H$,`4X/L$-C!W5PD"-T<)&H,:@CK/^@M +M`P``W57XW44(@\0(W>'?X/;$1'H25MW94]W8Z`+?___=1?A96>L>]L,@=>E3 +M@^P0V'?X%E9W=GVQ$1Z*]P-`*E#`%%1W57XW1PDZ%8"``#=1?C:Z=_@ +M65GVQ$1Z!6H"6.L),\!`ZP3=V#/`B^5=PXO_58OLW44(N0``\'_9X;@``/#_ +M.4T4=3N#?1``=779Z-C1W^#VQ`5Z#]W9W=C=!9"J0P#IZ0```-C1W^#=V?;$ +M08M%&`^%V@```-W8V>[IT0```#E%%'4[@WT0`'4UV>C8T=_@]L0%>@O=V=W8 +MV>[IK0```-C1W^#=V?;$08M%&`^%G@```-W8W060JD,`Z9$```#=V#E-#'4N +M@WT(``^%@@```-GNW440V-'?X/;$00^$<____]C9W^#VQ`6+11A[8MW8V>CK +M7#E%#'59@WT(`'53W44045'='"3HM?[__]GNW44065G8T8O(W^#VQ$%U$]W9 +MW=C=!9"J0P"#^0%U(-G@ZQS8V=_@]L0%>@^#^0%U#MW8W06@JD,`ZP3=V-GH +MBT48W1@SP%W#B_]3B]Q148/D\(/$!%6+:P2);"0$B^R![(@```"A:.9#`#/% +MB47\BT,05HMS#%+ +M2PB#^1!T$(/Y%G0+@_D==`:#9<#^ZQ*+1<#=1A"#X..#R`/=7;")1<"-1AA0 +MC48(4%%7C85\____4(U%@%#H0@,``(/$&(N-?/___VC__P``4>@HW/__@SX( +M65ET%.@2<___A,!T"U;H-W/__UF%P'4(_S;H(`8``%F+3?Q?,\U>Z+C=_O^+ +MY5V+XUO#B_]5B^Q14=U%"-G\W5WXW47XB^5=PXO_58OLBT4(J"!T!&H%ZQ>H +M"'0%,\!`7<.H!'0$:@+K!J@!=`5J`UA=PP^VP(/@`@/`7<.+_U.+W%%1@^3P +M@\0$58MK!(EL)`2+[('LB````*%HYD,`,\6)1?Q6BW,@C4,85U90_W,(Z)4` +M``"#Q`R%P'4F@V7`_E"-0QA0C4,04/]S#(U#(/]S"%"-18!0Z'$"``"+[<&=_@]L0%>RS= +M!9BJ0P#K,HM-#-GNW!G?X/;$!7H>W068JD,`ZQZ+30S9[MP9W^#VQ`5Z"-T% +MD*I#`.L(W060JD,`V>#=&8/F_NG4````]L,"#X3+````]D40$`^$P0```%[:Z=_@]L1$#XN1````W0&-1?Q045'='"3HG`0``(M% +M_(/$#`4`^O__B47\W57PV>X]SOO__WT',__>R4?K6=[9,]+?X/;$074!0HM% +M]KD#_/__@^`/@\@09HE%]HM%_#O!?2LKR(M%\/9%\`%T!87_=0%'T>CV1?0! +MB47P=`@-````@(E%\-%M](/I`77:W47PA=)T`MG@BT4,W1CK`S/_1X7_7W0( +M:A#H3=G__UF#YOWVPQ!T$?9%$"!T"VH@Z#?9__]9@^;O,\"%]EX/E,!;B^5= +MPXO_58OL:@#_=1S_=1C_=13_=1#_=0S_=0CH!0```(/$'%W#B_]5B^R+10@S +MR5,SVT.)2`2+10A7OPT``,")2`B+10B)2`R+31#VP1!T"XM%"+^/``#`"5@$ +M]L$"=`R+10B_DP``P(-(!`+VP0%T#(M%"+^1``#`@T@$!/;!!'0,BT4(OXX` +M`,"#2`0(]L$(=`R+10B_D```P(-(!!"+30A6BW4,BP;!X`3WT#-!"(/@$#%! +M"(M-"(L&`\#WT#-!"(/@"#%!"(M-"(L&T>CWT#-!"(/@!#%!"(M-"(L&P>@# +M]]`S00B#X`(Q00B+!HM-",'H!??0,T$((\,Q00CH?]C__XO0]L(!=`>+30B# +M20P0]L($=`>+10B#2`P(]L((=`>+10B#2`P$]L(0=`>+10B#2`P"]L(@=`:+ +M10@)6`R+!KD`#```(\%T-3T`!```="(]``@``'0,.\%U*8M%"(,(`^LABTT( +MBP&#X/Z#R`*)`>L2BTT(BP&#X/T+P^OPBT4(@R#\BP:Y``,``"/!="`]``(` +M`'0,.\%U(HM%"(,@X^L:BTT(BP&#X.>#R`3K"XM-"(L!@^#K@\@(B0&+10B+ +M313!X04S"('AX/\!`#$(BT4("5@@@WT@`'0LBT4(@V`@X8M%&-D`BT4(V5@0 +MBT4("5A@BT4(BUT<@V!@X8M%"-D#V5A0ZSJ+30B+02"#X..#R`*)02"+11C= +M`(M%"-U8$(M%"`E88(M-"(M='(M!8(/@XX/(`HE!8(M%"-T#W5A0Z*#6__^- +M10A0:@%J`%?_%90Q0P"+30CV00@0=`.#)O[V00@(=`.#)OOV00@$=`.#)O?V +M00@"=`.#)N_V00@!=`.#)M^+`;K_\___@^`#@^@`=#6#Z`%T(H/H`70-@^@! +M=2B!#@`,``#K((L&)?_[__\-``@``(D&ZQ"+!B7_]___#0`$``#K[B$6BP'! +MZ`*#X`>#Z`!T&8/H`70)@^@!=1HA%NL6BP8CP@T``@``ZPF+!B/"#0`#``") +M!H-](`!>=`?905#9&^L%W4%0W1M?6UW#B_]5B^R+10B#^`%T%8/`_H/X`7<8 +MZ`MU___'`"(```!=P^C^=/__QP`A````7<.+_U6+[(M5#(/L(#/)B\$Y%,68 +MJ4,`=`A`@_@=?/'K!XL,Q9RI0P")3>2%R715BT40B47HBT44B47LBT48B47P +MBT4<5HMU"(E%](M%(&C__P``_W4HB47XBT4DB77@B47\Z%'5__^-1>!0Z&UL +M__^#Q`R%P'4'5NA5____6=U%^%[K&VC__P``_W4HZ"?5____=0CH.?___]U% +M((/$#(OE7<.+_U6+[-U%"-GNW>'?X%?VQ$1Z"=W9,__IKP```%9FBW4.#[?& +MJ?!_``!U?(M-#(M5"/?!__\/`'4$A=)T:M[9OP/\___?X/;$074%,\!`ZP(S +MP/9%#A!U'P/)B4T,A=)Y!H/)`8E-#`/23_9%#A!TZ&:+=0Z)50BY[_\``&8C +M\6:)=0Z%P'0,N`"```!F"_!FB74.W44(:@!14=T<).@Q````@\0,ZR-J`%'= +MV%'='"3H'@````^W_H/$#,'O!('G_P<``('O_@,``%Z+11").%]=PXO_58OL +M45&+31`/MT4.W44()0^```#=7?B-B?X#``#!X00+R&:)3?[=1?B+Y5W#B_]5 +MB^R!?0P``/!_BT4(=0>%P'450%W#@7T,``#P_W4)A$`@```9H7`=1[W10S__P\`=0:#?0@`=`_WV1O)@^&0C8&` +M````7"-04!=P_?9&\F!X0C___^-@0`! +M``!=P\S_):@Q0P#_)=`Q0P#,S,S,S,S,S%6+[(M%"#/24U97BT@\`\@/MT$4 +M#[=9!H/`&`/!A=MT&XM]#(MP##O^<@F+2`@#SCOY<@I"@\`H.]-RZ#/`7UY; +M76XOE7<.+1>R+`#/)@3@%``#`#Y3!B\'#BV7HQT7\_O__ +M_S/`BTWP9(D-`````%E?7EN+Y5W#S,S,S,S,58OLBT4(N4U:``!F.0AT!#/` +M7<.+2#P#R#/`@3E010``=0RZ"P$``&8Y41@/E,!=PU!D_S4`````C40D#"MD +M)`Q35E>)*(OHH6CF0P`SQ5")9?#_=?S'1?S_____C47T9*,`````\L/,S,S, +MS,S,S%:+1"04"\!U*(M,)!"+1"0,,]+W\8O8BT0D"/?QB_"+P_=D)!"+R(O& +M]V0D$`/1ZT>+R(M<)!"+5"0,BT0D"-'IT=O1ZM'8"\EU]/?SB_#W9"04B\B+ +M1"00]^8#T7(..U0D#'<(<@\[1"0(=@E.*T0D$!M4)!0SVRM$)`@;5"0,]]KW +MV(/:`(O*B].+V8O(B\9>PA``S,S,S,S,S,S,S,QH4"%"`&3_-0````"+1"00 +MB6PD$(UL)!`KX%-65Z%HYD,`,47\,\6)1>10B67H_W7XBT7\QT7\_O___XE% +M^(U%\&2C`````/+#BTWD,\WRZ`;2_O_RZ?S2_O_,S,S,S,Q1C4PD""O(@^$/ +M`\$;R0O!6>D:R?[_48U,)`@KR(/A!P/!&\D+P5GI!,G^_\S,S,R#/1@-1@`` +M=#=5B^R#[`B#Y/C='"3R#RP$),G#@ST8#48``'0;@^P$V3PD6&:#X']F@_A_ +M=-.-I"0`````C4D`58OL@^P@@^3PV<#95"08WWPD$-]L)!"+5"08BT0D$(7` +M=#S>Z872>1[9'"2+#"2!\0```("!P?___W^#T`"+5"04@](`ZRS9'"2+#"2! +MP?___W^#V`"+5"04@]H`ZQ2+5"04]\+___]_=;C97"08V5PD&,G#S,S,S,S, +MS,S,S,Q5B^Q7@ST8#48``0^"_0```(M]"'=W#[95#(O"P>(("]!F#V[:\@]P +MVP`/%MNY#P```"//@\C_T^`K^3/2\P]O#V8/[])F#W319@]TRV8/U\HCR'48 +M9@_7R2/(#[W!`\>%R0]%T(/(_X/'$.O04V8/U]DCV-'A,\`KP2/(22/+6P^] +MP0/'AMF#V["@\<09@\Z8T?P0(U,#_`/0L%U[5_)P[CP____(\=F#^_`9@]T +M`+D/````(\^Z_____]/B9@_7^"/Z=11F#^_`9@]T0!"#P!!F#]?XA?]T[`^\ +MUP/"Z[V+?0@SP(/)__*N@\$!]]F#[P&*10S]\JZ#QP$X!W0$,\#K`HO'_%_) +MPXM-\.G!>/W_BTWP@<$H$```Z65!_?^+3?"!P>@@``#I@ZO]_XM-\('!@"(` +M`.E@]_S_BTWP@<'010``Z5+W_/]H\((``/]U[.C1Q?[_65G#N(BQ0P#IX^#^ +M_[@XL4,`Z=G@_O^-3#I4O;\_[@0LD,`Z:/@_O^-323IZ__\_[@\LD,`Z9'@_O^-33#IV?_\ +M_[AHLD,`Z7_@_O^-C109___I__W]_[B4LD,`Z6K@_O^+3?#I69/]_XM-\('! +M'*,``.G$._W_BTWP@<%\HP``Z;8[_?^+3?"!P=RC``#IJ#O]_XM-\('!/*0` +M`.F:._W_BTWP@<&SH +M6<3^_UE9P[A4M$,`Z6O?_O^-C:AB___I3_7\_[CLLT,`Z5;?_O^-C<3^___I +M=LS]_XV-G-[__^G,=OW_N(BT0P#I-M_^_XV-N.___^FW=OW_C4W@Z8'T_/^X +M(+1#`.D9W_[_C4W@Z6_T_/^XM+1#`.D'W_[_C8W(W___Z8AV_?^XX+1#`.GR +MWO[_BTWP@<$D4```Z0_,_?^+3?"!P7!A``#I@I']_[@4M4,`Z_O^+3?"! +MP9````#I6(G]_XM-\('!I````.E*B?W_BTWP@<&X````Z3R)_?]HP!```/]U +M[.AVP_[_65G#:,`0``#_=>SH9L/^_UE9P[@XM4,`Z7C>_O^-C?S<___I^77] +M_[B,M4,`Z6/>_O^+3?"#P03IE(?]_XM-\(/!).FK\_S_BTWP@\$XZ:#S_/^+ +M3?"#P4SI9_O]_XM-\('!1$L``.FD^_W_BTWP@<'8F```Z9O[_?^+3?"!P63F +M``#I4)W]_[A@MD,`Z0/>_O^-3<3I6?/\_[@\MD,`Z?'=_O\SVXM%\+GD2@`` +M]^$/D,/WVPO8,\"#PP0/DL#WV`O#4/]U[.CZR?[_65G#N+BU0P#IO-W^_XU- +MU.D2\_S_N.2U0P#IJMW^_XU-V.D`\_S_N!"V0P#IF-W^_V@X`P``_W7PZ&S" +M_O]96<.XQ+9#`.E^W?[_C8W<@O__Z6+S_/^-3=SI$//\_[@`N$,`Z6'=_O^- +MC63.___IXG3]_[@LN$,`Z4S=_O^-C:AR___I@X/]_[A8N$,`Z3?=_O^-C?#> +M___IZ5K]_[B(MT,`Z2+=_O^+5"0(C4(,BTKL,\CHI\O^_[@8ND,`Z0?=_O_, +MS,RYZ`Y$`.GSJ_W_S,S,S,S,N<"!1`#I^M0#`(S4`P"HU`,`OM0#`-34`P#> +MU`,`ZM0#`/;4`P`$U0,`%M4#`";5`P`ZU0,`2M4#`%S5`P!HU0,`>M4#`)35 +M`P`2U@,``````*#2`P".T@,`<-(#`%#2`P`RT@,`'M(#``S2`P``T@,`]-$# +M``````!0,D(``````'#M00``$$``$!!``"`00`!`$$``4!!``&`00`"P$$`` +MT!!``'`00`"0$$````````````"P[$$`8.U!`'!:0@"@GD(`<.Q"`!`#0P`` +M``````````"&0@"P&4,`<)]"```````````````````0````$!`````@$``` +M`$`0````4!````!@$````'`0````D!````"P$````-`0````T!8```#`'0`` +M`+`_````D&`````080```$"8````<)@```!0FP```)"=````T)X```#@GP`` +M`$"J````T-$```!PT@```*#2````$-,````PTP```````D-,```"@#`$` +M`-`<`0``\!P!```@'0$``+`>`0``D!\!``#0<@$``/"&`0``T(L!``#@BP$` +M`/"+`0```(P!```0C`$``"",`0``P(P!``#0C`$``.",`0``,(T!``!`C0$` +M`-"-`0``X(T!``#PC0$``!".`0``((X!```PC@$``$".`0``<(X!``"`C@$` +M`!"/`0``((\!``#@D@$```"4`0``\)0!````E0$``!"5`0``()4!```PE0$` +M``"6`0``,)8!``!`E@$``%"6`0``8)8!``!PE@$``&"8`0``<)@!``#`F0$` +M`-"9`0``X)D!``#PF0$```":`0``$)H!```@F@$``+"=`0``\)T!``#`I@$` +M`""L`0``8*\!``!PL0$``'"[`0``4,\!``#0YP$``+#L`0``8.T!``!P[0$` +M`/#N`0``$.\!``!0[P$``!#S`0```/0!``"@]`$``%`A`@`!0","``"@)`(` +M`$`E`@``@"4"``!0,@(``/`R`@``4#<"``!P6@(``"!^`@``0'X"``"@@@(` +M`,""`@``X(("``#P@@(```"#`@``0(,"``!0@P(``&"$`@```(8"``"@D0(` +M`,"3`@``\),"``"@G@(``'"?`@``<*$"``#0H0(``,"F`@``(*<"```@JP(` +M`-"K`@``$*P"``"@M0(``%"Y`@``H+H"``#`N@(``'#L`@``$`,#``"P&0,` +M`&`C`P``<",#``"`(P,``)`C`P``H",#``"P(P,``````````````````"H` +M````````T!9``%";0`!PF$``D)U``-">0`#@GT``P!U```````!-`&$`>`!I +M`&T`=0!M`"``80!L`&P`;P!W`&4`9``@`&$`<@!R`&$`>0`@`',`:0!Z`&4` +M(``H`"4`=0`I`"``:0!S`"``90!X`&,`90!E`&0`90!D````0P!-`%0```!2 +M`%(``````&@`)0!U````:`!C`"4`=0``````>``E`'4```!X`&,`)0!U```` +M```````````````````[`"4`=0```````````0(#!`4&!P@)"@L,#0X/#@H$ +M"`D/#08!#``""P<%`PL(#``%`@\-"@X#!@!;9^8):H6N9[MR\VX\.O5/I2X`7```````4P!E`%,`90!C`'4` +M<@!I`'0`>0!0`'(`:0!V`&D`;`!E`&<`90```%,`90!2`&4`0````!#`'(`>0!P`'0` +M4`!R`&\`=`!E`&,`=`!-`&4`;0!O`'(`>0`@`&8`80!I`&P`90!D````0P!R +M`'D`<`!T`%4`;@!P`'(`;P!T`&4`8P!T`$T`90!M`&\`<@!Y`"``9@!A`&D` +M;`!E`&0`````````F"^*0I%$-W'/^\"UI=NUZ5O"5CGQ$?%9I((_DM5>'*N8 +MJ@?8`5N#$KZ%,23#?0Q5=%V^!1XR(0(`L>,^O^^D.ML4*3WH_F^\GAQQ@`` +M``!X;&ES='!O5<`````4V5T1&5F875L=$1L;$1I0!P`'0`8@!A`',` +M90`N`&0`;`!L````;`!P`&L`+@!D`&P`;````'4`0!P`'0`,P`R`"X`9`!L`&P```!M`',`80!S`&X`,0`N`&0`;`!L``````!C +M`'(`>0!P`'0`=0!I`"X`9`!L`&P```!W`&D`;@!T`'(`=0!S`'0`+@!D`&P` +M;```````0!L`&4`/@```#P`+P!S`'0`>0!L`&4` +M/@```````````#P`0![`&8`;P!N`'0`+0!F +M`&$`;0!I`&P`>0`Z`"(`00!R`&D`80!L`"(`.P!F`&\`;@!T`"T``!M`&$`<`!P`&D`;@!G`&8`:0!L`&4`+@!T`&T`<````````!P`&$`<@``````3`!)`$,`10!.`%,`10!$`$P`1P``````(``` +M`%\`7P!T`&T`<`!?`'(`80!R`%\`&-L=7-I=F4`4F5L96%S95-25TQO8VM% +M>&-L=7-I=F4```````````!32$Q705!)+F1L;```````0T]-0U1,,S(N9&QL +M`````!2K0P#0YT$`7``````````````````````````````````````````` +M````````````````````````````````````:.9#`)"L0P`E````8#)#```` +M``#4,D,`D``````U`1!`!```` +M```````````#````(`63&0``````````H"1"`$"L0P"`)4(`\(9!`&)A9"!E +M>&-E<'1I;VX```#X54,`#%9#`$A60P!@.T,`80!D`'8`80!P`&D`,P`R```` +M```\`'``:0`M`&T`0!N`&,`:``M`&P`,0`M`#(`+0`P```````!`````P```$9L0P!?7V)A/0``8'9F=&%B;&4G````8'9B=&%B;&4G```` +M8'9C86QL)P!@='EP96]F)P````!@;&]C86P@2!C;VYS +M=')U8W1O'AX>`@'"`<`!P`( +M"`@```@'"``'"``'`"AN=6QL*0``*`!N`'4`;`!L`"D````````````%``#` +M"P`````````=``#`!`````````"6``#`!`````````"-``#`"`````````". +M``#`"`````````"/``#`"`````````"0``#`"`````````"1``#`"``````` +M``"2``#`"`````````"3``#`"`````````"T`@#`"`````````"U`@#`"``` +M```````,`````P````D```!M`',`8P!O`'(`90!E`"X`9`!L`&P```!#;W)% +M>&ET4')O8V5S0``5'5E0!7961N97-D87D` +M``!4:'5R0````!&0````!! +M=6=U0````!D9&1D+"!-34U-(&1D+"!Y>7EY +M`$A(.FUM.G-S`````%,`=0!N````30!O`&X```!4`'4`90```%<`90!D```` +M5`!H`'4```!&`'(`:0```%,`80!T````4P!U`&X`9`!A`'D``````$T`;P!N +M`&0`80!Y``````!4`'4`90!S`&0`80!Y````5P!E`&0`;@!E`',`9`!A`'D` +M``!4`&@`=0!R`',`9`!A`'D``````$8`<@!I`&0`80!Y``````!3`&$`=`!U +M`'(`9`!A`'D``````$H`80!N````1@!E`&(```!-`&$`<@```$$`<`!R```` +M30!A`'D```!*`'4`;@```$H`=0!L````00!U`&<```!3`&4`<````$\`8P!T +M````3@!O`'8```!$`&4`8P```$H`80!N`'4`80!R`'D```!&`&4`8@!R`'4` +M80!R`'D``````$T`80!R`&,`:````$$`<`!R`&D`;````$H`=0!N`&4````` +M`$H`=0!L`'D``````$$`=0!G`'4`0``````9`!D`&0`9``L`"``30!-`$T`30`@`&0`9``L`"``>0!Y`'D`>0`` +M`$@`2``Z`&T`;0`Z`',`&1# +M`(AD0P"<9$,`L&1#`+AD0P#`9$,`U&1#`/QD0P`094,`````````(``@`"`` +M(``@`"``(``@`"``*``H`"@`*``H`"``(``@`"``(``@`"``(``@`"``(``@ +M`"``(``@`"``(``@`$@`$``0`!``$``0`!``$``0`!``$``0`!``$``0`!`` +MA`"$`(0`A`"$`(0`A`"$`(0`A``0`!``$``0`!``$``0`($!@0&!`8$!@0&! +M`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$0`!`` +M$``0`!``$`""`8(!@@&"`8(!@@$"`0(!`@$"`0(!`@$"`0(!`@$"`0(!`@$" +M`0(!`@$"`0(!`@$"`0(!$``0`!``$``@`"``(``@`"``(``H`"``(``@`"`` +M(``@`"``(``@`"``(``@`"``(``@`"``(``@`"``(``@`"``(``@`"``(``( +M`!``$``0`!``$``0`!``$``0`!(!$``0`#``$``0`!``$``4`!0`$``2`1`` +M$``0`!0`$@$0`!``$``0`!```0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$!`0$! +M`0$!`0$!`0$!`0$!`0$!`0$!`1```0$!`0$!`0$!`0$!`0$"`0(!`@$"`0(! +M`@$"`0(!`@$"`0(!`@$"`0(!`@$"`0(!`@$"`0(!`@$"`0(!`@$0``(!`@$" +M`0(!`@$"`0(!`@$!`0`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````(``@`"``(``@`"``(``@`"``*``H`"@`*``H`"``(``@`"``(``@`"`` +M(``@`"``(``@`"``(``@`"``(``@`$@`$``0`!``$``0`!``$``0`!``$``0 +M`!``$``0`!``A`"$`(0`A`"$`(0`A`"$`(0`A``0`!``$``0`!``$``0`($` +M@0"!`($`@0"!``$``0`!``$``0`!``$``0`!``$``0`!``$``0`!``$``0`! +M``$``0`0`!``$``0`!``$`""`((`@@""`((`@@`"``(``@`"``(``@`"``(` +M`@`"``(``@`"``(``@`"``(``@`"``(`$``0`!``$``@```````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````"`@8*#A(6&AXB)BHN,C8Z/D)&2DY25EI>8 +MF9J;G)V>GZ"AHJ.DI::GJ*FJJZRMKJ^PL;*SM+6VM[BYNKN\O;Z_P,'"P\3% +MQL?(R+CY.7FY^CIZNOL[>[O\/'R +M\_3U]O?X^?K[_/W^_P`!`@,$!08'"`D*"PP-#@\0$1(3%!46%Q@9&AL<'1X? +M("$B(R0E)B7I;7%U>7V!A8F-D969G:&EJ:VQM;F]P<7)S='5V=WAY +M>GM\?7Y_@(&"@X2%AH>(B8J+C(V.CY"1DI.4E9:7F)F:FYR=GI^@H:*CI*6F +MIZBIJJNLK:ZOL+&RL[2UMK>XN;J[O+V^O\#!PL/$Q<;'R,G*R\S-SL_0T=+3 +MU-76U]C9VMOKK[.WN[_#Q\O/T]?;W^/GZ^_S]_O^` +M@8*#A(6&AXB)BHN,C8Z/D)&2DY25EI>8F9J;G)V>GZ"AHJ.DI::GJ*FJJZRM +MKJ^PL;*SM+6VM[BYNKN\O;Z_P,'"P\3%QL?(R+CY.7FY^CIZNOL[>[O\/'R\_3U]O?X^?K[_/W^_P`!`@,$!08' +M"`D*"PP-#@\0$1(3%!46%Q@9&AL<'1X?("$B(R0E)B7V!! +M0D-$149'2$E*2TQ-3D]045)35%565UA96GM\?7Y_@(&"@X2%AH>(B8J+C(V. +MCY"1DI.4E9:7F)F:FYR=GI^@H:*CI*6FIZBIJJNLK:ZOL+&RL[2UMK>XN;J[ +MO+V^O\#!PL/$Q<;'R,G*R\S-SL_0T=+3U-76U]C9VMOKK[.WN[_#Q\O/T]?;W^/GZ^_S]_O_@;D,`*&]#``Q60P!H;T,`H&]#`.AO +M0P!(<$,`E'!#`$A60P#0<$,`$'%#`$QQ0P"(<4,`V'%#`#!R0P"(@!A`'0`:0!O`&X`+0!L`#$`+0`R +M`"T`,0```#P`<`!I`"T`;0!S`"T`=P!I`&X`+0!C`&\`<@!E`"T`;`!O`&,` +M80!L`&D`>@!A`'0`:0!O`&X`+0!O`&(`0!S`&D`;@!F`&\`+0!L`#$`+0`R`"T`,0``````/`!P`&D`+0!M`',` +M+0!W`&D`;@`M`&,`;P!R`&4`+0!W`&D`;@!R`'0`+0!L`#$`+0`Q`"T`,``` +M````/`!P`&D`+0!M`',`+0!W`&D`;@`M`&,`;P!R`&4`+0!X`',`=`!A`'0` +M90`M`&P`,@`M`#$`+0`P````80!P`&D`+0!M`',`+0!W`&D`;@`M`'(`=`!C +M`&\`<@!E`"T`;@!T`'4``!T`"T`;0!S`"T`=P!I`&X`+0!N`'0`=0!S`&4`<@`M`&0`:0!A +M`&P`;P!G`&(`;P!X`"T`;``Q`"T`,0`M`#```````&4`>`!T`"T`;0!S`"T` +M=P!I`&X`+0!N`'0`=0!S`&4`<@`M`'<`:0!N`&0`;P!W`',`=`!A`'0`:0!O +M`&X`+0!L`#$`+0`Q`"T`,```````=0!S`&4`<@`S`#(```````(````2```` +M`@```!(````"````$@````(````2``````````X```!'971#=7)R96YT4&%C +M:V%G94ED``@````2````!````!(```!,0TUA<%-TQVL%````````0.KM=$;0G"R?#`````!A];FK +MOZ1DCJ]6J9]'!C:R +M2UW@7]R`"JK^\$#9CJC0@!IK(V,``&0X3#*6QU>#U4)*Y&$BJ=D]$#R]6V%/;FDJ>Q@^=71E"F[S5MFEBX[HMM]^F6L +M4]YWFZ(@L%/YO\:K)91+3>,$`($MP_OTT")24"@/M_/R$U<3%$+)3W`L!T&XP`7?"P +M=<;;J12YV>+?<@]E3$LH=Q;@]FW"D4-1S\F5)U6KXM8GYJBX<6:#Z*/#TS3^E+AF@<=:\AT1I?0%N +M^1"=5AIY=:2/``#ALKD\=8B"DQ8_S6LZM(G>AYX(1D5-:`RFV_V1DR3?$^QH +M,"=$M)GN08&VP\H"6/%1:-FB)79]C7%.`0``9/OF@UKR#ZU7E!&U@`!FM2D@ +MS]+%UWUM/Z4<3;?-WG"=VCU!%K=.RM!QF!/DUY`Z0$_B/ZOY;W=-)N:O"@,` +M```0,56K"=)8#*;+)F%6AX,<:L'TAW5VZ$0LST>@09X%",D^!KJ@Z,C/YU7` +M^N&R1`'OL'X@)',EZ8L2FF5OQXI',3'JM+5V';'-M$,5=J3D)W'FJC+2R48=O`-"8BH +M]W00'SK\$4CEK8YC61#GRY?H:=5Y3@.4Y`$```````"AZ=1< +M;&]]Y)OGV3OYH6]B=U$TB\;H62O>6-X\SUC_1B(5?%>H677G)E-G=Q=CM^;K +M7PK]XVDYZ#,UH`6HA[DQ]D,/'R';0UK8EO4;JZ(9/V@$````9/Y]OB\$R4NP +M[?7AVDZACW/;">2<[D]G#9\5J=:UM?8.ECASD<))Z\R7*U^5/S@/]K.1(!0W +M>-'?0M'!WB(^%5??KXI?Y?5WB\KGHUM2+P,]3^=""@`````0W?12"45=X4*T +MKBXTLZ-OH\T_;GHHM/=WP4O0R-)GX/BHKF<[R:VS5LAL"YV=E0#!2%L]BKY* +M]#;94DWHVW'%(1SY"8%%2FK8JM=\3.$(G*6;=0"(/.07``````!`DM00\02^ +M!0IKU'\.9?K)14P*TP+#@.A.SS^*+K\B'=80YZXI.0]<\+R +M1GR88G2/#R$9VZZVHRZR%%"JC:LYZD(TEI>IW]\!_M/STH`">:`W`````9N< +M4/&MW,H&J)M1^/(#Q*+A4J`Z(Q#7J7.%1+K9$L\#&(=P +MFSK<4NA2LN5.^Q<'+Z9-ON'7JPI/[6*,>^RYSB%`9M0`@Q6AYG7CS/(I+X2! +M`````.07=V3[]=-Q/7:@Z2\4?69,]#,N\;CSC@T/$VF43'.H#R9@0!,!/`J( +M<)\[9=2Q&'#8JK8VH?>ZC.X86CP +ME+V:S!-JU<&-+0$`````$!/H-GK&GBD6]`H_2?//IJ5WHR.^I();HLPOO+K^K'8R(4PN,LT3/K21_G`VV5R[A9<40OT:S$;X +MW3CFTH<':1?1`AK^\;4^KJNYPV_N"!R^`@``````0*K"0('9=_@L/=?A<9@O +MY]4)8U%RW1FHKT9:*M;.W`(J_MU&SHTD$R>MTB.W&;L$Q"O,!K?*Z[%'W$L) +MG8Q@%;#CJA8+S1"'@2+%.6__A/\_P4/>6-G_3;59G90X;EB!@`` +M`&&P9QH*`=+`X070.W,2VS\NGZ/BG;)AXMQC*KP$)I2;U7!AEB7CPKEU"Q0A +M+!T?8&H3N*([THES??%@W]?*QBO?:08WA[@D[0:39NMN21EOVXV3=8)T7C:: +M;L4QMY`VQ4(HR(YYKB3>#@````!D0<&:B-69+$/9&N>`HBX]]FL]>4F"0ZGG +M>4KF_2*:<-;@[\_*!=>DC;UL`&3CL]Q.I6X(J*&>18]TR%2._%?&=,S4P[A" +M;F/95\Q;M37I_A-L85'$&MNZE;6=3O&A4.?YW'%_8PG2(``````!") +MO5X\5C=WXSBCRSU/GM*!+)[WI'3'^<.7YQQJ..1?K)R+\P?Z[(C5K,%:/L[, +MKX5P/Q^=TVTMZ`P8?1=OE&E>X2R.9$@YH941X`\T6#P7M)3V2">]5R9\+MJ+ +M=:"0@#L3MMLMD$C/;7X$Y"294````````@(```,%```$"0`!!`T``042``$& +M&``"!AX``@(5#`!$```"`A4,`$@```(B%0P`3````D(5#`!0```"8A4,` +M%0```*"%0P`6````J(5#`!@```"PA4,`&0```+B%0P`:````P(5#`!L```#( +MA4,`'````-"%0P`=````V(5#`!X```#@A4,`'P```.B%0P`@````\(5#`"$` +M``#XA4,`(@```.AS0P`C`````(9#`"0````(AD,`)0```!"&0P`F````&(9# +M`"<````@AD,`*0```"B&0P`J````,(9#`"L````XAD,`+````$"&0P`M```` +M2(9#`"\```!0AD,`-@```%B&0P`W````8(9#`#@```!HAD,`.0```'"&0P`^ +M````>(9#`#\```"`AD,`0````(B&0P!!````D(9#`$,```"8AD,`1````*"& +M0P!&````J(9#`$<```"PAD,`20```+B&0P!*````P(9#`$L```#(AD,`3@`` +M`-"&0P!/````V(9#`%````#@AD,`5@```.B&0P!7````\(9#`%H```#XAD,` +M90````"'0P!_````M#5#``$$```(AT,``@0``!2'0P`#!```((=#``0$``#< +M(I#`($$``"$BD,``0@``)"* +M0P`$"```Q'-#``<(``"0``````80!Z``````!E`'4``````&T`:P``````80!F``````!K +M`&$``````&8`;P``````:`!I``````!M`',``````&L`:P``````:P!Y```` +M``!S`'<``````'4`>@``````=`!T``````!P`&$``````&<`=0``````=`!A +M``````!T`&4``````&L`;@``````;0!R``````!S`&$``````&T`;@`````` +M9P!L``````!K`&\`:P```',`>0!R````9`!I`'8```!A`'(`+0!3`$$```!B +M`&<`+0!"`$<```!C`&$`+0!%`%,```!C`',`+0!#`%H```!D`&$`+0!$`$L` +M``!D`&4`+0!$`$4```!E`&P`+0!'`%(```!F`&D`+0!&`$D```!F`'(`+0!& +M`%(```!H`&4`+0!)`$P```!H`'4`+0!(`%4```!I`',`+0!)`%,```!I`'0` +M+0!)`%0```!N`&P`+0!.`$P```!N`&(`+0!.`$\```!P`&P`+0!0`$P```!P +M`'0`+0!"`%(```!R`&\`+0!2`$\```!R`'4`+0!2`%4```!H`'(`+0!(`%(` +M``!S`&L`+0!3`$L```!S`'$`+0!!`$P```!S`'8`+0!3`$4```!T`&@`+0!4 +M`$@```!T`'(`+0!4`%(```!U`'(`+0!0`$L```!I`&0`+0!)`$0```!U`&L` +M+0!5`$$```!B`&4`+0!"`%D```!S`&P`+0!3`$D```!E`'0`+0!%`$4```!L +M`'8`+0!,`%8```!L`'0`+0!,`%0```!F`&$`+0!)`%(```!V`&D`+0!6`$X` +M``!H`'D`+0!!`$T```!A`'H`+0!!`%H`+0!,`&$`=`!N``````!E`'4`+0!% +M`%,```!M`&L`+0!-`$L```!T`&X`+0!:`$$```!X`&@`+0!:`$$```!Z`'4` +M+0!:`$$```!A`&8`+0!:`$$```!K`&$`+0!'`$4```!F`&\`+0!&`$\```!H +M`&D`+0!)`$X```!M`'0`+0!-`%0```!S`&4`+0!.`$\```!M`',`+0!-`%D` +M``!K`&L`+0!+`%H```!K`'D`+0!+`$<```!S`'<`+0!+`$4```!U`'H`+0!5 +M`%H`+0!,`&$`=`!N``````!T`'0`+0!2`%4```!B`&X`+0!)`$X```!P`&$` +M+0!)`$X```!G`'4`+0!)`$X```!T`&$`+0!)`$X```!T`&4`+0!)`$X```!K +M`&X`+0!)`$X```!M`&P`+0!)`$X```!M`'(`+0!)`$X```!S`&$`+0!)`$X` +M``!M`&X`+0!-`$X```!C`'D`+0!'`$(```!G`&P`+0!%`%,```!K`&\`:P`M +M`$D`3@``````@`M`$(`3P``````;@!S`"T`6@!!````;0!I`"T`3@!:````80!R`"T`20!1 +M````9`!E`"T`0P!(````90!N`"T`1P!"````90!S`"T`30!8````9@!R`"T` +M0@!%````:0!T`"T`0P!(````;@!L`"T`0@!%````;@!N`"T`3@!/````<`!T +M`"T`4`!4````0!R`&P` +M`````',`90`M`$8`20```'$`=0!Z`"T`4`!%``````!A`'(`+0!,`%D```!Z +M`&@`+0!3`$<```!D`&4`+0!,`%4```!E`&X`+0!#`$$```!E`',`+0!'`%0` +M``!F`'(`+0!#`$@```!H`'(`+0!"`$$```!S`&T`:@`M`$X`3P``````80!R +M`"T`1`!:````>@!H`"T`30!/````9`!E`"T`3`!)````90!N`"T`3@!:```` +M90!S`"T`0P!2````9@!R`"T`3`!5````8@!S`"T`0@!!`"T`3`!A`'0`;@`` +M````````0)E#`-D```!,F4,` +MQ@```!"&0P`C````6)E#`&4```!(AD,`*@```&290P!L````*(9#`"8```!P +MF4,`:````%"%0P`*````?)E#`$P```!HAD,`+@```(B90P!S````6(5#``L` +M``"4F4,`E````*"90P"E````K)E#`*X```"XF4,`30```,290P"V````T)E# +M`+P```#HAD,`/@```-R90P"(````L(9#`#<```#HF4,`?P```&"%0P`,```` +M])E#`$X```!PAD,`+P````":0P!T````P(5#`!@````,FD,`KP```!B:0P!: +M````:(5#``T````DFD,`3P```#B&0P`H````,)I#`&H```#XA4,`'P```#R: +M0P!A````<(5#``X```!(FD,`4````'B%0P`/````5)I#`)4```!@FD,`40`` +M`("%0P`0````;)I#`%(```!@AD,`+0```'B:0P!R````@(9#`#$```"$FD,` +M>````,B&0P`Z````D)I#`((```"(A4,`$0```/"&0P`_````G)I#`(D```"L +MFD,`4P```(B&0P`R````N)I#`'D````@AD,`)0```,2:0P!G````&(9#`"0` +M``#0FD,`9@```-R:0P".````4(9#`"L```#HFD,`;0```/2:0P"#````X(9# +M`#T`````FT,`A@```-"&0P`[````#)M#`(0```!XAD,`,````!B;0P"=```` +M))M#`'<````PFT,`=0```#R;0P!5````D(5#`!(```!(FT,`E@```%2;0P!4 +M````8)M#`)<```"8A4,`$P```&R;0P"-````J(9#`#8```!XFT,`?@```*"% +M0P`4````A)M#`%8```"HA4,`%0```)";0P!7````G)M#`)@```"HFT,`C``` +M`+B;0P"?````R)M#`*@```"PA4,`%@```-B;0P!8````N(5#`!<```#DFT,` +M60```-B&0P`\````\)M#`(4```#\FT,`IP````B<0P!V````%)Q#`)P```#( +MA4,`&0```""<0P!;````"(9#`"(````LG$,`9````#B<0P"^````2)Q#`,,` +M``!8G$,`L````&B<0P"X````>)Q#`,L```"(G$,`QP```-"%0P`:````F)Q# +M`%P```#LCD,`XP```*2<0P#"````O)Q#`+T```#4G$,`I@```.R<0P"9```` +MV(5#`!L````$G4,`F@```!"=0P!=````D(9#`#,````@```/B&0P!` +M````*)U#`(H```"XAD,`.````#B=0P"`````P(9#`#D```!$G4,`@0```."% +M0P`<````4)U#`%X```!````C)U#`&````"8AD,` +M-````)B=0P">````L)U#`'L````PAD,`)P```,B=0P!I````U)U#`&\```#@ +MG4,``P```/"=0P#B`````)Y#`)`````,GD,`H0```!B>0P"R````))Y#`*H` +M```PGD,`1@```#R>0P!P````80!F`"T`>@!A````80!R`"T`80!E````80!R +M`"T`8@!H````80!R`"T`9`!Z````80!R`"T`90!G````80!R`"T`:0!Q```` +M80!R`"T`:@!O````80!R`"T`:P!W````80!R`"T`;`!B````80!R`"T`;`!Y +M````80!R`"T`;0!A````80!R`"T`;P!M````80!R`"T`<0!A````80!R`"T` +M0!E````80!Z +M`"T`80!Z`"T`8P!Y`'(`;```````80!Z`"T`80!Z`"T`;`!A`'0`;@`````` +M8@!E`"T`8@!Y````8@!G`"T`8@!G````8@!N`"T`:0!N````8@!S`"T`8@!A +M`"T`;`!A`'0`;@``````8P!A`"T`90!S````8P!S`"T`8P!Z````8P!Y`"T` +M9P!B````9`!A`"T`9`!K````9`!E`"T`80!T````9`!E`"T`8P!H````9`!E +M`"T`9`!E````9`!E`"T`;`!I````9`!E`"T`;`!U````9`!I`'8`+0!M`'8` +M`````&4`;``M`&<`<@```&4`;@`M`&$`=0```&4`;@`M`&(`>@```&4`;@`M +M`&,`80```&4`;@`M`&,`8@```&4`;@`M`&<`8@```&4`;@`M`&D`90```&4` +M;@`M`&H`;0```&4`;@`M`&X`>@```&4`;@`M`'``:````&4`;@`M`'0`=``` +M`&4`;@`M`'4`````&4`0```&4`0```&4`0`M`&$`;0```&D` +M9``M`&D`9````&D`@```&L`;@`M`&D` +M;@```&L`;P!K`"T`:0!N``````!K`&\`+0!K`'(```!K`'D`+0!K`&<```!L +M`'0`+0!L`'0```!L`'8`+0!L`'8```!M`&D`+0!N`'H```!M`&L`+0!M`&L` +M``!M`&P`+0!I`&X```!M`&X`+0!M`&X```!M`'(`+0!I`&X```!M`',`+0!B +M`&X```!M`',`+0!M`'D```!M`'0`+0!M`'0```!N`&(`+0!N`&\```!N`&P` +M+0!B`&4```!N`&P`+0!N`&P```!N`&X`+0!N`&\```!N`',`+0!Z`&$```!P +M`&$`+0!I`&X```!P`&P`+0!P`&P```!P`'0`+0!B`'(```!P`'0`+0!P`'0` +M``!Q`'4`>@`M`&(`;P``````<0!U`'H`+0!E`&,``````'$`=0!Z`"T`<`!E +M``````!R`&\`+0!R`&\```!R`'4`+0!R`'4```!S`&$`+0!I`&X```!S`&4` +M+0!F`&D```!S`&4`+0!N`&\```!S`&4`+0!S`&4```!S`&L`+0!S`&L```!S +M`&P`+0!S`&D```!S`&T`80`M`&X`;P``````0``````=`!A +M`"T`:0!N````=`!E`"T`:0!N````=`!H`"T`=`!H````=`!N`"T`>@!A```` +M=`!R`"T`=`!R````=`!T`"T`<@!U````=0!K`"T`=0!A````=0!R`"T`<`!K +M````=0!Z`"T`=0!Z`"T`8P!Y`'(`;```````=0!Z`"T`=0!Z`"T`;`!A`'0` +M;@``````=@!I`"T`=@!N````>`!H`"T`>@!A````>@!H`"T`8P!H`',````` +M`'H`:``M`&,`:`!T``````!Z`&@`+0!C`&X```!Z`&@`+0!H`&L```!Z`&@` +M+0!M`&\```!Z`&@`+0!S`&<```!Z`&@`+0!T`'<```!Z`'4`+0!Z`&$````` +M````````@!!$```!````````@``P``!L;V\?/0``````````_____________________P`` +M````````````````\#\```````#P/P`````````````````````````````P +M0P```````#!#````````\/\```````#P?P$``````/!_`0``````\'_YSI?& +M%(DU0#V!*60)DPC`580U:H#))<#2-9;<`FK\/_>9&'Z?JQ9`-;%WW/)Z\K\( +M02Z_;'I:/P```````````````````(#_?P````````"`___YA69QL0U` +M````````__\-0/'`````````````!%`#! +M!4,`R@A#`,\(0P#Q!D,``````````````````,#__S7":"&BV@_)_S\UPF@A +MHMH/R?X_````````\#\````````(0`@$"`@(!`@(``0,"``$#`@````````` +M`/`_?P(UPF@AHMH/R3Y`________[W\````````0`````````)C````````` +MF$````````#P?P``````````;&]G`&QO9S$P````97AP`'!O=P!A+/P4P^_X):S@]`("6WJYPE#\= +MX9$,>/PY/0``/HXNVIH_&G!NGM$;-3T`P%GWV*V@/Z$```E1*AL]``!CQO?Z +MHS\_]8'Q8C8(/0#`[UD>%Z<_VU3//QJ]%CT``,<"D#ZJ/X;3T,A7TB$]`$## +M+3,RK3\?1-GXVWH;/0"@UG`1*+`_=E"O*(OS&ST`8/'L'YRQ/]154QX_X#X] +M`,!E_1L5LS^59XP$@.(W/0!@Q8`GD[0_\Z5BS:S$+ST`@.E>BI8XJ/0`@/,6;;<`_1?KA[HV!,CT``-ZL +M/@W!/Z[P@\M%BAX]`-!T%3^XP3_4_Y/Q&0L!/0#03P7^4<(_P'#_>@(@)#T`P-)''^G)/R`D\FP.,S4]`$`#BZ1NRC]_6RNYK.LS/0#P +M4L6W`,L_"(C_S(]`$`NNN,&S#]\O57-%\ +M(WL@/0!@?E(]%LX_Y),N\FF=,3T`H`+<+)K./X?Q@9#UZR`]`)"4=E@?SS\` +MD!?JZZ\'/0!PVQ^`F<\_:);R]WUS(CT`T`E%6PK0/W\E4R-;:Q\]`.C[-X!( +MT#_&$KFYDVH;/0"H(58QA]`_KO._?=IA,CT`N&H=<<;0/S+!,(U*Z34]`*C2 +MS=G_T#^`G?'V#C46/0!XPKXO0-$_B[HB0B`\,3T`D&D9EWK1/YE<+2%Y\B$] +M`%BL,'JUT3]^A/]B/L\]/0"X.A7;\-$_WPX,(RY8)ST`2$)/#B;2/_D?I"@0 +M?A4]`'@1IF)BTC\2&0PN&K`2/0#80\!QF-(_>3>>K&DY*ST`@`MVP=72/[\( +M#[[>ZCH]`#"[I[,,TS\RV+89F9(X/0!XGU`31-,_6+,2'S'O'ST``````,#; +M/P``````P-L_``````!1VS\``````%';/P````#PZ-H_`````/#HVC\````` +MX(#:/P````#@@-H_`````,`?VC\`````P!_:/P````"@OMD_`````*"^V3\` +M````@%W9/P````"`7=D_`````%`#V3\`````4`/9/P`````@J=@_`````""I +MV#\`````X%78/P````#@5=@_`````"C_US\`````*/_7/P````!@K]<_```` +M`&"OUS\`````F%_7/P````"87]<_`````-`/US\`````T`_7/P````"`P]8_ +M`````(##UC\`````J'K6/P````"H>M8_`````-`QUC\`````T#'6/P````!P +M[-4_`````'#LU3\`````$*?5/P`````0I]4_`````"AEU3\`````*&75/P`` +M``!`(]4_`````$`CU3\`````T.34/P````#0Y-0_`````&"FU#\`````8*;4 +M/P````!H:]0_`````&AKU#\`````^"S4/P````#X+-0_`````'CUTS\````` +M>/73/P````"`NM,_`````("ZTS\``````(/3/P``````@],_`````/A.TS\` +M````^$[3/P````!X%],_`````'@7TS\`````<./2/P````!PX](_`````."R +MTC\`````X++2/P````#8?M(_`````-A^TC\`````2$[2/P````!(3M(_```` +M`+@=TC\`````N!W2/P````"@\-$_`````*#PT3\`````B,/1/P````"(P]$_ +M`````'"6T3\`````<);1/P````!8:=$_`````%AIT3\`````N#_1/P````"X +M/]$_`````*`2T3\`````H!+1/P``````Z=`_``````#IT#\`````V,+0/P`` +M``#8PM`_`````#B9T#\`````.)G0/P`````0<]`_`````!!ST#\`````<$G0 +M/P````!P2=`_`````,`FT#\`````P";0/P````"8`-`_`````)@`T#\````` +MX+3//P````#@M,\_`````(!OSS\`````@&_//P`````@*L\_`````"`JSS\` +M````P.3./P````#`Y,X_`````&"?SC\`````8)_./P``````6LX_``````!: +MSC\`````D!O./P````"0&\X_`````##6S3\`````,-;-/P````#`E\T_```` +M`,"7S3\`````4%G-/P````!066X`7VQO9V(```!? +M;F5X=&%F=&5R````````%````+"@0P`=````M*!#`!H```"DH$,`&P```*B@ +M0P`?````@*I#`!,```"(JD,`(0````BI0P`.````N*!#``T```#`H$,`#P`` +M`!"I0P`0````&*E#``4```#(H$,`'@```""I0P`2````)*E#`"`````HJ4,` +M#````"RI0P`+````-*E#`!4````\J4,`'````$2I0P`9````3*E#`!$```!4 +MJ4,`&````%RI0P`6````9*E#`!<```!LJ4,`(@```'2I0P`C````>*E#`"0` +M``!\J4,`)0```("I0P`F````B*E#`'-I;F@`````8V]S:`````````````#P +M?________^]_`````````(!#`$\`3@!/`%4`5``D```````````````````` +M_RG#8``````"````40```"2M`P`DE0,``````/\IPV``````#````!0```!X +MK0,`>)4#``````#_*<-@``````T```"<`P``C*T#`(R5`P`````````````` +M```@[D,`**M#`````````````0```#BK0P!`JT,``````"#N0P`````````` +M`/____\`````0````"BK0P````````````````#H[4,`<*M#```````````` +M`0```("K0P"(JT,``````.CM0P```````````/____\`````0````'"K0P`` +M```````````````$[D,`N*M#`````````````@```,BK0P#4JT,`B*M#```` +M```$[D,``0````````#_____`````$````"XJT,`````````````````..Y# +M``2L0P````````````,````4K$,`)*Q#`-2K0P"(JT,``````#CN0P`"```` +M`````/____\`````0`````2L0P````````````````!@[D,`5*Q#```````` +M`````@```&2L0P!PK$,`B*M#``````!@[D,``0````````#_____`````$`` +M``!4K$,```````#_`0#%_P$`4"$"`/`R`@!0-P(`=Q\#`($?`P"3'P,`I1\# +M`+(@,`L"(#`,(B`P#< +M(@,`^2(#``XC`P`C(P,`.",#`$(C`P!24T135G1."$!&@$&S-:[+8A2E&@$` +M``!$.EQ0')A'0D;6X`````)Q\#`#8$```N +M=&5X="1X`%TC`P!=````+G1E>'0D>60``````#`#`&`"```N:61A=&$D-0`` +M``!@,@,`!````"XP,&-F9P``9#(#``0````N0U)4)%A#00````!H,@,`!``` +M`"Y#4E0D6$-!00```&PR`P`H````+D-25"180U4`````E#(#``0````N0U)4 +M)%A#6@````"8,@,`!````"Y#4E0D6$E!`````)PR`P`$````+D-25"1824%! +M````H#(#``0````N0U)4)%A)04,```"D,@,`$````"Y#4E0D6$E#`````+0R +M`P`$````+D-25"1825H`````N#(#``0````N0U)4)%A000````"\,@,`"``` +M`"Y#4E0D6%!8`````,0R`P`$````+D-25"184%A!````R#(#``0````N0U)4 +M)%A06@````#,,@,`!````"Y#4E0D6%1!`````-`R`P`$````+D-25"185%H` +M````U#(#`-P"```N8V9G=6%R9`````"P-0,`9'4``"YR9&%T80``%*L#`'P! +M```N&1A=&$````DK0,`!`0` +M`"YR9&%T821Z>GID8F<````HL0,`!````"YR=&,D24%!`````"RQ`P`$```` +M+G)T8R1)6EH`````,+$#``0````N+1#```````````` +M`````````````````0```/____]+(4,`(@63&0$```"LM$,````````````` +M```````````````!````_____UTA0P`B!9,9`0```-BT0P`````````````` +M``````````````$```#_____X]"``````#^____ +M`````-C___\`````_O___P````#00@``````_O___P````#4____`````/[___\`````NJ%"```` +M``#^____`````-3___\`````_O___P````!,MD(``````/[___\`````V/__ +M_P````#^____`````/6P0@``````Y/___P````"T____`````/[___\````` +MDKY"``````#^____`````-3___\`````_O___P````#ENT(``````/[___\` +M````S/___P````#^____`````"3`0@``````_O___P````#4____`````/[_ +M__\`````0LA"``````#^____`````-#___\`````_O___P````"1YT(````` +M`/[___\`````Q/___P````#^____`````!SI0@```````````._H0@#^____ +M`````-C___\`````_O___^'L0@#][$(``````/[___\`````S/___P````#^ +M____`````$GW0@``````_O___P````#0____`````/[___\`````!OM"```` +M``#^____`````-3___\`````_O___P````"<^T(``````/[___\`````U/__ +M_P````#^____`````"3]0@``````_O___P````#8____`````/[___]9&T,` +M;!M#``$````@4P,`N`P&`*`@!@"$OP,`H,8#`````````````0```#!3`P"\ +M#`8`3"`&`#"_`P!TQP,````````````!````0%,#`,`,!@`\(`8`(+\#`)S' +M`P````````````$```!04P,`Q`P&```@!@#DO@,`K,<#`````````````0`` +M`&!3`P#(#`8`="`&`%B_`P#@QP,````````````!````@%,#`,P,!@!T(08` +M6,`#``3(`P````````````$```#@5`,`[`P&`)@@!@!\OP,`',@#```````` +M`````0```/!4`P#P#`8`-"`&`!B_`P`DR`,````````````````````````` +M`````````````````````````````+K$`P`DQ0,`CL0#`*+$`P`RQ0,`SL0# +M`.;$`P`"Q0,`:,4#`%3%`P!$Q0,`#,4#``````"(Q@,``````&+$`P!VQ`,` +M3L0#``````#NPP,`_L,#``[$`P#BPP,`+,0#`$#$`P#,PP,`LL,#`![$`P`` +M````ML4#``3&`P#NQ0,`W,4#`,K%`P!ZQ0,`H,4#`(C%`P``````=L8#```` +M``"FP@,`NL(#`,K"`P#:P@,`[L(#``##`P`2PP,`DL(#`###`P!&PP,`4L,# +M`&C#`P!VPP,`A,,#`)##`P">PP,`A,(#`';"`P!JP@,`6L(#`$K"`P`\P@,` +M,,(#`"C"`P`8P@,`"L(#`/[!`P#LP0,`W,$#`,S!`P#`P0,`KL$#`)K!`P"( +MP0,`>L$#`&C!`P!:P0,`3L$#`#3!`P`BP0,`$,$#``#!`P#PP`,`W,`#`,K` +M`P"ZP`,`KL`#`)S``P",P`,`?L`#`![#`P!PP`,``````&3&`P`NQ@,`%L8# +M`%3&`P!"Q@,`````````4VAO=U=I;F1O=P````!'971$;&=)=&5M`````$5N +M86)L95=I;F1O=P````!39717:6YD;W=497AT5P````!'971087)E;G0```!3 +M9717:6YD;W=0;W,`````4V5T1&QG271E;51E>'17````1V5T4WES=&5M365T +M%<`````0W)E871E5VEN9&]W17A7````27-7:6YD;W<` +M````1&5S=')O>5=I;F1O=P```%5P9&%T95=I;F1O=P````!-87!7:6YD;W=0 +M;VEN=',```!#;W!Y4F5C=`````!,;V%D0W5RM0#`(S4`P"H +MU`,`OM0#`-34`P#>U`,`ZM0#`/;4`P`$U0,`%M4#`";5`P`ZU0,`2M4#`%S5 +M`P!HU0,`>M4#`)35`P`2U@,``````*#2`P".T@,`<-(#`%#2`P`RT@,`'M(# +M``S2`P``T@,`]-$#```````"`D=E=$QA&5C=71I;VY3=&%T90"R!%-L965P`#\#3&]A9$QI8G)A5<`9`!#;VUP87)E4W1R:6YG5P``$`!!;&QO +M8T-O;G-O;&4``%\!1G)E94-O;G-O;&4`%P!!='1A8VA#;VYS;VQE`"0%5W)I +M=&5#;VYS;VQE5P!&`D=E=%!R;V-E4UAE-P96-I9FEC3&]C86Q4:6UE5&]3>7-T96U4:6UE +M`+T$4WES=&5M5&EM951O1FEL951I;64``"0!1FEL951I;654;TQO8V%L1FEL +M951I;64`1@-,;V-A;$9I;&54:6UE5&]&:6QE5&EM90`E`49I;&54:6UE5&]3 +M>7-T96U4:6UE``!R`4=E=$-026YF;P#^`DES1$)#4TQE861">71E``!G`TUU +M;'1I0GET951O5VED94-H87(`$057:61E0VAA71E`+,"1VQO +M8F%L06QL;V,`5`-,;V-K4F5S;W5R8V4``+X"1VQO8F%L3&]C:P``Q0)';&]B +M86Q5;FQO8VL``+H"1VQO8F%L1G)E90``00-,;V%D4F5S;W5R8V4``+$$4VEZ +M96]F4F5S;W5R8V4``$T$4V5T0W5R5<``-\!1V5T17AI +M=$-O9&500-/<&5N1FEL94UA<'!I;F=7``"'`4=E=$-O;6UA;F1, +M:6YE5P!7!%-E=$5N=FER;VYM96YT5F%R:6%B;&57`!T!17AP86YD16YV:7)O +M;FUE;G13=')I;F=S5P"%`D=E=%1E;7!0871H5P``8`--;W9E1FEL945X5P`& +M`D=E=$QO8V%L94EN9F]7``"7`D=E=%1I;65&;W)M8717``#(`4=E=$1A=&5& +M;W)M8717```S`D=E=$YU;6)E&-E<'1I;VX``',"1V5T4WES +M=&5M26YF;P#O!%9I0``/0-, +M;V%D3&EB45X00``!`-)&-E<'1I;VY&:6QT97(` +M`*4$4V5T56YH86YD;&5D17AC97!T:6]N1FEL=&5R`&,"1V5T4W1A%<``*@#475E0`7`D=E=$UO9'5L94AA;F1L945X5P``$P)'971-;V1U +M;&5&:6QE3F%M94$``&@!1V5T04-0``#/`DAE87!&F4``)H!1V5T0V]NM`0```#D```!^Y=<\`@```'@````_B6DW`P`` +M`!T```!]!P8.!@```)4```#(72P````'P```!\````> +M````'P```!X````?``````$"`P0%!@<("@P.$!08'"`H,#A`4&!P@*#`X``` +M`````````0$!`0("`@(#`P,#!`0$!`4%!04`````!`````(````"`````@`` +M``(````"`````@````(````"`````@````(````"`````@````(````"```` +M`@````X`````````#``````$"!`@0(#``@(#!`4&!@8`````X$ZV*&0```"X +M1D,`/6;WPF4```#,1D,`"$D8YF8```#@1D,`I+G"7F<```#P1D,`D@:5CF@` +M````1T,`,61B6&D````81T,`,7X*&6H````L1T,`"98Z?FX```!$1T,`6,VT +M3F\```!<1T,`OS>5`'````!L1T,`0GT137$```"$1T,`V#`>?'(```"81T,` +M6`8D8G@```"L1T,`+WM/9'D```#`1T,`Z2]#97H```#41T,`R(GOK'L```#H +M1T,`C*;B7'P```#\1T,`>["%#8,````82$,`2D2H:(0````L2$,`L.22_(4` +M```\2$,`@ZZ"PH8```!02$,`@JSNC8P```!D2$,`[C:ZO8T```!X2$,`\,-U +M/XX```",2$,`+$`GL8\```"D2$,`$8>6*)````"\2$,`I+I*9I8```#(2$,` +M2[@9^)<```#42$,`'VK/2Y@```#D2$,`8KBO#YD```#P2$,`C6I:H)H````$ +M24,`DHDBRJ`````424,`#39P>Z$````H24,`OF#T.Z(````X24,`@&J\3JH` +M``!(24,`#NP:4*L```!824,`X+E!OZP```!H24,`IJ?26:T```!X24,`(:)! +MY:X```"(24,`[LV#$*\```"824,`_KG@M;````"H24,`8G`61+0```"X24,` +MS*+":;D```#(24,`)O-)Z+H```#<24,`)IYV*[X```#T24,`K"1@@+\````( +M2D,`ZS6Q[,,````@2D,`>IU=O<@````T2D,`7:^1R\D```!(2D,`&B^NILH` +M``!<2D,`2)#K5](```!T2D,`F8#4WMP```"$2D,`P[TON=T```"<2D,`0'CZ +MN-X```"T2D,`AXS7&N$```#(2D,`.)0-[.8```#82D,`7GR0H.<```#D2D,` +MA4"07?````#T2D,``S&LEO$````(2T,`,=)X-``````82T,`!"[:CP`````H +M2T,`.!&.A64````\2T,`BJ[`W6<```!82T,`_2+C9&L```!P2T,`WU-^!P$` +M``"02T,`2OU`X`(```"@2T,`Y'*V0(````T34,`#6\H=64```!(34,`&UFW+F<```!D34,`(HM= +MPP````!\34,`K,_@-P````"034,`]02GQ&4```"H34,`^`;N"@$```#(34,` +MG!IF=P(```#<34,`-0>8/P````#T34,`[O.U-@`````(3D,`ZLG8!0$````< +M3D,`X4BS]0(````P3D,`6`>%=`````!(3D,`B^(%%#`(110P"844,`J%%#`+Q10P#0 +M44,`Y%%#`/110P#_____````````````````=9@``+$9OT1.YD"[``````$` +M```!``````````````#_____````````````````(`63&0`````````````` +M``(````,````"````/____\````````````````!(``````````````````` +M``````````````````````````````````````````````````````(@```! +M```````````````````````````````````````````````````````````` +M`````````B````(````````````````````````````````````````````` +M``````"0:4,``0`````````!```````````````!```````````````````` +M```````````8Z$,`````````````````&.A#`````````````````!CH0P`` +M```````````````8Z$,`````````````````&.A#```````````````````` +M````````4.U#````````````$&Q#`)!M0P`@94,````````````````````` +M````````````6.=#`"#K0P!#````BF9#``$"!`@`````I`,``&"">8(A```` +M`````*;?````````H:4```````"!G^#\`````$!^@/P`````J`,``,&CVJ,@ +M``````````````````````````````"!_@```````$#^````````M0,``,&C +MVJ,@``````````````````````````````"!_@```````$'^````````M@,` +M`,^BY*(:`.6BZ*);``````````````````````"!_@```````$!^H?X````` +M404``%':7MH@`%_::MHR``````````````````````"!T]C>X/D``#%^@?X` +M```````````````````````````````````````````````````````````` +M````````````````````````````````$!`0$!`0$!`0$!`0$!`0$!`0$!`0 +M$!`0$!`````````@("`@("`@("`@("`@("`@("`@("`@("`@(``````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````!A8F-D969G:&EJ:VQM;F]P<7)S='5V=WAY>@`` +M`````$%"0T1%1D=(24I+3$U.3U!14E-455976%E:```````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````````!`0$!`0$!`0$!`0$!`0$!`0 +M$!`0$!`0$!`0````````("`@("`@("`@("`@("`@("`@("`@("`@("`````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````!A8F-D969G:&EJ:VQM;F]P<7)S='5V=WAY>@`````` +M`$%"0T1%1D=(24I+3$U.3U!14E-455976%E:```````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````@ZT,`+@```"X````` +M````1.U#``071@`$%T8`!!=&``071@`$%T8`!!=&``071@`$%T8`!!=&`']_ +M?W]_?W]_2.U#``@71@`(%T8`"!=&``@71@`(%T8`"!=&``@71@#^____```` +M`````````````0```````````````````/[___\````````````````$54,` +M`````"X_05&-E<'1I;VY`5]N97=?;&5N9W1H0'-T +M9$!````$54,``````"X_059B861?97AC97!T:6]N0'-T9$!````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````";>00!8WD$`$MY!`!S>00!BWD$`,-Y!`#K>00!$ +MWD$`@-Y!`';>00!LWD$`3MY!``````#!Y$$``````.W=00#WW4$`TMU!```` +M``"6W4$`H-U!`*K=00",W4$`OMU!`,C=00""W4$`9]U!`+3=00``````N=Y! +M`.'>00#7WD$`S=Y!`,/>00"*WD$`K]Y!`*7>00``````IN1!``````#'W$$` +MT=Q!`-O<00#EW$$`[]Q!`/G<00`#W4$`O=Q!`!?=00`AW4$`*]U!`#7=00`_ +MW4$`2=U!`%/=00!=W4$`L]Q!`*G<00"?W$$`E=Q!`(O<00"!W$$`=]Q!`&W< +M00!CW$$`6=Q!`$_<00!%W$$`.]Q!`#'<00`GW$$`'=Q!`!/<00`)W$$`_]M! +M`/7;00#KVT$`X=M!`-?;00#-VT$`P]M!`+G;00"OVT$`I=M!`)O;00"1VT$` +MA]M!`'W;00!SVT$`:=M!``W=00!.VT$``````"3?00`&WT$`Z]Y!`!K?00`0 +MWT$````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`0`%`+`%`(!```"``P```&```(`%````J```@`8```#H``"`#@```$@!`(`8 +M````8`$`@````````````````````@!E````>`$`@&8```"0`0"````````` +M```````````'``$```"H`0"``@```,`!`(`#````V`$`@`0```#P`0"`!0`` +M``@"`(`&````(`(`@`<````X`@"`````````````````!@```"P&`(!0`@"` +M_`4`@&@"`(`6!@"`@`(`@.@%`("8`@"`R@4`@+`"`("X!0"`R`(`@``````` +M````````````"@`'````X`(`@`@```#X`@"`"0```!`#`(`*````*`,`@`L` +M``!``P"`#````%@#`(`-````<`,`@`X```"(`P"`#P```*`#`(`0````N`,` +M@````````````````````0!D````T`,`@````````````````````0`!```` +MZ`,`@````````````````````0`)!`````0``````````````````````0`) +M!```$`0``````````````````````0`)!```(`0````````````````````` +M`0`)!```,`0``````````````````````0`)!```0`0````````````````` +M`````0`)!```4`0``````````````````````0`)!```8`0````````````` +M`````````0`)!```<`0``````````````````````0`)!```@`0````````` +M`````````````0`)!```D`0``````````````````````0`)!```H`0````` +M`````````````````0`)!```L`0``````````````````````0`)!```P`0` +M`````````````````````0`)!```T`0``````````````````````0`)!``` +MX`0``````````````````````0`)!```\`0``````````````````````0`) +M!`````4``````````````````````0`)!```$`4````````````````````` +M`0`)!```(`4``````````````````````0`)!```,`4````````````````` +M`````0`)!```0`4``````````````````````0`)!```4`4````````````` +M`````````0`)!```8`4``````````````````````0`)!```<`4````````` +M`````````````0`)!```@`4``````````````````````0`)!```D`4````` +M`````````````````0`)!```H`4``%`V!@!%"P````````````"8008`J14` +M````````````2%<&`&@%`````````````+!.4BZ&.MA#/(B+",,!J&3 +M#KH8?+(Q_E\Z[$D@^Z2#O+"+,/@A6SX(9`M=).R#O7A&LZN97>]T^]"[P\QV +M=4]U969W958D>1OHJ?HJXLN(+R(S"6X=\9R>!#RJ!N/"N#`NC`OCPK@P+HP+ +MX\*X!([+F.?T9'MA/V)<;.#"9%(UV5[8CQ@7QL4'7,3QB?[L\^233Y<_]6>? +MB^.3UJU'>/JP^/"CM?=NY;?OI+__P_)G?OO.VGNWB@\_HM.SMJQ'='I6OO^! +M^N++E1N_^N++WON_H=.S5OA1=O=C<73<$EX01\?9W8]7CXLX.FZ#I3QC->;? +MR107^<]_M7`U,7\J4]ZEL[,6XB+N/^`\H&J,1AS758WQ>-6XC,,$UJV]_&_0 +M_^_/?W;OU[^T/'_UBY.?_F0L98OUE[GC_H]_-$I3^_H(XJ/#PX6 +M=T=IZO#'BYSS:=89&)=VX^*2=]VJTR[_-=M+>''=V.%3$;`C5=>G&1;F%UZG +M&1>.7YA?.'YIZ[\.5<=D7)AWF7.7EOG1>.3N +MM_'Q8U]Q45]]Y>JG1Z/HZZ\=XS(>-Y]S1W[[=_G=.\G?/K4[TT_^7/[V`_F? +M?\\UU;'))(C0'?/C^;G^Q]_3/_W1[DS^^A=Y[YYC?E%,O=6XB!!?BXQQ$0"B +M>10SBG4+83G/,N/X90R@FZ/[>'NGA;B8/Q4!@`G%G/?*1S<.6P7*HQN'Y[W2 +M!BX2@;"QR3UX[:;YZ1C +M>[J4V6H]TO')&V\>O?/N_9NOG[[TRNEWO[?4^=(K#W[X^M$[[YZ\\:854"[E +M`8H`C6VX*!X^_^*W+[_Z[?=_L-3Y\JMG+[QX7A1N\B/%>\PK=08.?*MUJ2`# +M7PM^A``1FTRE_L(44ZUC:K:72GL1"!(9%*BH!VAVIHSI60[65Z8$?K)S7>.1:&O6H^ +MSAJX*`+$[ME+G;;JF-B/.%>JCTM$)HU#09\'WS&3J1VV=0Z7FD,@1,1^U'57 +M6@073=W)"1;!A;`[O4,+4D8BF%]FY`0"V8^ZR[Y-<>FZ+E51L+JAO((-O+M+B)$`OFEQF!#-M+Q9`4=AN>P;L%;3(&N`0=R%#S8@*&'/N: +M<40B&9=*/3S8'AGC-250DS&6;.,P"_O&]A(H^]J(S5+)_%(9^P:H/%AZGU0$ +MAXL5PWO25M5Q_:62?<,J%=CCA50ROU0-@2'U^UHMQ0>T8%M=7Q4%L]'-=MP1 +M"LO8QB64=,EVJP\B))+Y)5A7X>+K_:$^AJU]'CVO8M*-1N&OR\=:52"+N*V>X2%]; +MH0D`MC4Z?/9,>IH?C27"@;L#7Y27'40TH<@MA1*\LMDEA'V'&U*D^A+FU"-<F-6A+N.:":/ +MO.27B[$=NR'@1+3V5&BJ"9X3`@9L[<)4ESK*"-S(-X"PDB;:/$N1AK;&FRKUIA&U5Q6O05AA-@K#<1D;?\\O1@!MRQ +M?B(OMBYC:O*&VS'%UKTIDZW:P=0$%T(8I`Y,)H^\[VO.)6XJ"GAA:A[%[L6H +M$"W7WEJ3,5'CMR#$01*LR1B]6!'A?K#DG`1 +MMB*:;$GZP_*RCT3@?F+C^-:EK-FTS"AR7=.Z^25MB01)7N8!\U*GE&)S1^A% +MX?C1$S]`&&9DBHP6KH]J6D&JJ@C[YN?2.C:9U:@^180[AF*PX\Q@96U*FS&M +M&09[$Y,)@W>O["/%IA%1@1!CE)D^0ICT"$Y4=/60+[)@4Y!"B4 +M3WK=`I%]A+LF<7#JI&;0BO;0C9@V3"K_/15"_%(Y=U.1-Q8]M8!8AK,>/4,4 +M_WGBG`P*?TW$X#MJ7FMV\><2=Q/ +MF]XJ:4^:H9;MXX`Q0*EHLUGVE$6VSCYKZ;[WK:2I5%XJ6[BT=&OW049I@Y5; +M"RMWM+9WTSL"#+)&S<$]!1BH'UTDS,-<+&PTDLSS[+:?JZ$(!KE8^"GSR+"< +MXL')E8F`@VS!S8.(A@3LQXF>18.<.Y9@L'/!FY-.US5N+KI+>4T'%=?-FIL) +M;2QT3H2DQCN0/3L9=R>A'ZU +M`1_6TH!#NW^]U+A[;9-:+*[MM2((R6#&`&,H%>ZFUYTH5RJ8N[J'9B]/XW[: +MF:]C$4*I0HY?9NM8M#._;IG.$_2"Q64"S?9\:&:',R'C`@`;FK;G.%0TLZ(2 +M."X`L!'/M9I"59YV$#XN$ZN9R358+8]W`I=K:%B+Z?L4NX++!)K=6="4SZHS +M'<(%`-8T[54>"$O/UB>[A0L`E)KV*G<4IA)B<>E^DNZ-GJ+]RBZ^4E]X4X#Y +M4:UR6U0E90F\:)'NHKU<2%D5T&311.OL+BX`D$H<%%,=P^L:$#N-"P`D`H>% +MN"+@"8)242?IY%N)):9U'7[>5I_HC#0EPNHC`N%]Z#PT(D$AF7Z:`7 +M!SGE$3(N4]DUXD$N2H6,2\78S03C,L.G&`+&A7&Q@`L'O#/J:@Q#*_?;,[\P +M+HP+X\*X\&!<&!?&A7%A7!@7QH5Q85P8%\:EF[BP.->I_0'L1XP+X\*X,"Z, +M"^/"N#`N/!@7QF7!\7_UL1ZD2@_N/P````!)14Y$KD)@@@```(E03D<-"AH* +M````#4E(1%(```"Z```"7`@"````P>XI$`````1G04U!``"QCPO\804````@ +M8TA230``>B8``("$``#Z````@.@``'4P``#J8```.I@``!=PG+I1/`````EP +M2%ES```+$@``"Q(!TMU^_`````9B2T=$````````^4.[?P``%0U)1$%4>-KM +MW=ES',=]P/%=$,3!2Q`@D9(HBA1O4A2MPTZ8V;SG-[..+H-`SV)G +MNGOF6_5]U,.B^Z.>GNG992JU6"12C2$@N!!<""X$%X(+$4-`<"&X$%P(+@07 +M(H:`X$)P(;@07`@N1`P!P87@0@9P*1"IQA`07`@N!!>""\&%B"$@N%!(7!8* +M1*HQ!`07@@O!A>!"<"%B"`@N!!>""UG%9;Y`I!I#0'`AN!!<""X$%R*&@.!" +M<"&XD%5""\&%X$)P(6((""X$%]+/9;9@8'4CGS:__HL#?SO_ +M^%\.MGZGL^W/;\6^UN]VM_Q@5/YD^^0U<-J_IC?](^J*R64T_^158\"'V_?V'F-@ZV?G"Q5]:AC]ARZ)RKV3$W;7V +M3]#\^B_1H)(,E`%<9@IZDP=34%!)!DK[9.GG(L]MH:"2#!1<"@EYQE^#7NN` +M2P$'ZL$%+G"!"US@`A?ADM<;"()PT3Q9<(%+("[3>;V!(``7W9-E-Y>6[V<: +MKOXVG5O1/XX*R>>43RN?&2X:N+3\()/.+EL!Y2MHLLORR>$2-1?Y/]4Z*Y7D +MD\,E:B[I[(JE7-*Y5;A$S<52*SOYJ^$"%[C`!2YP@4LJ-9776_5<='_RZ/]J +M_9\<+G"!"US@`A>XP`4N<($+7.`"%[@$X3*9UUOU7'1_\NC_:OV?'"YP@0M< +MX`(7N,`%+G"!"US@`A>X!.$RD==;]5QT?_+H_VK]GQPN<($+7.`"%[C`!2YP +M@0MXP`4N<($+7.`"%[@$ +MX9+;T%OU7'1_\NC_:OV?'"YP@0M<0N(B!P%P@8LJE[DB7."BS.6N`Q>X*'/Y +MUS)D"7."BS&6QE,INZ*IZ+OH^LZZ_6O\G][A\Y,(%+FI<9.\B +MR?<9X0(752[S1;C`19G+/1_B]+N<@GCPL7>5O*$BXMWQ]-#R[9M[0,+LDGCPN7 +M>ZXM7#PQ?Y61_U-MN2K)YY1/*Y_9XNW:U[E\[#_>'=V(K)UP25I1SLOF;<)% +M'N_"!2ZJ7.3Q+ES@HLKEH[)WE8(+7)2X?.P_WH4+7#;A\E%YDQ8=N,!%FMW.G&@U&L=IG*1)@NIS$8$/?Z]`2BH)`,5S8QLU2.YR'%C))_@P-_, +M04$E&2B#NM?]&-B42U37(ZGIGW[%)F:3'>X__M(4*]MSN>NF1M8CJ^'M +MW[9^EZO2%]>@QC=_'>7X;]\V7"K7HP@_4%WG[[V=;\*7F4OM,@@R%&994>(R +M6XS^8\E(-?_#OQ_XZSGOF>]K'0EYQB]_K/S)\H?OZOAOXZ"HD1&MST7 +M*9MGI$B9RTR1D2)E+G>X'E&%R_VR4F/YU/`Z)3U5+M-%!HN4N=QV&"Q2YG+? +M_WH`XP47KD<4`A>N1Q2`RWW_ZP$,&5P"7(^&UBFYI>Z5`W3;9='#!Q,(%R" +M78\81+BHEBLPB$GB7*E)DUR/X*+>HLMHPB5(HWD& +M%"[*39=2?6L4YVK)1:Y'\N"/,86+:O*#S8PI7%2;Y7H$ET`--8E@H7.1`@)&%BVH+KK=P,;AP44T.!!A;RYP;7?(`1G;7##I<5!O.,^AP46ZRQ*##)4A];'CAHMX8&UZX +MJ#?CI+K8\,)%/3EQ[%PE^]+#9:+$T-O)19Z%:*EWG=&'BW*C!48?+LIY&UXF +M`"[J#;+AA8MZ\AU')@`N`9)7OCM6R9HT<\D4F`.X*#?M>$LIL$: +M+C..YF3#RS3`)4!L>.$2H%$VO'!1K[+A;2?C,X++C+_A93+@HIJ\TL!DP"5` +M\DH#\P&7`!M>YL-T+M..0;'AA4N`AO),"5R4JVQX;ZV0H9G%9=K?\#(K<%%M +MK,BLP"5(\J4U)@8NJLFO-#`Q<%%MD@TO7`+5O\'<&,EERC&Q'!M>N`1*?I;L +MY@J9E;EF!O+,&5R4 +MDSOJ&TP;7-23.VJF#2ZJR1TUTP:7`,G7')DYN*C&'35<@E3R[JBOKU#4>4-O +M8_+6]_5EBKKF2<=*+I4S:N8OXDXONM[0VYA\CYKYB[@_N_^_S9472JPK6_(V +M7TQAQ%Q.+UB[P/2L,X51<_GV_;*M"\QHD2F,FHMTRMX%1EZ"818CYB(+3).E +M"XP\LGM_F2*JPL7N!48>V3&1$7/Y]KURTX2="XP\LF,BH^)2_KQ3\W8N,#G_ +MCIJYC)C+G]XK-\L"DRO95]\&BYG+5U@Y)$=TQD]%VG_I)T+C+QE]]XRA=BF7,XOVKG`C!2940U=;RJ%JG[%Q@;JXRKQJXO%A98+*V)5^,95ZC +MYR(=E`4F:Z$8.1-@:J/G\O+M?5.N=[&!4;.!)C=Z+E(QV9=^[B,^H_LF.#HN7SK;KG1Q@6FBP6FUOW) +MW;)*)^]Z.->98#Y=S\Q8N,,,%YE@/%^EQ[^>02Y8E +MWQ-@FK5PN;A83EO'10X=KRU3;0K$17IZRL(%1@X=KRU1#0K*Y97;Y?JL;5SD +MT)&9K@V7.^6@'9MQ[5M@Y-"1R=YYW[I3#MHW[Y2;<[9QZ6.!T<1%.C-GVP(S +M*H>.+#":N$@M$[;M>7LWF&]M7%Y<<-/6+3!RZ,B4:^$B>3?5HR6;ZF&!T<=% +M;JIW9ZWB4CETO+I$5;83+M)QN:FV:X'I7F?6M7&1F^I].188N"CWPKQM"TPG +M"TRU?=-?(7;8P4FK]KSR5>IK+##5<;E=WGDO+9;KQZQ:8.2U*>9>%Q?IV+15 +M"\QPD;G7R>75V^6]=MU4M[/`Z.,BG9NS:L\KKTW)WW^%@E1#+M)!.4C*E*SI +MUAH"='+YPY[7%BXL,'JY2,_+2R6`ZOUG%[%I@/5E.7EVB;0N5R<<'=95[ZZA@:]7"3OZ-&:!68% +M$)JYO+)8WI_U7S$QOWX6&-U<)/\Q3-$.,==98+;L%7\!"+O#\AB&!08NBLEC +MF.:Q$@L,7%0[*[^V:LT"\Y`V+S(NTJ$)QYX%!ARZN;RT4&X<+5FSP+Q#?U24 +M7*33,ZXU"PPXM'.1GAQW[%A@P+$)EX5RQ'UCWFW(V'!)NKZ*#_U"XPA7*0G,&2PF(0O,*9QD4O27N^'XUA@X*+6^5FW;MCL!>;MAPG- +M0"[2B$D9N8=U?@8FAM8^9M8GKS_@4>+N;UXJS;9.!]]?LK<#&T,]-NG6E<^O+> +MLRRXF-D1`P\'Y.NQ,>9RT;\[M;=6.1P8*!J4_,!'C!<8V[E.1OXDQ2_%!K@8WE-98S8Q"&#D6L)O+C)N$+LSXS^ZTMG4OE6``N5G0X9\`FYOU5N%A36T:W&.]8`"[V;'OW#NG> +MQ'RPEGKS@7TED(MT=LK9K??979]_+``7:[:]$[JWO;?6X6)3S\J1=5]!9W(L +M`!>+>B*C54SGAF5<+OA;OR2W3Y[V:A0C+_.^^9DUP>7N-C54V/ZMKWR&Q]PL:QIMV5$WR;F +MYTLV<)EVZ?/.3[M[AC2)Z=B`BWV=JYP/:!%S91DN]G5J0M.-4E?>>Q3VQF?F +M!HY-.Y9STEH6F/=6X&)ESVBY4:J\:P<7&VO3F';W1W^CU.N_ +M"@,72V^4FN3[`[V%2)-_HZ&N6MM9Q4P\7VGHKLUKIR4PT7VVL=B>I&25[_AHOMR:WU@:&H +MQ,CKWW"Q/3FUWC,0"1=Y_1LN,4A.K1N\WYT+OZO+<(E#?W@8$S:7;O_U;[C$ +MH)/CSJ[>\,7(01)3,F5"[RE4;R$EQBU>D)IZ$O-#&=_LM3/_XT +MBIC+:#HU[M3WAB;FO56XQ*WCNRI71/(;0]+UQB +MUW-C(B:D/>\R7&+8,_*&KZ5[7B9/2X?D#=_N?.T+>\_+S.GJB>%PQ+SU$"[Q +M[/&A$,3<6H=+/),C@L<&0Q!S91DNL16S?Z!08RZ=_KL-__)I[6/"3!"SM^9B +MY-T&N,2ULQ/.GOY:BY'W>>$2U\Y,.$U]A=KO>>$2U^3@NK&V8F3/"Y<8)P?7 +M#;T%<_>\S)!IR7?;=M=0S/55N,1=3,ZI[RF8N.=E;LSL>*ZTJZ=&7-HW:K;G +M96*,[?ELJ:Y68JZMP"7^'1TKU=6$2^6?[=LYEW/^4T4R-A&3KHD8^:TRN"2A +MYVHEYIVE'7.9<,C\CHS60DRG_UME<$E"SU;$=.VL'1X],@V)$_/60[@DI60SS`"[)V_E6+2;08Q@&.D[W2NDJ'\.L +MP`4QRG4J/X9AB&/683DEJ$+,C76X)/4DLCHQEY?A@ACU2Y+_-@Q<$*/:]36X +M)/L=O-J>##"FB/FCDP&X)+CG1DMU@4\&/MD\1C,)>=]7"OJ")ER2W+&QTJ[* +M;S*H5#D9^.=/OA[CF)R>'RO5JXN1[\ENPF71T/!M$C)P,P"7AGH +M<;GIGPS`)>&=S)8:%,7(SY7!A4[E2HV*8MYX`!=R3N=*3?*K9MMRN?&E2Q*C +MEG`Q>U3$7%Z&"WF=&7?V]6TGIL/_EY+@0M+9<>=`_W9BY&ML<*'/Q;0,;"=& +M?DWHK/^?$DEM\J_E;'U)8HSHRQT" +M"Q%<""X$%X(+P87@0@07@@O!A>!"<"&X$,&%X$)P(;@07`@N1'`AN!!<""X$ +M%X(+$5P(+@07@@O!A6++)5LB4@PN!!>""\&%X$)P(8(+P87@0G`AN!!""\&%""X4H/\#9IGG&MFY;-<`````245.1*Y" +M8((`````````*````!`````@`````0`(`````````0``$@L``!(+`````0`` +M``$````````D-)L`)S6:`"DZF@`W)\H`.BG2`#LIU@`\*MH`/BO>`"U!FP`S +M2K<`,TNX`#)-N@`S3KL`,U&_`#-3OP`Z5;D`,UC%`#9ESP`\;LT`-F;0`#9F +MT0`U:M0`-FO4`#5OV``U;]H`,W3>`#1RW``T=]\`-7C?`#]UV0`S=^$`,WCA +M`#=XX``W>N``-WSD`#E^Y0!)-;H`5#S@`%8]Y0!90.L`0';;`%ERS`!I3,<` +M>5?F`'M9Z0!!D"H`2K$P`$NT,0!;ICL`4[,J`%:Y*P!7O"P`4KTV`&F]1`!9 +MP"T`7<4P`%;2-P!:W#H`6]\[`%SB.P!=Y3L`:\%%`&C%1``VG=8`(X;S`#J` +MYP`Z@.@`.H'J`#N!Z@`[@NH`/(/K`#Z%[0`_ANX`(;+-`#[C]0`Z\ND`2('; +M`$**\@!$CO4`4H7A`%>1Z`!^I-@`:Z/N`&ND[@!BI/X`8Z;_`%[NZ@#$738` +MX5XJ`.MB+`#O8RT`ZW0^`/1E+@#X92X`\'<_`/EX/P#-?DT`@U_P`.2'-P#K +MBSD`[XXZ`/20.P#XDSP`ZY!8`/"36@#YD58`JXGC`+./[0"VD?``N)/S`+F4 +M]0"DQ^0`L]_\`+3Q_P"[\?\`O?/_`,GU_P`````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````!/3DE(1D0!441&1TE.3P``244C +M(!H;`DT;&A\C0TD``$(=&1<5$@,3$A06&!PD```B$0\-"PH)$`H+#`X1(0!P +M*5565E965E965E9651YP4E!S='1T='1T='1T='-04BI4#X$`'Q"%`!$\NP`B$(P`)Q66`"L6J``N&+4`,!JN`"XA +MA0`['\<`/B'0`"%=E0`K1J,`.5*J`!)[`$AGOP!M6*H`2VO!`$MKQP!.>]<` +M6WC*`%%\U@!N1MX`3@!HGE$`;;-2`$O% +M%@!3RQ8`7\8H`%OA&@!MS%(``%2*XP!=C^(` +M59#I`%R0Y`!>_@!9E_$`7IST`%N>^P!K'U`%CN_P!0\O\`A#8M`(HW +M+P"7/#0`G$,Y`*=%/`"+7%D`E6->`*U21P"V2T(`NU%&`+I:3`"D:64`N7%K +M`,%/10##6DT`Q5Y1`,YH60#49%<`UFQ<`,A[?_4` +MTX%X`(Z)O0"-A6YO;V]N;V]N +M;FYK:P```````&MK;V]O;V]W=7=N=RAY=V]O;W=O;VYN;FYK````````;FYN +M;6UM;75U=75U*'AU=6UU=75U=6YN;FX```````!N;75J=75J:FEI:6DR>&EJ +M:6IJ:FIJ:FUN;@```````&UJ:6EH:&AH:69F9C)T9F9F:&AF:&9G:6QM```` +M````;&=H9&-C8G)R8F)B,G)B8F)D("XP/I,``````````$Q$/T5)44D-%!E\ +M?H60C84&"A\A+C`^F@``````````3$`/$$%*10X6%1<:@(N+B0<%"!\D,#Z: +M``````````!,6E=<7%Y<#A0F6%E=>WJ%!QTI5UM>>IH``````````%)*1DI0 +M4U!#&!I\?X6.C(8C(Q\B+#Z1FP``````````54].3U165$V!@8*'B)2/B)65 +MEI:7FYRB```````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````/_______________^````?@```'X```!^````?@ +M```'X```!^````?@```'`````(````&````!@````<````/````#X```!^`` +M``?P```/\```#_````_P```/\```#_````_P```/\```#_````_P```/____ +M____________*````#````!@`````0`(````````"0``$@L``!(+`````0`` +M``$````````0/@4`#0=8`!4+9P`9#7D`(!!T`!)%!@`65`8`&5X'`!IC!P`E +M7@H`)V<*`"QT#``M?0P`,GD.`#A[*`!0%A(`8QP7`&P?&0!G+"4`="TF`'9)H` +M,TZH`#=JBP`:2]\`#T[W`!17_P`68_\`*W#0`#1OV0!-+J\`0!_X`$LER@!' +M(]<`1"'K`$HE^0!7*_``5RWZ`&TVY@!C-/\`>CW\`$UCJ@!*:K8`4VRT`%=U +MN0!A?KP`3G/"`$Y^V0!3;,@`47;$`%5YQ@!6>\@`6G[+`%1]TP!M9M``=&O< +M`'5H[``N@@P`,XP.`#B'#@`TE`X`.Y,/`#F=#P`[EA$`.:4/`#NH$``_M1`` +M0)X1`$2E$0!'JA8`2+@3`%*]%@!@ET\`:[!1`$C#$P!4R!<`4=(9`&#'*P!Q +MT%(`.X>T`!JPVP`:I_\`+I#9`"*YV@`LKOP`',WZ`![D_P`KR,`7)/G +M`%:?_P!<` +M:YWJ`&2>\0!QF^(`;Z+N`&>B]`!CIO\`:Z3T`&FF^P!KJ?T`=:3K`'BF[0!Y +MJ>\`:ST`'BN^0!^NOH`1MS_`%G;_P!,Y/\`:50"C96$`MVUH`,9.1`#&6$L` +MRUY0`-5?40#*958`U&56`-AG5P#*>7$`AD+_`(QO_P"9?O\`B:W7`)*]W@") +ML>T`B+KX`)K`WP"KRN8`I^7_`*[P_P"QY_\`L_'_`+OR_P#![?\`P_3_`,CU +M_P`````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````#(S,S,S,S,S,S,S,S,S,S,S,RQY,S,S,S,S,S,S +M,S,S,S,S,S,S`````````````'M\?'Q\?'Q\?'Q\?'Q\BWQ\>RR_?'R+?'Q\ +M?'Q\?'Q\?'Q\?'M[`````````````'Q\?(N+BXN+BXN+BXN+BXN+BRR_BXN+ +MBXN+BXN+BXN+BXM\?'Q\`````````````'R+BXN.CHZ.CHZ.CHZ.CHZ.C2R_ +MCHZ.BXZ.C8Z.CHZ.BXZ+BWQ\`````````````(N+CHZ.E)24E(Z4CI24E)24 +ME$"_EI24E)24E)24E)24E)2.CHN+`````````````(N.CI26E)26E):6E):6 +ME):4ED&_E9:4EI:4EI24E)26E)24E(Z+`````````````(V4E)26EI:6OY65 +MEI65E9:5E4&_E965E965E965EI65EI:4E(Z.`````````````(V.DY.5E965 +MD9&1D9&1D9&1D4*^D9&1D9&1D9&1D;Z5E963DXR-`````````````(V,DY*1 +MD)"0D)"0CX^/CXB/CT*^CX^/CX^/CX^/D)"1D(^2DHR*`````````````(J, +MCX:&B(B(@8&!@8&!@8&!B$*(@8&!A(&!@8&!@8B(B(B&B8J*```````````` +M`(J'A7>`=75U=75U=75U=75U=4*`=75U=75U=75U?7]_?W=_A8>*``````#! +MO(*"@GJ%@75U=75U1W5U1W5U1TAU=4!]275(24E)24E)2DI*2G5*>H1Z@H*" +MO,$`O7Y^?GIZ>$EU=4AU=4=`1T='0D1`1T!(1T=`0D1$1T1$1T=(2$E)=WEZ +M?GY^O```O7Y]?7IX=WQ\BWQ\?'Q\BWR+BWQ\BWR+?(N+BWQ\BXN+BXN+BXN+ +M=WAY?7U^P```O8-#0GEV@WLZ88'QL; +M&B$F*#@Y/3X```````````````!=6E-/#5)78&!<4P@2%J2?HJ:QM[>VL[$7 +M'R(;&B4F*3D[/3X```````````````!A60L*"@L,4U13#`D2$Q45G*&FL;*M +MI;$8`P0#`P4>(RHZ.@I::RM[>XM:XD-BHA(28U.3L]N;D```````````````!?7U]>7U]D +M9&1D7UZGJ*^OK["XN+BXN*]-34U,3$U.3KJZOKL````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#_______\``/_______P``________``#_______\``/_______P``____ +M____``#X`````!\``/@`````'P``^``````?``#X`````!\``/@`````'P`` +M^``````?``#X`````!\``/@`````'P``^``````?``#X`````!\``/@````` +M'P````````````"```````$``(```````0``@``````!``#```````,``,`` +M`````P``X``````'``#@``````<``/``````#P``\``````/``#P``````\` +M`/@`````'P``_``````_``#\`````#\``/P`````/P``_``````_``#\```` +M`#\``/P`````/P``_``````_``#\`````#\``/P`````/P``_``````_``#\ +M`````#\``/P`````/P``_``````_``#\`````#\``/P`````/P``________ +M``#_______\``/_______P``________```H````$````"`````!`"`````` +M```$```2"P``$@L````````````````````````````````````````````` +M```````````````````````````````````````````````````````````$ +M!1P"`0`$*@```$````!`````0````$````!`````0````$````!`````0``` +M`$`!``0J`P4<`@``````````1([U_T**\O\_AN[_/H7M_SN"ZO\Z@>K_)#2; +M_U>1Z/\Z@>K_.X+J_SR#Z_\_AN[_0HKR_T2.]?\``````````#^&[O\[@>K_ +M-WSD_S-XX?\S=-[_-'+<_R'_N_'__[WS__^]\___O?/__[WS +M__^]\___O?/__[WS__^]\___O?/__[WS__^[\?__4H7A_WZDV/]9*O_P=S__\)-:_^2'-_\W)\K_5CWE_WM9Z?^KB>/_```` +M!@````,````$````"%K<.O]*L3#_:;U$_U:Y*__K8BS_ZW0^_^N06/_KBSG_ +M.BG2_U0\X/]Y5^;_LX_M_P````@````$`````P````9;WSO_09`J_UNF._]7 +MO"S_[V,M_\1=-O_-?DW_[XXZ_SLIUO])-;K_:4S'_[:1\/\````&`````P`` +M``(````$7.([_R&RS?\Z\NG_6<`M__1E+O\VG=;_7N[J__20._\\*MK_(X;S +M_S[C]?^XD_/_````!`````(````!`````EWE.]U2O3;W:,5$\EW%,-;X92[> +M^7@_]_F15O+XDSS6/BO>WEE`Z_>#7_#RN93UU0````(````!```````````` +M```````````````````````````````````````````````````````````` +M`````````````/__``"``0``@`$``(`!``"``0``@`$````````````````` +M`````````````````````````````````/__```H````(````$`````!`"`` +M```````0```2"P``$@L````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````(//P<"##0M`@PT,P(--RD"#3>_?]8G_W_69_]_UN@_?];H/W_6Z']_UNA_?]; +MH?W_6Z']_UNA_?\N2:7_?+3]_UNA_?];H?W_6Z']_UNA_?];H?W_6Z#]_UN@ +M_?]9G_W_6)_]_U>>_?]7G___59[__P`````````````````````````````` +M`%>>_?]9GOW_6Z#\_UR?_/]=H/K_7:#Z_UV@^O]>H/K_7J#Z_UZ@^O]>H/K_ +M7J#Z_S5/J/]\L?K_7J#Z_UZ@^O]>H/K_7J#Z_UZ@^O]=H/K_7:#Z_UV@^O]< +MG_S_6Y[\_UF>_?]7GOW_````````````````````````````````6Y[\_UN? +M^O]=GOG_7I[X_UZ>]O]?G?7_7Y[U_V"=]?]@G?7_8)WU_V"=]?]@G?7_/%6K +M_WNM]?]@G?7_8)WU_V"=]?]@G?7_8)WU_U^>]?]?G?7_7I[V_UV>^/]=GOG_ +M6Y_Z_UF>_/\```````````````````````````````!E^S_7I?L_UZ7[/]"6J[_=J7L_UZ7 +M[/]>E^S_7I?L_UZ7[/]?F>S_7YCN_U^9[O]>F.__7IGQ_UZ;]/]K_]MFN+_78_B_UV/XO]= +MC^+_78_B_UV0XO]=D.+_6Y#D_UJ1Y?]:D^G_6I7L_UJ8[_];FO7_```````` +M````````````````````````69?Q_UF3Z_]7C./_6(K>_UF'VO]9A-?_6H37 +M_UJ#UO]9@M;_68+5_UF"U?]9@M7_1&&P_V.+U?]9@M7_68+5_UF"U?]9@M;_ +M6H/6_UF#UO]8@]?_6879_UB'W?]6BN+_5Y#I_UB5[_\````````````````` +M``````````````!5D>K_58OC_TUNRO],;,;_3&O#_TMKPO]+;,'_2VS`_TML +MP/]+;,#_2VS`_TMLP/]"8;#_5'+#_TMLP/]+;,#_2VS`_TMLP/]+;,#_2VS! +M_TMKP?]+:L/_2VO%_TMMR?]4B.'_5)#I_P```````````````*K)YLI]GM'_ +M<9/,_U&+Y?]0?]?_26C$_TAGO_]'9[W_1F>\_T5HN_]%:+K_16>Z_T5GNO]$ +M9[K_1&>Z_SY@L/]*;+S_1&>Z_T1GNO]$9[K_16>Z_T5GNO]%9[O_16>\_T9F +MO/](9K[_26?#_T]\UO]0B.+_<9/,_WV>T?^JR>;)GL3A7XJMUO]IB,/_4(7? +M_U)ZT_]CIO__8Z;__V.F__]CIO__8Z;__V.F__]CIO__8Z;__V.F__]CIO__ +M8Z;__V.F__]CIO__8Z;__V.F__]CIO__8Z;__V.F__]CIO__8Z;__V.F__]C +MIO__47?1_T^#W?]IB,/_BJW6_Y[$X5^3O-X)C;;;ZV.`O?]/@-O_7XO>_\CU +M___(]?__R/7__\CU___(]?__R/7__\CU___(]?__R/7__\CU___(]?__R/7_ +M_\CU___(]?__R/7__\CU___(]?__R/7__\CU___(]?__R/7__\CU__]>BM[_ +M37[8_V.`O?^-MMOKE<#>"0````!^I-B+9X;"_TQ[U_]\L/#_P_3__\/T___# +M]/__P_3__\/T___#]/__P_3__\/T___#]/__P_3__\/T___#]/__P_3__\/T +M___#]/__P_3__\/T___#]/__P_3__\/T___#]/__P_3__WRP\/],>=;_9X;" +M_WZDV(H``````````&Z/TR)IB,W]3WS7_Z?@_O^]\___O?/__[WS__^]\___ +MO?/__[WS__^]\___O?/__[WS__^]\___O?/__[WS__^]\___O?/__[WS__^] +M\___O?/__[WS__^]\___O?/__[WS__^]\___I^#^_U!\U_]IB,W];H_3(@`` +M`````````````%][SK5=CN/_MO'__[?R__^W\O__M_+__[?R__^W\O__M_+_ +M_[?R__^W\O__M_+__[?R__^W\O__M_+__[?R__^W\O__M_+__[?R__^W\O__ +MM_+__[?R__^W\O__M_+__[?R__^V\?__78WC_U][SK0````````````````` +M```!4FK(2W6P\O^R\?__LO'__[+Q__^R\?__LO'__[+Q__^R\?__LO'__[+Q +M__^R\?__LO'__[+Q__^R\?__LO'__[+Q__^R\?__LO'__[+Q__^R\?__LO'_ +M_[+Q__^R\?__LO'__[+Q__]UL/+_4FK(2P````$```````````````$9(4,& +MO.C^_\KU___*]?__RO7__\KU___*]?__RO7__\KU___*]?__RO7__\KU___* +M]?__RO7__\KU___*]?__RO7__\KU___*]?__RO7__\KU___*]?__RO7__\KU +M___*]?__RO7__[WI_O\9(4,&`````0```````````````@````<````--7T. +M_S![#/\J;`S_+H$,_S:=#O]%M1+_,8L-_Q1+!?\_$0__52(<_V\M)O^(-B__ +MJ44[_[]:3O^E44/_?C_Y!TX/\````/ +M````"`````,```````````````,````'````#DBJ$_\XCP[_*W,,_R^$#/\X +MH`[_1[T3_S>>$/\980?_4A@4_V$F(?]S+B?_C#@O_ZQ&/?_'75'_NEM-_Z%& +M//\."%C_&@UL_QX/@?\I%:'_/"#(_U@NYO]P2.+_E'?F_P````X````'```` +M`P```````````````@````4````)2Z\4_SJ4#O\M=PS_,8D,_SJF#_]*Q13_ +M.J81_QIF!_]6&17_9"@B_W^W_````"0````4````"```````` +M```````!`````P````5-M13_/9D/_RY\#?\SC@W_/*T0_T_-%/\]K1'_'&L( +M_UL;%O]I*B/_?#(J_Y<\-/^[3$+_V&99_\UD5/^T34/_#PE?_QT.=?\B$(S_ +M+1>N_T`BV?]?,??_>$WS_YY_]?\````%`````P````$````````````````` +M```!`````4ZZ%?\^GA#_,($-_S63#?\^LA#_4]05_S^V$O\=<`C_7AL7_VXK +M)_^"-2S_G#XV_\%/1?_B:UO_U6A9_[M11/\0"63_'@]Z_R(1D?\N&+7_0R3@ +M_V,S_O]]3OK_HH+[_P````$````!```````````````````````````````` +M4;X5_S>"#?\I9@S_+6X*_S:%#/]'K!3_.)00_QUT"/]A'!C_523__$7D__P5)(_Q`):/\;#5O_'@]K_R@5D?\\'\W_6"S[_W-) +M\?^EA?__``````````````````````````````````````````!3P1;_(\'4 +M_QS#[/\@\O__(?___S7___\J\___'WD(_V$<&/\A797_(X#,_RNZ]_\PX/__ +M4/+__U+=__^\4D?_$`EH_Q$\N_\27-S_&J?V_R'5__\\_/__6.[__Z:&_?\` +M`````````````````````````````````````````%_&*/]-KQO_.I(3_SRE +M$/]&P!3_6^$:_TS#&_\PAAO_;BTJ_W8U,/^#-R[_F$`V_[E01O_6;U__SFQ= +M_[9:4?\Q*G[_+B&%_R<9DO\P&J[_2"?8_VP^]?^(8/7_KI;Z_P`````````` +M````````````````````````````````=<%4MF^T4]9HGE'N:[)0_7#+5/UY +MY53N;3K>)65>VC5];UI5C7NZD:67]O7%L_=.!>.[(>W/6M'!JMXZ+ +MO;:-A[W6BH3![H^&TOV:C>G]JY?][KBH_=;,P/^W```````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````/__________X```#^````?@```' +MX```!^````?@```'X```!^````?@```'````````````````@````8````'` +M```#@````8````&````!@````8````&````!@````<````/P```/\```#_`` +M``_P```/________________*````#````!@`````0`@````````)```$@L` +M`!(+```````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````!&%P!`A=<"@(770D" +M%UX#`A=>`P(77@,"%UX#`A=>`P(77@,"%UX#`A=>`P(77@,"%UX#`A=>`P(7 +M7@,"%UX#`A=>`P(77@,"%UX#`A=>`P(77@,"%UX#`A=>`P(77@,"%UX#`A=> +M`P(77@,"%UX#`A=>`P(77@,"%UX#`A=>`P(77@,"%UX#`A=>`P(77@,"%UT) +M`A=<"@$87`$````````````````````````````````````````````````` +M`````P?__]9H/__6J#__UNA +M__]__\` +M````````````````````````````````````````````````````6:#__URB +M__]>H___8*3__V*E__]CIO__8Z;__V2F__]DIO__9*;__V2F__]DIO__9*;_ +M_V2F__]DIO__9*;__V2F__]DIO__-E*I_X2X__]DIO__9*;__V2F__]DIO__ +M9*;__V2F__]DIO__9*;__V2F__]DIO__9*;__V.F__]CIO__8J7__V"D__]> +MH___7*+__UF@__\````````````````````````````````````````````` +M````````7J/__V&E__]EI___9J?^_VBH_O]IJ?[_:ZG^_VNJ_O]KJO[_:JC^ +M_VJH_O]JJ/[_:JC^_VJH_O]JJ/[_:JC^_VJH_O]JJ/[_/EJN_XBY_O]JJ/[_ +M:JC^_VJH_O]JJ/[_:JC^_VJH_O]JJ/[_:JC^_VJH_O]JJ/[_:ZK^_VNI_O]I +MJ?[_:*C^_V:G_O]EI___8:7__UZC__\````````````````````````````` +M````````````````````````8J3]_V:G_O]KJ?[_;:K^_V^L_/]RK/S_*[Z_W>N^O]WKOG_=Z[Y_W>M^?]WK?G_=ZWY_W>M^?]WK?G_ +M=ZWY_W>M^?]WK?G_3FRU_X^Z^?]WK?G_=ZWY_W>M^?]WK?G_=ZWY_W>M^?]W +MK?G_=ZWY_W>N^?]WKOG_=Z[Z_WBN^O]VKOK_=:S[_W*L^_]NJOS_:Z?\_V6F +M_O\`````````````````````````````````````````````````````:*;\ +M_VVI^_]RJ_K_=:WY_WBM^/]YKOC_>J[W_WJN]O]ZK?;_>JWV_WFM]/]YK?3_ +M>:WT_WFK]/]YJ_3_>:OT_WFK]/]YJ_3_5'&X_XZX]/]YJ_3_>:OT_WFK]/]Y +MJ_3_>:OT_WFM]/]YK?3_>:WT_WFM]/]ZK?;_>JWV_WJM]_]YK??_>*WX_W6L +M^?]RJOK_;:G[_VBF_/\````````````````````````````````````````` +M````````````:J;[_V^I^/]SJO?_=JOU_WFK]/]ZJ_3_>ZSS_WNK\O]ZJO#_ +M>:GP_WFI\/]YJ>__>:GO_WFI[_]YJ>__>:GO_WFI[_]YJ>__5G2[_XRT[_]Y +MJ>__>:GO_WFI[_]YJ>__>:GO_WFI[_]YJ>__>:GO_WFI\/]ZJO#_>JKR_WJK +M\?]YJ_+_>*KS_W:J]?]SJ?;_;ZCX_VFF^?\````````````````````````` +M````````````````````````````:*7X_VZG]O]RJ/3_=:CR_W>H\/]YJ.[_ +M>:?M_WBF[/]WI>O_=Z3K_W:DZO]VH^K_=J/J_W6CZO]UH^K_=:/J_W6CZO]U +MH^K_5G:\_X:MZO]UH^K_=:/J_W6CZO]UH^K_=:/J_W:CZO]VH^K_=J/J_W:D +MZO]WI>O_>*7L_WBF[?]WI^W_=J?O_W2G\?]RI_/_;:;U_VBC]_\````````` +M````````````````````````````````````````````9Z+T_VRB\O]PI.__ +M;IWH_V^#_;I??_VZ6W_]MEM[_;9;>_VV5WO]M +ME=[_;97>_VV5WO]ME=[_57:\_WN?W_]ME=[_;97>_VV5WO]ME=[_;97>_VV5 +MWO]MEM[_;9;>_VZ7W_]OE^#_<)K@_W":XO]PF^/_;IOE_VV;Z/]OHN[_:J+Q +M_V>A]/\````````````````````````````````````````````````````` +M9)[R_VF?[_]KG>K_8(74_V*&T_]BA]+_8X;1_V&&T/]@A<__7X3._UZ#SO]> +M@\W_7H/-_UZ#S?]>@\W_7H/-_UZ#S?]>@\W_472Z_VR-T/]>@\W_7H/-_UZ# +MS?]>@\W_7H/-_UZ#S?]>@\W_7H/-_U^$SO]@A<[_88;/_V*&T?]AAM+_8(73 +M_U^$T_]IG.C_:)WL_V.>\/\``````````````````````````*O*YLM^G]+_ +M\C_5GO(_U9[R/]6>\C_3&^Y_V&# +MRO]6>\C_5GO(_U9[R/]6>\C_5GO(_U9[R/]6>\C_5WS(_U=\R?]8?LC_57K&_U-XQ?]0=L3_3W7#_T]TPO].<\+_3G/"_TYSPO].<\+_3G/"_TYS +MPO].<\+_1FJV_U=YQ/].<\+_3G/"_TYSPO].<\+_3G/"_TYSPO].<\+_3G3" +M_T]TP_]0=<3_4G?%_U1YQO]5>&V_]EDN+_R?7__\GU___)]?__R?7__\GU___)]?__R?7__\GU +M___)]?__R?7__\GU___)]?__R?7__\GU___)]?__R?7__\GU___)]?__R?7_ +M_\GU___)]?__R?7__\GU___)]?__R?7__\GU___)]?__R?7__\GU___)]?__ +MR?7__\GU__]DD>'_5H3:_U*'W_]A?KS_87Z\_W>;R_^2O=Z+``````````") +ML=LC@JG5_5MVMO];=K;_487?_U-\T_^'N_7_Q?3__\7T___%]/__Q?3__\7T +M___%]/__Q?3__\7T___%]/__Q?3__\7T___%]/__Q?3__\7T___%]/__Q?3_ +M_\7T___%]/__Q?3__\7T___%]/__Q?3__\7T___%]/__Q?3__\7T___%]/__ +MQ?3__\7T___%]/__Q?3__\7T__^'N_3_47K2_U"#W/];=K;_6W:V_X.IUOV) +ML=LB````````````````?J38M6!]N_]4;;#_4(+<_U9_U?^QY___P?3__\'T +M___!]/__P?3__\'T___!]/__P?3__\'T___!]/__P?3__\'T___!]/__P?3_ +M_\'T___!]/__P?3__\'T___!]/__P?3__\'T___!]/__P?3__\'T___!]/__ +MP?3__\'T___!]/__P?3__\'T___!]/__P?3__\'T__^QY___5GW4_TY_VO]4 +M;;#_8'V[_WZDV+4`````````````````````=);52FB(R/]-9*K_3G_:_V*2 +MX_^]\___O?/__[WS__^]\___O?/__[WS__^]\___O?/__[WS__^]\___O?/_ +M_[WS__^]\___O?/__[WS__^]\___O?/__[WS__^]\___O?/__[WS__^]\___ +MO?/__[WS__^]\___O?/__[WS__^]\___O?/__[WS__^]\___O?/__[WS__^] +M\___89'C_TY]V/]-9*K_:(C(_W26U4H`````````````````````_Z?E__^U\O__M?+__[7R__^U\O__M?+_ +M_[7R__^U\O__M?+__[7R__^U\O__M?+__[7R__^U\O__M?+__[7R__^U\O__ +MM?+__[7R__^U\O__M?+__[7R__^U\O__M?+__[7R__^U\O__M?+__[7R__^U +M\O__M?+__[7R__^U\O__M?+__[7R__^U\O__I^7__U2$W?]2:[G_8'[/=``` +M`````````````````````````````%MTS116;\CV8I?I_['Q__^Q\?__L?'_ +M_['Q__^Q\?__L?'__['Q__^Q\?__L?'__['Q__^Q\?__L?'__['Q__^Q\?__ +ML?'__['Q__^Q\?__L?'__['Q__^Q\?__L?'__['Q__^Q\?__L?'__['Q__^Q +M\?__L?'__['Q__^Q\?__L?'__['Q__^Q\?__L?'__['Q__^Q\?__L?'__V*7 +MZ?]6;\CV6G3-%`````````````````````````````````````%0:,>@?KWW +M_Z[P__^N\/__KO#__Z[P__^N\/__KO#__Z[P__^N\/__KO#__Z[P__^N\/__ +MKO#__Z[P__^N\/__KO#__Z[P__^N\/__KO#__Z[P__^N\/__KO#__Z[P__^N +M\/__KO#__Z[P__^N\/__KO#__Z[P__^N\/__KO#__Z[P__^N\/__KO#__Z[P +M__^N\/__KO#__WZ]]_]0:,>@`````0`````````````````````````````` +M``````)$5[8ZP>W__\CU___(]?__R/7__\CU___(]?__R/7__\CU___(]?__ +MR/7__\CU___(]?__R/7__\CU___(]?__R/7__\CU___(]?__R/7__\CU___( +M]?__R/7__\CU___(]?__R/7__\CU___(]?__R/7__\CU___(]?__R/7__\CU +M___(]?__R/7__\CU___(]?__R/7__\'M__]$5[8Z`````@`````````````` +M``````````````````````,````*````%#5[#O\L;0O_)F4*_R1>"O\D9PG_ +M*WP+_S&-#?\WG0__-Y`._S-]#O\D8`K_$#X%_T84$/]3(QW_9BLE_W0M)O^& +M,2G_F3LR_ZA`./^N3D/_HDY!_X]'//^#/37_>S,J_PT'5O\7#&;_&0UW_Q0* +M??\5"X;_'0V:_R,2J/\L%K+_,1BP_S0:JO\]'Z;_3R>F_P```!0````*```` +M`P````````````````````````````````````0````,````%CJ%#_\VA`W_ +M+7<,_R9E"_\E:@G_*WP+_S"-#?\XH0__/)L/_SJ0$/\J<`S_$4`%_TD5$?]@ +M*"+_=S(K_WTQ*?^),BK_FCHR_ZA!.?^T4$7_KU1%_Z921?^91SW_@C8L_PT' +M6?\;#G;_'0Z+_Q8+B/\6#(K_'0V;_R,2J/\N%K?_-AJ__SX>R/]+)C$_\YC0[_+WH-_RAJ"_\G;@G_+8(+_S.4#?\[J!#_/J$0_SR5$/\L +M=@S_%$D&_U48%/]F*R3_>C0L_X(S*_^/-2S_H3TT_[!$._^[5$C_ME=)_ZM5 +M2/^A2T#_E3TR_Q`):/\=#GW_'@^/_Q<+C?\7#)#_'PZB_R42L/\O%[__.!O& +M_S\?S?].*-?_:33=_P```!4````+````!``````````````````````````` +M``````````,````(````$$JJ%/\]E0__,H$-_RIQ#/\I=0K_+XD,_S6<#O\^ +MLA#_0JL1_T"?$O\O?PW_%5`&_UL9%?]M+B;_@CPO_,9`-_SBD#_]"NA'_1K42_T2J$_\SB`[_%U<&_V,<%_]V,BG_C#LS_Y,Y +M,?^@.S'_LD0Z_\-,0O_17E#_S6)2_\-A4O^Y5TK_K4<\_Q(*>?\A$9'_)!&C +M_QH,G_\:#J'_(@^S_RD4P_\T&M7_/Q[?_T@CZ/]8+/#_Q%/\UCP__&%P'_V@> +M&/]\-"S_D3XU_Y@[,?^E/3/_MT8\_\A.1/_78%+_U&95_\ME5?_#6TW_MDM` +M_Q,+@/\C$9G_)!*K_QP-IO\;#J?_(Q"Y_RH5R/\V&]S_02#H_TLD\_]<+OG_ +M=SOY_P````0````"`````0`````````````````````````````````````` +M```!`````5*[%O]$I1'_.)$/_R]]#?\M?@O_,Y4-_SJI#_]$P1+_2;X3_TFT +M%/\WDP__&5X'_VL?&?]_-BS_E#\V_YH\,_^F/3+_N$8\_\E.1/_97U'_UV=6 +M_\]G5__'74__O$U!_Q0+A?\D$I__)1.O_QP-K?\;#JK_(Q"[_RH5S?\W&^#_ +M0B#L_TTE^/]?,/[_>SW^_P````$````!```````````````````````````` +M`````````````````````````%*]%O]$IA'_.),/_R]_#?\M@`O_,Y4-_SJJ +M$/]%PA+_2;\3_TFV%/\WE0__&5\'_VP?&?^!-BS_ED`V_YH],_^G/3/_N48\ +M_\I/1/_:8%'_V&A6_]%G5__*7E#_O4Y"_Q0+BO\D$J'_)A.R_QP-L/\<#JO_ +M)!&^_RL5T/\W'.+_0R'O_TXF^_]@,/__?#W__P`````````````````````` +M`````````````````````````````````````````%.^%O]$IQ'_.9,/_R^` +M#?\M@0O_,Y8._SJK$/]%PA+_2L`3_TJV%/\WE@__&5\'_VP?&?^!-BS_ED`V +M_YL]-/^G/C/_N4<\_\M/1?_:8E+_V6A6_])G5__+7E#_ODY"_Q4+B/\E$J/_ +M)A.T_QP.L?\<#ZW_)!'`_RL6TO\X'.3_1"'Q_T\F__]A,?__?3[__P`````` +M`````````````````````````````````````````````````````````%._ +M%O\[C0[_,'0-_REA"O\F7@G_*VD+_S%W#?\\D`__/9C3_ +M_RC@_/\>V/[_&F`'_VT>&O\>9)K_)7O!_R2&W?\FI?__+\G__S/;__\SV___ +M.M'__S_,__\]R?__P$]#_Q4+C?\02^C_$E'__PY)__\/5___%(#__Q6C__\9 +MH/__'ZK__R?%__\RYO__@D#__P`````````````````````````````````` +M`````````````````````````````%7!%O\SRL#_*,'*_R+#U_\CT>G_*.W_ +M_ROZ__\O]/__-NW[_SKG[_\MU\[_&F('_V\?&O\W:HO_.X>T_S>9U?\YL?7_ +M0=G__T?H__]0X?__6=O__V?3_O]JQ/'_P$]$_Q8,D_\:2]__&&'__Q5=__\3 +M9?__&Z[__Q[*__\FM?__+L/__SO0__]+WO__B$+__P`````````````````` +M`````````````````````````````````````````````%C%%_])LA/_/9X/ +M_S.)#O\PC`W_-Z$/_S^X$?]+SQ/_4,H5_T_!%O\[GQ#_&V8'_V\@&O^%."__ +MF$,X_YT^-/^I/S;_NTD]_\Q51__=9U?_VFM:_])K6__,8%+_O$Y!_Q8,E?\H +M%;#_*A;"_Q\/O/\?$+__*1/2_S$8Y/]`'_C_3";__U4K__]J-?__B$/__P`` +M```````````````````````````````````````````````````````````` +M`&G+-/]9NBC_2JD>_SJ3%?\VEA'_/*D0_T2^%/]1TAG_5<\;_U;#(O]*IB3_ +M.'LH_X([./^+13[_ED@__YI`-_^C03;_M$D]_\552?_395?_TFU;_\UN7O_% +M9UO_NUY5_T$WM/\_+[[_-B7#_R86N/\D%;W_*1/._S,:X?]$)??_4RW__V$[ +M__]\3?__FF+__P`````````````````````````````````````````````` +M`````````````````'&^5(APMU*P:ZM1RV:>3^9EHT_N:;5/_6S)4?USVE+N +M=-52YF_&4\MEJE&P68].B)-95XB985VPH&5ARZ!E8.:J9F+NMFQF_<-S;/W0 +M>G+NS7USYL9Y<-KMO6NT9$E6W_?;$2_6YZ +M>GJ>P"!@A!@9S!(&M,:\UB"D&1!H>&B8:3'#C#RV+(-8,C(@$$NL91F!M#`& +M/@A+!DE+1H`LF8>!!=CR8%C`#`QBF.[J[NJNKJ[J[JJZCWR?S/OS.'1`1$1$1$1$1$1$1$1$1$1$1$1$1 +M$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1 +M$1$1$1$1$1$1$1$1$1%Q&I#3SL`J#5&Y_X +MOM/`/44`#__Z>QI&6#E)TF*%I!L,FMO./LYM]3'?2C^K=X4=O_XU_DQVG?/<] +M]MY&<_.^MS6W+K^UL7GI38V-"X\U6MN/-UJ;C]I&ZPECS!:B@$,U1]6!.L0T +M$&EA[`9B-A'30J3ICZ6!,0W$-#&VA9@FB,$8,!;$^"I`:ON`R^BF`Y[O[W.S +MM\_'>[M\K+OW[$?[>\]\]*5/_I?'*M_NQAL;EN1MQC3>:DC>9,0\!N9Q1!Y5 +MY(D,MC(@11FHHK77E2!8#`T$BV`%&AA,G0`\"83]Q*?BV+_P<)R`V"[P/+B; +MJ'X;7]AOM_>=NTN +MKMO']8;H,/5ID**##(89FN60.31SX%Q5$R*3"<`:Q-J#VR1!DD`&82L-GRCV +MFTU,JX%L-/WYU.WSZO`WW4O]G],7.C]_^V_^[)W#RG?_XW_[P:TK;_J:"_=_ +M^CNWKCSVAP]E3QT=-`A\GE>"KPYRA^8.5'TM&)""`(Q424"L`6/`6M\=L,9_ +M_.4VG#?6:PN]?Y'^Z\_?O?L>_>ZE> +MOOL?_Z=/7'KX<[[W\B.O^X:-BXV6L7O`+M!%70^7#WQR*>J&J$N]P*LODZI# +M50'U`E\(O22U;0)B,:;XFR]'=:T)QP6!>!7`GT\\003-P22;&+N!L5O8I`E` +MOTWWSO7\G[_RW&]^WW.___:1\KW0?,T3VV;[>XW=_(8.2>LVRBZ.@7IA]P+O +M2%$R')DJ>4U5*UK_0MBM%()/3?@-"1($WH3SAB0(O@UBK^%^H;:\8(@GA23\ +MMH5A4Q(N2Q/L%MA+8"]W,1O_*_GN]\M+_^0EUA!K20"?IC_UK8/N*S_2?_'Z +M9OK2*^1WVKA./[3N10I"G^?@=@ZGS17WVP50A]:?S'4"$!J!&""H(]I +M`B8002"`D>/B^H(HQ*![&7HW13LY#'/(M2V)^?#NW_NEGP)X^(V_^O[[7O.I +M/WSQ`=U,FG=`]G!Y&^=ZJ$LAJ/=>X'/02N4_0`"J->$.@E^0@&D`IB*`D>M, +MM9U``'X;FGX\B8J`,0DN[Y$.]LD&.Z2#NZ3]W79__\*W/?61#_\TP.\V'_M` +MTUSXQZG9V.R(81!4^@&.3!T.)4-Q*$[#%M_Z%Q2@:&CY*0D@830UPKF*`"H2 +ML($$?.YEA`!&":$Z+R(TMK:X<.DB5RY>YLJ%!V#S$;AEVMSN?D">_ZZ?.6W9 +MF!=K1P!OT9_YNO[^K7_=?>HIAC=>QK5[,$S10MBSS.]/(P#G6W^<^GVGA1Y9 +MM?@2A-\6&H$I2H#M] +M3=[R\%]J_H?ON7#ET8?_U:6'AS2W.@A=E#0(MA?X0O#5C0H_@0`J$CA(`(QI +M`$(E_,9XM;?4!"81`.,$4$#)TGUZN\\P[-TD&[;)TQYY-B`;[-'?OZE)Z])7 +M_?#5CUQR=NM?MLPVB30)%@LT"'G1TF:"@?N_$. +MN?9W?O&T960>)*>=@7F1]WK__>#9ZZ0OW48[`Z_2._6"[!0MWYJ&5#_FX#$< +MW$K][U+]ANJWJHJH?YX4USJM?NNJAZDZ].4!>C>#+.33*9KF,,Q`09V3X4>> +M^[Y-VTULXSK&:A`X-_),+.NOD_!*RH(6I5%%I+A.#ORJ+ORRV42%LDY5'4.7\7)O +MG\[-J[SV4S]3N'7Q>[C&6A&`.?DM5HM\O_UGL]TVVD^]D&GM-8\(!%.^A+'] +M\=_73^FDZ\?.C=^X))IJJ[LI#%Q)4B5!!"+PADA!>^GGJK[T5I$=;!*,D.6M +M:X+/Z&>J]6N.0OU>8X+NCP\6H:R3LG[J)`-9VB,;[(?C0A.I$10$S21_VRW< +M6P>(;Y&#!E%QLE;EJ9=MRNN8]$K'SXW7U?1:TMJ_VC6)[^J51*1:EL^_"TUT`*W\1$\]#:P?`12MYC1=#\:^VB.^BB7S +M@F8UK:(N[/5\UY40LI$\E\(_4HS5D=E1,J4NHU`;"A*HM(OQ,FC9WY_ER0N3 +MY^-"#G8+1CZ\&B,Z57#K1P!K9P,X@&GZWV&-9)',V#E#S2!8VP]^(MC09S;U +M^VA-'J=_LH5I8&J^I_UTQ"XQP_4S00Y-"DAI')A"-J%/[57^@QFN_M<)YT^6 +M\Z(7+T&+F)0FO<9)I3_\8:/ZCY:#A&/%U9&=M<(:$D!M(*CH2^?.M[19V,^U +M&N8N_4^OW*48L_-:H036(6>$-6.15O`!JGE=Y<3G.N6IH,JC+T\JF"CG!ZA^L +M__7CNN6_U!NT$D+_"K0V_@\-A42@@4^):A@=@$0-5AQ&O?.0")[1&:6I\)6@ +M*L&P*.5?BBZ.*0VC8Y_EFF']""!W,,B@DT$_>/@-<^_TDX=Q\=)7S*'BP#BP +MQ3:4.L$/\UF@$;Z81)"&^&,;A@(!40,A22[@BF/QR0&Y0N[)1I3*QZ"OT'5H +M)T?W<^CG:.J\&_(PAS2O/!)500?>T2?K@@IY/L#EP;O/N6#["((^3AY:M%&C +M[50YY!>\_;PG7SA7'Q84SWI^=%W*83]_;U\<5S*+SV^>#\C3OA_R2[MD:1N7 +M]>J%!2H*]*5QVY**DZLC#LY[0RP[G"2L]!!2W,S"B'_1H( +MS6!8+/:+H;YB2-`[_GCG'A.\_PHK1`[!R<@+=![L%+D&/P35TGXK*E@U6#4D +M:DG(2$@P(UX*ZX.U(X"\W25_I8-[N>=;>!Q8A9:$L7C0)(S7)\ZGAO--0R,< +M$RSR6G@"ELT;%!^&$R_D0NG,X\?XPYAXX2A?.T:W3E&]1C;L,^R!L8U2H(7@H6>3*K\UC&@G8>2\&-T66SC[ +M&$RH(U.XR-=\_*5P\L$&,@A;+*H^H5*SA#ORM$EF!"%'W0"3-U!,T$9R7#8D +M3_NX;(@ZQUV4"V0\H"G;V%*@&\'1)GA,^"D-HB-"7Y"`*[HIP?NO3%)X]@DJ +MIFJ]@]9C@@^`Q83K"Q((I*-*!N3B'9$R,61BR#'D8LG*=M^30Z8YXC*L&^(T +M!5V_*0)K1P":IDC+(E>:B/6J.>(YW/.X(.)0J;'Q`+0;'("RT#7(=@O@GY"4+#"YP97>OKE +MB$FP-N?BQ4[I"-3I;9>38RIOP#H1&"IQ+";/2)@3L('834RRA7$#5%.L>J$B40J#9`$)];?0:,1<.DP +M%S:1RRU$&ZCFB)/0YR_L`1I4\I`RY8K+>3,#WN(&/.Y2'M&,U[1R[KNH7+H@ +M7+HB7+I?N/*@12Y;N&1AJS`*&*I>84;1"]X="+M#87\H[*>&.T/A1M=RJV^X +MOI_PR9T63_;=WF@L<;E._=Q9_$BAFTQ;&+)41R.7()K1/W5XG#X-4R1)!6H+9 +M-/"JH;-EZ&]!>$,B#J$R]B4F +MY8O>_(=\\>-_Q.=<>H;7\HHOWWZM?$-!]@63&;*N8>^VH?.\G:E\QL+%1LK% +MYAY<$KB";_334+Z.(V_[\GW\N8?XG:=?S^\^_^G\R2M/D!==#RDZ+QK*Y=-& +M:*U+PZ)2JM6EO[]5'O^"/H]_3I^'GQAR:2,]6+Y$Z(C0ZQGL*P;;,=@;LY4/ +M"[8AV"U\^%Q-8^\#3O@1__ZC_$Y[JHOW_../VB?9OE>Y#Y]@;_XT&_QYL9K +M^/GGOHY*$=8#8V[%]-UI;D"FI;S]'^_PT*4![>N.6R\[KIYJ^8;T'NJ0?OZK +M-%ZZR5L^^CEL4`U'CNH7:S>U9@T)`#BLHK]B<)?/?:[#\Z\Z!EUE,)SPTUI' +M3T:^$ZFEVO&!9TYZ_L$;BPC#%'8Z<'?/(?T.K^GUPD"GYT*&] +ME'E1C*=WAWJFRY=F*7G6F[M\!3J#LUV^3IZSDPV.7;ZSAGN#`)B1BV5\=T:5 +M3:9=-ZEU&3\\ZK<++.B9*M\2%.(S5;Z:'>/09YQMK"D!K%CUFNK.-M&9?Z)K +M["GE?.7E&\5TH=`9SIS]\LU>WK.*]22`"9-_9JIZ'=_5R?>;>+*:^37=*5\/ +MWG-!_OMR8.^D@@$:VU'G5S +M?&U?)MRG[C>.O\^1LY5+R/331Y;CC)5O$7)RELMW#V"M"6#21(S]OI)N5\>9 +M@]VNTNXKW53II>55&*DV31)F2PM.C9U>+^GI/GIE$\4 +M\L/*ERMYKI#4\SS?O/]V'[*B?+K\\C5;XOVQ9BQ?EN-=SP^\O_7$6A/`)%QM +M;O*COY;2<(Y7]Y7=@=(UEH$1AF(8&B&U0F8ES.\17"+!/U[(K>`2XX?B@X.. +M*6($2IB`(L4'9,J99@9(P-XCK1.5[_K@M?S8 +MKSJL2WFUK>SU#0.WR="UR+1)3I.,)GGP)U#CPUJ+%8PQJ&GZXR*NH=C@=N!] +MYJW)L28OA\&LR3&2XSWB^^#Z:-;#93VR89=LL`LN0X!.S]#C!XM:VTNXH,#:1^GH7D@N1^=J,IYP(8?(Q6\3/^$*RI(@6;\`X-4D;Z +MEN#0HXF&N5W*T#@&QM$GIZN.CLO9U30XF,.@"V]/6]"[%>6$\"D&JC +MM6.`E^[;YJ<_ZPUPH\/^HX:>$:_"B7J*I]J6L^F"WWX9%KSTY0_..#9,]BF" +M@@9A*2<)B2D%R#OU2YA!"/0&PK$-;.;GMHH.7T,&+9#8EXR)-T\"Y:JAS'K'8WFUQ___W$-=UP%;? +ML)UZ+T$_DZ]PQO6O9F0-@&(^`-`,"X34PX,7\P42PDS`,"D(*.:-EL[>F8;) +M0*&QV&OE[#8SC#1XV%Q@PZRGV$S"O5.2&NX\>A&]V$(S[YN.:(@.'*;3%JD, +M"QX$WU1;/Q,VC`O7PH'[4."UT.!E"/!ZQ.#JO`Z4O.O(=C/T[A#3"3$*!K-/ +M'!GO_O=:GTYN'L>ZG.T0L;>("W`P-H".3>XI0H(G?@4M,:-_'U\?8#PD>#$) +M*)",RP?DZ>M(!W>1WFU,M@^N/T(`\^*ASB:;VB3%88V4LS'&@X5648$9(8&D +M3G%%5.`P$[!8#*182:@@R6)6=Y@^Y;?61WY68TG%,D@,MMEDR]X[8K.>)3G* +M^*M`T_J^6AZ$7FNMOPG&G6+&H-&126YE$V/"->(#B(BI?E_?JG&^I::(%.P0 +ME3!I!_]L*T@K\7$+#@C_]#9R8F`L!6,W4,FKV7:U>(,C\3X+3<"))S"$(K9! +MN6^*X]#BF[`MNCY%=*""*(LL2Q485"3!-C91'>)<_]BOM9AVU1*OSN?4PX'[ +M_PO=ICXWL4AEJ(=B7\&*8M'P>A6CSH<[+VE%#@S]:3$#,SP[04A,@IDF_&MJ +M!EA#`E`_;:P65$/3##(?%,2O_N/7!B@7`E'_&2$^^2G$ZO>MAB`@4';HK:"^ +MLU_U&"@"5(S%OG,&<:$%Q@`YU1IS!@:$@"`..@[MNQ`$Q*]2Y`DJE`LH@FVH +MYK@\]P$UQI;ZJJ\+X%Q](1!*Z:\;P$6TFO**UKY8!Z`V#P%% +M)"R>0EZ%3@A_T[Q/GG5#ZOE@(/D0EVO\9;6@(#XR +MD/.1@4)4H$KP_78D(IN?GUU +M?<&IJ2VP`J(&HSE6QR&>8!V^" +MH!OU6H`0F@@OU&(-:C6L`ZDCJP*5*P+7@X18XT-TF[H=P`3AES)"D.0F!!() +M^F28GJS#''HYVL[#^H0Y.AR+"I2ZH++?)L\,:=]/&_9Q]4/WI8SU#V63H_5V +MD6JQ#@G$);YU+@*"B)&0_*P_+^#4!%L.1`8JQ[W+.?M%9")'GF?D:=^'!D_W +MR8>[@0@*0ACX,N1^<9,VRH[FO.I2]D7*4&#%/QDA0B_TA;`7D83+B$!`0RH[ +M@,5'^Y%2L+WQ+ZSZ%TC"E!&"?-=*L'0%D=_=PM\/J.BC2,N@&82%/%]3QHK7/*=H-$4(@$.-; +MWH%"+I4QKIQ`0J5?EOLZ,I6TC(=A9=0NT`S;H$Z+&A^)J(@85,:?$\0%;475 +MAP0;9B&.X2?)!GMD`XMM;`&",8T0GFQLN%"IA:=6H(C%Y\JN"."[+L8A1H,V +M$!8(@5(K0GR]B>0A%4L#!_.;U&+S2".8X@@V@T)-RD!3($==BC#P=.&RH,GD +MO(QR27.&.#9):$GI5.O?5*FVU*/TCP[]NR)DEP@9542@8-:LX@.&;5YN:VL' +M0AD0)`0NQX8(1*4F(`8G%B>6/`3^\.V]#90!N3KZFH'S"[2N&]:.`"0QF$M- +M3-[TJGRAV@> +M.&RUE7S<4&AK^[Z+H2U!-O'33XO^I5.D6"`DJ4(4B[F";=Q'TMQ`:RU]*0*E +MH:]:#[!8#@PT+`)4>;Y57??)]H3PV&I;4_,EV#H$WV7R!.`"@80+-4&UB;H- +MU&VA.L"Z#'5%9*`L+$0J;`(7Q7)9$BX7$8'*Q4X4)]6:@.7Z@(RM"RB5UE-_ +M;540M#'"&#GV05)]RV_*.055I*%J=:%BW6`C%BL6E1#T8R3YZ$`-64^GVK4C +M`'OI`G+?)J)]'Q7'%7U]W^`K&JS[05@=7M@G]M$FN=<5ZK",-K@'W#_EX'[A +M^%(.!?KN0*F!E`N,*E@+B:*)0D-#1""#F->2-!^GL7$_MI'4A#P$/`U=`2D- +M?.'YY5"AH%*T:46#.J+C5]DN0W_72R+5<&C1':K8H-PONDAE=\((8J6,`J36 +M8I(&J@VL:_IEQL7Z)<'$<%$LVU@OM%+T^4>%O+:>%T5IZ]V=*L?5*YHTO:<> +M?4#&?B=(60TZ=I4692P['55L1E.,J$B"D81$FB"-)7SQR\7:T98TFWZY[:2( +MS2=AV&[6"0'EG68\-R,**9]VOY&OM):,!&TA"),\C#&;&)O4ENT.$76HD=(A +MTU:/S&?9Q$_Y\]P&+2G_+X-]%'WO$,"E*$.3:OS>2C6V/Q[C?RQ'1Q?I6/F> +MHVP2]J4B#D/-$2ETE]8-:T<`U(Q<(YA[!:"S9K8M,MB`>CCN$^#($IZT"HZ1 +MQ<-^HG/_XMC9F#^O,WU>ZS<6N'X$L&H<6TC&6EB=LK_JS,LA?YN_A%.>N9P" +MKI*R#[0OIY*+Y6.-"6!1;'N"^\B4?:`V/E<=S_+(0^\Y;_;DD/M,O[G.=MGH +MPLHCOYNE>S5?X6:Z>H:+=,;?3.?K:5VO]6O]8:T)8`[,*@"SF@5F^9;G;2@. +M^1!GN=7\:^TRS0QP3%FM^^H=7LQI>94C?CF-&Y?5)D]O]>\=$K@W"."P+T". +M\Z,3/&]919PT)W[VPAZO?#/?KM[V+]9V<=`H>$CQ3QUG,U>'X=X@`$ZSZF7R +MP^LC@\LHU")D_:C,3?G[LLV3XZW[41$4UH<@SA[6F`"6](KKDUWF>4S]2Y7J +M1B<6E@FC&Y,TSFG9E$545>&<-WYG&3L^SDU/B$5:WZMAS''-8[I)<%)NU@EK +M3``GQ1'CZ)-]A&:[Y0E4Z%44]41/GOL;/U[95B9*,V5/#__3&JL;YY@`6.Q7 +M-H,U^5`L\2-:C3`51D`]].]G+N?'>D3UHS67_W4D@!-6]R']]47CQ +M=\0#9['"SYN%HZS<.M%4-WGVP?2APCD\_HZ!X_RV/A'YZ+NL)Q6L(0$4.(:] +M>1%?T*01H5$IF9+=^03Y^!D\YK5'$>.D'\SPR.,-^1W,U.*I;>X:6O`/S@;6 +MF``BEHVCQN5GO_:L8HY<3R/Y]2QXB4@`LWKE+>L9)69O0DZNR,QF%3S2(W#, +MT?`P)Y_E8[J_GL[XF\/L_N.SI4=O<;1^-1T/2*FG8_/>1H77#O$\"X6]GD@Q5AVOS;&:X[SKV7 +M^+.C400O82&R<7J:13T/4\JXQEA#`CC]#V$NZ%%_/,(K;AFNS%/U_/EPU)M8 +MM=7^9-"Y3L]>"V<;:T@`XSC*^E[;GS8[;\+AU'-'XA`+^Z28!2=9:'*10^YE +M?J9D[<`]CWY(:3>3B7^9](>EDLJAA9WRU\E5L(R*/QW<`P2P("R,R"=8QP]S +M6C^S."JS:U68!93WWBLQG%<".&[+/MN\W$..YPU;MK+"S?;S6;*_@/*MKZ"M +M7\[O?0*8U,T^KOOG48XQ(S-O=&0SX>"X&5D`9`::.&I"PR'1AHXDBOGMYR<9 +M:)O7Z6C6.YX%P^1)<6\3P*'O5.:X]A2SN>*[C-SQQ+=<='2`TZJ)>Q?W``$< +M]W7/Z`Y[;!P6CFLA=S[67^?'`H8)9HW#M:CG+A+KW\@?BGN``(Z!E7Q;,X7P +MF8HCA?R,R,?$(HZ82R;U!V:;>'`FBJBSG5Q7GEAO`I@_QO3BGW74.']]B9IC +M%..P7RUJE/*PZV:[?(9"'AMSU,[29O",&H#/!#$M".M-`,=]$XMTR3URJNPI +ME7'!.):[PE(7)CC5('#W#-:;`.!L?T,+N/_Z$,BQ5*13+L#1HJRS7[J66'\" +M6&9(YA/?LF8(G+<)7?)R-T?.YSG6=(3QFQ\JSVGXF<4:T@`ZU;],WH0KGLQ +MU[)PZ]EJ+Q)K2`"+PG'6D3KF-3,];X$?XSQ%.[V`Q,Q/,]=5%7`LXO`B +MGWL//&M&'YFE/'?]0W&<#=Q#!'#,SV'AY#W#T1BU4<4;:%%/O(I<66 +M*Z(RY_GC%>V@:GA&?1:/A97I+K_TC5\F7_X3W^].N\`1$6<5O_S^_\%^Q4__ +MRDIE9'4:@,@7K;)@$1%K!Y&O6/4CD]653=Y'>GW5Y8N(6!N(R(>`_W.5SUR) +M!O#+[_G*2QCYVE46+")B[6#D*W_Y/5_Y^E4^_)7WOJ.YJFD\]QR#-&.8.,?(7?O7]7_W6DTG?;%BN!B#F+P$/=0<#`B+"[ +M.X`;+RZ[3!$1ZX4;+]+KYTC0E!40(]_X:Q]\Y]+[RTLC@%_[T+M>@\B7YT[I +M#5-$!$1I?^+9X#I]!E2OF&(Z[:30?>H:J@X1'W^HW1^`R`5$OOED4G@TED8` +M8N0]8L3N]P8@@HC0VK#N!VZ_2V>E@C)<1$=\-$".(D0\M +M^_%+(8!?__#7"B+O0X1V;U`6;&/3L+N3HB^^P*DS;TPQG8&D+UYGD"G&FE). +MTLS1'V8@\F=^_<-?^\4GE=)&H(86\J)"$$+,(@Q'SRQ0!Z")1&`-_ZUNP/JI3+6 +MTMJTW'FE"R_?6F:Y(B+./EZ^17NOC[468\R(K'3[0W)5Q,@[?^.__?I/6586 +M%CX,^!M_^Z]=!K[&J=+M#Q`CY=^,M;0V++L[&?KB=>31QY95KHB(,P]]\3J# +M%)J;%C$Z(BL`[6Z?*Y>VF\"3P#]81AX6K@&(D;\F1K8ZO8$?SI#*N&&LH;5A +M486=/[T&6_H%&DV#"1I`759$A/U.'T00(]_ZF]_^[J7X +M["R^"V#,^S"&=K=_H$#&6&PCH=FRW+W3AY=O+J-,$1%G'[=>8F\OI=%*0E]? +M#LA+[AR]P1",>0)CWK&,;"R457[K.[_ILX'/&Z89PV'FQ_YK,,9@C*6Y8=G; +MSW#/7\,\]MKE57)$Q!F%>^%Y!BEL&A-&`,P!>0'8[_39WMX$[QGX"XO.QV(U +M`"/OQ0CM3CF..99,V0T`X>[3UR%-.75U+*:85IG2E-UG;XRJ_Q/E1>@/AF2Y +M`R-?^EM_]YO?O!`YK6%A!/!_?]=?+R?^=":H_[X+X`F@N9%@$\/=NRG<,-U]D=R^GN9'XUM]4&L"DM-_I(49$C"Q\;L#""$#$?+6(>:C7'Z*JDPMC +MO!W`6$NS96EWL2%H`19$N'OU!@SZI_Y28HII)6G09_?: +M31I-BS%VJ@&PGE25;F\`1N['R->%5VDT@_'/ +MABZ`0.D&?`C:^UT>>.@*^"'!)Q>1I1-K`&+DB\7(FP:#U$_\F3*<,=+/*?T! +M?$7A3KL'QFQBS+><6'8Y(0'\]@]^\+*(?(TJ]*:,_8\7H.X38!-; +MJD-W7K@-^WNG_I)BBFDI:7^/G9=VL-:0A&_>SP`L/`!G:#Q%Z.QWB_T/_O8/ +M?E!.(K]P4@W`F'=CS&:OVP..9C`)_9Q""S#&VP&,,=S=U]@-B+AW<>,:NUWQ +MQK_"^:?L`G"D$;!(698S\/,#/@UCWG[2;)W(""C&Q_SO[/<.'<*H?@!"*+`Q +MP2$HP=B4_B"G]]33;'[ZGUW5*XF(6!GZ5Z\RR.#RQ<0[PY7>?^"U!&:3(:"] +MUV7#SP_X(/"K)\G7L36`W_FA#W^V&/G/LC0C#4$_C^X"%,)?.05Y`K"^&W!S +M%W;O<.KJ6DPQ+3+MWF'GY7;0>,_\T(A\QA_`NJ3E%04\X-L*$;8+FSK_#B?8Z1J21D*2 +MC,[])XP``#/+$7A;`&(2Q'SKL6688Q+`[_[(WPH3?Z#7[AXY?%&D$98SM?A]U.G$>\_0?@Q1$8)Q7BS:2S&&7C4D,>,(`$'=&9T#.[3Z77GD) +M'CZ1@3,BXG3QRDO\4,>:]8@S=_<[<*DLH)F47H*8!%(9`8PUW.XJ^\,S*WE-$Q#*@ +M+SSCU7_C_5W$V)%Y,1XU(^"<\B0B]/:[_K?&?//O_\1W7I@WCW,1@!CY$C'R +MQF%_@,ORN5664-Q*]2FZ`L$M.&EX)PGGA-VGKH)SG+H:%U-,QTG.L7?U69P* +M-O'3W^O3?ZG9Q6KR-;],J=)K]Q`C5\3(N^>19YBW"V#,DP"]W;IOM^R^![P;\Y#R_G5D#^.@_^Z[+(O(N565P5."/P[H`4OX7SM?"A(48 +MZ<88=CN*>^'IU;VPB(@%PKUPE;U>Y>U:COT7L_]*;:'"<61*1,@&*6E_B(C\ +MN8_^L^_Z@GGR.;,&($:^`=CL[W8]X^]0P/ +M?&X&C<8*7UU$Q`F1INQ>O88BH\-_IC;\)\'Z=T(C8('>;IO6]@9X+>`CL_YN +M=AM`6/&GO]LY5E^E/M&A,G^$OE`Q.]`:&F%VH+&6.SLIW+S&J??G8HIIGG3S +M&CO[#F,M23+N_FM*+7A_Y +M;#'RY[-A2CH84IN_.%\:QX%`(99&LPJ6N-M1\FN?G+4L$1%G`OFU3[+7E\J_ +MI9CY%R;_3&WICRM7X7ZA<=X0(^^=-:^S:0`B3R)"?[=]['[*@4(7GH%":1PI +MAP/#V@&(X<[5YV$XX-19/::89DG#`3O/74>D9M>RA?#7EO\JQ:&2BY/(EHC0 +MV]DO".';_O!GOG[-/_#FL"U`4N^P"U-V"FQ:; +MV+)+<'LW@QO1-3AB37#C&>[N*V(+C79L^`^9J@&<1+;$"'F6,^SV$6/>*,9\ +M^2S9/=((*$;^"O#`8+>#.G?BX;\#]Y?"#YIRS8!&*V$X-(BQ['53TF?_E,;K +M_\RR7UU$Q(F1/?<4[8'0:%F2IC=JBS&UX3_`K_-SX+>+D*W>W7TV+FV#-P;^ +MXE'7'ZTFA`4_^[OS>_X=V@6`2ONI.0098V@VBVZ`9\[;SUZ'?H=35^]BBNFP +MU.]PY]H-K_Z;2OTOEOXJ+YV"D\J7B#!L]\BS'(R\X^/_^S]XW9'B?=@?__AG +M?^"U(O)E+G,,CSGV/YD`QOH]C!H#"\-)$3KI]EX&+SYSZN\WII@.32\^P]VV +MEB[M=0<@:ET`IG4!%D``(D+_[CXB8D3D`QR!(S0`\QXPIK_3KKGM+L8&`%"H +M0;Y>*@W`)EY]*DB@W7,,KO[)&7C#,<4T/0VO_@G=@2#!B-UH)J5MJ^K_PV3Q +MY\3R50X)[K1!!3!/_O'/_L/FH1(^[0__Z=_^H(C(^T2$P<[^0IAI*D:&`ZNE +MP\3:8$&UO'KM)>CL$A%Q)M'9YK87P5^/_$QK^L>-%:0#J'`,_6_=A +M$?G:P[(]W0@H\A>!-Z2=GI_XLV#C7^TYH2Z$\7D!X]V`UUQ_&C[]SR_[549$ +MS(\7GN9.F^##8FFV&B.Q_PX.@S/B!0@L5,;Z=_?8N'(1O#'P9Z9=-Y4`1,S[ +M``KU?UD0_S!O%S4@+M@!FM7T8&,LG?Z0WD<_PN:?_,[2\A(1<5STAX[>$)H; +MMOI^#ZC_>D#HZUBDG&6]`?D@)=EH?>&?_/S_^-F?\5>^XX\F73>Q"_")7_A' +M5T3D7>J48?OXKK^'V@`.J#_4/`)-V8\>P/37OF%`U`W@UL#O?:X7!9ZO_!`^\9&,*$-1OT +M[:`TJKQPJ\?5:[NDPP'9<(C+,IS+<4Y!%>7@!(N((U"\@UAGDR'%QEOO"I=U +MFR0DC09)LT5S8X/FYB:MS6;I_%,:_VIK_P&'U_."Y6RPU^;"(P\AQGS3)W[A +M?_H[;_G+_]W^^#43"4!$G@3H[^XO3?;':]G7D92NP3+F%ERE:EDQ-0911<05 +M@56I=B(.0T&6R^S>W3/P_=010W4AX+Z;:H.MRE9A[FO1?ZLZ/IQE%_XJ5!GL +MM=F\[_(%X)N!_WG\D@,$\*?_QP^_%7A;/AB0#P8K^4!$@F]4,1P8'"F21N+= +M@H,=8)0(K%\=114#J#I4!20V93,A5)-(Z`7&>CL$U;=9"GKHIAY(84*;E$M_ +M!GT:6YN?^"9TD@U+V"C@>F%RDY\49H +MG@-@BV`K@1`B)J#H`M0,U$FC47Z/-DE"PU0;_AM9_JNXR5%=@.7(VV!GE\;6 +M%O@AP>D$(!(F_K3;L(2)/[/4LXYK`*T&UB:X),DS0:OJ57K5R'LQSG'*JN(H#(`$L-UJ0$$J9>Z\$\C@B7*W&!OC\T'[F\"3P(_ +M4)PO">#I7_S1)X`O=6E&VCW.HA\+JNW2(U!0:[%.:6XTR=(L"+IG4F,,N;6X +MI$X`E74[XG`,0A>@N;4-@*;]T\[2F44Y!%@&L/5=TJ21>`)H>DV@N=$,FL#\ +MZC\L=T1FL+O+U@,/@/#^IW_Q1W_PS5_Y-W,8T0#,>P`SV%NQ\:^JY5`)86L, +MHMY(U=IL,NBG%8$:\2\A\Z3@G&_]2R,@1QM"\HP_V]%8W]%Z4>K6LM*AO?RJM56AM-;#(H*\E8@[4)>9*'+H$K +M;0!1[F>#Z?H6O[7M%Y-Q]K1S='91[P)X^Y0MOT%3&@(;WA'(VI$Y`'Z`>\;G +M+%GN!KL[-"]>!#\D6!$`(E\"O"'K=G%9MOR<'%X-)1.*`8/_,EL;+0;]JA_F +M;(XMA-\%+\!2^B,-'`7;]+-$2P*0:`2_Z![Q3\YRL=I3.,:IY*J:$6L2N"8;`9U/]2 +M2P!&S?Y'R]4J9&^XO\?6@P^!F&]YYE=^\KL3D3#QI[V_LDP<61%0KAI4Y*G1 +M$FS#XG)!C8+:8/0KA#\*_CP0ZWM_29+;G1/4M0!J=@%#JQ7_OGH%)-!53UI<.*_[6;#48]K.:RV_= +MZ!<)8!Z(]7,`;!($/YEOG=CSB5%[0+%-&C:T_M5EHL>89KDB^1ON[="Z=`7@ +M@\D;OO3)E878T9_[]KFDM*CD8J)0L]4@'?H)0)5R%8?\CH-B$I!)O)%531P& +MF`GEN'ZUZQ?_E+%+YO\N/_>#_VCE3?`:T'XUAZK9M'0+S:#V]]/77-8/!;D: +MXXG`F=F7B8RH0:#12LJNP;KYH*P!`5`.CQ@K)`U#GDVKX36J^=-&.=0:-($5 +MNWZO'R;7CP@T$EN?-,`Z?8?K00`U7+JR>=I9N#?PM-](!!`1<8X1"2`BXAPC$D!$Q#E& +M)("(B'.,2``1$><8D0`B(LXQ(@%$1)QC1`*(B#C'B`00$7&.$0D@(N(<(Q)` +M1,0Y1B2`B(ASC$@`$1'G&)$`(B+.,2(!1$2<8T0"B(@XQX@$$!%QCA$)("+B +M'",20$3$.48D@(B((!!`1<8X1 +M"2`BXAPC$D!$Q#E&)("(B'.,4R(`!:5*]?.C)VKG(Y:#:74><3Q,^W[UX*%. +MNWYU2%;[.)U^K`HR]C?%GU/AM"OJ7H-JJ$\M3YQVENXA:*C/L3H=J6,]\)/3 +MP(H)@%K%E%]>)?SC?ROD7N9_3,01T%K]CVPC3HSB.]:Q5/^;/V`J6:P(JR6` +M>JM3KQBI;>L$4&H`IU(W]S1TY(,D:@`+A8XU9F."/D(,IYO3U7RNI@'4]T=E0$^)@$]!`R@JQ?BMB!=\ +M%5]!@!=^AV_^"_T_]@,6B9(`H@:P8(RI^EI\[Z[:9_SXO'0!1H1?QYAQ7,"% +M2`#+0T4`8]N($^(P`G"C&H'6_WX>".!`H:42?"!+[9JH!"P4F@6!+P0_:@"+@=9V +M#AC_"N'/)V@!YT(#&&_]F=#ZRVCK#X!$`E@P7)[YG:@!+!9U[[X#(P%U+2`_ +MJ`6<`DZ!`/+1D3Y'$/PZ`801`*D9`2,!+!0N"P10"+[+3CM+]P;&-0#&[5[C +M).!3-2R[6IP"`=3Z_0>$/PP+BJ%J]>,HP#+@TC$"R*,&L!C4/5R+K9M"`OFH +M/>`4L'H"*(4_N/^6@F]JPN\J]3^.`"P%>:D!%-OTM+-T;T$/ZP9H31L.=H%3 +MZH*ME@")OJM:_KOI+;/V7!9<&@2\U@-@%6!PF^`(MDX!:Q>`T#Q_8!BJ&]&U3]RP4*1IW$48"G0"0?3N@(C9'`> +M-(#2[73,T6>2X(^,`$0L&@>&`:,-8`FHC03`X41P/C2`HI!!X%6JB#\C7G]U +M]]](`LM`20`ZYA$8L2",1;LJSI7"/WY\+@A`:U.`&=4`%,J6O]B/6!JB(]"J +M4`^]-DD3\,=Z/@A@RAQ_+;H`3!;^R`4+AXY/!HIS`18'G7*B)($)T9BM#M])902LC@,>;5JI(*#7!K_?UR^,ZXFS`9:"<#5CT/4^I#WKO8E+0SPE> +M@E#:`E1)'F^:W")Z;9BOY*M?2=OZF9M6.CD&($S$)N!;5@K(BQ@DG`6$,1)VSI6`D!/-B`U`D.7*XXIPQS!*=D#NTY,%H- +M`TQU_XDL$+$.T.GGRPDP!E5!F#Z\1#`XY4GM6LG09"Y*6#2*YR72HY#/=.>RYSW6M2S +M5W7?6^ZDUZXZ: +M.Q`''`,B(NYIU,8#42V7QO*-HEFA&*SL25_W2#7'K_;L*/@1YQDC1%`_]Z]O +MK:93NU+!^_I'#CPO"GY$1*VKL"K!+W!J`CB!#"(BSB56+?01$1$1$1$1$1$1 +M$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1 +M$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$1$:>(_Q]#*AH3%39B$0````!) +M14Y$KD)@@@````````````$`!P`0$````0`(`&@%```!`"`@```!``@`J`@` +M``(`,#````$`"`"H#@```P`0$````0`@`&@$```$`"`@```!`"``J!````4` +M,#````$`(`"H)0``!@```````0`@`'$]```'`,`(RI``````"P`;`"\`6P'@ +M``````!7`&D`;@!2`$$`4@`@`',`90!L`&8`+0!E`'@`=`!R`&$`8P!T`&D` +M;@!G`"``80!R`&,`:`!I`'8`90````@`30!3`"``4P!H`&4`;`!L`"``1`!L +M`&<`(``R````#@@`4``````&``D`/0"Z`&P`__^"``````````"``E`````` +M2P"2``@!"`!E`/__@@`F`$0`90!S`'0`:0!N`&$`=`!I`&\`;@`@`&8`;P!L +M`&0`90!R``````!"`"%0`````$L`G`#$`!@`9@#__X4````````````!4``` +M```6`9L`/``.`&<`__^``$(`<@!O`"8`=P!S`&4`+@`N`"X`````````1`BA +M4`````!+``D`"`&#`&@`4@!I`&,`:`!%`&0`:0!T`#(`,`!7```````````` +M$```0`````!+`*4`"@$!`&D`__^"`````````````E``````2P"L`,0`"`!K +M`/__@@!)`&X`0!O`'4`(`!L`&D`:P!E`"``=`!O`"``<@!E`'``;`!A`&,`90`@ +M`'0`:`!E`"``90!X`&D``%T``````%(`90!N`&$`;0!E +M````"`!-`%,`(`!3`&@`90!L`&P`(`!$`&P`9P`@`#(```"``(%0``````8` +M,0"1``P`:`#__X$``````````0`!4``````6`$H`,@`.``$`__^``$\`2P`` +M``````````%0`````%,`2@`R``X``@#__X``0P!A`&X`8P!E`&P````````` +M```"4``````&``L`D0`(`&4`__^"`%(`90!N`&$`;0!E`"``9@!I`&P`90`` +M````@`B!4``````&`!8`D0`,`&8`__^!`````````````E``````!@`F`)$` +M"`!G`/__@@!T`&\`````````!P``4``````#``(`F0!#`/____^````````` +M`,`(R)``````!0`F`"X`MP!#``````!%`&X`=`!E`'(`(`!P`&$````````$P`:0!C`&4`;@!S`&4````( +M`$T`4P`@`%,`:`!E`&P`;``@`$0`;`!G`"``,@``````#@@`4``````&``D` +M/0"Z`&8`__^"`````````$0(`5``````2P`)``@!N@!E`/__@0`````````0 +M``!0````````R0!=`0$`_____X(``````````0`!4`````#3`,\`/``.``$` +M__^``$$`8P!C`&4`<`!T`````````````5``````%@'/`#P`#@`"`/__@`!$ +M`&4`8P!L`&D`;@!E````````````P`#(D``````'`#L`2P#"`(L``````$X` +M90!X`'0`(`!V`&\`;`!U`&T`90`@`&D`0`@`&$`9P!A`&D`;@`@`&\`<@`@`'``<@!E`',``!T`'(`80!C`'0` +M:0!O`&X``````````0`!4``````J`'<`,@`.``$`__^``$\`2P`````````` +M``%0`````&8`=P`R``X``@#__X``0P!A`&X`8P!E`&P`````````/#]X;6P@ +M=F5R7!E/2)W +M:6XS,B(O/@T*/&1E&UL;G,](G5R;CIS8VAE;6%S+6UI8W)O +M51O:V5N/2(V-3DU8C8T,30T8V-F,61F(@T*("`@("`@;&%N9W5A9V4](BHB +M+SX-"B`@/"]D97!E;F1E;G1!3X-"CPO9&5P96YD96YC>3X-"CQC +M;VUP871I8FEL:71Y('AM;&YS/2)UV4R,#$Q-#4W+3$U-#8M-#-C-2UA-69E+3`P.&1E964S9#-F,'TB+SX-"B`@ +M("`\(2TM5&AE($E$(&)E;&]W(&EN9&EC871E&UL;G,Z87-M=C,](G5R;CIS8VAE;6%S+6UI8W)O +M3X-"@T*`````````````````!D`4P!E`&P` +M90!C`'0`(`!D`&4``!T`'(`80!C`'0`:0!N`&<`(``E`',`"P!3`&L`:0!P`'``:0!N`&<` +M(``E`',`&0!5`&X`90!X`'``90!C`'0`90!D`"``90!N`&0`(`!O`&8`(`!A +M`'(`8P!H`&D`=@!E`!\`5`!H`&4`(`!F`&D`;`!E`"``(@`E`',`(@`@`&@` +M90!A`&0`90!R`"``:0!S`"``8P!O`'(`<@!U`'``=``7`$,`;P!R`'(`=0!P +M`'0`(`!H`&4`80!D`&4`<@`@`&D``$T`80!I`&X` +M(`!A`'(`8P!H`&D`=@!E`"``:`!E`&$`9`!E`'(`(`!I`',`(`!C`&\`<@!R +M`'4`<`!T`````````"4`5`!H`&4`(`!A`'(`8P!H`&D`=@!E`"``8P!O`&T` +M;0!E`&X`=``@`&@`90!A`&0`90!R`"``:0!S`"``8P!O`'(`<@!U`'``=``> +M`%0`:`!E`"``80!R`&,`:`!I`'8`90`@`&,`;P!M`&T`90!N`'0`(`!I`',` +M(`!C`&\`<@!R`'4`<`!T`````````!$`3@!O`'0`(`!E`&X`;P!U`&<`:``@ +M`&T`90!M`&\`<@!Y`!0`50!N`&L`;@!O`'<`;@`@`&T`90!T`&@`;P!D`"`` +M:0!N`"``)0!S``X`0P!A`&X`;@!O`'0`(`!O`'``90!N`"``)0!S```````` +M```````0`$,`80!N`&X`;P!T`"``8P!R`&4`80!T`&4`(``E`',`%P!#`&$` +M;@!N`&\`=``@`&,`<@!E`&$`=`!E`"``9@!O`&P`9`!E`'(`(``E`',`2`!# +M`&@`90!C`&L`0!P`'0`90!D`"``9@!I`&P`90`@`"4`0`@`&$`;@!D`"``<@!E`'0` +M<@!Y`"``=`!H`&4`(`!I`&X``!T`'(`80!C +M`'0`:0!O`&X`+@`\`"\`;`!I`#X`/`!B`'(`/@`\`&(`<@`^`#8`/`!L`&D` +M/@!5`',`90`@`#P`8@`^`$(`<@!O`'<``!I`',`=``L`"``:0!T`"``=P!I`&P` +M;``@`&(`90```#(`8P!R`&4`80!T`&4`9``@`&$`=0!T`&\`;0!A`'0`:0!C +M`&$`;`!L`'D`(`!B`&4`9@!O`'(`90`@`&4`>`!T`'(`80!C`'0`:0!O`&X` +M+@`\`"\`;`!I`#X`/``O`'4`;``^`````````!8`5`!H`&4`(`!A`'(`8P!H +M`&D`=@!E`"``:0!S`"``8P!O`'(`<@!U`'``=````````````!T`10!X`'0` +M<@!A`&,`=`!I`&X`9P`@`&8`:0!L`&4``!C`&4`90!D`"``)0!D`"``8P!H`&$`<@!A`&,`=`!E +M`'(`0!P`'0` +M:0!O`&X`(`!M`&4`=`!H`&\`9``@`&D`;@`@`"4`0`@`&X`90!E`&0`(`!T`&\`(`!R`'4`;@`@`'0`:`!I +M`',`(`!S`&4`;`!F`"T`90!X`'0`<@!A`&,`=`!I`&X`9P`@`&$`<@!C`&@` +M:0!V`&4`(`!A`',`(`!A`&0`;0!I`&X`:0!S`'0`<@!A`'0`;P!R```````` +M````!0!0`&$`=0!S`&4`"`!#`&\`;@!T`&D`;@!U`&4````````````````` +M```````````0`%,`90!C`'4`<@!I`'0`>0`@`'<`80!R`&X`:0!N`&<`2P!0 +M`&P`90!A`',`90`@`'(`90!M`&\`=@!E`"``)0!S`"``9@!R`&\`;0`@`&8` +M;P!L`&0`90!R`"``)0!S`"X`(`!)`'0`(`!I`',`(`!U`&X`C)[,W$TLS4!-A8Y2SK#.O`Z'CV4-YLWM3=8.)DZ6#M*/',^?SZS:#-I(VF#:C-JHVPS;N-@8W"S>9-\0WW#?[-RXXB3B=.5@\>3RP/-4\ +MW#S\/!$]&STJ/8\]SSX```"````H````$S`M,#@P5#+V,JLS#C5D-0HW4S?% +M-^LW>#G0.@$\]ST`D```9````-\Q4S.V,W@T<37A-0HV*3:M-C0W=#>^-_PW +M#CB-.*\X2#E].=0Y`#H8.DHZ:3J:.K`R#C,S,V$SFC/&,R,T5C1S-$8UBC4+-A(V339^-K0VZC:, +M-YTW'3A3.%\XASB3.&(Z"CLL//T\83WJ/@P_)#\I/R\_-C\\/P```+```#0` +M``#-,6XR'#-:-(\T738%-Z\XZSCY.!LY3#F?.=TZ0#MQ/'H\Y#S_/`X]*#T@ +M/@#````@````>C1@-F@V?C:_.10Z+#HM/5,](#_4/^,_`-```)````"8,*

    4-\0WRSA=.60Y:SER.<\Y-3H_.DPZ^3H7.QX[;SO@.P,\ +M,#TW/3X]6CUL/8X]SSW6/1P^*CY6/F(^`C\C/R\_4S]R/WH_A3^R/P```.`` +M`"`!```;,"0PK3#`,,DPZ3`&,0PQ'3$C,3`QF#'Q,?@Q_S$&,@TR%#(;,B(R +M*3)+,E(R63)@,H$-YDWH#>Y-\,WY#?K +M-_PW"3@>."4X,SA!.((XGSB].-`XW3CO.`$Y$#D@.34Y2CE9.68Y>CF'.9$Y +M"CL5.QP[*CO^.PT\'#PK/#H\M3S$/-,\XCQ?/7\]6#YH/F\^=#Y_/M,^W#[G +M/@P_%S\-2DU-#4_-4HU +M535@-6LU=C6!-8PUES6B-:TUN#7#-\U^C4%-A`V&S8F-C$V/#9' +M-E(V739H-G,V?C:)-K$VS3;?-OXV5C=L-Z\WQ#?M-RSF..=`YVCGJ.0$Z!CI".FPZACJ?.JLZMSHQ.ST[13M* +M.WT[BCN5.YH[ICNR.\0[T3OR._D[7SR3/-(\W#SQ//@\)3TY/9(]I#VU/<4] +MU3T//EX^!3\3/]\_`!`!`)@````#,!DP*#`V,$0P1#%+,6$Q9C%*,M4RL#._ +M,\,SQS/+,\\STS/7,]LSWS/C,^SZ//JX^ +M]S\````P`0`4````#S#*,#LQ0#&E,0```$`!`!@```!I,H0S)#6'-;PU$#9- +M-ETX`%`!`"`````E,4(Q6#%Q,9@VGS9_-X8W$SP:/%(]63T`8`$`#````-DZ +MJ#T`@`$`:````)LP^#:Z-^HWFCC<.%@Y.:\Q,3([ +M,D$R4#)O,I$RKS*Z,M,RYS+[,EDSC#.L,^HS!307-"LT/S13-&@T@32.-)LT +ML#34-.$T[C06-2(U+C4U-3PU2#5Q-7LUF#6H-;DUSS7A-?DU'#8B-CHV1S99 +M-FDVV382-R$W/3=*-U$W7S=K-W0WY#?T-_DW#CAK.+`XQ#C7./0X`3D).0\Y +M$SDS.4,Y5#HN.TL[6SMO.Y<[HCO..PH\.CQP/(@\DSRV/)`]RCW/_(_]S\`L`$`H`$```,P##`@,"@P +M-C`],$,P2S!2,%TP:#"),(\PM##F,`DQ&C$P,4$Q4C%E,7$QE3'_,0HR$3(9 +M,BDR-#)!,DXR6S)V,GXRE#*G,K4ROS+%,N(RZ#+T,OTR"3,6,R0S+C,_,T0S +M43-8,UXSV#,'-#$T2317-%TTG32Z-.PT_#0'-1,U3C5F-7,U>36,-9,UHC6N +M-;HUQC77-=TU\#7Z-1@V3C9B-G8VBS:4-K4VSC;T-@0W)C9-Y\WK#>U-[XWR3?=-^,WZ3<#.!$X%SAC.&PX..DX^3@$.0DY#CD5.24Y*SDV.4(Y63EL.7(Y@3F,.98YGSFM.;@Y +MQ#G-.=,YVSGF.?(Y_#D#.@DZ#SH>.BHZ-SI$.F#J%.K@ZS#K:.N8Z[#H( +M.Q([*#LP.S8[3#N8.P,\#CP6/#(\.3QS/)0\JCS`/-X\[CP*/28]0SUI/7`] +MNCW,G`RAS*D,KTRT3(-,QLS)C-',VHS>S.Y,\TS +M831L-(PTE32>-.$T7S5^-8XUG#7'-=(U^34$-C,V/#9"-DTV4S9X-GTVB#:4 +M-J(V!3<8-S0WFS>Z-]LW]S<#.`DX%C@D."\X0S@V.3TY0SE2.5LY93F+.9DY +MGSG@.?0Y"#I&/%8\#CT;/64]:3UM/7$]=3UY/7T]@3V%/8D]C3V1/94]F3TN +M/C0^1CY./EP^9SYL/G4^>SZ+/J4^Z3[W/@8_+3\R/SP_:3^=/ZH_LS_!/\<_ +MS3_6/^4_`-`!`#@"```3,#\P1#!;,'(PAC"O,+8POS"H,;(QSC'@,1,R*#(Y +M,D8R4C)C,G(RCC*<,J,RJ3*T,KTRS3+A,NDR0S-5,V(S:3-P,X,SC#.5,ZLS +MLS/.,],SWS/D,_$S`#09-!XT(S0H-"TT,C0Y-$`T1C1]-)HTJC2^-,@TW33Z +M-`4U,#4Y-58U7#62-9@UL37+-=PUYC7P-?LU(38G-BPV,C8X-DTV5C9>-F8V +M#=^-X0WDS>C +M-[`WQC=Q.'`YZSGQ.?/"@\,CP\/$8\4#Q: +M/&0\;CQX/((\C#R6/*`\JCRT/+X\R#S2/-P\YCSP//H\!#T./1@](CTL/38] +M0#U*/50]7CUH/74]@SV-/9<]H3VK/;4]OSW)/=,]X#WN/?@]!3X3/AT^)SXQ +M/CL^13Y//ED^8SYM/G<^@3Z+/I@^ICZP/KH^Q#[./M@^XC[L/OD^!S\1/QL_ +M)3\P/T`_1C]0/V(_?#^"/Y$_F#^A/Z<_K3^V/[T_Y#_Y/P#@`0#<`````#`& +M,!`P&3!-,&@PLS"Y,,DY]CD=.B4Z/CKH/!$]A3VS/<0]R3W. +M/>\]]#T!/F\^_#X@/S@_/C]5/W`_C3^B/[$_SC\`\`$`U````!`P'C`Y,$0P +MS##5,-TP)#$S,3HQ<#%Y,88QD3&:,:TQX3&,,JLRM3+&,NPR!#,*,U,S:#.# +M,X\SGC.G,[0SXS/K,P0T"C0Q-%$U)38X-K`VA#>7-[4WPS=Q.:@YKSFT.;@YO#G`.18Z6SI@.F0Z:#IL.LL\ +MZSPU/4T]4CV]/<`^T3X``````@`,````DC4````0`@!T````FC>>-Z(WIC>J +M-ZXWLC>V-[HWOC?"-\8WRC?.-](WUC?:-]XWXC?F-^HW[C?R-_8W^C?^-P(X +M!C@*.`XX$C@6.##U\/8`]UCT; +M/B`^)#XH/BP^`"`"`$P```!O,>C.`,YLSPS/7,_,S +M_3,'-!4T,#1!-*,T4#5H-6XUBS6P-6PWHSOY.YP]]3V$/M,^]S\````P`@"$ +M````=3*!,I@SP3/=,_TS"S02-!@T+31`-%0T8#2<-*PTPS3+-/4T$34@-2PU +M.C5<-6PU<35V-9TUIC6K-;`UU#7@->4UZC4.-AHV'S8D-DLV5S9<-F$VD3:9 +M-IXVKC:X-MTV[S;[-@4W%S<<-SPWH3>M-R4X/SA(.)-6(U9C5J +M-6XUC>!-XTWH#>E-[$WMC?'-S$X.#A* +M.%,XFSBM.+4XOSC(.-DXZS@&.48Y6#E>.7(YQCG0.=8YW#E'.E`ZB3J4.HD\ +MO#S!/.<]_STL/DP^7#YA/FL^<#Y[/H8^FC[K/H\_HC^Q/](_````@`(`Q``` +M`"LP-C"%,)TPYS!],90Q$C)6,F@RH3*F,L$RS3(!,Q0S43-@,V4S=C-\,X4U\C4#-@TV$S8G-C,VK#:U-N$VZC80.!8X*#AF.&PXF3@&.0PY +M?SF%.9LYB3J3.J`ZTSKE.A4[,CL].X\[ECO:._0[#CP^/'$\A#Q[/;$]SC[J +M/CH_BC^[/^L_`)`"`'@````V,#(Q1C'.,8#R0/)<\M3RA +M/KL^RC[8/N0^\#[^/@X_(S\Z/UT_@#^-/YL_J3^T/\H_WC_F/_$_`*`"`-`` +M```',$`P<#"+,,8P_3`/,44QZ-\HWX3?I-Q`X*3@X.$0X4CAT.(8XD3B6.)LX +MMCC`.-PXYSCL./$X##D6.3(Y/3E".4$Y[#GQ +M.?8Y%SHG.D,Z3CI3.E@ZBSJO.LLZUCK;.N`Z_CHA.RP[.3M..UD[;3MR.W<[ +MF3NG.[8[W3OO._L[6C[_/B8_D3^X/P"P`@"T````P3`[,4HQ7#%N,8HQJ#&R +M,<,QR#'=,1`R%S(>,B4R/S).,E@R93)O,G\RUS(/,RHS/#5I-8HUCS6B-;8U +MP378-0@V'38K-C0V:3:@-M8VZ39[-Z\WUC$Q\S$%,AI-^(W^#<9.)$X8#F4.P```-`"`!@```!J +M,]8SJ3NQ.^@[[SL9/P```.`"`&`````.,!8P33!4,%DSG3:D-JLVLC;]-AXW +M)3<[-U$W7C=C-W$W4SAR.'-4PZ_#H-.Q4[)3LV.YP[ISNR.[@[P3L#/"X\4SQ? +M/&L\?CR=/,@\X#PE/3$]/3U)/5P]@#T`/FL^>CZ9/N(^0S^>/P```!`#`%@` +M```,,"LP7#"Q,>LR!C,<,S(S.C.3-I8WIS>6.9PYH3FQ.<(Y;CIT.M8ZVSKM +M.@L['SLE.]D[H3R^/#(]3CWV/7@_@C^4/Z8_N#_*/]P_\3\````@`P!(```` +M23!3,&@P@S"@,,LP\#`%,24Q0C%4,6DQCS'C,?@Q6#)J,I\RL3+#,MTR^C(/ +M,R0S.3-4,V$S<3.!,Y$SH3.Q,P`P`P!0````8#)H,FPR<#)T,G@R?#*`,H0R +MB#*,,I`RG#*@,J0RJ#*L,K`RO#+`,L0RN#6\-<`UQ#7(-#1\-(`T:#9L-G`V=#8```!0`P`L`0```#4$ +M-40U2#50-5@U9#5H-6PU<#5T-7@U?#6`-80UH#6D-<@US#70-=0UZ#7L-?`U +M]#7X-OPV`#<$-P@W##<0-Q0W&#<<-R`W)##=\-X`WA#>(-XPWD#>4-Y@WG#>@-Z0W +MJ#>L-[`WM#>X-[PWP#?$-\@WS#?0-]0WV#?<-^`WY#?H-^PW\#?T-_@W_#<` +M.`0X"#@,.!`X%#@8.!PX(#@D."@X+#@P.#0X.#@\.$`X1#A(.$PX4#A4.%@X +M7#A@.&0X:#AL.'`X=#AX.'PX@#B$.)@_H#^H/ZP_L#^T/[@_O#_`/\0_S#_0 +M/]0_V#_`UY#7H->PU +M\#7T-?@U_#4`-@0V"#8,-A`V%#88-APV(#8D-B@V+#8P-C0V.#8\-D`V1#9( +M-DPV4#94-E@V7#9@-F0V:#9L-G`V=#9X-GPV@#:0/I0^F#ZP]]#W\/00^##X4/AP^)#XL/C0^/#Y$/DP^5#Y0Q[#'T +M,?PQ!#(,,A0R'#(D,BPR-#(\,D0R3#)4,EPR9#)L,G0R?#*$,HPRE#*<,J0R +MK#*T,KPRQ#+,,M0RW#+D,NPR]#+\,@0S##,4,QPS)#,L,S0S/#-$,TPS5#-< +M,V0S;#-T,WPSA#.,,Y0SG#.D,ZPSM#.\,\0SS#/4,]PSY#/L,_0S_#,$-`PT +M%#0<-"0T+#0T-#PT1#1,-%0T7#1D-&PT=#1\-(0TC#24-)PTI#2L-+0TO#3$ +M-,PTU#3<-.0T[#3T-/@^`#\(/Q`_&#\@/R@_,#\X/T`_2#]0/U@_8#]H/W`_ +M>#^`/X@_D#^8/Z`_J#^P/[@_P#_(/]`_V#_@/^@_\#_X/P"0`P"0`0```#`( +M,!`P&#`@,"@P,#`X,$`P2#!0,%@P8#!H,'`P>#"`,(@PD#"8,*`PJ#"P,+@P +MP##(,-`PV##@,.@P\##X,``Q"#$0,1@Q(#$H,3`Q.#%`,4@Q4#%8,6`Q:#%P +M,7@Q@#&(,9`QF#&@,:@QL#&X,<`QR#'0,=@QX#'H,?`Q^#$`,@@R$#(8,B`R +M*#(P,C@R0#)(,E`R6#)@,F@R<#)X,H`RB#*0,I@RH#*H,K`RN#+`,L@RT#+8 +M,N`RZ#+P,O@R`#,(,Q`S&#,@,R@S,#,X,T`S2#-0,U@S8#-H,W`S>#.`,X@S +MD#.8,Z`SJ#.P,[@SP#/(,]`SV#/@,^@S\#/X,P`T"#00-!@T(#0H-#`T.#1` +M-$@T4#18-&`T:#1P-'@T@#2(-)`TF#2@-*@TL#2X-,`TR#30--@TX#3H-/`T +M^#0`-0@U$#48-2`U*#4P-3@U0#5(-5`U6#5@-6@U<#5X-8`UB#60-9@UH#6H +M-;`UN#7`-<@UT#78->`UZ#7P-?@U`#8(-A`V````H`,`D`````HP#C`2,!8P +MG#FD.:PYM#F\.<0YS#G4.=PYY#GL.?0Y_#D$.@PZ%#H<.B0Z+#HT.CPZ1#I, +M.E0Z7#ID.FPZ=#I\.B`[)#LT.S@[0#M8.V@[;#M\.X`[B#N@.[`[M#O$.\@[ +MS#O4.^P[_#L`/!`\%#P8/!P\)#P\/$P\4#Q@/&0\:#QP/(@\````L`,`;`$` +M`&`Q;#&0,;`QN#'`,<@QT#'8,>`Q[#$,,A@R.#)$,F0R<#*0,IPRP#+@,N@R +M\#+X,@`S"#,0,Q@S)#-,,U0S7#-X,X`SB#.4,[0SO#/(,^@S]#,4-!PT*#1( +M-%`T7#1\-(0TD#2P-+PTW#3H-`@U$#4<-4`U8#5H-7`U>#6`-8@UE#6T-<`U +MX#7L-0PVX-D0V:#:(-I`VF#:@-J@VL#:X-L`VS#;L-@`W"#<0-Q@W'#$-Y`WF#>\-\0WS#?<-^PW]#<(.!`X*#@T.%0X8#B8.+@X +MU#C8./0X^#@4.1@Y(#DH.3`Y-#DX.4`Y5#EP.7@Y?#F8.:`YI#F\.<`YW#G@ +M.?`Y%#H@.B@Z5#I8.F`Z:#IP.G0Z?#J0.K`ZS#K0.O`Z^#K\.A@[.#M8.W@[ +MF#NX.]@[^#L8/#@\6#QX/)@\N#S8//@\!#T@Q]#$`,@PR&#(D,C`R +M/#)(,E0R8#)L,G@RA#*0,IPRJ#*T,L`RS#+8,N0R\#+\,@@S%#,@,RPS.#-$ +M,U`S7#-H,W0S@#.,,Y@SI#.P,[PSR#/4,^`S[#/X,P0T$#0<-"@T-#1`-$PT +M6#1D-'`T?#2(-)0TH#2L-+@TQ#30--PTZ#3T-``U##48-20U,#4\-4@U5#5@ +M-6PU>#6$-9`UG#6H-;0UP#7,-=@UY#7P-?@U##88-APV(#8D-B@V+#8P-C0V +M.#8\-D`V1#9(-DPV6#>(-Y@WJ#>X-\@WX#?L-_`W]#<0.!0X'#A`/5`]5#U8 +M/5P]8#UD/6@];#UP/70]@#V$/8@]C#V0/90]F#V#%\,8`QA#$````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````!287(A&@4*`04&``4!`8"``/4["1PH`@,+@P`$@P`@TF-(B(````QT97-T+G1X +;="YT>'0*`P),FW]/_;C7`3$R,QUW5E$#!00` +` +end diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_solid.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_solid.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_solid.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_solid.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_stored.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_stored.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_stored.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_stored.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_symlink.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_symlink.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_symlink.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_symlink.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_truncated_huff.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_truncated_huff.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_truncated_huff.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_truncated_huff.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_win32.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_win32.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar5_win32.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_win32.rar.uu diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_window_buf_and_size_desync.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_window_buf_and_size_desync.rar.uu new file mode 100644 index 0000000..9e7d20f --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar5_window_buf_and_size_desync.rar.uu @@ -0,0 +1,11 @@ +begin 644 test_read_format_rar5_window_buf_and_size_desync.rar +M4F%R(1H'`0`]/-[E`@$`_P$`1#[Z5P("`PL``BXB"?\`!(@B@0`)6.-AF?_1 +M^0DI&0GG(F%R(0<:)`!3@"KT`P+G(@O_X[\``#&``(?!!0$$[:L``$.M*E)A +MP0";/P1%``A*2DI*2DYQ<6TN9'%*2DI*2DI*``!DGNGIZ>8_^>GE/_``!. +` +end diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_binary_data.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_binary_data.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_binary_data.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_binary_data.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_compress_best.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_compress_best.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_compress_best.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_compress_best.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_compress_normal.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_compress_normal.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_compress_normal.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_compress_normal.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_data.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_data.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_data.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_data.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_data.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_data.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_data.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_data.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_header.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_header.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_header.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_header.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_header.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_header.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_header.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_header.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_partially.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_partially.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_partially.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_partially.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_partially.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_partially.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_encryption_partially.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_encryption_partially.rar.uu diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_filter.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_filter.c new file mode 100644 index 0000000..46c5747 --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_filter.c @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2003-2021 Wei-Cheng Pan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_rar_filter) +{ + const char *refname = "test_read_format_rar_filter.rar"; + struct archive *a; + struct archive_entry *ae; + char *buff[12]; + const char signature[12] = { + 0x4d, 0x5a, 0x90, 0x00, + 0x03, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, + }; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, refname, 10240)); + + assertA(0 == archive_read_next_header(a, &ae)); + assertEqualString("bsdcat.exe", archive_entry_pathname(ae)); + assertA((int)archive_entry_mtime(ae)); + assertEqualInt(204288, archive_entry_size(ae)); + assertA(12 == archive_read_data(a, buff, 12)); + assertEqualMem(buff, signature, 12); + + assertA(1 == archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_file_count(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_filter.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_filter.rar.uu new file mode 100644 index 0000000..fe08c6d --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_filter.rar.uu @@ -0,0 +1,2099 @@ +begin 664 test_read_format_rar_filter.rar +M4F%R(1H'`,^0`P`"20.Q32)L250= +M,PH`(````&)S9&-A="YE>&44(945#(D9W!8B+N7`S2#`=A.D%X2[-NGU(*VLHG0+KG" +MV2*8G'[N``/\NP%@`$+_T&``$P!_EV`L``NK^@D``H@/\NP%@`%Y_T!@`$0! +M_EV`L``OK^@0``B`/\NP%@`%_?T+@`$P!1]UJDRA-<"D?]Z],JM,_I>F-Z%2 +M=^K_AM;?TWL7W;=)5IVMR9/,?&MR_?>)XGBMEOV_`6YMOX +MBW[EQ,WWWEOYN-]^!]8[[SC%LVA'\\]-V=G\K\Z<>_:\R8JS_&^V6^,^ +MV^YE\P01SFQM(R,N_\F435/L*/M\R_%3=*FE9*_]$FUXM4V3GD]5[0ZK.9%Y +MY$N^2YBE#R3_)-FE")5N80#3:6-1HW3F_.[=R;:_/#4L3BU"[P"JJ=N?"X*0 +MF5-`^3%TDHYL`S>7,'(K2*#E]33/,Y>!X7BB=$24B6GL+A.:G.,3?_N?C-U)ZS +MH5":OVIK,W'#FV:$NRDX)LZK9-J)W_3KK=558VQ(E)U\[VM!`[5"3Q13)U,; +M*O3CQL9[9.Y:6@O82?2"6*YL3])&?)%/.\+TI2%BSJ_"(%:_ +M$G[Z8Q%:;S(!W>%+2W7F3BU3YV='K8R%9,S5\%<;;KC6>85MA!0\"^+!L+0Z +M\Y-)-WZ"D]4VJ@`V0*2[+SR6*?SAJ'VEO`=WRA_C6J#69P6_8H1/#NK2LW.3 +MFEC5RQFIFY<MR7<906S%@N1#4;35-<^^A:%$90V(2('6PXK""6[N)4]F%% +M:G($3N6[WN[HEX@#*S2H@+23U9"/[Z%LS`=6@8_[%,#OFQ_\5!F5MVO=[6_$ +M:(*Z*DS[FHFIV"5\(H[UMV0M>Q4`9AM@]86(6'C]RL,18T22^$)OM=8G/Z*0 +MU3VZ1E7?H'_\`EJGZK%1">A(< +MR_XXWIO%/V8*5XTD:T!:,Q#W]'W$]W-N/;$4Q5SDJUL9TJ0[_B]PSL^"T72"Y]KP4*%6L!8NE.0?:01DP,>XA@21Q?$=AW0RT:;4!FZE^R'2+""4 +M0]X2-][9G(!"RY/"B=/U4/TPR;#N&!Q_()X5^JT9B)7\@KIDA]5QQH"[A` +M^TC&?OK?QU>KP#"2!DK]N?9O:PO15/6_3(U\ZQTE:/1;(4J2+ +MTVF+OH4KGH_+3O2.%0E^M>0CH;UWPQE9,RPU5.?3]BWRL&"K3I&X,JB#$9Y1O?03CQ1-WG/HB4`$MA:/.W"Y +M2W^HJBUN+/Z&TU2(S6.(T,5"U9SFA5(V/K7@04Q.F=A8$/-.KPS$4=[81'IJ +M?;\>#,QZ/MVXZZ[SRZ56Z5Z9.#:B#]7JT\_)-YX&O/9CO_:3E=3]J"]_HT.7 +M!+C0S:PSAF:9%`W#I``G?+K!LKA%[B($XV*P`^W_D\40H\FCJN-#8],3J`'K +M;IVB%\!!JL5DU%4W'L#XXY[907E"[5IR./)X#NM94%.J;=Z++-\D!5!3$Y63 +M+SGX:U_YA^8X'V$]LKHH(1`12Y,K-4K[PB1'JB:S!8%6&68=ZPRM>19W3`YD +M3!#&RSRR(FGUH@]4/GGK$+0\_J]HU>C><4!D`YG%#C28,[SY>2ZMSJQ'WQ_18D?+@".L%%R1G$[6]W7P +M)T6--F,8"PP!F46R91PV6C1"U.CVAA_2]F/&UQ#Y)X$J+%(VA@!P^.A)(U2: +MZ\(2Z@SV)K]R/=5<1M-H;:`VX2?D@W9F70&E>`OHC<.1K3R0]F8-(DZ\KAV: +M-RS\RUH4_7DH+NC\)#_:NB3UT,K(Y/$?\7G1FN_Z;08#^+[7E"O`?HKJO>`B +M3U85W)%+=2_1#T@HW/H].@?3)AWKUQ8UIC@(SGZ^3=27UFKA&SV)JW!L]Z:M +M>;`/9[K6X@]]47()MMPCB/(69'6\\SL*\L%]F]KZFAPR88*%'Q`#:,U9XV)P +M2LOF!Y$5^$*^I7ICE$`!)Y'DHW_98B&0/I<^+;..0];]*1W]=!!F,-_9-NH2 +MQH0K;B:%(M_J>3%5NL_A-&K$Y;<\9+UCW9P0TGT%Y*3)-7I8S+L6/_XH1`L_ +M7U?-!];\*$WET)JP1MI,>4[7SU8"7.2`!?Z`++T^J*G/:PJ?^NON^7AJZE^S +M+$KL/6^%,P`N%5N^GGKO*BMW%KPF\JB6!RU.-"I6MY>>K)"2/F64!\5^PHH. +MDEWQ'4)731$(D=JA86^)#\O3%!:T0MKBXL+/S`5,GKC84IC2,*3;#F3B95'K +M-JA23=&$JO00HR?8F&#KMN?=\,">J^$"R/):#^X/C"]Y@]W21G$/&?+#VOO` +MK+\H?.?S;*+R2B@$IOPM0,-+#+0B@08HV1$DCD?*HTU0QRDK*KWS-]2-1^EM +MNEK;`XM-4AJZ!2MP=9_L1E'(?AFRL(,X\,^?<1'1)^TL.P$^S9R133ZY[?J\ +M,O31\D&7KV>9L:6#VG\XPS45L.+3HD&E$K^88ED]A#<;&E:./[IV^X*KCW%. +M/<(PH80@)YMTT<`0\LI:YNY6/9CL/Y$LJ_E/(56_;_'/<:'/^54?+W4$'W1& +M5(65Z#;V7V,&I9EAB`:@(U98#X]@DXKYFX^(>M_RSIQ7(@T,IM1750SBIHCA +M9"UM3ZIH]K,94T,.)OQ@LWU)TC4K$(_=[!=FT,OTFGPPPN,WV$.7(3KO*KSC +MKJB-148Q]N+"^)B\<10']/%.EN\,])"MOWY^P7#L"6#"N92NICY2.W[C*,.X +M(WB>X@O1ZM61!.I:H?3";_`JG/?<_6^0Y3%TRE(U\%>F_>>QVW=^JP+JB?Z, +M#"E75?E?@!?CQC*Q20A/[2.=SXSZDG2*=+%:O=/%I\:&KIJ6=)M"3S"^?)S5 +M,[X:+%7_4,A@PME>*K96KAZG;X<'WL*0PA.=912<^`F1&R^X1_%IP\"*R>\) +MO@.:E0(:-^^\)6$1$^]"A^M`.(Z) +MXL'8I,[XD'\,;Y.8.7&J(".]YW=?=US`NDCW12OLE;(7/M\L-US9M[X:NA*Y->:U(9TIOIU!C_C5FU=8[@I$01O]F5I1:.O*YG!FL=%-= +MO;_]3<@"PA81A:&4AA,M4*ZW61#>18LWOHD\HKME8:3-IK^HCR:63BTRLPC) +M'6`!+_]\%DT$N,V,]O0I_N[KR0Z7Z>V2%:EY.:@B\ZQ$A6X=X7HQU75[:,&@MQKT0?O?)@=7=1Q_ZG6?\$A)HS +MY/8-?MIBC&5SIO#%?VE@F/@\Y?0$DQ14S5=L,W?2]M5L$Y2/WR*+CW4M),Z# +M'YJ#,27;*W&O.DXR5*T)I9QX5Y_IA'WT&=SG>K"Z/4M5&R:!;GPT&OH` +M-;+'?+MYG!/=PY_P#S7S^N*Z:!/U'#@,/NLEF",-6,P)FHT# +MYOW(EYE#4<`L*FJ*^^]V4/)M@7M<<^L.70K*4`L;/5FQ<$#P73'"-740,2HL +MP/_GSL2K=&IJ9HYE#VY1F2,]01G-I^.8+PT,4U=\^=\,C)PT(O]S\IYT5/'3 +MP45@8^U?D\L])M8#V&;X9TS6[_<9\4A\TW!3(E9(A`2'LD&)_8I$/8]F'`R) +MX1"G((X"*W'#Q*?AGGVDY94K@WS%*/!@OX^9!W6/"!_K9;F!SJ=B +MX(W9.B`6$IPCW-WE2C!XQT#;#O:^Z5H'PBDI1[K/P@U6ZC*QXY][+5]XP7N- +M_(WLCT'^I614ZQR>]PL%%LKJL&&2A+!]`DL8<:!>F;RP"W]GUIN^A*>>-,LB +MOK(Z9@X=IX!\(TM3*JWQ\<7X"SNI[?LZ#"5&1912PR\GS`4:&3P"IHZ5!7?9 +M^@=42==Y)'NYS$H6;$G,$I7Q79;8%7@[VD,537-%%Q.5.`2"31Q0X!-HM:3- +MWN#GX9^<1N=5X0K5)=!D`V>Z4G^X[0@V0'.#Y`Q*:5'P%Z8H]'.0RP"X3[3`M;_'L?_&G.- +MHP)E4\L^%9#TN9I\C<(HZB[%FQY%B7C"RQP`*]69]=`,M@*-18P[V#U]L-). +M71;DK$#][8BUQ>):,5^S--<;YEQ6]/>Q4;A,;OM3^KRG]8+NP=)N535$L&B# +M6RB2Q(`ZPL$'0%C#C'B#9=(:FCG!6-X+5#Q\C-GK`O76RRHX8L%5?P21+O.Q9Y>N(IZ'=ZNT +MM3VN]C:)DY==?M"!D,"^-K]%;?$L'M8C9ZE-/B,3?K&L5^T<8K3 +ME]$B^DZ1IE[%GF=S">HWL1/R/6DD94)[/(JR[R=B9,N8DPJ/?B]-^W/[/./T +M_CZ+Y30%[0GU\BQ2I[-&+)+OSYBS----(Y$GDQF<.L:]//0^T6Z84Q(9NA9K@TQ\5FK:\=FG\:*%.;&XN +M7#O'L3]8,2U2:FW2'G&X,J.Q?8_/OJVYI6Y;:-EJ*`X5'I-^-C&J)QH:$#S$ +MB7DUNL[DJ)JD5Z;W#YX_'$]T`=TTQVGJAV.'@+K4LF0GE*XUE85VK9G/<1@4 +M_+R<0**9HUP>M[)3='#?HU>0#-/8O=56'KEV0OLBT7;%LUTDFUG.*\W+.PV" +M)KVPM$X<,MTA;;=@STH;@0[]'B2!K`]=Q#3O:8($W82D=D9.V_MM)S^\)W$T +M%^C`2(5%LG(=7UQ;^4VH[NJKHH'/!+-?3][*K-_-HVZB(Y19@K(C*K<4]Y0P +M_U`4@]%CWY#04?2S"%5)07)NL"P<1:`H"4EU>^QXI^H=E%1PR1FN*WNV +MZ-!P5J5UKG28S_K^I_HQOFQA)S_D#MO58Y/30FPO9UO"4/9CZOT)TDLK?IP# +MW;GKO:.J26YV#6*-88/1$HW!!=BNL,[29`(E6E;P8K2'WRDZ-TT=B9A=V"HA +MCLUC1RQP`59#S#2P8IYDDQZ0\UIF`5GO<2`01RZ0R;0LI39$0K!38R%*1%N% +MVQ5/459KFW6%$LTIG:-0:9>A8-#3H/UFL]TAMRB=^P<%!U3H[SGU_1/TUWIF +M=X(S(/T&MI0T))0OGQ_SQWJ>E$GX*'<(F*I[!>I1Q!41!9QJGSJ3:?]BA"#: +M#(=G51_1/ET0KT:>VMV_(=\:%9!V)BQGR/HU@V2''9.L&._\QGLE<^^J$^"]IC.F("';W[)#^VJBF_/#V +MUQ9M5&AQ_;6'JC'%/Y6R^^DU^O5B[8:.30=DE?.+"99D[VK,[-/KRQA$05UV +MJ=[,>+Z2,+HQT.#-*DK>'`CEFL(2D:X:"%#/>V5`4^U8/?=8..3@U>I;BX\+ +MKN]],T==QU/-76P^Q;A&$9H'C98*>@F"#R-XVT.\;&M!KC-M6'MA$0T-`'BC +M>^B9ZXU/6_QO/R)>X[E=1C165F"`01W]%V%X``P:D9K(A+R3;VCF:(K''%#) +MR:*ZK7`*>V?&FZ<%G:(?W!!C^J,U(1N>;=:3ELVCVR0M2/+^W&J=P%2_?@H\ +MAY/:D-"R[EZ12,CZ3APE=RX."Z5@]L$G-(P..C/+[!%[KN#8<&HXD0_4G30?)L&`*T\V:10WY!_8"@`G +MEC]/.5@%V?X0)M9(PA2ZD[V`/Z?H-[O6-Z_5-[ZLWK]`WOL3>O$&]]8;UT)O +M?9FZ%#\D!`MMS;II(,I;3.,PF +MQA1(+OA.\^&@"%LA_B@.ILM\"B(LBL_.3^EJ58"/B=81!/D1S0E[2`D4UGA6 +M*P=]F9HPH[*`=]A!+9#"GQ85?%FWD\/?9&LK,S^R$3(3*,R'NC9`85G?>1IE +MF2&B=7?X5M?A.("A_V5NV8"/H5"5@>>?!EQ$.44!XR96KG;M!,(9Q8OG_4)Q +MA-^A.K$BLL"=ZIJEUAL7!>A/#NM473W]KT"0HS+-*!"!7O`'SB(4!/>%S2\^ +M2$!Q,.5AG0>>5MHSF?3\:^\`0"Y^>2AYG>ONXH_"14QERG4V\F9$GQ^$@,NL +MU>0LWNQ7>R5'S>\.)O-$214$`WJB-]+I0H=RV/21)Y!,:LHCUPO?/FIK5#[^ +MF>-7A?=?97NGWJT[[4]RE,=VE0:"Z?Q$]67HHQ$>AQR$^BY\)9F#JD3N]K@G +M\..S:3JWL8]5*8/+R`$&=K^L8![!@,SR4%UK"9N\S.0%,8R7YS?>F,I[9`'> +M@50$=KI11*9+OI#*3GQ3[]LY[=%T7OV%VMB##\',\>=0'-E*K3DIPI@X7BV_ +M^>T&YN".A,!\>(.4EHPY=&='L\\EX\G*F5_/`6BPBTD:#\5 +M\C:!QUYT-,.J-5%Y-3D4N$@*391%]&<]GXKC98<39%+VZDZOTDC0KZ:!J]_8 +M)$\!U!D>M)4$+PU-$8_0G-6(.ZW=Z=:FC`VTX?0I9R]WT,`C<<]Z7.7&T_J( +M3K9E'0DV:==I:/9C\WX8Z^R,8)/_'HG%2,R=NJ+A%76:1IASO-SRC9>;RGV^ +M]$S8D6]NT3O8)^;RT3LY\=^RY1J(\OVN6;;<&B%J$DU],YC!'%<5T>$*TV6Y +MH]%X"RBYBTWG)+44(2)N.CQ5!6LZ+JR'2PKCX#E;+XF +M;VN8S]#SS<+?ZNFTE^\X_!&:6HT`P$SZO:SE>24]3QX#A7JU3#4-4P7W5Z?3 +M;)OQ8?^;56$D0:@'QUC'4>/A*=C`$R61=?CW-0Z%S=0>,7;9SC,*[]7I#P36 +MJ^\<7>,2\OV7,6Q!RKUM?82^S@SVAUE],41S&ML[J/M%9.8R:A'RVK[]*E]X +M73FE.EA=Q"/M]F3?:]]9I4W"\QCKJ>E,CNVO#?ECNLK;/]J0SI7U-&7@9:[8 +M0>_#ZG48AW,9'S4]T@@C[W'8CU>_49/6)AD_4^'[29UHURLK]FMIYRNUKT1M +M*GJJYO@JL:VCIUUBWZ.Z*@08H1*+)+$)6)<6"FJK-)PW&APJ9LJ*/D_W\U]C +MPO5_T\P];#%P5'L%!7!WJTP(S$R4>4R;#MTC/0PVR?*WLE#(GO=(YRD)U^>^ +MA_=C<4/RV/DMPX<*P]LL5#!#>56R;T"'+AX:$J\===_4/QPHMLM!YFOJ$87B +MT.CKPLDKJO:.ID]%?/R0B6G7=:)6V3P-CUK?L;ESBUWZ&B`*?U]:0/YE;"/_4P6#?0.(#H##B?DF_5GOS\ +M@B:\`E'?#`;Q.NZ8J_,(&;6$^`OY???"'PCQA,VPJ]1F[]%W16C0_ +MO";N360K[J=O,\K]EC-?:2O9K:=@NV+>B8E)S138$9=Z_I#ZGGUA.(5A[1T3 +MRZQSG0)/[&EMA(*0MF0TNI9%@O_%]XY0:"G1&7J#+E?\FFW_Z,]P:\C`59$9-PC/U +M68?NL1\JTP_ON.<`+F]90.,U3X^$%Z[M&(VJ]-]1+3DJ2H(%GUBZQ@<.LY]Z +M-%R<_B8-1LM[WH,8%&QV?F2?/$=J8?[_Z`8?S(78\CS=X#JKF^ +M22T7A0:Y,Z:[]"`GWJTNZ0\Z9>;%5LCP@)*75)=9W:W6DH'2,Z7A^BWXS_\H5GWS-4/H/HNM#[&+JB4FNWD[3!SY(/,F%"QS^B:)X_D-L +MDD?-\,6)_WL9!E<]2875K=4PUYU<;G]:60,?.%AK?&]F.3Y1(=HO+G7S1,3` +MT97`O18!"QVW@!VLNCC7^7\/-9.[QHD\!26?5WV:.??H*.MT7`@/? +M1C4MBZUT4I;JP"L"&!O$-LC<2+AL.9PKZ3>E:>\:T$6HJ7,/^4-75FX[*14+ +MR.Q@87LTF0.;KZZ-AJYK$B+?-&9;-%=3"D!Q@Z9_"<6D=1)%D8/J("A,W"C- +MNSQJ4\S2)="OZOEFB=\5\KS4R.RM@)#E@&AIA-W%-5Y\:)LM3-5,_#3%[EY7 +M(1];N'7*'.1FD,EK>UE30R29O +MQPV`BQTR+1XP5)HSHK80=#-NJ%S#5=69OZ(MU"?T-U8N-6J(6"N,:GRU,V%>K)H*YBR,6=Q723OU>S1!6%,;V2-E=]9K$HGI5?J*%/$H+N +M#7>QZK8B"KB"7[VMHBN@+0,M<1H!?PVQ53GX4&TY7T?N2>*!:^C:M%GQ@0,L\;.0@UO-*@/I/E$Q9`!&B@1/O?1 +M[5K+RI,$QBAU^2HVI.HBK0#O#Z5V3Z&-:L\^_TVO[6W6RM-?0W6':.A\6R*^ +M(OGN)1@]5)GX^BC$$ORC)#OL*\5._Z!*4Q0X!VOEA[1&*,JKY&^DA%[B*%E] +MN4?,4;DE5Q*PZO3?Q.RU8U4A\$&909,U2^A2XRORO<'H$-D'E3R#/CV5=/#M +MA5_,9N+"2"X'8YU9L4W9V",>./EK26H5/8K[VL@W\-1M[3D=D6SCT*?_=N,. +M/CII-@@"=-YZ9&N6CKN!%W(C+K!4ET*W1&G:F&"$*$1B_],-UQ70OM'E`>=/ +M*\,!!T!ENFS.YZ[49%/3UKM40KZA.*PXK9(A"^!1OSB(BNXA'OE.*9,P@V[* +M8A)U#!/&GW`-;M(AKS';U0RM;,&O,H#8 +M&'%KX[?L"VG/#$:*-Y'-]B9(;!'(U">&?,O81RR7'NKXZ^_KX0N(SR^T9IX? +M97_7'?]BIOT-#7G%_$P5LN)#">:Z0=:$3X=S2B/AH?0&\)L$3=01\1'=$SQ9-J,Y* +M,W5#`H?AZU9UOSR1*3JZUSRI.4/0@':$,O;HI +M=R+3?TJC,!%@FEI!X$C0`H$0I@O9=-M=T,(R6<[K[2>+77D#U@H373M;1F!E +M*DC4YTF2ND5&IY2A'&XMI-OPZLCW$H(5LW?A,"5 +ME-)*HP0SIO4\A/(;4Y:H5L-9A#%3::')THQ(AS653R+[GL(ZP0;A:Q7[=B7K +M=2V1<5ME""WX,)MWV=O=%`%[I5'+_TM;Z9X[UV)ATA,I[KOJ39NS/NK4G1A! +M:HNI>DDK?*K-A!#5":O9C_EP=RF0:S"E&/L*#]/.(!>KJ$G^2Y-6O/U)NM[L +MJ/NF%79J4?2?8MO-712-@(I`__38WRN.;]=AY!O\O+\@W+:&@ODS0]W-6!K2 +MGR3P]QWD(X5Y2-@NF;"I_FCP*M>")5;U6F3)8)*?I-*0T5:+([94]]_Y+RNZ +MG!PY)>36-4-FR0LDJ35^EU=6Q8<=W6\C"H5U:[PRBR^Y7)MG^)M%;0ZQ^8.O(+W,(&KH%7W<(%QXBUVGZ.,]>EYG$Z\"@AT?]DH +M4C2\.L1:/WZ/=-@^Q/-\T$0.ONEMB:.FS,NO[95MV!ELL!^V6;?:??#601;3 +M!2Z<,YG\SZ)4V_V&3SI1V?I,\&8X9FL,;0SOAC\3Y=LVPT@/V')1?2:TM2:R +M.D6D=`Z/.\0@!@+I,D?:FO9,`][`S5SKO"XT+O.24EX9IJA9G\VI+AP#/9OH +M)[CFPY(:#*198M2C:_(.F%F9Z7W2(R4`7E\8!@[U[)%_WS]8)]J:[OU1^HR, +M#V8WE3&-SD7.BVD-QO8,S&5-.7=](/N,%TPU%!8P[;;5G.6;?X[T5=$*[8PZ +MN/9L4-G"SN/N6.'V3BU69[KFW4N':=MA2_5_&^+)T$DLM0 +M9/%X[-_;/NP?;X9WPQ^Y\T==HCO2%3H">J +M&B<;6P5FPDOJ5FH4X""?;)PDRXK(9BN&*?T=30NIA7[,GO0#*=RG8(5L5%AA +MZU75=D6K.*Z[(@=P>%D#.5[F;+:R_T5.A[Z(W?R9:I([[M[WO3YM`8E:*9N: +ME&]!QFY4J0HT-,FAK_K.>YVHL2QFJ;6W]+1-)U2,EANGTL_C.ZA&_"G%"S\E +MF#)TG+)<9J*FTZRIME2O3Z(>>ESZGK&'<_:;JH3<^JR7%F4=5TGV^(XM5 +M,.O]"5$VNR1@;]`QJ(?;C0K02]8E"!B*D%#RE/#_*(.\8><8MZ*\ZI`_OUMQ +MVV'*R[96/WRV_1E"62,GF$8%*'!BV2Q^_JMCI"O9>D"JN'5/Z8E6JMB6> +MO^DIE$O/L(^\9QCD=88^DSFXX@V-%WR>]15$[U20&CZV+/0XSSO1IW()#UZ, +MF.YFR;*OH7S^AIFTW=$D;3)!L5-1/G641#\MNI"[0LIBD>S%KH4=Q;_.?L&+ +MU"PO+X'/PGC9G=-Z['%-F1SAF_9$<$WG[HW[/8B\F]8`UF^!1-V;WZKHTN$A +MDE4+G-D'-4#A-DD;HOW<[F_;=:0QAW +M/LL%T4%VA9R9G845*>?.<.^.F:O +M9^9'WWE+[;C%GY@'^2.QW+85^N/9]#6..!PKO:]>"H4&TP]3/X9OT86:/QMY +MD%?27&K5K=7GIAXH&2ME6N<\OA%I0BZ=,.7!]K?3F(\ONQ.(%9O3]*0N# +M)X9DD$[O+#4!TT>C),4G$]D3 +M&KW,(+@/';I1D:#7C"]ZT_[VE"F;8`:J`Y[$]VQ%&A]5&N_JK<#BJ@`**'BUVO@)C0:.A5U7#.WB^41% +M8+^21*A"\LZ%,Y@&7KR2E@P&,-1*1=MC:=Z6C(=X!/;9#)-3W,L4*Q"R&RR? +MTF$)?X]I#7UHAH05AV"NBW#F7VXE,61?8=OH";P]]#/J],49<:Y>B:E +MD,42UIQ^*PADL7.APLY7>>PX]JAR*K=:/#Q\]&M5(Q?^]W$:M@]5NKJGND^4 +M2D6+0K;"B/=]Z@MJ7*&&\N!KI%>IY!#K!2H$&M01("BR8,*>N"\$,D$T1^W2PCBC5!: +M392G;/+[J$QCA,J)^1FI<+!V\5^SYF2RHH2-'SFW3BAKWE]. +M]N]WP'MBYHF<6NBI*-=]:OR+\?+D#U-HYSZH3@UHV+5`YE@,Z+(V.\P4A;\M +MNC4(498;_;?5(;/M8'.U:9>L>>W=F&'B5!R&C5[)10,M&;A,,L1 +M4`G.96%X$D:G9!1:)P4A=8.SWM*8S^?));G"B\Y$0')?#BPASPCL:O5R3-[! +M5BZ*%)42W=\"^C.#$0$.!(?(*X<3-3H00$/Z90V[&N*>^0[:_>?!M?]N[H(D'^CFL/_]IB++UV7#3=/<35( +M2_=6,`,G*GRHV(M71;9S+LA*,-+:HXC//,4&9MS5&XN[V;O(W.>\'H%3<[W/G&Q$NTQB6B3#$1\!OS[,SCH,?_]8@8 +M@U$1Y^\`8&(:>"-]14EI](1&WG$[!H\LDJV.^+(X:SF(/[MK(?EUP-B%70(L +M$8=QN.IAFNK+FS%RS);W'%5'?+U3[A;>Z5U19;E3I*4=OWSD8S@=3!/"\(5\ +M[RN42SK3[UK@H4%J+".=?:GMD[Q'LC-9QN?.PGR]]UA28:RE/GHE!MB^+"UA +M\>-O"8J8.LCY[O4^N46$Y$-FB,0!R7V(-.6980P28,KZMCC:5.09O+`0YOAI +MU*>,OIH;@MYV9#8$]GPD(MP?J?XB!3;+%NU[C%E'04*'YTA[%SAJ'?-[%A$K +M=RWKHUQ[J8\H>M,PZI%5TR1;DO2&&S,/MA&RA'DK'"\-$J3;QQI+D5Z?SCI7 +MLA3$5+'+"VR?QV:`,B3L=G=N!Z$E,/P1?4Q0L;J^VZ7M(T[$W[[YS)Y0#L]- +M\?<5Q*)OOE+=*?YUM&/XK\[@U>V9C#&2KP]F+3Q3J2;8," +MU)6U;Z +MIFNEW@,#;S""]4NDW9=U^JZ:]6==)60ZF/C$V**/L1Y9AU+\#A\PHI^6-,?= +M03*-KT'_0F23G9WQS8@(DK'/?G11>F)I=WFGPX_NO:P)0VF)-;[6EGVO;=TT +M)JL4IC23J;:4S:NY+]GGZE#;V^'!MO"-5^-WGHV#/&)4J][*T)O'F:RIKH[> +M(;$VTC@?*2DWV:,LWU+[RV_3,-9.BHV"20>K*&FPP)+I&LRQ5L;&-+7=O%CD1M' +MAM?8>&DN;OH7AK?\/#?;3/#>(U6`D,%ILQJM.<_:;%*?)GXAU+VV,BWA^)YG +M#NU1J6G0%#@>=IKT>9U5[%UHE%/JE\_ZGHG4P5)@>'I&A;^Z27[PB7&>F[L; +M8(V:B\WZG4>5^82^Q"AUWC$(7\FP.X7G3#ZG%K@%>GSB=+(]W?"<6TMG5B%< +MPK7YDH,F6QM&"MCO7= +M1)E63:5&H//$U#@^G8R]\YDE5TRF(,2D:(R3N"LM#!S*T$N.I[(W>H9PRG.+ +M![U_.,[F/M-KC-VK1SB;3[?>BO-X7!.._CJ1+S-(65YDN\2S6/UO)%<(C>WL +MP]!G&DG[ZWGF,/7]!H`L@58=XB6#+`\HD8_;7\@]R>^(\-GYQ1^H*.&H-Z2@ +M>(R.3MJ'@ +M*]/0#QQ'>:PEJ_0A#QC)5BKQH1&]I+,QF^LRSA\9?DNYDZ8+QY7VZ]*JWROC +MZ4?2;Y0'WAZ`TI9!VEI9\6,DHW8G-!K4E8%#[_HD6P[T[[RS4L3&'!J"-5MH +M1U7OLX^J7V9*8DGZRYFI,N[,U1EDC.&0VQ[]K;=43]C)#7/W"PVGC^^2;3EO +M%+;#OE3;H70;Z[)[B[DK%&>Z#CUKT1#)NK#H/,V]]8.EZV1N6%P.J_L:29O1 +M(WPCQ\T99_NFE(W^A])9QX9ZTK^PAIA`<6DLXML`KQM=',"%0V'RFE]-W"9] +MWGRFMYWR_[WP`3$P:],;V;;^IK8@WKB^3YM6W3I6WPQA/GL&25V%S#.(9(2M +M9[G!_E[.>$9:C+$&?54B%M[:*Q.T6,4.,P]S!'6'_J$G*7Z;B`X/CL$-Y(9P +M[?GF=`*2K=9L8#[K&[RT_MESSMH8@RV,:FE2A=X#0B=N,WU>GC=J8_90($A` +MVE@16Q?6G\P!RG%^'Z9RJ6`TI"^R'>J?7Q]*/I-\I-:(NAZT:KV;?5.N*TJ= +MOXQ3O`C]4@AK`%Y)=ZPV:M]?WTN^EC69B-5WU\1G+RB +M)/X-./D4_X9!'JG2EM@>'3V!\B=,DE@'*+ZR/0A9@\\P@`V:_JBR22#C-&[K +M+K;@:#:Z7!;NT`<63HAYE3[N:"@8HLGO"?IH61+^/XT +MF7RT-1Y2K-RVAF0E/]/E-RMGV"^0W'JS:U]>!>+__N-G.F&3[NGWBOM,^\]] +MS3;"V/G<:RK/DR?DII%JT]&FC0H!^`^CI]/7+LL#+C*+I]M*B?")!;1O*L76,OKOT+^# +M)9-WE<(=0]KY#/*C9E?Q98UMX78YSTV\Z=+/=Z;X^:AC[^,:??KYDM_O>$N+ +M[=D0B3"##,]8Y:]UD$TO?L(SH%3=94Y]5?AF_F=OTM\=W\9M=]HYQ$T.$,KBM*O[@I"[CJW! +M)ZF,_X:9%Q=,WNPYBV(]&;>6GKE-!J3NXH8KI30 +M%PQJN@W"Y?3%A$!**"6G[KJE59^$O_O2%.<5LS"[M+KD7I4D`.(!`*&C;JG0 +MS/E0WJ*9;^!S%@_VM\M9%C09G$0^*Y,>P:DPT&%AFZZKIW+U[1H?XN+[(2M +M^P]HE+-IK/M^!X/W/$ZK[??3W&UJ;DD1;?ML[$&'!6L`Z/P8T"@2CBXM3-V7 +M<0SZK9-H>UHG;3=R7UM.N+90WFFEX0 +MJ8<<&PSUV[J*MY,:Q.CZDYHCI9P]>3VR:+M^KJL*)D32;@AU:#C$Z&6K<7PO +M!UY)9\L3OEM)S[+=>4]4"@P^S1?_Y=8PT\%?6:NBW((1($#;XH_,F?;)+7 +MC5>6!$0.5J,&PTO8E.FZRG@'QU/B+6]\]HEQUYT@]V!J*2CH(B^/'I59SP.O +MQ3=A$H\>6A"['VI6CN8X!.?OP3Z2?*L94U&`4+6S$& +MM;?R3*+EOVJC=G2LG:QM_&N]\C\W*+B[:1WH_O.%.%DJ!^VW\QSG?Q>A`4GH +M8:&ZHP<1W6J$3W!O^?-46MD27('"=>^@7K3,'$8EH5O]>83J_*&P#(J:>_*Z +MKGBV$D1R;119VF*\4DN=<95X-O5'_8&HHI&CO()O:]YVB6'%IP_#C8J".=](V9_2_^2E;N=4G`A]USCA=G#^VCCD=4KT^WY1U)Y"( +M9.6+-=6J_+]H2`@0_VI'#B2%%N@3_T5$%/_,G;_'"J'\W]D`=!(U8WE,1WU# +M@\\HY@#5(4/NF*(:DGC3*TSX7"8DLN^R`]1`4&]S23]Q(5"E-)PU":Z3XZ-1 +M9-'ZDZA8,.F+'XWO@PGE-^;3(E92HZ$U\"?$5+WXF]\RF[3M040A+\K@`UL@ +MBZ#VW*1A#Z,TO7@<$BJGKX:L'\5UID9^6F3?Z/#^):VJXK]?`8.IG;]MUQ9A +M$Z95C:<2A/Y5/5@SI`JS`+>KOGUA13)Z6YSBU&%%O.N27.?V_";8+E_QSAP+ +MH7C'[-L99@Q_HY2-1LC)Q6ANU6[9;)1DH1]6HFL^T0HT=4;W6ICG9]JGPVL4 +MRO4Z>2/N@LOCI^F93WR0I9:)5QF#C23:D@)F@DC#D]:9?'+!:WLX9BF^0@[V +MXML[Y.>1BOC*2+W$TR>\T49!5#Z`..J0*BPD>*'C4)%@YSRRGU1;EOT:[Y5; +MJU!&QHK\ZZ*QTH1:;J#.PN+;!1KT=-=\B"<)/M-,HY&40OY%**QI.F5]192" +MR.HM\Y]+1QRPB_ENYZIT">_'^!E,1DAPXLW)/+^T>UK^;RH]0.U#`Y`"KRO4 +M?>(2JK9-Y4K:24*VG"*M@AD)LDD/?DC2`/Q)S6[\SMC*J]P>KM'2G.L\6=V' +M>62L=%LWC2/T5C/+7$=@=FFZ +M83MA4S^+@'H3`UM#?I,I\'2W:-K6GEYXZR:T/G)J&^[I]+HDW@>(WV@*1W[? +M8&XR-Q(Y;4B0]ND`@,V$.BG;.AKIS40T*[@0^V2$T+]8K%;RNR*E75Q/6 +M/VH-ET>(6C1.!G6NM"GD" +MZRM1,@NAU0=6"_'5!M8^ZE]E6=7'53:!DF;M80T50_15.B"H>Q>L,QD2]0=3 +MSQ(4_NH15"L.7?*+,"")J +M9:KO\9VGD$""5NG2!TLZC?LRU_R%$O?"<9[Y#I6)S()THT6V\-)&*KAD90(I +MSQZ^-T9!B(50DL`0ZBEF:[;-I6C+X[X>>,@C&(5EQ)61\G* +M)CXM-3XQSTEN^28R;2=;'^>F?J`5'H]RS23WG\%GCI!VB[EZ)DTG.6U4?V>8 +ML3>V,X]/DB.#73_,E3\X[--I`0CC*_*V`\B.E4F!I^ZF>>QM@'YC0%#X([([@F)EANC7 +MWIO)+CM;NIFC0L3\2:-5U>K\FHCHT"[$,EP_U:*Z*S,MH:V9HTN#D-UI%4R1 +M_,M1EY@5AUW"/"T,;PGDXS2O0S-?;FC-]A"I3G/`7LM,\U\"EC9JEV;2 +M2I5[NJ7D[S_?%P+>X9Z7AG^&%2??^7'BY&:+A2?Z`H\AS,(6)9MW@G4'=?-> +MBF2R_W[T>QM?3Y@FT'C//1LYR(*4'[IW,4%YUD!+"H]1-39>8^=!#4VJ+M=+ +M8H1*>@!CG]9JQ6/33L8,U^' +M^'XT]6T$+@P<<%8TUT$JWJ>D[7[?+::WVL9X_]?>\SW-Y"4QKIY[3RMB`:1` +ML4.K%].EJJ**ECY]HNK,WT/:.I8(=*YGQ^"SK?FZ#[E=4_@\Y-.6.9K>_>28 +MX03L`LH$Q2)`)J;$-+GO_%0`DR]RU%.N.A'6W&IGDEH6LH8%CF^B#)=@WXTX +M_`-DQG*QAF:R0`E*-6$P]<3*M!_/L>\G+?%-`L;84N?/ZH$6J`>=H3A?GXV(MGEZT^`1 +M@AE:U3!WO##D/U,2)_8,">/TU,7Y]X0,?2S]TB +M&YS^!`72FB@;\?[AWJ=+&WIO@X +M-=`SC%E2Y'PO/SO58P;_.D`\.9W0[5JA%LK;2IZ"E`<>7TMC._C?A<1:0Z9CK`&(:+]-^@@/P[JM$+ +M"-5$]NCT5HS*H7FS8)3\^-,Y@WP(*R?T2YN'M&(>08EB2]7 +M4@5ST<8;1$4%QMMFS+38U$;?!-CO#S7!/[#/BR+_(_JMC%T28#GAC+%XTY64 +M1V`TW::0/T<<>3@/V3:H5\;MO3EE$[KD<)/("@DT5XVS&&CHS+;,C7NN*RV: +M/#(I.']^8XD^2*Y/\S9(Q=%8)L6);J,@YK*(Z<_X1EXH[<66N>@',V:2IN;B +MU\-MC[DDRG/:?Z!$C$O\WZ#QMN/Y'[C[/ZZEN\/]7JMJ*.N9]&6[WY^/Y]:4L1GG0G/VV@\N;B-,]LJ=S+8XN48O(, +M]P=RB_E*F'FUYX6(2^(`1QWBQ-A-K\[!$\I7IA_``;BP4`$J`K^Y9_+.-KMP +M48<5=TH5[4-Z=18_D*6K]F5@A]@SKU.XMLJWRU/08^2;]S`>A4]FWE!X2C:A +M,\2W9#I*0@=E"?CU3IA^6!;7!YV_7+:,!2<'GN@'MOW8MU@Z2T(E]+[#@)EU +M)/'*E1X!Z(]U'XB1W\TS#D\&UI:1DA]1Z[[U]2PWH5*==6ML@S=8]3JAPHZK"8;J0F"Z/\.-I371^I+NI +MAMMT=MSX\]]%@J<;'DL@ZXNBCS/[9K]0;)BC]A7$KSSYUVHVZB:R!Z^_8+C( +M,[!Y4HL'J2`E>E]Y`,<`D3^!@_^$<&')@Z"(('S!]"3]_&?Z,>FW[-&,V%;R +M?@;/&"QGA450;I>,95UC%O.+/FOB.$5R=FNWN;6$=?B`<<1*6R=[4-0(_FZD +MV.V(4]NKU>"DKQ@E#('(,F:_M\HEOA'(:(.[;8'9VOHC<,]#BBFUJTYLJI[! +M.$B47Z@@>G6'>Y;O*^')?-,,"9/ZLCBJ9IK]LD'Q;@PT]I'Y/BI+C>AJZQ>4 +M\06U/N&\V+!^W%#TS81)FRM%`C\&+]8Y.S>V`<+^QZW=.F'X/3Y3:3J;;QV\ +MJC*60F5\N?VZQQ6;]Q:Y)7IY4F";SAZ=-?,KYA*.VITZ_F#11N'O!)S%1)]@ +MJ.&R[*GD?=;++D\(!3D>.VE&>7[RU')QZY0G?:#H/X]4..AB)$T7?`WDWZ^` +M9Z./OP^EK]FUL"^ZPJRU@EQ_C$X'TT:M_N&#[>'+Z\EQ[QZ8TLZ4ZL?/O9RS +M#P_>8NI.],D1%09)"3$"Z$G\&ZF*W:%QV!FK961?9KK25*Y7A +MB=<=/C'%#C$S?ZR&SU:$_*RF".H1*^S,Y9752:<^#3L_9D/D(B(9*L09Q8#1 +M"1&#PJ]S00\_)&)DK-B30C$@"PK&%3:^*VIZ%N-8D3U4E4:HU*#97Q\+MK;^/31KR$ +MC30<_JAS.H2'U;&W%6>,24K^1SS9,&=K?OAR3#_J_O&6%,>B^DA+II3_T_B= +M^Y(V2A2CUC2TF7[DI#.`XT$5@?3.>KNW/8!N$H1U6MF4>%^RL]%'[0_;=X7$M^ZK"!>DA$0 +M:"N\F08C2;18$_-U(0)UYZVUS]GXH/)=\?B45G8:4]5\UPQ6C^+TB&ZSUD1! +M;-EQ$D?Y^7ZQH$KMBN*KWY?6--^W^0=]6INW.3UNJLV>6K[LIXP9E$A0R4R- +MF4T!;,_V,=RWNK@0B9AT;9)8-"_[\?^`J9ETIY1P>D/MYJU,V-M842U.DNFZ +M20EO]FY@,!?7:)<)ZH!E'S:K55-1T8M,Z[M.W^O6C^*Q77:5L7BP[&0WY)LA +MXQ(N*6RJZQ+2['LF;K)7XE0Q).:BM?,*M'*.QQ^*OSJ8^[8IT5]M>CK07<'1 +M#V#*?.[YG0^@XOES8[$1*V44AUE!KD9JYSTZ?D"D<+@_Y.Z"BA+D[$-GC!`4 +M_VFH9Q/2]C'=F75V)#7MR^6'S\%5XX.GQS8%>1H@=71E"I*!*?<*P?ZQ76V` +MNP9V=`=)Q`%:81=0W._I_-Y>,,&3.1AT<)ZIH$N,ZL[02/$A7@EY7=8.-%B!@.!V^M?-LD!C+XD9O#\T)$ +MO!X"$3]$^7-!^&YW8$5YV(-?Z3HV]&%0X*OKOU=4E](_:@F\@07T:'"4<"XN +M+:.-20D^!/QF0Z`^Y.#%K:N@+M325/I-H/H*'5@4,IB-85J8:@-HM-J*>/I= +M\?D'_(Q%>S,^K$,ZACZL@_QTVCA*1G9"><_N#5G::=TFNBH:QO.1[1X`AW2W8 +M0>F'&J7-D>4+Z'`/T^'5_5%F6(>@EQ_5.W;F\F-^2*,&@&)S>HE^&(PF/K]7 +M7WC$=YHD+LR"_Z40/IND1^.2%3482WX=AUYM*#KS?]^_7F_K_/UQM_O=<;'Y +M:\W&3MJXUV1M.VKS>'8]<:W6=<;\3N("18?09>^AVDVXMH;4N'>``BPHCF.( +M8_$)2GP&F(,X4]#,IFS0^=>D84`.^5UDBQGW>%#FM90PV)2&J.-+7\)F? +M[:I]TZB4&ERQ=[7\)]`T90\E?W5)B8W(K&#A;K3@1[6L9_%*F_'A^="W8))C4/L!W/6)._ +M[3?$'CNNL,]K&J':JF2&QHZ!.VZXH_4A6EJN&Z'\;7E2327JB_B2&*3F3`=@ +M717M="?BMR(K5N6_\V#I>G9Y-`%%_=:M1=S2,R*MR)KTO\>E +M.O.$5\4F?&^?I'O+T/!G,;MY@_XK;J2+E-(X"0P6$/0CU2&@%Q07PIU92)YB +ME"NJ:@@S!P]3Z1B,7&H.(=WK_AS8[?4K1]/121P80%A3[>I*DY\R +MWR7M>IW[HZF/2*LUOE.SK:T>.L^HC9B2O::W#NM7\X["?5DD<7J/5`ZM)]6A +M&H_0U3<"D0CY=('>>>IV6J*%'QP#P6?S#T\XP$=(^H"Q4U>`93H\)]'Z[L_( +MF%B?XWW`'`,R^M0GR_4Z)]P"J>;'8L%=G6\QWK;""^81[N*',E3#&@Z[`Z8?Q5UWEBW[L>"=]82?V.+E(&`V-U+]?[:<27R&L&/G$ +MFEB3Y.(DO7>R>\4S4$_=ZHI^/?3K.J2-_HY%I(##]ENKG_"6RYLX>N1MP9M +M*0GN4J9FHTAGXP-?W\$TB.QO/*&K5&OCO]=9ELS\U=>A!\M"Z]W.W'G%[[0Q +MMQ=A1GC*,I?)5G7:6@329'$OI#E-#:D+EO9@>ZH]R +M>&C3-UI(.H*;9^-_E/D_0;4&@?*_(ZJ].'XH-",.THR$\P%*+-'CX%YWR,OL +MT5"#.S'?P#1#D#N=R7G&3O7^?&U_MJ-TCP;B;,;%)F]6H[*+"2%=4T//$^<( +M7\=\09QU1S2"&14ZI>%:?,`?A\P;G-H?FD&K4:A3@R5`AE\_2>&NE_&L\;(4 +M;WPMUOR1X&&FR(NF%`FES/+D6:CE'_DEY#>HC&('X#?O-_=FU$BX84"/R +M]YNL.8G(+"X^K!!OOA[_RR(%]B*S.(1/FQIEN!J&V"/\")7E\DL/>VY4[F`Z +M(P-WU6,,6AKHI'0E%8+!>K8,=FJO#9O>W!;Z1><"-#F4EHQ'F6UJA](XE')4 +MJY&FB%8$9>*%:WG8[GF;_0TG.7=OC&$?X3")5U/=B$]L(C=ED]#E6^#A7Y[3 +M;H_&&&:3H@.<)GC:AZ5O]L7U"I&`G,T99)/"0VP,:;%K)1FHLWF%JTZ7;@84 +M@_--791P2]KS@)O[B7\#D)_Q&)SX@_14^?>0I?8\O\C/Z'V(O4:JRI3W[/// +M)'Z[6[_B.I;\BT^4K$?PH[P2UR;FQ_"-;C03H/L\%'NGS&5?$U(HZKB0)D## +M2@HX+53(PP0[=4Z\C:A0^<6N&5Z?K3SMH(M('W71D$UO0/WUA:4+H/&50JJS +M&EY'9A0_M\&PL&2I>.W6E^BI(G9Z9$2R,RB&$-`J93SV'-X;-DA77-WC5BY\ +MR:JP3@7OY\N_T3%SZ\N60'$7]W/F'71=;2@QWSAJ!34^V3W/;1[P0-RP?P=9 +M&KBT\,,(8>/>[A0[9O=BXKU0]N;X7&KI)MW.EY6&0 +M`ZY$-SD[2%DAKAZIXBE@`$OB*[9#85KM56\%4HL:NJ68Q5Q^ +M"A6SE=N7:BN@LIS-9AEUB?CM.$::5T*H+++J3ZT*-S0E@\579&-:\P?J=BK< +MFMXBE#;.."K<5H^Q$RD1FCG8:#BV5YYA#)SV+./[Q6)^X;D/1Y)N97!],E#P%<5IY0 +MW853,KZGE(VBR-[`[C[!,$YX\RS!N;1#MYN+W6VBI#8$M_2HMSP$[F*:@RF0 +MQ+7W.3;#C,EBEMTB_4%P(N+SVH:S76HD=@;)( +M\"]_T6&=&8V3:8!K>PE)=9>F%QY+QBS*1]R"(5*`T/>_ORMQJD1Z +MI&*''7;ABKQOT%$*,Z1BY&'Z%JAVRRC'9/0?QF%A'V-S=I,OK)C.;)A.;FB= +M2U_&".!]DKQU<5,=10P(]94C+3/6TFQ7U,..#?-WQ)S?6F8.G?J$1X_>F-S4&-AN>($PXJ:6 +M@*`%$)?2([M;7FK!+I23$UQX9H_+IZ +M3IO6*\QD.-9NWJS]V8'M;2:1E['&;CERA_YMZ1!A%P=1B0-0(>+4SQ7=BZ;0+W:P'[,IP@?0VKO"ZM&+(E)=$9>V,5?))7ESO\49%@8 +M1&T]KZ&T2+X1ERVGU1%Y&O/_.#+^P5^SMN/9#)=76)\S2JJS<@H/Z1)._QCX +MB4Z;X0^IRE*(T)&?;=TNW"$$0NTXVM8+JX)7_%?0D^P81QG15=D=)".:U./",M@+*U#C@*PJ%.*Q2]KH&\VI1/HS^EMA#-$RO3G.$Y' +M1P!,F&3GVM,D92R/:]5'\ET)V<[\CXI%2Q8;R%2YOT'%KSV-'5'F +MKCJJ0'O[!.-*L4;H[A^+`'<:>#7FE2!,UBA,FC_8=9[9,73#GG>5]JW2/PI4 +M?P,^!CG\=6;X25[WC:LW)(F6MQO9HDWQIHZ(DS)#MZA@HV;"@='(/_! +M``:1FC_Q!]1PBTS#=\&*OLA='",\I_X0LJWYE0S>%>KA?!W`KC%+MIG +M:$B\4G)-\%?_"TS6PMUICR#<\][M.P<6JS.!H'V8E-WQ!UG-\!K(0"Y3349L +MV1JM,E^LD9>Z;]TXKI)=[^[OB1(=P`SPKX*2 +M_2AYV=SWR-03IO"V-400X"TAE*OKY.5JBS2(:+!E=\+N5#*H#!/GDE(![,@X +MA$?4B1L@^+()'[H9#UOOKO?VQ75JOR,"2#X9?VEY!T@--\MJ(10#OX_E1^F; +MD;G4^P;KCKV]"1]T9/E"!5$??HW7M$?$<_>,?I"`?[80C@21B7]"N.;O>#^B +M2*])>]7D#A^,,[9DB1NZPHS`3T5%@G&T](U6Q0M4JN +M_GZYN263Q&RIW'("7[Y92\*%=TI\LRFKV4S?CL-+R)(67S?C'RL@MD'RKADM +M,G.3D`%I=$=+11BB#*-*R&+$Z9ZJU-S0KH +MV+_'F,]9#3$/8`?>GQ4*-O$>`- +M`H?D-';@'R0T6ZA@U[_?8F,][`FN[XC"<^%@Y=%;V-8E@G/Y$@4*2"B+1TA0 +MPXKPZ.-?WZ:ULLD2NTI2:\YEE;_`W(6OAO9*2:&`%:489J4+OW9!`3T9U`'3 +M\?G"`I#9H\T)3GOQ68JH'9.RI+C\U&[,=SFJ=F8#W:(Y^C:-?+F#9WK>]Z_& +M-^!7K?O-_7VYJ24(=/QO_C7LB]S75N=R,X%;)E/YW#A, +M)P.A3).43S?WWJ.8OZH11)1]`.*9`QN?Q@]V=V1/KM0@O,CD`3X3!+C^,L8 +MZ#ZN(`'A36'B!8$%N@H$#` +M(8)2J;$`(!5XQ4A3A@F!52,PS`<O@K'`KSJ6; +M;1\A\5!'<$+"_29=%GL@2W++)L/=DK*T)CP@C%(]9/8.<$K9K46;A;8#\DV: +MSZ:M$DRBWHF0G/W%L0G.=>4P.;DV+:2Z0%]LXF()PX5#+N;:THX#Z+3= +M%Y[F<A<)J30DSK9G#'D=$3"Z!UL41[`NZ6GE$8^V$YTSO]OISK]N +M;@RV'BVEBBB;,"::@J-S+&!5X=>JBO#7.8UU5!TX1BX(?UG%(KXPNGXJMQCX +MZWP='CZ[1_R\H1V$@IE^SC]:0U\PEMR-`*O'!_MA*Q(\?]Q+@$=(#F'5PBL" +M"=U/H0EAB/+4Z,#^[3T82>BTD:V$;4%*X/40E^82W_K"/-U1+^1&W]4EW00D +M,_"/)$!N?75N#JY7=?VB+@:<=DW32H0SA72DL6A6:M&N&O#G[J=$OZ;"F@]6 +M>!S>$AU1,U6)VVPNW'9I!E`;&3L35&+E4Q3,=QL%'3MMB;/] +M]&73X2'QWQEG<0B2>R@+C"-OAN]H7,P+X(;#RPYQE"K>W>GWAUO6S/"2$3M^ +M/&`(4??#/X)61%D4NG"/'-!4_,Z]FO,01_"JG=0S40M/QM>_$%G+I$@LRB_2 +MAZ1VQGN#[,-SPN;D=">(MA@L-#B@X54'O)<4/=__2`QY"=JKUC>OR +MHP?9.HN?8\WX,-S45/W1T)I7`!-8?H.^\PK3C^'5@+TBX_867^A8TI='1`]Z +M$`(;NQKWFC;HT2$>9\T[T_AXH^,%4;SO/JIT"64']D10K$ +M#WT`=.\8:HF*.[VCBGD6`'U:U?GSJNSFXM3)1,[8A'%"^I-M[!DRP<90HC15 +MC$5$6`%IU6$E7_I^#;^VJ47<\Z3[;[GCYXS+Z)JQ;B(1D<1U?(Y^D>)+%2?>X4\"1TE!OJJ"YO8@GV$0+\;L_ +M!3T++YLR#[M>%**VGMY)7/:=&)GZ?#P,9$=APYSW`9<1AB>(UGO<-\K55+?/ +M?,:V'C00RU=S]EWEHF.;6=[A[58=E:U)@TU@^KDHZ$=E/++:\D>O,1_8_`'^ +M3#2D&:<>T-@3)_AP=29]FU>=9ZGE16:5/;Q+[3?V)F)^?2WU:M<P)9KEJZR;K=O<,=G +MI4%XC@AHJ,(_8O0!'0(,&>/H11_%/[X@5F+2@J?"->B\.T@R+Q$:Z,>]1(ZYQ+(AZ1%EIKBHA#U+?[E[NF&6K6"2V.59"&:R*=G[ +M/S[\+2#H.B62ATOVNGW_IZ;):K]>I[QMO[)O/>\VL8#=;R%[`F6V5KJ;=13+ +M6UFIQX?=RRCOE0A]#.W8``KTRI<+5%RDLI=E)=1>I=U+PI,*3*EY4O2C!`C* +MUB@2H52#"JQL&0(M`ALK6F)M;8(<4K@Y1'6!SMQ'WTA&6;0E>8]V&@KH0V3V +M8^2K:Y:MW@$89-__WY?M76Z$D,84N+Y=!&,@3"/PQ%;11;KK2MH4A:A[EBTF +M`F%/;@7G%-\[9A0"0>AIUYXN0:H[/OE*OUEZN"><_\B%_,G+>1BI.L@?ED-T +M_'G&*$V84V?5G$+WU/W3RY+I4]Z=9+3!I\TTUUHF_B_;<8ODQP[L*A>/UH^7 +MZ=6UNI'W$*6H8(T+\2]5&HQ&&SL03GKQ2'D=0CJ1T]3#23YYLEQ2 +MIA&">\)U6\()6:RG]2!?AW<.`;IQ(%W'^\6`MI%OM4C(6U/6BV2V$:+6N<&V +M3O0Q(V=XIC#"P7VSJ[+@Z*]%!6)5ZU%DY;U@!K5'U10-?FL`/AHOPH-7B.Z% +MS,I!@-ZLE8=[C,[M*(".EM4(3;1A1V+2-J=DPD:,WVMC"5C#U&\:\6YUA5[L +M:X2UIBZ^("RSU\Y!\K"IW`=#D(PJMD.D#>]6<_(B@7LCT`1B=:3/X#IHS5W17K^I*FP*^%WVTJY1$&KNO-T@U*.\-$G!>R!2 +MWYGVZ5/JPH03^Q`:N_-G!J>CM?B3W:`3LY0GQ"1YU(-'G=01/K.!)SRX8@B] +MQN\Z;]]8&'WA]2B$@;^0<-RH?=0DA=\_&6%5]__15D@5FU1A&%$"XTD/+*JK +M&R%JZP:ZSL/`'QE2K%P2H0!B#KSY0I\LN6G*DNT/[8=Y+:/V%AVPE8JND@R1 +M-ZX<6L)O,1!.YH41?G^)C0/;-Z86K6<.^_\#J;Z@%,ZJ]@ZF^C[V +M9U@^RYR8@?H('4LM=F>@-ND^>US5:%<>N6#TYLW%G$C:R(5H1,6CR)T@.,C* +M_B_:]*>V#06X]!/Z>U2VHNQ/8;7=+=M"J'VT2=KOS!2\.?[Q=L5!D)H=5M7$ +MP@L^QW5JG/!&#MQ1CP6W6^]0;2`NX^G[R9R=-LA,*@1.N.5D7=8*8KGH`7LP +MJ?F.+[>2)A1C@L%<`;C@V@[9]`SV6W8>!\HR*7"^VP7"29<,%W#N!,=*\POI +MR:'%(P:/HT7N`HV,T(=I^DAQ7*Y=WIJT/9ZQC1YZ\@SZ"P%NT%-7,_"K$@6: +M,DL3:_$MW9H`*]6=&!,#*(F9M8@DK0_P-#9>7T_L_(FOC1\/ZG+M*N^RJ/QI +M*K#SBO8#-?A[$R!XWN5.1AR'?[T&$!1FOJ>O.8)G#S&R)@7:[P34=\8C5Q*6 +M44E8>*;\BT=L:"L?M+0/(89!D]]C?1NMO`^YXA`%@@RL[ZR)T$EX4#;%T^EH +MJO4AFJ];K*5.E`C*1-SA[4]\+.SVD=/4047/T+R>6V<..T;J=QD3+EFDZTZT +M^>X\"+V(4L6%58U3'50FREZG[@<38TOU9D<4KB#KAJ%Z=06O'AT:CN^SB3KA +M,*?G@JSDD+>)YBEX2"O3Q"RU?(XUVLE8?US%.NDKJK1)E6U@-)[<<9"X6W%( +MT"BP&356CWU:Q"A>R`X,-NCM@-`8@!8 +MWERD8AQA5Q-K\8H#SP)N@[+!<(Y'+>!%696;#P.V.K(V4]8,M$B<;-7J2N;8 +MSMX("LH<]4T58UEB7UM*MV23+7,'7H([K%5%?64KQLL2JS&P:XB^5_]W6'A1 +M<+DUEO:?&2?>2GMB$;U6`:>G'NTL7;)Z,9K\W#W-Y2QC:1E\\2H7Y=)/;;)Z +M.Z(?@=.!,2('GD`+;_2OW0_TZ^E)-XM@0<97--DGG6\33^9^SCF_W-CNK5K$ +M>[;[C/+3AX1*'KQ3B$?L&3#AA-F]N(=<3DFT"^ +MTM?[A#EXMW@U&"UJ>G;LJ^G[I.^SC^L"8AOJT5`2&(T7%XD8&P@9`595\\4G +M16V%1L3)?`\E_+B1Y.E*][+HO+A`A1G)=1,7K^.3/6:;W/UZ*T">WCO\84T^ +M$>+M@@Z!/;N-`/D(S[CJ.]P8]/7AQ*?:) +M#&T\^?K.J;@AI[/#.F@Q(U5:Q5G`&U/JD)ZK,3,H:F@W_NNT=451;G>C5;S, +MZ;BG4*.LH'8++'YD?%=0PV1MYX#TP`&=YN0^UA"&\^/?#W5>*9P@R3/WT,!& +M12W!%C64#VOCF&CBNT.`V!QW@:MT:]],[@]<^[-E,=_"QQ9TJ_!Q":;@I2($D\N35;VZ5[<,@"G#%6)>&7+ +M3KOIER!;_!7JKL/\'(^\$X4%Q]]KAF`;.O\6F.,$-LX-FL'&!5N^+CK=RQ15 +MD2ZXR?D=2%V1/W3\%!Q2ZC5S$R8/:E%6QDM"9'0PPIH=0B%$J$">_*9 +M.)_$0.\6%E[6M3;'F"ZPO-6L)XJ,DRK7-YU&C,E._?W'^P+V80:DW!6\YX.S +M.`+\>"*N4RCY"[!&7>D(1J%JUFW=6B9H9;A\?G&=7G,'R.KR*'*KQROX8O(B +M9]WF,+RF4IEP$%=6BGERF?3X!M^:VS?YK;A&F?:^$='Z<@M^O*,_!^85Q;F% +MCG^$I['J%6H6H\.RX/)_!_F9/"SWN7Q%Z>XI*#WU;G;Q+R^S25CP6V2K66`T +M%(P;UH_MJ+TDI$_>%Z3AMY3^1R67I*L*2G:[VN2.UQZ#@'%AD17A6UZ94.%= +MRS1(^H[P8EMUYYPD]-H>C@P4(GXU;JO>&S,W#GP06MAOQ,7'8PP[":!W^9JY +M6/]GSI:GV)(4.T5*@%=+9`X,J'M&`9C84I!:S9_ZSG", +M-F)QS^FU4[`_1%*\,S/7(G9F>0E2B]G(N?-D,/"FER(C9Y7O)WR/`C*5<6U- +M+#N\JQ95[!T-@R+=/]1SZ1-I!7_X6IX__.,&+Q?=_>P](;(YV2Q>`AF`-7DA +M;&W:6`ZP8O6/'4V*C\AL7IM'F/*&BL`T4:C7POQ"V\`F-/T%26/#,H,\<#_BF4\=-IY6+VFJ!_>,[8D&.M:K."]S +M,K.C):(-GCSD?+GJ`ZV'K"!;D'&;23VD'8&7XY1&AV6T`/OL$2$;<;_2?K&4JB'_@E(3F=$(@DPX8(U(ILP +M1$LN2?YO9<9>LMD^AZ!;=]Q2SA152BLV,0^Z=:M<)LTF6SIZ<2(TJG`)A-XE +M4/]!D86Q'?)[L&2FB=%.&G$URT6GIW:L30-,,SG*>[`P+:-VB:9I5_BF7?&% +M2,'<(=E+LAWG#,C.\=-X2L@2OGK+FP!U;:'DW7G)_<,_UT;):6E#VU]CS=@( +MI:O.J>=`>P(>,IVP-YY:7$9X;),7&+&F:\=FCF:M8GI.--JP=3CT`WE8"9"' +MZV@TO@HF%Q3%WI+M*%JD?/#9&<<_J,WAX[1/5*K3MZ7O-T_1.LH;)UMJ76.*-HUL7R3KX%@)1E1-OKA%DUB. +M1X"?M9ZBZF2VL"'G]6"G]0M5-NT=X\4D=HYYTEBL!$0)5VC2)494NB!R0IYZ +MYYFQ.+%'=^BJ=.WY+]9J+W+,PGK1:0&8);8:5[06#+8`S)BF;_*!*'$GE2N/ +MY$OG%9=$/PU9-BQ_QW:$J\Z).)\%63?\0*2.L)CHYSK9H2/1(RD>?Y!7AX^: +MI#DH&E6Q;$UC.+57B2MTR15HL[`E-PBD3]NVFM8E6B++:%&T*H0U5FP3K1): +M.VK)B+9@Y,E]K\KKX6#WX424F'SO+"27OEQ7X$GXY;$A;%GG>P7?>S4F3!R0 +ME"'4%8@]E)D?'+XUDF7RQR>R10DTAAL&D<`B.I^XT-$'U<8Q8I*QJMT!(;"- +M%YA.U.%PE$%KY21K-VZ^)3XF,QO!?"HOD;!2`GP)"?JW6$T'9&14`L`4`&)` +M5R0;=/5T9EC&4_PH]6E;8E.V);-361=!"8,+NC&1%^D`]L13F_7SQ('BIF55 +M!^X$22"(`$F`)QG;K+I>8D'C_:=68=A4^XA1Z[=%.N,67=D".PRD^(JA7MC+ +MEZ6E78%Z,572U?UHR[Y!/QD_1M+0=8RXL6T]!Q/"_,/]Y<99:$W$J5SMU_UT +MR[YA,2N;\Z2!FO'%(*[!F>XF9#,P3JG9%R@UYF8G:`R,,/;-"53[UF@@0(]5 +M4,HZI!B=H3URRZZ*OCEW@(?V8`ERABY4$F@->R""Y)-]N0E%:WP0!.*>'W:U +M`)R*?=12PKXIBQ2%6R):HF(NPO2B@BNQ-I8Q_NJQ<*6Y +MQE:*%3+_%.WN='0%VIZPS5>V%'84;#HT@;*Z=$']FEM14TV0GKLE*PZ&"M"V +M*;1X=_J?GY.<1^:1`+-R442=5Z:8E/E.0)84I:DJ$IQI+#DU5FY:QFJ[9$DUXTYV)Z+05`UX=6ZZ#N6B>*G`KL92\2B+PL7] +M]3(V2O@ZXZSB\,F:SAFLHQ6,FP=S#6$SQ)>[HYR8L7<,6T&40=M7M2'HG%XU/"1<7(,&28[F%,;;5!]O'^1+R_ +M\G-1)C694ZYA@;A%^\P1>5E&%5,HMFZL9WDL8JWC#OR\<7`;:$2TZZX/4L-! +MI0>&M1AF&A3(-9P/**'U'.JJF*+AUS4=]+R*A<8G*[-G>5H3;K'*XQ%8(J\F +MKM!V`WS8\&'G9!4,(.''X#JU7$L>=`.IXDF!V)=&2K=-Q+E/7 +M>BQCKDOG[<1V8Z#[)'_S,5#]G.J8?J03OPRZ,"PWT=PG_Y\O*22RK1W:K.\[(63$_8*W#Z%C],6#M%PD20#OW+#?_/?_TC^_ELS!?S^:+'97"R_\:V\P'V9+^+ZK+S%4,D`>;^EK[\ +MQ_Y\?\X7=O.<+_NPT6H'KY:QQ?$ZU[9+@M3J9KIM94S1R"6#2M:#6(L,0Z1BAO19 +M,2ACX2)1R);]]S8M2U1ZJ!(2CC>*5MQ$;F.:+VEI8XFU?.K +M*7-(.BWM1?`N9O,FSRVLNV:O*$0R)/>/\7<$0_`E+`L[*:+VF!*U./,$-ZT0 +MNB`HW<__4;%WP#1V)[&FL+J>0C.&!E!M-1V&(`[N_?&1H'@CUQA0NFDA/-R2 +M1+II?_FE/L,DV022YZ=KD@0N@$V5CWR]I5Z7F^>[@YWC(N29;7ONHI(V0Q"W +M3/][\:+ND1V4C+;,-%BA)2XR91^*R/9;AHPZ_<836H$&&J^>?N2%^%"]5Z)< +M=GGXKU"GJUF=^0%$MR86:6>[!N\=>USTI:&U.`8Q$0FC,(FKQ7$7ZW7!7D7> +MIVCB^JYAGQF$,Y%U%;!<[VDJPU$S'+5?C8Z4WK)BUH1RJQ_Y>ZMS16"NBE=L +MK^7B'.ECI(Y98"W@188,;4[>A#ZB@NK.^,-"U_O!@P)9#YD@ET"G9W#XF^W! +MZ?+Q9`,L*K>#.^,R`V^2J51796L'WUK5;7`@R5S'F23FYC`,A1E8L-%]M%%X +MR\`.:1;L:0,U`U-PKB>?*9;OL;<*-^8OQ>U+$U8N:*GZ.$EM=T%C3@>-`&." +MA=&)X6V2UDAM0JO5?\I(:X@?JY.D(VP$^9,FI!WGDG*>!,R1WJD6>^EZYTBZ +MK6Y[J(V7MQ)O;@5_>`TFTDG70UW#*P:,.NVZ3+8A7R;T\==647[914TR;7*O +M3&:WRMBO"KY;K;`%L_QW)XU'R`5I7FZTDAO71/.B[BS+LG3S;UI5M:V6[3CV +MN?8,>_2.W)W1?%\WL>[FQ2T7)!R[S +MV9!G]FT-6-M,,%97W]Z5)[B+X;_'F9RBNI^TB,/),8C;*O3'6!I&.B$@J7Z) +M/2IHGH6V35;8(5HLL8^I*I5!=C4*I0Y,1PNI5R.-SB%2^GP5:4,7].CA1.$- +M&5?WV(;IS$:'O%\HX[2.DLN!:#-1879$&(%SNI3IYMI/"Z30N;88[7=H43:> +MR/$P^\?^!NY14Z@"UNR.5*H$*T7^ADF*FL+AQM/^R8;U">6*?E6[X7.T**4Q +M_AU!OO?]6UR0O*K"U.>EX->_YK=\8`#9Q/8STSH,_$L`PS80*'L-%1@13K[G +MW[KYI`<*U#_97"N&Z3Z='_O9>]=4@V'A?QW9FYZ]J\F3OL>4HHY_/PT[.7DR +M,UD\NO?6'(MAH?WF^=-21QM`<@4$[Y<7(.BA[&@9CTCO-6(?_F55T&Y#PRC1 +MY^/BP%P@K*!$4%>$P>980,?VN[1;P8%X/TG*ZD>8?LUNT-_G=W#@YSLC(K4L +MC%B!;42V%(;!B^5!7L@M)+581!G6IFC+G!3;A/2NC+0:Y6L,NLRT3,MK;)O( +M+&'OVC-TD%QH6J*`B[>+EKT^"@MV26IT153(QQ_)+:CW#6S3_L%O>F79C^W`^?+V#@Z00^U+-_\&\Y4M-AH?V?(8,W(M=!! +M9XL"/*#BM`=:+GD7^DWR0(RY`,[04]M&?T4UHKT>F!E3S1IH.(C`.F +MAK*P9#@06'@_\<15N&\5JCS[9Q?(OK\9'^[(Z@AF/BBJ:-?6A_]_MW[P45T> +MSEB$>JN*:8N0]31E6X*&C*&N8B-VT`!L#L9V0!T;0D>2TB`YBC\P`E\=`70\ +M6YK'M'G6\-)Z_E:0>&*J];9*P=5L,'59PQ(N83#UJQ)*](*4F/R([D.L)NRF +M$X3JRF$S^C']*JVCB=BX3*B=;(5#[S%P0^>;T5O"R>N16D_%25?CH=G^1_P' +M04%D#H>OEPJ73=TDYFHI8T50,=_`%[O).P,W6QC8[J^'#..]!UL-(*C-=#!%&WQE00.3`>_?[>* +MZFZ&OB)VTFDU!:*TF9/>X%ZYV$BD=DW6GRITJ[&Y*O^2<_WEW^P3Y\4]6[E +M0?7MCZ:#\%I#_K09P"!5LU*1/;(0`D(!EK/ZH1L`J-!GVDV^,3"G8-68Z`FW +M2;/;D]&!:)MW30,S1SB'IL6'A!\N@$NP:)7Z9-6_US"&^[]37$I@=`UQ4";6/]-J>'/>X@3I] +M[7);-.I1?G>&Y$>/:O"][?Z/$8`_XYV94BV7Q?H;&1 +MC&_^OA%0&$@L&I_9*H)M;K[;``_U`@-V0A#MI$]?$7$.BR4N"*4?5-2C63AC +MT8')INM>3-,+LUHF'J5/C'$F3$,+=):.B3T2'$5)\!BE466\2O +M%A`8)O;6PPLYE+"5DXPPEA5W@5+%%!5@-L,7_;'.^()"-\EEJ%7!W\7'W!%" +M2>P1@1H0MA96%26UW:3KXF"3WXF(`B9RC28WMM/?(>1Y.Y;&(6RCG\B;6+^/ +M[?6LB&**0D#BHIOJR)Z55M(S`5MO2Q`HD5%8^!C%3V<5OTYF\#%2T;5[Q&-1 +MN=XTO#^!>XJVK'<)%S.$>QRFF$?8BKP<0J>[3Q5#R'YVC)^PJAH\K(LME1WM +M]E$*38?4$-Q@E5WXR"`4-NM*Z1=#$L?I++:;(\"OBCO$8G8.Z,$^6$@.FL<@ +MPT5<#E,J)N.``_,1+.">!90'QTU<.GC)H)0O1*X5\_VX'%@\KAO:7C!X`F%$ +MS0;1&$X$]E& +MA`29G:CI`@]1C5_#C?JT/`G@9\#]"YT2@ZN[K(*KK2,MWG?:0-V(<9/M:0_< +M3F=!(F`>OUYS!VX^7'6VX]:>BB(_)%CL0]`\(K>OC,,Z]`0H-L2WW5DK*0;` +M"@/N5$V!,HPOB8?Q0E($U;P0A]R;()TO+,!'TRXO*S+"J_ +MMN;>\39ZZ+R^_HM^R8PI"5.5\&6GNB\NA)2I7Z;ZF]+]Y*EY5,2J;*WCWI[H +ME=W_&\O1DKX17G\DC<;KVZ@L2+)?)CZ4+RD7??ERMERO/W7?_ZS_^D?]26R4 +M+^;"%LJ)0O&-AT?E`$..C,NJ@9`O^H_4+#>^P>O@P=1_L?3T!%!M+:X9&9+M +MPJTP@VFW!ZZ&&0)"U0M9@R862]J9\IQI*A5>%6487)8 +MXIQQ)J4Y@ED":,+VPV;D'I'HW?DM$?B,-S.RAVH[4=J1+)GAX2W;OGV@Z!I1I62A10DLLS4IRR +M[6NT;87'5JQ_,GQ+SB/0?DNLW2GF$8&`2T9"SY"7J$,OE):HAD$NW50B@"7Y +M_"$=5O"7MD>AO27K_.I2_0I\1'K;XE\HM9G:PCPN`2F@$.5X<)<$C"A;M>V. +M_<2_(^O7\95A'4W^UR1_"4_ +M.U'V87*%!6,+W=N/8@+B3$38_H1B(L;O$4W&6.$&<]%NU]O8? +MQF:?=Q>&$%IX"YJRV6=^9J\ZY>;4%$B/TK-8EP^0\-8:5"O1>K$!$21K=6D( +MH2.*3_R;4GU&;818D(M;G(JE3VW6O+[ZXVA\SVVI9[9-N,K@WH?1+IXTP%\P'KQ9UWYFT6OP8Y%;F[NV9<)@Z\X_0S^Y%&^H[X):>MBCV1NYY^$S7PQD)7DO<:SVL^B':6\=5S$9.'CK;K_D'^XU?,B7 +MS.)?BZWC_!L!^[2$:^'/?MO//T*Q#Y]6X>='CK">S*/XAWV=I/%VMH8LW9*R +MN+]LF[+:9ZHC"UT;JL[_"-Y[?!%1\#D58-=,[::]-IU/#`%+H]09*6E)Y)6P +M3!3(_V&+KII2;4/<`8>JZMQU_OJM:A$1;IZYJPI'H^B.YFU?,#1-%@V&DS"= +M8A:!_T.OK+C])'<]+/S;>TD,G*VOIC:DC^V8$8Z-Q7Q4/M-9[^9L* +M`4094U<1*/+ZPB#K@/"]/OV^HA(SP(8!3'M@C6]#NYZV^HE/?UC5,C3%_<-\E6N9AJBVA53=%R_=Y-2B'&;(^V3CK4)_6?]-)\UJN@("QU +M7(S^\2J,ZOQP=9E#P[UF/8TTX&6"`89S8_06D>:#H*`:TSK@S;#0O55-AS/J@5B>BT/EH%GLH.Y&G=Y +MS-:)73YLYD*B%$4"HSG:2CCF-2,8\)UMPD[K&?:++DX&_*#:!VE"YC!Z*0NN +M5G!_Y-2@N>@,7;C``;TI(B/E/4'CEBW&Z5[-K=N3!!%*BY/<=2&`G4=]/S$0 +M&Q'][:GO*<13+@0/R\8\J^$EHZ_NPCY(1C5)19*\<7<=A;EJIA]A4A5MRB*: +M:N_!+@0E]ZA/(-;_A`(MH9C,H.@WS7#4[%QE6X(#")$,L+9@]PA`5\FS@8(] +M*08=I+U=Y&S9BC->8:I_V$&_?A]4E%&H!MPR0UBC%*']-*3:DZI/J4*@K(.O +M`"]J=,4;@NXJ+56*H3VJL(:\ES11FZ%!COEFSN\?>,`W7?(R]$47A`8-6+:# +M9`W9MM46=NP%_WC$2WK83[$22$KKNHYOQP7?BQ,E1RCNT8]V(,&J?JVWE%1D +M'0/HX11J4:E&I1LY&02UU;M?V:\1RXNR#)U<>N?R-JH5WI0L#+4MH/^;. +MZ=DU]W>)3$C(TH%W@I;ZNEW.YB@\)U_67B>^.S;+>$ +MW'W=WCW+8R_24"VD3QBYLZKN79I"UK1.I_,,8%'X[0\$8H25\)O-#BN*I&9\ +M<)+X3J?`&`1E7P'9=X`^2/A1@$!W6HZQ\ST`;T'=JY'],3K^^@MI/TKS'CZ- +MBPN$G1F=8C8Z?-`3P"R2A:-WDMJ/QC5;ALGLSUHOPUX""*>6^@I*V=WS.[,D +ME[92S9;6(91/;IWN)3[PV7U/.=SP]IL*0">O;X:]B@L?KO2I!TC'H]L+\!S+ +MR.^)ZFF@B&N;PVW^X#6**^&3;C+'A$/N611\^C5-M]B@ST#6.00GC)^+O>6Z +M)98H(7=>,L[WV`_`KM^>/=8__KP0N5J^WWKCJU!^.6*_N/67'>Q(JT@_0B%@ +MT`^>6KK[7Y-!7]#($^=."'VV(?[G*`UXS5V#%S9YPY`(=Z^.JCA)&QSU&733 +MSG?$1UGEACGCUEOQT1F:CI,NU8N)ALC7Q25X0USX[;W^)F +MAU=O+E$V1^Q]3[,R5+B3WY5K.H^$.=.HSJ_,'!VL^\5PCXJ57)7&]F)664]>S4@8!H[P +M0!K.%&(D3P8A0,0,TRN6UN0-$RDM8MA@7BWVB?R6HEGG._$>I^3^E3LT;)8F +MK+[S%Q+/NU$PD1?WY,SMX06$_P*(VYXYWF9G+O?<][;3+\3Z"PY7O,3+/]VB +M9OGB%J"$<1"=A+(ZH3XD*83E;M"BA-B!>TIJAEL*;58@(!S/O3\\)Y-P;9GY%$]G<%5D1UYI#]%\LRB&`5^R#Q33./7>*QU6@>*,T%:%`Y7"\T? +M+`!Z5&J,=,,+R^S63/*H6IO*'7,DXH\NB*;]P;*-^."0<6X]UB$.2H81C91S +M@CN9.;J=:Y8HX*K#9SW?W\$4O!:L!UNZ/&I\>MI)B4<*42>.3'C[TD'BUPTO +M':?2I,[`%QI%XI*^M1Y@73[7T=,C7RW%4S[62)56)ZC(9BSQ6GV"%.-H$6MY&8RG +MKKK=F\\6R;W'W\#-OO._8GN_J@!*CS`N1Z+_*2J-"C3!EYGEB."MTR&6J"+- +MD=B[Y%[*+Z;$#*V2L]@%$*025(LE@MXD'&39Y6@<-9(E+/_A,EZCRAZW[HHJ +MONLRRLN-NJ2W]_^G%@NV0+DTUQ)2;8;J&#KQK>D6%,5&$%N<]M]N\LBY-XG] +M,@A0Y3?6R?_\?,6*-9;$XPN&\YD7VU[>40S;(;+M,D+^)W\FK(L[<+0NCIF(T!,C+F=;>1E8O##1GO^[.Q/T51A^?M$FZ,+`G#AHO +MRL"@K=60M0*'2![9U/M5X5O'IS7[G_Y\6.GI@:@SA +M/DJ2QZ)A0'""T('P.K0D^0.H'!9#&JEU7_SZ3KBK3WS5\RU=('U*(\$20T/XF)2YK23 +M]OC$FN?]DS2MRT0+[;GHF;L#_-`!G^D/[>VK[3]RJPD7LK?<(EM?G/:6`GGS,<6^6E\,$4.G8O>S/G0]CD!I%QQ?V[) +MV?@I[L;>@5C`([="3X`Z+$>=`]'Z-B+05C='3&E5UFY6C(J#"!J-MM +MM=RB_ZF\QBA2NEVSQF*K<^H;.[K->PT':FU^-EF[B\XIXNO;8-`(^HK3$S#[ +M%`%PH"A*R)/+4Q&4`6=$I7T:%-\.`=-KAH:HVAIGG5U$`9O#VS,,Y$VP=C;" +M;-+4'[E#_S,*9Q][&]51Z=TB!\9$PG,/N$YM%J%R-C>A_C_]ROD"NJYF.AKA +M)C;=:`*]B45E0@6``(_QL>R)67@=2-V4`$F+Z7GWVDZU&8?'@F#T&70! +M`?ZRY3M6\^QD&:"_!WH*P[@TJ"F?(H5&99IU*N_SO7OFB`66P_AF&(R0B$]L/#J#HMOK-^;)R+"I1G58"`+SW`: +M_A#.WUJN;@E$V1]TI`G)^3;*;19AB/Z:4"4;VCM#@(%*[SEIN^FX$TXL2RR@VC87!^M>L/3:,8-<:DL3Q3VL2=RC+;4_2C+/@$P_E5M=(53-\JUUX&S&) +M7A2$=:R"Y]]^>SS4\Y[[NBQ$QD=G3\ZV>4T$,3]/<4\F5D88*(C6-5NS?>3^ +MD3G=F%>OL3>H%A/F^D`ZJG\')W#4;&G7&JWDG7W$,RKL/$K+J&=[ +M1M`C&T"@;&%1YUO=CC(4O2#^%?3\-P$%9L8M*3OPIX1FY9EZ6/P=\WLK!QU\ +M6;@RPN[(^#4?J:,5(RQ)-UF.ZD7Q0-.E7:9]T0^Z%23,4CO2'![CI#@Z!ZR& +M.P,_[)Q4EVN/[2N-@N^ON+B(./T6#'F(NJ>F1TT4=RU7JE'6B=K2:*$13^<= +MAO'YUG!V6I\(C.D[13XZJA#IXI%3QH\8BK*/*;$O+[I7/G8.OI%&DM#3PH]* +M?T?/1#/S1-[;L="?^>Q#OL9?CT`#VPKNE_2TM%Y,,:6#%JI*_YTH[+K+ +MA__.&DYA>=%+[K8,1/\_'E[$'BZV+KV/G`F(3`4]_Q3R^W@^\?VR&<#U)$!% +M)A[DG7D#WXJ'FH0Y;X^"7;VLN7,.>V+E:*E\X/_0C +M0).??VN_)N.F+K+7@NF9+K_13%S!=/7*XQ7O)6?RMZY3U6Y'A7JZH,YE@4PRUW)>']!5R3MSC&X17^]CR +MDP,17:>$_WW+'?L;V6S]A:'_-\Q=#[QHG%_XY;X/D4[6^%MVA;N]OI;:TMW5 +M7XMOEENQ=_+;ZQ;NDYDMOB%N631;>Y+=N%*3FBYMU2IE?+_4M*OA:\V6[]I; +M^8YPMV;+?_$N4@K*V"04_^0=CI'__.`Y)[2?!L<"6A_T$WRI3'Z;H<[]SY:$ +MU$%V-^@NMWUA:']5@K318EI;3A:'I:>[Z$M&J+30=$6CS"T_>Z,M&N+2RG2T +M>:H9]X-P82BRGZ%LRVX5M72$C/WO?B7O?C7C!P$Q,:Q/>"LZG`V[TN/QA0B- +MGE]:)U[#U/R9?+DGKZ88><]9;RGFD[,/B;TYW,=2+=]/"RV2V36O8'/SUGB' +MF%0HB9Z*4(ZB8>A')G,F?GGK`=N3=Z`X)D`5@2CRYU&$`9@`7&#`&VP#?_T` +M#[A?.]OHR^`D\\#F`F>.Z3]**2#=Y:B+9[C5Y2^H^[G^\-SM@M_Z8A.EV0(+ +M]A.'S5V*_+C^A$;X6D3>M,%20#1"FKKO@O]KNW9!1LU?36TF<$U9=IW\,?11 +M`=)()G$HUMP)FDTH1=M4>5,<3-#5[N5S4)N5>)4)1K+ZWI7BYO'QK5`K5`@5 +M`RA\RLN4CXH]$2_GJU$O*VD>9A9DTG<2`M<(#?W8NWT-F%)813XZ;;!/0.#& +MW>">R>A+I=E6\,[;NS2=<*7BW+UW)R+:=$7: +M)J0&$SB1-=B4!]_WYIY6YQ]_+H2^7^,OF>./(P5IT$-O\/+".OJP$O#^^2R#@ONI:I%KI%P^LGK9A1#1KLS+(,K- +M+O!6CY:+"M!@.RQI$]JE@MK1/)GFTENQN<@]7T!=H-U=?&[$A@I._>MI!HXK-W5!_9DM=&LR]&,)L_3?PE35Y4E4*(2"] +MOSR`8]0^$\240DR8BKPJ\+&@TD0?WL1#4M>P\#T!?8H[:]_Y8Z(P47HQ%B/8 +M5(`&+HQNK4^`J06(NJ# +M?+2*MY-SBS<\Z7?6`Y.US[UA]0F:RHC:X3Y24RNT(@C2Z$7C1J$7O91/1.'; +M*]01U[M*R?BKJKQ-1YT8_*%`32Y[5Q;#33FB^#15:Z[B=%$_%RG5]_Z"K:#H +M"=KXR(].4B`!C^@`VCOL?*'B\4P&`'Y\QZFUI,8H=1+J@D'IXR%$.`;'7XK1 +MY^+@W,4_2?33*,/4T4YVXO]2W0%6#KW5ES$G)0%H2J4/NYP_N_IYA]82'$FV +MJ/T(/[<6:K*"!/L"S3Y3E`+S!?4_/@"]GHE49D`-K)]#KBB%OY6=G#_42!ME-IE,H7C'!-S`2PYHOH<:7T5E- +M%]#ER^BL^9+Z&I+Z)B7Q)*U7"=H%JVZL[M3RSJLXL"6/#VC5[92]*\T4YD6O:&Z9S8X*N8=]Q?_JU'6D0E_X:EJW]^_]J/GA?,P2FHOI?+Z\OZTG6LK`` +M5(GN[4\5=3WI%P(AY3[\;AVH9_"LAUMDK'=6IU;CYWBH[['2!^WI@ZBQR +MDH?HFJU-K\,1/]#!]%%.U>P;Q8$/YMGWOG8083PB_T/7O)E#+"\1%:?%#!X8 +M^L'/H^-85418_TE%<9+?NEN3,M,[Y]CBCZ0NV/CJ\G(D*8JSR'B`K4"`@UUS +M!/S>8+_<8\6A>TQ6EID6AN!00NAXQ),%3UU%:+7QJ*%6W/R`=&IZ9J!M$TD9 +M[DCQ7_V`;<7LOJ`I5N5"#:L2_1@%4R/D[?C*/_@E54NA4&`$,(,'^6`X/38O +M_W*).JWAF#2/@?Y`08/N4"+WY-/8QJWK_`[_<1:7Z>]P6 +M_1$:W>"&8)@"<.N?UI/?A5V"^H\US$3!8?3++ON.UN->JTR9>C]?H^"O=:@ZYXNZ"VDS@T*L&ZU!Q$A2>*: +MK8'CGW^TE/I+41,WVY@C+%Z-@6WJ247+EP(>-;*W62#,!D/0\:0#4@%HA_*D +MJ\+E'^@+C#@ER_1EB\3+%T_;=O_C@70E[4+MRQ1*O\?[Y>K)]#I2B%OXVAY+?3R!_\K#` +M,@!,"7T7H+B^AHR_7T'+,#THB%_P]M]<)%-^;(A*OJ9P8^7HCX8AC]0\>8R7 +M:C*W]2NT*WM%>D*W\"!\)U(\)ZYPO.[6/_]`[FEA7#QK2QGRT+BQW!:)8L-B +MT78L=,0?S*M-%Z++)%H8%E]PM#$LN>+1>RRXJXNO,21J^ZNM +MY]+XI67!VZDK?\E>@*WY2OA"MWI7PI6[5\, +M5MZM4^VI[Q79%:N*^'*WFE?K"MXA7^X5L\5_NE;\!79E:F*Z16PQ7OI!X/*H +M(*,=U"=YH3GK@]+\1`MBI;^?;KRQS)/UBQ-$_.+'-$_U%CFR>D+'.$ZHL8`P +M7<0;;)SY7Y\G@2OT!.]%?!$^)Q2M.$_D(,MF2Z= +M"3]TN?1$ZTN?1D_VESG2>F+GTA-T</U?QW +M5XL&3[59;N'36\^#6X.W3E;J2OU!6YLALZ]6K6JVDEVSM6!'/-U4 +M%S?TDU9B1R2IA;]B?*-JTX@Y#M.F2!#.8[J03PK)9=B?7/Z4+1YS!VJ/^\0CS%/64V2FY4^A26Z8ES)'2*-%,>I +MW*GXU/#4\M2M4W"GQ*473AYPAPH\4_6I["FW4WJEXZ@E@B,.IV*G=*:%3R%- +M0IM%-XI>)\E.$?<4QRF94_.I^]2O4]]3YC[^V)<41OTZE_46BBSSG&*!3$J8 +M]3NU'2GBJ>8I["FU4^-3A*,,(`3A#$2OP<(:J=NHK]7U=6UU_<-D]ZDFUOO( +MK-UP%S#0^>C092:/,TSR1V+7J.K3&[NLY@(0>9:[IE*.:#45@FE?9SS!]IH? +M)%B&U:_S^R?<.-N^6SR"?Z,<*2]/=T=4TG+C+FP<(*&)`#XA>.!+$%K#(-JF +M12IBCU]1II!"G*,-([JQ]79 +M(@V:I*")"RBBTL-*L=AY*EYU$D +MO*X:A'QN8+W)BD-#'(PDCHLNV#\959^UFMR'$\.PB&SZM,0?[YY58=M<(!FR +MQ*?YEST!6_05?O4UQ%U`>S+$WR<&U)6\JI[99618K"Z +M>"5OUE7KJ;8MTIVQ59%TT96\LJK%-N64W:8E,D7/\I6_855JGO0MS,L3=ITT +MI6\TJ]E3^,++(EAF73\Q#9Y4=ODE?5_<0>2F1]FLD05_-`,2E>SX8,$KJ^41 +M_K-.IY"G^ZGEJ>:IYZGI*:=3U5*Q3V5+!3VE-FI[:FW4_BI9* +M?V4?*?(IO%/[J6:G#4E,F7"XK+U)E1BI?5)I3`*3:DXI.J8-2?4PJE"IAU&: +MC11JHW4IE,:ICE,@ID2H5JBK0%L([>W\^4_#QI&H'G[I1!@G+CRIZXS0_TM. +M^HATK[('6LD]*XN%Z@_V3Y;3A>I,J2DM;/>%PO4F2IJ\9L5:4':DP@[1L=., +M)_GI9.$'@=QJTP_#)EJ;9'D_/OE,2OY$Q5@"U;&X<&*K=Y>3L(VO_,7?77!79OHTTC2A";.N!%7JC33TGC;+/J3R#M +MY=8JUPVSEN3'"`FF(T?`LLWE16$R`@W)^XV90+156SIUDHV6["#N1F3 +MC]IJ\Q*P6",9;PK`\,_P#Y*=;XZX"QQ>JCO4I2*'G07KA-I`7Y.OHV:Q9^]9 +M$$=9$0.()<\J:F<41FKOV4#E=E(A?()] +M&C9SMC&L'&348C&)0+_%SE8TMZ-\'F8"']+J#9@.-JM452,8EK!M%'H*Q__F +M'J`^7$@S-(LB]2)#(S(V?V84U2OF.(X-9;/$9^B&]3A^+O-O]E;/@X'&==T+ +M"XGYY<(@.3Y4XS+M:_TBODOJHPG@XL/;L^E^(/NA7.*N$G(I=V)]OQ493Z-T +M]C2AIRP\SM?;A^*5E_#O%;GO=:LK'-WOD>N&5BP8],[\9W3Y)&8=E.;SB0KX +M?5]*/]9/@/$65*3F)\>_:S($`IS,7';'57:/P_Q1%4 +MV9%LK']IE/44]M1:"7_NPCD\Q/TVR]]ZGZN5RWS_V_43^DVQWK*2@WT=2VRR +M-.F;1'P&DONX\=&6.MV)P,>C+'*LX<$F)@KRY@P84#D0XY++&!H[G]8S9K&^ +M&S:]Q>&G(6+A=A-;`E?065;5)NGL(G6J.*BS;/NHX/U.V#0'7\-!4_O@BLC- +M3^6,*.2..W+C-?!KK@`UNLN5$OX\!N +M\SR;/IB^VV_#6W_'GR>S%'&A!FN\FNUALUZ5X^83S3DEE="BIL\ZU_:Z$^,V +M4U"_:+%XZ+I7T2[A*U%K,9[N,QPMFIK`R$H-)M`:XM5BQIX19MX2B$X,M3R\ +M:,^/2U7=L-KS(,G4I[7#.TN?2>9;A*[GU:$'X8R7X^%Q_H?*=\45X^(W2&DO +MYGJ:A[-5'`69H?/8/^@6(L;L]L*-Y@^:26Z\>KFAFA;>TN97$&.,,PU6;%@Z]%& +MKP;?J5O6O,!558>A[Q\D.4K;]2PH`/LZF#%VCBS-[I'E'+-!>-5YBFUM)//> +M/5T5!]+#8@7B$[[@M0;$,D2BT*YO^HFY&W50W7X(.N2H- +MG`\P-DOU;01(^FIR-[MTAUK@YAO;X=2TH7DPTGK+"7C$"9=6"Q6%%MJ6-*RV +M3#P*Q"[P`V1G;$;:1,VD[NS9,5?G=+C+RG9/'V-;?\"'6I8GRI=((1G9/08: +M2C[T,$@EYKRA?['LCHE3])0>^"%77%7,-!Y,C/]FE>8N5]@\R\Y[@2,^_^MX +MHKCYSAX=JY[@=O8+"5;.+<.L<]F`HM7>'5DM>V4U,5I^./+\"^U_#1O."K:2 +MIK'$NDMKN.P)9*>KE`T\K-5&Y6U&M:I5<59#?$%J()-?,K+57CCU$L#9;_'Z +MY=UKR9YEJRV+#P,Y)S^6`HIILG77`2:-WFW8I=BCD,BI(PCX]%2V*>ZCK;98 +M3&<7;Q+>(SX^>7[]$;H]SRQ\NHX-*'"X/+KU>+Q_TVBUBW>9)B*V"'D]!K6B>'T')--WFVUWM7WEK&%3S@BY/?Q";\;ERTG7Q2[5;]$/]BV6_ +MWBJXA<$/+LI9L!,-UNS'>MM^J546%Q=I'32I^\VVL`2TBJ/NAG&&'"+*=`-M +MOZX[S+1Q+RCR\>UX>#$,I:A_><_N1P;"S#U[9+J2I^5Q=A,+JX"X3":L? +M?L;$VQY-/!%T0;L#<;X+;QYZU+/V1^[G_@/V8OMDM5;]Z;S%;!L!WWEM@JVE +MF(M)N-8TJP50>@T56`T1TL24J4S1):4S<2[Z=JQ+SC\L=`.OZ0'<%K#0:M!? +M0N#]Y?KP-R6HK4%\2/\6SQN)C67(,BP\#,R*#K$D=!75%.X2J/QK(#GKSUP''^ +M7B1P9JT7%1TO%QKCV4,OJ8!G9:\HEX,Z+S+^K73Y>]?2J<1M6'X9?-X07P=` +M&X%YWPELLU^=#;`<>6XU#?)R?'#P-]+3_P);5Z*=1RGG26T,P'!(_:8;//\E +MU&#G]X%.1[.6>'WC"J-GZL'J;PM.GO#*S4S)2NO`/5(EHG':LATK20=FEXE9 +M`B;O)$+*O*-<4UL]7.GRZQ?1^*.K-\/[Y410ZC6[RUHC,Q&S%J9E42T-;,FM +MA*M!T:NE9/Z-#J?`[,H$B@S1(9$E==`GV)5*EL\/GBU?7SK^+NKWU;(U:8X) +M3KBA4DE9JEJD+B#48WU;6..9?Z`>>&7?N>^)F/6LP]8YS!\$55:J +M36LMB=94NB#N%>4UZ";NA@P?NRCU_?W6Y6;^+IZ=BPU.Z7O?@O\QLT]6"'(_#R5G +M)^DWU_\T@)]T0-";L7J#SWK\/P[?0FNCEG^?*,"1ZGZQX3X",/KFDCIJ`Y%X +M,T,HY^TFU71W(/6'>LF;Z4)BK6@V@L7.+UE'32B&;ZWWWVQ)N\Q$TKG(9Y0E +M7`EKB+?END6!V*R_A1R.;VFDN@V"(DTYR.S4O=',S=[3<'9'>/7\?IV*G>HV +MTGTRNQ;!%K'])&]T<6N]'"ST,B4Q(]#84T3O5J4=E(U-:$"[=39ASL!9W +M9L\OOW.11X6B>SI9[6..HT;#TQR].=@L;+=:#*0,M36+E.M'"FV/Z/_5CNXL +M0!Z@'>XDC3$Q7@JH%-0['W37/-N(3&X9`_$II_-BHANE//<,;@+I4FV=E"// +M\(N+THCSHY(]!I&4;G!K(KH2LC);Y0D]F$&O&W)G##T-(L+!C%19,=NC@V`- +MN6'X2:85@7!CYU.W5WF3/+]^7"AB3O?)>>L;:J1PS!Y/1C@>^VKC!"O.50CS +MX6":D8"=.V&GR:13.N%JR<_$*=D..H)FZP=8$/IIKF)I?NNY@9FSTOG +M'1.GG'`ZKC1>9F?CX[[,_\XJ)'-"W-'PRT@['[,VC@*)V1]OTD,!MW]& +MC^/MCPOF/&8LI:H:-5=I:0T!^\@JZ=E)XQ@X49`(%R"&X&X.1:8T,M`%S!R' +M,A=QA$2#<3QA@`^=XFS/3;YW+VEA>ZSJOFC#/6/\2`C1![_-'TS"F=(^DOH\ +M]Y5B>O1Q#&YY'-\JS/C>-@[8P!PLCE/>EXZ@.1P)D]UR>S/`1,T-URJ`%&WR +M'@0PYY'IN?:D4ZKJOC>+3H1GV+^/:^M)*WH*QNRU8OE9/8(!;N)!5=KYG8PX>N=U25( +MYP'4%3C.\?8AAB'&[$2&VY_M[%CRM564J:X-\`P7/H'4;YN;'IX"*=PEN;"F +MI./JRVJ?`H1F!R=#J@?MOX+1(F$MY1C4G_F>0+7%X=<&[.>8?Y`\AQTHS3M9 +M7#\'^^U.7-&G'\?H<>K)QWU:DTH#H[ULG8\>UQS:X]_*@"890DJYOG7-G +M,](T^(:6_@^V*U.V=[?E`_8>I17@$_9-E+3YS=I\`')I-9WL^4,*H:%YB0:X2`RP879`N'"F>NQ*?WV(EU.E0\(6(8P@;K<#FE57WUOZMU+B +MI'4J+SDZ*!ZKR5KG\+K[<6SN$\6Q=<%AF^S:"FD%%]:FE29;-S1(Y`,^#!&Y +M!UK:`H8ST<2BX;8VR"T)#K*LS?/[ZM6NC/\#4(I$FU2ZE3 +M9]=]*AWCCS0^=/^0&+D]'R#KYL]V(K?FE[[]+PS&>)!V]=(6X`]$_4(K%?**PDD1CEZ/T7S5<'.:*ILKSI5/E>A* +MF97%SKK,U=C;4:E*O\]@KPAD)MET@F]D]857CCR.N_7L&&A#9-0&.8ELHKQ, +M,;%-\^8A`/9+NGB)^^L00.L\O#C3C$/22KFJ&0WF7U['4HYT',;.9'RV;C"C +M5D+(G!XYQR*#:/O^.H1I`7_5!%&R?=4C1Z]A4GIE,&'T!S#=+#D#0Q;>^Z.Y +M>^(>FA`?;%7Z2@_27DL3-(T&C[<:*9N)S.&HKY\'/<\%CE\8LC<5-PSBA?1; +ML)7]?-HAP<-7\B'QI"/C9\DT3LH2<]@.$#%UK&+9E_3,V*(G:LO/,P$;ZL\X3C"HV.:@4EN)\1`X[D3RYO*'.JE9]99B@QF\>=`;LD5@VIXJN\D(^,5!E6 +MYJ['1)==-I:AC +M(5L,V&)>PKV8E,1-(0ZTGF+B5WW`5KO&9E-7'G/#Y+0=^VY`JD&:=ZPJO71P +MFL<*.;ORLPT)L,'^M;;S9M7#+2H?/7(M_U"^Z`.Y\D?2#H>&[I?F\P/]8YO\ +M(W=7\?^_-OMGTX;?-%08%618-=.K?'AS9;F/LRL,VE)?''\\O?>3+4J1R%3ZF=N6Q=]KDKX-K/NAP"U%W +M3^'E]&3UL'FCFQ;JZ8Q1[-)/K+;C[+_1/ +M$ARWZC@Z21IF&;LU98J:AAYB-F[#6O=3\A$Z1;!STNL8-'HNM\:=HQD)5$-Z +MA&F-:(=;,*37",SX8_-6^ZNWB/'GZ#(DGYB'[;PRYP4;VDY,A7I1%)Y(O"*K +ML@'?1,2`?*V1Q(O&6HL/<2J.$%/VL&;TV,6Q]6GTP3X>G1*HTVE4M5N?VSE> +MC18='$F"9;$^4<[OR:(-:X:C7L-!_RB-'6F5<&)+3%/EJ39+0DW1Z>$04"80 +M*)`G8`I\IJVJD^8-%]TX!.#6(TUP:@`]_MT::GSZL*(_`FI]H.#EI5UCIW8Y +MV#TU\1.N<3TL-`1?8Y@DJ0_2LJ^,/\`->T`L0-_;/)G!M(IE"?NSWMOO>JP@ +M2H[4Z]^C2KFWD_5:V4+E5:>44JCI,:E!6CS%3K[(?XBFR.U`TWV*#AJ";YZ. +MD^-5S2>?)?I\I'%8Y_!RH*M"X5O/F.E>A<,;@,MH'+:0^06I?>DK-RM2VKZ) +M]L"VKTT^W6N9H3K(%4ZU1_B[,UJMY'L5:3]WH*RVO)H4347DJ,9:U')T>,,\ +MB6QP_O2*MEX)+@D6?A6V+HW\]57&R/7+63^:U`U*1?+ZBV4Q"O(*C05AR^=K +M3P,B%+N\IKQ;J7I4?KM4>?(O(MN(2^$(H*0E.E)R>5%*^OG]^,I`\T#_?2IN +M')\A8$D'_O#^;33[UND0;E=5Q%%U]):P^&M)6]X]9U6M5TW1 +M.7$*/!+@:BCA2T*J&7TI%K;&H^&&DJ9+3E'3JZC+(85\53P+AJ,I$A>FVGMJ +M@BU@0!CYO<9X7P;C,=2SVP"2^V88F.JRK6&@T!BHGJTS%F@S1];Q<8ZL<'T` +M_Q04SE%-6S_#S["%#UL3Q!'6DKN1D:C562#0G,MY(+O,5G$^P7TJW5OE_T!E +M/&.\X7A`M?WY8B2XAU)BBURQ;V2DCBIS2FK9SR)+^Q0`-=A]H].&HZYI4\P< +MCAL^8Z,2QB/V%/WR$,B&8P"9AB4:1W>JF0BOA[.?XCW:9.F7C"HYU!DD,KN8 +M5/J[>G?T*-3#P]FJ]]U/SG<2`C1YWN83W@N]D#A<*ZH(;939/D^^)-<-]JG. +M\\^LDPE.R8#V`A6IK$6\@0/C,XU$"CC0AR75(IL2\C`!%W0=%R$Y33J]=YZ(&V+9W]]B^[??*Z +M;!X!$UP656H59T*J!/]:SBW"IE\`YNHIG/2==`/?-H3^MZOHC5T6G/DY:XQD3Y*135A7.I +M]L01AE#(`'I9B)&(B!\RCK[BS,R[#T_7.PSCE +MI/&EXON,/$K*MTCE%5C)/EP-K/^HME0)TI81,_<]+E.3WZ4^JKRC&[@?#](V +M]_^_(Y1JZ5/F;EP!_B7:>*CWLN`YEVYK3O,Q**G)T6E/<.<1)-Z +MC!YDA7SGJ\:>K1JNL=:#?=L<-&N:F;XMPVQ'&D0^;(C[S?_T2-`<(AXB`8R. +M(BAH`DAF.:J*CA:E`P#.="`2)!H*N4&TNM5M:X"6@!`DC)UZ1!2-!Q\PN*^. +M%'`N,$60$2:,RJ8-H+<"'Z"!Q`);0(!)`1$3"#^3XG\?/OSVOBX*@``20A#H +M?/U_CC"0U2#)9.Y[O7,Z=Z>]=[_/:$$+J885WB4?Y@-%SQ.N\@8RR?]G]',$ +M'YOX+@6Q'Y#)NTKN3URR^G*6ISD(%/N4/5W29XI90LW\"IWI2_3033.)>$=P +M50[-)L<$-$9IM5E_U0NDKY&$])3"Z7&W;K`4,E#DG?3(_&YC4 +MDLA66`>RJKGIM0\"%EU(M_![!6+WLM5+!Y[;520"DB[NK>E!#PO#-%Y2]2R& +M7W`:"QR362)!V734-QJ(_,3-=S-()U]]-\(;OA;0^N!KB:[&O +M9H3B8#'G\<]\,,<1AH<=%O"FN]5GA;T1I^"?.H<0=42O!?=/]S7)+S2][(@".7R:)V?;K`5?/@9?BW1'V33F"PV^`J##M=\`CCVLILF6C<"$BLJP!]"F1EA.5!'4B/!=`^-]`\^L2$I=:6 +M->:#$MK*GO?+A8RZ8+>/$JN6WQ;1L'-M69),HKLH9?P"`I&2IVU7PDPI"PC. +M[DX?V=%@7][R9"&584_]7.*E+`TS00JXP(F)Y1O +M$($(TD5'$D>P5/%YP64+ZT/9@GA=I<2\4S8`J3CZI:[*Q?E.\[6^?"9/*`T+ +M;F,_\Q]5H2YTEHO%H[K+F[65AP0IGP$\%2?Z;%H*K@AE&H^B +ML]G^!W$`)E%^HX#GHUS4BOF/+5P/JWSVB<\>27X"(R@>D/B^1@A5?WR,`UB% +MRK;TA>WR-)2H=D/#.H`R[J?E$"5#U*?S_G+(;NQ[5@96YVX^YBSYH$0>+JKT +M>8GX(?SS?^VPAP2+<0B7M5*D-?3E69(A@JK+AWSZ^@9T\PBJ7),YA"R^B1=8 +M2B$DXYP+*X?PT">)C=5,>CQ=)Q^`DQUV),FX.;M'DQ&_/LI*G@DRR\#!WMMV +M+>WM@`Q0>TL1?P3Q=I]T+G2,?QPX)).Q_/3BS7::(6@2<6$W?8YT`X<@)>@I +M495R9I^$$%MG%T[BTN,N=_879;%^MWEDC`\-Z +MYQG+S3"V*"]6.S1CW'0]5Y=@ZRE<#DI\Y2E1^WS8V<)WN:'9 +M>).7X^,3RA);V.9"/TN#>9#L,(?RT\\RDL\$Q+SIQOXJO!_BVK-MA5?!_"HK +M1]PE<[C[5)T!KN:RGHDYZ^S*XP9@G@^30.$>&E%JXA@X\J]`B7.)-V37>H3@ +M<#!4ATZ=L1CS[UK"X:1Y+=5;0X6E*76:5S]/SPT;UV/ER\,16+1+.Z#3<(!) +M,*/$

    @OI@CS+=1F3;+[+&!IF/B"6G6U$@0-B1JE*#-$V=@7V9.`TJ+&*6( +M5CQG\`X)`\_/)2FG$V&Y#W.B3KENTP!G!+-Y^P)T.@OEXA<3I +M=A?,8!8'A_\8X9A8^_XPFNBS$B^8SBS&"^99%G#7S*S+OT5Q +M$8RUIR<:9,FH$!C/N/$TY.[V&+@SG)0L[:OP=X0Y+](J`6P)3]30@Z!W) +MV3@"1-/-*[V\FOE;>9D-+TX+Q%"A1-).4TE_`+D-+TNW^?S)XWV08PXN^"4G +M*26,^HHD-K5^.I/OZHM;?]AZJGLHHY"^GU#4".[,7U^.IC6BH\G^@BD(Y,N7 +MXP/(-F!R+S5S3XY,6]4\Y?FIL8/51N<+`C +M;@$4=KNGN.@ORA;@.2WR%"\_ZF;6^U4'@F?RFY0IOU.)"OM_-!DH?Y@%>;YQ;ELS-<>BWNT4&J8=^)0MJR!$,%1W364H1"Z&GK1V6 +M8I/B.C%0"%X6F"I)U/SA#)3F%?N"PU"4T'>0>X)L3RX0\`?^"Q$8@3\#JTT6 +MJ7*/(TA&*.E]+X>[D +MM,I#`6Y=;24^J16_DAZM,D0O4(LPU=`QAYCBD<4RH1\4AB$+/&RG-!W"6[1S +M`\Q&"6K(&A4.LS+^&M>'%-X,ETFQ1]49J$)I;+(JF>^4Y31Z%()])AHG"%X1 +M"JYBG5261"=2.SBT'06^9GB1V$9`@,0F>"PYGJE3/3Q3/E)H$J$_Q"3`^CD! +M-DL>H36D05(D=P5H)H$0-`4/C[5,#?,RZ+WI.MJ0@0_MX;%T21" +M#K*2PNIEU;Y87@C-HY!Z&5^E;@+2WU0(IJ]-./Q!Z.-*1[A4>\C_ +M(17,$DGO$(M@!C*3!2,F/@8\-453!:6)@M0UO04T>I3X)+R9I@$TH3/IT$[\ +MMP@4\AM8A:6@!%(+:'K6IZ]+"RI%'HD[@$%S#XPQG93(DQ^8-)&U1P11;F(_ +M&[N-4+YG?TNQZ68)H(*!4'$EZHX:.2ZM\N`*0S$K +M_`S001U6YX^B\"C7M$IVM'>!2^),[OB4/`D_6^T2;^FQPE*',]DA#'U.P6)Z +M]`20/;%052:26[Y;'[0`75S+7.REZ!.N:]5Q0--,D+HE2\W\4\GP,*AV8UB] +MT?J47$<%H.U+:X!-J6/!3O'^'ZI8BV0)"M`3BN0H@H!,202!+]U9HDA0#)1*E.;3\1286MJ8@-(2@R5H%-\O$4R;X +MG$'@0@M\Q-BE8DY:Y6P[5T7HEP^@I-],I-!7$$A&A/G<5LM08I%/XG^",2W. +MY\DCTI-2DT6ILM-0FC8F_D$\(M1XOM\VAQ/9(5-N12" +MJ&.T$09R2_[XM:]P`4\DW+ILKA*4^Q\!BGB[!,*(*YM_`J"V("!3KX +M=UM5L"D)C^Y*;A#'`1KJ`\4)MX&`$QQ;,G,$HDY8&YE/O%I!594.W"MGL@0,YI"O5!=D=&CE)Y`EK-IEU` +MD%*@E,^":ZP5DR+I@$/"CS`"%LC=3-0A-!HWY;'P#:4YA*%\-BZ)7@!9AS6Z +M[JBJ)Y=;"@(%`KG!Y&*-0%$15&>K4):B2,6)52T)7(*5:W.J0I8C)264XA)Y +M26-HIL'SWP45%.),BZIAXBF[E7UI1!Y&_EQU/-@E;9,!<(+("0H,3YY\LOF@ +MCX1!HJLM0.HS"=);ZI#GY@\H_$2?=H\*%CC5E>FA:\`L*D_'T?X4\2DV0Y$V +ML%2TH+R1P))4*$ZA$HBK[B.N?O1+)@+`KOJ;A[)^%*GDKRM)-?%@%-RK_*WI +M1;*?&?%9Y3MX*LYD*,DNA;G)2B*5310E*WI+=`%A$`APL'F](\$.DIQ0GI!W +M1^N6ES%J:%T%3YPA^-\)!)TCMGSR'/+&IX6Q;L(HB5%/(%\$S]C:5OF*[ +M,(A9<$W`E?/7:\@MB$"74ZH*Y`$,S'EFQ"9<#S+8-%\TFF$;6"E2X%E*^U`B +MK@"ZR%F_(%6?P!BZ'M@33%-@!XI4$L-6^:-^&P\JHI=%30(:-$P!5K3J@=E; +M"WKS!YUW4]`)TE;G7')7254-+LITPM[,Z!$UU8*Q65*"#X,U!R+DV_@%/S+" +M.`HG7&H%&@)B^I>*BH\O%*DT"7!%PS,>H*F2\,Y-5*J7>KBI+OE`(T3HJ*G? +M.@CP+"51%1$$TMI+:F%HE!.)!8T!3.C1QSU9W"*+Y%O4R5+L\H8];%VY`L47#QJ5*M![ +M8"%0K5%;\6P29(>TM4;OREP?/5 +MU5`?J()IL@4S3RS:`4/F"H)"=-45.U6E2!/)*51$`+SJ+P1+F;%`E_*5\]9N +M!3<\B5BE\I-^LEG-H*QEH36`)X>`.@4XO32$+6PX5ZH6">I@5("A/9-*7&%" +MX8SUO"Z?N02_,2LJI@$7P6X27`C[0I?YJJMORZJMC]5?E-=8/0%Y9Z@X+/23 +MB_%(P5M!+%?!:G[&C42U.@GDQ@>0]`(\C@.5Z;[SZ1]6,.5KZR%&" +MW0-`6,M1<2U`#Z^@BD%J>#B?>$Q%0\IZ(S"24V0F((BY!]1@^1@)KD]J`SUQ +M^4F2U'+Z6*U/U0(T;Y6F1\Y@O([&J4[:@@++9/@5C.6T-@AH@A<1-.86%=\M +MS3DM2X?5PU[#GML$M2JKS$-J4($MW^JH6`Y,RS5ZRBXJ+(E1_WRLRA"M*6P% +MD2URR$%<9;'056\574F%@LJZ+14,UN;'J9$DMVDR6UB$J.5/:PGHG&IO9" +MVLH\\+8@6X695>E+F%74"S^%=2\%(5G!#L-V)55VTN5GT'1#!:W* +M3EF958:D+80?;#[E*N5*&\E^.,N:GR-EBT0?6,$V'=FIUI>`'E$QX'8OE"B3WV46?%G_[;D"#,IHY*')-//$$TW +MG=,3D;5$\2MD4AD\H+,_6@]F'/?"R>AP@^`9=JQN#NEWJG':S(3I2?5^&(X" +M^'XKY\KJNRWS%#M<4HX=$[ANE)=US?!DKV[1'"7X31!@C+#'WRJZ!)]M +M1A)TK#'86G*VD(D"%39OQX32I_WL"]/+D.:T@]%;Q.=+>W;BB92^QM-/'.=& +M5T!9_E^W7@PPD&\ZY,NEEQ*',^E6Z'PS+.I2^J_X$(+?$@84OX@TT7:8A^)+ +MB&BE<7&H>%))4I<,GQ*K`[YBA6[KT +M=;YUW4X1MA>`IZ$\?__&2;K'$0L(]HF4_ES>IU$]"Z39]8YY3=E7,A(:PQ@= +M&EAAQZ6GU]#\@Q2\SP+H*=>)D#8Q`-)3@)*_609T3`;.I+P:4#S[.DCUX>9O +M>Q\@D+A4@:*^B2D#83R5Y3IUY&^E)$ +MFGSYV)-(39])(B3SXI'7\F`HY74GP$:Y@@;<:P2&H:*1%YJ=:!`&GP,TN],'(_7;%)HJ*5""*P".JQEE%6":YF\_SCP+IU\6N +M!7Q&Y-3]U8@E,CML#CM418KT'#2/`'+2=DF2GDZ'Y3OX^S"S@)-04F(^MET< +M#EH-&Z9;2UZ"(*YA8"ZZ)C1;#75E29H(H28`GL[Y0)($N]G28807\ISTHP)/ +M`^A-'.I.H>>C#..;"BFDOH`;?R=BBJ"0%0\F,I3A +M.\IR$C(JQMU7IQ2NJGI-G/>=>`\^KN +M`\-'(=X&8P,I70P^ES9@Z9:]4P>9T1+;+'L3+M0WR<]X`]!QF\(FX/O3]:5_ +MCK34]"`O+)U,.H\D%`4M+,T(&J.7((JBF6X+-/W4H# +M#U*,K;@?PPKAA>C2G9+:LV1S)A#P09PW%@)Y-WX88'+'XGC++Q;:"#,S"J,D +MG!/U>C[@G>N_K#!Y=V$9D_*_Q=O9&\HNZ8FZFJ_"B2?@Q,NL0.4TN]2$]22- +MJ8]`00W@\ZXHO(]Z(WI$A/Z!S=II<1+54=Y1D[N&(.'A<1JG1$(FQ=!"&FP@ +M4:4O,([A,'S:DRJG2+RN:E"4S4;F:T+0A,[DG3!-+@3Q\:Q)-'QX/?>@)(;24/"]-=A7 +M^A2+(-D]MJ)/Y3'<7Z8/Z@75Q;K"OVS&MZ4_5Z*QY-)UO.(1"[B[0PG'B[3( +MF,%Q?Q"6:DTJUEMCZ^FFK5$P!7MO&?KK2'N[

    +?-O++?N5!J' +M+):@%)CS>>5'5^$<@O`/P/,K]7J$J5RF5LCK(>!.((7*&DJ^4)]TDHOEG9M$ +M&IJ7+4VEG.=F#MKH5*R"XGQVZZDUI[1AJ-DGV`R[?:T"OH)T +M\5YB]Q(0HR4YTA"@N>D<@D\*\4F6HGL.9*LF'(.-&OG]L)*;XX3F3R];`B5O +M#%2UW%5\$;)/@)0LG*[:HZ5+(91V@63=`P'E>DB;EOA9F[A^:PL@_;=B6B`SDSR#Z\ +M6^79=LY5U./",Z<$V#)>%C'F'CT_"!,5I=[SR(]GE,"QO%YEHVL2@=G1PUV( +MPF(EVKM]-OY)/?#^0T\GE6DSX",:P!YUX-ZT4^S.A7EZ#G).@!6)X!+5BS?0 +MD%]V^*O-D,AI5D*CCM$,(3JCUS-J%6-(V$:<-(&I)!5+*I\M6Z@\*3P6'_SE +M!:1Q`^0:$#7*`[J2%-MJ\?%;LRNE.Z&JOQZ=+P%>G6A'ADZ +M.X>M678+"`3.YN7V]-K^BWD7&S$A'IL@V<*#+RSI:]660B-;JSIZNK-35@$2 +MBBAN(S7!;3E1GMZ,E5(&C=Z\@O)GO5M[J3ZS"R6=MP?9`@%+0#1OJ8J`M*<, +M^N]1[/TSO%-4V#;A"0D?QH62E3>3\'M22!47-P@%\<:$4TWV"()%RJZU@YGV +M'N3P03_Y-@:4G8)+]3!:/E!0'=UWZP&;+\R@Q6`]791,G:O+"(C_;&5@PU.O +MZ-+B'CF>S/2TI^NN@JNEB8Q;O0NI6>*^E#U2I]`G)5(N'U8K40:GZ)+Y0!+ +MDL^4IG.`6*R6H+/DUE:B$05T4EARKN>O7SA.9GV46ZF!AY"-AZF9UX6.(;WT +MND>"S`-0M\Y*A-[/]Y-77P,OS3`EV)'Z]L1\6N-,KP("FLQ@FHP2KLMI-V3N +M75];3-KI>Q>H;L;,<2?P!;#(5'!!$TFA+:\;@^E:P2#:[0+M>D_^`A21:!=J +M_)[@BT]6'`0<5(4XV)KJQ +M@GN^P^M+'(/:@UDU+R"D:U>"^I66][T+Y5CV +MJ]X]>J+(^T7N,)NL2[L/11I9.@1R+2'D%?0MMK+]TM'!>QR[T8&FSE)\!$Z9 +M]=Y`,NV%UB+I/&^E?$.DJ[45Y\&6M9"K"/0N\(:JCME_C^V&.K"E*6"%Z4V: +M76)Y/'M.#(P`R3@[-=99/1G;\;P+-R2QRY^R]Q,`]V..D@VV2.C@'R(-(PU& +M&K'$7S4N"YU+3,7B8D,0I-W8!JF!@4._J#`G5.B[^8,7+S3"./<*>$9OS"%T +M6OE$!Q!I,7IG72\SL@SE%+3/7J>D&239(X0XJ/H<029EJ+V&B)-$S%L-9%*L +M$0F]+O9A+:L*%D4]3EA:RYN8-/=[T+5\->S;\;'L(GL"TD-V1O<'KO&^`WQ& +M^0WS'BJ^:X&RZ;OCE9`J]BPL?BK74_%A_M6+`6N.& +M/H_^T+`M7'(#@VP["A:(]=MQ`?2O+?P +MJQY#]Z,5;C7`W!FQ)N5-T)OTF]Q`0VIO$-Y9O6-\1JYY1;L@ZW&WPU[-QQL8 +M;S4(G_$W@(-^K0H1NFMD;]9N=-B37LV]&V8U:-[WH0+`[>F^9!_5?-#Y1QUP +MC=J;0&]4W3F_:;^AIW3/YZJWA*`6XWS';RPK-FZ$T[I[0`>*KN]6&_$%;LZT +MYK8@#N(Z$34$;ES=4=2YO&'=$W.JB'51N@WK(YG-M(Z>0B?[1S[5BQ]H[K'7 +MZ#MJAOR:$':C9<$=JCD?O-<-C0V>I@XF,*PR<'&QT/%Q16:8A(> +M)@XI_R,''-GI,:2]UC&]LNK8VH">`CH*!?X\2UIDK_ZL@X5/9X/>HZ/@H>*O +MAD,A!\?RZDH$;DN:8@V)A +MX!.12%#U&Z-6?9'E0=;B>_HP91.54S(-J;P&5N2I];FRY-CKN@BZ58X(R +MQ'H[YBQG;_X_(RRG@[-9SM^!"`>QSC81;U0HQ!WU2,6]Z.5?$)/GZ-@W^"?H +MJ#RD>_0P,8.-5/[W3PFR/D/4HX.*@FN+A&LB0S95H.'Z'U/U1]%P,08[A;$1 +ML4_Q*=T;&Q<;>$>#BT<)ZL!(UWQ6%4XR$5`EF.IRA8>."!'S]^L0(%0E'0?L +M'>$]3!^Q``7T:_J&7Y/0/L1#QC\0K$V\&HI4+C$_U/`(LP"DF(, +M]=_*P'[I"0/WP(,?O%-K4@7KP$C#A1*.[(?`FGR,'D:B*20,F[Q633AAX)'4 +M65%&4J-JA2!AX2'6#0J@W]-4R4+/'5G\AE:F)T#MJT#T9&Q>344J&T0%N_Q4DH-AXD$1XXB-@3-0,6"N]"D`*T<1U51LPT5 +M&@'X6*A\J$<(1_0"20;V":"3,4[OS]5'E4-7Y5"E%ZEU3K%R$+#(XZ)IF>21 +M[X@04:"0\6J,=[80@(>"+2/U>B!0TC!ZN-0[#QYVRRW1J@[VD8/#P_5AE#1C(^2`2JMYRZD9HZ +MFFO[F`J*9$QS?XJV1]3)L')^J"*?T9)U"V7``JIG5*`Z#>_A(T])HB1J.V6J +M.MGLW=\%L^(1RA"//GP'$]%L\;XB-AP--4N'KT!TV5&C]"*EV5_!RB4:M*^?$P#ZIK('UH(D +MR',@%!IBA6!,A@9Y,R#,?@=\3[#^6?C:8W&7(QO,N9ET,NIEV,<#+N8Y&7XQ +MS,=*A-1Z9@#'8QW,P)F",>#'DS!F/1CV9A#,+4+F/IF&,P]0>`ABC,6$0,B`)_D3(HR+,C#,D!,QQD>9(&R)F4,DC,J=H,ZE@_`:N*M)(O@J+$.1_Z6%$[L['"(V6%+0B7%+8B8%+ARB'M>$+0I?$6M:%M@$;Y` +M`PB/MLPMU@1OT'=C$<5"%LI!K2P&JHUJEI?5^D=?YIC1TJY?TJ6L_E37!5K5 +M5^EP>B9J>:.W3H`EXWU+3ZP4*<`8ZG^-/U&_K_HFJ5Q^M:H%QVVIM%1K]$E" +M&TN!VD;*TB)%1+0=V\\_2H\2P9?X=_2Q7+ZNF"'&.U+MUQ/!/Q0I@?X\B]08 +M7;^):TJK2]%SCNLH%WYLZ;HF#'?>>7FMAM]8PXE;A=:EL7/ +M=@8?-C`V9Y'TFFX-"XH@N7MWJW"$0?=32HJ6:-[X$@;/;P'2C72;/0K8K:TE +M9*B5+W4M^NESXJ+8)7GR.,8E>G)_2XWQ/>Q1-D:E.MV[F./7I>1;^#=)VUT$]9@068['2YA;DL[\E. +MN:ROY/N?D*#1Y$3INHH:2^%+P4H%B"[]<^>@I(=+F5NCV_"IO)Y[S+:6DS-, +M,DG0BVR,#A)WSE+2)TL27^DOE2_SYF'S>$)0IRI<[\`?3\"=^"K-5"M$FU2Z +M;(B#W7(IO8M^FI$-JL`F*,KM,WL/IX5>TWG2>";O/:38P3=B'CJE[O43WX5% +M2)*7KTB>G18O%3\']Z$NK`T_J]8E#2Q[WX?<4[4M3\`>IPTJ']T_R]L]$P0J +MC@J7P_F'=1I2W_8)I4+`'U=#NK[1$8KZ+VSSZ%PRE,Z1EL3[,H@_@4'`WIGT +MS+('!/J,&,\9:DPE*'[0NF=`RUF<\RQF,1=I`Q/2L(.)V=`-_7#ZPE@1(=_? +MJNL99?[+GRNBZI&(9\ITP*UI_ZUD1%?/[&^I4;=8[24P72>*'\`(2&`%D$P, +MQA"96@%?JD1'$'8^!D"P'!=B`N"'B;P;GB95NLR5.3K'PLQ8&M.R7_O+BIBJ +MI(;_S+DS_"71Y=V;JF(%XEIHB(^E("OY3I9$1B#E[AZ3?/52@!+%EJ03'_2; +M*LS6`.J!*M[]NULA)=?]WRE.J18:)5C;3QY:D,I%F$_^47'?[]+_E(KQ&"_> +M"R4LU(9_OOAIIHOC2ESP$ +MR57:?/="X[8^JL+?0LA__N+BK`2AW_["Y]R72R7:#'DBSL#*4"?I26F*BHD( +MW"X\#RA]V]$$GA#;-!]\:6B#C'/2=SIJQYXE;'T<4O&5)P_8A5-4:JV;%V(1 +M11JWHRDI21G5`E#:@%E=U8<@:FDIIQ/,$++*A*4:$+6CHP%OL77S]4MQ5!=Q +M_ITN?[])^M!21)F8%FTXB<^9^()UJ/-TP"].:17<55*EI&,143S`"N?"Y>N* +MA*,_HDJK-?2^@OWW(*1IZ$-JL`#6@,]W"*.@F?.`)-@#Q2E??>FY!+BJG_14 +M5471=$+DRD0_NEY_;/7<./+!4OFVMQ+&]*E0^ +M'L*17L]D\GLECY2)1>A6YT:N!T2MO[&"++B9_OO@O[__MFE5JK#OK/]]<50O +MI\)O#!?L_[ZF4/\^:+\@Z?R8+\^:::/[SW^]2TEHZWB;4M%1=='13]'0T;IM3>GZU426C3@]#8LO]%0-B+RTZ>9M\I(4VT/6:!91U43 +M#Q.?S4%%;*%>H:(@S\Q(KGZ1*C)L3=$"!Z41)R-<\T#Q19U[(E8$.$AV+22" +M^(\++L`4_]I<4BJ*AWF8O_4N0%WNRZI>S4EVE[*HO-Y?A8&.$F4BVB!@P%V4 +ME&N`UI*!C]V],)?IV$_B7"&O!QKR)?!T[#15=E@8"VR=:,"#*5/&EX[JE[R6 +MNA]!@'&,>4K,RNB?(5V3M=2A')I%021B4*Y-^!JHOKH^Y'L)#;RD=%'ZU2KZ +M*AI?4F,%'3^&/K!QO*V9[1U`K@Z72VB5*6Y1&?TV7[/T)$N8L/9L,-F:YW:= +M?GIA'T7@KWUK%U'-PBD,7:-<]*#%:"/P1VAP3],K+5$A_>Y!2%NJ_RL`JV>3'">1A_68 +MNT>6<0C%>P17QIIHOOL@'UJ6R_OV]B#^BF(ZPZ>$6M:%OJ"+8*ZHB90!?[$=@=V!&`0BOLB(4 +MCID$18ZLG +M1RRCCEF$84ZK0B-'5LZ.:X..:Z(PQU7A$@.KYT85&Y:/>QMR.,4.;QDD*SAQK4$&\Z,T:V=O/"-**SXCY +MQ6@$?0*^,1J16A$?@*^01KA6B$<(5^2$+(L%_-``F?T$;$=^HC:"M>(VP[]A +M&X%;`1PQ7"0=V!!SWYUQ!&\37%30WC".".Y0CDBN6=$A8>"S^O+A]'=$FB.Z +MV(KBX=M?&+PIC$6(4R"&="%UD0T$!QEA.B,[N(:@94@+.(%JF>>(G3KH".<.Z*$;C?Z'#>D(L`KIB+L*ZJ!JRKMQPWK( +M.Y`7KCDSV!%F'=D1?!7:$)!7;$3XKN"&L5W1#R*[R$T"17WT#@(S\"#NF?". +M&^(C6XUM'7,0WBN&(FC=V;Q!4X(=F("P<8&;-"N(FB`KLQBR_IC#F[TW>&\PV:-F4UP#> +M:(X0J7$<-!NF<"&B]N'V^&X(W`(,WA!WQ`CGF\XWA&]$=QQ'](-SGI"NF(M; +M,++4F&PU>L8L71%T-8#5]-5@0PBF,0Q"JR(9!5;$5H5>1%X%7L1>A3B(O@IR +M$7T4YB+\*,/ZR5M0A$,?Q2T(OR"_5;&0`I<0=V@0NBAJ\.;A"^*&L`B:07X8 +M1G9%5@0Z(#5B$00YC31RR#CFLCCEE''+,.M@BM"AM;'-8BN"AM=$5M$>K5KP +MRN"J^=$)NP#CEG$.J$+L(B#'6(Z;1%C%#;((:EH]5"RC+:*LPB_H2ELXB$'( +MQ&`0K*[0,A15I$.R`*T"(8S#VQQS?!#R@3=]$9$]G..0`)E^''./$/B`U?Q$<.@$'QN0$/J$5Q`B/'1*#N<')G.CB'%^(<0=R +M3HYY0XYY8XYY@XYYHXYG!QS.B.(=@(U8[HH.YS_0XYZ0X +MYZ8XYGAQSU!QSU1Q)=_V..>L@KK&]<<-[!T0:]D<QMZ30V]CAM\'#;Z.&N(C>"G) +M-#;\(3(USLX]C71-#74<'+S88N.?MWAC974N\N*#-5OOQB;6Y%_EOJUO`C_2 +M>J7-SZDC%U4!.JAV]4WW9@;#"LNZEY)&GQ5# +MJCJ_5CGJJ)`#@$O=Z@LX:';%$_2^4C^7MC(3;_0->.<#P>:OVG;$:?\WB]L] +M4AW8J`G4,%_5_Y>HB?_M[2;H3X'^3)REO_N)8J>5NW\S$!6$9LR0+6._H%WE +M:(R'*SVYCD?OHZ6EH:&CX-6IM=^K-^.;NT_MXNT5$3TSXN?\L/G\+=2DQL)> +M,[]:[[BX;.B7>5B/,985%>^HUKCH=??F+HUVM4O/ +M2^-6H#Z]"EI;BE[B6>.,A[3KYNZ:[Q>V>ML?U]O^"$L4Y$[;6EVD[;0J6:O> +M=KK&?]?P(<$))],6^H@QZRL6K+)9`^J95*>+3TO3&=(?T?^XY>[_WU?\+P/Z +M50TB_[/G^(?D/\K;&?_P)B_\)==CV/Q)T1"2=)MZ/"X0NPXITB,%0#P=@]H/ +M#"[3@!)V)_M=HG^J@Z51HK((HO$V=)`7'Q*5SZ76[%88F-DK+*S5JMURN5VO +M5\RP&,]A'BB:MUJD_1BMJL`AQ5X?7ZNX,*!)&>S^>R`#[__M? +M_;-WWWC#O5_UB%5?(6%3<1"8'Y9/)U4594X.\JH>WHA_3IUFPFJ8:J0/9`R$^?NI3++59C_5[!#I=A9'JMI5175J'Y`DZN??V4%/ +M1I0@WL?BS#ZR,_8F(J0(@N1*J>9-IBPNR`G>PKC^&_MR^&"]4^6DL +MH*(!`,SP^38#.GA!6(9[KY[4=#Z8>P+X1]N?UDG2GIX7A@8/8B'8JL>'_1^A +MA]LU_R&:65,:S#O60.J[X151T59+!N]R9'K3\V(SW1/NCZS=6$=A%T5@9^P1 +M485@MIV=/1"ZLZ3XK%HY`UZKK4$<_^<^B):6UQ=7O654F>M.:PA5.N`MM;8;<6T2&0WP\;P]\-AT +M,;M,JF14V*Q:##WL8L.N-,QS\+,>3BGQ/D!`U4>04&8/V0A>3PA^<,8+W8?( +M%Y,$'YQ)^[(U+C%189%QINHWV2,C`1$-DK)?7Q0ED")8\#*GYZZ'0_^:QF$L +MK9@_]Q&3UT.M*IL>G:TF)OOMJM9WFB'_[3!?SK0O?6QUR;3M.%UN1CKAG-K<\&8;@7L6\%A1:([#1HT:9@+\ +MW.#:WMHRY-[<"S-V=;]A77$#,6UTY-9[F[WYYN5V;SJ[&N`MI^#KF;=!;N[: +M*/`%+P9<[DVG3>:?!RR?'-V;A;0&Z@:Z';(#D^.[X]5$ZB2[M:8JK=O%S=!< +M7*K`&\?-7&+H+FZCYNQK@;=Q>%DKA]F\7-T%P.'X;QGQ55_J8.]_?6O`N[XLMWX6WQ!VPSX3ZUJZ`Q]!L\!B6MUPV%>GMR3^5-PB +M-.K"J8'=S3=G-UJK^A0M=WE[]D[OJ?SH/A1$!8\!A75U +MP2P`54'1])TNKPGZZ!`DV\"Y*<2TKCK!/2=Q!Z=THN>4V+$0?79R=UD@/M1G +M@G1?XHQ6W>X.+C(F#MD.IX=(.*R+_&A7DND@&7SN#@X^&@X +MV)I[@HXL-5.]^@XF%AY`E>PZQ4+$DA&&3^#+9Q\CW_U4O!U!\'$/Q-I8^,=I +M!30_A`TZCV*&6V'>GXD/0\"_)I4[QY#.)VDWR2PWJ\48%_C'\L\16!V8*+49 +M`#%W%RXA&R,'494Y(VJ_1<1D7J)MK\)?R#6J/[7@Y**IG'1%5?C'N+*>X-Q\ +M9TPC8^0A9`:>R?RV5MWF#RD/`Q8A2[!#4R&8MK[(1L0P"1Y&P09B%K(A&@!Q9L29)#\JH$ +M#WZX2,@W\[N/:B]_3PR[5@S,BLQO5`@>ZJ$Q4'(F(9 +ML'X.+A#"9HJ`DY"!E_6#_?;ZKS`7D0S`A5J/[\",D09Z^8(%;LK=R9 +MOT`WN)T]X5ZP&%!F[(3,<8,RIB!BBN.AHN0B1Y`59X.U/88_-_?#U3- +M\#,^#W&8:K9P@/:P&5AXPEC5JN9BY^\+]!WD?S1L6ZR&4_F7H*$AGPH=]RP`DIJ4U*:E-2FI34.^;2HJ +M$;4V8NV^XF1:H[V$SE3F]!4]`9LN::T`>6&V`JLAVU^/;YA_/WSRM_/VPH&P +M9[@ATS[$B?$?M46#/_00JR27_L0$'!&AGG0=^\CQ8,D`VU07L4 +MMZLV)%^C8(##W"CYRMS5;UB+YWH!^.CW_>Y!`3Q%5$$:#?11-5=]@/K(CX +MFT"!HDW2OX>URF5(3>1?SRE5GN,>`=E[W`!4I[+G]G'>W*$6FR0C%>=):QG+N=Z@SX\+,>(L7"MTC(L)W +MH")@U8#V-`<(-AHJ(4]R,54YQG_;JQ\IE?70[/&(>,4%86#42A3DBH4^!`0L +M20BR9UZK(.YX5S;[E5(@>[J25A8^J9VP,;8U!=/ +M&U=,>++26)O]DEB+JU"8CA[&5,E1C,/455E"W`9A%:-K9M<-#W?B)BBM?$6`_NHM81>[8A%C/YD +MYLI,4H0M\I.#4M!A^$B-"&$=VI#%)R<-?:C@EE<3-O0Q1#6,;$.+0.+44H5\JIV5\!BK +MN^]S8]H\X+C*QT?!*MY]E(]E9H%?EFJ'*X#]2'Q$A,NM+$\%I"?5G0GW9$)^ +MSE?33`FF%#?6$'MB%WKZ$+.65`;LR#FJ016T'>T&HT-]T'.1KF@W>T(7A3I\ +M36(0B?%($+$CLB@-8Q!$$:@6J\@`S"!=YE#?FD'^3-S:`GT:"+>H0;ZM`@?> +MA$-8;MD"1QD'^<-9U\\RN,#^OH?57S#&!?'080GS^, +M)/$Y#'$IRQX0P^(&$%$",((G,80"BQ@V.,+9CRU"&%)9<*-P@<.3JTE13%'W +M<_1OA9GZ?-_)V-#4F/3!JD-Z/3BWCQ7@^FJIP"_RHDJ9,"2T!!>GA +M;B4?X*)DOFOZUL8/?U?$S)PE\%.[RCD% +M7@MP%HS5T9+3:HX_&TE&*5:D";]@9C*ZP1QE;#JA)@)-N"JUAWIC,O@D_8,>'T)!L.J/GR8,PW*3!FAE^-ZQJ^;B +MS;$;\QKF;E3;P;RS:X;D#;<;^YI#@T`C`F^08NFX(R9MU-XAK +M*;"&VLW]#2'AG1%_-[@QA-QQ>SG##]8R!-RYM\-Z)MC+09'C8(W1M9-T)N#- +MHT)\8016@EB3'9(0W&RXI_$6@W[341N9-J*Q0BPF_**DA%W-Y(J'$6TW9 +M&D*&?$.YOB'8817J9L"TB'N0$70WA"H,1:C?R-(:&<$.HSM"L:(LIOTBO@$7 +MLWGBLB(:S?X-((2HAY-H1Q(+7!DP*CA#>;,BB'5:!GXE[#W@-.=CF([`KWB] +MIDF'3#O?$7DWFBH@1;S=J:00E!&"-\P[$"+`+O(B+L;QA4*(MANO-)$/B$8` +MWO#GXO6N3#J!WPB+Z;TA46(N)N[-3/R"'HVE_X4\2PN=6;U#=&;R#=B;X1?# +MP14;LS?&+X>&+G\S>V;]1O0-W)M$+X9H7.L-[)OSFSANV- +M\XOAXXN?V-[YNI-Z9N\-2I_KJ(RP>G15Q=K1EC]6S5I=4GV$>+E>77(RRFN- +M/]1>SCQ:KJ[:#+(:CK:ZHOL0\8*^NYE3>!='8M!`9DVPB6<6+XE>%C^)QXL7 +M!*V+&X2VBQD$L8LEA;,K1;<+4=)[J&5X+8+3HQ!:'&,.`)9#:R8B+;NX<+M9 +MC0NF2/0NEA'`^K#Q#-D$+O[6;P8#`4H:+@A;57^](TP@DYRW;R1V5P=`6PD2 +M_PL<3`E55D751?C8%0=#QRK$K]2($\2_40:I^B8.*A5)1;5 +M^5>(7![FC#Q"V4+QX +M`:VLA>'\-&7Q/-*2ZR#^G"TNTQN-7BI4_JBO*GGV<'+%P_6=UZSN0R4(_QJ, +M_Q*?5,Z"6PQ5.ZLNZJ*53S4_-,VK\C<'^L][^,(P_18=]D5_Y/)D(RZ?A`S_ +MW:6"U%RSW0K/W[?HR5FG^9/9[G\;5A_G+;'+K[7M^SH[+O-%!,VVLOB +M1[#(.V2W'CZ3EN\W\'+Y]B[?6_K(X3:ZV(@LKZ("D[G! +M@]`]8Q%7>=$KT#`WMEH?*R,$KP$<5><L!RUS!4 +MF<9.3$;2L?A0ZW:72)T^ROW-X.YZ#CZ-U^G]Q,[CBKWR/S_1 +MMYUKO!G2PF8PDYP*^_S>\VGD_>T-&^V>'^C2_QQV7\/YV^HVZTU,&>77[9)@M&BQ +MD#V/)A(B(@'^)LDZVP>/+9NONZK;N>6Y? +MAT\#.:6=40[[D??1>3F\K(3\.YT?.BKG?\]"_K-[?'\^.:UQTZ]E6V]^>*Q^ +M7!RS)_5ZR2Z]_DY+5L9F9BW>=1L?!M6TAL1L\Y%HV'EPFXU/6?^-6?1TL=I^ +M#SK;:=/-[#]];.35@O>SQ699/W;+SC/YVWZQ/\;U')[?N[79[SZ6/J[5;^GD +M[&/N^`YG:_:1Y/V5ZU]!;O,%\U\R&19-;B\AE6+CUGK?8E8 +M=);->96-CJ%_X'32,O@Y/W,'Q0WB16:EEUZ'QN(@//PX6#S&2NL38>RO1$5D +M['RZ6>M_*S^+RO/9N)@?ZA8OI[CT>CO[O0N>[VU@YFAV&/2?=S>;E])R-7OI +M>=<,+XNF]>&%W/(A<1NOQ_I>VE]P5UV3MS[>R3KQ8ZQ^WFP*W=?XW[4Q?SLOEQ?[V];VDIJ.=<++K^E[VPEX+ZK7 +MXH'N?7]V0D*QI,BM:Y>8?KOMUK/;SD*OQME\/'V6`GTNT;;)XOY_G02_\<)MTFS?/Q^[]VE=NLW_ +M&D7ISBVW$=)]WD+SFALRL)L]O@7_?+5CAL;\UOB[==MVQ?OJ]"QS%CZ:[BY7 +MOK1/&HUR;K'8'FM,Y/3!H.=P'?MI^CSE]?M-"UR>HX]DT_Q82MR^!9FCG/G*C/)E/EQM+M.;33V339N37<5I['FF?7&?5T*%KV'T\.ZZ[&XV1[%DB8E+T[ZYRW_/_+7IX]O4 +MW]T:N)$1_`G_B:WJ7F;(^]!%H*]\SCN:S*R:1H_&7YSAO&3?ZIP +M>/)N;1\FLTU8XVFE:XPF<3&.S=..LI`4,5PGSJ2+[C=S_%>B=5]W-OLKGOGK +M.FT;WIYSI5K7<2:Y-#U.YI.'0^7&3D!&V7L241TMH^N.IS;UBL36ZS7["T5Y +MEY\8X-/U.31>]9$4D'V,7V,M:F'AXB"<)O!_=K]&BZNIT#/:.)K&_'TFZMW[ +M=1I_7O3=]_=KDZWJ8G9,.=_-I=N#VJ\^3=MO^7HH:1@^KYI*^W';.S3=8^QL +M-ENENK:YXMT^8+9RKMA8SI0]5P^)0W702> +MY7]'].4?=UL;O!ZS6X+3R=YK&NT]IX-#M&'/^_5F)\E_XM]YV1^. +MLR\>YUO%^-::'+M2T9$RV8]N<7 +M#:=)(N?.YT3B[,]-=>?LO=6/ZVNQVS^K(9?*V9I]P^-TGJM%`:^4Y#YM/EK^ +M_\G]8CR=_??-K)?O\S3<[S3^Z7]?K96R;:(Z3=]=N[]NSG=DHCA?H[1G*B[' +MC:!LMU_ZG4NO2A-4O[_X8%]2/MI@_&\]?Q[):^^7UUCA='FVVUZK4VW;Z_?] +M;T:GI4EXXGCYOOTB3C[J(UV8I,7LOHOC#J=E\+AF_SV#39+AX:\OW2Y7^W6: +M.D6Y?_?J1CMY9N(PEUD[_E9'98V!PP-;TW[,31 +M*[7@1FJ^S/N6YS=_QK0MK\2X6+?7VO-VT,EALSPX!X +ML^_<,SCO(T:?[-96=GT=-7ORL9C[U\6W/5']$!`3DZ^27&L#UU'?#Y>A>]*U +MSGO\NR<2`KF@E6O"[G37/1I-S9YOG:I>[GCR^._67@\!%:-VB;CJGR0276MW +MC7+["T9!]:6"WP=]K76DM9IOP=MU\D)8]']]LMV@_F>W7#\6KE9OMP%1EO6C +MO]CG?SU-U7:.;UC)?9/06O+[+1WW<-,W&4%>X;_V+]404GO;2(@^CY,7E +M]_=F%\[V3<';S['7L.W\&IK>K;^)?=!&TC3I"=(MY"7117+S:WBMW?UKHZUA +M7^W+\->V66E5S.5]Z7=OA*Y6?DO/(9>;G/G9.IW\,QP7HL2@G23K!6&O45B] +MX#&,49]UKLF`X/6LMFD?ML]MLN/LWZ,5QL?U/_=L4OT_S9_+M(>P\#Q72MI= +M/YZY^-KV-:T;Q',U=Q=ZKS0VTM=RNAV]?>>ME;!/7]Y<)RX?)=]#\O!O.XH& +M*\7KO.E]8LWG;YA;QO;U!O:U>\38,==8OX/KNUUF.?=$6N9[GF]YB&[9\S2M +MO:B.5=\'9WS!24AH\#1P/2>N&PV3!_+ML6\?A_6G>=/].^O_[>!>P'FP;BZRS3F +MG1TN7%%]A5IOPU\W4AB&'F[;#_'O:!\W/Y7C"] +M6NY9[YF7W>$27?JXOIOB/WL[W83%;'XOOQ-ST?;QJW16W&8MUB\=D;C^K]F+ +M'=.IMLEYY[ONQ$MU;BDY6>[L_H+K^?;_G&0_:\&WKE)-HB?GI=^R]NY\R[N+/ +M-<3#XB7HKUI9C[ONG$<\CG>+8N +M5O>.U[A:XSCIOVTTT]<79'Z,#N6[ZO@Y'C^EMNF?E5]^P7QX[J, +MFAAY3C_)W/LS&@Z'GOTIFG=)I, +MW`_CA,Y>&>P?$R1O,SNJF^KKOG_A'K>,N0GY>B*^_\\ME.WK\%6[;^U;_2+_ +M6U3/Z_HSYGPZRX]MO_')X:0^]RONV_#?6V@U7C<[QJ_RI,M]WV?/N_MFX[?; +M3LV%>_?=ZQQVN?XN:VS'T.+LKSL679P#*[['#09\V[= +M]>CW'[Z#I;J3GK)_//QV+WG=N>GW9S!PNZV\IP&'\N]^VTK>(^>`^2Y>#I7; +MHOT1:MPX3GV=]J_??Z!Z8/@@I[^8M%\2*^_T_UUDU"N;!&R%KB^-Q8SX?UTM>9ZTUT6V^^ +M^ZB;9_BMB3CV*_?)'?;^B.9V'!P&58+Y^URU7O<#0L^TA;S6)LSXME#N#W<6 +M-^[GS]7P8K.?%\_7O?(^+.P?[SUX_K%O7R<>^M2C7.LW6[7]R.)PK).]UQAM +MYA*#5T%O\&^U/SNUN;;2G%B-1U?-%N_PZ1@\LU\&L<>8S[VCR.#F]3=+?MFB +M5W[/IM3JOAMULL.`I/XRR-R6OE^3R,WG2.VMO>)KOU8F^ZUHVNBLK=RO/J\_ +MD./DZZRZWA?IU%_X=WF\?,+W)C-5CMM8+)V,5M]=Y+UTZ\\9SLR_(GLQEX>L +MW'A^_$.TC,?:RLG#FH;8QUMFEQ_>-5M^=Y=/%NFB2\JCR[W"=ZQW;GX=YMFX +MK+4XKNUF>_L/O^[/,=DL6PZ&9^&B:D^58(:ZRT:RZ"2X=VQO6U[WU,8XI7W!VK3I +M/-'9Z4U]?[]VK]`XYI<^RV7S=--GG[0Y93#?1^TY/2G"V&,;[SM<5W<=R.OA +MM@IPP',L/<2Q-HO,`PW_XN?V9^Y<#-:'0QG+U'=:MCZ,)HG[#];-7ANQ-XDV +M'Y-9V(IOL[!+9UDR/XWC:??U''^:94:[<;:[V#`X/R_MX\G:;EIJUJ-!E-W; +M]/9>=\Z/!<'R91LU[MO=ZBI.3^$(Y9"R8[3>>2N]N>OGTVIQOB\+1UUVPQ#S +MC\O.>70\B`[/;VO2?L+H6&7NT_M,KSK^9#;JT;J;[3=T\]\F'@6U_]'-M*YJ +M,A]/\_C_*_.RR+>76*_?]7QA8*]].#C;*EMO&_"M9WW]M']2:9>+SF;Y=;N_ +MTMU_K5A<&C)_AF)"$F9UF197'TNOX\;]7!CN%:?#]^(P&F9^_KKO^M)Q,=6G +M5>[SSDX'/^'C2MK=.BD[PGU7KH76V9NZ?1\NF>Z5L;/HW#[:Z/I)-16\EC?CD:_U+GQFR +MZZ[\W?0*&.Q?5M'F9/;C;7,16SS^3RW-[W"WT7S;+BJQL=7U.M9J[X\S):W!3D/PZYL +MJS(_GC-7+[B[S.719BEUWU]?Z*\TL5UU5UBL)9-#K*_"9V7R7/_^0$C5%5P= +MG8&0E5GQP<.P3@@=H4>$%6/#\L5WF[7@!OA<>"AV!'>#,(\?S7H!.0281_`(+A9)!:=8!+1=#;6R\WLW5Z<-)5?CIH0T(,R=-&NF +M]7*W1^0Q\Z#"ZQ)*WFG=[/;KBT)B;4>BAZM$E]EIB#DY:]L17^T/M/R9^2\- +M&EL[W-DU:<_9$!>BK/(J:^S3]MW+O4ZPK!?_,6`UA,7@AGSNL1.UZ'"@_G\[ +M207R2R"2UE+9]LS+$V-IT"[.,D`V2B8X?`=TX&5;,:5<_UG]1(L^A8W^7167 +M4>F6:S["%J+#AHY8?B4.,=JQ-G&%$G?P*)81T +ME76"56-)$[=<'J&L82T[<=$^B0/0;`B +M1QR"RX:/"Y^(UA"1&GIE#[$* +M:#LMBE]GD-I>6`-F9D[F'6=<78!@,,WD70)+9PB.WQP#G'9]"N:WYQ&Z5&"F +MSKP4K=U-]=I7?+MKX-W7=(>U!?/+4:&R'?E[,E)8$JH7%4YJT[X35D!-^38F +M&NCZDX?'>;'9DWC731D9?-V(#)NLOF:<[MHV*#0\];KL5!!BUN,P4>^/O#$G +MU:0>[WZ:#MAT3@A][[0-$A*_#B"!5&.K)2!J@*FO8T,OH=657G]D0Q`V,"_#W!@%2$[P$RM/Q +M",8@P05-8X^!\C&R!%QW_1=5%E[8&+!&VH9K;1`6Z:(RLO+FMR8QHQY-\VXNDS4Y$_&L6+CG;)48CRK" +M-)%J#5(S0\KSZ4,'$DU!4?H/@9U6]1;X;F?8M12,6F(X4-DM'3!7*F&LF%^\ +MA*U8\NGL>N:X0>TJ+,-*"NJ5XM8J64&N,SPGJ +MO%Q#$LSI7U^G3I!Z37[BF^:]R$S@RS4H"-$8&2@6$4&\(&IXVA+%``X$J"L= +M:H[[KUSJ+.U.5T@=6#AO%X\1)_'*M`]WT>&M#=#4(8'(Q\GCR=<_8]*IZ?+G +MOS2^6@QA]%>3>EJIG+6&JU$8B9[!GARYD)35YZ!3#Z/O;[.A0K&N+%&Z^'#+N(MH?78X\*NF5'7$Z)@/NKKR@W"86P6@HCMY +M&B\*!PXA8GLZ1[C]:F^=<&\O=AY#8\R2&1\][!6'C_@L80$%H688HK3UKOK< +MM90P+"Q65&:EV<7@X<\RXJ/$)#3S)%-O<*@$_GK=>/S]>#&-J[F+#,Z;0\>J +M-7IJR8_RPP("BJ(BY&-DANUYYV1GTFP=S-/.X#D`BI@A9*EXINO@<5230U"R +MVN9SV$0E5EW+=&2:U+5'F+P2PH_%L"%U#/?HI)0XJ@+_+L>4,IUV!R8R\\=. +M@U)$6M'@L<;P84*C1(4++D3T6'J71@TVM;>>$QV]KE[^_NN+7*Q8IWPL&7.W +MZ%->OVQ038T]DHN<_/,!QYWZ12"*1H`P+J^N_$J3!@_5PK*8A\S.(-&<>8;? +M<"$-RJXH@?(^(P2W9VNWS7(^>Y`US$2(+=H(G`*KN[(2N5@(@2HY?B.4%Q-F#_%,13+2Y-LW=)7=VG+=67RX1SB;G<[/=` +MS64E4*_=42P7Z*%_-WHL'22F-`D7XQ\J0S(),7)N16O6JDYFQ>=U0WXU7EFH +M*(]9#D8;[I=KOG^Q/H0%(UE#\ANS_OH7/+HH +M$!"`8DR1/WE1H`52=.NV25W!?'PWN_+(D?,M5(A/>[WB\?H_%1`ASM3#%7S% +MU=DO@Z*&:C:R8,IO6\J;MF%LH!TP8@!`53JX1QO/[`^0@,L.4N'6"_)U+X5FQB@&2I: +M&!JPB'8Z3336/;-^B>69>_BX@Y#>FO/$'@.O +M1`OX:=6QRGG8(FL!JM#*J;2CPU&F?3%OIOR-=2DDBER=V(-J2(B$DY1 +M@,;"UL'>8LJ7&Y+N>^]I>;3-&U^V'MFQ5V_HW#ZM2-NB9R3E&$HZXIR85MXS +MQMKAE2:$\PFBYO216)CP'A0P[XBZ0NCVWS;F?C\8Z@TO@.UY@=S/9%U,T/*# +M!-1OUZ;3UQ.ZS5<"SLKE\_2QF*>",G*;FB[2O04O-`N>+A70L*WNVZ*<'1,TU[M2QT+P4E7K8M*D=*<0 +M[KVR*($<5*A'J7T(+Z26Y]AF2">B*JW'Z-M%2!ZX8>4>-C35(S!&)4<++T*= +M;EA:ATVT,GG/OL4UW%M=.M'G*5]T:QH./>K]&RMUZ?$X-ANG,[:.JE8V^_.9OC7,1ELNH>#\),CF_!LD +M`C\YF54]];YES<+]?9W=^#R-ZA-87Y,BQ9]PK7<7;C8][WR#/*^"D$4'7Y!( +ML[,UU'.J5NC_I6*1PY0+=1>2X?GKB?SLFXT-4$^8+/HWGP2N:^D/'=?0F>&' +MG.:RMYM@;*F?VP@AH>C8.--LY[+4J9;UZ7.0X^B;)'QS&8.S')X19NUKO$KJ4C2>\SRIYO1H]1KA44\*YCCKLM\ +MA]F;83W([!2J6?P/9=RU]?NUY?AHGQX2"$M^'`M"!B6V1Y/@"5Y;%4L>>Q+1 +MVN465GY=&;I0-Q\[Z)207U&ACB+Y?(+"0]["#? +M"AFVGJI-YS=Z4I%$BC:J(4HJ.\)9[C?!J=,]XOFW!2<9RM/#Z7Z2FZF#E`Y9 +MIW[O?,VDA[JNZ;L6J"!O;K#V>M*U]PX2HP]`.J1&G\].C"*[3>M@4K',(F.P +M%T7U5RAT!%?%2AC9:<+568[JOUJKK6?:2/FW_[:KK)B8/>%WWK%*NEX/8NR" +MH;:?$9$K-ZM'W9AO7W=44<+P%)D*U6>JOY@#D`B/EVM=R,N;I:NHY&:JO"2F +MFC:I+;DX8=?6)2PL?T72V:CM;7S%>SU&X-H4@8?P:B:.HWIK+1,:%SR;K>R" +M&L65\F)N$\RW>P_IKP@H@IU1+^7,J7T#41?>D,\[%5U$$!8I>FF[)(?/U!T` +MK<6N=_&0@F"!@L;2.=6JQ/8F*_VQ*#SY;(E`IZJY;![OYH?TIUJQ\17TS"+( +M2UTKD1@5:\JJ)CTC-71>\X5&91[//#1VVPT:2V*EPY'6E*IB/1-9"3'TR!9QQ&6BP)\1M'H)U@BY6W +M]:EVO'VAT9K>:@KE9)%]0ZQKC;@&1Y>]5VP2\0N7)%9L$/$?X.IV.]7`:]*< +MZNETE!:I'G[!A37E3SS8<$*\G2JP'/2B;IN&\'0Z#FGS0IO(<,68]%> +M.YQ48T^7F\Y-]`5^]L2PQ1>>093&*N_5(*VHAW2$F(^E3^I.\>)8=\7J?-#+ +MJZ$49,98OF3M8(V<2+8WZ27Z>AU/9@O(6VI,QY+RF0_7O5;FK&,ND*(MNRLF +MV"L:R;2):CX'O1N2)+2>N#;A@VX1@&?3WILO03^XAW?*222DYGWKU<^:_2+9%I"['[@.V93YAG/I'K0ZF%1PZ+,M'R'Q(^/D2F8;!^? +M,>5O;7<:(]6G6;UP%Q">ZU>Z;,8$AYV*`Y`)!ZAC\OXH4_819?4N>UEE08)_ +MM5J!V^;1U32:BX4%J`\VI?MG/@4^%:[0(F(WNLWQ8EG89516D^;C8FAO;>,+@MNH&)-N)2=^`W7\FJ3?&1<(U'HG=1G%`A":UA.*5P!'PXX1>T4$FAU +M_I/MSJ+W1./HP?\R@34^?O>W+M:GJO-T-0IB&&^(079A)9`DZDTZT?RCXW:;DF67=QA*FZP.#+5A[ +M+:M:8IPSE%A_92)]T?!7!9,RA2^(#[_H;$#J< +MTP+",3WHSVRX+&K3+(W(KT8+!GSBIZ[:CIH/1G8H<@_U#"S@&PK_$;+!`@-36Z-K( +MQ,?V,,3@X-"TR,#$V($K[T,Q`?+[.`L($"@0,!`X$$`02!!0$%@08!!H$'@0 +MB!"8$*@0R!#@%Y0(C`BL",P+S@2`!*`$O??T"?@*:`KD"V/QTG"`;4S_CP)_ +ML"GU%?J+?47^O[I2OQTEA]B?R0X!CPAX`+&P(A`C$"/@)<`GP"M_]>!OG^+[ +M6`H&#`80!A0&'`8D!C0&0`9@`/_6_ZC/Z&_Z$/$3C`#P,_4:^HW]?)]1SZCO +MU'OJ>_5,2/YN4H(2-L,:XUM;`TL"^&.3'_W$#HU.!`Y?;/]Z.'B +MR'YN:@`'\MSI^-!`_ZA@_>GZ'7V;`$L&>*WK5]@OOX6?@#_.@8/X&_?OZ('X +M%?B78`E?\L`2SA_V_ZR?=UG=/&.B?^%UYP;?'!#Q%'\U[^Y&!Q`$NX?<H@`&<9"X`3GB%A@"_QP:?O5_U +M7CD5?SDA`,R#[;`+J@$D_>S_RY;!_(@N-WV#;?'+/AC+]C6_\IK`"MJ^SWW6 +M_U9;XLJ'\(#^]_N.S@"(`#1C^Z#!^2U\:89^1=`:'D-Q?XZ'S-Q9^#[`$OUQ +M>``Y1]U?&\?]"P+[.Z%/X45`:%U?N9N#`%1XOD2`4>-OZ+7\:)+`#G$;]7Q^ +M"%86H!'=(`5W.?\X!7GZ9]<`L1^-]XYN%QB7/^D6!G\O@C]R`#7?N=]D_&K_ +M^/AAI(/N0W_N=G_#C*^(`M<7'Q9^@`-RK^5^?SGD_T[@.E@`6*ON"]_`?XNX +M7@-Y^C6@$,K[)XYVH!4P,(/M2U`+W_P*O]M#U_*_UH7'0`''$`5WQ$69T_YO +ML`0^`45S\[8M_!G_^U^D;^0`!/2^`?"SQWIN:@`.(S[_L0`ZP!8XT_RBT_1DQ0;OQ>(#("6@%EO$!^#.?B]3"R`/8`?8G +M]U,'Y6\\2#XASQCM/-).W__1X_D]C``XD/%(W]3]-__&7.`'GXR:/Y'"-_$? +MXR67%@_1?F=D9F#\8U_L8V_K#];__,D0`'_^_QXO1``:>_^+'_[&1?8/'(-_ +MR&[^44^,<>6IA_VK-XX>ORKOXWQ]VP&�`:4SQ5/^(E_G,(`$9^[6?QN#_Q +MSD?O;[)-S>R,7BYZ&__>12!$#L8.9*8&[G]M?Y]7CQU0B!`0`2?X`"35W]\@ +M$[(">@-QS^6I'._S7Q9^%:/MM_39`(^9S`N-OT!])*O_O5C`?!5*VAO_@<"; +M6\K;6?\_"B"?\>?SQZ3U[:OY^'&)_/JFM?[,A_)1U6_^:?%_<$G#]G^=)4TW +M]S^UK;S_9@_[&*Y?_>_"/V.)U_:`3^@+M^T`K]K=_V@%_L&#Q^T`7]6E[_9Z +MKU^?7\T___K4A^OU^OU^OU^OU^OU^OU^OU_;\Z8I6SM;4+9UQ7671+:=>^=K +M]FK?2_.>^P2T2"HMTAK,&Q=$@^8&J9'$S$!R.YO\5W3W43TKEH86N-()KZ^R +M&JMF5H]K.O=$'D3]\])S\Q6X[D&@*?(EV7X8M(MOMYHQ*;R\_$T$?L32J,G3 +M`9?G42G#-0:Y'8*<744/MSK@Q?;V]4$3':ONX'8Y*DN0-U"'WF;Y7BMZ0A./+@E+&7S9 +MWIU;;"!,?5"]L(T95Y57J;(Q@*0TS(I(B4/+"=[=1G&8*Q.[1U.8K/^1\H,5 +M?F,W.=A2W#U`%%5D(R]%JP7W=,HO2Y1M7.W(XDUGX.(*F[MM-P/0RF0?CE74 +MO0:R1F'8GO+Q,QRH5N@*F<*&/Z\%6%&"FC+F33;G]]RF8!%L=SJ&OUM[_MU! +M>150+!*,,*#KG@0Z&2%.^A]9[P%4.R/?-C'Z+(SGU/L?GPU +MO(Q9&&\C;W%&Y1#+$$`GK#,2)PC&EQ!A^;6WWE#;+,['XKY`DBW/[0W38Z&M +M`783+V,SN.LN(0QHTYY628&,9B4V0SQ:W^D)9;IM8OW=2(GQ7X(GS:KN@I8&R=N9RD" +MM(&!ES!ZK$G)7!S@98A?XFV5.82IN.%9]*6[EI"+T-P7W6:W<,FQL*(7/NJ%JPA&FLKSR/F@*\H'OB_ +M]+$A7**EDO>JQ8.D[EBP-AO;W9K![DX&ZE[DE#5P50O:QHLGB-FWM7E7%'2I +M47S:KT91L]B#G-[1^&FQJDG+HE>=1?7?AT`WJTRHDWVD%0<6T=-F0$$U_]ZR +MF^9%WW11<#L%YC*'*HT1]W1569;J9+WW3C?>I4,+=*]97:VN'+3%96R:UP,.X#A4%#.).XA2IE5Y!-DU;@6;T(3 +M1;7>7M$X2Z9[Y#4'H@F,R^+".YM?1Y%R-WP@1#N4@(U<5"O:Y\:(-*#R>F"\ +M-[O49H@328VG>?G9FA*NVEKW!@RL4-?G3O8K>OHHPEU!@K))L2=G:A&!7#@? +M;%"WI8?CZU1IMDCQQANV@"G<8%-P(\$DUIQI^EFTY=[7-S<+;-=I,+7Z' +M.K+.=G#%41O\X&NF*AB3^X<\*$=46_C=23CO4V;H'G9)RLB@'!ANQ-^E4*`P +MIN:2EZY9@&<#VN=0-WE2.LR>:5]<(=_T"H@.3]#'O>V@0SY6=?)"ZR/Y9!!D +MD!8^6]F9Z8;^L3]L+I:IXK/A7%%8O1^;I1F&&ODEV*1P2IH)D?S4BL,WN5Q' +MF"O#1G[E.I#I"YGA;B$E*8(S=E3A51/G1Z>N>!F +MND.(:O3^.LM45-/>9>RSF>JW#R(-7]-YML"B^2&U/59#YB94Q+;*!VT +MG0[)QBB]C9MA:P6ED\75_O!.[XKEAAZKOY1^RK:=G*#$6M6_KS1:F'WB]^>5 +MD5;FH.+"22/P4R&`9H!X2[OZ;M\MDE6"UU,.1OES;+[@?IF#-R9R>/FS#Y\`F.C:1<'N/\:;)43U>@ +MY;I4(=]67O&1N7D0L3[E#8,_1B9SDQZ*^B#,H*N+=;0;H[&TVDP!'V/H2CL?%&86&1X@2-14ET69_=G8 +MJ8)UC6;`>UB&0%-%"!*,Z#MML02\Q*;U4/[@F)X=5GVMJ0+'D9W>0F5ATA0G +MV$I]0=U/>AQ=OAV=*6/<[IFV:XYVW4SEP%[MB:94PLH>XT=T]:Y6N45IJEX[ +MZ!2%Q%W.)+/H]3XT^^-.%JEA)2'Y3\R\&*ZD"SSB)_*M'?MI1B:(QY.5/S^? +M4YJ.CVL'&(R])ZGCS%'72,>P^CB",$]\-:4)80WI+&3%B8U6RH +MMCDK/@WADAGK1T=(,=DWU*T^WGYWZM"!7%@*S_?R.J66*E`*;8V-Q8O98'PT +MQ2N5U6M9@B,$?2"Q'O@_4A`W7@W,P4R`4WR=OU8R+[C)Z.0O^)-U2>OO2FKM +MZ&!U`R./4OY5!KE.E(G+2'N\FX8BI(FSD/D>[FDN?-?9S!8=#S+B'<%_>C;UC8 +MG^"EA59:2W/WV6<$;G.$^<7I_:I!80=JKM/,2U]MCB:G!T9.Z:#3>AI-\U>P['>L5#I_C7_>38ERU1=U57XCIK'38Y16M.C@ +M&H.&\N^NFK\;D;+5L.#*G(--IJYF,(![H$_T2*)\'_/LN7O,(S&-BIVU7XA# +MD,/\M"_5XMHDI((>86B0=`J*W=RB,%UYF`E>E'JBKE.Q2;P_;F"5YOMD/H@Y +MZ<9C;M8L\\%>*Q_.6T/*C@EO]':LP'O2-^8G&H;P3;03^-=[)S@Q"E) +ME8+4Z8[B=&#V#2+C/[5P>JPOBO>I[6'<:%4LKB7(/)R?(8@T/67"[0[(3RM7 +M%WU^M\%9W4KLNS[[4O-YWR:=*CIOJL2&EB!ZRJV$L"OLK"P+W6)AEZ[?=I8H +MIS1SVK3R=.-]PP;Q:HPNQ*CG,,Y!IEZ?!#DFK<5F$('W&J$5J*O2;D^CPF:: +MZMI37)%X18F^BCK&4=HSY8A<#_I:Y00]C;3D4*)GYNCK(EQYL7EOT!Q>/ILU +M-_VQ@NH[3L2:N^'/H7[D%OLX\SQR"&T-B-@J)"\E>&O=)4.Y,9S\:,P4UL4\ +MNF.!`+(()`PBU\JT[4O<)U+,@?M%6X,WZO@$@=_5 +MQQM(LDERMM;+ID^[O,CM:,>'>7ZY8>PCR-9669B'WTC$!S]TC8IYN64Q+*T_ +MOPZ4'F+`+^>-R>"KGP"M=VS0QMF#Y/AX<]F&I'?@4>7LD4HN\*DSBBP=9HV5^U3)X;U:Y9V=3T:BM]@G:^TD2462,>A^GT!JQ4B-JJ75`8LB +M\SP"Z+8`TY]O91-WK61F=EP6:H\R<]%;]Q86R13(&?>'Z4T)(IQ;&-:W)2(3 +M>->XF&%UL&\>K=6+/;_)/`:]A`5UF7KDNH^E+*'?E[G/G'+ROM!B%W'$5ZW* +M@D$>I8`^8Q+R+H9KL"-($J@-G3%HWQ2H&/6UQR#`(6Q&TNC#1ING-#?IH`=_ +M/C[S&".:@)(M`%*@7OPG@))3_8"?9$=8@COZ^(:J+!!;5>#87=AE6.?'(*QQ +M,\M\.VT4ICK*LI@O2JF,+@\F9"D*+T0H09Q68V+O5F(G3*9K*^B^-?-R8QYQ +M]*8>>GS41ODV!D;O+C*E2U2@15S+VP6NV^\%N,0KY(+%?626FV-D9BR01')S +MBFNN/5?+NB:%;`H6-6P=3E1,YT\&3/'T^,S#9XF,U3R[#I&%3PZ'&U*O-8Q@ +M3R.S8VY9U)!.3%##@-A08D8"4=R]E5$_#8)9@@,;62W#ZU +M>90%]7"O9?(I0IJ:*^^VK3`_[<)D]FF2&NX]$AWP^F'R)$XQ]OK&_<>XI;K@ +MV^,3=US,(78I/#.%F4<)A/"XRX/)P\V"JD:KG.?7>9V.:DNFLUUCI_1OF3K,D:C4Q1DZ/L6SXKSE)E)5Y8:2L>8%&27FH-`Z[F?&F>Z\'C[K1HS4Z]CU +M-VYQ267/AV\GOA%J +ML\OK1]23"CJ4@;(G5`_C$S0%V>(6(@"Q-C-XC=9%?WMLGR'YJM!@F6KX$B$J +M%R[&:C!"XF*3:(0BNM;WX]PX&Z/U")EEO(4).[R'.>/4?_#L/G]2-IE^SZ\Z?FMPSX#SJ"#`14M//H^)G#[5:1!ZVS +M,M/7H#BS#*,=K-4KIO?'*MZ2*279 +MG_DVVDP7N9!,0%5/58]QJU;@D<=T)+MS=H]<-X +M")GCN"#ESCMGW2>[03^->R'\^?V$_TN>37[EGD13&TY[VU(.=H;I[+Z,LXRU +MCR9^-D1J#C.BJLYMDGW.:,2I!J20E::AGHBF&*@\-AU]^U8!JB<>!*>OH(R&94R7?V17/3A$[FGA9;M)\UK`ZD6-4FI0,T.N(\$/KC6X"XV&Z#X +M-D7![3FJ/KFY]R7)O3;;`[UFAU`T=.4;-">-Y++I2".RN7I4%ZH3L->&O<7+ +M\@*TR^=ZBX2XK]X$KJF#I%SV[Z1>H/DROVA(.5F&#M%EJA.98+PF3Z#1-1_1 +M+2E`<"0H;'%AIEQ@]9-,890TH&RO'X9MQ*Z.+,WADBUN9FPJEV=`*[+93>0A +M=B[R>NMPQX&.%`>I.?P$8@L7!$DU7T*H6D="@.9!P.ZGY,#:5]S"-;Y;00D$ +MW_]-:BOU[P&N'0'_Q4?JI_KY_Z\P-_8"/Z=TE#^6$Z_OK];_^]_\T_R4#UK_ +M]]?LD/['_.W_0`&_]@?Q?'_78(_:(3]0KZA?U_1P%']L_F!;D"_OGQN3_3HW +M5]D/\`5]1+ZD'U/?J`[2&97_WU?58MH+98"D8K%MY6DZ.>=,G'I/$$Z&8P>3 +MH>ZW$<*8#B1J+-TM][^WH^C04RQG +MP?4XIZ=Z)%HO#&?OB<%IKUZ5K7E#=6\1(J>RDY>P`AB*2D6@`RM)SKLJ;S5(<.G"/[\U+3,"4]/*U%S'P/OL +M;VI>G',6<[Y_"@2]ANOPM(G>9TV;^DUU6G(YMEY^CM-7JG@6T22ZI],N>SZH +M:O_-YO#;H=UU]Z(9K7L\'^YQ798`RCM.?9WWS'WXBID*`H=!;(8YLS4%,PK +MU'@@?XT_GMO.YK@\XT*_Z-#!1F$S3C>8DW@F.(U/@=^K^`I>-W4U2'EA'B2R +M>O&T#$Y=3>RI+)=2`@78ARC!"Y@JR&1[0C>4<3D2[WT@ZD-:Q\7YY;2&),

    _AAI:TCX=^9]9E0<\U6KS?'-`AT#W8E7O,UN:RZ7<>'29?J+5[" +M5UK2XIOSEW**=-M[);HB;4Z2+TN^DSW!"&Y3[8FS"`CL=U*1%:&>\PN'[EQA +M(+%G?YF&A[U+E1=BB@:KGY.+HI7TT>PP7]/ERBAMX5*H59B2"+?!%M9T]+J5'VSV8Z-\Q'P*".XVJP-F +MQA/A("$W:*>GQ^>-8A%NN6[GM(,UAE>XG;>Y:_*W'_TQ<4K=]A6D:J6:3DE3 +M$%<[V`5UB_\,U?W&]BD&>* +M;1:*_=`ZR&]/7WITFH;6>B\)5O?/I"US1#,9/K[J,O&J<$$I)^ZRC?;&,7+= +M'-J59=GD\S`G[R(U7NY)G//N=1'N^FENQ1`$E9`';;VU9[2"[12[FMQ6')"E +MHW!6BI7I-X"^^I/J84G+*@W]$?&1,K>]IZ5/35LH^R2F4)>; +MY88]F8O9-*7TL:RIX"!C.9\=JP^9$-`05.P?V-/M]Y-<7;3$<.G_S)Q##Y +M=-E=\J,)>.V5+-44TXC-PWMA`;@21,66FS7(FR5"F0K)B<=I;0\0W>D\+8MZ +M8[%0>WZTRQ%V[X%^R:`L=.HAC?)FBZ'FL4-+4DKIH)IY>`Y!,(PS,TGL3+CE +M/;(6DWM2)3*MAP^T<,-6IVNBW*3\1@LR.5&>_+4T@R2L +M4W-O.Z%)H3XBHQRCK(.@6[KT@[8SR"S7G#K[1Q[9,AX-HRO>Z3;8IH`)"A[K +MY#MSXC5P^6-RHF/6JQ4E8Z4&]H,M>LE@2"H@3^?]8.5L!,5(CT^G(?Y16] +M]4E.8Y)I57\$]'6X$Z]T\';<`\7#0KZ@V-&KFGL\WP90KW]BSH*SD)>:[F^O +M-V_/Z(+C](\W"!]&VTJ#6#73!]@W>`WA:&29KE=$H;-FLKTF!LW7PS<_`_Q2 +M<':*VL[1L'PPD1`)$WBI[F:&MDGX+*6:Y#;!88)O#0VZ:Z;]E?"CC_L0:"=> +MIWSZ.&S-@\UC#F'ZXH!HT*1UI6S'*:D*P(:_EBY>#M +MQ];-#0D01;)26,9E=R\5`>97N5/L=E?Y,W=;;E:I;NG&^1F`\/PI*?!LV.U? +M,8>K&7*.LWI"2INF+V!^*H>CA]44LI]J-7`E7'-44"_ +MJHTSRG`8O^?YX2>R1;2KZI/-!_PBL48^$;(_;/9?*1&$Z&!B7.UM$D[4RLRZRF>D= +M0M[ATUJ&1Z".4UYTD:+A)6431(`C7W&Y$)X@S+.)6J/%9A4&0JR*\^IS$>T' +M)J!VET+_?\=%G#7>5,(Q8G4U?(S@S+1*#V$W1TY&Z92*;/'YTDW4F#AE:E1$ +MP'QK,T3&WGS.74>IJ!_0F2*,7*!0RKFY)_1=>)-HMGO$]N@$SP)+$^$22!2+ +M&JW;,6'OOR@K'C$OMTQ1_J!%(?QXJQ%NFZH^37F*\DY<>@&15L^-9"^?NI\] +M*T5U&>+>R*_<]\1A&QU";_-@0["E8YV_.CC)N4,ZVZ&.&>`[(A+Y*Z$D.Z#@ +MH/:DP/AQ5_%7;/(JUHWOJ;9FX,,W^K&]+V%2`^'UD`DQCHVS\%#N9\NT! +M<<]Z^6?!4*R_1=D$@N9WL;DL$HV_)JX6/Z8./A,Y!5\!EXWK2>H=AY;0R.-9 +MM=ZRE+$C%JV!JO4?VV^\BLCAQ-)_PEG#D2;EV4T1'...S".NN''DG'VZ3UEO[;]5]AH^@>U`$`=*4 +MJFM5WT@SV*6H$$*HA<%H%*^FW*`RON^NR)[$0>*FS+7`]-<><5%[JI0`99^S(J]+UJ_G>OT7>*=%Y8)-8.;Z6'X-;Z%_-G3^EX;%^&PE +MOU!=&6]'.2^9%\FC?'KT/WZ%O!T;CA'T]VP1&%&$7=/,<&1J\<;9*O/U6T4+ +M$1JO!7,8GR+3)D*L5:AN,,+3\#773)N +M/Z]2`%HQB/LXU4K3=E8^ +M*@)LL5+/4YC>AE<YJ@K[ +MA.:%7\_H'*G'0'W'F+BROQ_AJH.V%7G!H(IEU@`RNT5UQKCK045_3\]Y(8ZG +M8A0EYBYDZ_/']`AK085TW*`]1$;X9@HB9-:`$.+W0'=#4[D#TM/.3$MCC)?O +MM*"J6$^`5J_$203+9'-11?*)1-*]EG(^$92@L]X)>#7RN&6+EZ#N+S[$KQ<,67M+68E,"BH'R>:K:T)L;S")$45XJI@HF=W:^T3Q_$ +M3B52Y!EPR4E;*@C-]O+'4^GYS;"833\^:VEY/2APY"S^M:\.-[[HZ!8R<8G) +M#@V5[3HRU5]OE\QXDY-T''66%!$B,OI@8D^:KAC2S+Y-YJ"ULME-DBN[=-@N +M]U?A\\NHY>`V=D3TIS_"JH4*77"?\[5P/I2<:]22F;OV6S0@NHV&3YO`IR-Z +M[]3.3YJ!UJ1KJF&P5'I4&1CX1^HLZ(4#;>W)$G.>_+UB?NK#0PR0K=6W,"M0 +MTI!QJF)(N\UWB:QH8>0P>;/J0@6#[)=TH7KS,MFUWH<=RJN.[IXO9+67G^CU +MU#`9:TQJ$4LX_MRGLD(OIGIEU-`V6;(@.R[V_I4*6F1*WH%PV06CKNFTW[A;\T8J;A,.CR.MS1=!R*6YN4F*(EB"`GE$DL%/M9MH5P;<&_YCK +M1KL2\]%/.H1I\XB;D):4L4ZV?E)$N1"XKHV-0S4FKD5^9)*MVG4J,64[/'G/ +M0._D+`,R]@9Y6?UW:D2RCMUYX'WSY0T4,ZBN8SVSRJ4SU)W&W%[Z#J[#I_TY +MNSL(,?A1#XJU,D*I^-.0<'C#ZONV%5(YB.-U43K6'-,`6RICVV%]5*!&?YX]?VU2N)CP6OF=ZC*FKAJ70CEP]QE/&SD4(QD/; +MFD)A3<3XX;V"FY00Z_:3:.7N$C050TUN(.P6?QT)A^-(8B"L"#?-*(C`-H[=VGXP[R(M8S4O +MBM4=A5#;+20-19'%:OR9=Q^4288'#OUMK>HBM:@^42-:WT)];HJ6<&1'RBN/552C/QW/<&JI,\]";?! +M=(T8_P'9F6!S`'DY-I?,",BZG+$P],<2)>L'2*@0AR;VTW2AH&GC56PK46K" +MZ^XMD'EB=]V,JKD5NBZZV-`3D'(PSCZ248'Y?O)&BL[#DC^:B>GUB&?)Z>2V +M@%Z(;D_;?3T7N3&XD7BOINUD$D+EX1`\=O89BSTT.K^3DCUSEH?OX.$I$C(( +M\AO(!#Q+!+^.:8H3-D7T**(DLV(2P'Q)9GKUN;-@Q;G[V.1'H8NTK^]LO3Z: +M8C+/LP7$51L^8\8WF1GX0;./A7$09C+:4YT0F'&!>#+C@LVZ;,J>^:+J7358 +MMHY=\U6JWNP,X>2E^XK&*GL+I+W4%#0UM_`W-D1OFP%IIL_,_6?U +MQ\X+0RQ2/K!IY'Z&211UP,O*S66E3J$8Z?%E;0(15`%_;MY]SDK:^27-@SO# +M%:HAN^M@&,]'/.F=GI-:R2/4Y!,HP/&U6:(,,I)%#"!'R8HD6>[S8D)>!DRO +MCO>9<4B"?CSGWRO%Y;>:H&(=($"VU[7IBH?DXA`4K/G=)25+BL8`H>]+SX/-E3!U +M:.T#?F=,;%%;;.^<,':T7;#]V"(/SWQHYFEBQ;+6YR3JVHM84;WI!,EE-"RS +MR`]I!)7:WKHG?2[O:&^B?ICL8B>+VMZ-8@G'I.WHS#F\-SFF$Z7W:&&$L012 +MCI_TXR'1,UW#A0WGNFDRX[MW6N[=#`37?*M6M?L2*<(5F-X[[![T6>^(I3G@ +M"RC)O)/RQ\G[=LD^O7>4=HL''D-SM94RQL')&@SU/OD::3!T[^,EZ*N,?2VQ=1LJC3C! +MB%>KOH4,JB8O6QF8+S[0G1;0),HPMOEW&FV0G'FW&U')WE_<++ZTV/291/4\ +MI+@EDAZ+D=\R%7`4@BM=R,JW5@]9%K0G0GWEAV&@R[IJX[-D?ZH$UIV5!+"# +M6--V+<0?;2O7-S3<\'.O8_1WI'"&;"G+]V_LQL$EMZV1K7GK9,1M0]&Q&Q3B +M3#X!RT:?^`G/U"KF0HX)F55RQEAJPOIR+7"/,'WJN-BAHYS3MM +M?R9B!$E`)/+J@B@ZP+KP+;PARC*N*NX*/=BD2;>:)LD-3U1?FP$]F'C3(&XC5,/3/,6N:F"APN=B3%/I5[B,5 +MX[HRL%45ILV4I)KBKQKV4'NKU('\I69+O%D729WD`>>(;0Y1.D=)/,5A.UGG +M1LW"K##'[HF(Z-FANUD&=(?.,!9JJW\X=9-DO%,N.=9U,*/,8E"5#`8*OFLD +MR/&RMIA:`,XR6\"FW!76*3JH;==.;X#&,PA'RPR,'=K'Z)(;>#JKA@Z#&%&> +MLQDNU96=?XR[KS#F1EC5KZA3A"E0PQ&[JM[K1`=?1\\Q:C-Y$\J3WRM!!&H9 +M!`Z%*+OR6)/#V4N:/%C7*!2]3]?F,8.O5296TH`PEDRC>V5;2UGGT]M<7/4* +M[R0T&Y^\#^;`D/:VS3B0M_T9B[IE[CHM?:!VM0?7]_KEEJ'-"[E092?97N)W +M[3K54]N&;')=\,C"V?ZY&ZVC3X28PC(FWUMX/T.^:'A'&D73EP]2QO#6P(^2 +M`8Q@,%=%/HO/H7Y2(^Z2MTY'?KX&F=RV0[)Q:3;RD=&6%IU[#H@>1R+E=BB( +M%RK<>D1H$HK6AL)J-(C2Y:$QV7-262EC:SV:+#X5D-!_1!IPYI[6C[`FE,.2 +M(7@TSAWZ38%H!58H\TS8EA*!<\&L81.%>7N47F>8]2IYF8&36K[#P@W#T="] +MQ*?(PV7@)%(R#>!'A]#7)/_B;F@R0WP)))CV"XNS/GNNLHRQ[:+ZH1D#]$5` +MDD]01%WIM83`A/##WL3IC%^CY:RZ"= +M8)]9K=5+#<*X^O&T]#OO>]3MS#*V9IL/?B/BM +M_.,8Z5-ZCR7'M&QX[?9A1XR?':U05WJOK&O9>;LOYH_:5D&A?C%YZBSZ;K5GH26[3[R",/AC64/(Y*\PV?P$%BZ2-7K4STRJ[;/;BH(856Z +M-.T1G*^L^$BP9Q-A#4!R2L;%[\PVBU<]2U'3#.%/,2P_?-V=9TU+;.#R`QVI +M[;-'+%IMQC03HOKIDZ4EV#72LZB$E3#$6X)-YXO[+)"F(?SBO288Q>87N>-7 +MK0Q13\-=0-`SH9V"B>-"-?F!OSV9ZT.@8=88%PW_4;><^Q3>\,GFM7\F/M3WU,9-7>^65?GZFV?ZS[^!=UN;!TMA3"./E>B3P)G:/DIT2MS&>-.P1T=BHN;\'88OL1A&I)2F"QN>6!S"^)S!- +M>L26;3_>.NX65-2$K1Q]@5LE3,*%DPL]I!77!)>]V3N!WB)"\*9A@R_^NMG% +MD:'@?T?;L,I1.B3>E8H(N#(8N>B65P/*MK<.41`2U=/PE+#Y6>)UO_6=;]CW)!RP<8+3!Z!T_%#WS]V6REDI9[:>&CBSN70X%EZG +M?=4KL4(J9[V%8?C)98C@9@AL1Z#89]Z#Y$:ZSC9FU^A2KR$]C"NEEF2DW&K] +M`P=P[Q_`'+D5IN*9[?\R;2,\7=M_@0^#WXQ43>E-YS&$PV;?-3E?=F.\490V +M+8N(^'/NJBNB`MT7]^6&?/JIAP.UY"W?(PA3M_=G_UQ\Z,P6$2U"\`]7("L@ +MV0MI>=?UW!AUY4S)FN"J(-S*;!RHB:5]Y--*++?76]A71VQ)(LP7O![:V$3M +M408!/C3V_A.J5&,Z7-]O(JI1TI)2'09+_\Q)R%<)$OXF$S)*$=OA(I)1V6.9 +MQD$`48$1I&C4*S7,S3/@S?'NM$+[JP]^&&"3)3.Y2R#WIIW<>^Z_HO`[.:X-GN>&SUJ%IUOAS&; +MQUG\),0#%/5UGFY#^X7LQ4*`G)E5Y,YPN9W;]E"M\,7406<3IW]@"O"YNET'9/1Z9P@B\G75N\[RT%6ST\7N)L0'28 +M]7\J;DBLVMU0-'6E^Y(8OC[0;#\-#MG'%7/B]R6K[WCY$:_*:7B/'.G>R!K0 +M)MYY7E2(VD=!;];G;3^=`%X:4P5"E$GGY?>#SG/>X!-]0)(W5C61L@9'O5#2 +M8CD+\JDOQ;6EL/P-:=MXEPD-36@.7G:>!D,>NC98H5'Y$/?QJ92J@RL%`0Z+ +M4I3431IXF[DN?C9N_A\A6_ZT;1"3A1S.4=FCV9%9.DWRMF[%HXF+7S#] +MJ#&FBL`>Y:QA,S*=0.PRSM'L)?/ARF]N`NYA^U$Z#)!\,E<^TXR)N0T@J]!3 +M-VYZC?<>MYTH@=G/Y4K-E)HX+Q[]*Q3F)>D4!.`;U]-CX +MNXBD#K-%D@;M5UPE5IF%%-<9%B;D8SPF*]%Y7$1:TYH!B;C9NPWMJ("&DY]?Z#U\/ +MS^&PE1Z((A>T?IY?L_[]\\YYHX>>[C&?">'Z];A[W +M26^$G&//H;KJU&FNVX\QSS(.5)YIX']LK=KWA,WK5'+N?"M_ZM]Y +MKZE^_L+@O&V?!,3D; +M\<)1YSK=;GY:DR'1F="I\M]T4Y/2UZ=OS02W?Z6?UUJX$1=&7DN?R9G^-3N7 +M?Q<3^,'Z.=>NJIZ?ZQMG?/JQ<@SN>S]]N/<#?Q-1U,72:_ZM?N]C>/B_KH]_@&.>],7BWZ/19#`6:$[=[\[9Z-IU-?\&PZJ\:WWG3_%GM +MMC<%O3TAII_YTEH][P;_[.!@=?H])`^+$.4)O.RU:I32==_M8CZK:1?8UO!M>-BWN$_3.\C!S?A1XC+]+NP?@RNQQ<5N;7J$?2 +MLYW:MC3,77(^ASY"F,YG*X?(O3=BG_Q?8^.KK=+_^FDDMQ]&(\NQ^Z5J'C,8 +MO6Z#N)G.5?XM]Z_,[;U<_TA,EO#[1_&P]Z]:-P=;KI;)UW7^?5BGS,?7XSMZ +M^+0_'>F,9SY=W[.M?E%1(62/H]VT?'9=_%Q6FYOCI'37S'/F:.:T7[Z?@;J' +MM-RX^#Z65L[U?TCW,)CK=]+JW[[E:-LU;%%SKBHDL-:/%"):;6\7:Z7L8 +MC08_>]Y38T&+CG:T-^P\'+\3_]MYO?%16U2@S6`R-OJ6OI42>(T6>25/)IIR +M8C^YQ,[KW6S:7<!PW[X=IL?KP5BPK%KVC<;2T1LI:JGQ\;D^B +MU?<\6S$^'ORVLC/_\'.YOEM2B1ZI_#=OI\-Z^JFQO[-'(S=QH?II+CPGC +M;1T[+S,E=O +M)B^%!9I5)F,-=H*(V+Y"_;;]5L&//SG3Q.FD-[D/+D.1[L%T.SO8F$HOZXM- +M4=[^=-Y>XEO]ET+]8_6G++=[;/]K@9#N9>`X7P\[8:?`82+_/E7W3;^YR;EM +M;QJZ)%JH[X%._^7RGHFHQS9;,-TY_]^;\F&EY'D]U':W +MBZ9)0XE/\;/YTLN^P/F=]&W\#(VSA-.4@OY8HWY_%=CGC9[50977/O<1O%4) +MIO,\#T]+W+G*9O2V_#Y1(I/926SW&V\+K.[MUB>`]0UZZ/\7#0;#\N6V_UI9'[--]$OSG!S;;1T\8S5-\ +M>OSI>1=_#J,E)'/VHO%A);Y:C47#RN%K8XW[HCHXGBQMQD9Z@OC](9;(SMR^ +M0^DT/$1]U=IW86%E=V?\>#B7B<9=A0G8VJ:T,$S/F>9$<0;)A +M];MEP^].%^9`MUAR\CE./5\._TF`MU0(!NZ1O&,/,AG=84/KMNZ^^:D@OAN[ +MJM?`Y?,$F.`,^1#V_/[KCGMZ)A%[`L0R$)L+X;=1D[OI;W&$W)B-)N]D,<18 +MN"1Y&Z$C&N)L60E(W?R,2Y-B<31"A9`1D49WNOA+@(D6&ZYR)ADD/!$(EV1Q +MVM'_)5$%ELP*%=8Z1,4D@74R1LDL`OXBXC>$[/YA"8G,*@OS*93 +M8U;,QV(B-4G2U%&B_>(C7$->G!W-V+:8!E*[&95_JTB)M*3(?`WJ_&-Q#ELV +M7W*>&>96(WS)YAYDW$19RS<4OD077,'L`!,L6T$'V$+A8AG!(TJQ_:!W=G'? +MFU395%D36MCK'V."66G!%,($E#=>K]K)2;!-V]@D4+F[6_$C]T*OX>=8UEA(5B@B!C?QX^ZK=_%=@4F7!%8,!(8<8<8<8BYAR/ +MD+*.NGLSL2N*V[BD7YN(#W$=Q'<79N4'+LN+NR18;(_'34K/B,B,LX?SY"RD +M8,1Q889:`Q(,?.PKFOAG'U>F^@^'\`>4G4:LM8H(")L8\;:*O\<&:`3P4#H# +MRO'/5NI*R58R8=?>'&=D&9W9E4,:,\B8D)*T%#0[KFVAV/HV5$R(3A]FX".&P+.-BX-L?UV[8!Z;'9J4-"-G1'&^ +MK[>$XF\=O=P;OUF4MBAK1N%M(+,[MQ)N&M2!:3V),9*4GP#@LA.F$Q(UY()5 +MY(T)&O9%C6`-PM82$*T)UE!\=V(DY?CPU^=P6X_,_LJB1$82$#IA1[\#-2PA*^&:2FB' +MH#XYA23V!:Z=H(6H:SP5DJM_L8\595-D46-.TIEV[@YKOVEWM!0OD&9$9DF3 +M1"<9E[;,_,:@M1A<0SAE,H-@@8Y=HK5A%G&E;-I?F92).[6ZUE[J"V-_0"3) +MT*3$@X3::\>27P&(>T3F@(0)##C#C$7)EF(3X[*1+<0-P*";AVYV;%+6H:DP +ME&.'N"'MI#9B#<$4%)6.'+F!G(;$.S$4I;E%F3MB:O +MN;.0V(BSH4.B2QB-3!7$3*A9$!:`=VRJ_,%!3;5MMBK(C:T5C-J-,Q$BH$?B +M-+#=(\D^$&:#MFSQ7PR8I%WZ#ZB1&K2Z2"H,H""Q3IE+0WLNXQ@L8"0PXJ6U +M=AK`&(_@E'*!F\ +M$>.2XMR"AEG+46>+4"P.XUVB"06,*L+&.*J@X=. +M#%V7"YA56\\0DT9+@?Y)FOAN%M6SLARSK[U)]0R)S+'8E62Y&IUN7/\Q+#]F"%-?#.-M8.VY:R*;&H:4[.F9D +M9E+Z-6JZ:^@0/'0L-:EA%C6`,X6@58><;PJ9`E3>.W@JNNJ.B@RI(T$<[A=V +MD9S@ERKF_NE5N[F.<;[`]UMU/[*6FB*W$&A!CS0FPE@# +M"ZJ`F,.,1Z#D,^T%H&>IV +MTA6$M0Q^"PN8U@#.%GA(""Y3!< +M+._5UR@NTI%!>0PK.-A:2LWO\ZN?O+^O7NP66B[%ZB-4G\UQ*`)G,\44YIZL`9M70/(^QY!A6E> +MQ:C$AM0H2_((AKU9-'H23Z="0^`B:^&98$:B%I':"#[+(H<+96;M85"@NM2A +MC35UZ(E(AL75MB1N"8+.,AT9!=/F'FC82PAA642#^R19@P>X($*?V(LUNFD( +M/@TAD@+G&#F,.,1Q&L`9E!3*.;4[FM,0=@&/_A-J->T+&L`=>ME5N%&,#F@! +MFN80+V!:V;&/EF%BW-3)_:1D4<0-'T#\I@\]D67@]LA#8R"=:AL$`_]@8I-- +M+"&*TT*EM:L8A]J!JVOAER!_/UZXK"E34$%FU(Z*BKKE@@[8#(:B*DJPIJ&5 +M$6![%2E7@SC2L]IBJY1U:W(H#V?^"L8$D"B1,!%&#.4:]U\,M6858-H'-M!. +M"N.ZVT%K"C0`P_XC'EA#,K^5\699L;"&R#KOW+[":&7WC40M(X8<(HG(8;EM +M#!,MK\YJ;2HM"=P3%]"XA.-#&,T2)>%^IRYU71>_=`I,N"1L"`7/GW\>:^XH +M;?O5B7Q&S,!W&'&'&(NU.SBI;U#<;T/2STVO6K5`Q +M/W5S"MD87'440BZ"J*84BC:X@3&V87.V$`HH*!9GA +MD%*##W(5R7;S%?-EX3%[[2[!T)C:QE#O^E5G-XN[$YEGM6BQE&P@K_6?QPWI +MT$ZC:4Z7U7BCRUPMN\Y`^'`*[T]A4_>)7HJ>AL&1R/1!B&`U]B"\L# +MF%B8A<,;'\-C&#J_ADK\(BP5U$,A6FA,1E8<#\#9T\_+HH(1?A9VEYX=D+)8 +M'N'D,'!YD16@D,*#V]D1@HQ9SW$K\D)>54L']I3[%K5P:,;J"=<6D@F$9_)[ +M%KE8J!A!197R78Y@8M'#0H95/QI?7Q;=:\QO7CQ6=A-2VU]&K-8>!1YX+*2N(>)SB\SX"8%DM?KX6ZPXLKEG*91[RAFS +MKZ@S\Y<*P,T2XC`D\6VM:YT"D1$D$+5G.E[.[JSD +MAFS_5`$@2^PXLF#OX:MPPMFJ+P[C80D$6_69O+F2X,_C97++M5YEQ!]$D%%K +MR[*.MT$7^5!UO*Q4%DW.,PD-U@1=5B5,0@2$*4"2Y6TS$76.Y2(RH(,9U;"*S +M&<#+>7RE;E>ML')=[G(7U\07M$LN!AU&E?^TO[P9`@-^AQ2(P;K1C6T$B%,9 +M?S#EES$4/`=2^S*",H$],=<"!D;@.T9-MM!J8_M^(&&SS7K$!9K@+1]%+\ML +M"EZ%**W:`>GV$IF%LU,-QAE1$&OZ+,L<,CN6IY$:G>P(!;\N&P=EW@.=]KT< +M-<3=H`V-:@BZ"RC#+C9@84O*X@`ALJCA;I#YNZ9VKMT`JNA:UFZ0UWNE4F+O +MWL.\4N1#LX7_\"H%/M6&B8G,Q:,W-B>P2R0[<>>T3&-A5Q$6O)QD0$-@]Y_ +M;]CJR8O]@L$PJ#/PEKWRR\^*L=?Y.VO8W]@FE;7"^AB?RO= +M')T:FJ=&XF*BM$>M_1JJTJ>$Y_?3JJD?U>B#=*A509+^N]XFFDJ6E43)^N;9 +M?F-\YS7=*%H63#.ZHYQDOO]YM9)K"G#FZQ%3Z*6=>>$I:YZA4A_@_,='BJFJ +M$F!!>O&4*#*JXUDCS0U1/5O>9^]/;3B_E*_-@>&\S.-=N?MIM1>LK\4_%1'4E]RFYE_IYZW +M./!PL!!H^XE2U?$W,VLV!Q:+8[9/LX[J8U\O%T1;2YYZSY-'\_NSO&3VET[O69]'U +MV3?(,IJ;=?>*,JJ3JH[4,53ZQ49=5%TW;$J5'#E15YB#6:(-*9@.57U:=%\U +M_SBR:L+5@.5H-@$U*PQ.!($%A0;"R]U`0<.%%2!>6`L\(J`N`^E8'XK1/&(@ +M,ND@=%KUVP0W$_)TO9;?PB`,P7=;X+O@'8%%^$5`=2RJ@QK_ON"/Z]09W1`- +MY90KK)W,UF!E3-9L:\8O5E&!`/>`WQ)+%$N<)0]H/#"NQYQ!W](\2K9T'-^)>`/!#_D.+V2SI@9NBG,E*@'E +MQ*>\(Z`/_::SHAS^@?-&Q/D@1H2D/O"YMP;X(S6IMH) +M=B.I+T3NAOJ.F$_>)=J4B]D_6Y6TP_B'^TE_,&?2/MBG?DNX!WV(\>2BOGWM +MDL<4B>G,4I%(IM"'E#&1G$!GWE(>UOAN$4VDS:RW9S-:Z]N;"7$'.^&9LZ/!+QQ/%;^)+. +M$N-#GDQ],9FT%?#I*`O.BC"7:C_..+?>F#(`S7/FU#GY`'^4>]C],S75N\%* +M4EU)F;-3Z0LI+T%:H%"S--"WO +MX,MH!L9PO7"`:ZU>XK>:.*98DTUITRAM.K>R.&N8<&9K;4+V!_[ZMX0J;DS6 +M]I$4RAIBM1IASR%O*>$/Q-5]^MF<'<:?^6-KOT&Z73: +M;<-HBH?)3(T/P?A]R#O2T-M.-^"JS4WCG;EHGU]UM1FM[M,/,7J+J-7Q\/Z^ +M8(IJH?Z,>2S$/NMW+9 +MEB^N`Q'Q^KG(N]%/'U<7K7TIWN:;<9C +M_H8X>8V^,G+C"L>JZF*]^?U&#@`PT@LW +M-5"LS`65<5FX8@L\`6&&^+%8@=P]V=5)TRT+!9O0LVCO<[;;-,]JJ(&H<6=` +MV]T`:K0@WQ@"TYKF+GJ#1^Q-(X"O*)BME*A\/8M/SVGJ^%/2VX`:KF@;S@"T +M!KF+GF31^3-(R2O*;N6QM0,_8J)*HZK/--MN`&JTX-]:`M":YBYX4T?DS2-" +MKRE8NW2I_#:K2]VEQ\(W_P\7\BWP/5^L'^OCT27JO,O=_>[_?!_Z(2H]XWF[ +M/2N;N3GW@@6"!GOE9O`1+!E-Y*SY!R=6XT@G5M>K#Q;"XKUW^[QIAA2$97]J +MG]5/Z:>HIZ8]1GO.>I3U$>8CW;/,9ZAIV>G\=.TT_6#G8AYX![(/R@(;!Y\' +MEJ'WAH;>/K#2A\?6&P2X#S9L4>!XD!?@!SN`$NZ!.YJWS*UX5M2K;F.XAS;R +M5N`>T`0='/@\:B,B#GB%BZGY,=WX\HVW&X\MCD+TVSGX;V6D/5GJ;7^6+]G4 +MR$/OW+='OQ_;IZ*A[O)S5_YD!LJ/(9G:^>!C\[EH3X;WKM@U<:'T_3F([\+A +ML=7-%\3GN];9^//8_D/D]R'OC).%R-+!]?0]!]R?-WW5_:<\?[YE^[3CV_IB +M-+F]?'?1I>YO.QS]5X>7^F9I+KPNKYI+GI8;I1VL>N;-1G.2J.EUZ"9TW,PL +MWS7Z7_>_(#IQGG])_F^:CHYM32Q%-]?I7*DX-!\_J_6T<5-U;QY_C<[)&V>^=3:>?+=*!\'H +M]',Z/$\/,Z'(\*EK?>-\J/R]BB\N=BMIYM:I]"GA:>@Q7-U7)^SI^#">?G_; +MONMLW:0GOIX2C]OVQ2X?@ZI4_3>+=/'WM'X^U(\WD77PP/VZG8<6;BLQUJRG +MO8O@1\I]O$G[)2UN>57\.#3<[[ +MKO:+:D8O]F-U(>A>T$=-]5@*J@:H]<+`?!#*DS:%K%[01A56@`/J*W:+_ZDG +M54U`U;M!?Q<%E1L7XH?PVSQJ\5-;M#?!.(BE08+J_Z57I+?\86%YQD=C(LDR +M)H*"".HS:(15WC(Z!Z6QJ2S,>H-5;% +ME4P].1[<]OY.%L]]R>)OMION#R>#L^!P.757]!$SQQ4-_ON/_^=GEKV_BE-< +MQ8=LYE0TPWA]7E\^98_+0^1GV_^/6D*Z^1Z[NLKO>C%X^]7YCQ4Q*3G?X]T8 +M^IU.YY;S(K48[746@&JX4/[>T3JZ,;\9O#38V&0KC+A-ZF^WV;:%QSOREFPQ?X +MN1,SPM4Z&;$(0N4\Z3M"MQ5MYHEYC6[S:^2/>9-_HE"B-'IKZN#FXZ;HL#LZ +M*GGDT,T3UF7.J>LNPN"1:!\2T@=>BL#I@DT#]!(5[JW=8"BA%B`"''66L;Z$#Z:YJ>N;0[K=P6L +M6,NXR.I/T4:CCQH("Q^,)OT%!0KWL#D7A4M-3*P1E +MEQ=`E&/))\4CSU?NPZ;8-J/I?4'\Z<#IQP.GF16Q#HPNGM%V+@\+8CD!]"Z +M=8$YAA#C$74G*=C%MPMCQ>$L`5UJ6(OL?+U,9(<+_*<\;%7J/%B/4R>E:59I +MTRV+%QQD5">Q<,8"V4+FJRH9?02!)BN+#[(C-_1?.Q+O/.6&<%Z +M5H0QKLL%HI*I$1YZY#0"@/JD:0ZG8HS/8Q@:SU867(RK&E935YB8::8#*,;% +MA49FIR+&-Y2-%"FR>0G5666F!V;*5?8V>,P2N0\;8-2TU7K+XB&RJB(6B\57 +M;*4^(J*U_:[C>[/B;[D[[B3`6UO?;45M,,_Y2_.U]GVZ\__WW7SI/I7]G6W> +MLR%+9)^Q^K)>GR4M+#4;%Y?'O",<^Z?[ZVND>WP_OW%]VC'PNIT<9C\?DF/; +MOL&JU$QSWKR._X*N==E=E*-,Z30R5.GTU#W=G'H$\'LDT:CW88U$:)!&O,?& +MH$V-CJ2)FD':V?YO.CUM5WDZV-4*9JJ>2EAN.L9YJ_&]%+_"[-1Z].AFA?DT0HB!9* +MY2/7*U8:TPA:X!,,Z59>4I)^X8U._'ND:-'HDP]'U>)N4NW?-/&^*24>+B^- +M=8O'7Z<'=_(BG^IV5Q"A/&SH8U/`HX,]C]&1CPM<^/1(U,:E:T"BL82^8EX< +M>-_,UL%#C]U8ZG[4+Y]U0=U`C76]QGI?$F\A6.KU^9H)]K4KLXUT7MK;(JPA +M-WW[>EA\GZKA;-$GEK=K=;Z_HH--U>I +MDAJ3<]9T=O=&46'5/_J1O9QKA4,16G&([K#%/S#&C$Q7\)N-`(ZY[V)Z_^TX5#*_:?SPUEH^;:LA4=^F_JCT +M/;\C3XIP0VZ\X8GKY/7R/>S@OJ_8,C?9'G"%`1RLQXO5)_!]79H?[*)J^W^, +MAX8W+D_7ZWW>ZH+>Z0<07N>TJ\+4K=6`&?=_@LK#+00:PL]!YNWW_X&FQ7T, +ML/F'#*N^"#Z(S:R(N*B+WFX&$6&272'A0RP_(G+A\\_X>]K`A[KG+NN&63$0 +MN76^28VOQ="#;HZ7U)%1:QP_3WAL';81\OO6PMX#]+Q(%:N%29XT,!+#=(.( +M5CYR%AH/,5H$/G=M +M8F7K/%TZP+M716NW^<5UEV`U5>K9/!(\79@C``&_X.$YP7P.B"2>))YDGR20 +MR2*2C)*-DD$F\R-L^;9#MA>]^4)*UI6]+ +M<$J!*\53(O,BED9>1/R37)8X([HPC(Z2CY)+)2\DGE)^402KQ*ODJAE4LK+R +MN\E4U6=GCMG<-L*"/(0T'P(R7['((FU[)OV3ILKALD&R>-D\[)\V0T>8;'@) +M"?)/'2:*3A).,DXZ3UTG+R>\DYZ3GY.ADZ:3/RC?*7"4>)1YE'P/!(+IS((C +MEXR7/S#I,7"8FIB>F$\Q/S"B8%[Z<%_&3NE7^N@'MY2H4J)*C2QJ6/2U1-)4 +MR5.E4)5*4:0:Y!TD$$@\R"&012".0C9"/D$LA-2":03R"B04R`TBUR+I(H`E +MB&112*.1C9&/!!4U(II%/(J)%3(C`@TZ22`)@0EH)&EH.S4DFDD\DHDE,D-) +MM342:F3&E&N4=)1`$FD,HBE$E9^5H96FE3\LWRUPEGB6?);'2T +M)+1DM'2VNEI>6WDM/2T_+4,M32Q^7;Y>X2[Q+H9?'2Z*7A)<2)QLO'2\?+ZZ +:72R]434OO)=-+STN,1U\CTC_TL0]>P!`!P`` +` +end diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_invalid1.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_invalid1.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_invalid1.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_invalid1.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_invalid1.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_invalid1.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_invalid1.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_invalid1.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_noeof.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_noeof.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_noeof.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_noeof.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_ppmd_use_after_free.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_ppmd_use_after_free.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_ppmd_use_after_free.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_ppmd_use_after_free.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_ppmd_use_after_free2.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_ppmd_use_after_free2.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_ppmd_use_after_free2.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_ppmd_use_after_free2.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_sfx.exe.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_sfx.exe.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_sfx.exe.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_sfx.exe.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_subblock.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_subblock.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_subblock.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_subblock.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_unicode.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_unicode.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_unicode.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_unicode.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_windows.rar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_windows.rar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_rar_windows.rar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_rar_windows.rar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.bufr.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.bufr.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.bufr.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.bufr.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.data.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.data.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.data.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.data.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.data.gz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.data.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.data.gz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.data.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.data.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.data.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_raw.data.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_raw.data.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_concatenated.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_concatenated.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_concatenated.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_concatenated.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_concatenated.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_concatenated.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_concatenated.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_concatenated.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_filename.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_filename.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_filename.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_filename.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_filename.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_filename.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_filename.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_filename.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_pax.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_pax.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_pax.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_pax.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_empty_with_gnulabel.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_filename.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_filename.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_filename.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_filename.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_invalid_pax_size.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_invalid_pax_size.c new file mode 100644 index 0000000..0a03cb6 --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_invalid_pax_size.c @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2020 Ben Wagner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * The pax size attribute can be used to override the size. + * It should be validated the same way the normal size is validated. + * The test data is fuzzer output from + * https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=48467 . + */ +DEFINE_TEST(test_read_format_tar_invalid_pax_size) +{ + /* + * An archive that contains a PAX 'size' record with a large negative value. + */ + struct archive_entry *ae; + struct archive *a; + const char *refname = "test_read_format_tar_invalid_pax_size.tar"; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualInt(ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, refname, 10240)); + /* This assert will pass a normal debug build without the pax size check. */ + /* Run this test with `-fsanitize=undefined` to verify. */ + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_invalid_pax_size.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_invalid_pax_size.tar.uu new file mode 100644 index 0000000..71309ea --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_format_tar_invalid_pax_size.tar.uu @@ -0,0 +1,38 @@ +begin 644 test_read_format_tar_invalid_pax_size.tar.uu +M+B]087A(96%D97)S+C$T-#8S+V%A80`````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````#`P,#`V-#0`,#`P,#`P,``P,#`P,#`P`#`P,#`P,#`P,S$R +M`#$R-3,Q,30U,S``````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````!U='-A<@`P,``````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````S,"`@("`@(#T@("`@("`@("`@("`@("`@("`@ +M(`HS,"`@("`@(#T@("`@("`@("`@("`@("`@("`@(`HS,"`@("`@("`]("`@ +M("`@("`@("`@("`@("`@(`HS,"!S:7IE/2TQ.3I.97\6@M?/P$SA1R6+RFRUD<*@L-#!$.$A`-#!,!;_I.?CH\]WK(I'HJ +MC1"P;([X:RD\"4NZL[X9?H=*YI9Q^9SUG`U"%GS.%'JF0M<\[PV?3#MR">63 +MU+);7<0EM,_'U]+()+7>.MS@IFGS.GUF +M'S5\-@V=Y=MW6",,P^\(`,FALG&E(V`ZX;1&#G$;^?8[^=%R^:Q[GB1^JPZA +M-SI]3O>XY5O/>)70LG3/QWO;L^DZJQ/Q)"5'6^UGS\CUT,:'[<)XDMY"B%WV +MPK$('N2MJ]2M61L`\D@@2E$0?$HA-^YDM0T959VUCN4BS.J<-=[ +M6P)HFD)TO47V[FWT;?<:9=HN25KX&K(SA?9*P8'"=&]T1G?9G8^[AR>)P11R +MY'H86B0%XTKA&U$O;*N]M,>LJ)E`K77)I'N2E`(B(!!&C.+TY**V^BU(V9R8 +M!ZLXW)6;"!YPP'E,4_F\OB!T"4Z:6/#"Z823+@5V#BNHGHC-+4@`)>?""C,) +M2+G'/1,#D-1'B&&R288:'(KD,I>"_/85-]>-'@L``"L:```+````+!_^R$5-5D[3>O4AU,N^VP>S3+^79Y-P+W?;_&!3.]_D3K-7OY*9 +MR]UN$D)9?2_/*/9(FB13Q!*YTT"H42F^;(9P^_V^L)?+=AI^5S^^6_'%I]C. +M9Z)^65,*(B*9*!+I`,KD;LHM>DSQNK>@Y,P6C^]6?!12PCM-YG)LFS/\JU3JFDR`5XNOHZ0N^P8+&#R!1]OO +MVOBBS4MIQG>:9>T9Q:[)S%W4/VZGC-8[OR,X![]8K^OG=J7OBK4\VOC@YV9W +MFHWR5[_MCQ4?:Y^R7Y3899^7>IAUK^2;'[3VLMQI&JC1>GRGD9AHN)X7\Y;: +M^7ZOWM5WNA/:>0C?=J=I`+@#PY2O0,.QX&@L(&@\@0,*@`$E-!B.,QP-R!>< +M!,"=IK&FC!A*V5%BT;9MB\5"UGU]@=_7TNR+R88[31-545)1L>].?^1Z*L:? +MLOK"5SW*USHUZU514E^883K="9+:RYTFHYC6C\_OLCR*\G4F;]#*=Y#!]VJW +MEJ6P^EZ<)N[5?Y^;47@$2V0Z@!QU6F17TJ,I0O;UK)^Z6:84_%S$)!55+`'Q +M84Z/04]X!7I"PI,`>2!?`)UZ<<\[-?BTBO+P*787=[K31`@)!V\)`U,VM1,# +M;ELI":%NY97\:E`QW[3R^)R&'\@5#-#:Y4[S($`4&@>WW*T##RHV96P(0GL( +MO0'Z!:+0Z&RIBGU\3D-!Z6Q+PNF/)1T^Y9R4A[76YELJD8?):1J$!V.!8!$Y +M/.!@+*)H,1V<)^A17D)7Z.IX@5FW<)H(4PCTX(RZJ;5.=YI;4<+K,7U`CL?= +MK=TS[-9#J%-D6DSYB"4R+2*6R)OG8[C3-`E?`)TK%%O$ASD-:X_A2IYP +M!0.93:UU;H9M7_:M^+J7OYC7&N"DI5W?%+BLEY#!KH'Y2X'Y2Z6#/5,,>7VQ(C%-+[J49OQ!=/B$7K*[.!. +M\V2F,B^U\2WC^=T`(N(1;]+%MP`C+XOI!.'6[L+@&'%61I@BTUO&@T?#P="M +M#X$>=U&S($RF`G8GPY^#*SB-@@/R>#@D.,/0]%U,4KJ#&DP%@DN`306CS/TQQ3?05=,[X`:49NP+`&$@#>Z77!V +MZ^)VQ4Y_Y#11J=;KZD=R:\8GH#,NH9:5^C[J75Q^:P7<:1@^K:Z&NE<&QH@_ +MHJ#VHMYQX>/?:2+NN%B4\V'B7L(0F:8H%PM-Y'8^7G>GB=Q&K?JSXIO-E]AM +MQ\469MA[!CY`=_%Q$(RJ2AZ+4^LSKF#NM?V9D$!.DY#@N`(!/I&N0(`W/M>" +MBCUJW?7\G&;C@Q;PYD;"BQICRGXTR +M3K6T"S9?]>4)A@`4&I^`GD"A<4D%O6&_T%#3:B<*8<4']Z+PO*]Z3C[<,CT0 +MQU"OWT20_.F'/?@J(DA_EHH[MZH>PN221WHF7]#4SBFI.!$Q(>/8E426\BW5*!/N4UZ$\&3:17\LPP\G\B?6I0!EVV8I[6 +M`*4UB!OLE#"H9,P[LXK]5*A9.\][4:W8M]4MXEX;Q0!*Y;R69GSP*1]&K[UD +MJN<>*NAI@#YE)7OJ]LDD,'@FZM2FK*IGLXSECRP)H=OJ30UO@'[W +M_F0N+FKSGVP7\I^YF.4G(4Z91#P\3@A5)1=1'E257'A1?FY!^1TB!UPNYC$_ +M;&[V9Z&2WRBCSH6RV0*Q>%@X/!#/L_"B&(GM_`/A8J9B?QYM_<)FF?Y.IT@D +M8'F!P:@Q,5/(S(B(B$B2)!D.<02$&,6>IE2R*7%*T&;?1.FK+IYT!&_5B-5DP39XE!D% +MU4I&#GB2.ZRXY2=4I)"45?,9GE*1:>%CGS]Y$T?]!<.L!XW0S]DV[J]^RZUO +MU-$)H:Y^.=7_&D-=/U?:N2=I9478#((F??EK=-I1S/+>G(J&!8#8Z!:SN/"0W!8-Q[JFX +MM_*65-,=T<$H_5R>$A*!B@?!QDT)A2&MH8F637:F%R6%";@](C+4@\6'16DZ +MU_HU?%3PJE\R1U+@1W,+`-#RU%+^+.>.!"M\UT,*C&33WQRGB1G26U$9^L)A +M)I%").6%$Y@_%NBBIU(1:BFRY39*=(')Z1KA$&)]OJ(+#I`/%M!VE>6H1^\D +M,#X7\>\,NQ2.]95_3M#!#:N(IC^E6(GHYRO+<3#5PU)A=@0# +M%[=9[_H%";U],PMX`<<#,:#K?!05",0@;1R(1:[N>SE]`N+W-AW20?"87U?W +MK[3+[+`]MO)(%2XN0H\@:S$OM_]EM=8!3:[TE;@FRJNCP6'V]PP'1<*B?KO! +MU0BW]X&T&QIBOH<8K/(#;Z@8%W[DDI%8F[B.+3D$C,J"\(`6XIX"'LOA0+`7 +MB)&X$P@K>MMV>X/MQ8*7P8-UY,(L_Q?%H5JB#>I4V^NXD34"X,<3K.RIA,_` +M?(#'XE!-6,8R!_)8X4;0H%5C7*"G;B"^H.GQJA^21KE)P!?PA)KD#RQ&%K(I +MX\:E'!D\^5@D'RPX,&RVW'G!BHTTI-]S4 +MD8845O$($J+3Q-60RN",_F/"AL>>K)JT2M]0$E`:/I!9&4\N/KB'Y^@,IEH' +M24"9!VN@A)H:Q?\A`.0A848 +M(`]O]_OU)'H%IJ@(?-M*9'K)&RCLM@T%=-)*31^"9Z1TS:;@S5]#J4..*-FE +M,/B;48CTK8-ZC76,F34<-E(M:`YL4:7L>QH0(`<:3R#$LW-\-LR\E^AG; +MI)[_`WT'-5!+`P04````70"(.)%-,9OE>IH!``!4`P``!P```'1S+F-O;F8H +MM2_]`%B-#`#6G$T?4$W3!D_TVC/9!E7:MTFZHMQL#\'FCNWU"^^36;A/#48` +M00!&`.H\A"5RGEETHH(5QQ%1V?#T(&R.*[7D]R#N_$0E[^.<6>(Y2SZSOC[& +M-:,6X0J5Q0$*P+/1^N-MYBU7C&((R=%@NK,V;$'M>)X8I2EYSU^EO7):4J]6LF)7DU;\IOL>*,<7S5>#A4! +MW:L#`DX$ID628(-DP6F6,+#@0UNE-8G\PZSD?UZ3A'UL]2XVSW:@7X5C(LE=*@ +M!P0),F$$.4@0"6:1X42K292OO'F(,_2?/@ZHC*Z015*;CIS?-8,)D!W9=FT'5M;6,=/5CUA)1X +M;1VP`U!+`P04````70`],9%-JCN.NAL"``"0`P``!0```'9I;7)C*+4O_0!8 +ME1``)BAL(R!OVP;,O[!>_2;=8,G_;[\MQ(&0),2W`I@S1AQ.5@F0@D!A90!? +M`%X`D5WYN&K*O.'RM]&3E$R[/8?P[:^%R]/I1X^K7-Q;OFKX`7;=U@C#,/O"`#)H;)QI2-@.N&T1@YQ&_GV._G1YXD +M?JL.H3)+> +M0HA=]L*W-DU=-H/GA"![DK:O4K5D;`/)(($I1$'Q*(3?N9+4-&56=M8[E(LS +MJG#7>UL":)I"=+U%]NYM]&WW&F7:+DE:^!JR,X7V2L&!PG1O=$9WV9V/NX-*X1M1+VRKO;3'K*B90*UUR:1[DI0"(B`01HSB].2BMOHM +M2-FK.-R5FP@><,!Y3%/YO+X@=`E.FECPPNF$DRX%=@XKJ)Z(S2U(`"7G +MP@HS"4BYQST3`Y#41XAALDF&&AR*Y#*7@OSV%7.AC5\0]IEE%P502P$"/P,4 +M````70"1.)%-GC?7C1X+```K&@``"P``````````````I($`````IH!``!4`P``!P`````````````` +MI(%'"P``=',N8V]N9E!+`0(_`Q0```!=`#TQD4VJ.XZZ&P(``)`#```%```` +I``````````"D@08-``!V:6UR8U!+!08``````P`#`*$```!$#P`````` +` +end diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large.c index 6966ccb..8dbf48d 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large.c @@ -37,7 +37,6 @@ static unsigned char buff[11 * 1024 * 1024]; /* Check correct behavior on large reads. */ DEFINE_TEST(test_read_large) { - unsigned int i; int tmpfilefd; char tmpfilename[] = "test-read_large.XXXXXX"; size_t used; @@ -45,8 +44,7 @@ DEFINE_TEST(test_read_large) struct archive_entry *entry; FILE *f; - for (i = 0; i < sizeof(testdata); i++) - testdata[i] = (unsigned char)(rand()); + fill_with_pseudorandom_data(testdata, sizeof(testdata)); assert(NULL != (a = archive_write_new())); assertA(0 == archive_write_set_format_ustar(a)); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_aa.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_aa.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_aa.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_aa.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ab.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ab.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ab.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ab.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ac.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ac.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ac.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ac.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ad.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ad.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ad.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ad.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ae.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ae.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_large_splitted_rar_ae.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_large_splitted_rar_ae.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_truncated.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_truncated.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_truncated.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_truncated.c index 1f6e78a..6a0bb9b 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_truncated.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_truncated.c @@ -48,8 +48,8 @@ DEFINE_TEST(test_read_pax_truncated) assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "file"); archive_entry_set_mode(ae, S_IFREG | 0755); - for (i = 0; i < filedata_size; i++) - filedata[i] = (unsigned char)rand(); + fill_with_pseudorandom_data(filedata, filedata_size); + archive_entry_set_atime(ae, 1, 2); archive_entry_set_ctime(ae, 3, 4); archive_entry_set_mtime(ae, 5, 6); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_rht_security_selinux.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_schily.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_schily.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_schily.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_schily.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_schily.tar.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_schily.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_pax_xattr_schily.tar.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_pax_xattr_schily.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_position.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_position.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_position.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_position.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_set_format.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_set_format.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_set_format.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_set_format.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_aa.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_aa.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_aa.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_aa.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_ab.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_ab.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_ab.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_ab.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_ac.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_ac.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_ac.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_ac.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_ad.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_ad.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_splitted_rar_ad.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_splitted_rar_ad.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_too_many_filters.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_too_many_filters.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_too_many_filters.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_too_many_filters.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_too_many_filters.gz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_too_many_filters.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_too_many_filters.gz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_too_many_filters.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_truncated.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_truncated.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_truncated.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_truncated.c index 3991ab2..1e760d7 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_truncated.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_truncated.c @@ -47,8 +47,7 @@ DEFINE_TEST(test_read_truncated) assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "file"); archive_entry_set_mode(ae, S_IFREG | 0755); - for (i = 0; i < sizeof(buff2); i++) - buff2[i] = (unsigned char)rand(); + fill_with_pseudorandom_data(buff2, sizeof(buff2)); archive_entry_set_size(ae, sizeof(buff2)); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_truncated_filter.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_truncated_filter.c similarity index 89% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_read_truncated_filter.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_read_truncated_filter.c index 632638d..f85ccaa 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_read_truncated_filter.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_read_truncated_filter.c @@ -41,7 +41,7 @@ test_truncation(const char *compression, char path[16]; char *buff, *data; size_t buffsize, datasize, used1; - int i, j, r, use_prog; + int i, r, use_prog; buffsize = 2000000; assert(NULL != (buff = (char *)malloc(buffsize))); @@ -81,7 +81,7 @@ test_truncation(const char *compression, archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "%s%d", compression, i); + snprintf(path, sizeof(path), "%s%d", compression, i); archive_entry_copy_pathname(ae, path); failure("%s", path); if (!assertEqualIntA(a, ARCHIVE_OK, @@ -91,9 +91,7 @@ test_truncation(const char *compression, free(buff); return; } - for (j = 0; j < (int)datasize; ++j) { - data[j] = (char)(rand() % 256); - } + fill_with_pseudorandom_data(data, datasize); failure("%s", path); if (!assertEqualIntA(a, datasize, archive_write_data(a, data, datasize))) { @@ -111,8 +109,13 @@ test_truncation(const char *compression, assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); - assertEqualIntA(a, ARCHIVE_OK, - archive_read_open_memory(a, buff, used1 - used1/64)); + r = archive_read_open_memory(a, buff, used1 - used1/64); + if (r != ARCHIVE_OK) { + assertEqualStringA(a, "truncated bzip2 input", + archive_error_string(a)); + goto out; + } + for (i = 0; i < 100; i++) { if (ARCHIVE_OK != archive_read_next_header(a, &ae)) { failure("Should have non-NULL error message for %s", @@ -120,7 +123,7 @@ test_truncation(const char *compression, assert(NULL != archive_error_string(a)); break; } - sprintf(path, "%s%d", compression, i); + snprintf(path, sizeof(path), "%s%d", compression, i); assertEqualString(path, archive_entry_pathname(ae)); if (datasize != (size_t)archive_read_data(a, data, datasize)) { failure("Should have non-NULL error message for %s", @@ -133,6 +136,7 @@ test_truncation(const char *compression, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +out: free(data); free(buff); } @@ -154,12 +158,12 @@ DEFINE_TEST(test_read_truncated_filter_gzip) DEFINE_TEST(test_read_truncated_filter_lzip) { - test_truncation("lzip", archive_write_add_filter_lzip, 0); + test_truncation("lzip", archive_write_add_filter_lzip, canLzip()); } DEFINE_TEST(test_read_truncated_filter_lzma) { - test_truncation("lzma", archive_write_add_filter_lzma, 0); + test_truncation("lzma", archive_write_add_filter_lzma, canLzma()); } DEFINE_TEST(test_read_truncated_filter_lzop) @@ -169,5 +173,5 @@ DEFINE_TEST(test_read_truncated_filter_lzop) DEFINE_TEST(test_read_truncated_filter_xz) { - test_truncation("xz", archive_write_add_filter_xz, 0); + test_truncation("xz", archive_write_add_filter_xz, canXz()); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_short_writes.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_short_writes.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_short_writes.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_short_writes.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_sparse_basic.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_sparse_basic.c similarity index 94% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_sparse_basic.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_sparse_basic.c index 43e87df..484c286 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_sparse_basic.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_sparse_basic.c @@ -253,8 +253,10 @@ is_sparse_supported(const char *path) #if defined(HAVE_LINUX_FIEMAP_H) if (r < 0) return (is_sparse_supported_fiemap(path)); -#endif + return (1); +#else return (r >= 0); +#endif } #elif !defined(HAVE_LINUX_FIEMAP_H) @@ -364,9 +366,10 @@ verify_sparse_file(struct archive *a, const char *path, #if DEBUG fprintf(stderr, " overlapping hole expected_offset=%d, size=%d\n", (int)expected_offset, (int)sparse->size); #endif - /* Must be a hole, overlap must be filled with '\0' */ - if (assert(sparse->type == HOLE)) { + if (sparse->type == HOLE) { assertMemoryFilledWith(start, end - start, '\0'); + } else if (assert(sparse->type == DATA)) { + assertMemoryFilledWith(start, end - start, ' '); } start = end; expected_offset += sparse->size; @@ -410,9 +413,10 @@ verify_sparse_file(struct archive *a, const char *path, #if DEBUG fprintf(stderr, " trailing overlap expected_offset=%d, size=%d\n", (int)expected_offset, (int)sparse->size); #endif - /* Must be a hole, overlap must be filled with '\0' */ - if (assert(sparse->type == HOLE)) { + if (sparse->type == HOLE) { assertMemoryFilledWith(start, end - start, '\0'); + } else if (assert(sparse->type == DATA)) { + assertMemoryFilledWith(start, end - start, ' '); } } last_offset = offset + bytes_read; @@ -614,6 +618,33 @@ DEFINE_TEST(test_sparse_basic) verify_sparse_file2(a, "file0", sparse_file0, 5, 0); verify_sparse_file2(a, "file0", sparse_file0, 5, 1); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* + * Test that setting ARCHIVE_READDISK_NO_SPARSE + * creates no sparse entries. + */ + assert((a = archive_read_disk_new()) != NULL); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_set_behavior(a, + ARCHIVE_READDISK_NO_SPARSE)); + + verify_sparse_file(a, "file0", sparse_file0, 0); + verify_sparse_file(a, "file1", sparse_file1, 0); + verify_sparse_file(a, "file2", sparse_file2, 0); + verify_sparse_file(a, "file3", sparse_file3, 0); + verify_sparse_file(a, "file4", sparse_file4, 0); + + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + assert((a = archive_read_disk_new()) != NULL); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_set_behavior(a, + ARCHIVE_READDISK_NO_SPARSE)); + + verify_sparse_file2(a, "file0", sparse_file0, 0, 0); + verify_sparse_file2(a, "file0", sparse_file0, 0, 1); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); free(cwd); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_splitted_rar_seek_support_aa.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_splitted_rar_seek_support_aa.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_splitted_rar_seek_support_aa.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_splitted_rar_seek_support_aa.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_splitted_rar_seek_support_ab.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_splitted_rar_seek_support_ab.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_splitted_rar_seek_support_ab.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_splitted_rar_seek_support_ab.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_splitted_rar_seek_support_ac.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_splitted_rar_seek_support_ac.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_splitted_rar_seek_support_ac.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_splitted_rar_seek_support_ac.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_tar_filenames.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_tar_filenames.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_tar_filenames.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_tar_filenames.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_tar_large.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_tar_large.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_tar_large.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_tar_large.c index 626f9f0..0da58aa 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_tar_large.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_tar_large.c @@ -224,7 +224,7 @@ DEFINE_TEST(test_tar_large) */ for (i = 0; tests[i] != 0; i++) { assert((ae = archive_entry_new()) != NULL); - sprintf(namebuff, "file_%d", i); + snprintf(namebuff, sizeof(namebuff), "file_%d", i); archive_entry_copy_pathname(ae, namebuff); archive_entry_set_mode(ae, S_IFREG | 0755); filesize = tests[i]; @@ -271,7 +271,7 @@ DEFINE_TEST(test_tar_large) */ for (i = 0; tests[i] > 0; i++) { assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); - sprintf(namebuff, "file_%d", i); + snprintf(namebuff, sizeof(namebuff), "file_%d", i); assertEqualString(namebuff, archive_entry_pathname(ae)); assert(tests[i] == archive_entry_size(ae)); } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_ustar_filename_encoding.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_ustar_filename_encoding.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_ustar_filename_encoding.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_ustar_filename_encoding.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_ustar_filenames.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_ustar_filenames.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_ustar_filenames.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_ustar_filenames.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_warn_missing_hardlink_target.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_warn_missing_hardlink_target.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_warn_missing_hardlink_target.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_warn_missing_hardlink_target.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_appledouble.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_appledouble.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_appledouble.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_appledouble.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_appledouble.cpio.gz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_appledouble.cpio.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_appledouble.cpio.gz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_appledouble.cpio.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_failures.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_failures.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_failures.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_failures.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_fixup.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_fixup.c similarity index 66% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_fixup.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_fixup.c index c399c98..b83b730 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_fixup.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_fixup.c @@ -47,26 +47,50 @@ DEFINE_TEST(test_write_disk_fixup) /* * Create a file */ - assertMakeFile("victim", 0600, "a"); + assertMakeFile("file", 0600, "a"); + + /* + * Create a directory + */ + assertMakeDir("dir", 0700); /* * Create a directory and a symlink with the same name */ - /* Directory: dir */ + /* Directory: dir1 */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); - archive_entry_set_mode(ae, AE_IFDIR | 0606); + archive_entry_copy_pathname(ae, "dir1/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); archive_entry_free(ae); - /* Symbolic Link: dir -> foo */ + /* Directory: dir2 */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir2/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Symbolic Link: dir1 -> dir */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); + archive_entry_copy_pathname(ae, "dir1"); archive_entry_set_mode(ae, AE_IFLNK | 0777); archive_entry_set_size(ae, 0); - archive_entry_copy_symlink(ae, "victim"); + archive_entry_copy_symlink(ae, "dir"); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Symbolic Link: dir2 -> file */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir2"); + archive_entry_set_mode(ae, AE_IFLNK | 0777); + archive_entry_set_size(ae, 0); + archive_entry_copy_symlink(ae, "file"); assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); if (r >= ARCHIVE_WARN) assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); @@ -75,7 +99,9 @@ DEFINE_TEST(test_write_disk_fixup) assertEqualInt(ARCHIVE_OK, archive_write_free(ad)); /* Test the entries on disk. */ - assertIsSymlink("dir", "victim", 0); - assertFileMode("victim", 0600); + assertIsSymlink("dir1", "dir", 0); + assertIsSymlink("dir2", "file", 0); + assertFileMode("dir", 0700); + assertFileMode("file", 0600); #endif } diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_hardlink.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_hardlink.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_hardlink.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_hardlink.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_hfs_compression.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_hfs_compression.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_hfs_compression.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_hfs_compression.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_hfs_compression.tgz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_hfs_compression.tgz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_hfs_compression.tgz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_hfs_compression.tgz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_lookup.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_lookup.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_lookup.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_lookup.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_mac_metadata.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_mac_metadata.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_mac_metadata.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_mac_metadata.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_mac_metadata.tar.gz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_mac_metadata.tar.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_mac_metadata.tar.gz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_mac_metadata.tar.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_no_hfs_compression.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_no_hfs_compression.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_no_hfs_compression.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_no_hfs_compression.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_no_hfs_compression.tgz.uu b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_no_hfs_compression.tgz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_no_hfs_compression.tgz.uu rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_no_hfs_compression.tgz.uu diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_perms.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_perms.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_perms.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_perms.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure744.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure744.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure744.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure744.c index 08c725e..9b12d4c 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure744.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure744.c @@ -75,7 +75,7 @@ DEFINE_TEST(test_write_disk_secure744) archive_entry_free(ae); *p++ = '/'; - sprintf(p, "target%d", n); + snprintf(p, buff_size - (p - buff), "target%d", n); /* Try to create a file through the symlink, should fail. */ assert((ae = archive_entry_new()) != NULL); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure745.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure745.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure745.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure745.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure746.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure746.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure746.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure746.c index 5ce1fd9..99cb882 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_secure746.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_secure746.c @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); */ DEFINE_TEST(test_write_disk_secure746a) { -#if defined(_WIN32) && !defined(__CYGWIN__) - skipping("archive_write_disk security checks not supported on Windows"); -#else struct archive *a; struct archive_entry *ae; @@ -75,7 +72,6 @@ DEFINE_TEST(test_write_disk_secure746a) assertEqualIntA(a, ARCHIVE_FATAL, archive_write_close(a)); archive_write_free(a); -#endif } /* diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_sparse.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_sparse.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_sparse.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_sparse.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_symlink.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_symlink.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_symlink.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_symlink.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_times.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_times.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_disk_times.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_disk_times.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_b64encode.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_b64encode.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_b64encode.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_b64encode.c index 665087b..5b917e9 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_b64encode.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_b64encode.c @@ -64,7 +64,7 @@ DEFINE_TEST(test_write_filter_b64encode) assert((ae = archive_entry_new()) != NULL); archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -79,7 +79,7 @@ DEFINE_TEST(test_write_filter_b64encode) assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 99; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualIntA(a, 0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); @@ -111,7 +111,7 @@ DEFINE_TEST(test_write_filter_b64encode) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 99; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -128,7 +128,7 @@ DEFINE_TEST(test_write_filter_b64encode) assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 99; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_bzip2.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_bzip2.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_bzip2.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_bzip2.c index 4f32d28..9e089c0 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_bzip2.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_bzip2.c @@ -83,7 +83,7 @@ DEFINE_TEST(test_write_filter_bzip2) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 999; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -99,7 +99,7 @@ DEFINE_TEST(test_write_filter_bzip2) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 999; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); @@ -133,7 +133,7 @@ DEFINE_TEST(test_write_filter_bzip2) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 999; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -160,7 +160,7 @@ DEFINE_TEST(test_write_filter_bzip2) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 999; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); @@ -187,7 +187,7 @@ DEFINE_TEST(test_write_filter_bzip2) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 999; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -212,7 +212,7 @@ DEFINE_TEST(test_write_filter_bzip2) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 999; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_compress.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_compress.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_compress.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_compress.c index 1b8910e..5cc0fc8 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_compress.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_compress.c @@ -59,7 +59,7 @@ DEFINE_TEST(test_write_filter_compress) archive_write_open_memory(a, buff, buffsize, &used)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -83,7 +83,7 @@ DEFINE_TEST(test_write_filter_compress) for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_gzip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_gzip.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_gzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_gzip.c index 935fb51..2b76162 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_gzip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_gzip.c @@ -85,7 +85,7 @@ DEFINE_TEST(test_write_filter_gzip) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -113,7 +113,7 @@ DEFINE_TEST(test_write_filter_gzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -148,7 +148,7 @@ DEFINE_TEST(test_write_filter_gzip) archive_write_set_options(a, "gzip:compression-level=9")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -187,7 +187,7 @@ DEFINE_TEST(test_write_filter_gzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -212,7 +212,7 @@ DEFINE_TEST(test_write_filter_gzip) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -249,7 +249,7 @@ DEFINE_TEST(test_write_filter_gzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_gzip_timestamp.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_gzip_timestamp.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_gzip_timestamp.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_gzip_timestamp.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lrzip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lrzip.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lrzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lrzip.c index f28c835..2efc2ec 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lrzip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lrzip.c @@ -68,7 +68,7 @@ DEFINE_TEST(test_write_filter_lrzip) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -84,7 +84,7 @@ DEFINE_TEST(test_write_filter_lrzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lz4.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lz4.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lz4.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lz4.c index 4f2135a..071fee4 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lz4.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lz4.c @@ -84,7 +84,7 @@ DEFINE_TEST(test_write_filter_lz4) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -107,7 +107,7 @@ DEFINE_TEST(test_write_filter_lz4) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -142,7 +142,7 @@ DEFINE_TEST(test_write_filter_lz4) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -170,7 +170,7 @@ DEFINE_TEST(test_write_filter_lz4) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -195,7 +195,7 @@ DEFINE_TEST(test_write_filter_lz4) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -225,7 +225,7 @@ DEFINE_TEST(test_write_filter_lz4) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -330,7 +330,7 @@ test_options(const char *options) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -350,7 +350,7 @@ test_options(const char *options) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzip.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzip.c index 145a308..ce70a5d 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzip.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzip.c @@ -81,7 +81,7 @@ DEFINE_TEST(test_write_filter_lzip) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -103,7 +103,7 @@ DEFINE_TEST(test_write_filter_lzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -133,7 +133,7 @@ DEFINE_TEST(test_write_filter_lzip) archive_write_set_filter_option(a, NULL, "compression-level", "9")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -157,7 +157,7 @@ DEFINE_TEST(test_write_filter_lzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); failure("Trying to read %s", path); if (!assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -181,7 +181,7 @@ DEFINE_TEST(test_write_filter_lzip) archive_write_set_filter_option(a, NULL, "compression-level", "0")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -210,7 +210,7 @@ DEFINE_TEST(test_write_filter_lzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzma.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzma.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzma.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzma.c index 68e4898..d055333 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzma.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzma.c @@ -80,7 +80,7 @@ DEFINE_TEST(test_write_filter_lzma) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -102,7 +102,7 @@ DEFINE_TEST(test_write_filter_lzma) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -132,7 +132,7 @@ DEFINE_TEST(test_write_filter_lzma) archive_write_set_filter_option(a, NULL, "compression-level", "9")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -156,7 +156,7 @@ DEFINE_TEST(test_write_filter_lzma) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); failure("Trying to read %s", path); if (!assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -180,7 +180,7 @@ DEFINE_TEST(test_write_filter_lzma) archive_write_set_filter_option(a, NULL, "compression-level", "0")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -214,7 +214,7 @@ DEFINE_TEST(test_write_filter_lzma) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzop.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzop.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzop.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzop.c index 92db7bf..18fc332 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_lzop.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_lzop.c @@ -79,7 +79,7 @@ DEFINE_TEST(test_write_filter_lzop) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -99,7 +99,7 @@ DEFINE_TEST(test_write_filter_lzop) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -135,7 +135,7 @@ DEFINE_TEST(test_write_filter_lzop) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -163,7 +163,7 @@ DEFINE_TEST(test_write_filter_lzop) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -188,7 +188,7 @@ DEFINE_TEST(test_write_filter_lzop) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -218,7 +218,7 @@ DEFINE_TEST(test_write_filter_lzop) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < filecount; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_program.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_program.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_program.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_program.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_uuencode.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_uuencode.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_uuencode.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_uuencode.c index 57a4b49..2ce5b89 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_uuencode.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_uuencode.c @@ -64,7 +64,7 @@ DEFINE_TEST(test_write_filter_uuencode) assert((ae = archive_entry_new()) != NULL); archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -79,7 +79,7 @@ DEFINE_TEST(test_write_filter_uuencode) assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 99; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualIntA(a, 0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); @@ -111,7 +111,7 @@ DEFINE_TEST(test_write_filter_uuencode) assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 99; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -128,7 +128,7 @@ DEFINE_TEST(test_write_filter_uuencode) assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 99; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(0, archive_read_next_header(a, &ae))) break; assertEqualString(path, archive_entry_pathname(ae)); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_xz.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_xz.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_xz.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_xz.c index bf1265c..e2f1ec8 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_xz.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_xz.c @@ -80,7 +80,7 @@ DEFINE_TEST(test_write_filter_xz) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -102,7 +102,7 @@ DEFINE_TEST(test_write_filter_xz) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -132,7 +132,7 @@ DEFINE_TEST(test_write_filter_xz) archive_write_set_filter_option(a, NULL, "compression-level", "9")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -163,7 +163,7 @@ DEFINE_TEST(test_write_filter_xz) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); failure("Trying to read %s", path); if (!assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -187,7 +187,7 @@ DEFINE_TEST(test_write_filter_xz) archive_write_set_filter_option(a, NULL, "compression-level", "0")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -220,7 +220,7 @@ DEFINE_TEST(test_write_filter_xz) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_zstd.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_zstd.c similarity index 95% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_zstd.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_zstd.c index b5f061a..263cea5 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_filter_zstd.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_filter_zstd.c @@ -74,7 +74,7 @@ DEFINE_TEST(test_write_filter_zstd) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize @@ -96,7 +96,7 @@ DEFINE_TEST(test_write_filter_zstd) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) break; @@ -129,9 +129,13 @@ DEFINE_TEST(test_write_filter_zstd) archive_write_set_filter_option(a, NULL, "compression-level", "-1")); */ assertEqualIntA(a, ARCHIVE_OK, archive_write_set_filter_option(a, NULL, "compression-level", "7")); + assertEqualIntA(a, ARCHIVE_FAILED, + archive_write_set_filter_option(a, NULL, "threads", "-1")); /* negative */ + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_filter_option(a, NULL, "threads", "4")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); archive_entry_set_size(ae, datasize); @@ -154,7 +158,7 @@ DEFINE_TEST(test_write_filter_zstd) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); failure("Trying to read %s", path); if (!assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -181,7 +185,7 @@ DEFINE_TEST(test_write_filter_zstd) archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); assertA(datasize == (size_t)archive_write_data(a, data, datasize)); @@ -201,7 +205,7 @@ DEFINE_TEST(test_write_filter_zstd) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used3)); for (i = 0; i < 100; i++) { - sprintf(path, "file%03d", i); + snprintf(path, sizeof(path), "file%03d", i); failure("Trying to read %s", path); if (!assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae))) diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_7zip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_7zip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_7zip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_7zip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_7zip_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_7zip_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_7zip_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_7zip_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_7zip_large.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_7zip_large.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_7zip_large.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_7zip_large.c index 5c49f59..b7a90d1 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_7zip_large.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_7zip_large.c @@ -27,7 +27,7 @@ #include "test.h" __FBSDID("$FreeBSD$"); -#define LARGE_SIZE (16*1024*1024) +#define LARGE_SIZE (1*1024*1024) static void test_large(const char *compression_type) { @@ -37,7 +37,6 @@ test_large(const char *compression_type) size_t buffsize = LARGE_SIZE + 1024 * 256; size_t datasize = LARGE_SIZE; char *buff, *filedata, *filedata2; - unsigned i; assert((buff = malloc(buffsize)) != NULL); assert((filedata = malloc(datasize)) != NULL); @@ -87,8 +86,7 @@ test_large(const char *compression_type) /* NOTE: PPMd cannot handle random data correctly.*/ memset(filedata, 'a', datasize); } else { - for (i = 0; i < datasize; i++) - filedata[i] = (char)rand(); + fill_with_pseudorandom_data(filedata, datasize); } assertEqualInt(datasize, archive_write_data(a, filedata, datasize)); diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_ar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_ar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_ar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_ar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio_newc.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio_newc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio_newc.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio_newc.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio_odc.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio_odc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_cpio_odc.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_cpio_odc.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_gnutar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_gnutar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_gnutar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_gnutar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_gnutar_filenames.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_gnutar_filenames.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_gnutar_filenames.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_gnutar_filenames.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_boot.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_boot.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_boot.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_boot.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_filename.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_filename.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_filename.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_filename.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_zisofs.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_zisofs.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_iso9660_zisofs.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_iso9660_zisofs.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_absolute_path.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_absolute_path.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_absolute_path.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_absolute_path.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_classic.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_classic.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_classic.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_classic.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_classic_indent.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_classic_indent.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_classic_indent.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_classic_indent.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_fflags.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_fflags.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_fflags.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_fflags.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_no_separator.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_no_separator.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_no_separator.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_no_separator.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_quoted_filename.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_quoted_filename.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_mtree_quoted_filename.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_mtree_quoted_filename.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_pax.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_pax.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_pax.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_pax.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_raw.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_raw.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_raw.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_raw.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_raw_b64.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_raw_b64.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_raw_b64.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_raw_b64.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_shar_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_shar_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_shar_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_shar_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_sparse.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_sparse.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_sparse.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_sparse.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_ustar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_ustar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_ustar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_ustar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_v7tar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_v7tar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_tar_v7tar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_tar_v7tar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_warc.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_warc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_warc.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_warc.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_warc_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_warc_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_warc_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_warc_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_xar.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_xar.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_xar.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_xar.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_xar_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_xar_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_xar_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_xar_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_compression_store.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_compression_store.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_compression_store.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_compression_store.c index c969a41..ed09087 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_compression_store.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_compression_store.c @@ -128,12 +128,31 @@ static void verify_uncompressed_contents(const char *buff, size_t used) /* Misc variables */ unsigned long crc; - struct tm *tm = localtime(&now); - + struct tm *tm; +#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S) + struct tm tmbuf; +#endif +#if defined(HAVE__LOCALTIME64_S) + errno_t terr; + __time64_t tmptime; +#endif /* p is the pointer to walk over the central directory, * q walks over the local headers, the data and the data descriptors. */ const char *p, *q, *local_header, *extra_start; +#if defined(HAVE_LOCALTIME_R) + tm = localtime_r(&now, &tmbuf); +#elif defined(HAVE__LOCALTIME64_S) + tmptime = now; + terr = _localtime64_s(&tmbuf, &tmptime); + if (terr) + tm = NULL; + else + tm = &tmbuf; +#else + tm = localtime(&now); +#endif + /* Remember the end of the archive in memory. */ buffend = buff + used; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_empty.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_empty.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_empty.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_empty.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_empty_zip64.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_empty_zip64.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_empty_zip64.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_empty_zip64.c diff --git a/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_entry_size_unset.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_entry_size_unset.c new file mode 100644 index 0000000..13b5f1b --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_entry_size_unset.c @@ -0,0 +1,321 @@ +/*- + * Copyright (c) 2021 Jia Cheong Tan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* File data */ +static const char file_name[] = "file"; +static const char file_data1[] = {'a', 'b', 'c', 'd', 'e'}; +static const char file_data2[] = {'f', 'g', 'h', 'i', 'j'}; +static const int file_perm = 00644; +static const short file_uid = 10; +static const short file_gid = 20; + +/* Folder data */ +static const char folder_name[] = "folder/"; +static const int folder_perm = 00755; +static const short folder_uid = 30; +static const short folder_gid = 40; + +#define ZIP_ENTRY_FLAG_LENGTH_AT_END (1 << 3) + +/* Quick and dirty: Read 2-byte and 4-byte integers from Zip file. */ +static unsigned i2(const char *p) { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } +static unsigned i4(const char *p) { return (i2(p) | (i2(p + 2) << 16)); } + +static unsigned long +bitcrc32(unsigned long c, const void *_p, size_t s) +{ + /* This is a drop-in replacement for crc32() from zlib. + * Libarchive should be able to correctly generate + * uncompressed zip archives (including correct CRCs) even + * when zlib is unavailable, and this function helps us verify + * that. Yes, this is very, very slow and unsuitable for + * production use, but it's correct, compact, and works well + * enough for this particular usage. Libarchive internally + * uses a much more efficient implementation. */ + const unsigned char *p = _p; + int bitctr; + + if (p == NULL) + return (0); + + for (; s > 0; --s) + { + c ^= *p++; + for (bitctr = 8; bitctr > 0; --bitctr) + { + if (c & 1) + c = (c >> 1); + else + c = (c >> 1) ^ 0xedb88320; + c ^= 0x80000000; + } + } + return (c); +} + +static void write_archive(struct archive *a) +{ + struct archive_entry *entry = archive_entry_new(); + assert(entry != NULL); + + /* Does not set size for file entry */ + archive_entry_set_pathname(entry, file_name); + archive_entry_set_mode(entry, S_IFREG | 0644); + archive_entry_set_uid(entry, file_uid); + archive_entry_set_gid(entry, file_gid); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, entry)); + assertEqualIntA(a, sizeof(file_data1), archive_write_data(a, file_data1, sizeof(file_data1))); + assertEqualIntA(a, sizeof(file_data2), archive_write_data(a, file_data2, sizeof(file_data2))); + archive_entry_free(entry); + + /* Folder */ + assert((entry = archive_entry_new()) != NULL); + archive_entry_set_pathname(entry, folder_name); + archive_entry_set_mode(entry, S_IFDIR | folder_perm); + archive_entry_set_size(entry, 0); + archive_entry_set_uid(entry, folder_uid); + archive_entry_set_gid(entry, folder_gid); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, entry)); + archive_entry_free(entry); +} + +static void verify_contents(const char *zip_buff, size_t size) +{ + unsigned long crc = bitcrc32(0, file_data1, sizeof(file_data1)); + crc = bitcrc32(crc, file_data2, sizeof(file_data2)); + + const char *zip_end = zip_buff + size; + /* Since there are no comments, the end of central directory + * is 22 bytes from the end of content */ + const char *end_of_central_dir = zip_end - 22; + /* Check for end of central directory signature */ + assertEqualMem(end_of_central_dir, "PK\x5\x6", 4); + /* Check for number of disk */ + assertEqualInt(i2(end_of_central_dir + 4), 0); + /* Check for disk where central directory starts */ + assertEqualInt(i2(end_of_central_dir + 6), 0); + /* Check for number of central directory records on disk */ + assertEqualInt(i2(end_of_central_dir + 8), 2); + /* Check for total number of central directory records */ + assertEqualInt(i2(end_of_central_dir + 10), 2); + /* Check for size of central directory and offset + * The size + offset must equal the end of the central directory */ + assertEqualInt(i4(end_of_central_dir + 12) + i4(end_of_central_dir + 16), end_of_central_dir - zip_buff); + /* Check for empty comment length */ + assertEqualInt(i2(end_of_central_dir + 20), 0); + + /* Get address of central directory */ + const char *central_directory = zip_buff + i4(end_of_central_dir + 16); + + /* Check for entry in central directory signature */ + assertEqualMem(central_directory, "PK\x1\x2", 4); + /* Check for version used to write entry */ + assertEqualInt(i2(central_directory + 4), 3 * 256 + 10); + /* Check for version needed to extract entry */ + assertEqualInt(i2(central_directory + 6), 10); + /* Check flags */ + assertEqualInt(i2(central_directory + 8), ZIP_ENTRY_FLAG_LENGTH_AT_END); + /* Check compression method */ + assertEqualInt(i2(central_directory + 10), 0); + /* Check crc value */ + assertEqualInt(i4(central_directory + 16), crc); + /* Check compressed size*/ + assertEqualInt(i4(central_directory + 20), sizeof(file_data1) + sizeof(file_data2)); + /* Check uncompressed size */ + assertEqualInt(i4(central_directory + 24), sizeof(file_data1) + sizeof(file_data2)); + /* Check file name length */ + assertEqualInt(i2(central_directory + 28), strlen(file_name)); + /* Check extra field length */ + assertEqualInt(i2(central_directory + 30), 20); + /* Check file comment length */ + assertEqualInt(i2(central_directory + 32), 0); + /* Check disk number where file starts */ + assertEqualInt(i2(central_directory + 34), 0); + /* Check internal file attrs */ + assertEqualInt(i2(central_directory + 36), 0); + /* Check external file attrs */ + assertEqualInt(i4(central_directory + 38) >> 16 & 01777, file_perm); + /* Check offset of local header */ + assertEqualInt(i4(central_directory + 42), 0); + /* Check for file name contents */ + assertEqualMem(central_directory + 46, file_name, strlen(file_name)); + + /* Get address of local file entry */ + const char *local_file_header = zip_buff; + + /* Check local file header signature */ + assertEqualMem(local_file_header, "PK\x3\x4", 4); + /* Check version needed to extract */ + assertEqualInt(i2(local_file_header + 4), 10); + /* Check flags */ + assertEqualInt(i2(local_file_header + 6), 8); + /* Check compression method */ + assertEqualInt(i2(local_file_header + 8), 0); + /* Check crc */ + assertEqualInt(i4(local_file_header + 14), 0); + /* Check compressed size + * 0 because it was unknown at time of writing */ + assertEqualInt(i4(local_file_header + 18), 0); + /* Check uncompressed size + * 0 because it was unknown at time of writing */ + assertEqualInt(i4(local_file_header + 22), 0); + /* Check pathname length */ + assertEqualInt(i2(local_file_header + 26), strlen(file_name)); + /* Check extra field length */ + assertEqualInt(i2(local_file_header + 28), 20); + /* Check path name match */ + assertEqualMem(local_file_header + 30, file_name, strlen(file_name)); + + /* Start of data */ + const char *data = local_file_header + i2(local_file_header + 28) + strlen(file_name) + 30; + /* Check for file data match */ + assertEqualMem(data, file_data1, sizeof(file_data1)); + assertEqualMem(data + sizeof(file_data1), file_data2, sizeof(file_data2)); + + /* Start of data descriptor */ + const char *data_descriptor = data + sizeof(file_data1) + sizeof(file_data2); + /* Check data descriptor signature */ + assertEqualMem(data_descriptor, "PK\x7\x8", 4); + /* Check crc value */ + assertEqualInt(i4(data_descriptor + 4), crc); + /* Check compressed size */ + assertEqualInt(i4(data_descriptor + 8), sizeof(file_data1) + sizeof(file_data2)); + /* Chcek uncompresed size */ + assertEqualInt(i4(data_descriptor + 12), sizeof(file_data1) + sizeof(file_data2)); + + /* Get folder entry in central directory */ + const char *central_directory_folder_entry = central_directory + 46 + 20 + strlen(file_name); + + /* Get start of folder entry */ + const char *local_folder_header = data_descriptor + 16; + + /* Check for entry in central directory signature */ + assertEqualMem(central_directory_folder_entry, "PK\x1\x2", 4); + /* Check version made by */ + assertEqualInt(i2(central_directory_folder_entry + 4), 3 * 256 + 20); + /* Check version needed to extract */ + assertEqualInt(i2(central_directory_folder_entry + 6), 20); + /* Check flags */ + assertEqualInt(i2(central_directory_folder_entry + 8), 0); + /* Check compression method */ + assertEqualInt(i2(central_directory_folder_entry + 10), 0); + /* Check crc */ + assertEqualInt(i2(central_directory_folder_entry + 16), 0); + /* Check compressed size */ + assertEqualInt(i4(central_directory_folder_entry + 20), 0); + /* Check uncompressed size */ + assertEqualInt(i4(central_directory_folder_entry + 24), 0); + /* Check path name length */ + assertEqualInt(i2(central_directory_folder_entry + 28), strlen(folder_name)); + /* Check extra field length */ + assertEqualInt(i2(central_directory_folder_entry + 30), 20); + /* Check file comment length */ + assertEqualInt(i2(central_directory_folder_entry + 32), 0); + /* Check disk number start */ + assertEqualInt(i2(central_directory_folder_entry + 34), 0); + /* Check internal file attrs */ + assertEqualInt(i2(central_directory_folder_entry + 36), 0); + /* Check external file attrs */ + assertEqualInt(i4(central_directory_folder_entry + 38) >> 16 & 01777, folder_perm); + /* Check offset of local header*/ + assertEqualInt(i4(central_directory_folder_entry + 42), local_folder_header - zip_buff); + /* Check path name */ + assertEqualMem(central_directory_folder_entry + 46, folder_name, strlen(folder_name)); + + /* Check local header */ + assertEqualMem(local_folder_header, "PK\x3\x4", 4); + /* Check version to extract */ + assertEqualInt(i2(local_folder_header + 4), 20); + /* Check flags */ + assertEqualInt(i2(local_folder_header + 6), 0); + /* Check compression method */ + assertEqualInt(i2(local_folder_header + 8), 0); + /* Check crc */ + assertEqualInt(i4(local_folder_header + 14), 0); + /* Check compressed size */ + assertEqualInt(i2(local_folder_header + 18), 0); + /* Check uncompressed size */ + assertEqualInt(i4(local_folder_header + 22), 0); + /* Check path name length */ + assertEqualInt(i2(local_folder_header + 26), strlen(folder_name)); + /* Check extra field length */ + assertEqualInt(i2(local_folder_header + 28), 20); + /* Check path name */ + assertEqualMem(local_folder_header + 30, folder_name, strlen(folder_name)); + + const char *post_local_folder = local_folder_header + 30 + strlen(folder_name) + 20; + assertEqualMem(post_local_folder, central_directory, 4); +} + +DEFINE_TEST(test_write_format_zip_size_unset) +{ + struct archive *a; + char zip_buffer[100000]; + size_t size; + + /* Use compression=store to disable compression. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:compression=store")); + /* Disable zip64 explicitly since it is automatically enabled if no size is set */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:zip64=")); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_in_last_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, zip_buffer, sizeof(zip_buffer), &size)); + + write_archive(a); + + /* Close the archive . */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + dumpfile("constructed_size_unset.zip", zip_buffer, size); + + verify_contents(zip_buffer, size); + + /* Use compression-level=0 to disable compression. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:compression-level=0")); + /* Disable zip64 explicitly since it is automatically enabled if no size is set */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:zip64=")); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_in_last_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, zip_buffer, sizeof(zip_buffer), &size)); + + write_archive(a); + + /* Close the archive . */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + dumpfile("constructed_size_unset.zip", zip_buffer, size); + + verify_contents(zip_buffer, size); +} diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_file.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_file.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_file.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_file.c index 2868123..7796a48 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_file.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_file.c @@ -73,7 +73,14 @@ DEFINE_TEST(test_write_format_zip_file) struct archive *a; struct archive_entry *ae; time_t t = 1234567890; - struct tm *tm = localtime(&t); + struct tm *tm; +#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S) + struct tm tmbuf; +#endif +#if defined(HAVE__LOCALTIME64_S) + errno_t terr; + __time64_t tmptime; +#endif size_t used, buffsize = 1000000; unsigned long crc; int file_perm = 00644; @@ -91,6 +98,18 @@ DEFINE_TEST(test_write_format_zip_file) zip_compression = 0; #endif +#if defined(HAVE_LOCALTIME_R) + tm = localtime_r(&t, &tmbuf); +#elif defined(HAVE__LOCALTIME64_S) + tmptime = t; + terr = _localtime64_s(&tmbuf, &tmptime); + if (terr) + tm = NULL; + else + tm = &tmbuf; +#else + tm = localtime(&t); +#endif buff = malloc(buffsize); /* Create a new archive in memory. */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_file_zip64.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_file_zip64.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_file_zip64.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_file_zip64.c index 71da986..c4161bc 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_file_zip64.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_file_zip64.c @@ -75,7 +75,14 @@ DEFINE_TEST(test_write_format_zip_file_zip64) struct archive *a; struct archive_entry *ae; time_t t = 1234567890; - struct tm *tm = localtime(&t); + struct tm *tm; +#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S) + struct tm tmbuf; +#endif +#if defined(HAVE__LOCALTIME64_S) + errno_t terr; + __time64_t tmptime; +#endif size_t used, buffsize = 1000000; unsigned long crc; int file_perm = 00644; @@ -92,6 +99,18 @@ DEFINE_TEST(test_write_format_zip_file_zip64) zip_compression = 0; #endif +#if defined(HAVE_LOCALTIME_R) + tm = localtime_r(&t, &tmbuf); +#elif defined(HAVE__LOCALTIME64_S) + tmptime = t; + terr = _localtime64_s(&tmbuf, &tmptime); + if (terr) + tm = NULL; + else + tm = &tmbuf; +#else + tm = localtime(&t); +#endif buff = malloc(buffsize); /* Create a new archive in memory. */ diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_large.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_large.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_large.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_large.c index 2f98c6d..e3594c9 100644 --- a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_large.c +++ b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_large.c @@ -309,7 +309,7 @@ verify_large_zip(struct archive *a, struct fileblocks *fileblocks) for (i = 0; test_sizes[i] > 0; i++) { assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); - sprintf(namebuff, "file_%d", i); + snprintf(namebuff, sizeof(namebuff), "file_%d", i); assertEqualString(namebuff, archive_entry_pathname(ae)); assertEqualInt(test_sizes[i], archive_entry_size(ae)); } @@ -359,7 +359,7 @@ DEFINE_TEST(test_write_format_zip_large) */ for (i = 0; test_sizes[i] != 0; i++) { assert((ae = archive_entry_new()) != NULL); - sprintf(namebuff, "file_%d", i); + snprintf(namebuff, sizeof(namebuff), "file_%d", i); archive_entry_copy_pathname(ae, namebuff); archive_entry_set_mode(ae, S_IFREG | 0755); filesize = test_sizes[i]; diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_zip64.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_zip64.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_format_zip_zip64.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_format_zip_zip64.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_open_memory.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_open_memory.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_open_memory.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_open_memory.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_write_read_format_zip.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_write_read_format_zip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_write_read_format_zip.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_write_read_format_zip.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_xattr_platform.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_xattr_platform.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_xattr_platform.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_xattr_platform.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/test/test_zip_filename_encoding.c b/src/dependencies/libarchive-3.6.2/libarchive/test/test_zip_filename_encoding.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/test/test_zip_filename_encoding.c rename to src/dependencies/libarchive-3.6.2/libarchive/test/test_zip_filename_encoding.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive/xxhash.c b/src/dependencies/libarchive-3.6.2/libarchive/xxhash.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive/xxhash.c rename to src/dependencies/libarchive-3.6.2/libarchive/xxhash.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive_fe/err.c b/src/dependencies/libarchive-3.6.2/libarchive_fe/err.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive_fe/err.c rename to src/dependencies/libarchive-3.6.2/libarchive_fe/err.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive_fe/err.h b/src/dependencies/libarchive-3.6.2/libarchive_fe/err.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive_fe/err.h rename to src/dependencies/libarchive-3.6.2/libarchive_fe/err.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive_fe/lafe_platform.h b/src/dependencies/libarchive-3.6.2/libarchive_fe/lafe_platform.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive_fe/lafe_platform.h rename to src/dependencies/libarchive-3.6.2/libarchive_fe/lafe_platform.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive_fe/line_reader.c b/src/dependencies/libarchive-3.6.2/libarchive_fe/line_reader.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive_fe/line_reader.c rename to src/dependencies/libarchive-3.6.2/libarchive_fe/line_reader.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive_fe/line_reader.h b/src/dependencies/libarchive-3.6.2/libarchive_fe/line_reader.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive_fe/line_reader.h rename to src/dependencies/libarchive-3.6.2/libarchive_fe/line_reader.h diff --git a/src/dependencies/libarchive-3.5.2/libarchive_fe/passphrase.c b/src/dependencies/libarchive-3.6.2/libarchive_fe/passphrase.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive_fe/passphrase.c rename to src/dependencies/libarchive-3.6.2/libarchive_fe/passphrase.c diff --git a/src/dependencies/libarchive-3.5.2/libarchive_fe/passphrase.h b/src/dependencies/libarchive-3.6.2/libarchive_fe/passphrase.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/libarchive_fe/passphrase.h rename to src/dependencies/libarchive-3.6.2/libarchive_fe/passphrase.h diff --git a/src/dependencies/libarchive-3.5.2/tar/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/tar/CMakeLists.txt similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/tar/CMakeLists.txt diff --git a/src/dependencies/libarchive-3.5.2/tar/bsdtar.1 b/src/dependencies/libarchive-3.6.2/tar/bsdtar.1 similarity index 98% rename from src/dependencies/libarchive-3.5.2/tar/bsdtar.1 rename to src/dependencies/libarchive-3.6.2/tar/bsdtar.1 index 86a06bb..b57835a 100644 --- a/src/dependencies/libarchive-3.5.2/tar/bsdtar.1 +++ b/src/dependencies/libarchive-3.6.2/tar/bsdtar.1 @@ -470,6 +470,11 @@ This is the reverse of and the default behavior if .Nm is run as non-root in x mode. +.It Fl Fl no-read-sparse +(c, r, u modes only) +Do not read sparse file information from disk. +This is the reverse of +.Fl Fl read-sparse . .It Fl Fl no-safe-writes (x mode only) Do not create temporary files and use @@ -633,10 +638,20 @@ a compression dictionary to improve compression ratio. .It Cm zstd:compression-level A decimal integer specifying the zstd compression level. Supported values depend on the library version, common values are from 1 to 22. +.It Cm zstd:threads +Specify the number of worker threads to use. +Setting threads to a special value 0 makes +.Xr zstd 1 +use as many threads as there are CPU cores on the system. .It Cm lzop:compression-level A decimal integer from 1 to 9 specifying the lzop compression level. .It Cm xz:compression-level A decimal integer from 0 to 9 specifying the xz compression level. +.It Cm xz:threads +Specify the number of worker threads to use. +Setting threads to a special value 0 makes +.Xr xz 1 +use as many threads as there are CPU cores on the system. .It Cm mtree: Ns Ar keyword The mtree writer module allows you to specify which mtree keywords will be included in the output. @@ -730,6 +745,12 @@ By default, the archive is always read to the very end, since there can be multiple entries with the same name and, by convention, later entries overwrite earlier entries. This option is provided as a performance optimization. +.It Fl Fl read-sparse +(c, r, u modes only) +Read sparse file information from disk. +This is the reverse of +.Fl Fl no-read-sparse +and the default behavior. .It Fl S (x mode only) Extract files as sparse files. @@ -932,7 +953,7 @@ archives. .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : -.Bl -tag -width ".Ev BLOCKSIZE" +.Bl -tag -width indent .It Ev TAR_READER_OPTIONS The default options for format readers and compression readers. The diff --git a/src/dependencies/libarchive-3.5.2/tar/bsdtar.c b/src/dependencies/libarchive-3.6.2/tar/bsdtar.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/tar/bsdtar.c rename to src/dependencies/libarchive-3.6.2/tar/bsdtar.c index af41be5..75249d1 100644 --- a/src/dependencies/libarchive-3.5.2/tar/bsdtar.c +++ b/src/dependencies/libarchive-3.6.2/tar/bsdtar.c @@ -70,24 +70,20 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.93 2008/11/08 04:43:24 kientzle #include "bsdtar.h" #include "err.h" -/* - * Per POSIX.1-1988, tar defaults to reading/writing archives to/from - * the default tape device for the system. Pick something reasonable here. - */ -#ifdef __linux -#define _PATH_DEFTAPE "/dev/st0" +#if ARCHIVE_VERSION_NUMBER < 4000000 && !defined(_PATH_DEFTAPE) +// Libarchive 4.0 and later will NOT define _PATH_DEFTAPE +// but will honor it if it's set in the build. +// Until then, we'll continue to set it by default on certain platforms: +#if defined(__linux) +#define _PATH_DEFTAPE "/dev/st0" +#elif defined(_WIN32) && !defined(__CYGWIN__) +#define _PATH_DEFTAPE "\\\\.\\tape0" +#elif !defined(__APPLE__) +#define _PATH_DEFTAPE "/dev/tape" #endif -#if defined(_WIN32) && !defined(__CYGWIN__) -#define _PATH_DEFTAPE "\\\\.\\tape0" -#endif -#if defined(__APPLE__) -#undef _PATH_DEFTAPE -#define _PATH_DEFTAPE "-" /* Mac OS has no tape support, default to stdio. */ #endif -#ifndef _PATH_DEFTAPE -#define _PATH_DEFTAPE "/dev/tape" -#endif +#define _PATH_STDIO "-" #ifdef __MINGW32__ int _CRT_glob = 0; /* Disable broken CRT globbing. */ @@ -217,8 +213,21 @@ main(int argc, char **argv) /* Default: open tape drive. */ bsdtar->filename = getenv("TAPE"); - if (bsdtar->filename == NULL) - bsdtar->filename = _PATH_DEFTAPE; +#if defined(_PATH_DEFTAPE) + if (bsdtar->filename == NULL) { +#if defined(_WIN32) && !defined(__CYGWIN__) + int tapeExists = !_access(_PATH_DEFTAPE, 0); +#else + int tapeExists = !access(_PATH_DEFTAPE, F_OK); +#endif + if (tapeExists) { + bsdtar->filename = _PATH_DEFTAPE; + } + } +#endif + if (bsdtar->filename == NULL) { + bsdtar->filename = _PATH_STDIO; + } /* Default block size settings. */ bsdtar->bytes_per_block = DEFAULT_BYTES_PER_BLOCK; @@ -542,6 +551,10 @@ main(int argc, char **argv) bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_MAC_METADATA; bsdtar->flags |= OPTFLAG_NO_MAC_METADATA; break; + case OPTION_NO_READ_SPARSE: + bsdtar->readdisk_flags |= ARCHIVE_READDISK_NO_SPARSE; + bsdtar->flags |= OPTFLAG_NO_READ_SPARSE; + break; case OPTION_NO_SAFE_WRITES: bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_SAFE_WRITES; break; @@ -649,6 +662,10 @@ main(int argc, char **argv) case 'r': /* SUSv2 */ set_mode(bsdtar, opt); break; + case OPTION_READ_SPARSE: + bsdtar->readdisk_flags &= ~ARCHIVE_READDISK_NO_SPARSE; + bsdtar->flags |= OPTFLAG_READ_SPARSE; + break; case 'S': /* NetBSD pax-as-tar */ bsdtar->extract_flags |= ARCHIVE_EXTRACT_SPARSE; break; @@ -796,8 +813,14 @@ main(int argc, char **argv) "Must specify one of -c, -r, -t, -u, -x"); /* Check boolean options only permitted in certain modes. */ - if (bsdtar->flags & OPTFLAG_AUTO_COMPRESS) - only_mode(bsdtar, "-a", "c"); + if (bsdtar->flags & OPTFLAG_AUTO_COMPRESS) { + only_mode(bsdtar, "-a", "cx"); + if (bsdtar->mode == 'x') { + bsdtar->flags &= ~OPTFLAG_AUTO_COMPRESS; + lafe_warnc(0, + "Ignoring option -a in mode -x"); + } + } if (bsdtar->readdisk_flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) only_mode(bsdtar, "--one-file-system", "cru"); if (bsdtar->flags & OPTFLAG_FAST_READ) diff --git a/src/dependencies/libarchive-3.5.2/tar/bsdtar.h b/src/dependencies/libarchive-3.6.2/tar/bsdtar.h similarity index 97% rename from src/dependencies/libarchive-3.5.2/tar/bsdtar.h rename to src/dependencies/libarchive-3.6.2/tar/bsdtar.h index 89aa3aa..8f9f79a 100644 --- a/src/dependencies/libarchive-3.5.2/tar/bsdtar.h +++ b/src/dependencies/libarchive-3.6.2/tar/bsdtar.h @@ -129,6 +129,8 @@ struct bsdtar { #define OPTFLAG_FFLAGS (0x00100000) /* --fflags */ #define OPTFLAG_NO_MAC_METADATA (0x00200000) /* --no-mac-metadata */ #define OPTFLAG_MAC_METADATA (0x00400000) /* --mac-metadata */ +#define OPTFLAG_NO_READ_SPARSE (0x00800000) /* --no-read-sparse */ +#define OPTFLAG_READ_SPARSE (0x01000000) /* --read-sparse */ /* Fake short equivalents for long options that otherwise lack them. */ enum { @@ -164,6 +166,7 @@ enum { OPTION_NO_ACLS, OPTION_NO_FFLAGS, OPTION_NO_MAC_METADATA, + OPTION_NO_READ_SPARSE, OPTION_NO_SAFE_WRITES, OPTION_NO_SAME_OWNER, OPTION_NO_SAME_PERMISSIONS, @@ -178,6 +181,7 @@ enum { OPTION_OPTIONS, OPTION_PASSPHRASE, OPTION_POSIX, + OPTION_READ_SPARSE, OPTION_SAFE_WRITES, OPTION_SAME_OWNER, OPTION_STRIP_COMPONENTS, diff --git a/src/dependencies/libarchive-3.5.2/tar/bsdtar_platform.h b/src/dependencies/libarchive-3.6.2/tar/bsdtar_platform.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/bsdtar_platform.h rename to src/dependencies/libarchive-3.6.2/tar/bsdtar_platform.h diff --git a/src/dependencies/libarchive-3.5.2/tar/bsdtar_windows.c b/src/dependencies/libarchive-3.6.2/tar/bsdtar_windows.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/bsdtar_windows.c rename to src/dependencies/libarchive-3.6.2/tar/bsdtar_windows.c diff --git a/src/dependencies/libarchive-3.5.2/tar/bsdtar_windows.h b/src/dependencies/libarchive-3.6.2/tar/bsdtar_windows.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/bsdtar_windows.h rename to src/dependencies/libarchive-3.6.2/tar/bsdtar_windows.h diff --git a/src/dependencies/libarchive-3.5.2/tar/cmdline.c b/src/dependencies/libarchive-3.6.2/tar/cmdline.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/tar/cmdline.c rename to src/dependencies/libarchive-3.6.2/tar/cmdline.c index b80937f..d49e5b0 100644 --- a/src/dependencies/libarchive-3.5.2/tar/cmdline.c +++ b/src/dependencies/libarchive-3.6.2/tar/cmdline.c @@ -122,6 +122,7 @@ static const struct bsdtar_option { { "no-acls", 0, OPTION_NO_ACLS }, { "no-fflags", 0, OPTION_NO_FFLAGS }, { "no-mac-metadata", 0, OPTION_NO_MAC_METADATA }, + { "no-read-sparse", 0, OPTION_NO_READ_SPARSE }, { "no-recursion", 0, 'n' }, { "no-safe-writes", 0, OPTION_NO_SAFE_WRITES }, { "no-same-owner", 0, OPTION_NO_SAME_OWNER }, @@ -145,6 +146,7 @@ static const struct bsdtar_option { { "posix", 0, OPTION_POSIX }, { "preserve-permissions", 0, 'p' }, { "read-full-blocks", 0, 'B' }, + { "read-sparse", 0, OPTION_READ_SPARSE }, { "safe-writes", 0, OPTION_SAFE_WRITES }, { "same-owner", 0, OPTION_SAME_OWNER }, { "same-permissions", 0, 'p' }, diff --git a/src/dependencies/libarchive-3.5.2/tar/config_freebsd.h b/src/dependencies/libarchive-3.6.2/tar/config_freebsd.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/config_freebsd.h rename to src/dependencies/libarchive-3.6.2/tar/config_freebsd.h diff --git a/src/dependencies/libarchive-3.5.2/tar/creation_set.c b/src/dependencies/libarchive-3.6.2/tar/creation_set.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/tar/creation_set.c rename to src/dependencies/libarchive-3.6.2/tar/creation_set.c index bdc607d..cfc5a64 100644 --- a/src/dependencies/libarchive-3.5.2/tar/creation_set.c +++ b/src/dependencies/libarchive-3.6.2/tar/creation_set.c @@ -95,7 +95,7 @@ get_format_code(const char *suffix) { ".7z", "7zip" }, { ".ar", "arbsd" }, { ".cpio", "cpio" }, - { ".iso", "iso9960" }, + { ".iso", "iso9660" }, { ".mtree", "mtree" }, { ".shar", "shar" }, { ".tar", "paxr" }, diff --git a/src/dependencies/libarchive-3.5.2/tar/read.c b/src/dependencies/libarchive-3.6.2/tar/read.c similarity index 98% rename from src/dependencies/libarchive-3.5.2/tar/read.c rename to src/dependencies/libarchive-3.6.2/tar/read.c index 658c810..b959966 100644 --- a/src/dependencies/libarchive-3.5.2/tar/read.c +++ b/src/dependencies/libarchive-3.6.2/tar/read.c @@ -371,10 +371,9 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) r = archive_read_extract2(a, entry, writer); if (r != ARCHIVE_OK) { if (!bsdtar->verbose) - safe_fprintf(stderr, "%s", - archive_entry_pathname(entry)); - safe_fprintf(stderr, ": %s", - archive_error_string(a)); + safe_fprintf(stderr, "%s", archive_entry_pathname(entry)); + fprintf(stderr, ": %s: ", archive_error_string(a)); + fprintf(stderr, "%s", strerror(errno)); if (!bsdtar->verbose) fprintf(stderr, "\n"); bsdtar->return_value = 1; diff --git a/src/dependencies/libarchive-3.5.2/tar/subst.c b/src/dependencies/libarchive-3.6.2/tar/subst.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/tar/subst.c rename to src/dependencies/libarchive-3.6.2/tar/subst.c index 39c54ac..55ad63d 100644 --- a/src/dependencies/libarchive-3.5.2/tar/subst.c +++ b/src/dependencies/libarchive-3.6.2/tar/subst.c @@ -320,6 +320,7 @@ cleanup_substitution(struct bsdtar *bsdtar) while ((rule = subst->first_rule) != NULL) { subst->first_rule = rule->next; free(rule->result); + regfree(&rule->re); free(rule); } free(subst); diff --git a/src/dependencies/libarchive-3.5.2/tar/test/CMakeLists.txt b/src/dependencies/libarchive-3.6.2/tar/test/CMakeLists.txt similarity index 99% rename from src/dependencies/libarchive-3.5.2/tar/test/CMakeLists.txt rename to src/dependencies/libarchive-3.6.2/tar/test/CMakeLists.txt index 2cd573a..3b66753 100644 --- a/src/dependencies/libarchive-3.5.2/tar/test/CMakeLists.txt +++ b/src/dependencies/libarchive-3.6.2/tar/test/CMakeLists.txt @@ -44,6 +44,7 @@ IF(ENABLE_TAR AND ENABLE_TEST) test_option_fflags.c test_option_gid_gname.c test_option_grzip.c + test_option_ignore_zeros.c test_option_j.c test_option_k.c test_option_keep_newer_files.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/list.h b/src/dependencies/libarchive-3.6.2/tar/test/list.h similarity index 89% rename from src/dependencies/libarchive-3.5.2/tar/test/list.h rename to src/dependencies/libarchive-3.6.2/tar/test/list.h index 379b8a3..0b7c020 100644 --- a/src/dependencies/libarchive-3.5.2/tar/test/list.h +++ b/src/dependencies/libarchive-3.6.2/tar/test/list.h @@ -2,38 +2,47 @@ DEFINE_TEST(test_0) DEFINE_TEST(test_basic) DEFINE_TEST(test_copy) DEFINE_TEST(test_empty_mtree) +DEFINE_TEST(test_extract_tar_Z) DEFINE_TEST(test_extract_tar_bz2) DEFINE_TEST(test_extract_tar_grz) DEFINE_TEST(test_extract_tar_gz) DEFINE_TEST(test_extract_tar_lrz) -DEFINE_TEST(test_extract_tar_lz4) DEFINE_TEST(test_extract_tar_lz) +DEFINE_TEST(test_extract_tar_lz4) DEFINE_TEST(test_extract_tar_lzma) DEFINE_TEST(test_extract_tar_lzo) DEFINE_TEST(test_extract_tar_xz) -DEFINE_TEST(test_extract_tar_Z) DEFINE_TEST(test_extract_tar_zstd) DEFINE_TEST(test_format_newc) DEFINE_TEST(test_help) DEFINE_TEST(test_leading_slash) DEFINE_TEST(test_missing_file) -DEFINE_TEST(test_option_a) -DEFINE_TEST(test_option_acls) -DEFINE_TEST(test_option_b64encode) -DEFINE_TEST(test_option_b) DEFINE_TEST(test_option_C_mtree) DEFINE_TEST(test_option_C_upper) +DEFINE_TEST(test_option_H_upper) +DEFINE_TEST(test_option_L_upper) +DEFINE_TEST(test_option_O_upper) +DEFINE_TEST(test_option_T_upper) +DEFINE_TEST(test_option_U_upper) +DEFINE_TEST(test_option_X_upper) +DEFINE_TEST(test_option_a) +DEFINE_TEST(test_option_acls) +DEFINE_TEST(test_option_b) +DEFINE_TEST(test_option_b64encode) DEFINE_TEST(test_option_exclude) DEFINE_TEST(test_option_exclude_vcs) DEFINE_TEST(test_option_fflags) DEFINE_TEST(test_option_gid_gname) DEFINE_TEST(test_option_grzip) -DEFINE_TEST(test_option_H_upper) +DEFINE_TEST(test_option_ignore_zeros_mode_t) +DEFINE_TEST(test_option_ignore_zeros_mode_x) +DEFINE_TEST(test_option_ignore_zeros_mode_c) +DEFINE_TEST(test_option_ignore_zeros_mode_r) +DEFINE_TEST(test_option_ignore_zeros_mode_u) DEFINE_TEST(test_option_j) DEFINE_TEST(test_option_k) DEFINE_TEST(test_option_keep_newer_files) DEFINE_TEST(test_option_lrzip) -DEFINE_TEST(test_option_L_upper) DEFINE_TEST(test_option_lz4) DEFINE_TEST(test_option_lzma) DEFINE_TEST(test_option_lzop) @@ -41,18 +50,14 @@ DEFINE_TEST(test_option_n) DEFINE_TEST(test_option_newer_than) DEFINE_TEST(test_option_nodump) DEFINE_TEST(test_option_older_than) -DEFINE_TEST(test_option_O_upper) DEFINE_TEST(test_option_passphrase) DEFINE_TEST(test_option_q) DEFINE_TEST(test_option_r) -DEFINE_TEST(test_option_safe_writes) DEFINE_TEST(test_option_s) -DEFINE_TEST(test_option_T_upper) +DEFINE_TEST(test_option_safe_writes) DEFINE_TEST(test_option_uid_uname) DEFINE_TEST(test_option_uuencode) -DEFINE_TEST(test_option_U_upper) DEFINE_TEST(test_option_xattrs) -DEFINE_TEST(test_option_X_upper) DEFINE_TEST(test_option_xz) DEFINE_TEST(test_option_z) DEFINE_TEST(test_option_zstd) diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test.h b/src/dependencies/libarchive-3.6.2/tar/test/test.h similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test.h rename to src/dependencies/libarchive-3.6.2/tar/test/test.h diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_0.c b/src/dependencies/libarchive-3.6.2/tar/test/test_0.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_0.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_0.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_basic.c b/src/dependencies/libarchive-3.6.2/tar/test/test_basic.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_basic.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_basic.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_copy.c b/src/dependencies/libarchive-3.6.2/tar/test/test_copy.c similarity index 94% rename from src/dependencies/libarchive-3.5.2/tar/test/test_copy.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_copy.c index d618e45..b8175c3 100644 --- a/src/dependencies/libarchive-3.5.2/tar/test/test_copy.c +++ b/src/dependencies/libarchive-3.6.2/tar/test/test_copy.c @@ -160,21 +160,21 @@ create_tree(void) failure("Internal sanity check failed: i = %d", i); assert(filenames[i] != NULL); - sprintf(buff, "f/%s", filenames[i]); + snprintf(buff, sizeof(buff), "f/%s", filenames[i]); assertMakeFile(buff, 0777, buff); /* Create a link named "l/abcdef..." to the above. */ - sprintf(buff2, "l/%s", filenames[i]); + snprintf(buff2, sizeof(buff2), "l/%s", filenames[i]); assertMakeHardlink(buff2, buff); /* Create a link named "m/abcdef..." to the above. */ - sprintf(buff2, "m/%s", filenames[i]); + snprintf(buff2, sizeof(buff2), "m/%s", filenames[i]); assertMakeHardlink(buff2, buff); if (canSymlink()) { /* Create a symlink named "s/abcdef..." to the above. */ - sprintf(buff, "s/%s", filenames[i]); - sprintf(buff2, "../f/%s", filenames[i]); + snprintf(buff, sizeof(buff), "s/%s", filenames[i]); + snprintf(buff2, sizeof(buff2), "../f/%s", filenames[i]); failure("buff=\"%s\" buff2=\"%s\"", buff, buff2); assertMakeSymlink(buff, buff2, 0); } @@ -202,13 +202,13 @@ verify_tree(size_t limit) /* Generate the names we know should be there and verify them. */ for (i = 1; i < LOOP_MAX; i++) { /* Verify a file named "f/abcdef..." */ - sprintf(name1, "f/%s", filenames[i]); + snprintf(name1, sizeof(name1), "f/%s", filenames[i]); if (i <= limit) { assertFileExists(name1); assertFileContents(name1, (int)strlen(name1), name1); } - sprintf(name2, "l/%s", filenames[i]); + snprintf(name2, sizeof(name2), "l/%s", filenames[i]); if (i + 2 <= limit) { /* Verify hardlink "l/abcdef..." */ assertIsHardlink(name1, name2); @@ -219,14 +219,14 @@ verify_tree(size_t limit) if (canSymlink()) { /* Verify symlink "s/abcdef..." */ - sprintf(name1, "s/%s", filenames[i]); - sprintf(name2, "../f/%s", filenames[i]); + snprintf(name1, sizeof(name1), "s/%s", filenames[i]); + snprintf(name2, sizeof(name2), "../f/%s", filenames[i]); if (strlen(name2) <= limit) assertIsSymlink(name1, name2, 0); } /* Verify dir "d/abcdef...". */ - sprintf(name1, "d/%s", filenames[i]); + snprintf(name1, sizeof(name1), "d/%s", filenames[i]); if (i + 1 <= limit) { /* +1 for trailing slash */ if (assertIsDir(name1, -1)) { /* TODO: opendir/readdir this diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_empty_mtree.c b/src/dependencies/libarchive-3.6.2/tar/test/test_empty_mtree.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_empty_mtree.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_empty_mtree.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.Z.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.bz2.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.bz2.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.bz2.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.bz2.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.grz.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.grz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.grz.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.grz.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.gz.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.gz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.gz.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.gz.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lrz.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lrz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lrz.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lrz.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lz.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lz.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lz.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lz4.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lz4.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lz4.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lz4.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lzma.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lzma.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lzma.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lzma.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lzo.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lzo.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.lzo.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.lzo.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.xz.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.xz.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.xz.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.xz.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.zst.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.zst.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract.tar.zst.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract.tar.zst.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_Z.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_Z.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_Z.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_Z.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_bz2.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_bz2.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_bz2.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_bz2.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_grz.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_grz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_grz.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_grz.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_gz.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_gz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_gz.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_gz.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lrz.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lrz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lrz.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lrz.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lz.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lz.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lz.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lz4.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lz4.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lzma.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lzma.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lzma.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lzma.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lzo.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lzo.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_lzo.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_lzo.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_xz.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_xz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_xz.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_xz.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_zstd.c b/src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_zstd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_extract_tar_zstd.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_extract_tar_zstd.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_format_newc.c b/src/dependencies/libarchive-3.6.2/tar/test/test_format_newc.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_format_newc.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_format_newc.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_help.c b/src/dependencies/libarchive-3.6.2/tar/test/test_help.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_help.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_help.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_leading_slash.c b/src/dependencies/libarchive-3.6.2/tar/test/test_leading_slash.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_leading_slash.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_leading_slash.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_leading_slash.tar.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_leading_slash.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_leading_slash.tar.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_leading_slash.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_missing_file.c b/src/dependencies/libarchive-3.6.2/tar/test/test_missing_file.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_missing_file.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_missing_file.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_C_mtree.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_C_mtree.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_C_mtree.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_C_mtree.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_C_upper.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_C_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_C_upper.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_C_upper.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_H_upper.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_H_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_H_upper.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_H_upper.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_L_upper.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_L_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_L_upper.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_L_upper.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_O_upper.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_O_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_O_upper.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_O_upper.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_T_upper.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_T_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_T_upper.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_T_upper.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_U_upper.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_U_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_U_upper.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_U_upper.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_X_upper.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_X_upper.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_X_upper.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_X_upper.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_a.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_a.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_a.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_a.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_acls.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_acls.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_acls.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_acls.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_b.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_b.c similarity index 92% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_b.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_b.c index 0eee80d..d1b75e3 100644 --- a/src/dependencies/libarchive-3.5.2/tar/test/test_option_b.c +++ b/src/dependencies/libarchive-3.6.2/tar/test/test_option_b.c @@ -30,15 +30,17 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_option_b) { char *testprog_ustar; + size_t testprog_ustar_len; assertMakeFile("file1", 0644, "file1"); if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) { skipping("This test requires a `cat` program"); return; } - testprog_ustar = malloc(strlen(testprog) + sizeof(USTAR_OPT) + 1); - strcpy(testprog_ustar, testprog); - strcat(testprog_ustar, USTAR_OPT); + testprog_ustar_len = strlen(testprog) + sizeof(USTAR_OPT) + 1; + testprog_ustar = malloc(testprog_ustar_len); + strncpy(testprog_ustar, testprog, testprog_ustar_len); + strncat(testprog_ustar, USTAR_OPT, testprog_ustar_len); /* * Bsdtar does not pad if the output is going directly to a disk file. diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_b64encode.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_b64encode.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_b64encode.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_b64encode.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_exclude.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_exclude.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_exclude.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_exclude.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_exclude_vcs.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_exclude_vcs.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_exclude_vcs.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_exclude_vcs.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_fflags.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_fflags.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_fflags.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_fflags.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_gid_gname.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_gid_gname.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_gid_gname.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_gid_gname.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_grzip.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_grzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_grzip.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_grzip.c diff --git a/src/dependencies/libarchive-3.6.2/tar/test/test_option_ignore_zeros.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_ignore_zeros.c new file mode 100644 index 0000000..26c9320 --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/tar/test/test_option_ignore_zeros.c @@ -0,0 +1,147 @@ +/*- + * Copyright (c) 2021 Ryan Libby + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static int +make_files(void) +{ + int ret; + + assertMakeDir("in", 0755); + assertMakeDir("out", 0755); + assertMakeFile("in/a", 0644, "a"); + assertMakeFile("in/b", 0644, "b"); + assertMakeFile("in/c", 0644, "c"); + assertEqualInt(0, systemf("%s cf a.tar -C in a", testprog)); + assertEqualInt(0, systemf("%s cf b.tar -C in b", testprog)); + /* An archive formed with cat, and readable with --ignore-zeros. */ + ret = systemf("cat a.tar b.tar > ab-cat.tar"); + if (ret != 0) { + skipping("This test requires a `cat` program"); + return (ret); + } + + return (0); +} + +DEFINE_TEST(test_option_ignore_zeros_mode_t) +{ + if (make_files()) + return; + + /* Generate expected t-mode output. */ + assertEqualInt(0, systemf( + "%s cf ab-norm.tar -C in a b > norm-c.out 2> norm-c.err", + testprog)); + assertEmptyFile("norm-c.err"); + assertEmptyFile("norm-c.out"); + assertEqualInt(0, systemf( + "%s tf ab-norm.tar > norm-t.out 2> norm-t.err", + testprog)); + assertEmptyFile("norm-t.err"); + + /* Test output. */ + assertEqualInt(0, systemf( + "%s tf ab-cat.tar --ignore-zeros > test.out 2> test.err", + testprog)); + assertEmptyFile("test.err"); + + assertEqualFile("test.out", "norm-t.out"); +} + +DEFINE_TEST(test_option_ignore_zeros_mode_x) +{ + if (make_files()) + return; + + assertEqualInt(0, systemf( + "%s xf ab-cat.tar --ignore-zeros -C out > test.out 2> test.err", + testprog)); + assertEmptyFile("test.err"); + assertEmptyFile("test.out"); + + assertEqualFile("out/a", "in/a"); + assertEqualFile("out/b", "in/b"); +} + +DEFINE_TEST(test_option_ignore_zeros_mode_c) +{ + if (make_files()) + return; + + assertEqualInt(0, systemf( + "%s cf abc.tar --ignore-zeros @ab-cat.tar -C in c " + "> test-c.out 2> test-c.err", + testprog)); + assertEmptyFile("test-c.err"); + assertEmptyFile("test-c.out"); + + assertEqualInt(0, systemf( + "%s xf abc.tar -C out > test-x.out 2> test-x.err", + testprog)); + assertEmptyFile("test-x.err"); + assertEmptyFile("test-x.out"); + + assertEqualFile("out/a", "in/a"); + assertEqualFile("out/b", "in/b"); + assertEqualFile("out/c", "in/c"); +} + +static void +test_option_ignore_zeros_mode_ru(const char *mode) +{ + if (make_files()) + return; + + assertEqualInt(0, systemf( + "%s %sf ab-cat.tar --ignore-zeros -C in c " + "> test-ru.out 2> test-ru.err", + testprog, mode)); + assertEmptyFile("test-ru.err"); + assertEmptyFile("test-ru.out"); + + assertEqualInt(0, systemf( + "%s xf ab-cat.tar --ignore-zeros -C out " + "> test-x.out 2> test-x.err", + testprog)); + assertEmptyFile("test-x.err"); + assertEmptyFile("test-x.out"); + + assertEqualFile("out/a", "in/a"); + assertEqualFile("out/b", "in/b"); + assertEqualFile("out/c", "in/c"); +} + +DEFINE_TEST(test_option_ignore_zeros_mode_r) +{ + test_option_ignore_zeros_mode_ru("r"); +} + +DEFINE_TEST(test_option_ignore_zeros_mode_u) +{ + test_option_ignore_zeros_mode_ru("u"); +} diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_j.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_j.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_j.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_j.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_k.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_k.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_k.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_k.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_keep_newer_files.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_keep_newer_files.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_keep_newer_files.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_keep_newer_files.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_keep_newer_files.tar.Z.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_option_keep_newer_files.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_keep_newer_files.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_keep_newer_files.tar.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_lrzip.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_lrzip.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_lrzip.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_lrzip.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_lz4.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_lz4.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_lz4.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_lz4.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_lzma.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_lzma.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_lzma.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_lzma.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_lzop.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_lzop.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_lzop.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_lzop.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_n.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_n.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_n.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_n.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_newer_than.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_newer_than.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_newer_than.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_newer_than.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_nodump.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_nodump.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_nodump.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_nodump.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_older_than.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_older_than.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_older_than.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_older_than.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_passphrase.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_passphrase.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_passphrase.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_passphrase.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_passphrase.zip.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_option_passphrase.zip.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_passphrase.zip.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_passphrase.zip.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_q.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_q.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_q.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_q.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_r.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_r.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_r.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_r.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_s.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_s.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_s.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_s.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_s.tar.Z.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_option_s.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_s.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_s.tar.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_safe_writes.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_safe_writes.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_safe_writes.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_safe_writes.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_uid_uname.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_uid_uname.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_uid_uname.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_uid_uname.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_uuencode.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_uuencode.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_uuencode.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_uuencode.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_xattrs.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_xattrs.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_xattrs.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_xattrs.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_xz.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_xz.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_xz.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_xz.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_z.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_z.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_z.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_z.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_option_zstd.c b/src/dependencies/libarchive-3.6.2/tar/test/test_option_zstd.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_option_zstd.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_option_zstd.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_patterns.c b/src/dependencies/libarchive-3.6.2/tar/test/test_patterns.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_patterns.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_patterns.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_patterns_2.tar.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_patterns_2.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_patterns_2.tar.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_patterns_2.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_patterns_3.tar.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_patterns_3.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_patterns_3.tar.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_patterns_3.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_patterns_4.tar.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_patterns_4.tar.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_patterns_4.tar.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_patterns_4.tar.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_print_longpath.c b/src/dependencies/libarchive-3.6.2/tar/test/test_print_longpath.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_print_longpath.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_print_longpath.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_print_longpath.tar.Z.uu b/src/dependencies/libarchive-3.6.2/tar/test/test_print_longpath.tar.Z.uu similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_print_longpath.tar.Z.uu rename to src/dependencies/libarchive-3.6.2/tar/test/test_print_longpath.tar.Z.uu diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_stdio.c b/src/dependencies/libarchive-3.6.2/tar/test/test_stdio.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_stdio.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_stdio.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_strip_components.c b/src/dependencies/libarchive-3.6.2/tar/test/test_strip_components.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_strip_components.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_strip_components.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_symlink_dir.c b/src/dependencies/libarchive-3.6.2/tar/test/test_symlink_dir.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_symlink_dir.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_symlink_dir.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_version.c b/src/dependencies/libarchive-3.6.2/tar/test/test_version.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_version.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_version.c diff --git a/src/dependencies/libarchive-3.5.2/tar/test/test_windows.c b/src/dependencies/libarchive-3.6.2/tar/test/test_windows.c similarity index 100% rename from src/dependencies/libarchive-3.5.2/tar/test/test_windows.c rename to src/dependencies/libarchive-3.6.2/tar/test/test_windows.c diff --git a/src/dependencies/libarchive-3.5.2/tar/util.c b/src/dependencies/libarchive-3.6.2/tar/util.c similarity index 97% rename from src/dependencies/libarchive-3.5.2/tar/util.c rename to src/dependencies/libarchive-3.6.2/tar/util.c index 8ebec64..5a4ab0b 100644 --- a/src/dependencies/libarchive-3.5.2/tar/util.c +++ b/src/dependencies/libarchive-3.6.2/tar/util.c @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/util.c,v 1.23 2008/12/15 06:00:25 kientzle E #include "err.h" #include "passphrase.h" -static size_t bsdtar_expand_char(char *, size_t, char); +static size_t bsdtar_expand_char(char *, size_t, size_t, char); static const char *strip_components(const char *path, int elements); #if defined(_WIN32) && !defined(__CYGWIN__) @@ -173,12 +173,12 @@ safe_fprintf(FILE *f, const char *fmt, ...) /* Not printable, format the bytes. */ while (n-- > 0) i += (unsigned)bsdtar_expand_char( - outbuff, i, *p++); + outbuff, sizeof(outbuff), i, *p++); } } else { /* After any conversion failure, don't bother * trying to convert the rest. */ - i += (unsigned)bsdtar_expand_char(outbuff, i, *p++); + i += (unsigned)bsdtar_expand_char(outbuff, sizeof(outbuff), i, *p++); try_wc = 0; } @@ -200,7 +200,7 @@ safe_fprintf(FILE *f, const char *fmt, ...) * Render an arbitrary sequence of bytes into printable ASCII characters. */ static size_t -bsdtar_expand_char(char *buff, size_t offset, char c) +bsdtar_expand_char(char *buff, size_t buffsize, size_t offset, char c) { size_t i = offset; @@ -221,7 +221,7 @@ bsdtar_expand_char(char *buff, size_t offset, char c) case '\v': buff[i++] = 'v'; break; case '\\': buff[i++] = '\\'; break; default: - sprintf(buff + i, "%03o", 0xFF & (int)c); + snprintf(buff + i, buffsize - i, "%03o", 0xFF & (int)c); i += 3; } } @@ -309,11 +309,12 @@ set_chdir(struct bsdtar *bsdtar, const char *newdir) /* The -C /foo -C bar case; concatenate */ char *old_pending = bsdtar->pending_chdir; size_t old_len = strlen(old_pending); - bsdtar->pending_chdir = malloc(old_len + strlen(newdir) + 2); + size_t new_len = old_len + strlen(newdir) + 2; + bsdtar->pending_chdir = malloc(new_len); if (old_pending[old_len - 1] == '/') old_pending[old_len - 1] = '\0'; if (bsdtar->pending_chdir != NULL) - sprintf(bsdtar->pending_chdir, "%s/%s", + snprintf(bsdtar->pending_chdir, new_len, "%s/%s", old_pending, newdir); free(old_pending); } @@ -695,7 +696,7 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry) /* Use uname if it's present, else uid. */ p = archive_entry_uname(entry); if ((p == NULL) || (*p == '\0')) { - sprintf(tmp, "%lu ", + snprintf(tmp, sizeof(tmp), "%lu ", (unsigned long)archive_entry_uid(entry)); p = tmp; } @@ -710,7 +711,7 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry) fprintf(out, "%s", p); w = strlen(p); } else { - sprintf(tmp, "%lu", + snprintf(tmp, sizeof(tmp), "%lu", (unsigned long)archive_entry_gid(entry)); w = strlen(tmp); fprintf(out, "%s", tmp); @@ -723,7 +724,7 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry) */ if (archive_entry_filetype(entry) == AE_IFCHR || archive_entry_filetype(entry) == AE_IFBLK) { - sprintf(tmp, "%lu,%lu", + snprintf(tmp, sizeof(tmp), "%lu,%lu", (unsigned long)archive_entry_rdevmajor(entry), (unsigned long)archive_entry_rdevminor(entry)); } else { diff --git a/src/dependencies/libarchive-3.5.2/tar/write.c b/src/dependencies/libarchive-3.6.2/tar/write.c similarity index 99% rename from src/dependencies/libarchive-3.5.2/tar/write.c rename to src/dependencies/libarchive-3.6.2/tar/write.c index 09c44a3..f2fb1c3 100644 --- a/src/dependencies/libarchive-3.5.2/tar/write.c +++ b/src/dependencies/libarchive-3.6.2/tar/write.c @@ -196,6 +196,10 @@ set_reader_options(struct bsdtar *bsdtar, struct archive *a) else archive_clear_error(a); } + if (bsdtar->flags & OPTFLAG_IGNORE_ZEROS) + if (archive_read_set_options(a, + "read_concatenated_archives") != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); } void diff --git a/src/dependencies/libarchive-3.5.2/test_utils/test_common.h b/src/dependencies/libarchive-3.6.2/test_utils/test_common.h similarity index 99% rename from src/dependencies/libarchive-3.5.2/test_utils/test_common.h rename to src/dependencies/libarchive-3.6.2/test_utils/test_common.h index 42119c0..6250235 100644 --- a/src/dependencies/libarchive-3.5.2/test_utils/test_common.h +++ b/src/dependencies/libarchive-3.6.2/test_utils/test_common.h @@ -471,4 +471,6 @@ void assertVersion(const char *prog, const char *base); #include #endif +#include "test_utils.h" + #endif /* TEST_COMMON_H */ diff --git a/src/dependencies/libarchive-3.5.2/test_utils/test_main.c b/src/dependencies/libarchive-3.6.2/test_utils/test_main.c similarity index 96% rename from src/dependencies/libarchive-3.5.2/test_utils/test_main.c rename to src/dependencies/libarchive-3.6.2/test_utils/test_main.c index c1c03cd..74250ad 100644 --- a/src/dependencies/libarchive-3.5.2/test_utils/test_main.c +++ b/src/dependencies/libarchive-3.6.2/test_utils/test_main.c @@ -426,7 +426,7 @@ failure(const char *fmt, ...) nextmsg = NULL; } else { va_start(ap, fmt); - vsprintf(msgbuff, fmt, ap); + vsnprintf(msgbuff, sizeof(msgbuff), fmt, ap); va_end(ap); nextmsg = msgbuff; } @@ -551,7 +551,7 @@ test_skipping(const char *fmt, ...) va_list ap; va_start(ap, fmt); - vsprintf(buff, fmt, ap); + vsnprintf(buff, sizeof(buff), fmt, ap); va_end(ap); /* Use failure() message if set. */ msg = nextmsg; @@ -1970,7 +1970,12 @@ assertion_make_file(const char *file, int line, failure_finish(NULL); return (0); } - if (0 != chmod(path, mode)) { +#ifdef HAVE_FCHMOD + if (0 != fchmod(fd, mode)) +#else + if (0 != chmod(path, mode)) +#endif + { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); close(fd); @@ -2610,7 +2615,7 @@ canLzma(void) static int tested = 0, value = 0; if (!tested) { tested = 1; - if (systemf("lzma %s", redirectArgs) == 0) + if (systemf("lzma --help %s", redirectArgs) == 0) value = 1; } return (value); @@ -3065,7 +3070,7 @@ systemf(const char *fmt, ...) int r; va_start(ap, fmt); - vsprintf(buff, fmt, ap); + vsnprintf(buff, sizeof(buff), fmt, ap); if (verbosity > VERBOSITY_FULL) logprintf("Cmd: %s\n", buff); r = system(buff); @@ -3090,7 +3095,7 @@ slurpfile(size_t * sizep, const char *fmt, ...) int r; va_start(ap, fmt); - vsprintf(filename, fmt, ap); + vsnprintf(filename, sizeof(filename), fmt, ap); va_end(ap); f = fopen(filename, "rb"); @@ -3157,7 +3162,7 @@ extract_reference_file(const char *name) char buff[1024]; FILE *in, *out; - sprintf(buff, "%s/%s.uu", refdir, name); + snprintf(buff, sizeof(buff), "%s/%s.uu", refdir, name); in = fopen(buff, "r"); failure("Couldn't open reference file %s", buff); assert(in != NULL); @@ -3185,14 +3190,12 @@ extract_reference_file(const char *name) while (bytes > 0) { int n = 0; /* Write out 1-3 bytes from that. */ - if (bytes > 0) { - assert(VALID_UUDECODE(p[0])); - assert(VALID_UUDECODE(p[1])); - n = UUDECODE(*p++) << 18; - n |= UUDECODE(*p++) << 12; - fputc(n >> 16, out); - --bytes; - } + assert(VALID_UUDECODE(p[0])); + assert(VALID_UUDECODE(p[1])); + n = UUDECODE(*p++) << 18; + n |= UUDECODE(*p++) << 12; + fputc(n >> 16, out); + --bytes; if (bytes > 0) { assert(VALID_UUDECODE(p[0])); n |= UUDECODE(*p++) << 6; @@ -3218,7 +3221,7 @@ copy_reference_file(const char *name) FILE *in, *out; size_t rbytes; - sprintf(buff, "%s/%s", refdir, name); + snprintf(buff, sizeof(buff), "%s/%s", refdir, name); in = fopen(buff, "rb"); failure("Couldn't open reference file %s", buff); assert(in != NULL); @@ -3462,6 +3465,12 @@ assertion_entry_compare_acls(const char *file, int line, * DEFINE_TEST(test_function) * for each test. */ +struct test_list_t +{ + void (*func)(void); + const char *name; + int failures; +}; /* Use "list.h" to declare all of the test functions. */ #undef DEFINE_TEST @@ -3539,7 +3548,7 @@ test_run(int i, const char *tmpdir) exit(1); } /* Create a log file for this test. */ - sprintf(logfilename, "%s.log", tests[i].name); + snprintf(logfilename, sizeof(logfilename), "%s.log", tests[i].name); logfile = fopen(logfilename, "w"); fprintf(logfile, "%s\n\n", tests[i].name); /* Chdir() to a work dir for this specific test. */ @@ -3753,13 +3762,119 @@ success: return p; } +/* Filter tests against a glob pattern. Returns non-zero if test matches + * pattern, zero otherwise. A '^' at the beginning of the pattern negates + * the return values (i.e. returns zero for a match, non-zero otherwise. + */ +static int +test_filter(const char *pattern, const char *test) +{ + int retval = 0; + int negate = 0; + const char *p = pattern; + const char *t = test; + + if (p[0] == '^') + { + negate = 1; + p++; + } + + while (1) + { + if (p[0] == '\\') + p++; + else if (p[0] == '*') + { + while (p[0] == '*') + p++; + if (p[0] == '\\') + p++; + if ((t = strchr(t, p[0])) == 0) + break; + } + if (p[0] != t[0]) + break; + if (p[0] == '\0') { + retval = 1; + break; + } + p++; + t++; + } + + return (negate) ? !retval : retval; +} + +static int +get_test_set(int *test_set, int limit, const char *test) +{ + int start, end; + int idx = 0; + + if (test == NULL) { + /* Default: Run all tests. */ + for (;idx < limit; idx++) + test_set[idx] = idx; + return (limit); + } + if (*test >= '0' && *test <= '9') { + const char *vp = test; + start = 0; + while (*vp >= '0' && *vp <= '9') { + start *= 10; + start += *vp - '0'; + ++vp; + } + if (*vp == '\0') { + end = start; + } else if (*vp == '-') { + ++vp; + if (*vp == '\0') { + end = limit - 1; + } else { + end = 0; + while (*vp >= '0' && *vp <= '9') { + end *= 10; + end += *vp - '0'; + ++vp; + } + } + } else + return (-1); + if (start < 0 || end >= limit || start > end) + return (-1); + while (start <= end) + test_set[idx++] = start++; + } else { + for (start = 0; start < limit; ++start) { + const char *name = tests[start].name; + if (test_filter(test, name)) + test_set[idx++] = start; + } + } + return ((idx == 0)?-1:idx); +} + int main(int argc, char **argv) { static const int limit = sizeof(tests) / sizeof(tests[0]); int test_set[sizeof(tests) / sizeof(tests[0])]; int i = 0, j = 0, tests_run = 0, tests_failed = 0, option; + int testprogdir_len; +#ifdef PROGRAM + int tmp2_len; +#endif time_t now; + struct tm *tmptr; +#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S) + struct tm tmbuf; +#endif +#if defined(HAVE__LOCALTIME64_S) + errno_t terr; + __time64_t tmptime; +#endif char *refdir_alloc = NULL; const char *progname; char **saved_argv; @@ -3795,12 +3910,13 @@ main(int argc, char **argv) * tree. */ progname = p = argv[0]; - if ((testprogdir = (char *)malloc(strlen(progname) + 1)) == NULL) + testprogdir_len = strlen(progname) + 1; + if ((testprogdir = (char *)malloc(testprogdir_len)) == NULL) { fprintf(stderr, "ERROR: Out of memory."); exit(1); } - strcpy(testprogdir, progname); + strncpy(testprogdir, progname, testprogdir_len); while (*p != '\0') { /* Support \ or / dir separators for Windows compat. */ if (*p == '/' || *p == '\\') @@ -3942,20 +4058,21 @@ main(int argc, char **argv) #ifdef PROGRAM if (testprogfile == NULL) { - if ((tmp2 = (char *)malloc(strlen(testprogdir) + 1 + - strlen(PROGRAM) + 1)) == NULL) + tmp2_len = strlen(testprogdir) + 1 + strlen(PROGRAM) + 1; + if ((tmp2 = (char *)malloc(tmp2_len)) == NULL) { fprintf(stderr, "ERROR: Out of memory."); exit(1); } - strcpy(tmp2, testprogdir); - strcat(tmp2, "/"); - strcat(tmp2, PROGRAM); + strncpy(tmp2, testprogdir, tmp2_len); + strncat(tmp2, "/", tmp2_len); + strncat(tmp2, PROGRAM, tmp2_len); testprogfile = tmp2; } { char *testprg; + int testprg_len; #if defined(_WIN32) && !defined(__CYGWIN__) /* Command.com sometimes rejects '/' separators. */ testprg = strdup(testprogfile); @@ -3966,10 +4083,11 @@ main(int argc, char **argv) testprogfile = testprg; #endif /* Quote the name that gets put into shell command lines. */ - testprg = malloc(strlen(testprogfile) + 3); - strcpy(testprg, "\""); - strcat(testprg, testprogfile); - strcat(testprg, "\""); + testprg_len = strlen(testprogfile) + 3; + testprg = malloc(testprg_len); + strncpy(testprg, "\"", testprg_len); + strncat(testprg, testprogfile, testprg_len); + strncat(testprg, "\"", testprg_len); testprog = testprg; } #endif @@ -3991,9 +4109,20 @@ main(int argc, char **argv) */ now = time(NULL); for (i = 0; ; i++) { +#if defined(HAVE_LOCALTIME_R) + tmptr = localtime_r(&now, &tmbuf); +#elif defined(HAVE__LOCALTIME64_S) + tmptime = now; + terr = _localtime64_s(&tmbuf, &tmptime); + if (terr) + tmptr = NULL; + else + tmptr = &tmbuf; +#else + tmptr = localtime(&now); +#endif strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp), - "%Y-%m-%dT%H.%M.%S", - localtime(&now)); + "%Y-%m-%dT%H.%M.%S", tmptr); if ((strlen(tmp) + 1 + strlen(progname) + 1 + strlen(tmpdir_timestamp) + 1 + 3) > (sizeof(tmpdir) / sizeof(char))) { @@ -4049,7 +4178,7 @@ main(int argc, char **argv) do { int test_num; - test_num = get_test_set(test_set, limit, *argv, tests); + test_num = get_test_set(test_set, limit, *argv); if (test_num < 0) { printf("*** INVALID Test %s\n", *argv); free(refdir_alloc); diff --git a/src/dependencies/libarchive-3.6.2/test_utils/test_utils.c b/src/dependencies/libarchive-3.6.2/test_utils/test_utils.c new file mode 100644 index 0000000..b796676 --- /dev/null +++ b/src/dependencies/libarchive-3.6.2/test_utils/test_utils.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2003-2012 Tim Kientzle + * Copyright (c) 2012 Andres Mejia + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "test_utils.h" + +#include +#include +#include +#include +#include + +static inline uint64_t +xorshift64(uint64_t *state) +{ + uint64_t x = *state; + x ^= x << 13; + x ^= x >> 7; + x ^= x << 17; + *state = x; + return (x); +} + +/* + * Fill a buffer with reproducible pseudo-random data using a simple xorshift + * algorithm. Originally, most tests filled buffers with a loop that calls + * rand() once for each byte. However, this initialization can be extremely + * slow when running on emulated platforms such as QEMU where 16M calls to + * rand() take a long time: Before the test_write_format_7zip_large_copy test + * took ~22 seconds, whereas using a xorshift random number generator (that can + * be inlined) reduces it to ~17 seconds on QEMU RISC-V. + */ +static void +fill_with_pseudorandom_data_seed(uint64_t seed, void *buffer, size_t size) +{ + uint64_t *aligned_buffer; + size_t num_values; + size_t i; + size_t unaligned_suffix; + size_t unaligned_prefix = 0; + /* + * To avoid unaligned stores we only fill the aligned part of the buffer + * with pseudo-random data and fill the unaligned prefix with 0xab and + * the suffix with 0xcd. + */ + if ((uintptr_t)buffer % sizeof(uint64_t)) { + unaligned_prefix = + sizeof(uint64_t) - (uintptr_t)buffer % sizeof(uint64_t); + aligned_buffer = + (uint64_t *)((char *)buffer + unaligned_prefix); + memset(buffer, 0xab, unaligned_prefix); + } else { + aligned_buffer = (uint64_t *)buffer; + } + assert((uintptr_t)aligned_buffer % sizeof(uint64_t) == 0); + num_values = (size - unaligned_prefix) / sizeof(uint64_t); + unaligned_suffix = + size - unaligned_prefix - num_values * sizeof(uint64_t); + for (i = 0; i < num_values; i++) { + aligned_buffer[i] = xorshift64(&seed); + } + if (unaligned_suffix) { + memset((char *)buffer + size - unaligned_suffix, 0xcd, + unaligned_suffix); + } +} + +void +fill_with_pseudorandom_data(void *buffer, size_t size) +{ + uint64_t seed; + const char* seed_str; + /* + * Check if a seed has been specified in the environment, otherwise fall + * back to using rand() as a seed. + */ + if ((seed_str = getenv("TEST_RANDOM_SEED")) != NULL) { + errno = 0; + seed = strtoull(seed_str, NULL, 10); + if (errno != 0) { + fprintf(stderr, "strtoull(%s) failed: %s", seed_str, + strerror(errno)); + seed = rand(); + } + } else { + seed = rand(); + } + fill_with_pseudorandom_data_seed(seed, buffer, size); +} diff --git a/src/dependencies/libarchive-3.5.2/test_utils/test_utils.h b/src/dependencies/libarchive-3.6.2/test_utils/test_utils.h similarity index 90% rename from src/dependencies/libarchive-3.5.2/test_utils/test_utils.h rename to src/dependencies/libarchive-3.6.2/test_utils/test_utils.h index 164c528..4145789 100644 --- a/src/dependencies/libarchive-3.5.2/test_utils/test_utils.h +++ b/src/dependencies/libarchive-3.6.2/test_utils/test_utils.h @@ -27,13 +27,10 @@ #ifndef TEST_UTILS_H #define TEST_UTILS_H -struct test_list_t -{ - void (*func)(void); - const char *name; - int failures; -}; +#include +#include -int get_test_set(int *, int, const char *, struct test_list_t *); +/* Fill a buffer with pseudorandom data */ +void fill_with_pseudorandom_data(void* buffer, size_t size); #endif /* TEST_UTILS_H */ diff --git a/src/dependencies/zlib-1.2.11/contrib/amd64/amd64-match.S b/src/dependencies/zlib-1.2.11/contrib/amd64/amd64-match.S deleted file mode 100644 index 81d4a1c..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/amd64/amd64-match.S +++ /dev/null @@ -1,452 +0,0 @@ -/* - * match.S -- optimized version of longest_match() - * based on the similar work by Gilles Vollant, and Brian Raiter, written 1998 - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the BSD License. Use by owners of Che Guevarra - * parafernalia is prohibited, where possible, and highly discouraged - * elsewhere. - */ - -#ifndef NO_UNDERLINE -# define match_init _match_init -# define longest_match _longest_match -#endif - -#define scanend ebx -#define scanendw bx -#define chainlenwmask edx /* high word: current chain len low word: s->wmask */ -#define curmatch rsi -#define curmatchd esi -#define windowbestlen r8 -#define scanalign r9 -#define scanalignd r9d -#define window r10 -#define bestlen r11 -#define bestlend r11d -#define scanstart r12d -#define scanstartw r12w -#define scan r13 -#define nicematch r14d -#define limit r15 -#define limitd r15d -#define prev rcx - -/* - * The 258 is a "magic number, not a parameter -- changing it - * breaks the hell loose - */ -#define MAX_MATCH (258) -#define MIN_MATCH (3) -#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) -#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) - -/* stack frame offsets */ -#define LocalVarsSize (112) -#define _chainlenwmask ( 8-LocalVarsSize)(%rsp) -#define _windowbestlen (16-LocalVarsSize)(%rsp) -#define save_r14 (24-LocalVarsSize)(%rsp) -#define save_rsi (32-LocalVarsSize)(%rsp) -#define save_rbx (40-LocalVarsSize)(%rsp) -#define save_r12 (56-LocalVarsSize)(%rsp) -#define save_r13 (64-LocalVarsSize)(%rsp) -#define save_r15 (80-LocalVarsSize)(%rsp) - - -.globl match_init, longest_match - -/* - * On AMD64 the first argument of a function (in our case -- the pointer to - * deflate_state structure) is passed in %rdi, hence our offsets below are - * all off of that. - */ - -/* you can check the structure offset by running - -#include -#include -#include "deflate.h" - -void print_depl() -{ -deflate_state ds; -deflate_state *s=&ds; -printf("size pointer=%u\n",(int)sizeof(void*)); - -printf("#define dsWSize (%3u)(%%rdi)\n",(int)(((char*)&(s->w_size))-((char*)s))); -printf("#define dsWMask (%3u)(%%rdi)\n",(int)(((char*)&(s->w_mask))-((char*)s))); -printf("#define dsWindow (%3u)(%%rdi)\n",(int)(((char*)&(s->window))-((char*)s))); -printf("#define dsPrev (%3u)(%%rdi)\n",(int)(((char*)&(s->prev))-((char*)s))); -printf("#define dsMatchLen (%3u)(%%rdi)\n",(int)(((char*)&(s->match_length))-((char*)s))); -printf("#define dsPrevMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_match))-((char*)s))); -printf("#define dsStrStart (%3u)(%%rdi)\n",(int)(((char*)&(s->strstart))-((char*)s))); -printf("#define dsMatchStart (%3u)(%%rdi)\n",(int)(((char*)&(s->match_start))-((char*)s))); -printf("#define dsLookahead (%3u)(%%rdi)\n",(int)(((char*)&(s->lookahead))-((char*)s))); -printf("#define dsPrevLen (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_length))-((char*)s))); -printf("#define dsMaxChainLen (%3u)(%%rdi)\n",(int)(((char*)&(s->max_chain_length))-((char*)s))); -printf("#define dsGoodMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->good_match))-((char*)s))); -printf("#define dsNiceMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->nice_match))-((char*)s))); -} - -*/ - - -/* - to compile for XCode 3.2 on MacOSX x86_64 - - run "gcc -g -c -DXCODE_MAC_X64_STRUCTURE amd64-match.S" - */ - - -#ifndef CURRENT_LINX_XCODE_MAC_X64_STRUCTURE -#define dsWSize ( 68)(%rdi) -#define dsWMask ( 76)(%rdi) -#define dsWindow ( 80)(%rdi) -#define dsPrev ( 96)(%rdi) -#define dsMatchLen (144)(%rdi) -#define dsPrevMatch (148)(%rdi) -#define dsStrStart (156)(%rdi) -#define dsMatchStart (160)(%rdi) -#define dsLookahead (164)(%rdi) -#define dsPrevLen (168)(%rdi) -#define dsMaxChainLen (172)(%rdi) -#define dsGoodMatch (188)(%rdi) -#define dsNiceMatch (192)(%rdi) - -#else - -#ifndef STRUCT_OFFSET -# define STRUCT_OFFSET (0) -#endif - - -#define dsWSize ( 56 + STRUCT_OFFSET)(%rdi) -#define dsWMask ( 64 + STRUCT_OFFSET)(%rdi) -#define dsWindow ( 72 + STRUCT_OFFSET)(%rdi) -#define dsPrev ( 88 + STRUCT_OFFSET)(%rdi) -#define dsMatchLen (136 + STRUCT_OFFSET)(%rdi) -#define dsPrevMatch (140 + STRUCT_OFFSET)(%rdi) -#define dsStrStart (148 + STRUCT_OFFSET)(%rdi) -#define dsMatchStart (152 + STRUCT_OFFSET)(%rdi) -#define dsLookahead (156 + STRUCT_OFFSET)(%rdi) -#define dsPrevLen (160 + STRUCT_OFFSET)(%rdi) -#define dsMaxChainLen (164 + STRUCT_OFFSET)(%rdi) -#define dsGoodMatch (180 + STRUCT_OFFSET)(%rdi) -#define dsNiceMatch (184 + STRUCT_OFFSET)(%rdi) - -#endif - - - - -.text - -/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ - -longest_match: -/* - * Retrieve the function arguments. %curmatch will hold cur_match - * throughout the entire function (passed via rsi on amd64). - * rdi will hold the pointer to the deflate_state (first arg on amd64) - */ - mov %rsi, save_rsi - mov %rbx, save_rbx - mov %r12, save_r12 - mov %r13, save_r13 - mov %r14, save_r14 - mov %r15, save_r15 - -/* uInt wmask = s->w_mask; */ -/* unsigned chain_length = s->max_chain_length; */ -/* if (s->prev_length >= s->good_match) { */ -/* chain_length >>= 2; */ -/* } */ - - movl dsPrevLen, %eax - movl dsGoodMatch, %ebx - cmpl %ebx, %eax - movl dsWMask, %eax - movl dsMaxChainLen, %chainlenwmask - jl LastMatchGood - shrl $2, %chainlenwmask -LastMatchGood: - -/* chainlen is decremented once beforehand so that the function can */ -/* use the sign flag instead of the zero flag for the exit test. */ -/* It is then shifted into the high word, to make room for the wmask */ -/* value, which it will always accompany. */ - - decl %chainlenwmask - shll $16, %chainlenwmask - orl %eax, %chainlenwmask - -/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ - - movl dsNiceMatch, %eax - movl dsLookahead, %ebx - cmpl %eax, %ebx - jl LookaheadLess - movl %eax, %ebx -LookaheadLess: movl %ebx, %nicematch - -/* register Bytef *scan = s->window + s->strstart; */ - - mov dsWindow, %window - movl dsStrStart, %limitd - lea (%limit, %window), %scan - -/* Determine how many bytes the scan ptr is off from being */ -/* dword-aligned. */ - - mov %scan, %scanalign - negl %scanalignd - andl $3, %scanalignd - -/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ -/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ - - movl dsWSize, %eax - subl $MIN_LOOKAHEAD, %eax - xorl %ecx, %ecx - subl %eax, %limitd - cmovng %ecx, %limitd - -/* int best_len = s->prev_length; */ - - movl dsPrevLen, %bestlend - -/* Store the sum of s->window + best_len in %windowbestlen locally, and in memory. */ - - lea (%window, %bestlen), %windowbestlen - mov %windowbestlen, _windowbestlen - -/* register ush scan_start = *(ushf*)scan; */ -/* register ush scan_end = *(ushf*)(scan+best_len-1); */ -/* Posf *prev = s->prev; */ - - movzwl (%scan), %scanstart - movzwl -1(%scan, %bestlen), %scanend - mov dsPrev, %prev - -/* Jump into the main loop. */ - - movl %chainlenwmask, _chainlenwmask - jmp LoopEntry - -.balign 16 - -/* do { - * match = s->window + cur_match; - * if (*(ushf*)(match+best_len-1) != scan_end || - * *(ushf*)match != scan_start) continue; - * [...] - * } while ((cur_match = prev[cur_match & wmask]) > limit - * && --chain_length != 0); - * - * Here is the inner loop of the function. The function will spend the - * majority of its time in this loop, and majority of that time will - * be spent in the first ten instructions. - */ -LookupLoop: - andl %chainlenwmask, %curmatchd - movzwl (%prev, %curmatch, 2), %curmatchd - cmpl %limitd, %curmatchd - jbe LeaveNow - subl $0x00010000, %chainlenwmask - js LeaveNow -LoopEntry: cmpw -1(%windowbestlen, %curmatch), %scanendw - jne LookupLoop - cmpw %scanstartw, (%window, %curmatch) - jne LookupLoop - -/* Store the current value of chainlen. */ - movl %chainlenwmask, _chainlenwmask - -/* %scan is the string under scrutiny, and %prev to the string we */ -/* are hoping to match it up with. In actuality, %esi and %edi are */ -/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ -/* initialized to -(MAX_MATCH_8 - scanalign). */ - - mov $(-MAX_MATCH_8), %rdx - lea (%curmatch, %window), %windowbestlen - lea MAX_MATCH_8(%windowbestlen, %scanalign), %windowbestlen - lea MAX_MATCH_8(%scan, %scanalign), %prev - -/* the prefetching below makes very little difference... */ - prefetcht1 (%windowbestlen, %rdx) - prefetcht1 (%prev, %rdx) - -/* - * Test the strings for equality, 8 bytes at a time. At the end, - * adjust %rdx so that it is offset to the exact byte that mismatched. - * - * It should be confessed that this loop usually does not represent - * much of the total running time. Replacing it with a more - * straightforward "rep cmpsb" would not drastically degrade - * performance -- unrolling it, for example, makes no difference. - */ - -#undef USE_SSE /* works, but is 6-7% slower, than non-SSE... */ - -LoopCmps: -#ifdef USE_SSE - /* Preload the SSE registers */ - movdqu (%windowbestlen, %rdx), %xmm1 - movdqu (%prev, %rdx), %xmm2 - pcmpeqb %xmm2, %xmm1 - movdqu 16(%windowbestlen, %rdx), %xmm3 - movdqu 16(%prev, %rdx), %xmm4 - pcmpeqb %xmm4, %xmm3 - movdqu 32(%windowbestlen, %rdx), %xmm5 - movdqu 32(%prev, %rdx), %xmm6 - pcmpeqb %xmm6, %xmm5 - movdqu 48(%windowbestlen, %rdx), %xmm7 - movdqu 48(%prev, %rdx), %xmm8 - pcmpeqb %xmm8, %xmm7 - - /* Check the comparisions' results */ - pmovmskb %xmm1, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - /* this is the only iteration of the loop with a possibility of having - incremented rdx by 0x108 (each loop iteration add 16*4 = 0x40 - and (0x40*4)+8=0x108 */ - add $8, %rdx - jz LenMaximum - add $8, %rdx - - - pmovmskb %xmm3, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - - add $16, %rdx - - - pmovmskb %xmm5, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - add $16, %rdx - - - pmovmskb %xmm7, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - add $16, %rdx - - jmp LoopCmps -LeaveLoopCmps: add %rax, %rdx -#else - mov (%windowbestlen, %rdx), %rax - xor (%prev, %rdx), %rax - jnz LeaveLoopCmps - - mov 8(%windowbestlen, %rdx), %rax - xor 8(%prev, %rdx), %rax - jnz LeaveLoopCmps8 - - mov 16(%windowbestlen, %rdx), %rax - xor 16(%prev, %rdx), %rax - jnz LeaveLoopCmps16 - - add $24, %rdx - jnz LoopCmps - jmp LenMaximum -# if 0 -/* - * This three-liner is tantalizingly simple, but bsf is a slow instruction, - * and the complicated alternative down below is quite a bit faster. Sad... - */ - -LeaveLoopCmps: bsf %rax, %rax /* find the first non-zero bit */ - shrl $3, %eax /* divide by 8 to get the byte */ - add %rax, %rdx -# else -LeaveLoopCmps16: - add $8, %rdx -LeaveLoopCmps8: - add $8, %rdx -LeaveLoopCmps: testl $0xFFFFFFFF, %eax /* Check the first 4 bytes */ - jnz Check16 - add $4, %rdx - shr $32, %rax -Check16: testw $0xFFFF, %ax - jnz LenLower - add $2, %rdx - shrl $16, %eax -LenLower: subb $1, %al - adc $0, %rdx -# endif -#endif - -/* Calculate the length of the match. If it is longer than MAX_MATCH, */ -/* then automatically accept it as the best possible match and leave. */ - - lea (%prev, %rdx), %rax - sub %scan, %rax - cmpl $MAX_MATCH, %eax - jge LenMaximum - -/* If the length of the match is not longer than the best match we */ -/* have so far, then forget it and return to the lookup loop. */ - - cmpl %bestlend, %eax - jg LongerMatch - mov _windowbestlen, %windowbestlen - mov dsPrev, %prev - movl _chainlenwmask, %edx - jmp LookupLoop - -/* s->match_start = cur_match; */ -/* best_len = len; */ -/* if (len >= nice_match) break; */ -/* scan_end = *(ushf*)(scan+best_len-1); */ - -LongerMatch: - movl %eax, %bestlend - movl %curmatchd, dsMatchStart - cmpl %nicematch, %eax - jge LeaveNow - - lea (%window, %bestlen), %windowbestlen - mov %windowbestlen, _windowbestlen - - movzwl -1(%scan, %rax), %scanend - mov dsPrev, %prev - movl _chainlenwmask, %chainlenwmask - jmp LookupLoop - -/* Accept the current string, with the maximum possible length. */ - -LenMaximum: - movl $MAX_MATCH, %bestlend - movl %curmatchd, dsMatchStart - -/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ -/* return s->lookahead; */ - -LeaveNow: - movl dsLookahead, %eax - cmpl %eax, %bestlend - cmovngl %bestlend, %eax -LookaheadRet: - -/* Restore the registers and return from whence we came. */ - - mov save_rsi, %rsi - mov save_rbx, %rbx - mov save_r12, %r12 - mov save_r13, %r13 - mov save_r14, %r14 - mov save_r15, %r15 - - ret - -match_init: ret diff --git a/src/dependencies/zlib-1.2.11/contrib/asm686/README.686 b/src/dependencies/zlib-1.2.11/contrib/asm686/README.686 deleted file mode 100644 index a0bf3be..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/asm686/README.686 +++ /dev/null @@ -1,51 +0,0 @@ -This is a patched version of zlib, modified to use -Pentium-Pro-optimized assembly code in the deflation algorithm. The -files changed/added by this patch are: - -README.686 -match.S - -The speedup that this patch provides varies, depending on whether the -compiler used to build the original version of zlib falls afoul of the -PPro's speed traps. My own tests show a speedup of around 10-20% at -the default compression level, and 20-30% using -9, against a version -compiled using gcc 2.7.2.3. Your mileage may vary. - -Note that this code has been tailored for the PPro/PII in particular, -and will not perform particuarly well on a Pentium. - -If you are using an assembler other than GNU as, you will have to -translate match.S to use your assembler's syntax. (Have fun.) - -Brian Raiter -breadbox@muppetlabs.com -April, 1998 - - -Added for zlib 1.1.3: - -The patches come from -http://www.muppetlabs.com/~breadbox/software/assembly.html - -To compile zlib with this asm file, copy match.S to the zlib directory -then do: - -CFLAGS="-O3 -DASMV" ./configure -make OBJA=match.o - - -Update: - -I've been ignoring these assembly routines for years, believing that -gcc's generated code had caught up with it sometime around gcc 2.95 -and the major rearchitecting of the Pentium 4. However, I recently -learned that, despite what I believed, this code still has some life -in it. On the Pentium 4 and AMD64 chips, it continues to run about 8% -faster than the code produced by gcc 4.1. - -In acknowledgement of its continuing usefulness, I've altered the -license to match that of the rest of zlib. Share and Enjoy! - -Brian Raiter -breadbox@muppetlabs.com -April, 2007 diff --git a/src/dependencies/zlib-1.2.11/contrib/asm686/match.S b/src/dependencies/zlib-1.2.11/contrib/asm686/match.S deleted file mode 100644 index fa42109..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/asm686/match.S +++ /dev/null @@ -1,357 +0,0 @@ -/* match.S -- x86 assembly version of the zlib longest_match() function. - * Optimized for the Intel 686 chips (PPro and later). - * - * Copyright (C) 1998, 2007 Brian Raiter - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the author be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ - -#ifndef NO_UNDERLINE -#define match_init _match_init -#define longest_match _longest_match -#endif - -#define MAX_MATCH (258) -#define MIN_MATCH (3) -#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) -#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) - -/* stack frame offsets */ - -#define chainlenwmask 0 /* high word: current chain len */ - /* low word: s->wmask */ -#define window 4 /* local copy of s->window */ -#define windowbestlen 8 /* s->window + bestlen */ -#define scanstart 16 /* first two bytes of string */ -#define scanend 12 /* last two bytes of string */ -#define scanalign 20 /* dword-misalignment of string */ -#define nicematch 24 /* a good enough match size */ -#define bestlen 28 /* size of best match so far */ -#define scan 32 /* ptr to string wanting match */ - -#define LocalVarsSize (36) -/* saved ebx 36 */ -/* saved edi 40 */ -/* saved esi 44 */ -/* saved ebp 48 */ -/* return address 52 */ -#define deflatestate 56 /* the function arguments */ -#define curmatch 60 - -/* All the +zlib1222add offsets are due to the addition of fields - * in zlib in the deflate_state structure since the asm code was first written - * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). - * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). - * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - */ - -#define zlib1222add (8) - -#define dsWSize (36+zlib1222add) -#define dsWMask (44+zlib1222add) -#define dsWindow (48+zlib1222add) -#define dsPrev (56+zlib1222add) -#define dsMatchLen (88+zlib1222add) -#define dsPrevMatch (92+zlib1222add) -#define dsStrStart (100+zlib1222add) -#define dsMatchStart (104+zlib1222add) -#define dsLookahead (108+zlib1222add) -#define dsPrevLen (112+zlib1222add) -#define dsMaxChainLen (116+zlib1222add) -#define dsGoodMatch (132+zlib1222add) -#define dsNiceMatch (136+zlib1222add) - - -.file "match.S" - -.globl match_init, longest_match - -.text - -/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ -.cfi_sections .debug_frame - -longest_match: - -.cfi_startproc -/* Save registers that the compiler may be using, and adjust %esp to */ -/* make room for our stack frame. */ - - pushl %ebp - .cfi_def_cfa_offset 8 - .cfi_offset ebp, -8 - pushl %edi - .cfi_def_cfa_offset 12 - pushl %esi - .cfi_def_cfa_offset 16 - pushl %ebx - .cfi_def_cfa_offset 20 - subl $LocalVarsSize, %esp - .cfi_def_cfa_offset LocalVarsSize+20 - -/* Retrieve the function arguments. %ecx will hold cur_match */ -/* throughout the entire function. %edx will hold the pointer to the */ -/* deflate_state structure during the function's setup (before */ -/* entering the main loop). */ - - movl deflatestate(%esp), %edx - movl curmatch(%esp), %ecx - -/* uInt wmask = s->w_mask; */ -/* unsigned chain_length = s->max_chain_length; */ -/* if (s->prev_length >= s->good_match) { */ -/* chain_length >>= 2; */ -/* } */ - - movl dsPrevLen(%edx), %eax - movl dsGoodMatch(%edx), %ebx - cmpl %ebx, %eax - movl dsWMask(%edx), %eax - movl dsMaxChainLen(%edx), %ebx - jl LastMatchGood - shrl $2, %ebx -LastMatchGood: - -/* chainlen is decremented once beforehand so that the function can */ -/* use the sign flag instead of the zero flag for the exit test. */ -/* It is then shifted into the high word, to make room for the wmask */ -/* value, which it will always accompany. */ - - decl %ebx - shll $16, %ebx - orl %eax, %ebx - movl %ebx, chainlenwmask(%esp) - -/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ - - movl dsNiceMatch(%edx), %eax - movl dsLookahead(%edx), %ebx - cmpl %eax, %ebx - jl LookaheadLess - movl %eax, %ebx -LookaheadLess: movl %ebx, nicematch(%esp) - -/* register Bytef *scan = s->window + s->strstart; */ - - movl dsWindow(%edx), %esi - movl %esi, window(%esp) - movl dsStrStart(%edx), %ebp - lea (%esi,%ebp), %edi - movl %edi, scan(%esp) - -/* Determine how many bytes the scan ptr is off from being */ -/* dword-aligned. */ - - movl %edi, %eax - negl %eax - andl $3, %eax - movl %eax, scanalign(%esp) - -/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ -/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ - - movl dsWSize(%edx), %eax - subl $MIN_LOOKAHEAD, %eax - subl %eax, %ebp - jg LimitPositive - xorl %ebp, %ebp -LimitPositive: - -/* int best_len = s->prev_length; */ - - movl dsPrevLen(%edx), %eax - movl %eax, bestlen(%esp) - -/* Store the sum of s->window + best_len in %esi locally, and in %esi. */ - - addl %eax, %esi - movl %esi, windowbestlen(%esp) - -/* register ush scan_start = *(ushf*)scan; */ -/* register ush scan_end = *(ushf*)(scan+best_len-1); */ -/* Posf *prev = s->prev; */ - - movzwl (%edi), %ebx - movl %ebx, scanstart(%esp) - movzwl -1(%edi,%eax), %ebx - movl %ebx, scanend(%esp) - movl dsPrev(%edx), %edi - -/* Jump into the main loop. */ - - movl chainlenwmask(%esp), %edx - jmp LoopEntry - -.balign 16 - -/* do { - * match = s->window + cur_match; - * if (*(ushf*)(match+best_len-1) != scan_end || - * *(ushf*)match != scan_start) continue; - * [...] - * } while ((cur_match = prev[cur_match & wmask]) > limit - * && --chain_length != 0); - * - * Here is the inner loop of the function. The function will spend the - * majority of its time in this loop, and majority of that time will - * be spent in the first ten instructions. - * - * Within this loop: - * %ebx = scanend - * %ecx = curmatch - * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) - * %esi = windowbestlen - i.e., (window + bestlen) - * %edi = prev - * %ebp = limit - */ -LookupLoop: - andl %edx, %ecx - movzwl (%edi,%ecx,2), %ecx - cmpl %ebp, %ecx - jbe LeaveNow - subl $0x00010000, %edx - js LeaveNow -LoopEntry: movzwl -1(%esi,%ecx), %eax - cmpl %ebx, %eax - jnz LookupLoop - movl window(%esp), %eax - movzwl (%eax,%ecx), %eax - cmpl scanstart(%esp), %eax - jnz LookupLoop - -/* Store the current value of chainlen. */ - - movl %edx, chainlenwmask(%esp) - -/* Point %edi to the string under scrutiny, and %esi to the string we */ -/* are hoping to match it up with. In actuality, %esi and %edi are */ -/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ -/* initialized to -(MAX_MATCH_8 - scanalign). */ - - movl window(%esp), %esi - movl scan(%esp), %edi - addl %ecx, %esi - movl scanalign(%esp), %eax - movl $(-MAX_MATCH_8), %edx - lea MAX_MATCH_8(%edi,%eax), %edi - lea MAX_MATCH_8(%esi,%eax), %esi - -/* Test the strings for equality, 8 bytes at a time. At the end, - * adjust %edx so that it is offset to the exact byte that mismatched. - * - * We already know at this point that the first three bytes of the - * strings match each other, and they can be safely passed over before - * starting the compare loop. So what this code does is skip over 0-3 - * bytes, as much as necessary in order to dword-align the %edi - * pointer. (%esi will still be misaligned three times out of four.) - * - * It should be confessed that this loop usually does not represent - * much of the total running time. Replacing it with a more - * straightforward "rep cmpsb" would not drastically degrade - * performance. - */ -LoopCmps: - movl (%esi,%edx), %eax - xorl (%edi,%edx), %eax - jnz LeaveLoopCmps - movl 4(%esi,%edx), %eax - xorl 4(%edi,%edx), %eax - jnz LeaveLoopCmps4 - addl $8, %edx - jnz LoopCmps - jmp LenMaximum -LeaveLoopCmps4: addl $4, %edx -LeaveLoopCmps: testl $0x0000FFFF, %eax - jnz LenLower - addl $2, %edx - shrl $16, %eax -LenLower: subb $1, %al - adcl $0, %edx - -/* Calculate the length of the match. If it is longer than MAX_MATCH, */ -/* then automatically accept it as the best possible match and leave. */ - - lea (%edi,%edx), %eax - movl scan(%esp), %edi - subl %edi, %eax - cmpl $MAX_MATCH, %eax - jge LenMaximum - -/* If the length of the match is not longer than the best match we */ -/* have so far, then forget it and return to the lookup loop. */ - - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - cmpl %ebx, %eax - jg LongerMatch - movl windowbestlen(%esp), %esi - movl dsPrev(%edx), %edi - movl scanend(%esp), %ebx - movl chainlenwmask(%esp), %edx - jmp LookupLoop - -/* s->match_start = cur_match; */ -/* best_len = len; */ -/* if (len >= nice_match) break; */ -/* scan_end = *(ushf*)(scan+best_len-1); */ - -LongerMatch: movl nicematch(%esp), %ebx - movl %eax, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - cmpl %ebx, %eax - jge LeaveNow - movl window(%esp), %esi - addl %eax, %esi - movl %esi, windowbestlen(%esp) - movzwl -1(%edi,%eax), %ebx - movl dsPrev(%edx), %edi - movl %ebx, scanend(%esp) - movl chainlenwmask(%esp), %edx - jmp LookupLoop - -/* Accept the current string, with the maximum possible length. */ - -LenMaximum: movl deflatestate(%esp), %edx - movl $MAX_MATCH, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - -/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ -/* return s->lookahead; */ - -LeaveNow: - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - movl dsLookahead(%edx), %eax - cmpl %eax, %ebx - jg LookaheadRet - movl %ebx, %eax -LookaheadRet: - -/* Restore the stack and return from whence we came. */ - - addl $LocalVarsSize, %esp - .cfi_def_cfa_offset 20 - popl %ebx - .cfi_def_cfa_offset 16 - popl %esi - .cfi_def_cfa_offset 12 - popl %edi - .cfi_def_cfa_offset 8 - popl %ebp - .cfi_def_cfa_offset 4 -.cfi_endproc -match_init: ret diff --git a/src/dependencies/zlib-1.2.11/contrib/inflate86/inffas86.c b/src/dependencies/zlib-1.2.11/contrib/inflate86/inffas86.c deleted file mode 100644 index 7292f67..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/inflate86/inffas86.c +++ /dev/null @@ -1,1157 +0,0 @@ -/* inffas86.c is a hand tuned assembler version of - * - * inffast.c -- fast decoding - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Copyright (C) 2003 Chris Anderson - * Please use the copyright conditions above. - * - * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also - * slightly quicker on x86 systems because, instead of using rep movsb to copy - * data, it uses rep movsw, which moves data in 2-byte chunks instead of single - * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates - * from http://fedora.linux.duke.edu/fc1_x86_64 - * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with - * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version, - * when decompressing mozilla-source-1.3.tar.gz. - * - * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from - * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at - * the moment. I have successfully compiled and tested this code with gcc2.96, - * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S - * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX - * enabled. I will attempt to merge the MMX code into this version. Newer - * versions of this and inffast.S can be found at - * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* Mark Adler's comments from inffast.c: */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - struct inffast_ar { -/* 64 32 x86 x86_64 */ -/* ar offset register */ -/* 0 0 */ void *esp; /* esp save */ -/* 8 4 */ void *ebp; /* ebp save */ -/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */ -/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */ -/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */ -/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */ -/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */ -/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */ -/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */ -/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */ -/* 80 40 */ unsigned long hold; /* edx rdx local strm->hold */ -/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */ -/* 92 48 */ unsigned wsize; /* window size */ -/* 96 52 */ unsigned write; /* window write index */ -/*100 56 */ unsigned lmask; /* r12 mask for lcode */ -/*104 60 */ unsigned dmask; /* r13 mask for dcode */ -/*108 64 */ unsigned len; /* r14 match length */ -/*112 68 */ unsigned dist; /* r15 match distance */ -/*116 72 */ unsigned status; /* set when state chng*/ - } ar; - -#if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) -#define PAD_AVAIL_IN 6 -#define PAD_AVAIL_OUT 258 -#else -#define PAD_AVAIL_IN 5 -#define PAD_AVAIL_OUT 257 -#endif - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - ar.in = strm->next_in; - ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN); - ar.out = strm->next_out; - ar.beg = ar.out - (start - strm->avail_out); - ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT); - ar.wsize = state->wsize; - ar.write = state->wnext; - ar.window = state->window; - ar.hold = state->hold; - ar.bits = state->bits; - ar.lcode = state->lencode; - ar.dcode = state->distcode; - ar.lmask = (1U << state->lenbits) - 1; - ar.dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - /* align in on 1/2 hold size boundary */ - while (((unsigned long)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) { - ar.hold += (unsigned long)*ar.in++ << ar.bits; - ar.bits += 8; - } - -#if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) - __asm__ __volatile__ ( -" leaq %0, %%rax\n" -" movq %%rbp, 8(%%rax)\n" /* save regs rbp and rsp */ -" movq %%rsp, (%%rax)\n" -" movq %%rax, %%rsp\n" /* make rsp point to &ar */ -" movq 16(%%rsp), %%rsi\n" /* rsi = in */ -" movq 32(%%rsp), %%rdi\n" /* rdi = out */ -" movq 24(%%rsp), %%r9\n" /* r9 = last */ -" movq 48(%%rsp), %%r10\n" /* r10 = end */ -" movq 64(%%rsp), %%rbp\n" /* rbp = lcode */ -" movq 72(%%rsp), %%r11\n" /* r11 = dcode */ -" movq 80(%%rsp), %%rdx\n" /* rdx = hold */ -" movl 88(%%rsp), %%ebx\n" /* ebx = bits */ -" movl 100(%%rsp), %%r12d\n" /* r12d = lmask */ -" movl 104(%%rsp), %%r13d\n" /* r13d = dmask */ - /* r14d = len */ - /* r15d = dist */ -" cld\n" -" cmpq %%rdi, %%r10\n" -" je .L_one_time\n" /* if only one decode left */ -" cmpq %%rsi, %%r9\n" -" je .L_one_time\n" -" jmp .L_do_loop\n" - -".L_one_time:\n" -" movq %%r12, %%r8\n" /* r8 = lmask */ -" cmpb $32, %%bl\n" -" ja .L_get_length_code_one_time\n" - -" lodsl\n" /* eax = *(uint *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $32, %%bl\n" /* bits += 32 */ -" shlq %%cl, %%rax\n" -" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ -" jmp .L_get_length_code_one_time\n" - -".align 32,0x90\n" -".L_while_test:\n" -" cmpq %%rdi, %%r10\n" -" jbe .L_break_loop\n" -" cmpq %%rsi, %%r9\n" -" jbe .L_break_loop\n" - -".L_do_loop:\n" -" movq %%r12, %%r8\n" /* r8 = lmask */ -" cmpb $32, %%bl\n" -" ja .L_get_length_code\n" /* if (32 < bits) */ - -" lodsl\n" /* eax = *(uint *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $32, %%bl\n" /* bits += 32 */ -" shlq %%cl, %%rax\n" -" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ - -".L_get_length_code:\n" -" andq %%rdx, %%r8\n" /* r8 &= hold */ -" movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */ - -" movb %%ah, %%cl\n" /* cl = this.bits */ -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrq %%cl, %%rdx\n" /* hold >>= this.bits */ - -" testb %%al, %%al\n" -" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ - -" movq %%r12, %%r8\n" /* r8 = lmask */ -" shrl $16, %%eax\n" /* output this.val char */ -" stosb\n" - -".L_get_length_code_one_time:\n" -" andq %%rdx, %%r8\n" /* r8 &= hold */ -" movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */ - -".L_dolen:\n" -" movb %%ah, %%cl\n" /* cl = this.bits */ -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrq %%cl, %%rdx\n" /* hold >>= this.bits */ - -" testb %%al, %%al\n" -" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ - -" shrl $16, %%eax\n" /* output this.val char */ -" stosb\n" -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_length_base:\n" -" movl %%eax, %%r14d\n" /* len = this */ -" shrl $16, %%r14d\n" /* len = this.val */ -" movb %%al, %%cl\n" - -" testb $16, %%al\n" -" jz .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */ -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_decode_distance\n" /* if (!op) */ - -".L_add_bits_to_len:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrq %%cl, %%rdx\n" -" addl %%eax, %%r14d\n" /* len += hold & mask[op] */ - -".L_decode_distance:\n" -" movq %%r13, %%r8\n" /* r8 = dmask */ -" cmpb $32, %%bl\n" -" ja .L_get_distance_code\n" /* if (32 < bits) */ - -" lodsl\n" /* eax = *(uint *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $32, %%bl\n" /* bits += 32 */ -" shlq %%cl, %%rax\n" -" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ - -".L_get_distance_code:\n" -" andq %%rdx, %%r8\n" /* r8 &= hold */ -" movl (%%r11,%%r8,4), %%eax\n" /* eax = dcode[hold & dmask] */ - -".L_dodist:\n" -" movl %%eax, %%r15d\n" /* dist = this */ -" shrl $16, %%r15d\n" /* dist = this.val */ -" movb %%ah, %%cl\n" -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrq %%cl, %%rdx\n" /* hold >>= this.bits */ -" movb %%al, %%cl\n" /* cl = this.op */ - -" testb $16, %%al\n" /* if ((op & 16) == 0) */ -" jz .L_test_for_second_level_dist\n" -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_check_dist_one\n" - -".L_add_bits_to_dist:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" /* (1 << op) - 1 */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrq %%cl, %%rdx\n" -" addl %%eax, %%r15d\n" /* dist += hold & ((1 << op) - 1) */ - -".L_check_window:\n" -" movq %%rsi, %%r8\n" /* save in so from can use it's reg */ -" movq %%rdi, %%rax\n" -" subq 40(%%rsp), %%rax\n" /* nbytes = out - beg */ - -" cmpl %%r15d, %%eax\n" -" jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */ - -" movl %%r14d, %%ecx\n" /* ecx = len */ -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = out - dist */ - -" sarl %%ecx\n" -" jnc .L_copy_two\n" /* if len % 2 == 0 */ - -" rep movsw\n" -" movb (%%rsi), %%al\n" -" movb %%al, (%%rdi)\n" -" incq %%rdi\n" - -" movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */ -" jmp .L_while_test\n" - -".L_copy_two:\n" -" rep movsw\n" -" movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */ -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_check_dist_one:\n" -" cmpl $1, %%r15d\n" /* if dist 1, is a memset */ -" jne .L_check_window\n" -" cmpq %%rdi, 40(%%rsp)\n" /* if out == beg, outside window */ -" je .L_check_window\n" - -" movl %%r14d, %%ecx\n" /* ecx = len */ -" movb -1(%%rdi), %%al\n" -" movb %%al, %%ah\n" - -" sarl %%ecx\n" -" jnc .L_set_two\n" -" movb %%al, (%%rdi)\n" -" incq %%rdi\n" - -".L_set_two:\n" -" rep stosw\n" -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_second_level_length:\n" -" testb $64, %%al\n" -" jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl %%r14d, %%eax\n" /* eax += len */ -" movl (%%rbp,%%rax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ -" jmp .L_dolen\n" - -".align 32,0x90\n" -".L_test_for_second_level_dist:\n" -" testb $64, %%al\n" -" jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl %%r15d, %%eax\n" /* eax += dist */ -" movl (%%r11,%%rax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ -" jmp .L_dodist\n" - -".align 32,0x90\n" -".L_clip_window:\n" -" movl %%eax, %%ecx\n" /* ecx = nbytes */ -" movl 92(%%rsp), %%eax\n" /* eax = wsize, prepare for dist cmp */ -" negl %%ecx\n" /* nbytes = -nbytes */ - -" cmpl %%r15d, %%eax\n" -" jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */ - -" addl %%r15d, %%ecx\n" /* nbytes = dist - nbytes */ -" cmpl $0, 96(%%rsp)\n" -" jne .L_wrap_around_window\n" /* if (write != 0) */ - -" movq 56(%%rsp), %%rsi\n" /* from = window */ -" subl %%ecx, %%eax\n" /* eax -= nbytes */ -" addq %%rax, %%rsi\n" /* from += wsize - nbytes */ - -" movl %%r14d, %%eax\n" /* eax = len */ -" cmpl %%ecx, %%r14d\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* eax -= nbytes */ -" rep movsb\n" -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = &out[ -dist ] */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_wrap_around_window:\n" -" movl 96(%%rsp), %%eax\n" /* eax = write */ -" cmpl %%eax, %%ecx\n" -" jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */ - -" movl 92(%%rsp), %%esi\n" /* from = wsize */ -" addq 56(%%rsp), %%rsi\n" /* from += window */ -" addq %%rax, %%rsi\n" /* from += write */ -" subq %%rcx, %%rsi\n" /* from -= nbytes */ -" subl %%eax, %%ecx\n" /* nbytes -= write */ - -" movl %%r14d, %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movq 56(%%rsp), %%rsi\n" /* from = window */ -" movl 96(%%rsp), %%ecx\n" /* nbytes = write */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = out - dist */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_contiguous_in_window:\n" -" movq 56(%%rsp), %%rsi\n" /* rsi = window */ -" addq %%rax, %%rsi\n" -" subq %%rcx, %%rsi\n" /* from += write - nbytes */ - -" movl %%r14d, %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = out - dist */ -" jmp .L_do_copy\n" /* if (nbytes >= len) */ - -".align 32,0x90\n" -".L_do_copy:\n" -" movl %%eax, %%ecx\n" /* ecx = len */ -" rep movsb\n" - -" movq %%r8, %%rsi\n" /* move in back to %esi, toss from */ -" jmp .L_while_test\n" - -".L_test_for_end_of_block:\n" -" testb $32, %%al\n" -" jz .L_invalid_literal_length_code\n" -" movl $1, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_literal_length_code:\n" -" movl $2, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_code:\n" -" movl $3, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_too_far:\n" -" movl $4, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_break_loop:\n" -" movl $0, 116(%%rsp)\n" - -".L_break_loop_with_status:\n" -/* put in, out, bits, and hold back into ar and pop esp */ -" movq %%rsi, 16(%%rsp)\n" /* in */ -" movq %%rdi, 32(%%rsp)\n" /* out */ -" movl %%ebx, 88(%%rsp)\n" /* bits */ -" movq %%rdx, 80(%%rsp)\n" /* hold */ -" movq (%%rsp), %%rax\n" /* restore rbp and rsp */ -" movq 8(%%rsp), %%rbp\n" -" movq %%rax, %%rsp\n" - : - : "m" (ar) - : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", - "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" - ); -#elif ( defined( __GNUC__ ) || defined( __ICC ) ) && defined( __i386 ) - __asm__ __volatile__ ( -" leal %0, %%eax\n" -" movl %%esp, (%%eax)\n" /* save esp, ebp */ -" movl %%ebp, 4(%%eax)\n" -" movl %%eax, %%esp\n" -" movl 8(%%esp), %%esi\n" /* esi = in */ -" movl 16(%%esp), %%edi\n" /* edi = out */ -" movl 40(%%esp), %%edx\n" /* edx = hold */ -" movl 44(%%esp), %%ebx\n" /* ebx = bits */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ - -" cld\n" -" jmp .L_do_loop\n" - -".align 32,0x90\n" -".L_while_test:\n" -" cmpl %%edi, 24(%%esp)\n" /* out < end */ -" jbe .L_break_loop\n" -" cmpl %%esi, 12(%%esp)\n" /* in < last */ -" jbe .L_break_loop\n" - -".L_do_loop:\n" -" cmpb $15, %%bl\n" -" ja .L_get_length_code\n" /* if (15 < bits) */ - -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ - -".L_get_length_code:\n" -" movl 56(%%esp), %%eax\n" /* eax = lmask */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[hold & lmask] */ - -".L_dolen:\n" -" movb %%ah, %%cl\n" /* cl = this.bits */ -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrl %%cl, %%edx\n" /* hold >>= this.bits */ - -" testb %%al, %%al\n" -" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ - -" shrl $16, %%eax\n" /* output this.val char */ -" stosb\n" -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_length_base:\n" -" movl %%eax, %%ecx\n" /* len = this */ -" shrl $16, %%ecx\n" /* len = this.val */ -" movl %%ecx, 64(%%esp)\n" /* save len */ -" movb %%al, %%cl\n" - -" testb $16, %%al\n" -" jz .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */ -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_decode_distance\n" /* if (!op) */ -" cmpb %%cl, %%bl\n" -" jae .L_add_bits_to_len\n" /* if (op <= bits) */ - -" movb %%cl, %%ch\n" /* stash op in ch, freeing cl */ -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ -" movb %%ch, %%cl\n" /* move op back to ecx */ - -".L_add_bits_to_len:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrl %%cl, %%edx\n" -" addl %%eax, 64(%%esp)\n" /* len += hold & mask[op] */ - -".L_decode_distance:\n" -" cmpb $15, %%bl\n" -" ja .L_get_distance_code\n" /* if (15 < bits) */ - -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ - -".L_get_distance_code:\n" -" movl 60(%%esp), %%eax\n" /* eax = dmask */ -" movl 36(%%esp), %%ecx\n" /* ecx = dcode */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" movl (%%ecx,%%eax,4), %%eax\n"/* eax = dcode[hold & dmask] */ - -".L_dodist:\n" -" movl %%eax, %%ebp\n" /* dist = this */ -" shrl $16, %%ebp\n" /* dist = this.val */ -" movb %%ah, %%cl\n" -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrl %%cl, %%edx\n" /* hold >>= this.bits */ -" movb %%al, %%cl\n" /* cl = this.op */ - -" testb $16, %%al\n" /* if ((op & 16) == 0) */ -" jz .L_test_for_second_level_dist\n" -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_check_dist_one\n" -" cmpb %%cl, %%bl\n" -" jae .L_add_bits_to_dist\n" /* if (op <= bits) 97.6% */ - -" movb %%cl, %%ch\n" /* stash op in ch, freeing cl */ -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ -" movb %%ch, %%cl\n" /* move op back to ecx */ - -".L_add_bits_to_dist:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" /* (1 << op) - 1 */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrl %%cl, %%edx\n" -" addl %%eax, %%ebp\n" /* dist += hold & ((1 << op) - 1) */ - -".L_check_window:\n" -" movl %%esi, 8(%%esp)\n" /* save in so from can use it's reg */ -" movl %%edi, %%eax\n" -" subl 20(%%esp), %%eax\n" /* nbytes = out - beg */ - -" cmpl %%ebp, %%eax\n" -" jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */ - -" movl 64(%%esp), %%ecx\n" /* ecx = len */ -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ - -" sarl %%ecx\n" -" jnc .L_copy_two\n" /* if len % 2 == 0 */ - -" rep movsw\n" -" movb (%%esi), %%al\n" -" movb %%al, (%%edi)\n" -" incl %%edi\n" - -" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".L_copy_two:\n" -" rep movsw\n" -" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_check_dist_one:\n" -" cmpl $1, %%ebp\n" /* if dist 1, is a memset */ -" jne .L_check_window\n" -" cmpl %%edi, 20(%%esp)\n" -" je .L_check_window\n" /* out == beg, if outside window */ - -" movl 64(%%esp), %%ecx\n" /* ecx = len */ -" movb -1(%%edi), %%al\n" -" movb %%al, %%ah\n" - -" sarl %%ecx\n" -" jnc .L_set_two\n" -" movb %%al, (%%edi)\n" -" incl %%edi\n" - -".L_set_two:\n" -" rep stosw\n" -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_second_level_length:\n" -" testb $64, %%al\n" -" jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl 64(%%esp), %%eax\n" /* eax += len */ -" movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ -" jmp .L_dolen\n" - -".align 32,0x90\n" -".L_test_for_second_level_dist:\n" -" testb $64, %%al\n" -" jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl %%ebp, %%eax\n" /* eax += dist */ -" movl 36(%%esp), %%ecx\n" /* ecx = dcode */ -" movl (%%ecx,%%eax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ -" jmp .L_dodist\n" - -".align 32,0x90\n" -".L_clip_window:\n" -" movl %%eax, %%ecx\n" -" movl 48(%%esp), %%eax\n" /* eax = wsize */ -" negl %%ecx\n" /* nbytes = -nbytes */ -" movl 28(%%esp), %%esi\n" /* from = window */ - -" cmpl %%ebp, %%eax\n" -" jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */ - -" addl %%ebp, %%ecx\n" /* nbytes = dist - nbytes */ -" cmpl $0, 52(%%esp)\n" -" jne .L_wrap_around_window\n" /* if (write != 0) */ - -" subl %%ecx, %%eax\n" -" addl %%eax, %%esi\n" /* from += wsize - nbytes */ - -" movl 64(%%esp), %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_wrap_around_window:\n" -" movl 52(%%esp), %%eax\n" /* eax = write */ -" cmpl %%eax, %%ecx\n" -" jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */ - -" addl 48(%%esp), %%esi\n" /* from += wsize */ -" addl %%eax, %%esi\n" /* from += write */ -" subl %%ecx, %%esi\n" /* from -= nbytes */ -" subl %%eax, %%ecx\n" /* nbytes -= write */ - -" movl 64(%%esp), %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl 28(%%esp), %%esi\n" /* from = window */ -" movl 52(%%esp), %%ecx\n" /* nbytes = write */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_contiguous_in_window:\n" -" addl %%eax, %%esi\n" -" subl %%ecx, %%esi\n" /* from += write - nbytes */ - -" movl 64(%%esp), %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ -" jmp .L_do_copy\n" /* if (nbytes >= len) */ - -".align 32,0x90\n" -".L_do_copy:\n" -" movl %%eax, %%ecx\n" -" rep movsb\n" - -" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".L_test_for_end_of_block:\n" -" testb $32, %%al\n" -" jz .L_invalid_literal_length_code\n" -" movl $1, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_literal_length_code:\n" -" movl $2, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_code:\n" -" movl $3, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_too_far:\n" -" movl 8(%%esp), %%esi\n" -" movl $4, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_break_loop:\n" -" movl $0, 72(%%esp)\n" - -".L_break_loop_with_status:\n" -/* put in, out, bits, and hold back into ar and pop esp */ -" movl %%esi, 8(%%esp)\n" /* save in */ -" movl %%edi, 16(%%esp)\n" /* save out */ -" movl %%ebx, 44(%%esp)\n" /* save bits */ -" movl %%edx, 40(%%esp)\n" /* save hold */ -" movl 4(%%esp), %%ebp\n" /* restore esp, ebp */ -" movl (%%esp), %%esp\n" - : - : "m" (ar) - : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi" - ); -#elif defined( _MSC_VER ) && ! defined( _M_AMD64 ) - __asm { - lea eax, ar - mov [eax], esp /* save esp, ebp */ - mov [eax+4], ebp - mov esp, eax - mov esi, [esp+8] /* esi = in */ - mov edi, [esp+16] /* edi = out */ - mov edx, [esp+40] /* edx = hold */ - mov ebx, [esp+44] /* ebx = bits */ - mov ebp, [esp+32] /* ebp = lcode */ - - cld - jmp L_do_loop - -ALIGN 4 -L_while_test: - cmp [esp+24], edi - jbe L_break_loop - cmp [esp+12], esi - jbe L_break_loop - -L_do_loop: - cmp bl, 15 - ja L_get_length_code /* if (15 < bits) */ - - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - -L_get_length_code: - mov eax, [esp+56] /* eax = lmask */ - and eax, edx /* eax &= hold */ - mov eax, [ebp+eax*4] /* eax = lcode[hold & lmask] */ - -L_dolen: - mov cl, ah /* cl = this.bits */ - sub bl, ah /* bits -= this.bits */ - shr edx, cl /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base /* if (op != 0) 45.7% */ - - shr eax, 16 /* output this.val char */ - stosb - jmp L_while_test - -ALIGN 4 -L_test_for_length_base: - mov ecx, eax /* len = this */ - shr ecx, 16 /* len = this.val */ - mov [esp+64], ecx /* save len */ - mov cl, al - - test al, 16 - jz L_test_for_second_level_length /* if ((op & 16) == 0) 8% */ - and cl, 15 /* op &= 15 */ - jz L_decode_distance /* if (!op) */ - cmp bl, cl - jae L_add_bits_to_len /* if (op <= bits) */ - - mov ch, cl /* stash op in ch, freeing cl */ - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - mov cl, ch /* move op back to ecx */ - -L_add_bits_to_len: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx /* eax &= hold */ - shr edx, cl - add [esp+64], eax /* len += hold & mask[op] */ - -L_decode_distance: - cmp bl, 15 - ja L_get_distance_code /* if (15 < bits) */ - - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - -L_get_distance_code: - mov eax, [esp+60] /* eax = dmask */ - mov ecx, [esp+36] /* ecx = dcode */ - and eax, edx /* eax &= hold */ - mov eax, [ecx+eax*4]/* eax = dcode[hold & dmask] */ - -L_dodist: - mov ebp, eax /* dist = this */ - shr ebp, 16 /* dist = this.val */ - mov cl, ah - sub bl, ah /* bits -= this.bits */ - shr edx, cl /* hold >>= this.bits */ - mov cl, al /* cl = this.op */ - - test al, 16 /* if ((op & 16) == 0) */ - jz L_test_for_second_level_dist - and cl, 15 /* op &= 15 */ - jz L_check_dist_one - cmp bl, cl - jae L_add_bits_to_dist /* if (op <= bits) 97.6% */ - - mov ch, cl /* stash op in ch, freeing cl */ - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - mov cl, ch /* move op back to ecx */ - -L_add_bits_to_dist: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax /* (1 << op) - 1 */ - and eax, edx /* eax &= hold */ - shr edx, cl - add ebp, eax /* dist += hold & ((1 << op) - 1) */ - -L_check_window: - mov [esp+8], esi /* save in so from can use it's reg */ - mov eax, edi - sub eax, [esp+20] /* nbytes = out - beg */ - - cmp eax, ebp - jb L_clip_window /* if (dist > nbytes) 4.2% */ - - mov ecx, [esp+64] /* ecx = len */ - mov esi, edi - sub esi, ebp /* from = out - dist */ - - sar ecx, 1 - jnc L_copy_two - - rep movsw - mov al, [esi] - mov [edi], al - inc edi - - mov esi, [esp+8] /* move in back to %esi, toss from */ - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -L_copy_two: - rep movsw - mov esi, [esp+8] /* move in back to %esi, toss from */ - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp ebp, 1 /* if dist 1, is a memset */ - jne L_check_window - cmp [esp+20], edi - je L_check_window /* out == beg, if outside window */ - - mov ecx, [esp+64] /* ecx = len */ - mov al, [edi-1] - mov ah, al - - sar ecx, 1 - jnc L_set_two - mov [edi], al /* memset out with from[-1] */ - inc edi - -L_set_two: - rep stosw - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - test al, 64 - jnz L_test_for_end_of_block /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx /* eax &= hold */ - add eax, [esp+64] /* eax += len */ - mov eax, [ebp+eax*4] /* eax = lcode[val+(hold&mask[op])]*/ - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - test al, 64 - jnz L_invalid_distance_code /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx /* eax &= hold */ - add eax, ebp /* eax += dist */ - mov ecx, [esp+36] /* ecx = dcode */ - mov eax, [ecx+eax*4] /* eax = dcode[val+(hold&mask[op])]*/ - jmp L_dodist - -ALIGN 4 -L_clip_window: - mov ecx, eax - mov eax, [esp+48] /* eax = wsize */ - neg ecx /* nbytes = -nbytes */ - mov esi, [esp+28] /* from = window */ - - cmp eax, ebp - jb L_invalid_distance_too_far /* if (dist > wsize) */ - - add ecx, ebp /* nbytes = dist - nbytes */ - cmp dword ptr [esp+52], 0 - jne L_wrap_around_window /* if (write != 0) */ - - sub eax, ecx - add esi, eax /* from += wsize - nbytes */ - - mov eax, [esp+64] /* eax = len */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, edi - sub esi, ebp /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_wrap_around_window: - mov eax, [esp+52] /* eax = write */ - cmp ecx, eax - jbe L_contiguous_in_window /* if (write >= nbytes) */ - - add esi, [esp+48] /* from += wsize */ - add esi, eax /* from += write */ - sub esi, ecx /* from -= nbytes */ - sub ecx, eax /* nbytes -= write */ - - mov eax, [esp+64] /* eax = len */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, [esp+28] /* from = window */ - mov ecx, [esp+52] /* nbytes = write */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, edi - sub esi, ebp /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_contiguous_in_window: - add esi, eax - sub esi, ecx /* from += write - nbytes */ - - mov eax, [esp+64] /* eax = len */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, edi - sub esi, ebp /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_do_copy: - mov ecx, eax - rep movsb - - mov esi, [esp+8] /* move in back to %esi, toss from */ - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -L_test_for_end_of_block: - test al, 32 - jz L_invalid_literal_length_code - mov dword ptr [esp+72], 1 - jmp L_break_loop_with_status - -L_invalid_literal_length_code: - mov dword ptr [esp+72], 2 - jmp L_break_loop_with_status - -L_invalid_distance_code: - mov dword ptr [esp+72], 3 - jmp L_break_loop_with_status - -L_invalid_distance_too_far: - mov esi, [esp+4] - mov dword ptr [esp+72], 4 - jmp L_break_loop_with_status - -L_break_loop: - mov dword ptr [esp+72], 0 - -L_break_loop_with_status: -/* put in, out, bits, and hold back into ar and pop esp */ - mov [esp+8], esi /* save in */ - mov [esp+16], edi /* save out */ - mov [esp+44], ebx /* save bits */ - mov [esp+40], edx /* save hold */ - mov ebp, [esp+4] /* restore esp, ebp */ - mov esp, [esp] - } -#else -#error "x86 architecture not defined" -#endif - - if (ar.status > 1) { - if (ar.status == 2) - strm->msg = "invalid literal/length code"; - else if (ar.status == 3) - strm->msg = "invalid distance code"; - else - strm->msg = "invalid distance too far back"; - state->mode = BAD; - } - else if ( ar.status == 1 ) { - state->mode = TYPE; - } - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - ar.len = ar.bits >> 3; - ar.in -= ar.len; - ar.bits -= ar.len << 3; - ar.hold &= (1U << ar.bits) - 1; - - /* update state and return */ - strm->next_in = ar.in; - strm->next_out = ar.out; - strm->avail_in = (unsigned)(ar.in < ar.last ? - PAD_AVAIL_IN + (ar.last - ar.in) : - PAD_AVAIL_IN - (ar.in - ar.last)); - strm->avail_out = (unsigned)(ar.out < ar.end ? - PAD_AVAIL_OUT + (ar.end - ar.out) : - PAD_AVAIL_OUT - (ar.out - ar.end)); - state->hold = ar.hold; - state->bits = ar.bits; - return; -} - diff --git a/src/dependencies/zlib-1.2.11/contrib/inflate86/inffast.S b/src/dependencies/zlib-1.2.11/contrib/inflate86/inffast.S deleted file mode 100644 index 2245a29..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/inflate86/inffast.S +++ /dev/null @@ -1,1368 +0,0 @@ -/* - * inffast.S is a hand tuned assembler version of: - * - * inffast.c -- fast decoding - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Copyright (C) 2003 Chris Anderson - * Please use the copyright conditions above. - * - * This version (Jan-23-2003) of inflate_fast was coded and tested under - * GNU/Linux on a pentium 3, using the gcc-3.2 compiler distribution. On that - * machine, I found that gzip style archives decompressed about 20% faster than - * the gcc-3.2 -O3 -fomit-frame-pointer compiled version. Your results will - * depend on how large of a buffer is used for z_stream.next_in & next_out - * (8K-32K worked best for my 256K cpu cache) and how much overhead there is in - * stream processing I/O and crc32/addler32. In my case, this routine used - * 70% of the cpu time and crc32 used 20%. - * - * I am confident that this version will work in the general case, but I have - * not tested a wide variety of datasets or a wide variety of platforms. - * - * Jan-24-2003 -- Added -DUSE_MMX define for slightly faster inflating. - * It should be a runtime flag instead of compile time flag... - * - * Jan-26-2003 -- Added runtime check for MMX support with cpuid instruction. - * With -DUSE_MMX, only MMX code is compiled. With -DNO_MMX, only non-MMX code - * is compiled. Without either option, runtime detection is enabled. Runtime - * detection should work on all modern cpus and the recomended algorithm (flip - * ID bit on eflags and then use the cpuid instruction) is used in many - * multimedia applications. Tested under win2k with gcc-2.95 and gas-2.12 - * distributed with cygwin3. Compiling with gcc-2.95 -c inffast.S -o - * inffast.obj generates a COFF object which can then be linked with MSVC++ - * compiled code. Tested under FreeBSD 4.7 with gcc-2.95. - * - * Jan-28-2003 -- Tested Athlon XP... MMX mode is slower than no MMX (and - * slower than compiler generated code). Adjusted cpuid check to use the MMX - * code only for Pentiums < P4 until I have more data on the P4. Speed - * improvment is only about 15% on the Athlon when compared with code generated - * with MSVC++. Not sure yet, but I think the P4 will also be slower using the - * MMX mode because many of it's x86 ALU instructions execute in .5 cycles and - * have less latency than MMX ops. Added code to buffer the last 11 bytes of - * the input stream since the MMX code grabs bits in chunks of 32, which - * differs from the inffast.c algorithm. I don't think there would have been - * read overruns where a page boundary was crossed (a segfault), but there - * could have been overruns when next_in ends on unaligned memory (unintialized - * memory read). - * - * Mar-13-2003 -- P4 MMX is slightly slower than P4 NO_MMX. I created a C - * version of the non-MMX code so that it doesn't depend on zstrm and zstate - * structure offsets which are hard coded in this file. This was last tested - * with zlib-1.2.0 which is currently in beta testing, newer versions of this - * and inffas86.c can be found at http://www.eetbeetee.com/zlib/ and - * http://www.charm.net/~christop/zlib/ - */ - - -/* - * if you have underscore linking problems (_inflate_fast undefined), try - * using -DGAS_COFF - */ -#if ! defined( GAS_COFF ) && ! defined( GAS_ELF ) - -#if defined( WIN32 ) || defined( __CYGWIN__ ) -#define GAS_COFF /* windows object format */ -#else -#define GAS_ELF -#endif - -#endif /* ! GAS_COFF && ! GAS_ELF */ - - -#if defined( GAS_COFF ) - -/* coff externals have underscores */ -#define inflate_fast _inflate_fast -#define inflate_fast_use_mmx _inflate_fast_use_mmx - -#endif /* GAS_COFF */ - - -.file "inffast.S" - -.globl inflate_fast - -.text -.align 4,0 -.L_invalid_literal_length_code_msg: -.string "invalid literal/length code" - -.align 4,0 -.L_invalid_distance_code_msg: -.string "invalid distance code" - -.align 4,0 -.L_invalid_distance_too_far_msg: -.string "invalid distance too far back" - -#if ! defined( NO_MMX ) -.align 4,0 -.L_mask: /* mask[N] = ( 1 << N ) - 1 */ -.long 0 -.long 1 -.long 3 -.long 7 -.long 15 -.long 31 -.long 63 -.long 127 -.long 255 -.long 511 -.long 1023 -.long 2047 -.long 4095 -.long 8191 -.long 16383 -.long 32767 -.long 65535 -.long 131071 -.long 262143 -.long 524287 -.long 1048575 -.long 2097151 -.long 4194303 -.long 8388607 -.long 16777215 -.long 33554431 -.long 67108863 -.long 134217727 -.long 268435455 -.long 536870911 -.long 1073741823 -.long 2147483647 -.long 4294967295 -#endif /* NO_MMX */ - -.text - -/* - * struct z_stream offsets, in zlib.h - */ -#define next_in_strm 0 /* strm->next_in */ -#define avail_in_strm 4 /* strm->avail_in */ -#define next_out_strm 12 /* strm->next_out */ -#define avail_out_strm 16 /* strm->avail_out */ -#define msg_strm 24 /* strm->msg */ -#define state_strm 28 /* strm->state */ - -/* - * struct inflate_state offsets, in inflate.h - */ -#define mode_state 0 /* state->mode */ -#define wsize_state 32 /* state->wsize */ -#define write_state 40 /* state->write */ -#define window_state 44 /* state->window */ -#define hold_state 48 /* state->hold */ -#define bits_state 52 /* state->bits */ -#define lencode_state 68 /* state->lencode */ -#define distcode_state 72 /* state->distcode */ -#define lenbits_state 76 /* state->lenbits */ -#define distbits_state 80 /* state->distbits */ - -/* - * inflate_fast's activation record - */ -#define local_var_size 64 /* how much local space for vars */ -#define strm_sp 88 /* first arg: z_stream * (local_var_size + 24) */ -#define start_sp 92 /* second arg: unsigned int (local_var_size + 28) */ - -/* - * offsets for local vars on stack - */ -#define out 60 /* unsigned char* */ -#define window 56 /* unsigned char* */ -#define wsize 52 /* unsigned int */ -#define write 48 /* unsigned int */ -#define in 44 /* unsigned char* */ -#define beg 40 /* unsigned char* */ -#define buf 28 /* char[ 12 ] */ -#define len 24 /* unsigned int */ -#define last 20 /* unsigned char* */ -#define end 16 /* unsigned char* */ -#define dcode 12 /* code* */ -#define lcode 8 /* code* */ -#define dmask 4 /* unsigned int */ -#define lmask 0 /* unsigned int */ - -/* - * typedef enum inflate_mode consts, in inflate.h - */ -#define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */ -#define INFLATE_MODE_BAD 26 - - -#if ! defined( USE_MMX ) && ! defined( NO_MMX ) - -#define RUN_TIME_MMX - -#define CHECK_MMX 1 -#define DO_USE_MMX 2 -#define DONT_USE_MMX 3 - -.globl inflate_fast_use_mmx - -.data - -.align 4,0 -inflate_fast_use_mmx: /* integer flag for run time control 1=check,2=mmx,3=no */ -.long CHECK_MMX - -#if defined( GAS_ELF ) -/* elf info */ -.type inflate_fast_use_mmx,@object -.size inflate_fast_use_mmx,4 -#endif - -#endif /* RUN_TIME_MMX */ - -#if defined( GAS_COFF ) -/* coff info: scl 2 = extern, type 32 = function */ -.def inflate_fast; .scl 2; .type 32; .endef -#endif - -.text - -.align 32,0x90 -inflate_fast: - pushl %edi - pushl %esi - pushl %ebp - pushl %ebx - pushf /* save eflags (strm_sp, state_sp assumes this is 32 bits) */ - subl $local_var_size, %esp - cld - -#define strm_r %esi -#define state_r %edi - - movl strm_sp(%esp), strm_r - movl state_strm(strm_r), state_r - - /* in = strm->next_in; - * out = strm->next_out; - * last = in + strm->avail_in - 11; - * beg = out - (start - strm->avail_out); - * end = out + (strm->avail_out - 257); - */ - movl avail_in_strm(strm_r), %edx - movl next_in_strm(strm_r), %eax - - addl %eax, %edx /* avail_in += next_in */ - subl $11, %edx /* avail_in -= 11 */ - - movl %eax, in(%esp) - movl %edx, last(%esp) - - movl start_sp(%esp), %ebp - movl avail_out_strm(strm_r), %ecx - movl next_out_strm(strm_r), %ebx - - subl %ecx, %ebp /* start -= avail_out */ - negl %ebp /* start = -start */ - addl %ebx, %ebp /* start += next_out */ - - subl $257, %ecx /* avail_out -= 257 */ - addl %ebx, %ecx /* avail_out += out */ - - movl %ebx, out(%esp) - movl %ebp, beg(%esp) - movl %ecx, end(%esp) - - /* wsize = state->wsize; - * write = state->write; - * window = state->window; - * hold = state->hold; - * bits = state->bits; - * lcode = state->lencode; - * dcode = state->distcode; - * lmask = ( 1 << state->lenbits ) - 1; - * dmask = ( 1 << state->distbits ) - 1; - */ - - movl lencode_state(state_r), %eax - movl distcode_state(state_r), %ecx - - movl %eax, lcode(%esp) - movl %ecx, dcode(%esp) - - movl $1, %eax - movl lenbits_state(state_r), %ecx - shll %cl, %eax - decl %eax - movl %eax, lmask(%esp) - - movl $1, %eax - movl distbits_state(state_r), %ecx - shll %cl, %eax - decl %eax - movl %eax, dmask(%esp) - - movl wsize_state(state_r), %eax - movl write_state(state_r), %ecx - movl window_state(state_r), %edx - - movl %eax, wsize(%esp) - movl %ecx, write(%esp) - movl %edx, window(%esp) - - movl hold_state(state_r), %ebp - movl bits_state(state_r), %ebx - -#undef strm_r -#undef state_r - -#define in_r %esi -#define from_r %esi -#define out_r %edi - - movl in(%esp), in_r - movl last(%esp), %ecx - cmpl in_r, %ecx - ja .L_align_long /* if in < last */ - - addl $11, %ecx /* ecx = &in[ avail_in ] */ - subl in_r, %ecx /* ecx = avail_in */ - movl $12, %eax - subl %ecx, %eax /* eax = 12 - avail_in */ - leal buf(%esp), %edi - rep movsb /* memcpy( buf, in, avail_in ) */ - movl %eax, %ecx - xorl %eax, %eax - rep stosb /* memset( &buf[ avail_in ], 0, 12 - avail_in ) */ - leal buf(%esp), in_r /* in = buf */ - movl in_r, last(%esp) /* last = in, do just one iteration */ - jmp .L_is_aligned - - /* align in_r on long boundary */ -.L_align_long: - testl $3, in_r - jz .L_is_aligned - xorl %eax, %eax - movb (in_r), %al - incl in_r - movl %ebx, %ecx - addl $8, %ebx - shll %cl, %eax - orl %eax, %ebp - jmp .L_align_long - -.L_is_aligned: - movl out(%esp), out_r - -#if defined( NO_MMX ) - jmp .L_do_loop -#endif - -#if defined( USE_MMX ) - jmp .L_init_mmx -#endif - -/*** Runtime MMX check ***/ - -#if defined( RUN_TIME_MMX ) -.L_check_mmx: - cmpl $DO_USE_MMX, inflate_fast_use_mmx - je .L_init_mmx - ja .L_do_loop /* > 2 */ - - pushl %eax - pushl %ebx - pushl %ecx - pushl %edx - pushf - movl (%esp), %eax /* copy eflags to eax */ - xorl $0x200000, (%esp) /* try toggling ID bit of eflags (bit 21) - * to see if cpu supports cpuid... - * ID bit method not supported by NexGen but - * bios may load a cpuid instruction and - * cpuid may be disabled on Cyrix 5-6x86 */ - popf - pushf - popl %edx /* copy new eflags to edx */ - xorl %eax, %edx /* test if ID bit is flipped */ - jz .L_dont_use_mmx /* not flipped if zero */ - xorl %eax, %eax - cpuid - cmpl $0x756e6547, %ebx /* check for GenuineIntel in ebx,ecx,edx */ - jne .L_dont_use_mmx - cmpl $0x6c65746e, %ecx - jne .L_dont_use_mmx - cmpl $0x49656e69, %edx - jne .L_dont_use_mmx - movl $1, %eax - cpuid /* get cpu features */ - shrl $8, %eax - andl $15, %eax - cmpl $6, %eax /* check for Pentium family, is 0xf for P4 */ - jne .L_dont_use_mmx - testl $0x800000, %edx /* test if MMX feature is set (bit 23) */ - jnz .L_use_mmx - jmp .L_dont_use_mmx -.L_use_mmx: - movl $DO_USE_MMX, inflate_fast_use_mmx - jmp .L_check_mmx_pop -.L_dont_use_mmx: - movl $DONT_USE_MMX, inflate_fast_use_mmx -.L_check_mmx_pop: - popl %edx - popl %ecx - popl %ebx - popl %eax - jmp .L_check_mmx -#endif - - -/*** Non-MMX code ***/ - -#if defined ( NO_MMX ) || defined( RUN_TIME_MMX ) - -#define hold_r %ebp -#define bits_r %bl -#define bitslong_r %ebx - -.align 32,0x90 -.L_while_test: - /* while (in < last && out < end) - */ - cmpl out_r, end(%esp) - jbe .L_break_loop /* if (out >= end) */ - - cmpl in_r, last(%esp) - jbe .L_break_loop - -.L_do_loop: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out - * - * do { - * if (bits < 15) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * this = lcode[hold & lmask] - */ - cmpb $15, bits_r - ja .L_get_length_code /* if (15 < bits) */ - - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - -.L_get_length_code: - movl lmask(%esp), %edx /* edx = lmask */ - movl lcode(%esp), %ecx /* ecx = lcode */ - andl hold_r, %edx /* edx &= hold */ - movl (%ecx,%edx,4), %eax /* eax = lcode[hold & lmask] */ - -.L_dolen: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out - * - * dolen: - * bits -= this.bits; - * hold >>= this.bits - */ - movb %ah, %cl /* cl = this.bits */ - subb %ah, bits_r /* bits -= this.bits */ - shrl %cl, hold_r /* hold >>= this.bits */ - - /* check if op is a literal - * if (op == 0) { - * PUP(out) = this.val; - * } - */ - testb %al, %al - jnz .L_test_for_length_base /* if (op != 0) 45.7% */ - - shrl $16, %eax /* output this.val char */ - stosb - jmp .L_while_test - -.L_test_for_length_base: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = len - * - * else if (op & 16) { - * len = this.val - * op &= 15 - * if (op) { - * if (op > bits) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * len += hold & mask[op]; - * bits -= op; - * hold >>= op; - * } - */ -#define len_r %edx - movl %eax, len_r /* len = this */ - shrl $16, len_r /* len = this.val */ - movb %al, %cl - - testb $16, %al - jz .L_test_for_second_level_length /* if ((op & 16) == 0) 8% */ - andb $15, %cl /* op &= 15 */ - jz .L_save_len /* if (!op) */ - cmpb %cl, bits_r - jae .L_add_bits_to_len /* if (op <= bits) */ - - movb %cl, %ch /* stash op in ch, freeing cl */ - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - movb %ch, %cl /* move op back to ecx */ - -.L_add_bits_to_len: - movl $1, %eax - shll %cl, %eax - decl %eax - subb %cl, bits_r - andl hold_r, %eax /* eax &= hold */ - shrl %cl, hold_r - addl %eax, len_r /* len += hold & mask[op] */ - -.L_save_len: - movl len_r, len(%esp) /* save len */ -#undef len_r - -.L_decode_distance: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * - * if (bits < 15) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * this = dcode[hold & dmask]; - * dodist: - * bits -= this.bits; - * hold >>= this.bits; - * op = this.op; - */ - - cmpb $15, bits_r - ja .L_get_distance_code /* if (15 < bits) */ - - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - -.L_get_distance_code: - movl dmask(%esp), %edx /* edx = dmask */ - movl dcode(%esp), %ecx /* ecx = dcode */ - andl hold_r, %edx /* edx &= hold */ - movl (%ecx,%edx,4), %eax /* eax = dcode[hold & dmask] */ - -#define dist_r %edx -.L_dodist: - movl %eax, dist_r /* dist = this */ - shrl $16, dist_r /* dist = this.val */ - movb %ah, %cl - subb %ah, bits_r /* bits -= this.bits */ - shrl %cl, hold_r /* hold >>= this.bits */ - - /* if (op & 16) { - * dist = this.val - * op &= 15 - * if (op > bits) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * dist += hold & mask[op]; - * bits -= op; - * hold >>= op; - */ - movb %al, %cl /* cl = this.op */ - - testb $16, %al /* if ((op & 16) == 0) */ - jz .L_test_for_second_level_dist - andb $15, %cl /* op &= 15 */ - jz .L_check_dist_one - cmpb %cl, bits_r - jae .L_add_bits_to_dist /* if (op <= bits) 97.6% */ - - movb %cl, %ch /* stash op in ch, freeing cl */ - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - movb %ch, %cl /* move op back to ecx */ - -.L_add_bits_to_dist: - movl $1, %eax - shll %cl, %eax - decl %eax /* (1 << op) - 1 */ - subb %cl, bits_r - andl hold_r, %eax /* eax &= hold */ - shrl %cl, hold_r - addl %eax, dist_r /* dist += hold & ((1 << op) - 1) */ - jmp .L_check_window - -.L_check_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes - * - * nbytes = out - beg; - * if (dist <= nbytes) { - * from = out - dist; - * do { - * PUP(out) = PUP(from); - * } while (--len > 0) { - * } - */ - - movl in_r, in(%esp) /* save in so from can use it's reg */ - movl out_r, %eax - subl beg(%esp), %eax /* nbytes = out - beg */ - - cmpl dist_r, %eax - jb .L_clip_window /* if (dist > nbytes) 4.2% */ - - movl len(%esp), %ecx - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - - subl $3, %ecx - movb (from_r), %al - movb %al, (out_r) - movb 1(from_r), %al - movb 2(from_r), %dl - addl $3, from_r - movb %al, 1(out_r) - movb %dl, 2(out_r) - addl $3, out_r - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - jmp .L_while_test - -.align 16,0x90 -.L_check_dist_one: - cmpl $1, dist_r - jne .L_check_window - cmpl out_r, beg(%esp) - je .L_check_window - - decl out_r - movl len(%esp), %ecx - movb (out_r), %al - subl $3, %ecx - - movb %al, 1(out_r) - movb %al, 2(out_r) - movb %al, 3(out_r) - addl $4, out_r - rep stosb - - jmp .L_while_test - -.align 16,0x90 -.L_test_for_second_level_length: - /* else if ((op & 64) == 0) { - * this = lcode[this.val + (hold & mask[op])]; - * } - */ - testb $64, %al - jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ - - movl $1, %eax - shll %cl, %eax - decl %eax - andl hold_r, %eax /* eax &= hold */ - addl %edx, %eax /* eax += this.val */ - movl lcode(%esp), %edx /* edx = lcode */ - movl (%edx,%eax,4), %eax /* eax = lcode[val + (hold&mask[op])] */ - jmp .L_dolen - -.align 16,0x90 -.L_test_for_second_level_dist: - /* else if ((op & 64) == 0) { - * this = dcode[this.val + (hold & mask[op])]; - * } - */ - testb $64, %al - jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ - - movl $1, %eax - shll %cl, %eax - decl %eax - andl hold_r, %eax /* eax &= hold */ - addl %edx, %eax /* eax += this.val */ - movl dcode(%esp), %edx /* edx = dcode */ - movl (%edx,%eax,4), %eax /* eax = dcode[val + (hold&mask[op])] */ - jmp .L_dodist - -.align 16,0x90 -.L_clip_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes - * - * else { - * if (dist > wsize) { - * invalid distance - * } - * from = window; - * nbytes = dist - nbytes; - * if (write == 0) { - * from += wsize - nbytes; - */ -#define nbytes_r %ecx - movl %eax, nbytes_r - movl wsize(%esp), %eax /* prepare for dist compare */ - negl nbytes_r /* nbytes = -nbytes */ - movl window(%esp), from_r /* from = window */ - - cmpl dist_r, %eax - jb .L_invalid_distance_too_far /* if (dist > wsize) */ - - addl dist_r, nbytes_r /* nbytes = dist - nbytes */ - cmpl $0, write(%esp) - jne .L_wrap_around_window /* if (write != 0) */ - - subl nbytes_r, %eax - addl %eax, from_r /* from += wsize - nbytes */ - - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = len - * - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = out - dist; - * } - * } - */ -#define len_r %eax - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - -.L_wrap_around_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = write, %eax = len - * - * else if (write < nbytes) { - * from += wsize + write - nbytes; - * nbytes -= write; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = window; - * nbytes = write; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while(--nbytes); - * from = out - dist; - * } - * } - * } - */ -#define write_r %eax - movl write(%esp), write_r - cmpl write_r, nbytes_r - jbe .L_contiguous_in_window /* if (write >= nbytes) */ - - addl wsize(%esp), from_r - addl write_r, from_r - subl nbytes_r, from_r /* from += wsize + write - nbytes */ - subl write_r, nbytes_r /* nbytes -= write */ -#undef write_r - - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl window(%esp), from_r /* from = window */ - movl write(%esp), nbytes_r /* nbytes = write */ - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - -.L_contiguous_in_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = write, %eax = len - * - * else { - * from += write - nbytes; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = out - dist; - * } - * } - */ -#define write_r %eax - addl write_r, from_r - subl nbytes_r, from_r /* from += write - nbytes */ -#undef write_r - - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - -.L_do_copy1: - /* regs: %esi = from, %esi = in, %ebp = hold, %bl = bits, %edi = out - * %eax = len - * - * while (len > 0) { - * PUP(out) = PUP(from); - * len--; - * } - * } - * } while (in < last && out < end); - */ -#undef nbytes_r -#define in_r %esi - movl len_r, %ecx - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - jmp .L_while_test - -#undef len_r -#undef dist_r - -#endif /* NO_MMX || RUN_TIME_MMX */ - - -/*** MMX code ***/ - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -.align 32,0x90 -.L_init_mmx: - emms - -#undef bits_r -#undef bitslong_r -#define bitslong_r %ebp -#define hold_mm %mm0 - movd %ebp, hold_mm - movl %ebx, bitslong_r - -#define used_mm %mm1 -#define dmask2_mm %mm2 -#define lmask2_mm %mm3 -#define lmask_mm %mm4 -#define dmask_mm %mm5 -#define tmp_mm %mm6 - - movd lmask(%esp), lmask_mm - movq lmask_mm, lmask2_mm - movd dmask(%esp), dmask_mm - movq dmask_mm, dmask2_mm - pxor used_mm, used_mm - movl lcode(%esp), %ebx /* ebx = lcode */ - jmp .L_do_loop_mmx - -.align 32,0x90 -.L_while_test_mmx: - /* while (in < last && out < end) - */ - cmpl out_r, end(%esp) - jbe .L_break_loop /* if (out >= end) */ - - cmpl in_r, last(%esp) - jbe .L_break_loop - -.L_do_loop_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - - cmpl $32, bitslong_r - ja .L_get_length_code_mmx /* if (32 < bits) */ - - movd bitslong_r, tmp_mm - movd (in_r), %mm7 - addl $4, in_r - psllq tmp_mm, %mm7 - addl $32, bitslong_r - por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ - -.L_get_length_code_mmx: - pand hold_mm, lmask_mm - movd lmask_mm, %eax - movq lmask2_mm, lmask_mm - movl (%ebx,%eax,4), %eax /* eax = lcode[hold & lmask] */ - -.L_dolen_mmx: - movzbl %ah, %ecx /* ecx = this.bits */ - movd %ecx, used_mm - subl %ecx, bitslong_r /* bits -= this.bits */ - - testb %al, %al - jnz .L_test_for_length_base_mmx /* if (op != 0) 45.7% */ - - shrl $16, %eax /* output this.val char */ - stosb - jmp .L_while_test_mmx - -.L_test_for_length_base_mmx: -#define len_r %edx - movl %eax, len_r /* len = this */ - shrl $16, len_r /* len = this.val */ - - testb $16, %al - jz .L_test_for_second_level_length_mmx /* if ((op & 16) == 0) 8% */ - andl $15, %eax /* op &= 15 */ - jz .L_decode_distance_mmx /* if (!op) */ - - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd %eax, used_mm - movd hold_mm, %ecx - subl %eax, bitslong_r - andl .L_mask(,%eax,4), %ecx - addl %ecx, len_r /* len += hold & mask[op] */ - -.L_decode_distance_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - - cmpl $32, bitslong_r - ja .L_get_dist_code_mmx /* if (32 < bits) */ - - movd bitslong_r, tmp_mm - movd (in_r), %mm7 - addl $4, in_r - psllq tmp_mm, %mm7 - addl $32, bitslong_r - por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ - -.L_get_dist_code_mmx: - movl dcode(%esp), %ebx /* ebx = dcode */ - pand hold_mm, dmask_mm - movd dmask_mm, %eax - movq dmask2_mm, dmask_mm - movl (%ebx,%eax,4), %eax /* eax = dcode[hold & lmask] */ - -.L_dodist_mmx: -#define dist_r %ebx - movzbl %ah, %ecx /* ecx = this.bits */ - movl %eax, dist_r - shrl $16, dist_r /* dist = this.val */ - subl %ecx, bitslong_r /* bits -= this.bits */ - movd %ecx, used_mm - - testb $16, %al /* if ((op & 16) == 0) */ - jz .L_test_for_second_level_dist_mmx - andl $15, %eax /* op &= 15 */ - jz .L_check_dist_one_mmx - -.L_add_bits_to_dist_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd %eax, used_mm /* save bit length of current op */ - movd hold_mm, %ecx /* get the next bits on input stream */ - subl %eax, bitslong_r /* bits -= op bits */ - andl .L_mask(,%eax,4), %ecx /* ecx = hold & mask[op] */ - addl %ecx, dist_r /* dist += hold & mask[op] */ - -.L_check_window_mmx: - movl in_r, in(%esp) /* save in so from can use it's reg */ - movl out_r, %eax - subl beg(%esp), %eax /* nbytes = out - beg */ - - cmpl dist_r, %eax - jb .L_clip_window_mmx /* if (dist > nbytes) 4.2% */ - - movl len_r, %ecx - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - - subl $3, %ecx - movb (from_r), %al - movb %al, (out_r) - movb 1(from_r), %al - movb 2(from_r), %dl - addl $3, from_r - movb %al, 1(out_r) - movb %dl, 2(out_r) - addl $3, out_r - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -.align 16,0x90 -.L_check_dist_one_mmx: - cmpl $1, dist_r - jne .L_check_window_mmx - cmpl out_r, beg(%esp) - je .L_check_window_mmx - - decl out_r - movl len_r, %ecx - movb (out_r), %al - subl $3, %ecx - - movb %al, 1(out_r) - movb %al, 2(out_r) - movb %al, 3(out_r) - addl $4, out_r - rep stosb - - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -.align 16,0x90 -.L_test_for_second_level_length_mmx: - testb $64, %al - jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ - - andl $15, %eax - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ecx - andl .L_mask(,%eax,4), %ecx - addl len_r, %ecx - movl (%ebx,%ecx,4), %eax /* eax = lcode[hold & lmask] */ - jmp .L_dolen_mmx - -.align 16,0x90 -.L_test_for_second_level_dist_mmx: - testb $64, %al - jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ - - andl $15, %eax - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ecx - andl .L_mask(,%eax,4), %ecx - movl dcode(%esp), %eax /* ecx = dcode */ - addl dist_r, %ecx - movl (%eax,%ecx,4), %eax /* eax = lcode[hold & lmask] */ - jmp .L_dodist_mmx - -.align 16,0x90 -.L_clip_window_mmx: -#define nbytes_r %ecx - movl %eax, nbytes_r - movl wsize(%esp), %eax /* prepare for dist compare */ - negl nbytes_r /* nbytes = -nbytes */ - movl window(%esp), from_r /* from = window */ - - cmpl dist_r, %eax - jb .L_invalid_distance_too_far /* if (dist > wsize) */ - - addl dist_r, nbytes_r /* nbytes = dist - nbytes */ - cmpl $0, write(%esp) - jne .L_wrap_around_window_mmx /* if (write != 0) */ - - subl nbytes_r, %eax - addl %eax, from_r /* from += wsize - nbytes */ - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - -.L_wrap_around_window_mmx: -#define write_r %eax - movl write(%esp), write_r - cmpl write_r, nbytes_r - jbe .L_contiguous_in_window_mmx /* if (write >= nbytes) */ - - addl wsize(%esp), from_r - addl write_r, from_r - subl nbytes_r, from_r /* from += wsize + write - nbytes */ - subl write_r, nbytes_r /* nbytes -= write */ -#undef write_r - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl window(%esp), from_r /* from = window */ - movl write(%esp), nbytes_r /* nbytes = write */ - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - -.L_contiguous_in_window_mmx: -#define write_r %eax - addl write_r, from_r - subl nbytes_r, from_r /* from += write - nbytes */ -#undef write_r - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - -.L_do_copy1_mmx: -#undef nbytes_r -#define in_r %esi - movl len_r, %ecx - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -#undef hold_r -#undef bitslong_r - -#endif /* USE_MMX || RUN_TIME_MMX */ - - -/*** USE_MMX, NO_MMX, and RUNTIME_MMX from here on ***/ - -.L_invalid_distance_code: - /* else { - * strm->msg = "invalid distance code"; - * state->mode = BAD; - * } - */ - movl $.L_invalid_distance_code_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_test_for_end_of_block: - /* else if (op & 32) { - * state->mode = TYPE; - * break; - * } - */ - testb $32, %al - jz .L_invalid_literal_length_code /* if ((op & 32) == 0) */ - - movl $0, %ecx - movl $INFLATE_MODE_TYPE, %edx - jmp .L_update_stream_state - -.L_invalid_literal_length_code: - /* else { - * strm->msg = "invalid literal/length code"; - * state->mode = BAD; - * } - */ - movl $.L_invalid_literal_length_code_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_invalid_distance_too_far: - /* strm->msg = "invalid distance too far back"; - * state->mode = BAD; - */ - movl in(%esp), in_r /* from_r has in's reg, put in back */ - movl $.L_invalid_distance_too_far_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_update_stream_state: - /* set strm->msg = %ecx, strm->state->mode = %edx */ - movl strm_sp(%esp), %eax - testl %ecx, %ecx /* if (msg != NULL) */ - jz .L_skip_msg - movl %ecx, msg_strm(%eax) /* strm->msg = msg */ -.L_skip_msg: - movl state_strm(%eax), %eax /* state = strm->state */ - movl %edx, mode_state(%eax) /* state->mode = edx (BAD | TYPE) */ - jmp .L_break_loop - -.align 32,0x90 -.L_break_loop: - -/* - * Regs: - * - * bits = %ebp when mmx, and in %ebx when non-mmx - * hold = %hold_mm when mmx, and in %ebp when non-mmx - * in = %esi - * out = %edi - */ - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -#if defined( RUN_TIME_MMX ) - - cmpl $DO_USE_MMX, inflate_fast_use_mmx - jne .L_update_next_in - -#endif /* RUN_TIME_MMX */ - - movl %ebp, %ebx - -.L_update_next_in: - -#endif - -#define strm_r %eax -#define state_r %edx - - /* len = bits >> 3; - * in -= len; - * bits -= len << 3; - * hold &= (1U << bits) - 1; - * state->hold = hold; - * state->bits = bits; - * strm->next_in = in; - * strm->next_out = out; - */ - movl strm_sp(%esp), strm_r - movl %ebx, %ecx - movl state_strm(strm_r), state_r - shrl $3, %ecx - subl %ecx, in_r - shll $3, %ecx - subl %ecx, %ebx - movl out_r, next_out_strm(strm_r) - movl %ebx, bits_state(state_r) - movl %ebx, %ecx - - leal buf(%esp), %ebx - cmpl %ebx, last(%esp) - jne .L_buf_not_used /* if buf != last */ - - subl %ebx, in_r /* in -= buf */ - movl next_in_strm(strm_r), %ebx - movl %ebx, last(%esp) /* last = strm->next_in */ - addl %ebx, in_r /* in += strm->next_in */ - movl avail_in_strm(strm_r), %ebx - subl $11, %ebx - addl %ebx, last(%esp) /* last = &strm->next_in[ avail_in - 11 ] */ - -.L_buf_not_used: - movl in_r, next_in_strm(strm_r) - - movl $1, %ebx - shll %cl, %ebx - decl %ebx - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -#if defined( RUN_TIME_MMX ) - - cmpl $DO_USE_MMX, inflate_fast_use_mmx - jne .L_update_hold - -#endif /* RUN_TIME_MMX */ - - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ebp - - emms - -.L_update_hold: - -#endif /* USE_MMX || RUN_TIME_MMX */ - - andl %ebx, %ebp - movl %ebp, hold_state(state_r) - -#define last_r %ebx - - /* strm->avail_in = in < last ? 11 + (last - in) : 11 - (in - last) */ - movl last(%esp), last_r - cmpl in_r, last_r - jbe .L_last_is_smaller /* if (in >= last) */ - - subl in_r, last_r /* last -= in */ - addl $11, last_r /* last += 11 */ - movl last_r, avail_in_strm(strm_r) - jmp .L_fixup_out -.L_last_is_smaller: - subl last_r, in_r /* in -= last */ - negl in_r /* in = -in */ - addl $11, in_r /* in += 11 */ - movl in_r, avail_in_strm(strm_r) - -#undef last_r -#define end_r %ebx - -.L_fixup_out: - /* strm->avail_out = out < end ? 257 + (end - out) : 257 - (out - end)*/ - movl end(%esp), end_r - cmpl out_r, end_r - jbe .L_end_is_smaller /* if (out >= end) */ - - subl out_r, end_r /* end -= out */ - addl $257, end_r /* end += 257 */ - movl end_r, avail_out_strm(strm_r) - jmp .L_done -.L_end_is_smaller: - subl end_r, out_r /* out -= end */ - negl out_r /* out = -out */ - addl $257, out_r /* out += 257 */ - movl out_r, avail_out_strm(strm_r) - -#undef end_r -#undef strm_r -#undef state_r - -.L_done: - addl $local_var_size, %esp - popf - popl %ebx - popl %ebp - popl %esi - popl %edi - ret - -#if defined( GAS_ELF ) -/* elf info */ -.type inflate_fast,@function -.size inflate_fast,.-inflate_fast -#endif diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx64/bld_ml64.bat b/src/dependencies/zlib-1.2.11/contrib/masmx64/bld_ml64.bat deleted file mode 100644 index 8f9343d..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx64/bld_ml64.bat +++ /dev/null @@ -1,2 +0,0 @@ -ml64.exe /Flinffasx64 /c /Zi inffasx64.asm -ml64.exe /Flgvmat64 /c /Zi gvmat64.asm diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx64/gvmat64.asm b/src/dependencies/zlib-1.2.11/contrib/masmx64/gvmat64.asm deleted file mode 100644 index 9879c28..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx64/gvmat64.asm +++ /dev/null @@ -1,553 +0,0 @@ -;uInt longest_match_x64( -; deflate_state *s, -; IPos cur_match); /* current match */ - -; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86_64 -; (AMD64 on Athlon 64, Opteron, Phenom -; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7) -; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant. -; -; File written by Gilles Vollant, by converting to assembly the longest_match -; from Jean-loup Gailly in deflate.c of zLib and infoZip zip. -; -; and by taking inspiration on asm686 with masm, optimised assembly code -; from Brian Raiter, written 1998 -; -; This software is provided 'as-is', without any express or implied -; warranty. In no event will the authors be held liable for any damages -; arising from the use of this software. -; -; Permission is granted to anyone to use this software for any purpose, -; including commercial applications, and to alter it and redistribute it -; freely, subject to the following restrictions: -; -; 1. The origin of this software must not be misrepresented; you must not -; claim that you wrote the original software. If you use this software -; in a product, an acknowledgment in the product documentation would be -; appreciated but is not required. -; 2. Altered source versions must be plainly marked as such, and must not be -; misrepresented as being the original software -; 3. This notice may not be removed or altered from any source distribution. -; -; -; -; http://www.zlib.net -; http://www.winimage.com/zLibDll -; http://www.muppetlabs.com/~breadbox/software/assembly.html -; -; to compile this file for infozip Zip, I use option: -; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm -; -; to compile this file for zLib, I use option: -; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm -; Be carrefull to adapt zlib1222add below to your version of zLib -; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change -; value of zlib1222add later) -; -; This file compile with Microsoft Macro Assembler (x64) for AMD64 -; -; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK -; -; (you can get Windows WDK with ml64 for AMD64 from -; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price) -; - - -;uInt longest_match(s, cur_match) -; deflate_state *s; -; IPos cur_match; /* current match */ -.code -longest_match PROC - - -;LocalVarsSize equ 88 - LocalVarsSize equ 72 - -; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12 -; free register : r14,r15 -; register can be saved : rsp - - chainlenwmask equ rsp + 8 - LocalVarsSize ; high word: current chain len - ; low word: s->wmask -;window equ rsp + xx - LocalVarsSize ; local copy of s->window ; stored in r10 -;windowbestlen equ rsp + xx - LocalVarsSize ; s->window + bestlen , use r10+r11 -;scanstart equ rsp + xx - LocalVarsSize ; first two bytes of string ; stored in r12w -;scanend equ rsp + xx - LocalVarsSize ; last two bytes of string use ebx -;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13 -;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d -;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9 -IFDEF INFOZIP -ELSE - nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size -ENDIF - -save_rdi equ rsp + 24 - LocalVarsSize -save_rsi equ rsp + 32 - LocalVarsSize -save_rbx equ rsp + 40 - LocalVarsSize -save_rbp equ rsp + 48 - LocalVarsSize -save_r12 equ rsp + 56 - LocalVarsSize -save_r13 equ rsp + 64 - LocalVarsSize -;save_r14 equ rsp + 72 - LocalVarsSize -;save_r15 equ rsp + 80 - LocalVarsSize - - -; summary of register usage -; scanend ebx -; scanendw bx -; chainlenwmask edx -; curmatch rsi -; curmatchd esi -; windowbestlen r8 -; scanalign r9 -; scanalignd r9d -; window r10 -; bestlen r11 -; bestlend r11d -; scanstart r12d -; scanstartw r12w -; scan r13 -; nicematch r14d -; limit r15 -; limitd r15d -; prev rcx - -; all the +4 offsets are due to the addition of pending_buf_size (in zlib -; in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, remove the +4). -; Note : these value are good with a 8 bytes boundary pack structure - - - MAX_MATCH equ 258 - MIN_MATCH equ 3 - MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) - - -;;; Offsets for fields in the deflate_state structure. These numbers -;;; are calculated from the definition of deflate_state, with the -;;; assumption that the compiler will dword-align the fields. (Thus, -;;; changing the definition of deflate_state could easily cause this -;;; program to crash horribly, without so much as a warning at -;;; compile time. Sigh.) - -; all the +zlib1222add offsets are due to the addition of fields -; in zlib in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). -; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). -; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - - -IFDEF INFOZIP - -_DATA SEGMENT -COMM window_size:DWORD -; WMask ; 7fff -COMM window:BYTE:010040H -COMM prev:WORD:08000H -; MatchLen : unused -; PrevMatch : unused -COMM strstart:DWORD -COMM match_start:DWORD -; Lookahead : ignore -COMM prev_length:DWORD ; PrevLen -COMM max_chain_length:DWORD -COMM good_match:DWORD -COMM nice_match:DWORD -prev_ad equ OFFSET prev -window_ad equ OFFSET window -nicematch equ nice_match -_DATA ENDS -WMask equ 07fffh - -ELSE - - IFNDEF zlib1222add - zlib1222add equ 8 - ENDIF -dsWSize equ 56+zlib1222add+(zlib1222add/2) -dsWMask equ 64+zlib1222add+(zlib1222add/2) -dsWindow equ 72+zlib1222add -dsPrev equ 88+zlib1222add -dsMatchLen equ 128+zlib1222add -dsPrevMatch equ 132+zlib1222add -dsStrStart equ 140+zlib1222add -dsMatchStart equ 144+zlib1222add -dsLookahead equ 148+zlib1222add -dsPrevLen equ 152+zlib1222add -dsMaxChainLen equ 156+zlib1222add -dsGoodMatch equ 172+zlib1222add -dsNiceMatch equ 176+zlib1222add - -window_size equ [ rcx + dsWSize] -WMask equ [ rcx + dsWMask] -window_ad equ [ rcx + dsWindow] -prev_ad equ [ rcx + dsPrev] -strstart equ [ rcx + dsStrStart] -match_start equ [ rcx + dsMatchStart] -Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip -prev_length equ [ rcx + dsPrevLen] -max_chain_length equ [ rcx + dsMaxChainLen] -good_match equ [ rcx + dsGoodMatch] -nice_match equ [ rcx + dsNiceMatch] -ENDIF - -; parameter 1 in r8(deflate state s), param 2 in rdx (cur match) - -; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and -; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp -; -; All registers must be preserved across the call, except for -; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch. - - - -;;; Save registers that the compiler may be using, and adjust esp to -;;; make room for our stack frame. - - -;;; Retrieve the function arguments. r8d will hold cur_match -;;; throughout the entire function. edx will hold the pointer to the -;;; deflate_state structure during the function's setup (before -;;; entering the main loop. - -; parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match) - -; this clear high 32 bits of r8, which can be garbage in both r8 and rdx - - mov [save_rdi],rdi - mov [save_rsi],rsi - mov [save_rbx],rbx - mov [save_rbp],rbp -IFDEF INFOZIP - mov r8d,ecx -ELSE - mov r8d,edx -ENDIF - mov [save_r12],r12 - mov [save_r13],r13 -; mov [save_r14],r14 -; mov [save_r15],r15 - - -;;; uInt wmask = s->w_mask; -;;; unsigned chain_length = s->max_chain_length; -;;; if (s->prev_length >= s->good_match) { -;;; chain_length >>= 2; -;;; } - - mov edi, prev_length - mov esi, good_match - mov eax, WMask - mov ebx, max_chain_length - cmp edi, esi - jl LastMatchGood - shr ebx, 2 -LastMatchGood: - -;;; chainlen is decremented once beforehand so that the function can -;;; use the sign flag instead of the zero flag for the exit test. -;;; It is then shifted into the high word, to make room for the wmask -;;; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - -;;; on zlib only -;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - -IFDEF INFOZIP - mov [chainlenwmask], ebx -; on infozip nice_match = [nice_match] -ELSE - mov eax, nice_match - mov [chainlenwmask], ebx - mov r10d, Lookahead - cmp r10d, eax - cmovnl r10d, eax - mov [nicematch],r10d -ENDIF - -;;; register Bytef *scan = s->window + s->strstart; - mov r10, window_ad - mov ebp, strstart - lea r13, [r10 + rbp] - -;;; Determine how many bytes the scan ptr is off from being -;;; dword-aligned. - - mov r9,r13 - neg r13 - and r13,3 - -;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -;;; s->strstart - (IPos)MAX_DIST(s) : NIL; -IFDEF INFOZIP - mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1)) -ELSE - mov eax, window_size - sub eax, MIN_LOOKAHEAD -ENDIF - xor edi,edi - sub ebp, eax - - mov r11d, prev_length - - cmovng ebp,edi - -;;; int best_len = s->prev_length; - - -;;; Store the sum of s->window + best_len in esi locally, and in esi. - - lea rsi,[r10+r11] - -;;; register ush scan_start = *(ushf*)scan; -;;; register ush scan_end = *(ushf*)(scan+best_len-1); -;;; Posf *prev = s->prev; - - movzx r12d,word ptr [r9] - movzx ebx, word ptr [r9 + r11 - 1] - - mov rdi, prev_ad - -;;; Jump into the main loop. - - mov edx, [chainlenwmask] - - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop1: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry1: - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop2: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry2: - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop4: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry4: - - cmp bx,word ptr [rsi + r8 - 1] - jnz LookupLoop1 - jmp LookupLoopIsZero - - -;;; do { -;;; match = s->window + cur_match; -;;; if (*(ushf*)(match+best_len-1) != scan_end || -;;; *(ushf*)match != scan_start) continue; -;;; [...] -;;; } while ((cur_match = prev[cur_match & wmask]) > limit -;;; && --chain_length != 0); -;;; -;;; Here is the inner loop of the function. The function will spend the -;;; majority of its time in this loop, and majority of that time will -;;; be spent in the first ten instructions. -;;; -;;; Within this loop: -;;; ebx = scanend -;;; r8d = curmatch -;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -;;; esi = windowbestlen - i.e., (window + bestlen) -;;; edi = prev -;;; ebp = limit - -LookupLoop: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry: - - cmp bx,word ptr [rsi + r8 - 1] - jnz LookupLoop1 -LookupLoopIsZero: - cmp r12w, word ptr [r10 + r8] - jnz LookupLoop1 - - -;;; Store the current value of chainlen. - mov [chainlenwmask], edx - -;;; Point edi to the string under scrutiny, and esi to the string we -;;; are hoping to match it up with. In actuality, esi and edi are -;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is -;;; initialized to -(MAX_MATCH_8 - scanalign). - - lea rsi,[r8+r10] - mov rdx, 0fffffffffffffef8h; -(MAX_MATCH_8) - lea rsi, [rsi + r13 + 0108h] ;MAX_MATCH_8] - lea rdi, [r9 + r13 + 0108h] ;MAX_MATCH_8] - - prefetcht1 [rsi+rdx] - prefetcht1 [rdi+rdx] - - -;;; Test the strings for equality, 8 bytes at a time. At the end, -;;; adjust rdx so that it is offset to the exact byte that mismatched. -;;; -;;; We already know at this point that the first three bytes of the -;;; strings match each other, and they can be safely passed over before -;;; starting the compare loop. So what this code does is skip over 0-3 -;;; bytes, as much as necessary in order to dword-align the edi -;;; pointer. (rsi will still be misaligned three times out of four.) -;;; -;;; It should be confessed that this loop usually does not represent -;;; much of the total running time. Replacing it with a more -;;; straightforward "rep cmpsb" would not drastically degrade -;;; performance. - - -LoopCmps: - mov rax, [rsi + rdx] - xor rax, [rdi + rdx] - jnz LeaveLoopCmps - - mov rax, [rsi + rdx + 8] - xor rax, [rdi + rdx + 8] - jnz LeaveLoopCmps8 - - - mov rax, [rsi + rdx + 8+8] - xor rax, [rdi + rdx + 8+8] - jnz LeaveLoopCmps16 - - add rdx,8+8+8 - - jnz short LoopCmps - jmp short LenMaximum -LeaveLoopCmps16: add rdx,8 -LeaveLoopCmps8: add rdx,8 -LeaveLoopCmps: - - test eax, 0000FFFFh - jnz LenLower - - test eax,0ffffffffh - - jnz LenLower32 - - add rdx,4 - shr rax,32 - or ax,ax - jnz LenLower - -LenLower32: - shr eax,16 - add rdx,2 -LenLower: sub al, 1 - adc rdx, 0 -;;; Calculate the length of the match. If it is longer than MAX_MATCH, -;;; then automatically accept it as the best possible match and leave. - - lea rax, [rdi + rdx] - sub rax, r9 - cmp eax, MAX_MATCH - jge LenMaximum - -;;; If the length of the match is not longer than the best match we -;;; have so far, then forget it and return to the lookup loop. -;/////////////////////////////////// - - cmp eax, r11d - jg LongerMatch - - lea rsi,[r10+r11] - - mov rdi, prev_ad - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; s->match_start = cur_match; -;;; best_len = len; -;;; if (len >= nice_match) break; -;;; scan_end = *(ushf*)(scan+best_len-1); - -LongerMatch: - mov r11d, eax - mov match_start, r8d - cmp eax, [nicematch] - jge LeaveNow - - lea rsi,[r10+rax] - - movzx ebx, word ptr [r9 + rax - 1] - mov rdi, prev_ad - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; Accept the current string, with the maximum possible length. - -LenMaximum: - mov r11d,MAX_MATCH - mov match_start, r8d - -;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -;;; return s->lookahead; - -LeaveNow: -IFDEF INFOZIP - mov eax,r11d -ELSE - mov eax, Lookahead - cmp r11d, eax - cmovng eax, r11d -ENDIF - -;;; Restore the stack and return from whence we came. - - - mov rsi,[save_rsi] - mov rdi,[save_rdi] - mov rbx,[save_rbx] - mov rbp,[save_rbp] - mov r12,[save_r12] - mov r13,[save_r13] -; mov r14,[save_r14] -; mov r15,[save_r15] - - - ret 0 -; please don't remove this string ! -; Your can freely use gvmat64 in any free or commercial app -; but it is far better don't remove the string in the binary! - db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0 -longest_match ENDP - -match_init PROC - ret 0 -match_init ENDP - - -END diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx64/inffas8664.c b/src/dependencies/zlib-1.2.11/contrib/masmx64/inffas8664.c deleted file mode 100644 index e8af06f..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx64/inffas8664.c +++ /dev/null @@ -1,186 +0,0 @@ -/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding - * version for AMD64 on Windows using Microsoft C compiler - * - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Copyright (C) 2003 Chris Anderson - * Please use the copyright conditions above. - * - * 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant - * - * inffas8664.c call function inffas8664fnc in inffasx64.asm - * inffasx64.asm is automatically convert from AMD64 portion of inffas86.c - * - * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also - * slightly quicker on x86 systems because, instead of using rep movsb to copy - * data, it uses rep movsw, which moves data in 2-byte chunks instead of single - * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates - * from http://fedora.linux.duke.edu/fc1_x86_64 - * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with - * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version, - * when decompressing mozilla-source-1.3.tar.gz. - * - * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from - * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at - * the moment. I have successfully compiled and tested this code with gcc2.96, - * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S - * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX - * enabled. I will attempt to merge the MMX code into this version. Newer - * versions of this and inffast.S can be found at - * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ - * - */ - -#include -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* Mark Adler's comments from inffast.c: */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ - - - - typedef struct inffast_ar { -/* 64 32 x86 x86_64 */ -/* ar offset register */ -/* 0 0 */ void *esp; /* esp save */ -/* 8 4 */ void *ebp; /* ebp save */ -/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */ -/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */ -/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */ -/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */ -/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */ -/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */ -/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */ -/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */ -/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */ -/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */ -/* 92 48 */ unsigned wsize; /* window size */ -/* 96 52 */ unsigned write; /* window write index */ -/*100 56 */ unsigned lmask; /* r12 mask for lcode */ -/*104 60 */ unsigned dmask; /* r13 mask for dcode */ -/*108 64 */ unsigned len; /* r14 match length */ -/*112 68 */ unsigned dist; /* r15 match distance */ -/*116 72 */ unsigned status; /* set when state chng*/ - } type_ar; -#ifdef ASMINF - -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - type_ar ar; - void inffas8664fnc(struct inffast_ar * par); - - - -#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64)) -#define PAD_AVAIL_IN 6 -#define PAD_AVAIL_OUT 258 -#else -#define PAD_AVAIL_IN 5 -#define PAD_AVAIL_OUT 257 -#endif - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - - ar.in = strm->next_in; - ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN); - ar.out = strm->next_out; - ar.beg = ar.out - (start - strm->avail_out); - ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT); - ar.wsize = state->wsize; - ar.write = state->wnext; - ar.window = state->window; - ar.hold = state->hold; - ar.bits = state->bits; - ar.lcode = state->lencode; - ar.dcode = state->distcode; - ar.lmask = (1U << state->lenbits) - 1; - ar.dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - /* align in on 1/2 hold size boundary */ - while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) { - ar.hold += (unsigned long)*ar.in++ << ar.bits; - ar.bits += 8; - } - - inffas8664fnc(&ar); - - if (ar.status > 1) { - if (ar.status == 2) - strm->msg = "invalid literal/length code"; - else if (ar.status == 3) - strm->msg = "invalid distance code"; - else - strm->msg = "invalid distance too far back"; - state->mode = BAD; - } - else if ( ar.status == 1 ) { - state->mode = TYPE; - } - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - ar.len = ar.bits >> 3; - ar.in -= ar.len; - ar.bits -= ar.len << 3; - ar.hold &= (1U << ar.bits) - 1; - - /* update state and return */ - strm->next_in = ar.in; - strm->next_out = ar.out; - strm->avail_in = (unsigned)(ar.in < ar.last ? - PAD_AVAIL_IN + (ar.last - ar.in) : - PAD_AVAIL_IN - (ar.in - ar.last)); - strm->avail_out = (unsigned)(ar.out < ar.end ? - PAD_AVAIL_OUT + (ar.end - ar.out) : - PAD_AVAIL_OUT - (ar.out - ar.end)); - state->hold = (unsigned long)ar.hold; - state->bits = ar.bits; - return; -} - -#endif diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx64/inffasx64.asm b/src/dependencies/zlib-1.2.11/contrib/masmx64/inffasx64.asm deleted file mode 100644 index 60a8d89..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx64/inffasx64.asm +++ /dev/null @@ -1,396 +0,0 @@ -; inffasx64.asm is a hand tuned assembler version of inffast.c - fast decoding -; version for AMD64 on Windows using Microsoft C compiler -; -; inffasx64.asm is automatically convert from AMD64 portion of inffas86.c -; inffasx64.asm is called by inffas8664.c, which contain more info. - - -; to compile this file, I use option -; ml64.exe /Flinffasx64 /c /Zi inffasx64.asm -; with Microsoft Macro Assembler (x64) for AMD64 -; - -; This file compile with Microsoft Macro Assembler (x64) for AMD64 -; -; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK -; -; (you can get Windows WDK with ml64 for AMD64 from -; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price) -; - - -.code -inffas8664fnc PROC - -; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and -; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp -; -; All registers must be preserved across the call, except for -; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch. - - - mov [rsp-8],rsi - mov [rsp-16],rdi - mov [rsp-24],r12 - mov [rsp-32],r13 - mov [rsp-40],r14 - mov [rsp-48],r15 - mov [rsp-56],rbx - - mov rax,rcx - - mov [rax+8], rbp ; /* save regs rbp and rsp */ - mov [rax], rsp - - mov rsp, rax ; /* make rsp point to &ar */ - - mov rsi, [rsp+16] ; /* rsi = in */ - mov rdi, [rsp+32] ; /* rdi = out */ - mov r9, [rsp+24] ; /* r9 = last */ - mov r10, [rsp+48] ; /* r10 = end */ - mov rbp, [rsp+64] ; /* rbp = lcode */ - mov r11, [rsp+72] ; /* r11 = dcode */ - mov rdx, [rsp+80] ; /* rdx = hold */ - mov ebx, [rsp+88] ; /* ebx = bits */ - mov r12d, [rsp+100] ; /* r12d = lmask */ - mov r13d, [rsp+104] ; /* r13d = dmask */ - ; /* r14d = len */ - ; /* r15d = dist */ - - - cld - cmp r10, rdi - je L_one_time ; /* if only one decode left */ - cmp r9, rsi - - jne L_do_loop - - -L_one_time: - mov r8, r12 ; /* r8 = lmask */ - cmp bl, 32 - ja L_get_length_code_one_time - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - jmp L_get_length_code_one_time - -ALIGN 4 -L_while_test: - cmp r10, rdi - jbe L_break_loop - cmp r9, rsi - jbe L_break_loop - -L_do_loop: - mov r8, r12 ; /* r8 = lmask */ - cmp bl, 32 - ja L_get_length_code ; /* if (32 < bits) */ - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - -L_get_length_code: - and r8, rdx ; /* r8 &= hold */ - mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */ - - mov cl, ah ; /* cl = this.bits */ - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base ; /* if (op != 0) 45.7% */ - - mov r8, r12 ; /* r8 = lmask */ - shr eax, 16 ; /* output this.val char */ - stosb - -L_get_length_code_one_time: - and r8, rdx ; /* r8 &= hold */ - mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */ - -L_dolen: - mov cl, ah ; /* cl = this.bits */ - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base ; /* if (op != 0) 45.7% */ - - shr eax, 16 ; /* output this.val char */ - stosb - jmp L_while_test - -ALIGN 4 -L_test_for_length_base: - mov r14d, eax ; /* len = this */ - shr r14d, 16 ; /* len = this.val */ - mov cl, al - - test al, 16 - jz L_test_for_second_level_length ; /* if ((op & 16) == 0) 8% */ - and cl, 15 ; /* op &= 15 */ - jz L_decode_distance ; /* if (!op) */ - -L_add_bits_to_len: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - shr rdx, cl - add r14d, eax ; /* len += hold & mask[op] */ - -L_decode_distance: - mov r8, r13 ; /* r8 = dmask */ - cmp bl, 32 - ja L_get_distance_code ; /* if (32 < bits) */ - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - -L_get_distance_code: - and r8, rdx ; /* r8 &= hold */ - mov eax, [r11+r8*4] ; /* eax = dcode[hold & dmask] */ - -L_dodist: - mov r15d, eax ; /* dist = this */ - shr r15d, 16 ; /* dist = this.val */ - mov cl, ah - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - mov cl, al ; /* cl = this.op */ - - test al, 16 ; /* if ((op & 16) == 0) */ - jz L_test_for_second_level_dist - and cl, 15 ; /* op &= 15 */ - jz L_check_dist_one - -L_add_bits_to_dist: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax ; /* (1 << op) - 1 */ - and eax, edx ; /* eax &= hold */ - shr rdx, cl - add r15d, eax ; /* dist += hold & ((1 << op) - 1) */ - -L_check_window: - mov r8, rsi ; /* save in so from can use it's reg */ - mov rax, rdi - sub rax, [rsp+40] ; /* nbytes = out - beg */ - - cmp eax, r15d - jb L_clip_window ; /* if (dist > nbytes) 4.2% */ - - mov ecx, r14d ; /* ecx = len */ - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - - sar ecx, 1 - jnc L_copy_two ; /* if len % 2 == 0 */ - - rep movsw - mov al, [rsi] - mov [rdi], al - inc rdi - - mov rsi, r8 ; /* move in back to %rsi, toss from */ - jmp L_while_test - -L_copy_two: - rep movsw - mov rsi, r8 ; /* move in back to %rsi, toss from */ - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp r15d, 1 ; /* if dist 1, is a memset */ - jne L_check_window - cmp [rsp+40], rdi ; /* if out == beg, outside window */ - je L_check_window - - mov ecx, r14d ; /* ecx = len */ - mov al, [rdi-1] - mov ah, al - - sar ecx, 1 - jnc L_set_two - mov [rdi], al - inc rdi - -L_set_two: - rep stosw - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - test al, 64 - jnz L_test_for_end_of_block ; /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - add eax, r14d ; /* eax += len */ - mov eax, [rbp+rax*4] ; /* eax = lcode[val+(hold&mask[op])]*/ - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - test al, 64 - jnz L_invalid_distance_code ; /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - add eax, r15d ; /* eax += dist */ - mov eax, [r11+rax*4] ; /* eax = dcode[val+(hold&mask[op])]*/ - jmp L_dodist - -ALIGN 4 -L_clip_window: - mov ecx, eax ; /* ecx = nbytes */ - mov eax, [rsp+92] ; /* eax = wsize, prepare for dist cmp */ - neg ecx ; /* nbytes = -nbytes */ - - cmp eax, r15d - jb L_invalid_distance_too_far ; /* if (dist > wsize) */ - - add ecx, r15d ; /* nbytes = dist - nbytes */ - cmp dword ptr [rsp+96], 0 - jne L_wrap_around_window ; /* if (write != 0) */ - - mov rsi, [rsp+56] ; /* from = window */ - sub eax, ecx ; /* eax -= nbytes */ - add rsi, rax ; /* from += wsize - nbytes */ - - mov eax, r14d ; /* eax = len */ - cmp r14d, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* eax -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = &out[ -dist ] */ - jmp L_do_copy - -ALIGN 4 -L_wrap_around_window: - mov eax, [rsp+96] ; /* eax = write */ - cmp ecx, eax - jbe L_contiguous_in_window ; /* if (write >= nbytes) */ - - mov esi, [rsp+92] ; /* from = wsize */ - add rsi, [rsp+56] ; /* from += window */ - add rsi, rax ; /* from += write */ - sub rsi, rcx ; /* from -= nbytes */ - sub ecx, eax ; /* nbytes -= write */ - - mov eax, r14d ; /* eax = len */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, [rsp+56] ; /* from = window */ - mov ecx, [rsp+96] ; /* nbytes = write */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_contiguous_in_window: - mov rsi, [rsp+56] ; /* rsi = window */ - add rsi, rax - sub rsi, rcx ; /* from += write - nbytes */ - - mov eax, r14d ; /* eax = len */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - jmp L_do_copy ; /* if (nbytes >= len) */ - -ALIGN 4 -L_do_copy: - mov ecx, eax ; /* ecx = len */ - rep movsb - - mov rsi, r8 ; /* move in back to %esi, toss from */ - jmp L_while_test - -L_test_for_end_of_block: - test al, 32 - jz L_invalid_literal_length_code - mov dword ptr [rsp+116], 1 - jmp L_break_loop_with_status - -L_invalid_literal_length_code: - mov dword ptr [rsp+116], 2 - jmp L_break_loop_with_status - -L_invalid_distance_code: - mov dword ptr [rsp+116], 3 - jmp L_break_loop_with_status - -L_invalid_distance_too_far: - mov dword ptr [rsp+116], 4 - jmp L_break_loop_with_status - -L_break_loop: - mov dword ptr [rsp+116], 0 - -L_break_loop_with_status: -; /* put in, out, bits, and hold back into ar and pop esp */ - mov [rsp+16], rsi ; /* in */ - mov [rsp+32], rdi ; /* out */ - mov [rsp+88], ebx ; /* bits */ - mov [rsp+80], rdx ; /* hold */ - - mov rax, [rsp] ; /* restore rbp and rsp */ - mov rbp, [rsp+8] - mov rsp, rax - - - - mov rsi,[rsp-8] - mov rdi,[rsp-16] - mov r12,[rsp-24] - mov r13,[rsp-32] - mov r14,[rsp-40] - mov r15,[rsp-48] - mov rbx,[rsp-56] - - ret 0 -; : -; : "m" (ar) -; : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", -; "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" -; ); - -inffas8664fnc ENDP -;_TEXT ENDS -END diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx64/readme.txt b/src/dependencies/zlib-1.2.11/contrib/masmx64/readme.txt deleted file mode 100644 index 2da6733..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx64/readme.txt +++ /dev/null @@ -1,31 +0,0 @@ -Summary -------- -This directory contains ASM implementations of the functions -longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t), -for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits. - -gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits - assembly optimized version from Jean-loup Gailly original longest_match function - -inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing - original function from Mark Adler - -Use instructions ----------------- -Assemble the .asm files using MASM and put the object files into the zlib source -directory. You can also get object files here: - - http://www.winimage.com/zLibDll/zlib124_masm_obj.zip - -define ASMV and ASMINF in your project. Include inffas8664.c in your source tree, -and inffasx64.obj and gvmat64.obj as object to link. - - -Build instructions ------------------- -run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe) - -ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK - -You can get Windows 2003 server DDK with ml64 and cl for AMD64 from - http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx86/bld_ml32.bat b/src/dependencies/zlib-1.2.11/contrib/masmx86/bld_ml32.bat deleted file mode 100644 index e1b86bf..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx86/bld_ml32.bat +++ /dev/null @@ -1,2 +0,0 @@ -ml /coff /Zi /c /Flmatch686.lst match686.asm -ml /coff /Zi /c /Flinffas32.lst inffas32.asm diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx86/inffas32.asm b/src/dependencies/zlib-1.2.11/contrib/masmx86/inffas32.asm deleted file mode 100644 index 03d20f8..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx86/inffas32.asm +++ /dev/null @@ -1,1080 +0,0 @@ -;/* inffas32.asm is a hand tuned assembler version of inffast.c -- fast decoding -; * -; * inffas32.asm is derivated from inffas86.c, with translation of assembly code -; * -; * Copyright (C) 1995-2003 Mark Adler -; * For conditions of distribution and use, see copyright notice in zlib.h -; * -; * Copyright (C) 2003 Chris Anderson -; * Please use the copyright conditions above. -; * -; * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from -; * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at -; * the moment. I have successfully compiled and tested this code with gcc2.96, -; * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S -; * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX -; * enabled. I will attempt to merge the MMX code into this version. Newer -; * versions of this and inffast.S can be found at -; * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ -; * -; * 2005 : modification by Gilles Vollant -; */ -; For Visual C++ 4.x and higher and ML 6.x and higher -; ml.exe is in directory \MASM611C of Win95 DDK -; ml.exe is also distributed in http://www.masm32.com/masmdl.htm -; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/ -; -; -; compile with command line option -; ml /coff /Zi /c /Flinffas32.lst inffas32.asm - -; if you define NO_GZIP (see inflate.h), compile with -; ml /coff /Zi /c /Flinffas32.lst /DNO_GUNZIP inffas32.asm - - -; zlib122sup is 0 fort zlib 1.2.2.1 and lower -; zlib122sup is 8 fort zlib 1.2.2.2 and more (with addition of dmax and head -; in inflate_state in inflate.h) -zlib1222sup equ 8 - - -IFDEF GUNZIP - INFLATE_MODE_TYPE equ 11 - INFLATE_MODE_BAD equ 26 -ELSE - IFNDEF NO_GUNZIP - INFLATE_MODE_TYPE equ 11 - INFLATE_MODE_BAD equ 26 - ELSE - INFLATE_MODE_TYPE equ 3 - INFLATE_MODE_BAD equ 17 - ENDIF -ENDIF - - -; 75 "inffast.S" -;FILE "inffast.S" - -;;;GLOBAL _inflate_fast - -;;;SECTION .text - - - - .586p - .mmx - - name inflate_fast_x86 - .MODEL FLAT - -_DATA segment -inflate_fast_use_mmx: - dd 1 - - -_TEXT segment - - - -ALIGN 4 - db 'Fast decoding Code from Chris Anderson' - db 0 - -ALIGN 4 -invalid_literal_length_code_msg: - db 'invalid literal/length code' - db 0 - -ALIGN 4 -invalid_distance_code_msg: - db 'invalid distance code' - db 0 - -ALIGN 4 -invalid_distance_too_far_msg: - db 'invalid distance too far back' - db 0 - - -ALIGN 4 -inflate_fast_mask: -dd 0 -dd 1 -dd 3 -dd 7 -dd 15 -dd 31 -dd 63 -dd 127 -dd 255 -dd 511 -dd 1023 -dd 2047 -dd 4095 -dd 8191 -dd 16383 -dd 32767 -dd 65535 -dd 131071 -dd 262143 -dd 524287 -dd 1048575 -dd 2097151 -dd 4194303 -dd 8388607 -dd 16777215 -dd 33554431 -dd 67108863 -dd 134217727 -dd 268435455 -dd 536870911 -dd 1073741823 -dd 2147483647 -dd 4294967295 - - -mode_state equ 0 ;/* state->mode */ -wsize_state equ (32+zlib1222sup) ;/* state->wsize */ -write_state equ (36+4+zlib1222sup) ;/* state->write */ -window_state equ (40+4+zlib1222sup) ;/* state->window */ -hold_state equ (44+4+zlib1222sup) ;/* state->hold */ -bits_state equ (48+4+zlib1222sup) ;/* state->bits */ -lencode_state equ (64+4+zlib1222sup) ;/* state->lencode */ -distcode_state equ (68+4+zlib1222sup) ;/* state->distcode */ -lenbits_state equ (72+4+zlib1222sup) ;/* state->lenbits */ -distbits_state equ (76+4+zlib1222sup) ;/* state->distbits */ - - -;;SECTION .text -; 205 "inffast.S" -;GLOBAL inflate_fast_use_mmx - -;SECTION .data - - -; GLOBAL inflate_fast_use_mmx:object -;.size inflate_fast_use_mmx, 4 -; 226 "inffast.S" -;SECTION .text - -ALIGN 4 -_inflate_fast proc near -.FPO (16, 4, 0, 0, 1, 0) - push edi - push esi - push ebp - push ebx - pushfd - sub esp,64 - cld - - - - - mov esi, [esp+88] - mov edi, [esi+28] - - - - - - - - mov edx, [esi+4] - mov eax, [esi+0] - - add edx,eax - sub edx,11 - - mov [esp+44],eax - mov [esp+20],edx - - mov ebp, [esp+92] - mov ecx, [esi+16] - mov ebx, [esi+12] - - sub ebp,ecx - neg ebp - add ebp,ebx - - sub ecx,257 - add ecx,ebx - - mov [esp+60],ebx - mov [esp+40],ebp - mov [esp+16],ecx -; 285 "inffast.S" - mov eax, [edi+lencode_state] - mov ecx, [edi+distcode_state] - - mov [esp+8],eax - mov [esp+12],ecx - - mov eax,1 - mov ecx, [edi+lenbits_state] - shl eax,cl - dec eax - mov [esp+0],eax - - mov eax,1 - mov ecx, [edi+distbits_state] - shl eax,cl - dec eax - mov [esp+4],eax - - mov eax, [edi+wsize_state] - mov ecx, [edi+write_state] - mov edx, [edi+window_state] - - mov [esp+52],eax - mov [esp+48],ecx - mov [esp+56],edx - - mov ebp, [edi+hold_state] - mov ebx, [edi+bits_state] -; 321 "inffast.S" - mov esi, [esp+44] - mov ecx, [esp+20] - cmp ecx,esi - ja L_align_long - - add ecx,11 - sub ecx,esi - mov eax,12 - sub eax,ecx - lea edi, [esp+28] - rep movsb - mov ecx,eax - xor eax,eax - rep stosb - lea esi, [esp+28] - mov [esp+20],esi - jmp L_is_aligned - - -L_align_long: - test esi,3 - jz L_is_aligned - xor eax,eax - mov al, [esi] - inc esi - mov ecx,ebx - add ebx,8 - shl eax,cl - or ebp,eax - jmp L_align_long - -L_is_aligned: - mov edi, [esp+60] -; 366 "inffast.S" -L_check_mmx: - cmp dword ptr [inflate_fast_use_mmx],2 - je L_init_mmx - ja L_do_loop - - push eax - push ebx - push ecx - push edx - pushfd - mov eax, [esp] - xor dword ptr [esp],0200000h - - - - - popfd - pushfd - pop edx - xor edx,eax - jz L_dont_use_mmx - xor eax,eax - cpuid - cmp ebx,0756e6547h - jne L_dont_use_mmx - cmp ecx,06c65746eh - jne L_dont_use_mmx - cmp edx,049656e69h - jne L_dont_use_mmx - mov eax,1 - cpuid - shr eax,8 - and eax,15 - cmp eax,6 - jne L_dont_use_mmx - test edx,0800000h - jnz L_use_mmx - jmp L_dont_use_mmx -L_use_mmx: - mov dword ptr [inflate_fast_use_mmx],2 - jmp L_check_mmx_pop -L_dont_use_mmx: - mov dword ptr [inflate_fast_use_mmx],3 -L_check_mmx_pop: - pop edx - pop ecx - pop ebx - pop eax - jmp L_check_mmx -; 426 "inffast.S" -ALIGN 4 -L_do_loop: -; 437 "inffast.S" - cmp bl,15 - ja L_get_length_code - - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - -L_get_length_code: - mov edx, [esp+0] - mov ecx, [esp+8] - and edx,ebp - mov eax, [ecx+edx*4] - -L_dolen: - - - - - - - mov cl,ah - sub bl,ah - shr ebp,cl - - - - - - - test al,al - jnz L_test_for_length_base - - shr eax,16 - stosb - -L_while_test: - - - cmp [esp+16],edi - jbe L_break_loop - - cmp [esp+20],esi - ja L_do_loop - jmp L_break_loop - -L_test_for_length_base: -; 502 "inffast.S" - mov edx,eax - shr edx,16 - mov cl,al - - test al,16 - jz L_test_for_second_level_length - and cl,15 - jz L_save_len - cmp bl,cl - jae L_add_bits_to_len - - mov ch,cl - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - mov cl,ch - -L_add_bits_to_len: - mov eax,1 - shl eax,cl - dec eax - sub bl,cl - and eax,ebp - shr ebp,cl - add edx,eax - -L_save_len: - mov [esp+24],edx - - -L_decode_distance: -; 549 "inffast.S" - cmp bl,15 - ja L_get_distance_code - - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - -L_get_distance_code: - mov edx, [esp+4] - mov ecx, [esp+12] - and edx,ebp - mov eax, [ecx+edx*4] - - -L_dodist: - mov edx,eax - shr edx,16 - mov cl,ah - sub bl,ah - shr ebp,cl -; 584 "inffast.S" - mov cl,al - - test al,16 - jz L_test_for_second_level_dist - and cl,15 - jz L_check_dist_one - cmp bl,cl - jae L_add_bits_to_dist - - mov ch,cl - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - mov cl,ch - -L_add_bits_to_dist: - mov eax,1 - shl eax,cl - dec eax - sub bl,cl - and eax,ebp - shr ebp,cl - add edx,eax - jmp L_check_window - -L_check_window: -; 625 "inffast.S" - mov [esp+44],esi - mov eax,edi - sub eax, [esp+40] - - cmp eax,edx - jb L_clip_window - - mov ecx, [esp+24] - mov esi,edi - sub esi,edx - - sub ecx,3 - mov al, [esi] - mov [edi],al - mov al, [esi+1] - mov dl, [esi+2] - add esi,3 - mov [edi+1],al - mov [edi+2],dl - add edi,3 - rep movsb - - mov esi, [esp+44] - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp edx,1 - jne L_check_window - cmp [esp+40],edi - je L_check_window - - dec edi - mov ecx, [esp+24] - mov al, [edi] - sub ecx,3 - - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - add edi,4 - rep stosb - - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - - - - - test al,64 - jnz L_test_for_end_of_block - - mov eax,1 - shl eax,cl - dec eax - and eax,ebp - add eax,edx - mov edx, [esp+8] - mov eax, [edx+eax*4] - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - - - - - test al,64 - jnz L_invalid_distance_code - - mov eax,1 - shl eax,cl - dec eax - and eax,ebp - add eax,edx - mov edx, [esp+12] - mov eax, [edx+eax*4] - jmp L_dodist - -ALIGN 4 -L_clip_window: -; 721 "inffast.S" - mov ecx,eax - mov eax, [esp+52] - neg ecx - mov esi, [esp+56] - - cmp eax,edx - jb L_invalid_distance_too_far - - add ecx,edx - cmp dword ptr [esp+48],0 - jne L_wrap_around_window - - sub eax,ecx - add esi,eax -; 749 "inffast.S" - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - -L_wrap_around_window: -; 793 "inffast.S" - mov eax, [esp+48] - cmp ecx,eax - jbe L_contiguous_in_window - - add esi, [esp+52] - add esi,eax - sub esi,ecx - sub ecx,eax - - - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi, [esp+56] - mov ecx, [esp+48] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - -L_contiguous_in_window: -; 836 "inffast.S" - add esi,eax - sub esi,ecx - - - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - -L_do_copy1: -; 862 "inffast.S" - mov ecx,eax - rep movsb - - mov esi, [esp+44] - jmp L_while_test -; 878 "inffast.S" -ALIGN 4 -L_init_mmx: - emms - - - - - - movd mm0,ebp - mov ebp,ebx -; 896 "inffast.S" - movd mm4,dword ptr [esp+0] - movq mm3,mm4 - movd mm5,dword ptr [esp+4] - movq mm2,mm5 - pxor mm1,mm1 - mov ebx, [esp+8] - jmp L_do_loop_mmx - -ALIGN 4 -L_do_loop_mmx: - psrlq mm0,mm1 - - cmp ebp,32 - ja L_get_length_code_mmx - - movd mm6,ebp - movd mm7,dword ptr [esi] - add esi,4 - psllq mm7,mm6 - add ebp,32 - por mm0,mm7 - -L_get_length_code_mmx: - pand mm4,mm0 - movd eax,mm4 - movq mm4,mm3 - mov eax, [ebx+eax*4] - -L_dolen_mmx: - movzx ecx,ah - movd mm1,ecx - sub ebp,ecx - - test al,al - jnz L_test_for_length_base_mmx - - shr eax,16 - stosb - -L_while_test_mmx: - - - cmp [esp+16],edi - jbe L_break_loop - - cmp [esp+20],esi - ja L_do_loop_mmx - jmp L_break_loop - -L_test_for_length_base_mmx: - - mov edx,eax - shr edx,16 - - test al,16 - jz L_test_for_second_level_length_mmx - and eax,15 - jz L_decode_distance_mmx - - psrlq mm0,mm1 - movd mm1,eax - movd ecx,mm0 - sub ebp,eax - and ecx, [inflate_fast_mask+eax*4] - add edx,ecx - -L_decode_distance_mmx: - psrlq mm0,mm1 - - cmp ebp,32 - ja L_get_dist_code_mmx - - movd mm6,ebp - movd mm7,dword ptr [esi] - add esi,4 - psllq mm7,mm6 - add ebp,32 - por mm0,mm7 - -L_get_dist_code_mmx: - mov ebx, [esp+12] - pand mm5,mm0 - movd eax,mm5 - movq mm5,mm2 - mov eax, [ebx+eax*4] - -L_dodist_mmx: - - movzx ecx,ah - mov ebx,eax - shr ebx,16 - sub ebp,ecx - movd mm1,ecx - - test al,16 - jz L_test_for_second_level_dist_mmx - and eax,15 - jz L_check_dist_one_mmx - -L_add_bits_to_dist_mmx: - psrlq mm0,mm1 - movd mm1,eax - movd ecx,mm0 - sub ebp,eax - and ecx, [inflate_fast_mask+eax*4] - add ebx,ecx - -L_check_window_mmx: - mov [esp+44],esi - mov eax,edi - sub eax, [esp+40] - - cmp eax,ebx - jb L_clip_window_mmx - - mov ecx,edx - mov esi,edi - sub esi,ebx - - sub ecx,3 - mov al, [esi] - mov [edi],al - mov al, [esi+1] - mov dl, [esi+2] - add esi,3 - mov [edi+1],al - mov [edi+2],dl - add edi,3 - rep movsb - - mov esi, [esp+44] - mov ebx, [esp+8] - jmp L_while_test_mmx - -ALIGN 4 -L_check_dist_one_mmx: - cmp ebx,1 - jne L_check_window_mmx - cmp [esp+40],edi - je L_check_window_mmx - - dec edi - mov ecx,edx - mov al, [edi] - sub ecx,3 - - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - add edi,4 - rep stosb - - mov ebx, [esp+8] - jmp L_while_test_mmx - -ALIGN 4 -L_test_for_second_level_length_mmx: - test al,64 - jnz L_test_for_end_of_block - - and eax,15 - psrlq mm0,mm1 - movd ecx,mm0 - and ecx, [inflate_fast_mask+eax*4] - add ecx,edx - mov eax, [ebx+ecx*4] - jmp L_dolen_mmx - -ALIGN 4 -L_test_for_second_level_dist_mmx: - test al,64 - jnz L_invalid_distance_code - - and eax,15 - psrlq mm0,mm1 - movd ecx,mm0 - and ecx, [inflate_fast_mask+eax*4] - mov eax, [esp+12] - add ecx,ebx - mov eax, [eax+ecx*4] - jmp L_dodist_mmx - -ALIGN 4 -L_clip_window_mmx: - - mov ecx,eax - mov eax, [esp+52] - neg ecx - mov esi, [esp+56] - - cmp eax,ebx - jb L_invalid_distance_too_far - - add ecx,ebx - cmp dword ptr [esp+48],0 - jne L_wrap_around_window_mmx - - sub eax,ecx - add esi,eax - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - -L_wrap_around_window_mmx: - - mov eax, [esp+48] - cmp ecx,eax - jbe L_contiguous_in_window_mmx - - add esi, [esp+52] - add esi,eax - sub esi,ecx - sub ecx,eax - - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi, [esp+56] - mov ecx, [esp+48] - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - -L_contiguous_in_window_mmx: - - add esi,eax - sub esi,ecx - - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - -L_do_copy1_mmx: - - - mov ecx,edx - rep movsb - - mov esi, [esp+44] - mov ebx, [esp+8] - jmp L_while_test_mmx -; 1174 "inffast.S" -L_invalid_distance_code: - - - - - - mov ecx, invalid_distance_code_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_test_for_end_of_block: - - - - - - test al,32 - jz L_invalid_literal_length_code - - mov ecx,0 - mov edx,INFLATE_MODE_TYPE - jmp L_update_stream_state - -L_invalid_literal_length_code: - - - - - - mov ecx, invalid_literal_length_code_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_invalid_distance_too_far: - - - - mov esi, [esp+44] - mov ecx, invalid_distance_too_far_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_update_stream_state: - - mov eax, [esp+88] - test ecx,ecx - jz L_skip_msg - mov [eax+24],ecx -L_skip_msg: - mov eax, [eax+28] - mov [eax+mode_state],edx - jmp L_break_loop - -ALIGN 4 -L_break_loop: -; 1243 "inffast.S" - cmp dword ptr [inflate_fast_use_mmx],2 - jne L_update_next_in - - - - mov ebx,ebp - -L_update_next_in: -; 1266 "inffast.S" - mov eax, [esp+88] - mov ecx,ebx - mov edx, [eax+28] - shr ecx,3 - sub esi,ecx - shl ecx,3 - sub ebx,ecx - mov [eax+12],edi - mov [edx+bits_state],ebx - mov ecx,ebx - - lea ebx, [esp+28] - cmp [esp+20],ebx - jne L_buf_not_used - - sub esi,ebx - mov ebx, [eax+0] - mov [esp+20],ebx - add esi,ebx - mov ebx, [eax+4] - sub ebx,11 - add [esp+20],ebx - -L_buf_not_used: - mov [eax+0],esi - - mov ebx,1 - shl ebx,cl - dec ebx - - - - - - cmp dword ptr [inflate_fast_use_mmx],2 - jne L_update_hold - - - - psrlq mm0,mm1 - movd ebp,mm0 - - emms - -L_update_hold: - - - - and ebp,ebx - mov [edx+hold_state],ebp - - - - - mov ebx, [esp+20] - cmp ebx,esi - jbe L_last_is_smaller - - sub ebx,esi - add ebx,11 - mov [eax+4],ebx - jmp L_fixup_out -L_last_is_smaller: - sub esi,ebx - neg esi - add esi,11 - mov [eax+4],esi - - - - -L_fixup_out: - - mov ebx, [esp+16] - cmp ebx,edi - jbe L_end_is_smaller - - sub ebx,edi - add ebx,257 - mov [eax+16],ebx - jmp L_done -L_end_is_smaller: - sub edi,ebx - neg edi - add edi,257 - mov [eax+16],edi - - - - - -L_done: - add esp,64 - popfd - pop ebx - pop ebp - pop esi - pop edi - ret -_inflate_fast endp - -_TEXT ends -end diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx86/match686.asm b/src/dependencies/zlib-1.2.11/contrib/masmx86/match686.asm deleted file mode 100644 index 3b09212..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx86/match686.asm +++ /dev/null @@ -1,479 +0,0 @@ -; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86 -; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant. -; File written by Gilles Vollant, by converting match686.S from Brian Raiter -; for MASM. This is as assembly version of longest_match -; from Jean-loup Gailly in deflate.c -; -; http://www.zlib.net -; http://www.winimage.com/zLibDll -; http://www.muppetlabs.com/~breadbox/software/assembly.html -; -; For Visual C++ 4.x and higher and ML 6.x and higher -; ml.exe is distributed in -; http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 -; -; this file contain two implementation of longest_match -; -; this longest_match was written by Brian raiter (1998), optimized for Pentium Pro -; (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom) -; -; for using an assembly version of longest_match, you need define ASMV in project -; -; compile the asm file running -; ml /coff /Zi /c /Flmatch686.lst match686.asm -; and do not include match686.obj in your project -; -; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for -; Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor -; with autoselect (with cpu detection code) -; if you want support the old pentium optimization, you can still use these version -; -; this file is not optimized for old pentium, but it compatible with all x86 32 bits -; processor (starting 80386) -; -; -; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2 - -;uInt longest_match(s, cur_match) -; deflate_state *s; -; IPos cur_match; /* current match */ - - NbStack equ 76 - cur_match equ dword ptr[esp+NbStack-0] - str_s equ dword ptr[esp+NbStack-4] -; 5 dword on top (ret,ebp,esi,edi,ebx) - adrret equ dword ptr[esp+NbStack-8] - pushebp equ dword ptr[esp+NbStack-12] - pushedi equ dword ptr[esp+NbStack-16] - pushesi equ dword ptr[esp+NbStack-20] - pushebx equ dword ptr[esp+NbStack-24] - - chain_length equ dword ptr [esp+NbStack-28] - limit equ dword ptr [esp+NbStack-32] - best_len equ dword ptr [esp+NbStack-36] - window equ dword ptr [esp+NbStack-40] - prev equ dword ptr [esp+NbStack-44] - scan_start equ word ptr [esp+NbStack-48] - wmask equ dword ptr [esp+NbStack-52] - match_start_ptr equ dword ptr [esp+NbStack-56] - nice_match equ dword ptr [esp+NbStack-60] - scan equ dword ptr [esp+NbStack-64] - - windowlen equ dword ptr [esp+NbStack-68] - match_start equ dword ptr [esp+NbStack-72] - strend equ dword ptr [esp+NbStack-76] - NbStackAdd equ (NbStack-24) - - .386p - - name gvmatch - .MODEL FLAT - - - -; all the +zlib1222add offsets are due to the addition of fields -; in zlib in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). -; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). -; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - - zlib1222add equ 8 - -; Note : these value are good with a 8 bytes boundary pack structure - dep_chain_length equ 74h+zlib1222add - dep_window equ 30h+zlib1222add - dep_strstart equ 64h+zlib1222add - dep_prev_length equ 70h+zlib1222add - dep_nice_match equ 88h+zlib1222add - dep_w_size equ 24h+zlib1222add - dep_prev equ 38h+zlib1222add - dep_w_mask equ 2ch+zlib1222add - dep_good_match equ 84h+zlib1222add - dep_match_start equ 68h+zlib1222add - dep_lookahead equ 6ch+zlib1222add - - -_TEXT segment - -IFDEF NOUNDERLINE - public longest_match - public match_init -ELSE - public _longest_match - public _match_init -ENDIF - - MAX_MATCH equ 258 - MIN_MATCH equ 3 - MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) - - - -MAX_MATCH equ 258 -MIN_MATCH equ 3 -MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1) -MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h) - - -;;; stack frame offsets - -chainlenwmask equ esp + 0 ; high word: current chain len - ; low word: s->wmask -window equ esp + 4 ; local copy of s->window -windowbestlen equ esp + 8 ; s->window + bestlen -scanstart equ esp + 16 ; first two bytes of string -scanend equ esp + 12 ; last two bytes of string -scanalign equ esp + 20 ; dword-misalignment of string -nicematch equ esp + 24 ; a good enough match size -bestlen equ esp + 28 ; size of best match so far -scan equ esp + 32 ; ptr to string wanting match - -LocalVarsSize equ 36 -; saved ebx byte esp + 36 -; saved edi byte esp + 40 -; saved esi byte esp + 44 -; saved ebp byte esp + 48 -; return address byte esp + 52 -deflatestate equ esp + 56 ; the function arguments -curmatch equ esp + 60 - -;;; Offsets for fields in the deflate_state structure. These numbers -;;; are calculated from the definition of deflate_state, with the -;;; assumption that the compiler will dword-align the fields. (Thus, -;;; changing the definition of deflate_state could easily cause this -;;; program to crash horribly, without so much as a warning at -;;; compile time. Sigh.) - -dsWSize equ 36+zlib1222add -dsWMask equ 44+zlib1222add -dsWindow equ 48+zlib1222add -dsPrev equ 56+zlib1222add -dsMatchLen equ 88+zlib1222add -dsPrevMatch equ 92+zlib1222add -dsStrStart equ 100+zlib1222add -dsMatchStart equ 104+zlib1222add -dsLookahead equ 108+zlib1222add -dsPrevLen equ 112+zlib1222add -dsMaxChainLen equ 116+zlib1222add -dsGoodMatch equ 132+zlib1222add -dsNiceMatch equ 136+zlib1222add - - -;;; match686.asm -- Pentium-Pro-optimized version of longest_match() -;;; Written for zlib 1.1.2 -;;; Copyright (C) 1998 Brian Raiter -;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html -;;; -;; -;; This software is provided 'as-is', without any express or implied -;; warranty. In no event will the authors be held liable for any damages -;; arising from the use of this software. -;; -;; Permission is granted to anyone to use this software for any purpose, -;; including commercial applications, and to alter it and redistribute it -;; freely, subject to the following restrictions: -;; -;; 1. The origin of this software must not be misrepresented; you must not -;; claim that you wrote the original software. If you use this software -;; in a product, an acknowledgment in the product documentation would be -;; appreciated but is not required. -;; 2. Altered source versions must be plainly marked as such, and must not be -;; misrepresented as being the original software -;; 3. This notice may not be removed or altered from any source distribution. -;; - -;GLOBAL _longest_match, _match_init - - -;SECTION .text - -;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch) - -;_longest_match: - IFDEF NOUNDERLINE - longest_match proc near - ELSE - _longest_match proc near - ENDIF -.FPO (9, 4, 0, 0, 1, 0) - -;;; Save registers that the compiler may be using, and adjust esp to -;;; make room for our stack frame. - - push ebp - push edi - push esi - push ebx - sub esp, LocalVarsSize - -;;; Retrieve the function arguments. ecx will hold cur_match -;;; throughout the entire function. edx will hold the pointer to the -;;; deflate_state structure during the function's setup (before -;;; entering the main loop. - - mov edx, [deflatestate] - mov ecx, [curmatch] - -;;; uInt wmask = s->w_mask; -;;; unsigned chain_length = s->max_chain_length; -;;; if (s->prev_length >= s->good_match) { -;;; chain_length >>= 2; -;;; } - - mov eax, [edx + dsPrevLen] - mov ebx, [edx + dsGoodMatch] - cmp eax, ebx - mov eax, [edx + dsWMask] - mov ebx, [edx + dsMaxChainLen] - jl LastMatchGood - shr ebx, 2 -LastMatchGood: - -;;; chainlen is decremented once beforehand so that the function can -;;; use the sign flag instead of the zero flag for the exit test. -;;; It is then shifted into the high word, to make room for the wmask -;;; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - mov [chainlenwmask], ebx - -;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - mov eax, [edx + dsNiceMatch] - mov ebx, [edx + dsLookahead] - cmp ebx, eax - jl LookaheadLess - mov ebx, eax -LookaheadLess: mov [nicematch], ebx - -;;; register Bytef *scan = s->window + s->strstart; - - mov esi, [edx + dsWindow] - mov [window], esi - mov ebp, [edx + dsStrStart] - lea edi, [esi + ebp] - mov [scan], edi - -;;; Determine how many bytes the scan ptr is off from being -;;; dword-aligned. - - mov eax, edi - neg eax - and eax, 3 - mov [scanalign], eax - -;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -;;; s->strstart - (IPos)MAX_DIST(s) : NIL; - - mov eax, [edx + dsWSize] - sub eax, MIN_LOOKAHEAD - sub ebp, eax - jg LimitPositive - xor ebp, ebp -LimitPositive: - -;;; int best_len = s->prev_length; - - mov eax, [edx + dsPrevLen] - mov [bestlen], eax - -;;; Store the sum of s->window + best_len in esi locally, and in esi. - - add esi, eax - mov [windowbestlen], esi - -;;; register ush scan_start = *(ushf*)scan; -;;; register ush scan_end = *(ushf*)(scan+best_len-1); -;;; Posf *prev = s->prev; - - movzx ebx, word ptr [edi] - mov [scanstart], ebx - movzx ebx, word ptr [edi + eax - 1] - mov [scanend], ebx - mov edi, [edx + dsPrev] - -;;; Jump into the main loop. - - mov edx, [chainlenwmask] - jmp short LoopEntry - -align 4 - -;;; do { -;;; match = s->window + cur_match; -;;; if (*(ushf*)(match+best_len-1) != scan_end || -;;; *(ushf*)match != scan_start) continue; -;;; [...] -;;; } while ((cur_match = prev[cur_match & wmask]) > limit -;;; && --chain_length != 0); -;;; -;;; Here is the inner loop of the function. The function will spend the -;;; majority of its time in this loop, and majority of that time will -;;; be spent in the first ten instructions. -;;; -;;; Within this loop: -;;; ebx = scanend -;;; ecx = curmatch -;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -;;; esi = windowbestlen - i.e., (window + bestlen) -;;; edi = prev -;;; ebp = limit - -LookupLoop: - and ecx, edx - movzx ecx, word ptr [edi + ecx*2] - cmp ecx, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow -LoopEntry: movzx eax, word ptr [esi + ecx - 1] - cmp eax, ebx - jnz LookupLoop - mov eax, [window] - movzx eax, word ptr [eax + ecx] - cmp eax, [scanstart] - jnz LookupLoop - -;;; Store the current value of chainlen. - - mov [chainlenwmask], edx - -;;; Point edi to the string under scrutiny, and esi to the string we -;;; are hoping to match it up with. In actuality, esi and edi are -;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is -;;; initialized to -(MAX_MATCH_8 - scanalign). - - mov esi, [window] - mov edi, [scan] - add esi, ecx - mov eax, [scanalign] - mov edx, 0fffffef8h; -(MAX_MATCH_8) - lea edi, [edi + eax + 0108h] ;MAX_MATCH_8] - lea esi, [esi + eax + 0108h] ;MAX_MATCH_8] - -;;; Test the strings for equality, 8 bytes at a time. At the end, -;;; adjust edx so that it is offset to the exact byte that mismatched. -;;; -;;; We already know at this point that the first three bytes of the -;;; strings match each other, and they can be safely passed over before -;;; starting the compare loop. So what this code does is skip over 0-3 -;;; bytes, as much as necessary in order to dword-align the edi -;;; pointer. (esi will still be misaligned three times out of four.) -;;; -;;; It should be confessed that this loop usually does not represent -;;; much of the total running time. Replacing it with a more -;;; straightforward "rep cmpsb" would not drastically degrade -;;; performance. - -LoopCmps: - mov eax, [esi + edx] - xor eax, [edi + edx] - jnz LeaveLoopCmps - mov eax, [esi + edx + 4] - xor eax, [edi + edx + 4] - jnz LeaveLoopCmps4 - add edx, 8 - jnz LoopCmps - jmp short LenMaximum -LeaveLoopCmps4: add edx, 4 -LeaveLoopCmps: test eax, 0000FFFFh - jnz LenLower - add edx, 2 - shr eax, 16 -LenLower: sub al, 1 - adc edx, 0 - -;;; Calculate the length of the match. If it is longer than MAX_MATCH, -;;; then automatically accept it as the best possible match and leave. - - lea eax, [edi + edx] - mov edi, [scan] - sub eax, edi - cmp eax, MAX_MATCH - jge LenMaximum - -;;; If the length of the match is not longer than the best match we -;;; have so far, then forget it and return to the lookup loop. - - mov edx, [deflatestate] - mov ebx, [bestlen] - cmp eax, ebx - jg LongerMatch - mov esi, [windowbestlen] - mov edi, [edx + dsPrev] - mov ebx, [scanend] - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; s->match_start = cur_match; -;;; best_len = len; -;;; if (len >= nice_match) break; -;;; scan_end = *(ushf*)(scan+best_len-1); - -LongerMatch: mov ebx, [nicematch] - mov [bestlen], eax - mov [edx + dsMatchStart], ecx - cmp eax, ebx - jge LeaveNow - mov esi, [window] - add esi, eax - mov [windowbestlen], esi - movzx ebx, word ptr [edi + eax - 1] - mov edi, [edx + dsPrev] - mov [scanend], ebx - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; Accept the current string, with the maximum possible length. - -LenMaximum: mov edx, [deflatestate] - mov dword ptr [bestlen], MAX_MATCH - mov [edx + dsMatchStart], ecx - -;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -;;; return s->lookahead; - -LeaveNow: - mov edx, [deflatestate] - mov ebx, [bestlen] - mov eax, [edx + dsLookahead] - cmp ebx, eax - jg LookaheadRet - mov eax, ebx -LookaheadRet: - -;;; Restore the stack and return from whence we came. - - add esp, LocalVarsSize - pop ebx - pop esi - pop edi - pop ebp - - ret -; please don't remove this string ! -; Your can freely use match686 in any free or commercial app if you don't remove the string in the binary! - db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah - - - IFDEF NOUNDERLINE - longest_match endp - ELSE - _longest_match endp - ENDIF - - IFDEF NOUNDERLINE - match_init proc near - ret - match_init endp - ELSE - _match_init proc near - ret - _match_init endp - ENDIF - - -_TEXT ends -end diff --git a/src/dependencies/zlib-1.2.11/contrib/masmx86/readme.txt b/src/dependencies/zlib-1.2.11/contrib/masmx86/readme.txt deleted file mode 100644 index 3271f72..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/masmx86/readme.txt +++ /dev/null @@ -1,27 +0,0 @@ - -Summary -------- -This directory contains ASM implementations of the functions -longest_match() and inflate_fast(). - - -Use instructions ----------------- -Assemble using MASM, and copy the object files into the zlib source -directory, then run the appropriate makefile, as suggested below. You can -donwload MASM from here: - - http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 - -You can also get objects files here: - - http://www.winimage.com/zLibDll/zlib124_masm_obj.zip - -Build instructions ------------------- -* With Microsoft C and MASM: -nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" - -* With Borland C and TASM: -make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj" - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlib.rc b/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlib.rc deleted file mode 100644 index fee177a..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlibwapi.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.def b/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.def deleted file mode 100644 index 54e683d..0000000 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.def +++ /dev/null @@ -1,153 +0,0 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.2 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 diff --git a/src/dependencies/zlib-1.2.11/crc32.c b/src/dependencies/zlib-1.2.11/crc32.c deleted file mode 100644 index 9580440..0000000 --- a/src/dependencies/zlib-1.2.11/crc32.c +++ /dev/null @@ -1,442 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -/* @(#) $Id$ */ - -/* - Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore - protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should - first call get_crc_table() to initialize the tables before allowing more than - one thread to use crc32(). - - DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. - */ - -#ifdef MAKECRCH -# include -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif /* !DYNAMIC_CRC_TABLE */ -#endif /* MAKECRCH */ - -#include "zutil.h" /* for STDC and FAR definitions */ - -/* Definitions for doing the crc four data bytes at a time. */ -#if !defined(NOBYFOUR) && defined(Z_U4) -# define BYFOUR -#endif -#ifdef BYFOUR - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, z_size_t)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, z_size_t)); -# define TBLS 8 -#else -# define TBLS 1 -#endif /* BYFOUR */ - -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); - - -#ifdef DYNAMIC_CRC_TABLE - -local volatile int crc_table_empty = 1; -local z_crc_t FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); -#ifdef MAKECRCH - local void write_table OF((FILE *, const z_crc_t FAR *)); -#endif /* MAKECRCH */ -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - z_crc_t c; - int n, k; - z_crc_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (z_crc_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (z_crc_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = ZSWAP32(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = ZSWAP32(c); - } - } -#endif /* BYFOUR */ - - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other guy to finish (not efficient, but rare) */ - while (crc_table_empty) - ; - } - -#ifdef MAKECRCH - /* write out CRC tables to crc32.h */ - { - FILE *out; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const z_crc_t FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); - } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const z_crc_t FAR *table; -{ - int n; - - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", - (unsigned long)(table[n]), - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} -#endif /* MAKECRCH */ - -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). - */ -#include "crc32.h" -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const z_crc_t FAR * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - return (const z_crc_t FAR *)crc_table; -} - -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -unsigned long ZEXPORT crc32_z(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - if (buf == Z_NULL) return 0UL; - -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - z_crc_t endian; - - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); - } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; - } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} - -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - uInt len; -{ - return crc32_z(crc, buf, len); -} - -#ifdef BYFOUR - -/* - This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit - integer pointer type. This violates the strict aliasing rule, where a - compiler can assume, for optimization purposes, that two pointers to - fundamentally different types won't ever point to the same memory. This can - manifest as a problem only if one of the pointers is written to. This code - only reads from those pointers. So long as this code remains isolated in - this compilation unit, there won't be a problem. For this reason, this code - should not be copied and pasted into a compilation unit in which other code - writes to the buffer that is passed to these routines. - */ - -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = (z_crc_t)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} - -/* ========================================================================= */ -#define DOBIG4 c ^= *buf4++; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = ZSWAP32((z_crc_t)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOBIG32; - len -= 32; - } - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(ZSWAP32(c)); -} - -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - -/* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; -{ - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - -/* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; -{ - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= */ -local uLong crc32_combine_(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case (also disallow negative lengths) */ - if (len2 <= 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } - - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} - -uLong ZEXPORT crc32_combine64(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} diff --git a/src/dependencies/zlib-1.2.11/crc32.h b/src/dependencies/zlib-1.2.11/crc32.h deleted file mode 100644 index 9e0c778..0000000 --- a/src/dependencies/zlib-1.2.11/crc32.h +++ /dev/null @@ -1,441 +0,0 @@ -/* crc32.h -- tables for rapid CRC calculation - * Generated automatically by crc32.c - */ - -local const z_crc_t FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL -#endif - } -}; diff --git a/src/dependencies/zlib-1.2.11/examples/enough.c b/src/dependencies/zlib-1.2.11/examples/enough.c deleted file mode 100644 index b991144..0000000 --- a/src/dependencies/zlib-1.2.11/examples/enough.c +++ /dev/null @@ -1,572 +0,0 @@ -/* enough.c -- determine the maximum size of inflate's Huffman code tables over - * all possible valid and complete Huffman codes, subject to a length limit. - * Copyright (C) 2007, 2008, 2012 Mark Adler - * Version 1.4 18 August 2012 Mark Adler - */ - -/* Version history: - 1.0 3 Jan 2007 First version (derived from codecount.c version 1.4) - 1.1 4 Jan 2007 Use faster incremental table usage computation - Prune examine() search on previously visited states - 1.2 5 Jan 2007 Comments clean up - As inflate does, decrease root for short codes - Refuse cases where inflate would increase root - 1.3 17 Feb 2008 Add argument for initial root table size - Fix bug for initial root table size == max - 1 - Use a macro to compute the history index - 1.4 18 Aug 2012 Avoid shifts more than bits in type (caused endless loop!) - Clean up comparisons of different types - Clean up code indentation - */ - -/* - Examine all possible Huffman codes for a given number of symbols and a - maximum code length in bits to determine the maximum table size for zilb's - inflate. Only complete Huffman codes are counted. - - Two codes are considered distinct if the vectors of the number of codes per - length are not identical. So permutations of the symbol assignments result - in the same code for the counting, as do permutations of the assignments of - the bit values to the codes (i.e. only canonical codes are counted). - - We build a code from shorter to longer lengths, determining how many symbols - are coded at each length. At each step, we have how many symbols remain to - be coded, what the last code length used was, and how many bit patterns of - that length remain unused. Then we add one to the code length and double the - number of unused patterns to graduate to the next code length. We then - assign all portions of the remaining symbols to that code length that - preserve the properties of a correct and eventually complete code. Those - properties are: we cannot use more bit patterns than are available; and when - all the symbols are used, there are exactly zero possible bit patterns - remaining. - - The inflate Huffman decoding algorithm uses two-level lookup tables for - speed. There is a single first-level table to decode codes up to root bits - in length (root == 9 in the current inflate implementation). The table - has 1 << root entries and is indexed by the next root bits of input. Codes - shorter than root bits have replicated table entries, so that the correct - entry is pointed to regardless of the bits that follow the short code. If - the code is longer than root bits, then the table entry points to a second- - level table. The size of that table is determined by the longest code with - that root-bit prefix. If that longest code has length len, then the table - has size 1 << (len - root), to index the remaining bits in that set of - codes. Each subsequent root-bit prefix then has its own sub-table. The - total number of table entries required by the code is calculated - incrementally as the number of codes at each bit length is populated. When - all of the codes are shorter than root bits, then root is reduced to the - longest code length, resulting in a single, smaller, one-level table. - - The inflate algorithm also provides for small values of root (relative to - the log2 of the number of symbols), where the shortest code has more bits - than root. In that case, root is increased to the length of the shortest - code. This program, by design, does not handle that case, so it is verified - that the number of symbols is less than 2^(root + 1). - - In order to speed up the examination (by about ten orders of magnitude for - the default arguments), the intermediate states in the build-up of a code - are remembered and previously visited branches are pruned. The memory - required for this will increase rapidly with the total number of symbols and - the maximum code length in bits. However this is a very small price to pay - for the vast speedup. - - First, all of the possible Huffman codes are counted, and reachable - intermediate states are noted by a non-zero count in a saved-results array. - Second, the intermediate states that lead to (root + 1) bit or longer codes - are used to look at all sub-codes from those junctures for their inflate - memory usage. (The amount of memory used is not affected by the number of - codes of root bits or less in length.) Third, the visited states in the - construction of those sub-codes and the associated calculation of the table - size is recalled in order to avoid recalculating from the same juncture. - Beginning the code examination at (root + 1) bit codes, which is enabled by - identifying the reachable nodes, accounts for about six of the orders of - magnitude of improvement for the default arguments. About another four - orders of magnitude come from not revisiting previous states. Out of - approximately 2x10^16 possible Huffman codes, only about 2x10^6 sub-codes - need to be examined to cover all of the possible table memory usage cases - for the default arguments of 286 symbols limited to 15-bit codes. - - Note that an unsigned long long type is used for counting. It is quite easy - to exceed the capacity of an eight-byte integer with a large number of - symbols and a large maximum code length, so multiple-precision arithmetic - would need to replace the unsigned long long arithmetic in that case. This - program will abort if an overflow occurs. The big_t type identifies where - the counting takes place. - - An unsigned long long type is also used for calculating the number of - possible codes remaining at the maximum length. This limits the maximum - code length to the number of bits in a long long minus the number of bits - needed to represent the symbols in a flat code. The code_t type identifies - where the bit pattern counting takes place. - */ - -#include -#include -#include -#include - -#define local static - -/* special data types */ -typedef unsigned long long big_t; /* type for code counting */ -typedef unsigned long long code_t; /* type for bit pattern counting */ -struct tab { /* type for been here check */ - size_t len; /* length of bit vector in char's */ - char *vec; /* allocated bit vector */ -}; - -/* The array for saving results, num[], is indexed with this triplet: - - syms: number of symbols remaining to code - left: number of available bit patterns at length len - len: number of bits in the codes currently being assigned - - Those indices are constrained thusly when saving results: - - syms: 3..totsym (totsym == total symbols to code) - left: 2..syms - 1, but only the evens (so syms == 8 -> 2, 4, 6) - len: 1..max - 1 (max == maximum code length in bits) - - syms == 2 is not saved since that immediately leads to a single code. left - must be even, since it represents the number of available bit patterns at - the current length, which is double the number at the previous length. - left ends at syms-1 since left == syms immediately results in a single code. - (left > sym is not allowed since that would result in an incomplete code.) - len is less than max, since the code completes immediately when len == max. - - The offset into the array is calculated for the three indices with the - first one (syms) being outermost, and the last one (len) being innermost. - We build the array with length max-1 lists for the len index, with syms-3 - of those for each symbol. There are totsym-2 of those, with each one - varying in length as a function of sym. See the calculation of index in - count() for the index, and the calculation of size in main() for the size - of the array. - - For the deflate example of 286 symbols limited to 15-bit codes, the array - has 284,284 entries, taking up 2.17 MB for an 8-byte big_t. More than - half of the space allocated for saved results is actually used -- not all - possible triplets are reached in the generation of valid Huffman codes. - */ - -/* The array for tracking visited states, done[], is itself indexed identically - to the num[] array as described above for the (syms, left, len) triplet. - Each element in the array is further indexed by the (mem, rem) doublet, - where mem is the amount of inflate table space used so far, and rem is the - remaining unused entries in the current inflate sub-table. Each indexed - element is simply one bit indicating whether the state has been visited or - not. Since the ranges for mem and rem are not known a priori, each bit - vector is of a variable size, and grows as needed to accommodate the visited - states. mem and rem are used to calculate a single index in a triangular - array. Since the range of mem is expected in the default case to be about - ten times larger than the range of rem, the array is skewed to reduce the - memory usage, with eight times the range for mem than for rem. See the - calculations for offset and bit in beenhere() for the details. - - For the deflate example of 286 symbols limited to 15-bit codes, the bit - vectors grow to total approximately 21 MB, in addition to the 4.3 MB done[] - array itself. - */ - -/* Globals to avoid propagating constants or constant pointers recursively */ -local int max; /* maximum allowed bit length for the codes */ -local int root; /* size of base code table in bits */ -local int large; /* largest code table so far */ -local size_t size; /* number of elements in num and done */ -local int *code; /* number of symbols assigned to each bit length */ -local big_t *num; /* saved results array for code counting */ -local struct tab *done; /* states already evaluated array */ - -/* Index function for num[] and done[] */ -#define INDEX(i,j,k) (((size_t)((i-1)>>1)*((i-2)>>1)+(j>>1)-1)*(max-1)+k-1) - -/* Free allocated space. Uses globals code, num, and done. */ -local void cleanup(void) -{ - size_t n; - - if (done != NULL) { - for (n = 0; n < size; n++) - if (done[n].len) - free(done[n].vec); - free(done); - } - if (num != NULL) - free(num); - if (code != NULL) - free(code); -} - -/* Return the number of possible Huffman codes using bit patterns of lengths - len through max inclusive, coding syms symbols, with left bit patterns of - length len unused -- return -1 if there is an overflow in the counting. - Keep a record of previous results in num to prevent repeating the same - calculation. Uses the globals max and num. */ -local big_t count(int syms, int len, int left) -{ - big_t sum; /* number of possible codes from this juncture */ - big_t got; /* value returned from count() */ - int least; /* least number of syms to use at this juncture */ - int most; /* most number of syms to use at this juncture */ - int use; /* number of bit patterns to use in next call */ - size_t index; /* index of this case in *num */ - - /* see if only one possible code */ - if (syms == left) - return 1; - - /* note and verify the expected state */ - assert(syms > left && left > 0 && len < max); - - /* see if we've done this one already */ - index = INDEX(syms, left, len); - got = num[index]; - if (got) - return got; /* we have -- return the saved result */ - - /* we need to use at least this many bit patterns so that the code won't be - incomplete at the next length (more bit patterns than symbols) */ - least = (left << 1) - syms; - if (least < 0) - least = 0; - - /* we can use at most this many bit patterns, lest there not be enough - available for the remaining symbols at the maximum length (if there were - no limit to the code length, this would become: most = left - 1) */ - most = (((code_t)left << (max - len)) - syms) / - (((code_t)1 << (max - len)) - 1); - - /* count all possible codes from this juncture and add them up */ - sum = 0; - for (use = least; use <= most; use++) { - got = count(syms - use, len + 1, (left - use) << 1); - sum += got; - if (got == (big_t)0 - 1 || sum < got) /* overflow */ - return (big_t)0 - 1; - } - - /* verify that all recursive calls are productive */ - assert(sum != 0); - - /* save the result and return it */ - num[index] = sum; - return sum; -} - -/* Return true if we've been here before, set to true if not. Set a bit in a - bit vector to indicate visiting this state. Each (syms,len,left) state - has a variable size bit vector indexed by (mem,rem). The bit vector is - lengthened if needed to allow setting the (mem,rem) bit. */ -local int beenhere(int syms, int len, int left, int mem, int rem) -{ - size_t index; /* index for this state's bit vector */ - size_t offset; /* offset in this state's bit vector */ - int bit; /* mask for this state's bit */ - size_t length; /* length of the bit vector in bytes */ - char *vector; /* new or enlarged bit vector */ - - /* point to vector for (syms,left,len), bit in vector for (mem,rem) */ - index = INDEX(syms, left, len); - mem -= 1 << root; - offset = (mem >> 3) + rem; - offset = ((offset * (offset + 1)) >> 1) + rem; - bit = 1 << (mem & 7); - - /* see if we've been here */ - length = done[index].len; - if (offset < length && (done[index].vec[offset] & bit) != 0) - return 1; /* done this! */ - - /* we haven't been here before -- set the bit to show we have now */ - - /* see if we need to lengthen the vector in order to set the bit */ - if (length <= offset) { - /* if we have one already, enlarge it, zero out the appended space */ - if (length) { - do { - length <<= 1; - } while (length <= offset); - vector = realloc(done[index].vec, length); - if (vector != NULL) - memset(vector + done[index].len, 0, length - done[index].len); - } - - /* otherwise we need to make a new vector and zero it out */ - else { - length = 1 << (len - root); - while (length <= offset) - length <<= 1; - vector = calloc(length, sizeof(char)); - } - - /* in either case, bail if we can't get the memory */ - if (vector == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - cleanup(); - exit(1); - } - - /* install the new vector */ - done[index].len = length; - done[index].vec = vector; - } - - /* set the bit */ - done[index].vec[offset] |= bit; - return 0; -} - -/* Examine all possible codes from the given node (syms, len, left). Compute - the amount of memory required to build inflate's decoding tables, where the - number of code structures used so far is mem, and the number remaining in - the current sub-table is rem. Uses the globals max, code, root, large, and - done. */ -local void examine(int syms, int len, int left, int mem, int rem) -{ - int least; /* least number of syms to use at this juncture */ - int most; /* most number of syms to use at this juncture */ - int use; /* number of bit patterns to use in next call */ - - /* see if we have a complete code */ - if (syms == left) { - /* set the last code entry */ - code[len] = left; - - /* complete computation of memory used by this code */ - while (rem < left) { - left -= rem; - rem = 1 << (len - root); - mem += rem; - } - assert(rem == left); - - /* if this is a new maximum, show the entries used and the sub-code */ - if (mem > large) { - large = mem; - printf("max %d: ", mem); - for (use = root + 1; use <= max; use++) - if (code[use]) - printf("%d[%d] ", code[use], use); - putchar('\n'); - fflush(stdout); - } - - /* remove entries as we drop back down in the recursion */ - code[len] = 0; - return; - } - - /* prune the tree if we can */ - if (beenhere(syms, len, left, mem, rem)) - return; - - /* we need to use at least this many bit patterns so that the code won't be - incomplete at the next length (more bit patterns than symbols) */ - least = (left << 1) - syms; - if (least < 0) - least = 0; - - /* we can use at most this many bit patterns, lest there not be enough - available for the remaining symbols at the maximum length (if there were - no limit to the code length, this would become: most = left - 1) */ - most = (((code_t)left << (max - len)) - syms) / - (((code_t)1 << (max - len)) - 1); - - /* occupy least table spaces, creating new sub-tables as needed */ - use = least; - while (rem < use) { - use -= rem; - rem = 1 << (len - root); - mem += rem; - } - rem -= use; - - /* examine codes from here, updating table space as we go */ - for (use = least; use <= most; use++) { - code[len] = use; - examine(syms - use, len + 1, (left - use) << 1, - mem + (rem ? 1 << (len - root) : 0), rem << 1); - if (rem == 0) { - rem = 1 << (len - root); - mem += rem; - } - rem--; - } - - /* remove entries as we drop back down in the recursion */ - code[len] = 0; -} - -/* Look at all sub-codes starting with root + 1 bits. Look at only the valid - intermediate code states (syms, left, len). For each completed code, - calculate the amount of memory required by inflate to build the decoding - tables. Find the maximum amount of memory required and show the code that - requires that maximum. Uses the globals max, root, and num. */ -local void enough(int syms) -{ - int n; /* number of remaing symbols for this node */ - int left; /* number of unused bit patterns at this length */ - size_t index; /* index of this case in *num */ - - /* clear code */ - for (n = 0; n <= max; n++) - code[n] = 0; - - /* look at all (root + 1) bit and longer codes */ - large = 1 << root; /* base table */ - if (root < max) /* otherwise, there's only a base table */ - for (n = 3; n <= syms; n++) - for (left = 2; left < n; left += 2) - { - /* look at all reachable (root + 1) bit nodes, and the - resulting codes (complete at root + 2 or more) */ - index = INDEX(n, left, root + 1); - if (root + 1 < max && num[index]) /* reachable node */ - examine(n, root + 1, left, 1 << root, 0); - - /* also look at root bit codes with completions at root + 1 - bits (not saved in num, since complete), just in case */ - if (num[index - 1] && n <= left << 1) - examine((n - left) << 1, root + 1, (n - left) << 1, - 1 << root, 0); - } - - /* done */ - printf("done: maximum of %d table entries\n", large); -} - -/* - Examine and show the total number of possible Huffman codes for a given - maximum number of symbols, initial root table size, and maximum code length - in bits -- those are the command arguments in that order. The default - values are 286, 9, and 15 respectively, for the deflate literal/length code. - The possible codes are counted for each number of coded symbols from two to - the maximum. The counts for each of those and the total number of codes are - shown. The maximum number of inflate table entires is then calculated - across all possible codes. Each new maximum number of table entries and the - associated sub-code (starting at root + 1 == 10 bits) is shown. - - To count and examine Huffman codes that are not length-limited, provide a - maximum length equal to the number of symbols minus one. - - For the deflate literal/length code, use "enough". For the deflate distance - code, use "enough 30 6". - - This uses the %llu printf format to print big_t numbers, which assumes that - big_t is an unsigned long long. If the big_t type is changed (for example - to a multiple precision type), the method of printing will also need to be - updated. - */ -int main(int argc, char **argv) -{ - int syms; /* total number of symbols to code */ - int n; /* number of symbols to code for this run */ - big_t got; /* return value of count() */ - big_t sum; /* accumulated number of codes over n */ - code_t word; /* for counting bits in code_t */ - - /* set up globals for cleanup() */ - code = NULL; - num = NULL; - done = NULL; - - /* get arguments -- default to the deflate literal/length code */ - syms = 286; - root = 9; - max = 15; - if (argc > 1) { - syms = atoi(argv[1]); - if (argc > 2) { - root = atoi(argv[2]); - if (argc > 3) - max = atoi(argv[3]); - } - } - if (argc > 4 || syms < 2 || root < 1 || max < 1) { - fputs("invalid arguments, need: [sym >= 2 [root >= 1 [max >= 1]]]\n", - stderr); - return 1; - } - - /* if not restricting the code length, the longest is syms - 1 */ - if (max > syms - 1) - max = syms - 1; - - /* determine the number of bits in a code_t */ - for (n = 0, word = 1; word; n++, word <<= 1) - ; - - /* make sure that the calculation of most will not overflow */ - if (max > n || (code_t)(syms - 2) >= (((code_t)0 - 1) >> (max - 1))) { - fputs("abort: code length too long for internal types\n", stderr); - return 1; - } - - /* reject impossible code requests */ - if ((code_t)(syms - 1) > ((code_t)1 << max) - 1) { - fprintf(stderr, "%d symbols cannot be coded in %d bits\n", - syms, max); - return 1; - } - - /* allocate code vector */ - code = calloc(max + 1, sizeof(int)); - if (code == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - return 1; - } - - /* determine size of saved results array, checking for overflows, - allocate and clear the array (set all to zero with calloc()) */ - if (syms == 2) /* iff max == 1 */ - num = NULL; /* won't be saving any results */ - else { - size = syms >> 1; - if (size > ((size_t)0 - 1) / (n = (syms - 1) >> 1) || - (size *= n, size > ((size_t)0 - 1) / (n = max - 1)) || - (size *= n, size > ((size_t)0 - 1) / sizeof(big_t)) || - (num = calloc(size, sizeof(big_t))) == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - cleanup(); - return 1; - } - } - - /* count possible codes for all numbers of symbols, add up counts */ - sum = 0; - for (n = 2; n <= syms; n++) { - got = count(n, 1, 2); - sum += got; - if (got == (big_t)0 - 1 || sum < got) { /* overflow */ - fputs("abort: can't count that high!\n", stderr); - cleanup(); - return 1; - } - printf("%llu %d-codes\n", got, n); - } - printf("%llu total codes for 2 to %d symbols", sum, syms); - if (max < syms - 1) - printf(" (%d-bit length limit)\n", max); - else - puts(" (no length limit)"); - - /* allocate and clear done array for beenhere() */ - if (syms == 2) - done = NULL; - else if (size > ((size_t)0 - 1) / sizeof(struct tab) || - (done = calloc(size, sizeof(struct tab))) == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - cleanup(); - return 1; - } - - /* find and show maximum inflate table usage */ - if (root > max) /* reduce root to max length */ - root = max; - if ((code_t)syms < ((code_t)1 << (root + 1))) - enough(syms); - else - puts("cannot handle minimum code lengths > root"); - - /* done */ - cleanup(); - return 0; -} diff --git a/src/dependencies/zlib-1.2.11/zlib.3.pdf b/src/dependencies/zlib-1.2.11/zlib.3.pdf deleted file mode 100644 index 6fa519c..0000000 Binary files a/src/dependencies/zlib-1.2.11/zlib.3.pdf and /dev/null differ diff --git a/src/dependencies/zlib-1.2.11/CMakeLists.txt b/src/dependencies/zlib-1.2.13/CMakeLists.txt similarity index 76% rename from src/dependencies/zlib-1.2.11/CMakeLists.txt rename to src/dependencies/zlib-1.2.13/CMakeLists.txt index 6e2bb16..b412dc7 100644 --- a/src/dependencies/zlib-1.2.11/CMakeLists.txt +++ b/src/dependencies/zlib-1.2.13/CMakeLists.txt @@ -3,10 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -set(VERSION "1.2.11") - -option(ASM686 "Enable building i686 assembly implementation") -option(AMD64 "Enable building amd64 assembly implementation") +set(VERSION "1.2.13") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -129,39 +126,6 @@ if(NOT MINGW) ) endif() -if(CMAKE_COMPILER_IS_GNUCC) - if(ASM686) - set(ZLIB_ASMS contrib/asm686/match.S) - elseif (AMD64) - set(ZLIB_ASMS contrib/amd64/amd64-match.S) - endif () - - if(ZLIB_ASMS) - add_definitions(-DASMV) - set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) - endif() -endif() - -if(MSVC) - if(ASM686) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx86/inffas32.asm - contrib/masmx86/match686.asm - ) - elseif (AMD64) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx64/gvmat64.asm - contrib/masmx64/inffasx64.asm - ) - endif() - - if(ZLIB_ASMS) - add_definitions(-DASMV -DASMINF) - endif() -endif() - # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" @@ -183,10 +147,10 @@ if(MINGW) set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) -#add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -#set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) -#set_target_properties(zlib PROPERTIES SOVERSION 1) +add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) +set_target_properties(zlib PROPERTIES SOVERSION 1) if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version @@ -196,7 +160,7 @@ if(NOT CYGWIN) # # This has no effect with MSVC, on that platform the version info for # the DLL comes from the resource file win32/zlib1.rc -# set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) + set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) endif() if(UNIX) @@ -207,12 +171,11 @@ if(UNIX) endif() elseif(BUILD_SHARED_LIBS AND WIN32) # Creates zlib1.dll when building shared library version - #set_target_properties(zlib PROPERTIES SUFFIX "1.dll") + set_target_properties(zlib PROPERTIES SUFFIX "1.dll") endif() if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - #install(TARGETS zlib zlibstatic - install(TARGETS zlibstatic + install(TARGETS zlib zlibstatic RUNTIME DESTINATION "${INSTALL_BIN_DIR}" ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) @@ -231,20 +194,20 @@ endif() # Example binaries #============================================================================ -#add_executable(example test/example.c) -#target_link_libraries(example zlib) -#add_test(example example) +add_executable(example test/example.c) +target_link_libraries(example zlib) +add_test(example example) -#add_executable(minigzip test/minigzip.c) -#target_link_libraries(minigzip zlib) +add_executable(minigzip test/minigzip.c) +target_link_libraries(minigzip zlib) -#if(HAVE_OFF64_T) -# add_executable(example64 test/example.c) -# target_link_libraries(example64 zlib) -# set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -# add_test(example64 example64) -# -# add_executable(minigzip64 test/minigzip.c) -# target_link_libraries(minigzip64 zlib) -# set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -#endif() +if(HAVE_OFF64_T) + add_executable(example64 test/example.c) + target_link_libraries(example64 zlib) + set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_test(example64 example64) + + add_executable(minigzip64 test/minigzip.c) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") +endif() diff --git a/src/dependencies/zlib-1.2.11/ChangeLog b/src/dependencies/zlib-1.2.13/ChangeLog similarity index 92% rename from src/dependencies/zlib-1.2.11/ChangeLog rename to src/dependencies/zlib-1.2.13/ChangeLog index 30199a6..457526b 100644 --- a/src/dependencies/zlib-1.2.11/ChangeLog +++ b/src/dependencies/zlib-1.2.13/ChangeLog @@ -1,6 +1,81 @@ ChangeLog file for zlib +Changes in 1.2.13 (13 Oct 2022) +- Fix configure issue that discarded provided CC definition +- Correct incorrect inputs provided to the CRC functions +- Repair prototypes and exporting of new CRC functions +- Fix inflateBack to detect invalid input with distances too far +- Have infback() deliver all of the available output up to any error +- Fix a bug when getting a gzip header extra field with inflate() +- Fix bug in block type selection when Z_FIXED used +- Tighten deflateBound bounds +- Remove deleted assembler code references +- Various portability and appearance improvements + +Changes in 1.2.12 (27 Mar 2022) +- Cygwin does not have _wopen(), so do not create gzopen_w() there +- Permit a deflateParams() parameter change as soon as possible +- Limit hash table inserts after switch from stored deflate +- Fix bug when window full in deflate_stored() +- Fix CLEAR_HASH macro to be usable as a single statement +- Avoid a conversion error in gzseek when off_t type too small +- Have Makefile return non-zero error code on test failure +- Avoid some conversion warnings in gzread.c and gzwrite.c +- Update use of errno for newer Windows CE versions +- Small speedup to inflate [psumbera] +- Return an error if the gzputs string length can't fit in an int +- Add address checking in clang to -w option of configure +- Don't compute check value for raw inflate if asked to validate +- Handle case where inflateSync used when header never processed +- Avoid the use of ptrdiff_t +- Avoid an undefined behavior of memcpy() in gzappend() +- Avoid undefined behaviors of memcpy() in gz*printf() +- Avoid an undefined behavior of memcpy() in _tr_stored_block() +- Make the names in functions declarations identical to definitions +- Remove old assembler code in which bugs have manifested +- Fix deflateEnd() to not report an error at start of raw deflate +- Add legal disclaimer to README +- Emphasize the need to continue decompressing gzip members +- Correct the initialization requirements for deflateInit2() +- Fix a bug that can crash deflate on some input when using Z_FIXED +- Assure that the number of bits for deflatePrime() is valid +- Use a structure to make globals in enough.c evident +- Use a macro for the printf format of big_t in enough.c +- Clean up code style in enough.c, update version +- Use inline function instead of macro for index in enough.c +- Clarify that prefix codes are counted in enough.c +- Show all the codes for the maximum tables size in enough.c +- Add gznorm.c example, which normalizes gzip files +- Fix the zran.c example to work on a multiple-member gzip file +- Add tables for crc32_combine(), to speed it up by a factor of 200 +- Add crc32_combine_gen() and crc32_combine_op() for fast combines +- Speed up software CRC-32 computation by a factor of 1.5 to 3 +- Use atomic test and set, if available, for dynamic CRC tables +- Don't bother computing check value after successful inflateSync() +- Correct comment in crc32.c +- Add use of the ARMv8 crc32 instructions when requested +- Use ARM crc32 instructions if the ARM architecture has them +- Explicitly note that the 32-bit check values are 32 bits +- Avoid adding empty gzip member after gzflush with Z_FINISH +- Fix memory leak on error in gzlog.c +- Fix error in comment on the polynomial representation of a byte +- Clarify gz* function interfaces, referring to parameter names +- Change macro name in inflate.c to avoid collision in VxWorks +- Correct typo in blast.c +- Improve portability of contrib/minizip +- Fix indentation in minizip's zip.c +- Replace black/white with allow/block. (theresa-m) +- minizip warning fix if MAXU32 already defined. (gvollant) +- Fix unztell64() in minizip to work past 4GB. (Daniël Hörchner) +- Clean up minizip to reduce warnings for testing +- Add fallthrough comments for gcc +- Eliminate use of ULL constants +- Separate out address sanitizing from warnings in configure +- Remove destructive aspects of make distclean +- Check for cc masquerading as gcc or clang in configure +- Fix crc32.c to compile local functions only if used + Changes in 1.2.11 (15 Jan 2017) - Fix deflate stored bug when pulling last block from window - Permit immediate deflateParams changes before any deflate input @@ -96,7 +171,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Fix types in contrib/minizip to match result of get_crc_table() - Simplify contrib/vstudio/vc10 with 'd' suffix - Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Support i686 and amd64 assembler builds in CMakeLists.txt - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h - Add vc11 and vc12 build files to contrib/vstudio - Add gzvprintf() as an undocumented function in zlib @@ -296,14 +371,14 @@ Changes in 1.2.5.1 (10 Sep 2011) - Use u4 type for crc_table to avoid conversion warnings - Apply casts in zlib.h to avoid conversion warnings - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy +- Improve inflateSync() documentation to note indeterminacy - Add deflatePending() function to return the amount of pending output - Correct the spelling of "specification" in FAQ [Randers-Pehrson] - Add a check in configure for stdarg.h, use for gzprintf() - Check that pointers fit in ints when gzprint() compiled old style - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] +- Add debug records in assembler code [Londer] - Update RFC references to use http://tools.ietf.org/html/... [Li] - Add --archs option, use of libtool to configure for Mac OS X [Borstel] @@ -511,7 +586,7 @@ Changes in 1.2.3.5 (8 Jan 2010) - Don't use _vsnprintf on later versions of MSVC [Lowman] - Add CMake build script and input file [Lowman] - Update contrib/minizip to 1.1 [Svensson, Vollant] -- Moved nintendods directory from contrib to . +- Moved nintendods directory from contrib to root - Replace gzio.c with a new set of routines with the same functionality - Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above - Update contrib/minizip to 1.1b @@ -685,7 +760,7 @@ Changes in 1.2.2.4 (11 July 2005) - Be more strict on incomplete code sets in inflate_table() and increase ENOUGH and MAXD -- this repairs a possible security vulnerability for invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. + discovering the vulnerability and providing test cases - Add ia64 support to configure for HP-UX [Smith] - Add error return to gzread() for format or i/o error [Levin] - Use malloc.h for OS/2 [Necasek] @@ -721,7 +796,7 @@ Changes in 1.2.2.2 (30 December 2004) - Add Z_FIXED strategy option to deflateInit2() to force fixed trees - Add updated make_vms.com [Coghlan], update README - Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. + fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html - Add FAQ entry and comments in deflate.c on uninitialized memory access - Add Solaris 9 make options in configure [Gilbert] - Allow strerror() usage in gzio.c for STDC @@ -792,7 +867,7 @@ Changes in 1.2.1.1 (9 January 2004) - Fix a big fat bug in inftrees.c that prevented decoding valid dynamic blocks with only literals and no distance codes -- Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. +- Add a note to puff.c on no distance codes case Changes in 1.2.1 (17 November 2003) - Remove a tab in contrib/gzappend/gzappend.c @@ -970,7 +1045,7 @@ Changes in 1.2.0.1 (17 March 2003) - Include additional header file on VMS for off_t typedef - Try to use _vsnprintf where it supplants vsprintf [Vollant] - Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to +- Enhance comments in zlib.h on what happens if gzprintf() tries to write more than 4095 bytes before compression - Remove unused state from inflateBackEnd() - Remove exit(0) from minigzip.c, example.c @@ -1036,14 +1111,14 @@ Changes in 1.2.0 (9 March 2003) - Add contrib/puff/ simple inflate for deflate format description Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. +- ZFREE was repeated on same allocation on some error conditions This creates a security problem described in http://www.zlib.org/advisory-2002-03-11.txt - Returned incorrect error (Z_MEM_ERROR) on some invalid data - Avoid accesses before window for invalid distances with inflate window - less than 32K. + less than 32K - force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). + of 256 bytes. (A complete fix will be available in 1.1.5) Changes in 1.1.3 (9 July 1998) - fix "an inflate input buffer bug that shows up on rare but persistent @@ -1117,7 +1192,7 @@ Changes in 1.1.1 (27 Feb 98) - remove block truncation heuristic which had very marginal effect for zlib (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. + matches in deflate_slow - added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) Changes in 1.1.0 (24 Feb 98) @@ -1148,7 +1223,7 @@ Changes in 1.0.9 (17 Feb 1998) - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) + the declaration of FAR (Gilles Vollant) - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) - read_buf buf parameter of type Bytef* instead of charf* - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) @@ -1162,7 +1237,7 @@ Changes in 1.0.8 (27 Jan 1998) - include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) - use constant arrays for the static trees in trees.c instead of computing them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". + trees.h, compile with GEN_TREES_H and run "make test" - check return code of example in "make test" and display result - pass minigzip command line options to file_compress - simplifying code of inflateSync to avoid gcc 2.8 bug @@ -1201,12 +1276,12 @@ Changes in 1.0.6 (19 Jan 1998) - add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) - Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. + Andy Buckler for finding this one) +- In minigzip, pass transparently also the first byte for .Z files - return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() - check Z_FINISH in inflate (thanks to Marc Schluper) - Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. +- make static libraries by default in configure, add --shared option - move MSDOS or Windows specific files to directory msdos - suppress the notion of partial flush to simplify the interface (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) @@ -1218,7 +1293,7 @@ Changes in 1.0.6 (19 Jan 1998) - added Makefile.nt (thanks to Stephen Williams) - added the unsupported "contrib" directory: contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). + 386 asm code replacing longest_match() contrib/iostream/ by Kevin Ruland A C++ I/O streams interface to the zlib gz* functions contrib/iostream2/ by Tyge Løvset @@ -1226,7 +1301,7 @@ Changes in 1.0.6 (19 Jan 1998) contrib/untgz/ by "Pedro A. Aranda Guti\irrez" A very simple tar.gz file extractor using zlib contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. + How to use compress(), uncompress() and the gz* functions from VB - pass params -f (filtered data), -h (huffman only), -1 to -9 (compression level) in minigzip (thanks to Tom Lane) @@ -1235,8 +1310,8 @@ Changes in 1.0.6 (19 Jan 1998) - add undocumented function inflateSyncPoint() (hack for Paul Mackerras) - add undocumented function zError to convert error code to string (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code +- Use default memcpy for Symantec MSDOS compiler - Add EXPORT keyword for check_func (needed for Windows DLL) - add current directory to LD_LIBRARY_PATH for "make test" - create also a link for libz.so.1 @@ -1249,7 +1324,7 @@ Changes in 1.0.6 (19 Jan 1998) - allow compilation with ANSI keywords only enabled for TurboC in large model - avoid "versionString"[0] (Borland bug) - add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch) - allow compilation with CC - defined STDC for OS/2 (David Charlap) - limit external names to 8 chars for MVS (Thomas Lund) @@ -1259,7 +1334,7 @@ Changes in 1.0.6 (19 Jan 1998) - use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) - added makelcc.bat for lcc-win32 (Tom St Denis) - in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. +- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion - check for unistd.h in configure (for off_t) - remove useless check parameter in inflate_blocks_free - avoid useless assignment of s->check to itself in inflate_blocks_new @@ -1280,7 +1355,7 @@ Changes in 1.0.5 (3 Jan 98) Changes in 1.0.4 (24 Jul 96) - In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. + on to attempt decompressing extra garbage data. This affected minigzip too - zlibVersion and gzerror return const char* (needed for DLL) - port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) - use z_error only for DEBUG (avoid problem with DLLs) @@ -1310,7 +1385,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] - fix array overlay in deflate.c which sometimes caused bad compressed data - fix inflate bug with empty stored block - fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generate bad compressed data. +- fix deflateParams() which could generate bad compressed data - Bytef is define'd instead of typedef'ed (work around Borland bug) - added an INDEX file - new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), @@ -1331,7 +1406,7 @@ Changes in 0.99 (27 Jan 96) - allow preset dictionary shared between compressor and decompressor - allow compression level 0 (no compression) - add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. + and compression strategy - test large buffers and deflateParams in example.c - add optional "configure" to build zlib as a shared library - suppress Makefile.qnx, use configure instead @@ -1373,30 +1448,30 @@ Changes in 0.99 (27 Jan 96) - use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... - use Z_BINARY instead of BINARY - document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. +- allow "a" as mode in gzopen - fix error checking in gzread - allow skipping .gz extra-field on pipes - added reference to Perl interface in README - put the crc table in FAR data (I dislike more and more the medium model :) - added get_crc_table -- added a dimension to all arrays (Borland C can't count). +- added a dimension to all arrays (Borland C can't count) - workaround Borland C bug in declaration of inflate_codes_new & inflate_fast - guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. +- Watcom C pretends to be Microsoft C small model even in 32 bit mode - don't use unsized arrays to avoid silly warnings by Visual C++: warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). + (what's wrong with far data in far model?) - define enum out of inflate_blocks_state to allow compilation with C++ Changes in 0.95 (16 Aug 95) - fix MSDOS small and medium model (now easier to adapt to any compiler) - inlined send_bits - fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). + not completely flushed in rare occasions) - default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). + (it's now sufficient to set MAX_WBITS in zconf.h) - voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). + typedefs and because voidnp was not near in large model) Changes in 0.94 (13 Aug 95) - support MSDOS medium model @@ -1405,12 +1480,12 @@ Changes in 0.94 (13 Aug 95) - added support for VMS - allow a compression level in gzopen() - gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. +- For deflate with flush, flush even if no more input is provided - rename libgz.a as libz.a - avoid complex expression in infcodes.c triggering Turbo C bug - work around a problem with gcc on Alpha (in INSERT_STRING) - don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. +- allow renaming of Byte, uInt, etc... with #define - avoid warning about (unused) pointer before start of array in deflate.c - avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c - avoid reserved word 'new' in trees.c @@ -1429,7 +1504,7 @@ Changes in 0.92 (3 May 95) - no memcpy on Pyramid - suppressed inftest.c - optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. +- optimized inflate on stored blocks - untabify all sources to simplify patches Changes in 0.91 (2 May 95) @@ -1447,7 +1522,7 @@ Changes in 0.9 (1 May 95) - let again gzread copy uncompressed data unchanged (was working in 0.71) - deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented - added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. +- moved MAX_WBITS to zconf.h because users might want to change that - document explicitly that zalloc(64K) on MSDOS must return a normalized pointer (zero offset) - added Makefiles for Microsoft C, Turbo C, Borland C++ @@ -1456,7 +1531,7 @@ Changes in 0.9 (1 May 95) Changes in 0.8 (29 April 95) - added fast inflate (inffast.c) - deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. + is incompatible with previous versions of zlib which returned Z_OK - work around a TurboC compiler bug (bad code for b << 0, see infutil.h) (actually that was not a compiler bug, see 0.81 above) - gzread no longer reads one extra byte in certain cases @@ -1466,50 +1541,50 @@ Changes in 0.8 (29 April 95) Changes in 0.71 (14 April 95) - Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. + TurboC large model Changes in 0.7 (14 April 95) -- Added full inflate support. +- Added full inflate support - Simplified the crc32() interface. The pre- and post-conditioning (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. + incompatible with previous versions; see zlib.h for the new usage Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. +- workaround for a bug in TurboC. example and minigzip now work on MSDOS Changes in 0.6 (11 April 95) - added minigzip.c - added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. +- added transparent reading of non-gziped files in gzread - fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose) - don't allocate big arrays in the stack (for MSDOS) - fix some MSDOS compilation problems Changes in 0.5: - do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. + not yet Z_FULL_FLUSH - support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. +- added opaque object for zalloc and zfree - added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. +- added a variable zlib_version for consistency checking +- renamed the 'filter' parameter of deflateInit2 as 'strategy' + Added Z_FILTERED and Z_HUFFMAN_ONLY constants Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. +- avoid "zip" everywhere, use zlib instead of ziplib - suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. + if compression method == 8 - added adler32 and crc32 - renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. +- added the method parameter for deflateInit2 - added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting +- simplified considerably deflateInit and inflateInit by not supporting user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. + and inflateInit2 Changes in 0.3: - prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. +- use Z_FINISH instead of deflateEnd to finish compression - added Z_HUFFMAN_ONLY - added gzerror() diff --git a/src/dependencies/zlib-1.2.11/FAQ b/src/dependencies/zlib-1.2.13/FAQ similarity index 100% rename from src/dependencies/zlib-1.2.11/FAQ rename to src/dependencies/zlib-1.2.13/FAQ diff --git a/src/dependencies/zlib-1.2.11/INDEX b/src/dependencies/zlib-1.2.13/INDEX similarity index 100% rename from src/dependencies/zlib-1.2.11/INDEX rename to src/dependencies/zlib-1.2.13/INDEX diff --git a/src/dependencies/zlib-1.2.13/LICENSE b/src/dependencies/zlib-1.2.13/LICENSE new file mode 100644 index 0000000..ab8ee6f --- /dev/null +++ b/src/dependencies/zlib-1.2.13/LICENSE @@ -0,0 +1,22 @@ +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu diff --git a/src/dependencies/zlib-1.2.11/Makefile b/src/dependencies/zlib-1.2.13/Makefile similarity index 100% rename from src/dependencies/zlib-1.2.11/Makefile rename to src/dependencies/zlib-1.2.13/Makefile diff --git a/src/dependencies/zlib-1.2.11/Makefile.in b/src/dependencies/zlib-1.2.13/Makefile.in similarity index 94% rename from src/dependencies/zlib-1.2.11/Makefile.in rename to src/dependencies/zlib-1.2.13/Makefile.in index 5a77949..7d2713f 100644 --- a/src/dependencies/zlib-1.2.11/Makefile.in +++ b/src/dependencies/zlib-1.2.13/Makefile.in @@ -7,10 +7,6 @@ # Normally configure builds both a static and a shared library. # If you want to build just a static library, use: ./configure --static -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: # make install # To install in $HOME instead of /usr/local, use: @@ -26,13 +22,13 @@ CFLAGS=-O SFLAGS=-O LDFLAGS= -TEST_LDFLAGS=-L. libz.a +TEST_LDFLAGS=$(LDFLAGS) -L. libz.a LDSHARED=$(CC) CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.11 +SHAREDLIBV=libz.so.1.2.13 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -87,12 +83,12 @@ test: all teststatic testshared teststatic: static @TMPST=tmpst_$$; \ - if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ + if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \ echo ' *** zlib test OK ***'; \ else \ echo ' *** zlib test FAILED ***'; false; \ - fi; \ - rm -f $$TMPST + fi + @rm -f tmpst_$$ testshared: shared @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ @@ -100,21 +96,21 @@ testshared: shared DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ TMPSH=tmpsh_$$; \ - if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ + if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \ echo ' *** zlib shared test OK ***'; \ else \ echo ' *** zlib shared test FAILED ***'; false; \ - fi; \ - rm -f $$TMPSH + fi + @rm -f tmpsh_$$ test64: all64 @TMP64=tmp64_$$; \ - if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ + if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \ echo ' *** zlib 64-bit test OK ***'; \ else \ echo ' *** zlib 64-bit test FAILED ***'; false; \ - fi; \ - rm -f $$TMP64 + fi + @rm -f tmp64_$$ infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c @@ -124,7 +120,7 @@ infcover: infcover.o libz.a cover: infcover rm -f *.gcda - ./infcover + ${QEMU_RUN} ./infcover gcov inf*.c libz.a: $(OBJS) @@ -292,10 +288,10 @@ minigzip$(EXE): minigzip.o $(STATICLIB) $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) examplesh$(EXE): example.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) example64$(EXE): example64.o $(STATICLIB) $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) @@ -376,15 +372,13 @@ clean: rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov maintainer-clean: distclean -distclean: clean zconf zconf.h.cmakein docs +distclean: clean zconf zconf.h.cmakein rm -f Makefile zlib.pc configure.log -@rm -f .DS_Store @if [ -f Makefile.in ]; then \ printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \ printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \ touch -r $(SRCDIR)Makefile.in Makefile ; fi - @if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi - @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi tags: etags $(SRCDIR)*.[ch] diff --git a/src/dependencies/zlib-1.2.11/README b/src/dependencies/zlib-1.2.13/README similarity index 92% rename from src/dependencies/zlib-1.2.11/README rename to src/dependencies/zlib-1.2.13/README index 51106de..ba34d18 100644 --- a/src/dependencies/zlib-1.2.11/README +++ b/src/dependencies/zlib-1.2.13/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.11 is a general purpose data compression library. All the code is +zlib 1.2.13 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.11 are documented in the file ChangeLog. +The changes made in version 1.2.13 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -84,7 +84,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2017 Jean-loup Gailly and Mark Adler + (C) 1995-2022 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -108,7 +108,10 @@ Copyright notice: If you use the zlib library in a product, we would appreciate *not* receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. +Gailly and Mark Adler; it does not include third-party code. We make all +contributions to and distributions of this project solely in our personal +capacity, and are not conveying any rights to any intellectual property of +any third parties. If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read diff --git a/src/dependencies/zlib-1.2.11/adler32.c b/src/dependencies/zlib-1.2.13/adler32.c similarity index 100% rename from src/dependencies/zlib-1.2.11/adler32.c rename to src/dependencies/zlib-1.2.13/adler32.c diff --git a/src/dependencies/zlib-1.2.11/amiga/Makefile.pup b/src/dependencies/zlib-1.2.13/amiga/Makefile.pup similarity index 100% rename from src/dependencies/zlib-1.2.11/amiga/Makefile.pup rename to src/dependencies/zlib-1.2.13/amiga/Makefile.pup diff --git a/src/dependencies/zlib-1.2.11/amiga/Makefile.sas b/src/dependencies/zlib-1.2.13/amiga/Makefile.sas similarity index 100% rename from src/dependencies/zlib-1.2.11/amiga/Makefile.sas rename to src/dependencies/zlib-1.2.13/amiga/Makefile.sas diff --git a/src/dependencies/zlib-1.2.11/compress.c b/src/dependencies/zlib-1.2.13/compress.c similarity index 94% rename from src/dependencies/zlib-1.2.11/compress.c rename to src/dependencies/zlib-1.2.13/compress.c index e2db404..2ad5326 100644 --- a/src/dependencies/zlib-1.2.11/compress.c +++ b/src/dependencies/zlib-1.2.13/compress.c @@ -19,7 +19,7 @@ memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) +int ZEXPORT compress2(dest, destLen, source, sourceLen, level) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) /* =========================================================================== */ -int ZEXPORT compress (dest, destLen, source, sourceLen) +int ZEXPORT compress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) If the default memLevel or windowBits for deflateInit() is changed, then this function needs to be updated. */ -uLong ZEXPORT compressBound (sourceLen) +uLong ZEXPORT compressBound(sourceLen) uLong sourceLen; { return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + diff --git a/src/dependencies/zlib-1.2.11/configure b/src/dependencies/zlib-1.2.13/configure old mode 100644 new mode 100755 similarity index 90% rename from src/dependencies/zlib-1.2.11/configure rename to src/dependencies/zlib-1.2.13/configure index e974d1f..fa4d5da --- a/src/dependencies/zlib-1.2.11/configure +++ b/src/dependencies/zlib-1.2.13/configure @@ -32,8 +32,11 @@ fi # set command prefix for cross-compilation if [ -n "${CHOST}" ]; then - uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" + uname=${CHOST} + mname=${CHOST} CROSS_PREFIX="${CHOST}-" +else + mname=`(uname -a || echo unknown) 2>/dev/null` fi # destination name for static library @@ -87,6 +90,7 @@ build64=0 gcc=0 warn=0 debug=0 +sanitize=0 old_cc="$CC" old_cflags="$CFLAGS" OBJC='$(OBJZ) $(OBJG)' @@ -137,6 +141,7 @@ case "$1" in -c* | --const) zconst=1; shift ;; -w* | --warn) warn=1; shift ;; -d* | --debug) debug=1; shift ;; + --sanitize) sanitize=1; shift ;; *) echo "unknown option: $1" | tee -a configure.log echo "$0 --help for help" | tee -a configure.log @@ -165,10 +170,17 @@ extern int getchar(); int hello() {return getchar();} EOF -test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log -cc=${CC-${CROSS_PREFIX}gcc} -cflags=${CFLAGS-"-O3"} -# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure +if test -z "$CC"; then + echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log + if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then + cc=${CROSS_PREFIX}gcc + else + cc=${CROSS_PREFIX}cc + fi +else + cc=${CC} +fi + case "$cc" in *gcc*) gcc=1 ;; *clang*) gcc=1 ;; @@ -194,11 +206,14 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then fi if test "$warn" -eq 1; then if test "$zconst" -eq 1; then - CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" + CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST" else - CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" + CFLAGS="${CFLAGS} -Wall -Wextra" fi fi + if test $sanitize -eq 1; then + CFLAGS="${CFLAGS} -g -fsanitize=address" + fi if test $debug -eq 1; then CFLAGS="${CFLAGS} -DZLIB_DEBUG" SFLAGS="${SFLAGS} -DZLIB_DEBUG" @@ -207,47 +222,52 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then uname=`(uname -s || echo unknown) 2>/dev/null` fi case "$uname" in - Linux* | linux* | GNU | GNU/* | solaris*) + Linux* | linux* | *-linux* | GNU | GNU/* | solaris*) + case "$mname" in + *sparc*) + LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;; + esac LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;; *BSD | *bsd* | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} LDCONFIG="ldconfig -m" ;; - CYGWIN* | Cygwin* | cygwin* | OS/2*) + CYGWIN* | Cygwin* | cygwin* | *-cygwin* | OS/2*) EXE='.exe' ;; - MINGW* | mingw*) -# temporary bypass + MINGW* | mingw* | *-mingw*) rm -f $test.[co] $test $test$shared_ext - echo "Please use win32/Makefile.gcc instead." | tee -a configure.log - leave 1 + echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log LDSHARED=${LDSHARED-"$cc -shared"} LDSHAREDLIBC="" EXE='.exe' ;; - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 - # (alain.bonnefoy@icbt.com) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; + QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 + # (alain.bonnefoy@icbt.com) + LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; HP-UX*) - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl' ;; - esac ;; - Darwin* | darwin*) - shared_ext='.dylib' - SHAREDLIB=libz$shared_ext - SHAREDLIBV=libz.$VER$shared_ext - SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} - if libtool -V 2>&1 | grep Apple > /dev/null; then - AR="libtool" - else - AR="/usr/bin/libtool" - fi - ARFLAGS="-o" ;; - *) LDSHARED=${LDSHARED-"$cc -shared"} ;; + LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} + case `(uname -m || echo unknown) 2>/dev/null` in + ia64) + shared_ext='.so' + SHAREDLIB='libz.so' ;; + *) + shared_ext='.sl' + SHAREDLIB='libz.sl' ;; + esac ;; + AIX*) + LDFLAGS="${LDFLAGS} -Wl,-brtl" ;; + Darwin* | darwin* | *-darwin*) + shared_ext='.dylib' + SHAREDLIB=libz$shared_ext + SHAREDLIBV=libz.$VER$shared_ext + SHAREDLIBM=libz.$VER1$shared_ext + LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} + if libtool -V 2>&1 | grep Apple > /dev/null; then + AR="libtool" + else + AR="/usr/bin/libtool" + fi + ARFLAGS="-o" ;; + *) + LDSHARED=${LDSHARED-"$cc -shared"} ;; esac else # find system name and corresponding cc options @@ -367,8 +387,11 @@ else try() { show $* - ( $* ) >> configure.log 2>&1 + got=`( $* ) 2>&1` ret=$? + if test "$got" != ""; then + printf "%s\n" "$got" >> configure.log + fi if test $ret -ne 0; then echo "(exit code "$ret")" >> configure.log fi @@ -381,8 +404,11 @@ tryboth() show $* got=`( $* ) 2>&1` ret=$? - printf %s "$got" >> configure.log + if test "$got" != ""; then + printf "%s\n" "$got" >> configure.log + fi if test $ret -ne 0; then + echo "(exit code "$ret")" >> configure.log return $ret fi test "$got" = "" @@ -433,20 +459,6 @@ else TEST="all teststatic testshared" fi -# check for underscores in external names for use by assembler code -CPP=${CPP-"$CC -E"} -case $CFLAGS in - *ASMV*) - echo >> configure.log - show "$NM $test.o | grep _hello" - if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then - CPP="$CPP -DNO_UNDERLINE" - echo Checking for underline in external names... No. | tee -a configure.log - else - echo Checking for underline in external names... Yes. | tee -a configure.log - fi ;; -esac - echo >> configure.log # check for size_t @@ -457,17 +469,11 @@ size_t dummy = 0; EOF if try $CC -c $CFLAGS $test.c; then echo "Checking for size_t... Yes." | tee -a configure.log - need_sizet=0 else echo "Checking for size_t... No." | tee -a configure.log - need_sizet=1 -fi - -echo >> configure.log - -# find the size_t integer type, if needed -if test $need_sizet -eq 1; then - cat > $test.c < $test.c << EOF long long dummy = 0; EOF if try $CC -c $CFLAGS $test.c; then @@ -495,17 +501,13 @@ EOF if try $CC $CFLAGS -o $test $test.c; then sizet=`./$test` echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log + CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" + SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" else - echo "Failed to find a pointer-size integer type." | tee -a configure.log - leave 1 + echo "Checking for a pointer-size integer type... not found." | tee -a configure.log fi fi -if test $need_sizet -eq 1; then - CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" - SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" -fi - echo >> configure.log # check for large file support, and if none, check for fseeko() @@ -849,7 +851,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log echo STATICLIB = $STATICLIB >> configure.log echo TEST = $TEST >> configure.log echo VER = $VER >> configure.log -echo Z_U4 = $Z_U4 >> configure.log echo SRCDIR = $SRCDIR >> configure.log echo exec_prefix = $exec_prefix >> configure.log echo includedir = $includedir >> configure.log diff --git a/src/dependencies/zlib-1.2.11/contrib/README.contrib b/src/dependencies/zlib-1.2.13/contrib/README.contrib similarity index 68% rename from src/dependencies/zlib-1.2.11/contrib/README.contrib rename to src/dependencies/zlib-1.2.13/contrib/README.contrib index a411d5c..5e5f950 100644 --- a/src/dependencies/zlib-1.2.11/contrib/README.contrib +++ b/src/dependencies/zlib-1.2.13/contrib/README.contrib @@ -1,4 +1,4 @@ -All files under this contrib directory are UNSUPPORTED. There were +All files under this contrib directory are UNSUPPORTED. They were provided by users of zlib and were not tested by the authors of zlib. Use at your own risk. Please contact the authors of the contributions for help about these, not the zlib authors. Thanks. @@ -8,14 +8,6 @@ ada/ by Dmitriy Anisimkov Support for Ada See http://zlib-ada.sourceforge.net/ -amd64/ by Mikhail Teterin - asm code for AMD64 - See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393 - -asm686/ by Brian Raiter - asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax - See http://www.muppetlabs.com/~breadbox/software/assembly.html - blast/ by Mark Adler Decompressor for output of PKWare Data Compression Library (DCL) @@ -32,9 +24,6 @@ gcc_gvmat64/by Gilles Vollant infback9/ by Mark Adler Unsupported diffs to infback to decode the deflate64 format -inflate86/ by Chris Anderson - Tuned x86 gcc asm code to replace inflate_fast() - iostream/ by Kevin Ruland A C++ I/O streams interface to the zlib gz* functions @@ -45,16 +34,6 @@ iostream3/ by Ludwig Schwardt and Kevin Ruland Yet another C++ I/O streams interface -masmx64/ by Gilles Vollant - x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to - replace longest_match() and inflate_fast(), also masm x86 - 64-bits translation of Chris Anderson inflate_fast() - -masmx86/ by Gilles Vollant - x86 asm code to replace longest_match() and inflate_fast(), - for Visual C++ and MASM (32 bits). - Based on Brian Raiter (asm686) and Chris Anderson (inflate86) - minizip/ by Gilles Vollant Mini zip and unzip based on zlib Includes Zip64 support by Mathias Svensson diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/buffer_demo.adb b/src/dependencies/zlib-1.2.13/contrib/ada/buffer_demo.adb similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/buffer_demo.adb rename to src/dependencies/zlib-1.2.13/contrib/ada/buffer_demo.adb diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/mtest.adb b/src/dependencies/zlib-1.2.13/contrib/ada/mtest.adb similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/mtest.adb rename to src/dependencies/zlib-1.2.13/contrib/ada/mtest.adb diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/read.adb b/src/dependencies/zlib-1.2.13/contrib/ada/read.adb similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/read.adb rename to src/dependencies/zlib-1.2.13/contrib/ada/read.adb diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/readme.txt b/src/dependencies/zlib-1.2.13/contrib/ada/readme.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/readme.txt rename to src/dependencies/zlib-1.2.13/contrib/ada/readme.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/test.adb b/src/dependencies/zlib-1.2.13/contrib/ada/test.adb similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/test.adb rename to src/dependencies/zlib-1.2.13/contrib/ada/test.adb diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/zlib-streams.adb b/src/dependencies/zlib-1.2.13/contrib/ada/zlib-streams.adb similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/zlib-streams.adb rename to src/dependencies/zlib-1.2.13/contrib/ada/zlib-streams.adb diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/zlib-streams.ads b/src/dependencies/zlib-1.2.13/contrib/ada/zlib-streams.ads similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/zlib-streams.ads rename to src/dependencies/zlib-1.2.13/contrib/ada/zlib-streams.ads diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/zlib-thin.adb b/src/dependencies/zlib-1.2.13/contrib/ada/zlib-thin.adb similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/zlib-thin.adb rename to src/dependencies/zlib-1.2.13/contrib/ada/zlib-thin.adb diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/zlib-thin.ads b/src/dependencies/zlib-1.2.13/contrib/ada/zlib-thin.ads similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/zlib-thin.ads rename to src/dependencies/zlib-1.2.13/contrib/ada/zlib-thin.ads diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/zlib.adb b/src/dependencies/zlib-1.2.13/contrib/ada/zlib.adb similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/zlib.adb rename to src/dependencies/zlib-1.2.13/contrib/ada/zlib.adb diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/zlib.ads b/src/dependencies/zlib-1.2.13/contrib/ada/zlib.ads similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/zlib.ads rename to src/dependencies/zlib-1.2.13/contrib/ada/zlib.ads diff --git a/src/dependencies/zlib-1.2.11/contrib/ada/zlib.gpr b/src/dependencies/zlib-1.2.13/contrib/ada/zlib.gpr similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/ada/zlib.gpr rename to src/dependencies/zlib-1.2.13/contrib/ada/zlib.gpr diff --git a/src/dependencies/zlib-1.2.11/contrib/blast/Makefile b/src/dependencies/zlib-1.2.13/contrib/blast/Makefile similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/blast/Makefile rename to src/dependencies/zlib-1.2.13/contrib/blast/Makefile diff --git a/src/dependencies/zlib-1.2.11/contrib/blast/README b/src/dependencies/zlib-1.2.13/contrib/blast/README similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/blast/README rename to src/dependencies/zlib-1.2.13/contrib/blast/README diff --git a/src/dependencies/zlib-1.2.11/contrib/blast/blast.c b/src/dependencies/zlib-1.2.13/contrib/blast/blast.c similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/blast/blast.c rename to src/dependencies/zlib-1.2.13/contrib/blast/blast.c diff --git a/src/dependencies/zlib-1.2.11/contrib/blast/blast.h b/src/dependencies/zlib-1.2.13/contrib/blast/blast.h similarity index 97% rename from src/dependencies/zlib-1.2.11/contrib/blast/blast.h rename to src/dependencies/zlib-1.2.13/contrib/blast/blast.h index 6cf65ed..ef8544c 100644 --- a/src/dependencies/zlib-1.2.11/contrib/blast/blast.h +++ b/src/dependencies/zlib-1.2.13/contrib/blast/blast.h @@ -57,7 +57,7 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow, * use by the application to pass an input descriptor to infun(), if desired. * * If left and in are not NULL and *left is not zero when blast() is called, - * then the *left bytes are *in are consumed for input before infun() is used. + * then the *left bytes at *in are consumed for input before infun() is used. * * The output function is invoked: err = outfun(how, buf, len), where the bytes * to be written are buf[0..len-1]. If err is not zero, then blast() returns diff --git a/src/dependencies/zlib-1.2.11/contrib/blast/test.pk b/src/dependencies/zlib-1.2.13/contrib/blast/test.pk similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/blast/test.pk rename to src/dependencies/zlib-1.2.13/contrib/blast/test.pk diff --git a/src/dependencies/zlib-1.2.11/contrib/blast/test.txt b/src/dependencies/zlib-1.2.13/contrib/blast/test.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/blast/test.txt rename to src/dependencies/zlib-1.2.13/contrib/blast/test.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/delphi/ZLib.pas b/src/dependencies/zlib-1.2.13/contrib/delphi/ZLib.pas similarity index 99% rename from src/dependencies/zlib-1.2.11/contrib/delphi/ZLib.pas rename to src/dependencies/zlib-1.2.13/contrib/delphi/ZLib.pas index 060e199..8be5fa2 100644 --- a/src/dependencies/zlib-1.2.11/contrib/delphi/ZLib.pas +++ b/src/dependencies/zlib-1.2.13/contrib/delphi/ZLib.pas @@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; const OutBuf: Pointer; BufSize: Integer); const - zlib_version = '1.2.11'; + zlib_version = '1.2.13'; type EZlibError = class(Exception); diff --git a/src/dependencies/zlib-1.2.11/contrib/delphi/ZLibConst.pas b/src/dependencies/zlib-1.2.13/contrib/delphi/ZLibConst.pas similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/delphi/ZLibConst.pas rename to src/dependencies/zlib-1.2.13/contrib/delphi/ZLibConst.pas diff --git a/src/dependencies/zlib-1.2.11/contrib/delphi/readme.txt b/src/dependencies/zlib-1.2.13/contrib/delphi/readme.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/delphi/readme.txt rename to src/dependencies/zlib-1.2.13/contrib/delphi/readme.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/delphi/zlibd32.mak b/src/dependencies/zlib-1.2.13/contrib/delphi/zlibd32.mak similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/delphi/zlibd32.mak rename to src/dependencies/zlib-1.2.13/contrib/delphi/zlibd32.mak diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib.build b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib.build similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib.build rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib.build diff --git a/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib.chm b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib.chm new file mode 100644 index 0000000..f214a44 Binary files /dev/null and b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib.chm differ diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib.sln b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib.sln similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib.sln rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib.sln diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/AssemblyInfo.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/AssemblyInfo.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/AssemblyInfo.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/AssemblyInfo.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/ChecksumImpl.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/ChecksumImpl.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/ChecksumImpl.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/CircularBuffer.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/CircularBuffer.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/CircularBuffer.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/CircularBuffer.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/CodecBase.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/CodecBase.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/CodecBase.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/CodecBase.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/Deflater.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/Deflater.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/Deflater.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/Deflater.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/DotZLib.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/DotZLib.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/DotZLib.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/DotZLib.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/DotZLib.csproj b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/DotZLib.csproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/DotZLib.csproj rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/DotZLib.csproj diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/GZipStream.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/GZipStream.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/GZipStream.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/GZipStream.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/Inflater.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/Inflater.cs similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/Inflater.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/Inflater.cs diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/UnitTests.cs b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/UnitTests.cs similarity index 95% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/UnitTests.cs rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/UnitTests.cs index 44f7633..16a0ebb 100644 --- a/src/dependencies/zlib-1.2.11/contrib/dotzlib/DotZLib/UnitTests.cs +++ b/src/dependencies/zlib-1.2.13/contrib/dotzlib/DotZLib/UnitTests.cs @@ -156,7 +156,7 @@ namespace DotZLibTests public void Info_Version() { Info info = new Info(); - Assert.AreEqual("1.2.11", Info.Version); + Assert.AreEqual("1.2.13", Info.Version); Assert.AreEqual(32, info.SizeOfUInt); Assert.AreEqual(32, info.SizeOfULong); Assert.AreEqual(32, info.SizeOfPointer); diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/LICENSE_1_0.txt b/src/dependencies/zlib-1.2.13/contrib/dotzlib/LICENSE_1_0.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/LICENSE_1_0.txt rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/LICENSE_1_0.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/dotzlib/readme.txt b/src/dependencies/zlib-1.2.13/contrib/dotzlib/readme.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/dotzlib/readme.txt rename to src/dependencies/zlib-1.2.13/contrib/dotzlib/readme.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/gcc_gvmat64/gvmat64.S b/src/dependencies/zlib-1.2.13/contrib/gcc_gvmat64/gvmat64.S similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/gcc_gvmat64/gvmat64.S rename to src/dependencies/zlib-1.2.13/contrib/gcc_gvmat64/gvmat64.S diff --git a/src/dependencies/zlib-1.2.11/contrib/infback9/README b/src/dependencies/zlib-1.2.13/contrib/infback9/README similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/infback9/README rename to src/dependencies/zlib-1.2.13/contrib/infback9/README diff --git a/src/dependencies/zlib-1.2.11/contrib/infback9/infback9.c b/src/dependencies/zlib-1.2.13/contrib/infback9/infback9.c similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/infback9/infback9.c rename to src/dependencies/zlib-1.2.13/contrib/infback9/infback9.c diff --git a/src/dependencies/zlib-1.2.11/contrib/infback9/infback9.h b/src/dependencies/zlib-1.2.13/contrib/infback9/infback9.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/infback9/infback9.h rename to src/dependencies/zlib-1.2.13/contrib/infback9/infback9.h diff --git a/src/dependencies/zlib-1.2.11/contrib/infback9/inffix9.h b/src/dependencies/zlib-1.2.13/contrib/infback9/inffix9.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/infback9/inffix9.h rename to src/dependencies/zlib-1.2.13/contrib/infback9/inffix9.h diff --git a/src/dependencies/zlib-1.2.11/contrib/infback9/inflate9.h b/src/dependencies/zlib-1.2.13/contrib/infback9/inflate9.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/infback9/inflate9.h rename to src/dependencies/zlib-1.2.13/contrib/infback9/inflate9.h diff --git a/src/dependencies/zlib-1.2.11/contrib/infback9/inftree9.c b/src/dependencies/zlib-1.2.13/contrib/infback9/inftree9.c similarity index 98% rename from src/dependencies/zlib-1.2.11/contrib/infback9/inftree9.c rename to src/dependencies/zlib-1.2.13/contrib/infback9/inftree9.c index 5f4a767..10827a6 100644 --- a/src/dependencies/zlib-1.2.11/contrib/infback9/inftree9.c +++ b/src/dependencies/zlib-1.2.13/contrib/infback9/inftree9.c @@ -1,5 +1,5 @@ /* inftree9.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2017 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate9_copyright[] = - " inflate9 1.2.11 Copyright 1995-2017 Mark Adler "; + " inflate9 1.2.13 Copyright 1995-2022 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -64,7 +64,7 @@ unsigned short FAR *work; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 77, 202}; + 133, 133, 133, 133, 144, 194, 65}; static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, diff --git a/src/dependencies/zlib-1.2.11/contrib/infback9/inftree9.h b/src/dependencies/zlib-1.2.13/contrib/infback9/inftree9.h similarity index 97% rename from src/dependencies/zlib-1.2.11/contrib/infback9/inftree9.h rename to src/dependencies/zlib-1.2.13/contrib/infback9/inftree9.h index 5ab21f0..3b39497 100644 --- a/src/dependencies/zlib-1.2.11/contrib/infback9/inftree9.h +++ b/src/dependencies/zlib-1.2.13/contrib/infback9/inftree9.h @@ -38,7 +38,7 @@ typedef struct { /* Maximum size of the dynamic table. The maximum number of code structures is 1446, which is the sum of 852 for literal/length codes and 594 for distance codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that + examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes returns returns 852, and "enough 32 6 15" for distance codes returns 594. diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream/test.cpp b/src/dependencies/zlib-1.2.13/contrib/iostream/test.cpp similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream/test.cpp rename to src/dependencies/zlib-1.2.13/contrib/iostream/test.cpp diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream/zfstream.cpp b/src/dependencies/zlib-1.2.13/contrib/iostream/zfstream.cpp similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream/zfstream.cpp rename to src/dependencies/zlib-1.2.13/contrib/iostream/zfstream.cpp diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream/zfstream.h b/src/dependencies/zlib-1.2.13/contrib/iostream/zfstream.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream/zfstream.h rename to src/dependencies/zlib-1.2.13/contrib/iostream/zfstream.h diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream2/zstream.h b/src/dependencies/zlib-1.2.13/contrib/iostream2/zstream.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream2/zstream.h rename to src/dependencies/zlib-1.2.13/contrib/iostream2/zstream.h diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream2/zstream_test.cpp b/src/dependencies/zlib-1.2.13/contrib/iostream2/zstream_test.cpp similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream2/zstream_test.cpp rename to src/dependencies/zlib-1.2.13/contrib/iostream2/zstream_test.cpp diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream3/README b/src/dependencies/zlib-1.2.13/contrib/iostream3/README similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream3/README rename to src/dependencies/zlib-1.2.13/contrib/iostream3/README diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream3/TODO b/src/dependencies/zlib-1.2.13/contrib/iostream3/TODO similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream3/TODO rename to src/dependencies/zlib-1.2.13/contrib/iostream3/TODO diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream3/test.cc b/src/dependencies/zlib-1.2.13/contrib/iostream3/test.cc similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream3/test.cc rename to src/dependencies/zlib-1.2.13/contrib/iostream3/test.cc diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream3/zfstream.cc b/src/dependencies/zlib-1.2.13/contrib/iostream3/zfstream.cc similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream3/zfstream.cc rename to src/dependencies/zlib-1.2.13/contrib/iostream3/zfstream.cc diff --git a/src/dependencies/zlib-1.2.11/contrib/iostream3/zfstream.h b/src/dependencies/zlib-1.2.13/contrib/iostream3/zfstream.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/iostream3/zfstream.h rename to src/dependencies/zlib-1.2.13/contrib/iostream3/zfstream.h diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/Makefile b/src/dependencies/zlib-1.2.13/contrib/minizip/Makefile similarity index 62% rename from src/dependencies/zlib-1.2.11/contrib/minizip/Makefile rename to src/dependencies/zlib-1.2.13/contrib/minizip/Makefile index 84eaad2..aac76e0 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/Makefile +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/Makefile @@ -1,5 +1,5 @@ CC=cc -CFLAGS=-O -I../.. +CFLAGS := $(CFLAGS) -O -I../.. UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a @@ -16,10 +16,14 @@ minizip: $(ZIP_OBJS) $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) test: miniunz minizip - ./minizip test readme.txt + @rm -f test.* + @echo hello hello hello > test.txt + ./minizip test test.txt ./miniunz -l test.zip - mv readme.txt readme.old + @mv test.txt test.old ./miniunz test.zip + @cmp test.txt test.old + @rm -f test.* clean: - /bin/rm -f *.o *~ minizip miniunz + /bin/rm -f *.o *~ minizip miniunz test.* diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/Makefile.am b/src/dependencies/zlib-1.2.13/contrib/minizip/Makefile.am similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/Makefile.am rename to src/dependencies/zlib-1.2.13/contrib/minizip/Makefile.am diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/MiniZip64_Changes.txt b/src/dependencies/zlib-1.2.13/contrib/minizip/MiniZip64_Changes.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/MiniZip64_Changes.txt rename to src/dependencies/zlib-1.2.13/contrib/minizip/MiniZip64_Changes.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/MiniZip64_info.txt b/src/dependencies/zlib-1.2.13/contrib/minizip/MiniZip64_info.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/MiniZip64_info.txt rename to src/dependencies/zlib-1.2.13/contrib/minizip/MiniZip64_info.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/configure.ac b/src/dependencies/zlib-1.2.13/contrib/minizip/configure.ac similarity index 93% rename from src/dependencies/zlib-1.2.11/contrib/minizip/configure.ac rename to src/dependencies/zlib-1.2.13/contrib/minizip/configure.ac index 5b11970..bff300b 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/configure.ac +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([minizip], [1.2.11], [bugzilla.redhat.com]) +AC_INIT([minizip], [1.2.13], [bugzilla.redhat.com]) AC_CONFIG_SRCDIR([minizip.c]) AM_INIT_AUTOMAKE([foreign]) LT_INIT diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/crypt.h b/src/dependencies/zlib-1.2.13/contrib/minizip/crypt.h similarity index 88% rename from src/dependencies/zlib-1.2.11/contrib/minizip/crypt.h rename to src/dependencies/zlib-1.2.13/contrib/minizip/crypt.h index 1e9e820..1cc41f1 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/crypt.h +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/crypt.h @@ -38,6 +38,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) * unpredictable manner on 16-bit systems; not a problem * with any known compiler so far, though */ + (void)pcrc_32_tab; temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); } @@ -77,24 +78,24 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcr (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) #define zencode(pkeys,pcrc_32_tab,c,t) \ - (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) + (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c)) #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED #define RAND_HEAD_LEN 12 /* "last resort" source for second part of crypt seed pattern */ # ifndef ZCR_SEED2 -# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ +# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ # endif -static int crypthead(const char* passwd, /* password string */ - unsigned char* buf, /* where to write header */ - int bufSize, - unsigned long* pkeys, - const z_crc_t* pcrc_32_tab, - unsigned long crcForCrypting) +static unsigned crypthead(const char* passwd, /* password string */ + unsigned char* buf, /* where to write header */ + int bufSize, + unsigned long* pkeys, + const z_crc_t* pcrc_32_tab, + unsigned long crcForCrypting) { - int n; /* index in random header */ + unsigned n; /* index in random header */ int t; /* temporary */ int c; /* random byte */ unsigned char header[RAND_HEAD_LEN-2]; /* random header */ diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/ioapi.c b/src/dependencies/zlib-1.2.13/contrib/minizip/ioapi.c similarity index 94% rename from src/dependencies/zlib-1.2.11/contrib/minizip/ioapi.c rename to src/dependencies/zlib-1.2.13/contrib/minizip/ioapi.c index 7f5c191..814a6fd 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/ioapi.c +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/ioapi.c @@ -58,7 +58,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); else { - uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); + uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); if ((tell_uLong) == MAXU32) return (ZPOS64_T)-1; else @@ -96,6 +96,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in { FILE* file = NULL; const char* mode_fopen = NULL; + (void)opaque; if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) mode_fopen = "rb"; else @@ -114,6 +115,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, { FILE* file = NULL; const char* mode_fopen = NULL; + (void)opaque; if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) mode_fopen = "rb"; else @@ -132,6 +134,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) { uLong ret; + (void)opaque; ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); return ret; } @@ -139,6 +142,7 @@ static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) { uLong ret; + (void)opaque; ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); return ret; } @@ -146,6 +150,7 @@ static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const voi static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) { long ret; + (void)opaque; ret = ftell((FILE *)stream); return ret; } @@ -154,7 +159,8 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) { ZPOS64_T ret; - ret = FTELLO_FUNC((FILE *)stream); + (void)opaque; + ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream); return ret; } @@ -162,6 +168,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs { int fseek_origin=0; long ret; + (void)opaque; switch (origin) { case ZLIB_FILEFUNC_SEEK_CUR : @@ -176,7 +183,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs default: return -1; } ret = 0; - if (fseek((FILE *)stream, offset, fseek_origin) != 0) + if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0) ret = -1; return ret; } @@ -185,6 +192,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T { int fseek_origin=0; long ret; + (void)opaque; switch (origin) { case ZLIB_FILEFUNC_SEEK_CUR : @@ -200,7 +208,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T } ret = 0; - if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) + if(FSEEKO_FUNC((FILE *)stream, (z_off_t)offset, fseek_origin) != 0) ret = -1; return ret; @@ -210,6 +218,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) { int ret; + (void)opaque; ret = fclose((FILE *)stream); return ret; } @@ -217,6 +226,7 @@ static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) { int ret; + (void)opaque; ret = ferror((FILE *)stream); return ret; } diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/ioapi.h b/src/dependencies/zlib-1.2.13/contrib/minizip/ioapi.h similarity index 98% rename from src/dependencies/zlib-1.2.11/contrib/minizip/ioapi.h rename to src/dependencies/zlib-1.2.13/contrib/minizip/ioapi.h index 8dcbdb0..ae9ca7e 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/ioapi.h +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/ioapi.h @@ -50,7 +50,7 @@ #define ftello64 ftell #define fseeko64 fseek #else -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #define fopen64 fopen #define ftello64 ftello #define fseeko64 fseeko @@ -91,8 +91,7 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; typedef uint64_t ZPOS64_T; #else -/* Maximum unsigned 32-bit value used as placeholder for zip64 */ -#define MAXU32 0xffffffff + #if defined(_MSC_VER) || defined(__BORLANDC__) typedef unsigned __int64 ZPOS64_T; @@ -102,7 +101,10 @@ typedef unsigned long long int ZPOS64_T; #endif #endif - +/* Maximum unsigned 32-bit value used as placeholder for zip64 */ +#ifndef MAXU32 +#define MAXU32 (0xffffffff) +#endif #ifdef __cplusplus extern "C" { diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/iowin32.c b/src/dependencies/zlib-1.2.13/contrib/minizip/iowin32.c similarity index 98% rename from src/dependencies/zlib-1.2.11/contrib/minizip/iowin32.c rename to src/dependencies/zlib-1.2.13/contrib/minizip/iowin32.c index 274f39e..7df5251 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/iowin32.c +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/iowin32.c @@ -28,6 +28,11 @@ // see Include/shared/winapifamily.h in the Windows Kit #if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) + +#if !defined(WINAPI_FAMILY_ONE_PARTITION) +#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) +#endif + #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP) #define IOWIN32_USING_WINRT_API 1 #endif diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/iowin32.h b/src/dependencies/zlib-1.2.13/contrib/minizip/iowin32.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/iowin32.h rename to src/dependencies/zlib-1.2.13/contrib/minizip/iowin32.h diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/make_vms.com b/src/dependencies/zlib-1.2.13/contrib/minizip/make_vms.com similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/make_vms.com rename to src/dependencies/zlib-1.2.13/contrib/minizip/make_vms.com diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/miniunz.c b/src/dependencies/zlib-1.2.13/contrib/minizip/miniunz.c similarity index 95% rename from src/dependencies/zlib-1.2.11/contrib/minizip/miniunz.c rename to src/dependencies/zlib-1.2.13/contrib/minizip/miniunz.c index 3d65401..0dc9b50 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/miniunz.c +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/miniunz.c @@ -45,6 +45,7 @@ #include #include #include +#include #ifdef _WIN32 # include @@ -80,7 +81,7 @@ filename : the filename of the file where date/time must be modified dosdate : the new date at the MSDos format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ -void change_file_date(filename,dosdate,tmu_date) +static void change_file_date(filename,dosdate,tmu_date) const char *filename; uLong dosdate; tm_unz tmu_date; @@ -97,7 +98,8 @@ void change_file_date(filename,dosdate,tmu_date) SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); CloseHandle(hFile); #else -#ifdef unix || __APPLE__ +#if defined(unix) || defined(__APPLE__) + (void)dosdate; struct utimbuf ut; struct tm newdate; newdate.tm_sec = tmu_date.tm_sec; @@ -121,7 +123,7 @@ void change_file_date(filename,dosdate,tmu_date) /* mymkdir and change_file_date are not 100 % portable As I don't know well Unix, I wait feedback for the unix portion */ -int mymkdir(dirname) +static int mymkdir(dirname) const char* dirname; { int ret=0; @@ -135,14 +137,14 @@ int mymkdir(dirname) return ret; } -int makedir (newdir) - char *newdir; +static int makedir (newdir) + const char *newdir; { char *buffer ; char *p; - int len = (int)strlen(newdir); + size_t len = strlen(newdir); - if (len <= 0) + if (len == 0) return 0; buffer = (char*)malloc(len+1); @@ -185,13 +187,13 @@ int makedir (newdir) return 1; } -void do_banner() +static void do_banner() { printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } -void do_help() +static void do_help() { printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ " -e Extract without pathname (junk paths)\n" \ @@ -203,7 +205,7 @@ void do_help() " -p extract crypted file using password\n\n"); } -void Display64BitsSize(ZPOS64_T n, int size_char) +static void Display64BitsSize(ZPOS64_T n, int size_char) { /* to avoid compatibility problem , we do here the conversion */ char number[21]; @@ -231,7 +233,7 @@ void Display64BitsSize(ZPOS64_T n, int size_char) printf("%s",&number[pos_string]); } -int do_list(uf) +static int do_list(uf) unzFile uf; { uLong i; @@ -309,7 +311,7 @@ int do_list(uf) } -int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) +static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) unzFile uf; const int* popt_extract_without_path; int* popt_overwrite; @@ -324,7 +326,6 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) uInt size_buf; unz_file_info64 file_info; - uLong ratio=0; err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); if (err!=UNZ_OK) @@ -439,7 +440,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) break; } if (err>0) - if (fwrite(buf,err,1,fout)!=1) + if (fwrite(buf,(unsigned)err,1,fout)!=1) { printf("error in writing extracted file\n"); err=UNZ_ERRNO; @@ -472,7 +473,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) } -int do_extract(uf,opt_extract_without_path,opt_overwrite,password) +static int do_extract(uf,opt_extract_without_path,opt_overwrite,password) unzFile uf; int opt_extract_without_path; int opt_overwrite; @@ -481,7 +482,6 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password) uLong i; unz_global_info64 gi; int err; - FILE* fout=NULL; err = unzGetGlobalInfo64(uf,&gi); if (err!=UNZ_OK) @@ -508,14 +508,13 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password) return 0; } -int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password) +static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password) unzFile uf; const char* filename; int opt_extract_without_path; int opt_overwrite; const char* password; { - int err = UNZ_OK; if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) { printf("file %s not found in the zipfile\n",filename); @@ -565,7 +564,7 @@ int main(argc,argv) while ((*p)!='\0') { - char c=*(p++);; + char c=*(p++); if ((c=='l') || (c=='L')) opt_do_list = 1; if ((c=='v') || (c=='V')) diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/miniunzip.1 b/src/dependencies/zlib-1.2.13/contrib/minizip/miniunzip.1 similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/miniunzip.1 rename to src/dependencies/zlib-1.2.13/contrib/minizip/miniunzip.1 diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/minizip.1 b/src/dependencies/zlib-1.2.13/contrib/minizip/minizip.1 similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/minizip.1 rename to src/dependencies/zlib-1.2.13/contrib/minizip/minizip.1 diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/minizip.c b/src/dependencies/zlib-1.2.13/contrib/minizip/minizip.c similarity index 92% rename from src/dependencies/zlib-1.2.11/contrib/minizip/minizip.c rename to src/dependencies/zlib-1.2.13/contrib/minizip/minizip.c index 4288962..e8561b1 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/minizip.c +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/minizip.c @@ -71,8 +71,8 @@ #define MAXFILENAME (256) #ifdef _WIN32 -uLong filetime(f, tmzip, dt) - char *f; /* name of file to get info on */ +static int filetime(f, tmzip, dt) + const char *f; /* name of file to get info on */ tm_zip *tmzip; /* return value: access, modific. and creation times */ uLong *dt; /* dostime */ { @@ -94,12 +94,13 @@ uLong filetime(f, tmzip, dt) return ret; } #else -#ifdef unix || __APPLE__ -uLong filetime(f, tmzip, dt) - char *f; /* name of file to get info on */ +#if defined(unix) || defined(__APPLE__) +static int filetime(f, tmzip, dt) + const char *f; /* name of file to get info on */ tm_zip *tmzip; /* return value: access, modific. and creation times */ uLong *dt; /* dostime */ { + (void)dt; int ret=0; struct stat s; /* results of stat() */ struct tm* filedate; @@ -108,7 +109,7 @@ uLong filetime(f, tmzip, dt) if (strcmp(f,"-")!=0) { char name[MAXFILENAME+1]; - int len = strlen(f); + size_t len = strlen(f); if (len > MAXFILENAME) len = MAXFILENAME; @@ -138,7 +139,7 @@ uLong filetime(f, tmzip, dt) } #else uLong filetime(f, tmzip, dt) - char *f; /* name of file to get info on */ + const char *f; /* name of file to get info on */ tm_zip *tmzip; /* return value: access, modific. and creation times */ uLong *dt; /* dostime */ { @@ -150,7 +151,7 @@ uLong filetime(f, tmzip, dt) -int check_exist_file(filename) +static int check_exist_file(filename) const char* filename; { FILE* ftestexist; @@ -163,13 +164,13 @@ int check_exist_file(filename) return ret; } -void do_banner() +static void do_banner() { printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); } -void do_help() +static void do_help() { printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ " -o Overwrite existing file.zip\n" \ @@ -182,14 +183,14 @@ void do_help() /* calculate the CRC32 of a file, because to encrypt a file, we need known the CRC32 of the file before */ -int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) +static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) { unsigned long calculate_crc=0; int err=ZIP_OK; FILE * fin = FOPEN_FUNC(filenameinzip,"rb"); unsigned long size_read = 0; - unsigned long total_read = 0; + /* unsigned long total_read = 0; */ if (fin==NULL) { err = ZIP_ERRNO; @@ -199,7 +200,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne do { err = ZIP_OK; - size_read = (int)fread(buf,1,size_buf,fin); + size_read = fread(buf,1,size_buf,fin); if (size_read < size_buf) if (feof(fin)==0) { @@ -208,8 +209,8 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne } if (size_read>0) - calculate_crc = crc32(calculate_crc,buf,size_read); - total_read += size_read; + calculate_crc = crc32_z(calculate_crc,buf,size_read); + /* total_read += size_read; */ } while ((err == ZIP_OK) && (size_read>0)); @@ -221,7 +222,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne return err; } -int isLargeFile(const char* filename) +static int isLargeFile(const char* filename) { int largeFile = 0; ZPOS64_T pos = 0; @@ -229,8 +230,8 @@ int isLargeFile(const char* filename) if(pFile != NULL) { - int n = FSEEKO_FUNC(pFile, 0, SEEK_END); - pos = FTELLO_FUNC(pFile); + FSEEKO_FUNC(pFile, 0, SEEK_END); + pos = (ZPOS64_T)FTELLO_FUNC(pFile); printf("File : %s is %lld bytes\n", filename, pos); @@ -255,7 +256,7 @@ int main(argc,argv) char filename_try[MAXFILENAME+16]; int zipok; int err=0; - int size_buf=0; + size_t size_buf=0; void* buf=NULL; const char* password=NULL; @@ -276,7 +277,7 @@ int main(argc,argv) while ((*p)!='\0') { - char c=*(p++);; + char c=*(p++); if ((c=='o') || (c=='O')) opt_overwrite = 1; if ((c=='a') || (c=='A')) @@ -396,7 +397,7 @@ int main(argc,argv) (strlen(argv[i]) == 2))) { FILE * fin; - int size_read; + size_t size_read; const char* filenameinzip = argv[i]; const char *savefilenameinzip; zip_fileinfo zi; @@ -472,7 +473,7 @@ int main(argc,argv) do { err = ZIP_OK; - size_read = (int)fread(buf,1,size_buf,fin); + size_read = fread(buf,1,size_buf,fin); if (size_read < size_buf) if (feof(fin)==0) { @@ -482,7 +483,7 @@ int main(argc,argv) if (size_read>0) { - err = zipWriteInFileInZip (zf,buf,size_read); + err = zipWriteInFileInZip (zf,buf,(unsigned)size_read); if (err<0) { printf("error in writing %s in the zipfile\n", diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/minizip.pc.in b/src/dependencies/zlib-1.2.13/contrib/minizip/minizip.pc.in similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/minizip.pc.in rename to src/dependencies/zlib-1.2.13/contrib/minizip/minizip.pc.in diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/mztools.c b/src/dependencies/zlib-1.2.13/contrib/minizip/mztools.c similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/mztools.c rename to src/dependencies/zlib-1.2.13/contrib/minizip/mztools.c diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/mztools.h b/src/dependencies/zlib-1.2.13/contrib/minizip/mztools.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/minizip/mztools.h rename to src/dependencies/zlib-1.2.13/contrib/minizip/mztools.h diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/unzip.c b/src/dependencies/zlib-1.2.13/contrib/minizip/unzip.c similarity index 98% rename from src/dependencies/zlib-1.2.11/contrib/minizip/unzip.c rename to src/dependencies/zlib-1.2.13/contrib/minizip/unzip.c index bcfb941..3036b47 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/unzip.c +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/unzip.c @@ -112,7 +112,7 @@ # define ALLOC(size) (malloc(size)) #endif #ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} +# define TRYFREE(p) { free(p);} #endif #define SIZECENTRALDIRITEM (0x2e) @@ -455,7 +455,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) { - uPosFound = uReadPos+i; + uPosFound = uReadPos+(unsigned)i; break; } @@ -523,7 +523,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) { - uPosFound = uReadPos+i; + uPosFound = uReadPos+(unsigned)i; break; } @@ -853,13 +853,13 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) { ZPOS64_T uDate; uDate = (ZPOS64_T)(ulDosDate>>16); - ptm->tm_mday = (uInt)(uDate&0x1f) ; - ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; - ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; + ptm->tm_mday = (int)(uDate&0x1f) ; + ptm->tm_mon = (int)((((uDate)&0x1E0)/0x20)-1) ; + ptm->tm_year = (int)(((uDate&0x0FE00)/0x0200)+1980) ; - ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); - ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; - ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; + ptm->tm_hour = (int) ((ulDosDate &0xF800)/0x800); + ptm->tm_min = (int) ((ulDosDate&0x7E0)/0x20) ; + ptm->tm_sec = (int) (2*(ulDosDate&0x1f)) ; } /* @@ -993,7 +993,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, if (lSeek!=0) { - if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) + if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; @@ -1018,7 +1018,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, if (lSeek!=0) { - if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) + if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; @@ -1090,7 +1090,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, if (lSeek!=0) { - if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) + if (ZSEEK64(s->z_filefunc, s->filestream,(ZPOS64_T)lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; @@ -1566,6 +1566,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; else { + TRYFREE(pfile_in_zip_read_info->read_buffer); TRYFREE(pfile_in_zip_read_info); return err; } @@ -1586,6 +1587,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; else { + TRYFREE(pfile_in_zip_read_info->read_buffer); TRYFREE(pfile_in_zip_read_info); return err; } @@ -1767,7 +1769,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) if ((pfile_in_zip_read_info->stream.avail_in == 0) && (pfile_in_zip_read_info->rest_read_compressed == 0)) - return (iRead==0) ? UNZ_EOF : iRead; + return (iRead==0) ? UNZ_EOF : (int)iRead; if (pfile_in_zip_read_info->stream.avail_out < pfile_in_zip_read_info->stream.avail_in) @@ -1857,6 +1859,9 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) err = Z_DATA_ERROR; uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; + /* Detect overflow, because z_stream.total_out is uLong (32 bits) */ + if (uTotalOutAftertotal_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis; @@ -1871,14 +1876,14 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); if (err==Z_STREAM_END) - return (iRead==0) ? UNZ_EOF : iRead; + return (iRead==0) ? UNZ_EOF : (int)iRead; if (err!=Z_OK) break; } } if (err==Z_OK) - return iRead; + return (int)iRead; return err; } diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/unzip.h b/src/dependencies/zlib-1.2.13/contrib/minizip/unzip.h similarity index 97% rename from src/dependencies/zlib-1.2.11/contrib/minizip/unzip.h rename to src/dependencies/zlib-1.2.13/contrib/minizip/unzip.h index 2104e39..6f95e94 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/unzip.h +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/unzip.h @@ -83,12 +83,12 @@ typedef voidp unzFile; /* tm_unz contain date/time info */ typedef struct tm_unz_s { - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ + int tm_sec; /* seconds after the minute - [0,59] */ + int tm_min; /* minutes after the hour - [0,59] */ + int tm_hour; /* hours since midnight - [0,23] */ + int tm_mday; /* day of the month - [1,31] */ + int tm_mon; /* months since January - [0,11] */ + int tm_year; /* years - [1980..2044] */ } tm_unz; /* unz_global_info structure contain global data about the ZIPfile diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/zip.c b/src/dependencies/zlib-1.2.13/contrib/minizip/zip.c similarity index 98% rename from src/dependencies/zlib-1.2.11/contrib/minizip/zip.c rename to src/dependencies/zlib-1.2.13/contrib/minizip/zip.c index 44e88a9..66d693f 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/zip.c +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/zip.c @@ -158,7 +158,7 @@ typedef struct #ifndef NOCRYPT unsigned long keys[3]; /* keys defining the pseudo-random sequence */ const z_crc_t* pcrc_32_tab; - int crypt_header_size; + unsigned crypt_header_size; #endif } curfile64_info; @@ -301,7 +301,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, } } - if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) + if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte) return ZIP_ERRNO; else return ZIP_OK; @@ -337,8 +337,8 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) else if (year>=80) year-=80; return - (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) | - ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); + (uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) | + (((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); } @@ -522,12 +522,12 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) { - uPosFound = uReadPos+i; + uPosFound = uReadPos+(unsigned)i; break; } - if (uPosFound!=0) - break; + if (uPosFound!=0) + break; } TRYFREE(buf); return uPosFound; @@ -586,7 +586,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib // Signature "0x07064b50" Zip64 end of central directory locater if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) { - uPosFound = uReadPos+i; + uPosFound = uReadPos+(unsigned)i; break; } } @@ -637,7 +637,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib return relativeOffset; } -int LoadCentralDirectoryRecord(zip64_internal* pziinit) +local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { int err=ZIP_OK; ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ @@ -955,7 +955,7 @@ extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append) return zipOpen3(pathname,append,NULL,NULL); } -int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) +local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) { /* write the local header */ int err; @@ -1034,8 +1034,8 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex // Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file) zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2); + err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2); err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8); err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8); @@ -1471,11 +1471,6 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in { uLong uTotalOutBefore = zi->ci.stream.total_out; err=deflate(&zi->ci.stream, Z_NO_FLUSH); - if(uTotalOutBefore > zi->ci.stream.total_out) - { - int bBreak = 0; - bBreak++; - } zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; } @@ -1516,7 +1511,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s zip64_internal* zi; ZPOS64_T compressed_size; uLong invalidValue = 0xffffffff; - short datasize = 0; + unsigned datasize = 0; int err=ZIP_OK; if (file == NULL) @@ -1752,7 +1747,7 @@ extern int ZEXPORT zipCloseFileInZip (zipFile file) return zipCloseFileInZipRaw (file,0,0); } -int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) +local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) { int err = ZIP_OK; ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset; @@ -1774,7 +1769,7 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo return err; } -int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) +local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) { int err = ZIP_OK; @@ -1813,7 +1808,7 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra } return err; } -int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) +local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) { int err = ZIP_OK; @@ -1861,7 +1856,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, return err; } -int Write_GlobalComment(zip64_internal* zi, const char* global_comment) +local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) { int err = ZIP_OK; uInt size_global_comment = 0; @@ -1959,10 +1954,10 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe int retVal = ZIP_OK; - if(pData == NULL || *dataLen < 4) + if(pData == NULL || dataLen == NULL || *dataLen < 4) return ZIP_PARAMERROR; - pNewHeader = (char*)ALLOC(*dataLen); + pNewHeader = (char*)ALLOC((unsigned)*dataLen); pTmp = pNewHeader; while(p < (pData + *dataLen)) diff --git a/src/dependencies/zlib-1.2.11/contrib/minizip/zip.h b/src/dependencies/zlib-1.2.13/contrib/minizip/zip.h similarity index 95% rename from src/dependencies/zlib-1.2.11/contrib/minizip/zip.h rename to src/dependencies/zlib-1.2.13/contrib/minizip/zip.h index 8aaebb6..7e4509d 100644 --- a/src/dependencies/zlib-1.2.11/contrib/minizip/zip.h +++ b/src/dependencies/zlib-1.2.13/contrib/minizip/zip.h @@ -88,12 +88,12 @@ typedef voidp zipFile; /* tm_zip contain date/time info */ typedef struct tm_zip_s { - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ + int tm_sec; /* seconds after the minute - [0,59] */ + int tm_min; /* minutes after the hour - [0,59] */ + int tm_hour; /* hours since midnight - [0,23] */ + int tm_mday; /* day of the month - [1,31] */ + int tm_mon; /* months since January - [0,11] */ + int tm_year; /* years - [1980..2044] */ } tm_zip; typedef struct @@ -144,6 +144,11 @@ extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)); +extern zipFile ZEXPORT zipOpen3 OF((const void *pathname, + int append, + zipcharpc* globalcomment, + zlib_filefunc64_32_def* pzlib_filefunc64_32_def)); + extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, const char* filename, const zip_fileinfo* zipfi, diff --git a/src/dependencies/zlib-1.2.11/contrib/pascal/example.pas b/src/dependencies/zlib-1.2.13/contrib/pascal/example.pas similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/pascal/example.pas rename to src/dependencies/zlib-1.2.13/contrib/pascal/example.pas diff --git a/src/dependencies/zlib-1.2.11/contrib/pascal/readme.txt b/src/dependencies/zlib-1.2.13/contrib/pascal/readme.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/pascal/readme.txt rename to src/dependencies/zlib-1.2.13/contrib/pascal/readme.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/pascal/zlibd32.mak b/src/dependencies/zlib-1.2.13/contrib/pascal/zlibd32.mak similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/pascal/zlibd32.mak rename to src/dependencies/zlib-1.2.13/contrib/pascal/zlibd32.mak diff --git a/src/dependencies/zlib-1.2.11/contrib/pascal/zlibpas.pas b/src/dependencies/zlib-1.2.13/contrib/pascal/zlibpas.pas similarity index 99% rename from src/dependencies/zlib-1.2.11/contrib/pascal/zlibpas.pas rename to src/dependencies/zlib-1.2.13/contrib/pascal/zlibpas.pas index a0dff11..bf3fff6 100644 --- a/src/dependencies/zlib-1.2.11/contrib/pascal/zlibpas.pas +++ b/src/dependencies/zlib-1.2.13/contrib/pascal/zlibpas.pas @@ -10,7 +10,7 @@ unit zlibpas; interface const - ZLIB_VERSION = '1.2.11'; + ZLIB_VERSION = '1.2.13'; ZLIB_VERNUM = $12a0; type diff --git a/src/dependencies/zlib-1.2.11/contrib/puff/Makefile b/src/dependencies/zlib-1.2.13/contrib/puff/Makefile similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/puff/Makefile rename to src/dependencies/zlib-1.2.13/contrib/puff/Makefile diff --git a/src/dependencies/zlib-1.2.11/contrib/puff/README b/src/dependencies/zlib-1.2.13/contrib/puff/README similarity index 99% rename from src/dependencies/zlib-1.2.11/contrib/puff/README rename to src/dependencies/zlib-1.2.13/contrib/puff/README index bbc4cb5..d8192c7 100644 --- a/src/dependencies/zlib-1.2.11/contrib/puff/README +++ b/src/dependencies/zlib-1.2.13/contrib/puff/README @@ -38,7 +38,7 @@ Then you can call puff() to decompress a deflate stream that is in memory in its entirety at source, to a sufficiently sized block of memory for the decompressed data at dest. puff() is the only external symbol in puff.c The only C library functions that puff.c needs are setjmp() and longjmp(), which -are used to simplify error checking in the code to improve readabilty. puff.c +are used to simplify error checking in the code to improve readability. puff.c does no memory allocation, and uses less than 2K bytes off of the stack. If destlen is not enough space for the uncompressed data, then inflate will diff --git a/src/dependencies/zlib-1.2.11/contrib/puff/puff.c b/src/dependencies/zlib-1.2.13/contrib/puff/puff.c similarity index 99% rename from src/dependencies/zlib-1.2.11/contrib/puff/puff.c rename to src/dependencies/zlib-1.2.13/contrib/puff/puff.c index c6c90d7..6737ff6 100644 --- a/src/dependencies/zlib-1.2.11/contrib/puff/puff.c +++ b/src/dependencies/zlib-1.2.13/contrib/puff/puff.c @@ -43,7 +43,7 @@ * - Use pointers instead of long to specify source and * destination sizes to avoid arbitrary 4 GB limits * 1.2 17 Mar 2002 - Add faster version of decode(), doubles speed (!), - * but leave simple version for readabilty + * but leave simple version for readability * - Make sure invalid distances detected if pointers * are 16 bits * - Fix fixed codes table error @@ -624,7 +624,7 @@ local int fixed(struct state *s) * are themselves compressed using Huffman codes and run-length encoding. In * the list of code lengths, a 0 symbol means no code, a 1..15 symbol means * that length, and the symbols 16, 17, and 18 are run-length instructions. - * Each of 16, 17, and 18 are follwed by extra bits to define the length of + * Each of 16, 17, and 18 are followed by extra bits to define the length of * the run. 16 copies the last length 3 to 6 times. 17 represents 3 to 10 * zero lengths, and 18 represents 11 to 138 zero lengths. Unused symbols * are common, hence the special coding for zero lengths. diff --git a/src/dependencies/zlib-1.2.11/contrib/puff/puff.h b/src/dependencies/zlib-1.2.13/contrib/puff/puff.h similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/puff/puff.h rename to src/dependencies/zlib-1.2.13/contrib/puff/puff.h diff --git a/src/dependencies/zlib-1.2.11/contrib/puff/pufftest.c b/src/dependencies/zlib-1.2.13/contrib/puff/pufftest.c similarity index 98% rename from src/dependencies/zlib-1.2.11/contrib/puff/pufftest.c rename to src/dependencies/zlib-1.2.13/contrib/puff/pufftest.c index 7764814..5f72ecc 100644 --- a/src/dependencies/zlib-1.2.11/contrib/puff/pufftest.c +++ b/src/dependencies/zlib-1.2.13/contrib/puff/pufftest.c @@ -143,7 +143,7 @@ int main(int argc, char **argv) len - sourcelen); } - /* if requested, inflate again and write decompressd data to stdout */ + /* if requested, inflate again and write decompressed data to stdout */ if (put && ret == 0) { if (fail) destlen >>= 1; diff --git a/src/dependencies/zlib-1.2.11/contrib/puff/zeros.raw b/src/dependencies/zlib-1.2.13/contrib/puff/zeros.raw similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/puff/zeros.raw rename to src/dependencies/zlib-1.2.13/contrib/puff/zeros.raw diff --git a/src/dependencies/zlib-1.2.11/contrib/testzlib/testzlib.c b/src/dependencies/zlib-1.2.13/contrib/testzlib/testzlib.c similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/testzlib/testzlib.c rename to src/dependencies/zlib-1.2.13/contrib/testzlib/testzlib.c diff --git a/src/dependencies/zlib-1.2.11/contrib/testzlib/testzlib.txt b/src/dependencies/zlib-1.2.13/contrib/testzlib/testzlib.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/testzlib/testzlib.txt rename to src/dependencies/zlib-1.2.13/contrib/testzlib/testzlib.txt diff --git a/src/dependencies/zlib-1.2.11/contrib/untgz/Makefile b/src/dependencies/zlib-1.2.13/contrib/untgz/Makefile similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/untgz/Makefile rename to src/dependencies/zlib-1.2.13/contrib/untgz/Makefile diff --git a/src/dependencies/zlib-1.2.11/contrib/untgz/Makefile.msc b/src/dependencies/zlib-1.2.13/contrib/untgz/Makefile.msc similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/untgz/Makefile.msc rename to src/dependencies/zlib-1.2.13/contrib/untgz/Makefile.msc diff --git a/src/dependencies/zlib-1.2.11/contrib/untgz/untgz.c b/src/dependencies/zlib-1.2.13/contrib/untgz/untgz.c similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/untgz/untgz.c rename to src/dependencies/zlib-1.2.13/contrib/untgz/untgz.c diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/readme.txt b/src/dependencies/zlib-1.2.13/contrib/vstudio/readme.txt similarity index 90% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/readme.txt rename to src/dependencies/zlib-1.2.13/contrib/vstudio/readme.txt index f67eae8..17e693f 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/readme.txt +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/readme.txt @@ -1,4 +1,4 @@ -Building instructions for the DLL versions of Zlib 1.2.11 +Building instructions for the DLL versions of Zlib 1.2.13 ======================================================== This directory contains projects that build zlib and minizip using @@ -17,9 +17,6 @@ More information can be found at this site. Build instructions for Visual Studio 2008 (32 bits or 64 bits) -------------------------------------------------------------- - Decompress current zlib, including all contrib/* files -- Compile assembly code (with Visual Studio Command Prompt) by running: - bld_ml64.bat (in contrib\masmx64) - bld_ml32.bat (in contrib\masmx86) - Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008 - Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32" diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/miniunz.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/miniunz.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/miniunz.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/miniunz.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/miniunz.vcxproj.filters b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/miniunz.vcxproj.filters similarity index 89% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/miniunz.vcxproj.filters rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/miniunz.vcxproj.filters index 0b2a3de..e53556a 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/miniunz.vcxproj.filters +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/miniunz.vcxproj.filters @@ -3,7 +3,7 @@ {048af943-022b-4db6-beeb-a54c34774ee2} - cpp;c;cxx;def;odl;idl;hpj;bat;asm + cpp;c;cxx;def;odl;idl;hpj;bat {c1d600d2-888f-4aea-b73e-8b0dd9befa0c} diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/minizip.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/minizip.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/minizip.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/minizip.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/minizip.vcxproj.filters b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/minizip.vcxproj.filters similarity index 89% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/minizip.vcxproj.filters rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/minizip.vcxproj.filters index dd73cd3..bd18d71 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/minizip.vcxproj.filters +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/minizip.vcxproj.filters @@ -3,7 +3,7 @@ {c0419b40-bf50-40da-b153-ff74215b79de} - cpp;c;cxx;def;odl;idl;hpj;bat;asm + cpp;c;cxx;def;odl;idl;hpj;bat {bb87b070-735b-478e-92ce-7383abb2f36c} diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlib.vcxproj similarity index 90% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlib.vcxproj index 9088d17..0e668f7 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlib.vcxproj @@ -181,7 +181,7 @@ Disabled ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreadedDebug @@ -194,7 +194,7 @@ EditAndContinue - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true $(OutDir)testzlib.pdb @@ -241,7 +241,7 @@ OnlyExplicitInline true ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreaded @@ -254,7 +254,7 @@ ProgramDatabase - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true Console @@ -269,14 +269,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDebugDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -352,14 +352,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -398,14 +398,6 @@ - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj.filters b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlib.vcxproj.filters similarity index 88% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj.filters rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlib.vcxproj.filters index 249daa8..3cf52ee 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj.filters +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlib.vcxproj.filters @@ -3,7 +3,7 @@ {c1f6a2e3-5da5-4955-8653-310d3efe05a9} - cpp;c;cxx;def;odl;idl;hpj;bat;asm + cpp;c;cxx;def;odl;idl;hpj;bat {c2aaffdc-2c95-4d6f-8466-4bec5890af2c} @@ -30,9 +30,6 @@ Source Files - - Source Files - Source Files diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlibdll.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlibdll.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlibdll.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlibdll.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlibdll.vcxproj.filters b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlibdll.vcxproj.filters similarity index 89% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlibdll.vcxproj.filters rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlibdll.vcxproj.filters index 53a8693..aeb550e 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/testzlibdll.vcxproj.filters +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/testzlibdll.vcxproj.filters @@ -3,7 +3,7 @@ {fa61a89f-93fc-4c89-b29e-36224b7592f4} - cpp;c;cxx;def;odl;idl;hpj;bat;asm + cpp;c;cxx;def;odl;idl;hpj;bat {d4b85da0-2ba2-4934-b57f-e2584e3848ee} diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlib.rc b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlib.rc similarity index 80% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlib.rc rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlib.rc index fee177a..8760274 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlib.rc +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 + FILEVERSION 1, 2, 13, 0 + PRODUCTVERSION 1, 2, 13, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" + VALUE "FileVersion", "1.2.13\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibstat.vcxproj similarity index 88% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibstat.vcxproj index b9f2bbe..c7ed09e 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibstat.vcxproj @@ -160,7 +160,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) @@ -182,16 +182,12 @@ $(OutDir)zlibstat.lib true - - cd ..\..\masmx86 -bld_ml32.bat - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -210,19 +206,15 @@ bld_ml32.bat /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true - - cd ..\..\masmx86 -bld_ml32.bat - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -252,7 +244,7 @@ bld_ml32.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -274,10 +266,6 @@ bld_ml32.bat $(OutDir)zlibstat.lib true - - cd ..\..\masmx64 -bld_ml64.bat - @@ -285,7 +273,7 @@ bld_ml64.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -314,8 +302,8 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -334,14 +322,10 @@ bld_ml64.bat /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true - - cd ..\..\masmx64 -bld_ml64.bat - @@ -349,7 +333,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -379,7 +363,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -409,7 +393,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -443,14 +427,6 @@ bld_ml64.bat - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj.filters b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibstat.vcxproj.filters similarity index 92% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj.filters rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibstat.vcxproj.filters index c8c7f7e..ba7e23d 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj.filters +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibstat.vcxproj.filters @@ -33,9 +33,6 @@ Source Files - - Source Files - Source Files diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.def b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.def similarity index 96% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.def rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.def index 54e683d..ba09bc1 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.def +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.def @@ -151,3 +151,8 @@ EXPORTS deflateGetDictionary @173 adler32_z @174 crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.sln b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.sln similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.sln rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.sln diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.vcxproj similarity index 90% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.vcxproj index 6ff9ddb..19dfc35 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.vcxproj @@ -197,8 +197,8 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) MultiThreadedDebug @@ -219,7 +219,7 @@ /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) true .\zlibvc.def true @@ -229,10 +229,6 @@ - - cd ..\..\masmx86 -bld_ml32.bat - @@ -244,7 +240,7 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -288,8 +284,8 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -312,7 +308,7 @@ bld_ml32.bat /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) true false .\zlibvc.def @@ -322,10 +318,6 @@ bld_ml32.bat - - cd ..\..\masmx86 -bld_ml32.bat - @@ -337,8 +329,8 @@ bld_ml32.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -358,7 +350,7 @@ bld_ml32.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) true .\zlibvc.def true @@ -366,10 +358,6 @@ bld_ml32.bat Windows MachineX64 - - cd ..\..\masmx64 -bld_ml64.bat - @@ -381,7 +369,7 @@ bld_ml64.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) @@ -424,7 +412,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -465,7 +453,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -510,8 +498,8 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -533,7 +521,7 @@ bld_ml64.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) true false .\zlibvc.def @@ -541,10 +529,6 @@ bld_ml64.bat Windows MachineX64 - - cd ..\..\masmx64 -bld_ml64.bat - @@ -556,7 +540,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -601,14 +585,6 @@ bld_ml64.bat - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj.filters b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.vcxproj.filters similarity index 94% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj.filters rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.vcxproj.filters index 180b71c..67c444a 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj.filters +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc10/zlibvc.vcxproj.filters @@ -42,9 +42,6 @@ Source Files - - Source Files - Source Files diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/miniunz.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/miniunz.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/miniunz.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/miniunz.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/minizip.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/minizip.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/minizip.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/minizip.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/testzlib.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/testzlib.vcxproj similarity index 90% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/testzlib.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/testzlib.vcxproj index 6d55954..c6198c1 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/testzlib.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/testzlib.vcxproj @@ -187,7 +187,7 @@ Disabled ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreadedDebugDLL @@ -200,7 +200,7 @@ ProgramDatabase - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true $(OutDir)testzlib.pdb @@ -247,7 +247,7 @@ OnlyExplicitInline true ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreaded @@ -260,7 +260,7 @@ ProgramDatabase - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true Console @@ -275,14 +275,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDebugDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -358,14 +358,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -404,14 +404,6 @@ - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/testzlibdll.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/testzlibdll.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/testzlibdll.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/testzlibdll.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlib.rc b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlib.rc similarity index 80% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlib.rc rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlib.rc index fee177a..8760274 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlib.rc +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 + FILEVERSION 1, 2, 13, 0 + PRODUCTVERSION 1, 2, 13, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" + VALUE "FileVersion", "1.2.13\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibstat.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibstat.vcxproj similarity index 89% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibstat.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibstat.vcxproj index 806b76a..86fb1c8 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibstat.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibstat.vcxproj @@ -167,7 +167,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) @@ -193,8 +193,8 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -213,7 +213,7 @@ /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true @@ -221,7 +221,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -251,7 +251,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -280,7 +280,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -309,8 +309,8 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -329,7 +329,7 @@ /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true @@ -340,7 +340,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -370,7 +370,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -400,7 +400,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -434,14 +434,6 @@ - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.def b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.def similarity index 96% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.def rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.def index 54e683d..ba09bc1 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc10/zlibvc.def +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.def @@ -151,3 +151,8 @@ EXPORTS deflateGetDictionary @173 adler32_z @174 crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.sln b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.sln similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.sln rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.sln diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.vcxproj similarity index 90% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.vcxproj index c65b95f..fc8cd9c 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc11/zlibvc.vcxproj @@ -204,8 +204,8 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -226,7 +226,7 @@ /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true .\zlibvc.def @@ -240,10 +240,6 @@ $(OutDir)zlibwapi.lib - - cd ..\..\masmx86 -bld_ml32.bat - @@ -255,7 +251,7 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -303,8 +299,8 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -327,7 +323,7 @@ bld_ml32.bat /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true false @@ -341,10 +337,6 @@ bld_ml32.bat $(OutDir)zlibwapi.lib - - cd ..\..\masmx86 -bld_ml32.bat - @@ -356,8 +348,8 @@ bld_ml32.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -377,7 +369,7 @@ bld_ml32.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true .\zlibvc.def @@ -389,10 +381,6 @@ bld_ml32.bat $(OutDir)zlibwapi.lib MachineX64 - - cd ..\..\contrib\masmx64 -bld_ml64.bat - @@ -404,7 +392,7 @@ bld_ml64.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) @@ -447,7 +435,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -492,7 +480,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -537,8 +525,8 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -560,7 +548,7 @@ bld_ml64.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true false @@ -572,10 +560,6 @@ bld_ml64.bat $(OutDir)zlibwapi.lib MachineX64 - - cd ..\..\masmx64 -bld_ml64.bat - @@ -587,7 +571,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -632,14 +616,6 @@ bld_ml64.bat - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/miniunz.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/miniunz.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/miniunz.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/miniunz.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/minizip.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/minizip.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/minizip.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/minizip.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/testzlib.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/testzlib.vcxproj similarity index 92% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/testzlib.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/testzlib.vcxproj index 64b2cbe..41303c0 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/testzlib.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/testzlib.vcxproj @@ -190,7 +190,7 @@ Disabled ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreadedDebugDLL @@ -203,7 +203,7 @@ ProgramDatabase - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true $(OutDir)testzlib.pdb @@ -250,7 +250,7 @@ OnlyExplicitInline true ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreaded @@ -263,7 +263,7 @@ ProgramDatabase - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true Console @@ -279,14 +279,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDebugDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -362,14 +362,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -408,14 +408,6 @@ - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/testzlibdll.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/testzlibdll.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/testzlibdll.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/testzlibdll.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlib.rc b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlib.rc similarity index 82% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlib.rc rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlib.rc index c4e4b01..cdd7985 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlib.rc +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 + FILEVERSION 1, 2, 13, 0 + PRODUCTVERSION 1, 2, 13, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" + VALUE "FileVersion", "1.2.13\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibstat.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibstat.vcxproj similarity index 91% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibstat.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibstat.vcxproj index 3fdee7c..6629d8e 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibstat.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibstat.vcxproj @@ -170,7 +170,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) @@ -196,8 +196,8 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -216,7 +216,7 @@ /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true @@ -224,7 +224,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -254,7 +254,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -283,7 +283,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -312,8 +312,8 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -332,7 +332,7 @@ /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true @@ -343,7 +343,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -373,7 +373,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -403,7 +403,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -437,14 +437,6 @@ - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.def b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.def similarity index 96% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.def rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.def index 54e683d..ba09bc1 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc11/zlibvc.def +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.def @@ -151,3 +151,8 @@ EXPORTS deflateGetDictionary @173 adler32_z @174 crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.sln b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.sln similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.sln rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.sln diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.vcxproj similarity index 92% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.vcxproj index ab2b6c3..4e0de69 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc12/zlibvc.vcxproj @@ -207,8 +207,8 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -229,7 +229,7 @@ /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true .\zlibvc.def @@ -243,10 +243,6 @@ $(OutDir)zlibwapi.lib - - cd ..\..\masmx86 -bld_ml32.bat - @@ -258,7 +254,7 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -306,8 +302,8 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -330,7 +326,7 @@ bld_ml32.bat /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true false @@ -345,10 +341,6 @@ bld_ml32.bat $(OutDir)zlibwapi.lib false - - cd ..\..\masmx86 -bld_ml32.bat - @@ -360,8 +352,8 @@ bld_ml32.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -381,7 +373,7 @@ bld_ml32.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true .\zlibvc.def @@ -393,10 +385,6 @@ bld_ml32.bat $(OutDir)zlibwapi.lib MachineX64 - - cd ..\..\contrib\masmx64 -bld_ml64.bat - @@ -408,7 +396,7 @@ bld_ml64.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) @@ -451,7 +439,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -496,7 +484,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -541,8 +529,8 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -564,7 +552,7 @@ bld_ml64.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true false @@ -576,10 +564,6 @@ bld_ml64.bat $(OutDir)zlibwapi.lib MachineX64 - - cd ..\..\masmx64 -bld_ml64.bat - @@ -591,7 +575,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -636,14 +620,6 @@ bld_ml64.bat - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/miniunz.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/miniunz.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/miniunz.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/miniunz.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/minizip.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/minizip.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/minizip.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/minizip.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/testzlib.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/testzlib.vcxproj similarity index 92% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/testzlib.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/testzlib.vcxproj index 2c37125..5452049 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/testzlib.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/testzlib.vcxproj @@ -190,7 +190,7 @@ Disabled ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreadedDebugDLL @@ -203,7 +203,7 @@ ProgramDatabase - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true $(OutDir)testzlib.pdb @@ -250,7 +250,7 @@ OnlyExplicitInline true ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true Default MultiThreaded @@ -263,7 +263,7 @@ ProgramDatabase - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)testzlib.exe true Console @@ -279,14 +279,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDebugDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -362,14 +362,14 @@ ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) Default MultiThreadedDLL false $(IntDir) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -408,14 +408,6 @@ - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/testzlibdll.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/testzlibdll.vcxproj similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/testzlibdll.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/testzlibdll.vcxproj diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlib.rc b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlib.rc similarity index 82% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlib.rc rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlib.rc index c4e4b01..cdd7985 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlib.rc +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 + FILEVERSION 1, 2, 13, 0 + PRODUCTVERSION 1, 2, 13, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" + VALUE "FileVersion", "1.2.13\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibstat.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibstat.vcxproj similarity index 91% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibstat.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibstat.vcxproj index 3e4b986..85c1e89 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibstat.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibstat.vcxproj @@ -170,7 +170,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) @@ -196,8 +196,8 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -216,7 +216,7 @@ /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true @@ -224,7 +224,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -254,7 +254,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -283,7 +283,7 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) @@ -312,8 +312,8 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -332,7 +332,7 @@ /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibstat.lib true @@ -343,7 +343,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -373,7 +373,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -403,7 +403,7 @@ OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) true @@ -437,14 +437,6 @@ - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.def b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.def similarity index 96% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.def rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.def index 54e683d..ba09bc1 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc12/zlibvc.def +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.def @@ -151,3 +151,8 @@ EXPORTS deflateGetDictionary @173 adler32_z @174 crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.sln b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.sln similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.sln rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.sln diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.vcxproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.vcxproj similarity index 92% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.vcxproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.vcxproj index f8f673c..424ff55 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc14/zlibvc.vcxproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc14/zlibvc.vcxproj @@ -207,8 +207,8 @@ Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -229,7 +229,7 @@ /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true .\zlibvc.def @@ -243,10 +243,6 @@ $(OutDir)zlibwapi.lib - - cd ..\..\masmx86 -bld_ml32.bat - @@ -258,7 +254,7 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -306,8 +302,8 @@ bld_ml32.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) true @@ -330,7 +326,7 @@ bld_ml32.bat /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true false @@ -345,10 +341,6 @@ bld_ml32.bat $(OutDir)zlibwapi.lib false - - cd ..\..\masmx86 -bld_ml32.bat - @@ -360,8 +352,8 @@ bld_ml32.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -381,7 +373,7 @@ bld_ml32.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true .\zlibvc.def @@ -393,10 +385,6 @@ bld_ml32.bat $(OutDir)zlibwapi.lib MachineX64 - - cd ..\..\contrib\masmx64 -bld_ml64.bat - @@ -408,7 +396,7 @@ bld_ml64.bat Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) @@ -451,7 +439,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -496,7 +484,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -541,8 +529,8 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -564,7 +552,7 @@ bld_ml64.bat 0x040c - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)zlibwapi.dll true false @@ -576,10 +564,6 @@ bld_ml64.bat $(OutDir)zlibwapi.lib MachineX64 - - cd ..\..\masmx64 -bld_ml64.bat - @@ -591,7 +575,7 @@ bld_ml64.bat OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ..\..\..;%(AdditionalIncludeDirectories) _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) true @@ -636,14 +620,6 @@ bld_ml64.bat - - true - true - true - true - true - true - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/miniunz.vcproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/miniunz.vcproj similarity index 95% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/miniunz.vcproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/miniunz.vcproj index 7da32b9..cc3d13a 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/miniunz.vcproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/miniunz.vcproj @@ -542,7 +542,7 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/testzlibdll.vcproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/testzlibdll.vcproj similarity index 95% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/testzlibdll.vcproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/testzlibdll.vcproj index b1ddde0..6448b49 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/testzlibdll.vcproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/testzlibdll.vcproj @@ -542,7 +542,7 @@ + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1, 2, 13, 0 + PRODUCTVERSION 1, 2, 13, 0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" + VALUE "FileVersion", "1.2.13\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibstat.vcproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibstat.vcproj similarity index 86% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibstat.vcproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibstat.vcproj index 61c76c7..1bf1563 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibstat.vcproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibstat.vcproj @@ -47,7 +47,7 @@ @@ -343,8 +342,8 @@ @@ -418,7 +416,7 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.def b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.def new file mode 100644 index 0000000..ba09bc1 --- /dev/null +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.def @@ -0,0 +1,158 @@ +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.2 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 + +; zlib1 v1.2.9 added: + inflateCodesUsed @168 + inflateValidate @169 + uncompress2 @170 + gzfread @171 + gzfwrite @172 + deflateGetDictionary @173 + adler32_z @174 + crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.sln b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.sln similarity index 100% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.sln rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.sln diff --git a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.vcproj b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.vcproj similarity index 88% rename from src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.vcproj rename to src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.vcproj index c9a8947..f11dd1f 100644 --- a/src/dependencies/zlib-1.2.11/contrib/vstudio/vc9/zlibvc.vcproj +++ b/src/dependencies/zlib-1.2.13/contrib/vstudio/vc9/zlibvc.vcproj @@ -53,8 +53,8 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/dependencies/zlib-1.2.13/crc32.c b/src/dependencies/zlib-1.2.13/crc32.c new file mode 100644 index 0000000..f8357b0 --- /dev/null +++ b/src/dependencies/zlib-1.2.13/crc32.c @@ -0,0 +1,1125 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2022 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * This interleaved implementation of a CRC makes use of pipelined multiple + * arithmetic-logic units, commonly found in modern CPU cores. It is due to + * Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution. + */ + +/* @(#) $Id$ */ + +/* + Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore + protection on the static variables used to control the first-use generation + of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should + first call get_crc_table() to initialize the tables before allowing more than + one thread to use crc32(). + + MAKECRCH can be #defined to write out crc32.h. A main() routine is also + produced, so that this one source file can be compiled to an executable. + */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for Z_U4, Z_U8, z_crc_t, and FAR definitions */ + + /* + A CRC of a message is computed on N braids of words in the message, where + each word consists of W bytes (4 or 8). If N is 3, for example, then three + running sparse CRCs are calculated respectively on each braid, at these + indices in the array of words: 0, 3, 6, ..., 1, 4, 7, ..., and 2, 5, 8, ... + This is done starting at a word boundary, and continues until as many blocks + of N * W bytes as are available have been processed. The results are combined + into a single CRC at the end. For this code, N must be in the range 1..6 and + W must be 4 or 8. The upper limit on N can be increased if desired by adding + more #if blocks, extending the patterns apparent in the code. In addition, + crc32.h would need to be regenerated, if the maximum N value is increased. + + N and W are chosen empirically by benchmarking the execution time on a given + processor. The choices for N and W below were based on testing on Intel Kaby + Lake i7, AMD Ryzen 7, ARM Cortex-A57, Sparc64-VII, PowerPC POWER9, and MIPS64 + Octeon II processors. The Intel, AMD, and ARM processors were all fastest + with N=5, W=8. The Sparc, PowerPC, and MIPS64 were all fastest at N=5, W=4. + They were all tested with either gcc or clang, all using the -O3 optimization + level. Your mileage may vary. + */ + +/* Define N */ +#ifdef Z_TESTN +# define N Z_TESTN +#else +# define N 5 +#endif +#if N < 1 || N > 6 +# error N must be in 1..6 +#endif + +/* + z_crc_t must be at least 32 bits. z_word_t must be at least as long as + z_crc_t. It is assumed here that z_word_t is either 32 bits or 64 bits, and + that bytes are eight bits. + */ + +/* + Define W and the associated z_word_t type. If W is not defined, then a + braided calculation is not used, and the associated tables and code are not + compiled. + */ +#ifdef Z_TESTW +# if Z_TESTW-1 != -1 +# define W Z_TESTW +# endif +#else +# ifdef MAKECRCH +# define W 8 /* required for MAKECRCH */ +# else +# if defined(__x86_64__) || defined(__aarch64__) +# define W 8 +# else +# define W 4 +# endif +# endif +#endif +#ifdef W +# if W == 8 && defined(Z_U8) + typedef Z_U8 z_word_t; +# elif defined(Z_U4) +# undef W +# define W 4 + typedef Z_U4 z_word_t; +# else +# undef W +# endif +#endif + +/* If available, use the ARM processor CRC32 instruction. */ +#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8 +# define ARMCRC32 +#endif + +/* Local functions. */ +local z_crc_t multmodp OF((z_crc_t a, z_crc_t b)); +local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); + +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) + local z_word_t byte_swap OF((z_word_t word)); +#endif + +#if defined(W) && !defined(ARMCRC32) + local z_crc_t crc_word OF((z_word_t data)); + local z_word_t crc_word_big OF((z_word_t data)); +#endif + +#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE)) +/* + Swap the bytes in a z_word_t to convert between little and big endian. Any + self-respecting compiler will optimize this to a single machine byte-swap + instruction, if one is available. This assumes that word_t is either 32 bits + or 64 bits. + */ +local z_word_t byte_swap(word) + z_word_t word; +{ +# if W == 8 + return + (word & 0xff00000000000000) >> 56 | + (word & 0xff000000000000) >> 40 | + (word & 0xff0000000000) >> 24 | + (word & 0xff00000000) >> 8 | + (word & 0xff000000) << 8 | + (word & 0xff0000) << 24 | + (word & 0xff00) << 40 | + (word & 0xff) << 56; +# else /* W == 4 */ + return + (word & 0xff000000) >> 24 | + (word & 0xff0000) >> 8 | + (word & 0xff00) << 8 | + (word & 0xff) << 24; +# endif +} +#endif + +/* CRC polynomial. */ +#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */ + +#ifdef DYNAMIC_CRC_TABLE + +local z_crc_t FAR crc_table[256]; +local z_crc_t FAR x2n_table[32]; +local void make_crc_table OF((void)); +#ifdef W + local z_word_t FAR crc_big_table[256]; + local z_crc_t FAR crc_braid_table[W][256]; + local z_word_t FAR crc_braid_big_table[W][256]; + local void braid OF((z_crc_t [][256], z_word_t [][256], int, int)); +#endif +#ifdef MAKECRCH + local void write_table OF((FILE *, const z_crc_t FAR *, int)); + local void write_table32hi OF((FILE *, const z_word_t FAR *, int)); + local void write_table64 OF((FILE *, const z_word_t FAR *, int)); +#endif /* MAKECRCH */ + +/* + Define a once() function depending on the availability of atomics. If this is + compiled with DYNAMIC_CRC_TABLE defined, and if CRCs will be computed in + multiple threads, and if atomics are not available, then get_crc_table() must + be called to initialize the tables and must return before any threads are + allowed to compute or combine CRCs. + */ + +/* Definition of once functionality. */ +typedef struct once_s once_t; +local void once OF((once_t *, void (*)(void))); + +/* Check for the availability of atomics. */ +#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \ + !defined(__STDC_NO_ATOMICS__) + +#include + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + atomic_flag begun; + atomic_int done; +}; +#define ONCE_INIT {ATOMIC_FLAG_INIT, 0} + +/* + Run the provided init() function exactly once, even if multiple threads + invoke once() at the same time. The state must be a once_t initialized with + ONCE_INIT. + */ +local void once(state, init) + once_t *state; + void (*init)(void); +{ + if (!atomic_load(&state->done)) { + if (atomic_flag_test_and_set(&state->begun)) + while (!atomic_load(&state->done)) + ; + else { + init(); + atomic_store(&state->done, 1); + } + } +} + +#else /* no atomics */ + +/* Structure for once(), which must be initialized with ONCE_INIT. */ +struct once_s { + volatile int begun; + volatile int done; +}; +#define ONCE_INIT {0, 0} + +/* Test and set. Alas, not atomic, but tries to minimize the period of + vulnerability. */ +local int test_and_set OF((int volatile *)); +local int test_and_set(flag) + int volatile *flag; +{ + int was; + + was = *flag; + *flag = 1; + return was; +} + +/* Run the provided init() function once. This is not thread-safe. */ +local void once(state, init) + once_t *state; + void (*init)(void); +{ + if (!state->done) { + if (test_and_set(&state->begun)) + while (!state->done) + ; + else { + init(); + state->done = 1; + } + } +} + +#endif + +/* State for once(). */ +local once_t made = ONCE_INIT; + +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x^2+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x + (which is shifting right by one and adding x^32 mod p if the bit shifted out + is a one). We start with the highest power (least significant bit) of q and + repeat for all eight bits of q. + + The table is simply the CRC of all possible eight bit values. This is all the + information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. + */ + +local void make_crc_table() +{ + unsigned i, j, n; + z_crc_t p; + + /* initialize the CRC of bytes tables */ + for (i = 0; i < 256; i++) { + p = i; + for (j = 0; j < 8; j++) + p = p & 1 ? (p >> 1) ^ POLY : p >> 1; + crc_table[i] = p; +#ifdef W + crc_big_table[i] = byte_swap(p); +#endif + } + + /* initialize the x^2^n mod p(x) table */ + p = (z_crc_t)1 << 30; /* x^1 */ + x2n_table[0] = p; + for (n = 1; n < 32; n++) + x2n_table[n] = p = multmodp(p, p); + +#ifdef W + /* initialize the braiding tables -- needs x2n_table[] */ + braid(crc_braid_table, crc_braid_big_table, N, W); +#endif + +#ifdef MAKECRCH + { + /* + The crc32.h header file contains tables for both 32-bit and 64-bit + z_word_t's, and so requires a 64-bit type be available. In that case, + z_word_t must be defined to be 64-bits. This code then also generates + and writes out the tables for the case that z_word_t is 32 bits. + */ +#if !defined(W) || W != 8 +# error Need a 64-bit integer type in order to generate crc32.h. +#endif + FILE *out; + int k, n; + z_crc_t ltl[8][256]; + z_word_t big[8][256]; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + + /* write out little-endian CRC table to crc32.h */ + fprintf(out, + "/* crc32.h -- tables for rapid CRC calculation\n" + " * Generated automatically by crc32.c\n */\n" + "\n" + "local const z_crc_t FAR crc_table[] = {\n" + " "); + write_table(out, crc_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#ifdef W\n" + "\n" + "#if W == 8\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table64(out, crc_big_table, 256); + fprintf(out, + "};\n"); + + /* write out big-endian CRC table for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_word_t FAR crc_big_table[] = {\n" + " "); + write_table32hi(out, crc_big_table, 256); + fprintf(out, + "};\n" + "\n" + "#endif\n"); + + /* write out braid tables for each value of N */ + for (n = 1; n <= 6; n++) { + fprintf(out, + "\n" + "#if N == %d\n", n); + + /* compute braid tables for this N and 64-bit word_t */ + braid(ltl, big, n, 8); + + /* write out braid tables for 64-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#if W == 8\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 8; k++) { + fprintf(out, " {"); + write_table64(out, big[k], 256); + fprintf(out, "}%s", k < 7 ? ",\n" : ""); + } + fprintf(out, + "};\n"); + + /* compute braid tables for this N and 32-bit word_t */ + braid(ltl, big, n, 4); + + /* write out braid tables for 32-bit z_word_t to crc32.h */ + fprintf(out, + "\n" + "#else /* W == 4 */\n" + "\n" + "local const z_crc_t FAR crc_braid_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table(out, ltl[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "local const z_word_t FAR crc_braid_big_table[][256] = {\n"); + for (k = 0; k < 4; k++) { + fprintf(out, " {"); + write_table32hi(out, big[k], 256); + fprintf(out, "}%s", k < 3 ? ",\n" : ""); + } + fprintf(out, + "};\n" + "\n" + "#endif\n" + "\n" + "#endif\n"); + } + fprintf(out, + "\n" + "#endif\n"); + + /* write out zeros operator table to crc32.h */ + fprintf(out, + "\n" + "local const z_crc_t FAR x2n_table[] = {\n" + " "); + write_table(out, x2n_table, 32); + fprintf(out, + "};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH + +/* + Write the 32-bit values in table[0..k-1] to out, five per line in + hexadecimal separated by commas. + */ +local void write_table(out, table, k) + FILE *out; + const z_crc_t FAR *table; + int k; +{ + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", + (unsigned long)(table[n]), + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the high 32-bits of each value in table[0..k-1] to out, five per line + in hexadecimal separated by commas. + */ +local void write_table32hi(out, table, k) +FILE *out; +const z_word_t FAR *table; +int k; +{ + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%08lx%s", n == 0 || n % 5 ? "" : " ", + (unsigned long)(table[n] >> 32), + n == k - 1 ? "" : (n % 5 == 4 ? ",\n" : ", ")); +} + +/* + Write the 64-bit values in table[0..k-1] to out, three per line in + hexadecimal separated by commas. This assumes that if there is a 64-bit + type, then there is also a long long integer type, and it is at least 64 + bits. If not, then the type cast and format string can be adjusted + accordingly. + */ +local void write_table64(out, table, k) + FILE *out; + const z_word_t FAR *table; + int k; +{ + int n; + + for (n = 0; n < k; n++) + fprintf(out, "%s0x%016llx%s", n == 0 || n % 3 ? "" : " ", + (unsigned long long)(table[n]), + n == k - 1 ? "" : (n % 3 == 2 ? ",\n" : ", ")); +} + +/* Actually do the deed. */ +int main() +{ + make_crc_table(); + return 0; +} + +#endif /* MAKECRCH */ + +#ifdef W +/* + Generate the little and big-endian braid tables for the given n and z_word_t + size w. Each array must have room for w blocks of 256 elements. + */ +local void braid(ltl, big, n, w) + z_crc_t ltl[][256]; + z_word_t big[][256]; + int n; + int w; +{ + int k; + z_crc_t i, p, q; + for (k = 0; k < w; k++) { + p = x2nmodp((n * w + 3 - k) << 3, 0); + ltl[k][0] = 0; + big[w - 1 - k][0] = 0; + for (i = 1; i < 256; i++) { + ltl[k][i] = q = multmodp(i << 24, p); + big[w - 1 - k][i] = byte_swap(q); + } + } +} +#endif + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables for byte-wise and braided CRC-32 calculations, and a table of powers + * of x for combining CRC-32s, all made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ======================================================================== + * Routines used for CRC calculation. Some are also required for the table + * generation above. + */ + +/* + Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, + reflected. For speed, this requires that a not be zero. + */ +local z_crc_t multmodp(a, b) + z_crc_t a; + z_crc_t b; +{ + z_crc_t m, p; + + m = (z_crc_t)1 << 31; + p = 0; + for (;;) { + if (a & m) { + p ^= b; + if ((a & (m - 1)) == 0) + break; + } + m >>= 1; + b = b & 1 ? (b >> 1) ^ POLY : b >> 1; + } + return p; +} + +/* + Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been + initialized. + */ +local z_crc_t x2nmodp(n, k) + z_off64_t n; + unsigned k; +{ + z_crc_t p; + + p = (z_crc_t)1 << 31; /* x^0 == 1 */ + while (n) { + if (n & 1) + p = multmodp(x2n_table[k & 31], p); + n >>= 1; + k++; + } + return p; +} + +/* ========================================================================= + * This function can be used by asm versions of crc32(), and to force the + * generation of the CRC tables in a threaded application. + */ +const z_crc_t FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return (const z_crc_t FAR *)crc_table; +} + +/* ========================================================================= + * Use ARM machine instructions if available. This will compute the CRC about + * ten times faster than the braided calculation. This code does not check for + * the presence of the CRC instruction at run time. __ARM_FEATURE_CRC32 will + * only be defined if the compilation specifies an ARM processor architecture + * that has the instructions. For example, compiling with -march=armv8.1-a or + * -march=armv8-a+crc, or -march=native if the compile machine has the crc32 + * instructions. + */ +#ifdef ARMCRC32 + +/* + Constants empirically determined to maximize speed. These values are from + measurements on a Cortex-A57. Your mileage may vary. + */ +#define Z_BATCH 3990 /* number of words in a batch */ +#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */ +#define Z_BATCH_MIN 800 /* fewest words in a final batch */ + +unsigned long ZEXPORT crc32_z(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + z_size_t len; +{ + z_crc_t val; + z_word_t crc1, crc2; + const z_word_t *word; + z_word_t val0, val1, val2; + z_size_t last, last2, i; + z_size_t num; + + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; + +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; + + /* Compute the CRC up to a word boundary. */ + while (len && ((z_size_t)buf & 7) != 0) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); + } + + /* Prepare to compute the CRC on full 64-bit words word[0..num-1]. */ + word = (z_word_t const *)buf; + num = len >> 3; + len &= 7; + + /* Do three interleaved CRCs to realize the throughput of one crc32x + instruction per cycle. Each CRC is calculated on Z_BATCH words. The + three CRCs are combined into a single CRC after each set of batches. */ + while (num >= 3 * Z_BATCH) { + crc1 = 0; + crc2 = 0; + for (i = 0; i < Z_BATCH; i++) { + val0 = word[i]; + val1 = word[i + Z_BATCH]; + val2 = word[i + 2 * Z_BATCH]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * Z_BATCH; + num -= 3 * Z_BATCH; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc1; + crc = multmodp(Z_BATCH_ZEROS, crc) ^ crc2; + } + + /* Do one last smaller batch with the remaining words, if there are enough + to pay for the combination of CRCs. */ + last = num / 3; + if (last >= Z_BATCH_MIN) { + last2 = last << 1; + crc1 = 0; + crc2 = 0; + for (i = 0; i < last; i++) { + val0 = word[i]; + val1 = word[i + last]; + val2 = word[i + last2]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc1) : "r"(val1)); + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc2) : "r"(val2)); + } + word += 3 * last; + num -= 3 * last; + val = x2nmodp(last, 6); + crc = multmodp(val, crc) ^ crc1; + crc = multmodp(val, crc) ^ crc2; + } + + /* Compute the CRC on any remaining words. */ + for (i = 0; i < num; i++) { + val0 = word[i]; + __asm__ volatile("crc32x %w0, %w0, %x1" : "+r"(crc) : "r"(val0)); + } + word += num; + + /* Complete the CRC on any remaining bytes. */ + buf = (const unsigned char FAR *)word; + while (len) { + len--; + val = *buf++; + __asm__ volatile("crc32b %w0, %w0, %w1" : "+r"(crc) : "r"(val)); + } + + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; +} + +#else + +#ifdef W + +/* + Return the CRC of the W bytes in the word_t data, taking the + least-significant byte of the word as the first byte of data, without any pre + or post conditioning. This is used to combine the CRCs of each braid. + */ +local z_crc_t crc_word(data) + z_word_t data; +{ + int k; + for (k = 0; k < W; k++) + data = (data >> 8) ^ crc_table[data & 0xff]; + return (z_crc_t)data; +} + +local z_word_t crc_word_big(data) + z_word_t data; +{ + int k; + for (k = 0; k < W; k++) + data = (data << 8) ^ + crc_big_table[(data >> ((W - 1) << 3)) & 0xff]; + return data; +} + +#endif + +/* ========================================================================= */ +unsigned long ZEXPORT crc32_z(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + z_size_t len; +{ + /* Return initial CRC, if requested. */ + if (buf == Z_NULL) return 0; + +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + + /* Pre-condition the CRC */ + crc = (~crc) & 0xffffffff; + +#ifdef W + + /* If provided enough bytes, do a braided CRC calculation. */ + if (len >= N * W + W - 1) { + z_size_t blks; + z_word_t const *words; + unsigned endian; + int k; + + /* Compute the CRC up to a z_word_t boundary. */ + while (len && ((z_size_t)buf & (W - 1)) != 0) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + + /* Compute the CRC on as many N z_word_t blocks as are available. */ + blks = len / (N * W); + len -= blks * N * W; + words = (z_word_t const *)buf; + + /* Do endian check at execution time instead of compile time, since ARM + processors can change the endianess at execution time. If the + compiler knows what the endianess will be, it can optimize out the + check and the unused branch. */ + endian = 1; + if (*(unsigned char *)&endian) { + /* Little endian. */ + + z_crc_t crc0; + z_word_t word0; +#if N > 1 + z_crc_t crc1; + z_word_t word1; +#if N > 2 + z_crc_t crc2; + z_word_t word2; +#if N > 3 + z_crc_t crc3; + z_word_t word3; +#if N > 4 + z_crc_t crc4; + z_word_t word4; +#if N > 5 + z_crc_t crc5; + z_word_t word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = crc; +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + crc = crc_word(crc0 ^ words[0]); +#if N > 1 + crc = crc_word(crc1 ^ words[1] ^ crc); +#if N > 2 + crc = crc_word(crc2 ^ words[2] ^ crc); +#if N > 3 + crc = crc_word(crc3 ^ words[3] ^ crc); +#if N > 4 + crc = crc_word(crc4 ^ words[4] ^ crc); +#if N > 5 + crc = crc_word(crc5 ^ words[5] ^ crc); +#endif +#endif +#endif +#endif +#endif + words += N; + } + else { + /* Big endian. */ + + z_word_t crc0, word0, comb; +#if N > 1 + z_word_t crc1, word1; +#if N > 2 + z_word_t crc2, word2; +#if N > 3 + z_word_t crc3, word3; +#if N > 4 + z_word_t crc4, word4; +#if N > 5 + z_word_t crc5, word5; +#endif +#endif +#endif +#endif +#endif + + /* Initialize the CRC for each braid. */ + crc0 = byte_swap(crc); +#if N > 1 + crc1 = 0; +#if N > 2 + crc2 = 0; +#if N > 3 + crc3 = 0; +#if N > 4 + crc4 = 0; +#if N > 5 + crc5 = 0; +#endif +#endif +#endif +#endif +#endif + + /* + Process the first blks-1 blocks, computing the CRCs on each braid + independently. + */ + while (--blks) { + /* Load the word for each braid into registers. */ + word0 = crc0 ^ words[0]; +#if N > 1 + word1 = crc1 ^ words[1]; +#if N > 2 + word2 = crc2 ^ words[2]; +#if N > 3 + word3 = crc3 ^ words[3]; +#if N > 4 + word4 = crc4 ^ words[4]; +#if N > 5 + word5 = crc5 ^ words[5]; +#endif +#endif +#endif +#endif +#endif + words += N; + + /* Compute and update the CRC for each word. The loop should + get unrolled. */ + crc0 = crc_braid_big_table[0][word0 & 0xff]; +#if N > 1 + crc1 = crc_braid_big_table[0][word1 & 0xff]; +#if N > 2 + crc2 = crc_braid_big_table[0][word2 & 0xff]; +#if N > 3 + crc3 = crc_braid_big_table[0][word3 & 0xff]; +#if N > 4 + crc4 = crc_braid_big_table[0][word4 & 0xff]; +#if N > 5 + crc5 = crc_braid_big_table[0][word5 & 0xff]; +#endif +#endif +#endif +#endif +#endif + for (k = 1; k < W; k++) { + crc0 ^= crc_braid_big_table[k][(word0 >> (k << 3)) & 0xff]; +#if N > 1 + crc1 ^= crc_braid_big_table[k][(word1 >> (k << 3)) & 0xff]; +#if N > 2 + crc2 ^= crc_braid_big_table[k][(word2 >> (k << 3)) & 0xff]; +#if N > 3 + crc3 ^= crc_braid_big_table[k][(word3 >> (k << 3)) & 0xff]; +#if N > 4 + crc4 ^= crc_braid_big_table[k][(word4 >> (k << 3)) & 0xff]; +#if N > 5 + crc5 ^= crc_braid_big_table[k][(word5 >> (k << 3)) & 0xff]; +#endif +#endif +#endif +#endif +#endif + } + } + + /* + Process the last block, combining the CRCs of the N braids at the + same time. + */ + comb = crc_word_big(crc0 ^ words[0]); +#if N > 1 + comb = crc_word_big(crc1 ^ words[1] ^ comb); +#if N > 2 + comb = crc_word_big(crc2 ^ words[2] ^ comb); +#if N > 3 + comb = crc_word_big(crc3 ^ words[3] ^ comb); +#if N > 4 + comb = crc_word_big(crc4 ^ words[4] ^ comb); +#if N > 5 + comb = crc_word_big(crc5 ^ words[5] ^ comb); +#endif +#endif +#endif +#endif +#endif + words += N; + crc = byte_swap(comb); + } + + /* + Update the pointer to the remaining bytes to process. + */ + buf = (unsigned char const *)words; + } + +#endif /* W */ + + /* Complete the computation of the CRC on any remaining bytes. */ + while (len >= 8) { + len -= 8; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + while (len) { + len--; + crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff]; + } + + /* Return the CRC, post-conditioned. */ + return crc ^ 0xffffffff; +} + +#endif + +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + return crc32_z(crc, buf, len); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine64(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off64_t len2; +{ +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine(crc1, crc2, len2) + uLong crc1; + uLong crc2; + z_off_t len2; +{ + return crc32_combine64(crc1, crc2, (z_off64_t)len2); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_gen64(len2) + z_off64_t len2; +{ +#ifdef DYNAMIC_CRC_TABLE + once(&made, make_crc_table); +#endif /* DYNAMIC_CRC_TABLE */ + return x2nmodp(len2, 3); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_gen(len2) + z_off_t len2; +{ + return crc32_combine_gen64((z_off64_t)len2); +} + +/* ========================================================================= */ +uLong ZEXPORT crc32_combine_op(crc1, crc2, op) + uLong crc1; + uLong crc2; + uLong op; +{ + return multmodp(op, crc1) ^ (crc2 & 0xffffffff); +} diff --git a/src/dependencies/zlib-1.2.13/crc32.h b/src/dependencies/zlib-1.2.13/crc32.h new file mode 100644 index 0000000..137df68 --- /dev/null +++ b/src/dependencies/zlib-1.2.13/crc32.h @@ -0,0 +1,9446 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const z_crc_t FAR crc_table[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}; + +#ifdef W + +#if W == 8 + +local const z_word_t FAR crc_big_table[] = { + 0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}; + +#else /* W == 4 */ + +local const z_word_t FAR crc_big_table[] = { + 0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}; + +#endif + +#if N == 1 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}, + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x9630077700000000, 0x2c610eee00000000, + 0xba51099900000000, 0x19c46d0700000000, 0x8ff46a7000000000, + 0x35a563e900000000, 0xa395649e00000000, 0x3288db0e00000000, + 0xa4b8dc7900000000, 0x1ee9d5e000000000, 0x88d9d29700000000, + 0x2b4cb60900000000, 0xbd7cb17e00000000, 0x072db8e700000000, + 0x911dbf9000000000, 0x6410b71d00000000, 0xf220b06a00000000, + 0x4871b9f300000000, 0xde41be8400000000, 0x7dd4da1a00000000, + 0xebe4dd6d00000000, 0x51b5d4f400000000, 0xc785d38300000000, + 0x56986c1300000000, 0xc0a86b6400000000, 0x7af962fd00000000, + 0xecc9658a00000000, 0x4f5c011400000000, 0xd96c066300000000, + 0x633d0ffa00000000, 0xf50d088d00000000, 0xc8206e3b00000000, + 0x5e10694c00000000, 0xe44160d500000000, 0x727167a200000000, + 0xd1e4033c00000000, 0x47d4044b00000000, 0xfd850dd200000000, + 0x6bb50aa500000000, 0xfaa8b53500000000, 0x6c98b24200000000, + 0xd6c9bbdb00000000, 0x40f9bcac00000000, 0xe36cd83200000000, + 0x755cdf4500000000, 0xcf0dd6dc00000000, 0x593dd1ab00000000, + 0xac30d92600000000, 0x3a00de5100000000, 0x8051d7c800000000, + 0x1661d0bf00000000, 0xb5f4b42100000000, 0x23c4b35600000000, + 0x9995bacf00000000, 0x0fa5bdb800000000, 0x9eb8022800000000, + 0x0888055f00000000, 0xb2d90cc600000000, 0x24e90bb100000000, + 0x877c6f2f00000000, 0x114c685800000000, 0xab1d61c100000000, + 0x3d2d66b600000000, 0x9041dc7600000000, 0x0671db0100000000, + 0xbc20d29800000000, 0x2a10d5ef00000000, 0x8985b17100000000, + 0x1fb5b60600000000, 0xa5e4bf9f00000000, 0x33d4b8e800000000, + 0xa2c9077800000000, 0x34f9000f00000000, 0x8ea8099600000000, + 0x18980ee100000000, 0xbb0d6a7f00000000, 0x2d3d6d0800000000, + 0x976c649100000000, 0x015c63e600000000, 0xf4516b6b00000000, + 0x62616c1c00000000, 0xd830658500000000, 0x4e0062f200000000, + 0xed95066c00000000, 0x7ba5011b00000000, 0xc1f4088200000000, + 0x57c40ff500000000, 0xc6d9b06500000000, 0x50e9b71200000000, + 0xeab8be8b00000000, 0x7c88b9fc00000000, 0xdf1ddd6200000000, + 0x492dda1500000000, 0xf37cd38c00000000, 0x654cd4fb00000000, + 0x5861b24d00000000, 0xce51b53a00000000, 0x7400bca300000000, + 0xe230bbd400000000, 0x41a5df4a00000000, 0xd795d83d00000000, + 0x6dc4d1a400000000, 0xfbf4d6d300000000, 0x6ae9694300000000, + 0xfcd96e3400000000, 0x468867ad00000000, 0xd0b860da00000000, + 0x732d044400000000, 0xe51d033300000000, 0x5f4c0aaa00000000, + 0xc97c0ddd00000000, 0x3c71055000000000, 0xaa41022700000000, + 0x10100bbe00000000, 0x86200cc900000000, 0x25b5685700000000, + 0xb3856f2000000000, 0x09d466b900000000, 0x9fe461ce00000000, + 0x0ef9de5e00000000, 0x98c9d92900000000, 0x2298d0b000000000, + 0xb4a8d7c700000000, 0x173db35900000000, 0x810db42e00000000, + 0x3b5cbdb700000000, 0xad6cbac000000000, 0x2083b8ed00000000, + 0xb6b3bf9a00000000, 0x0ce2b60300000000, 0x9ad2b17400000000, + 0x3947d5ea00000000, 0xaf77d29d00000000, 0x1526db0400000000, + 0x8316dc7300000000, 0x120b63e300000000, 0x843b649400000000, + 0x3e6a6d0d00000000, 0xa85a6a7a00000000, 0x0bcf0ee400000000, + 0x9dff099300000000, 0x27ae000a00000000, 0xb19e077d00000000, + 0x44930ff000000000, 0xd2a3088700000000, 0x68f2011e00000000, + 0xfec2066900000000, 0x5d5762f700000000, 0xcb67658000000000, + 0x71366c1900000000, 0xe7066b6e00000000, 0x761bd4fe00000000, + 0xe02bd38900000000, 0x5a7ada1000000000, 0xcc4add6700000000, + 0x6fdfb9f900000000, 0xf9efbe8e00000000, 0x43beb71700000000, + 0xd58eb06000000000, 0xe8a3d6d600000000, 0x7e93d1a100000000, + 0xc4c2d83800000000, 0x52f2df4f00000000, 0xf167bbd100000000, + 0x6757bca600000000, 0xdd06b53f00000000, 0x4b36b24800000000, + 0xda2b0dd800000000, 0x4c1b0aaf00000000, 0xf64a033600000000, + 0x607a044100000000, 0xc3ef60df00000000, 0x55df67a800000000, + 0xef8e6e3100000000, 0x79be694600000000, 0x8cb361cb00000000, + 0x1a8366bc00000000, 0xa0d26f2500000000, 0x36e2685200000000, + 0x95770ccc00000000, 0x03470bbb00000000, 0xb916022200000000, + 0x2f26055500000000, 0xbe3bbac500000000, 0x280bbdb200000000, + 0x925ab42b00000000, 0x046ab35c00000000, 0xa7ffd7c200000000, + 0x31cfd0b500000000, 0x8b9ed92c00000000, 0x1daede5b00000000, + 0xb0c2649b00000000, 0x26f263ec00000000, 0x9ca36a7500000000, + 0x0a936d0200000000, 0xa906099c00000000, 0x3f360eeb00000000, + 0x8567077200000000, 0x1357000500000000, 0x824abf9500000000, + 0x147ab8e200000000, 0xae2bb17b00000000, 0x381bb60c00000000, + 0x9b8ed29200000000, 0x0dbed5e500000000, 0xb7efdc7c00000000, + 0x21dfdb0b00000000, 0xd4d2d38600000000, 0x42e2d4f100000000, + 0xf8b3dd6800000000, 0x6e83da1f00000000, 0xcd16be8100000000, + 0x5b26b9f600000000, 0xe177b06f00000000, 0x7747b71800000000, + 0xe65a088800000000, 0x706a0fff00000000, 0xca3b066600000000, + 0x5c0b011100000000, 0xff9e658f00000000, 0x69ae62f800000000, + 0xd3ff6b6100000000, 0x45cf6c1600000000, 0x78e20aa000000000, + 0xeed20dd700000000, 0x5483044e00000000, 0xc2b3033900000000, + 0x612667a700000000, 0xf71660d000000000, 0x4d47694900000000, + 0xdb776e3e00000000, 0x4a6ad1ae00000000, 0xdc5ad6d900000000, + 0x660bdf4000000000, 0xf03bd83700000000, 0x53aebca900000000, + 0xc59ebbde00000000, 0x7fcfb24700000000, 0xe9ffb53000000000, + 0x1cf2bdbd00000000, 0x8ac2baca00000000, 0x3093b35300000000, + 0xa6a3b42400000000, 0x0536d0ba00000000, 0x9306d7cd00000000, + 0x2957de5400000000, 0xbf67d92300000000, 0x2e7a66b300000000, + 0xb84a61c400000000, 0x021b685d00000000, 0x942b6f2a00000000, + 0x37be0bb400000000, 0xa18e0cc300000000, 0x1bdf055a00000000, + 0x8def022d00000000}, + {0x0000000000000000, 0x41311b1900000000, 0x8262363200000000, + 0xc3532d2b00000000, 0x04c56c6400000000, 0x45f4777d00000000, + 0x86a75a5600000000, 0xc796414f00000000, 0x088ad9c800000000, + 0x49bbc2d100000000, 0x8ae8effa00000000, 0xcbd9f4e300000000, + 0x0c4fb5ac00000000, 0x4d7eaeb500000000, 0x8e2d839e00000000, + 0xcf1c988700000000, 0x5112c24a00000000, 0x1023d95300000000, + 0xd370f47800000000, 0x9241ef6100000000, 0x55d7ae2e00000000, + 0x14e6b53700000000, 0xd7b5981c00000000, 0x9684830500000000, + 0x59981b8200000000, 0x18a9009b00000000, 0xdbfa2db000000000, + 0x9acb36a900000000, 0x5d5d77e600000000, 0x1c6c6cff00000000, + 0xdf3f41d400000000, 0x9e0e5acd00000000, 0xa224849500000000, + 0xe3159f8c00000000, 0x2046b2a700000000, 0x6177a9be00000000, + 0xa6e1e8f100000000, 0xe7d0f3e800000000, 0x2483dec300000000, + 0x65b2c5da00000000, 0xaaae5d5d00000000, 0xeb9f464400000000, + 0x28cc6b6f00000000, 0x69fd707600000000, 0xae6b313900000000, + 0xef5a2a2000000000, 0x2c09070b00000000, 0x6d381c1200000000, + 0xf33646df00000000, 0xb2075dc600000000, 0x715470ed00000000, + 0x30656bf400000000, 0xf7f32abb00000000, 0xb6c231a200000000, + 0x75911c8900000000, 0x34a0079000000000, 0xfbbc9f1700000000, + 0xba8d840e00000000, 0x79dea92500000000, 0x38efb23c00000000, + 0xff79f37300000000, 0xbe48e86a00000000, 0x7d1bc54100000000, + 0x3c2ade5800000000, 0x054f79f000000000, 0x447e62e900000000, + 0x872d4fc200000000, 0xc61c54db00000000, 0x018a159400000000, + 0x40bb0e8d00000000, 0x83e823a600000000, 0xc2d938bf00000000, + 0x0dc5a03800000000, 0x4cf4bb2100000000, 0x8fa7960a00000000, + 0xce968d1300000000, 0x0900cc5c00000000, 0x4831d74500000000, + 0x8b62fa6e00000000, 0xca53e17700000000, 0x545dbbba00000000, + 0x156ca0a300000000, 0xd63f8d8800000000, 0x970e969100000000, + 0x5098d7de00000000, 0x11a9ccc700000000, 0xd2fae1ec00000000, + 0x93cbfaf500000000, 0x5cd7627200000000, 0x1de6796b00000000, + 0xdeb5544000000000, 0x9f844f5900000000, 0x58120e1600000000, + 0x1923150f00000000, 0xda70382400000000, 0x9b41233d00000000, + 0xa76bfd6500000000, 0xe65ae67c00000000, 0x2509cb5700000000, + 0x6438d04e00000000, 0xa3ae910100000000, 0xe29f8a1800000000, + 0x21cca73300000000, 0x60fdbc2a00000000, 0xafe124ad00000000, + 0xeed03fb400000000, 0x2d83129f00000000, 0x6cb2098600000000, + 0xab2448c900000000, 0xea1553d000000000, 0x29467efb00000000, + 0x687765e200000000, 0xf6793f2f00000000, 0xb748243600000000, + 0x741b091d00000000, 0x352a120400000000, 0xf2bc534b00000000, + 0xb38d485200000000, 0x70de657900000000, 0x31ef7e6000000000, + 0xfef3e6e700000000, 0xbfc2fdfe00000000, 0x7c91d0d500000000, + 0x3da0cbcc00000000, 0xfa368a8300000000, 0xbb07919a00000000, + 0x7854bcb100000000, 0x3965a7a800000000, 0x4b98833b00000000, + 0x0aa9982200000000, 0xc9fab50900000000, 0x88cbae1000000000, + 0x4f5def5f00000000, 0x0e6cf44600000000, 0xcd3fd96d00000000, + 0x8c0ec27400000000, 0x43125af300000000, 0x022341ea00000000, + 0xc1706cc100000000, 0x804177d800000000, 0x47d7369700000000, + 0x06e62d8e00000000, 0xc5b500a500000000, 0x84841bbc00000000, + 0x1a8a417100000000, 0x5bbb5a6800000000, 0x98e8774300000000, + 0xd9d96c5a00000000, 0x1e4f2d1500000000, 0x5f7e360c00000000, + 0x9c2d1b2700000000, 0xdd1c003e00000000, 0x120098b900000000, + 0x533183a000000000, 0x9062ae8b00000000, 0xd153b59200000000, + 0x16c5f4dd00000000, 0x57f4efc400000000, 0x94a7c2ef00000000, + 0xd596d9f600000000, 0xe9bc07ae00000000, 0xa88d1cb700000000, + 0x6bde319c00000000, 0x2aef2a8500000000, 0xed796bca00000000, + 0xac4870d300000000, 0x6f1b5df800000000, 0x2e2a46e100000000, + 0xe136de6600000000, 0xa007c57f00000000, 0x6354e85400000000, + 0x2265f34d00000000, 0xe5f3b20200000000, 0xa4c2a91b00000000, + 0x6791843000000000, 0x26a09f2900000000, 0xb8aec5e400000000, + 0xf99fdefd00000000, 0x3accf3d600000000, 0x7bfde8cf00000000, + 0xbc6ba98000000000, 0xfd5ab29900000000, 0x3e099fb200000000, + 0x7f3884ab00000000, 0xb0241c2c00000000, 0xf115073500000000, + 0x32462a1e00000000, 0x7377310700000000, 0xb4e1704800000000, + 0xf5d06b5100000000, 0x3683467a00000000, 0x77b25d6300000000, + 0x4ed7facb00000000, 0x0fe6e1d200000000, 0xccb5ccf900000000, + 0x8d84d7e000000000, 0x4a1296af00000000, 0x0b238db600000000, + 0xc870a09d00000000, 0x8941bb8400000000, 0x465d230300000000, + 0x076c381a00000000, 0xc43f153100000000, 0x850e0e2800000000, + 0x42984f6700000000, 0x03a9547e00000000, 0xc0fa795500000000, + 0x81cb624c00000000, 0x1fc5388100000000, 0x5ef4239800000000, + 0x9da70eb300000000, 0xdc9615aa00000000, 0x1b0054e500000000, + 0x5a314ffc00000000, 0x996262d700000000, 0xd85379ce00000000, + 0x174fe14900000000, 0x567efa5000000000, 0x952dd77b00000000, + 0xd41ccc6200000000, 0x138a8d2d00000000, 0x52bb963400000000, + 0x91e8bb1f00000000, 0xd0d9a00600000000, 0xecf37e5e00000000, + 0xadc2654700000000, 0x6e91486c00000000, 0x2fa0537500000000, + 0xe836123a00000000, 0xa907092300000000, 0x6a54240800000000, + 0x2b653f1100000000, 0xe479a79600000000, 0xa548bc8f00000000, + 0x661b91a400000000, 0x272a8abd00000000, 0xe0bccbf200000000, + 0xa18dd0eb00000000, 0x62defdc000000000, 0x23efe6d900000000, + 0xbde1bc1400000000, 0xfcd0a70d00000000, 0x3f838a2600000000, + 0x7eb2913f00000000, 0xb924d07000000000, 0xf815cb6900000000, + 0x3b46e64200000000, 0x7a77fd5b00000000, 0xb56b65dc00000000, + 0xf45a7ec500000000, 0x370953ee00000000, 0x763848f700000000, + 0xb1ae09b800000000, 0xf09f12a100000000, 0x33cc3f8a00000000, + 0x72fd249300000000}, + {0x0000000000000000, 0x376ac20100000000, 0x6ed4840300000000, + 0x59be460200000000, 0xdca8090700000000, 0xebc2cb0600000000, + 0xb27c8d0400000000, 0x85164f0500000000, 0xb851130e00000000, + 0x8f3bd10f00000000, 0xd685970d00000000, 0xe1ef550c00000000, + 0x64f91a0900000000, 0x5393d80800000000, 0x0a2d9e0a00000000, + 0x3d475c0b00000000, 0x70a3261c00000000, 0x47c9e41d00000000, + 0x1e77a21f00000000, 0x291d601e00000000, 0xac0b2f1b00000000, + 0x9b61ed1a00000000, 0xc2dfab1800000000, 0xf5b5691900000000, + 0xc8f2351200000000, 0xff98f71300000000, 0xa626b11100000000, + 0x914c731000000000, 0x145a3c1500000000, 0x2330fe1400000000, + 0x7a8eb81600000000, 0x4de47a1700000000, 0xe0464d3800000000, + 0xd72c8f3900000000, 0x8e92c93b00000000, 0xb9f80b3a00000000, + 0x3cee443f00000000, 0x0b84863e00000000, 0x523ac03c00000000, + 0x6550023d00000000, 0x58175e3600000000, 0x6f7d9c3700000000, + 0x36c3da3500000000, 0x01a9183400000000, 0x84bf573100000000, + 0xb3d5953000000000, 0xea6bd33200000000, 0xdd01113300000000, + 0x90e56b2400000000, 0xa78fa92500000000, 0xfe31ef2700000000, + 0xc95b2d2600000000, 0x4c4d622300000000, 0x7b27a02200000000, + 0x2299e62000000000, 0x15f3242100000000, 0x28b4782a00000000, + 0x1fdeba2b00000000, 0x4660fc2900000000, 0x710a3e2800000000, + 0xf41c712d00000000, 0xc376b32c00000000, 0x9ac8f52e00000000, + 0xada2372f00000000, 0xc08d9a7000000000, 0xf7e7587100000000, + 0xae591e7300000000, 0x9933dc7200000000, 0x1c25937700000000, + 0x2b4f517600000000, 0x72f1177400000000, 0x459bd57500000000, + 0x78dc897e00000000, 0x4fb64b7f00000000, 0x16080d7d00000000, + 0x2162cf7c00000000, 0xa474807900000000, 0x931e427800000000, + 0xcaa0047a00000000, 0xfdcac67b00000000, 0xb02ebc6c00000000, + 0x87447e6d00000000, 0xdefa386f00000000, 0xe990fa6e00000000, + 0x6c86b56b00000000, 0x5bec776a00000000, 0x0252316800000000, + 0x3538f36900000000, 0x087faf6200000000, 0x3f156d6300000000, + 0x66ab2b6100000000, 0x51c1e96000000000, 0xd4d7a66500000000, + 0xe3bd646400000000, 0xba03226600000000, 0x8d69e06700000000, + 0x20cbd74800000000, 0x17a1154900000000, 0x4e1f534b00000000, + 0x7975914a00000000, 0xfc63de4f00000000, 0xcb091c4e00000000, + 0x92b75a4c00000000, 0xa5dd984d00000000, 0x989ac44600000000, + 0xaff0064700000000, 0xf64e404500000000, 0xc124824400000000, + 0x4432cd4100000000, 0x73580f4000000000, 0x2ae6494200000000, + 0x1d8c8b4300000000, 0x5068f15400000000, 0x6702335500000000, + 0x3ebc755700000000, 0x09d6b75600000000, 0x8cc0f85300000000, + 0xbbaa3a5200000000, 0xe2147c5000000000, 0xd57ebe5100000000, + 0xe839e25a00000000, 0xdf53205b00000000, 0x86ed665900000000, + 0xb187a45800000000, 0x3491eb5d00000000, 0x03fb295c00000000, + 0x5a456f5e00000000, 0x6d2fad5f00000000, 0x801b35e100000000, + 0xb771f7e000000000, 0xeecfb1e200000000, 0xd9a573e300000000, + 0x5cb33ce600000000, 0x6bd9fee700000000, 0x3267b8e500000000, + 0x050d7ae400000000, 0x384a26ef00000000, 0x0f20e4ee00000000, + 0x569ea2ec00000000, 0x61f460ed00000000, 0xe4e22fe800000000, + 0xd388ede900000000, 0x8a36abeb00000000, 0xbd5c69ea00000000, + 0xf0b813fd00000000, 0xc7d2d1fc00000000, 0x9e6c97fe00000000, + 0xa90655ff00000000, 0x2c101afa00000000, 0x1b7ad8fb00000000, + 0x42c49ef900000000, 0x75ae5cf800000000, 0x48e900f300000000, + 0x7f83c2f200000000, 0x263d84f000000000, 0x115746f100000000, + 0x944109f400000000, 0xa32bcbf500000000, 0xfa958df700000000, + 0xcdff4ff600000000, 0x605d78d900000000, 0x5737bad800000000, + 0x0e89fcda00000000, 0x39e33edb00000000, 0xbcf571de00000000, + 0x8b9fb3df00000000, 0xd221f5dd00000000, 0xe54b37dc00000000, + 0xd80c6bd700000000, 0xef66a9d600000000, 0xb6d8efd400000000, + 0x81b22dd500000000, 0x04a462d000000000, 0x33cea0d100000000, + 0x6a70e6d300000000, 0x5d1a24d200000000, 0x10fe5ec500000000, + 0x27949cc400000000, 0x7e2adac600000000, 0x494018c700000000, + 0xcc5657c200000000, 0xfb3c95c300000000, 0xa282d3c100000000, + 0x95e811c000000000, 0xa8af4dcb00000000, 0x9fc58fca00000000, + 0xc67bc9c800000000, 0xf1110bc900000000, 0x740744cc00000000, + 0x436d86cd00000000, 0x1ad3c0cf00000000, 0x2db902ce00000000, + 0x4096af9100000000, 0x77fc6d9000000000, 0x2e422b9200000000, + 0x1928e99300000000, 0x9c3ea69600000000, 0xab54649700000000, + 0xf2ea229500000000, 0xc580e09400000000, 0xf8c7bc9f00000000, + 0xcfad7e9e00000000, 0x9613389c00000000, 0xa179fa9d00000000, + 0x246fb59800000000, 0x1305779900000000, 0x4abb319b00000000, + 0x7dd1f39a00000000, 0x3035898d00000000, 0x075f4b8c00000000, + 0x5ee10d8e00000000, 0x698bcf8f00000000, 0xec9d808a00000000, + 0xdbf7428b00000000, 0x8249048900000000, 0xb523c68800000000, + 0x88649a8300000000, 0xbf0e588200000000, 0xe6b01e8000000000, + 0xd1dadc8100000000, 0x54cc938400000000, 0x63a6518500000000, + 0x3a18178700000000, 0x0d72d58600000000, 0xa0d0e2a900000000, + 0x97ba20a800000000, 0xce0466aa00000000, 0xf96ea4ab00000000, + 0x7c78ebae00000000, 0x4b1229af00000000, 0x12ac6fad00000000, + 0x25c6adac00000000, 0x1881f1a700000000, 0x2feb33a600000000, + 0x765575a400000000, 0x413fb7a500000000, 0xc429f8a000000000, + 0xf3433aa100000000, 0xaafd7ca300000000, 0x9d97bea200000000, + 0xd073c4b500000000, 0xe71906b400000000, 0xbea740b600000000, + 0x89cd82b700000000, 0x0cdbcdb200000000, 0x3bb10fb300000000, + 0x620f49b100000000, 0x55658bb000000000, 0x6822d7bb00000000, + 0x5f4815ba00000000, 0x06f653b800000000, 0x319c91b900000000, + 0xb48adebc00000000, 0x83e01cbd00000000, 0xda5e5abf00000000, + 0xed3498be00000000}, + {0x0000000000000000, 0x6567bcb800000000, 0x8bc809aa00000000, + 0xeeafb51200000000, 0x5797628f00000000, 0x32f0de3700000000, + 0xdc5f6b2500000000, 0xb938d79d00000000, 0xef28b4c500000000, + 0x8a4f087d00000000, 0x64e0bd6f00000000, 0x018701d700000000, + 0xb8bfd64a00000000, 0xddd86af200000000, 0x3377dfe000000000, + 0x5610635800000000, 0x9f57195000000000, 0xfa30a5e800000000, + 0x149f10fa00000000, 0x71f8ac4200000000, 0xc8c07bdf00000000, + 0xada7c76700000000, 0x4308727500000000, 0x266fcecd00000000, + 0x707fad9500000000, 0x1518112d00000000, 0xfbb7a43f00000000, + 0x9ed0188700000000, 0x27e8cf1a00000000, 0x428f73a200000000, + 0xac20c6b000000000, 0xc9477a0800000000, 0x3eaf32a000000000, + 0x5bc88e1800000000, 0xb5673b0a00000000, 0xd00087b200000000, + 0x6938502f00000000, 0x0c5fec9700000000, 0xe2f0598500000000, + 0x8797e53d00000000, 0xd187866500000000, 0xb4e03add00000000, + 0x5a4f8fcf00000000, 0x3f28337700000000, 0x8610e4ea00000000, + 0xe377585200000000, 0x0dd8ed4000000000, 0x68bf51f800000000, + 0xa1f82bf000000000, 0xc49f974800000000, 0x2a30225a00000000, + 0x4f579ee200000000, 0xf66f497f00000000, 0x9308f5c700000000, + 0x7da740d500000000, 0x18c0fc6d00000000, 0x4ed09f3500000000, + 0x2bb7238d00000000, 0xc518969f00000000, 0xa07f2a2700000000, + 0x1947fdba00000000, 0x7c20410200000000, 0x928ff41000000000, + 0xf7e848a800000000, 0x3d58149b00000000, 0x583fa82300000000, + 0xb6901d3100000000, 0xd3f7a18900000000, 0x6acf761400000000, + 0x0fa8caac00000000, 0xe1077fbe00000000, 0x8460c30600000000, + 0xd270a05e00000000, 0xb7171ce600000000, 0x59b8a9f400000000, + 0x3cdf154c00000000, 0x85e7c2d100000000, 0xe0807e6900000000, + 0x0e2fcb7b00000000, 0x6b4877c300000000, 0xa20f0dcb00000000, + 0xc768b17300000000, 0x29c7046100000000, 0x4ca0b8d900000000, + 0xf5986f4400000000, 0x90ffd3fc00000000, 0x7e5066ee00000000, + 0x1b37da5600000000, 0x4d27b90e00000000, 0x284005b600000000, + 0xc6efb0a400000000, 0xa3880c1c00000000, 0x1ab0db8100000000, + 0x7fd7673900000000, 0x9178d22b00000000, 0xf41f6e9300000000, + 0x03f7263b00000000, 0x66909a8300000000, 0x883f2f9100000000, + 0xed58932900000000, 0x546044b400000000, 0x3107f80c00000000, + 0xdfa84d1e00000000, 0xbacff1a600000000, 0xecdf92fe00000000, + 0x89b82e4600000000, 0x67179b5400000000, 0x027027ec00000000, + 0xbb48f07100000000, 0xde2f4cc900000000, 0x3080f9db00000000, + 0x55e7456300000000, 0x9ca03f6b00000000, 0xf9c783d300000000, + 0x176836c100000000, 0x720f8a7900000000, 0xcb375de400000000, + 0xae50e15c00000000, 0x40ff544e00000000, 0x2598e8f600000000, + 0x73888bae00000000, 0x16ef371600000000, 0xf840820400000000, + 0x9d273ebc00000000, 0x241fe92100000000, 0x4178559900000000, + 0xafd7e08b00000000, 0xcab05c3300000000, 0x3bb659ed00000000, + 0x5ed1e55500000000, 0xb07e504700000000, 0xd519ecff00000000, + 0x6c213b6200000000, 0x094687da00000000, 0xe7e932c800000000, + 0x828e8e7000000000, 0xd49eed2800000000, 0xb1f9519000000000, + 0x5f56e48200000000, 0x3a31583a00000000, 0x83098fa700000000, + 0xe66e331f00000000, 0x08c1860d00000000, 0x6da63ab500000000, + 0xa4e140bd00000000, 0xc186fc0500000000, 0x2f29491700000000, + 0x4a4ef5af00000000, 0xf376223200000000, 0x96119e8a00000000, + 0x78be2b9800000000, 0x1dd9972000000000, 0x4bc9f47800000000, + 0x2eae48c000000000, 0xc001fdd200000000, 0xa566416a00000000, + 0x1c5e96f700000000, 0x79392a4f00000000, 0x97969f5d00000000, + 0xf2f123e500000000, 0x05196b4d00000000, 0x607ed7f500000000, + 0x8ed162e700000000, 0xebb6de5f00000000, 0x528e09c200000000, + 0x37e9b57a00000000, 0xd946006800000000, 0xbc21bcd000000000, + 0xea31df8800000000, 0x8f56633000000000, 0x61f9d62200000000, + 0x049e6a9a00000000, 0xbda6bd0700000000, 0xd8c101bf00000000, + 0x366eb4ad00000000, 0x5309081500000000, 0x9a4e721d00000000, + 0xff29cea500000000, 0x11867bb700000000, 0x74e1c70f00000000, + 0xcdd9109200000000, 0xa8beac2a00000000, 0x4611193800000000, + 0x2376a58000000000, 0x7566c6d800000000, 0x10017a6000000000, + 0xfeaecf7200000000, 0x9bc973ca00000000, 0x22f1a45700000000, + 0x479618ef00000000, 0xa939adfd00000000, 0xcc5e114500000000, + 0x06ee4d7600000000, 0x6389f1ce00000000, 0x8d2644dc00000000, + 0xe841f86400000000, 0x51792ff900000000, 0x341e934100000000, + 0xdab1265300000000, 0xbfd69aeb00000000, 0xe9c6f9b300000000, + 0x8ca1450b00000000, 0x620ef01900000000, 0x07694ca100000000, + 0xbe519b3c00000000, 0xdb36278400000000, 0x3599929600000000, + 0x50fe2e2e00000000, 0x99b9542600000000, 0xfcdee89e00000000, + 0x12715d8c00000000, 0x7716e13400000000, 0xce2e36a900000000, + 0xab498a1100000000, 0x45e63f0300000000, 0x208183bb00000000, + 0x7691e0e300000000, 0x13f65c5b00000000, 0xfd59e94900000000, + 0x983e55f100000000, 0x2106826c00000000, 0x44613ed400000000, + 0xaace8bc600000000, 0xcfa9377e00000000, 0x38417fd600000000, + 0x5d26c36e00000000, 0xb389767c00000000, 0xd6eecac400000000, + 0x6fd61d5900000000, 0x0ab1a1e100000000, 0xe41e14f300000000, + 0x8179a84b00000000, 0xd769cb1300000000, 0xb20e77ab00000000, + 0x5ca1c2b900000000, 0x39c67e0100000000, 0x80fea99c00000000, + 0xe599152400000000, 0x0b36a03600000000, 0x6e511c8e00000000, + 0xa716668600000000, 0xc271da3e00000000, 0x2cde6f2c00000000, + 0x49b9d39400000000, 0xf081040900000000, 0x95e6b8b100000000, + 0x7b490da300000000, 0x1e2eb11b00000000, 0x483ed24300000000, + 0x2d596efb00000000, 0xc3f6dbe900000000, 0xa691675100000000, + 0x1fa9b0cc00000000, 0x7ace0c7400000000, 0x9461b96600000000, + 0xf10605de00000000}, + {0x0000000000000000, 0xb029603d00000000, 0x6053c07a00000000, + 0xd07aa04700000000, 0xc0a680f500000000, 0x708fe0c800000000, + 0xa0f5408f00000000, 0x10dc20b200000000, 0xc14b703000000000, + 0x7162100d00000000, 0xa118b04a00000000, 0x1131d07700000000, + 0x01edf0c500000000, 0xb1c490f800000000, 0x61be30bf00000000, + 0xd197508200000000, 0x8297e06000000000, 0x32be805d00000000, + 0xe2c4201a00000000, 0x52ed402700000000, 0x4231609500000000, + 0xf21800a800000000, 0x2262a0ef00000000, 0x924bc0d200000000, + 0x43dc905000000000, 0xf3f5f06d00000000, 0x238f502a00000000, + 0x93a6301700000000, 0x837a10a500000000, 0x3353709800000000, + 0xe329d0df00000000, 0x5300b0e200000000, 0x042fc1c100000000, + 0xb406a1fc00000000, 0x647c01bb00000000, 0xd455618600000000, + 0xc489413400000000, 0x74a0210900000000, 0xa4da814e00000000, + 0x14f3e17300000000, 0xc564b1f100000000, 0x754dd1cc00000000, + 0xa537718b00000000, 0x151e11b600000000, 0x05c2310400000000, + 0xb5eb513900000000, 0x6591f17e00000000, 0xd5b8914300000000, + 0x86b821a100000000, 0x3691419c00000000, 0xe6ebe1db00000000, + 0x56c281e600000000, 0x461ea15400000000, 0xf637c16900000000, + 0x264d612e00000000, 0x9664011300000000, 0x47f3519100000000, + 0xf7da31ac00000000, 0x27a091eb00000000, 0x9789f1d600000000, + 0x8755d16400000000, 0x377cb15900000000, 0xe706111e00000000, + 0x572f712300000000, 0x4958f35800000000, 0xf971936500000000, + 0x290b332200000000, 0x9922531f00000000, 0x89fe73ad00000000, + 0x39d7139000000000, 0xe9adb3d700000000, 0x5984d3ea00000000, + 0x8813836800000000, 0x383ae35500000000, 0xe840431200000000, + 0x5869232f00000000, 0x48b5039d00000000, 0xf89c63a000000000, + 0x28e6c3e700000000, 0x98cfa3da00000000, 0xcbcf133800000000, + 0x7be6730500000000, 0xab9cd34200000000, 0x1bb5b37f00000000, + 0x0b6993cd00000000, 0xbb40f3f000000000, 0x6b3a53b700000000, + 0xdb13338a00000000, 0x0a84630800000000, 0xbaad033500000000, + 0x6ad7a37200000000, 0xdafec34f00000000, 0xca22e3fd00000000, + 0x7a0b83c000000000, 0xaa71238700000000, 0x1a5843ba00000000, + 0x4d77329900000000, 0xfd5e52a400000000, 0x2d24f2e300000000, + 0x9d0d92de00000000, 0x8dd1b26c00000000, 0x3df8d25100000000, + 0xed82721600000000, 0x5dab122b00000000, 0x8c3c42a900000000, + 0x3c15229400000000, 0xec6f82d300000000, 0x5c46e2ee00000000, + 0x4c9ac25c00000000, 0xfcb3a26100000000, 0x2cc9022600000000, + 0x9ce0621b00000000, 0xcfe0d2f900000000, 0x7fc9b2c400000000, + 0xafb3128300000000, 0x1f9a72be00000000, 0x0f46520c00000000, + 0xbf6f323100000000, 0x6f15927600000000, 0xdf3cf24b00000000, + 0x0eaba2c900000000, 0xbe82c2f400000000, 0x6ef862b300000000, + 0xded1028e00000000, 0xce0d223c00000000, 0x7e24420100000000, + 0xae5ee24600000000, 0x1e77827b00000000, 0x92b0e6b100000000, + 0x2299868c00000000, 0xf2e326cb00000000, 0x42ca46f600000000, + 0x5216664400000000, 0xe23f067900000000, 0x3245a63e00000000, + 0x826cc60300000000, 0x53fb968100000000, 0xe3d2f6bc00000000, + 0x33a856fb00000000, 0x838136c600000000, 0x935d167400000000, + 0x2374764900000000, 0xf30ed60e00000000, 0x4327b63300000000, + 0x102706d100000000, 0xa00e66ec00000000, 0x7074c6ab00000000, + 0xc05da69600000000, 0xd081862400000000, 0x60a8e61900000000, + 0xb0d2465e00000000, 0x00fb266300000000, 0xd16c76e100000000, + 0x614516dc00000000, 0xb13fb69b00000000, 0x0116d6a600000000, + 0x11caf61400000000, 0xa1e3962900000000, 0x7199366e00000000, + 0xc1b0565300000000, 0x969f277000000000, 0x26b6474d00000000, + 0xf6cce70a00000000, 0x46e5873700000000, 0x5639a78500000000, + 0xe610c7b800000000, 0x366a67ff00000000, 0x864307c200000000, + 0x57d4574000000000, 0xe7fd377d00000000, 0x3787973a00000000, + 0x87aef70700000000, 0x9772d7b500000000, 0x275bb78800000000, + 0xf72117cf00000000, 0x470877f200000000, 0x1408c71000000000, + 0xa421a72d00000000, 0x745b076a00000000, 0xc472675700000000, + 0xd4ae47e500000000, 0x648727d800000000, 0xb4fd879f00000000, + 0x04d4e7a200000000, 0xd543b72000000000, 0x656ad71d00000000, + 0xb510775a00000000, 0x0539176700000000, 0x15e537d500000000, + 0xa5cc57e800000000, 0x75b6f7af00000000, 0xc59f979200000000, + 0xdbe815e900000000, 0x6bc175d400000000, 0xbbbbd59300000000, + 0x0b92b5ae00000000, 0x1b4e951c00000000, 0xab67f52100000000, + 0x7b1d556600000000, 0xcb34355b00000000, 0x1aa365d900000000, + 0xaa8a05e400000000, 0x7af0a5a300000000, 0xcad9c59e00000000, + 0xda05e52c00000000, 0x6a2c851100000000, 0xba56255600000000, + 0x0a7f456b00000000, 0x597ff58900000000, 0xe95695b400000000, + 0x392c35f300000000, 0x890555ce00000000, 0x99d9757c00000000, + 0x29f0154100000000, 0xf98ab50600000000, 0x49a3d53b00000000, + 0x983485b900000000, 0x281de58400000000, 0xf86745c300000000, + 0x484e25fe00000000, 0x5892054c00000000, 0xe8bb657100000000, + 0x38c1c53600000000, 0x88e8a50b00000000, 0xdfc7d42800000000, + 0x6feeb41500000000, 0xbf94145200000000, 0x0fbd746f00000000, + 0x1f6154dd00000000, 0xaf4834e000000000, 0x7f3294a700000000, + 0xcf1bf49a00000000, 0x1e8ca41800000000, 0xaea5c42500000000, + 0x7edf646200000000, 0xcef6045f00000000, 0xde2a24ed00000000, + 0x6e0344d000000000, 0xbe79e49700000000, 0x0e5084aa00000000, + 0x5d50344800000000, 0xed79547500000000, 0x3d03f43200000000, + 0x8d2a940f00000000, 0x9df6b4bd00000000, 0x2ddfd48000000000, + 0xfda574c700000000, 0x4d8c14fa00000000, 0x9c1b447800000000, + 0x2c32244500000000, 0xfc48840200000000, 0x4c61e43f00000000, + 0x5cbdc48d00000000, 0xec94a4b000000000, 0x3cee04f700000000, + 0x8cc764ca00000000}, + {0x0000000000000000, 0xa5d35ccb00000000, 0x0ba1c84d00000000, + 0xae72948600000000, 0x1642919b00000000, 0xb391cd5000000000, + 0x1de359d600000000, 0xb830051d00000000, 0x6d8253ec00000000, + 0xc8510f2700000000, 0x66239ba100000000, 0xc3f0c76a00000000, + 0x7bc0c27700000000, 0xde139ebc00000000, 0x70610a3a00000000, + 0xd5b256f100000000, 0x9b02d60300000000, 0x3ed18ac800000000, + 0x90a31e4e00000000, 0x3570428500000000, 0x8d40479800000000, + 0x28931b5300000000, 0x86e18fd500000000, 0x2332d31e00000000, + 0xf68085ef00000000, 0x5353d92400000000, 0xfd214da200000000, + 0x58f2116900000000, 0xe0c2147400000000, 0x451148bf00000000, + 0xeb63dc3900000000, 0x4eb080f200000000, 0x3605ac0700000000, + 0x93d6f0cc00000000, 0x3da4644a00000000, 0x9877388100000000, + 0x20473d9c00000000, 0x8594615700000000, 0x2be6f5d100000000, + 0x8e35a91a00000000, 0x5b87ffeb00000000, 0xfe54a32000000000, + 0x502637a600000000, 0xf5f56b6d00000000, 0x4dc56e7000000000, + 0xe81632bb00000000, 0x4664a63d00000000, 0xe3b7faf600000000, + 0xad077a0400000000, 0x08d426cf00000000, 0xa6a6b24900000000, + 0x0375ee8200000000, 0xbb45eb9f00000000, 0x1e96b75400000000, + 0xb0e423d200000000, 0x15377f1900000000, 0xc08529e800000000, + 0x6556752300000000, 0xcb24e1a500000000, 0x6ef7bd6e00000000, + 0xd6c7b87300000000, 0x7314e4b800000000, 0xdd66703e00000000, + 0x78b52cf500000000, 0x6c0a580f00000000, 0xc9d904c400000000, + 0x67ab904200000000, 0xc278cc8900000000, 0x7a48c99400000000, + 0xdf9b955f00000000, 0x71e901d900000000, 0xd43a5d1200000000, + 0x01880be300000000, 0xa45b572800000000, 0x0a29c3ae00000000, + 0xaffa9f6500000000, 0x17ca9a7800000000, 0xb219c6b300000000, + 0x1c6b523500000000, 0xb9b80efe00000000, 0xf7088e0c00000000, + 0x52dbd2c700000000, 0xfca9464100000000, 0x597a1a8a00000000, + 0xe14a1f9700000000, 0x4499435c00000000, 0xeaebd7da00000000, + 0x4f388b1100000000, 0x9a8adde000000000, 0x3f59812b00000000, + 0x912b15ad00000000, 0x34f8496600000000, 0x8cc84c7b00000000, + 0x291b10b000000000, 0x8769843600000000, 0x22bad8fd00000000, + 0x5a0ff40800000000, 0xffdca8c300000000, 0x51ae3c4500000000, + 0xf47d608e00000000, 0x4c4d659300000000, 0xe99e395800000000, + 0x47ecadde00000000, 0xe23ff11500000000, 0x378da7e400000000, + 0x925efb2f00000000, 0x3c2c6fa900000000, 0x99ff336200000000, + 0x21cf367f00000000, 0x841c6ab400000000, 0x2a6efe3200000000, + 0x8fbda2f900000000, 0xc10d220b00000000, 0x64de7ec000000000, + 0xcaacea4600000000, 0x6f7fb68d00000000, 0xd74fb39000000000, + 0x729cef5b00000000, 0xdcee7bdd00000000, 0x793d271600000000, + 0xac8f71e700000000, 0x095c2d2c00000000, 0xa72eb9aa00000000, + 0x02fde56100000000, 0xbacde07c00000000, 0x1f1ebcb700000000, + 0xb16c283100000000, 0x14bf74fa00000000, 0xd814b01e00000000, + 0x7dc7ecd500000000, 0xd3b5785300000000, 0x7666249800000000, + 0xce56218500000000, 0x6b857d4e00000000, 0xc5f7e9c800000000, + 0x6024b50300000000, 0xb596e3f200000000, 0x1045bf3900000000, + 0xbe372bbf00000000, 0x1be4777400000000, 0xa3d4726900000000, + 0x06072ea200000000, 0xa875ba2400000000, 0x0da6e6ef00000000, + 0x4316661d00000000, 0xe6c53ad600000000, 0x48b7ae5000000000, + 0xed64f29b00000000, 0x5554f78600000000, 0xf087ab4d00000000, + 0x5ef53fcb00000000, 0xfb26630000000000, 0x2e9435f100000000, + 0x8b47693a00000000, 0x2535fdbc00000000, 0x80e6a17700000000, + 0x38d6a46a00000000, 0x9d05f8a100000000, 0x33776c2700000000, + 0x96a430ec00000000, 0xee111c1900000000, 0x4bc240d200000000, + 0xe5b0d45400000000, 0x4063889f00000000, 0xf8538d8200000000, + 0x5d80d14900000000, 0xf3f245cf00000000, 0x5621190400000000, + 0x83934ff500000000, 0x2640133e00000000, 0x883287b800000000, + 0x2de1db7300000000, 0x95d1de6e00000000, 0x300282a500000000, + 0x9e70162300000000, 0x3ba34ae800000000, 0x7513ca1a00000000, + 0xd0c096d100000000, 0x7eb2025700000000, 0xdb615e9c00000000, + 0x63515b8100000000, 0xc682074a00000000, 0x68f093cc00000000, + 0xcd23cf0700000000, 0x189199f600000000, 0xbd42c53d00000000, + 0x133051bb00000000, 0xb6e30d7000000000, 0x0ed3086d00000000, + 0xab0054a600000000, 0x0572c02000000000, 0xa0a19ceb00000000, + 0xb41ee81100000000, 0x11cdb4da00000000, 0xbfbf205c00000000, + 0x1a6c7c9700000000, 0xa25c798a00000000, 0x078f254100000000, + 0xa9fdb1c700000000, 0x0c2eed0c00000000, 0xd99cbbfd00000000, + 0x7c4fe73600000000, 0xd23d73b000000000, 0x77ee2f7b00000000, + 0xcfde2a6600000000, 0x6a0d76ad00000000, 0xc47fe22b00000000, + 0x61acbee000000000, 0x2f1c3e1200000000, 0x8acf62d900000000, + 0x24bdf65f00000000, 0x816eaa9400000000, 0x395eaf8900000000, + 0x9c8df34200000000, 0x32ff67c400000000, 0x972c3b0f00000000, + 0x429e6dfe00000000, 0xe74d313500000000, 0x493fa5b300000000, + 0xececf97800000000, 0x54dcfc6500000000, 0xf10fa0ae00000000, + 0x5f7d342800000000, 0xfaae68e300000000, 0x821b441600000000, + 0x27c818dd00000000, 0x89ba8c5b00000000, 0x2c69d09000000000, + 0x9459d58d00000000, 0x318a894600000000, 0x9ff81dc000000000, + 0x3a2b410b00000000, 0xef9917fa00000000, 0x4a4a4b3100000000, + 0xe438dfb700000000, 0x41eb837c00000000, 0xf9db866100000000, + 0x5c08daaa00000000, 0xf27a4e2c00000000, 0x57a912e700000000, + 0x1919921500000000, 0xbccacede00000000, 0x12b85a5800000000, + 0xb76b069300000000, 0x0f5b038e00000000, 0xaa885f4500000000, + 0x04facbc300000000, 0xa129970800000000, 0x749bc1f900000000, + 0xd1489d3200000000, 0x7f3a09b400000000, 0xdae9557f00000000, + 0x62d9506200000000, 0xc70a0ca900000000, 0x6978982f00000000, + 0xccabc4e400000000}, + {0x0000000000000000, 0xb40b77a600000000, 0x29119f9700000000, + 0x9d1ae83100000000, 0x13244ff400000000, 0xa72f385200000000, + 0x3a35d06300000000, 0x8e3ea7c500000000, 0x674eef3300000000, + 0xd345989500000000, 0x4e5f70a400000000, 0xfa54070200000000, + 0x746aa0c700000000, 0xc061d76100000000, 0x5d7b3f5000000000, + 0xe97048f600000000, 0xce9cde6700000000, 0x7a97a9c100000000, + 0xe78d41f000000000, 0x5386365600000000, 0xddb8919300000000, + 0x69b3e63500000000, 0xf4a90e0400000000, 0x40a279a200000000, + 0xa9d2315400000000, 0x1dd946f200000000, 0x80c3aec300000000, + 0x34c8d96500000000, 0xbaf67ea000000000, 0x0efd090600000000, + 0x93e7e13700000000, 0x27ec969100000000, 0x9c39bdcf00000000, + 0x2832ca6900000000, 0xb528225800000000, 0x012355fe00000000, + 0x8f1df23b00000000, 0x3b16859d00000000, 0xa60c6dac00000000, + 0x12071a0a00000000, 0xfb7752fc00000000, 0x4f7c255a00000000, + 0xd266cd6b00000000, 0x666dbacd00000000, 0xe8531d0800000000, + 0x5c586aae00000000, 0xc142829f00000000, 0x7549f53900000000, + 0x52a563a800000000, 0xe6ae140e00000000, 0x7bb4fc3f00000000, + 0xcfbf8b9900000000, 0x41812c5c00000000, 0xf58a5bfa00000000, + 0x6890b3cb00000000, 0xdc9bc46d00000000, 0x35eb8c9b00000000, + 0x81e0fb3d00000000, 0x1cfa130c00000000, 0xa8f164aa00000000, + 0x26cfc36f00000000, 0x92c4b4c900000000, 0x0fde5cf800000000, + 0xbbd52b5e00000000, 0x79750b4400000000, 0xcd7e7ce200000000, + 0x506494d300000000, 0xe46fe37500000000, 0x6a5144b000000000, + 0xde5a331600000000, 0x4340db2700000000, 0xf74bac8100000000, + 0x1e3be47700000000, 0xaa3093d100000000, 0x372a7be000000000, + 0x83210c4600000000, 0x0d1fab8300000000, 0xb914dc2500000000, + 0x240e341400000000, 0x900543b200000000, 0xb7e9d52300000000, + 0x03e2a28500000000, 0x9ef84ab400000000, 0x2af33d1200000000, + 0xa4cd9ad700000000, 0x10c6ed7100000000, 0x8ddc054000000000, + 0x39d772e600000000, 0xd0a73a1000000000, 0x64ac4db600000000, + 0xf9b6a58700000000, 0x4dbdd22100000000, 0xc38375e400000000, + 0x7788024200000000, 0xea92ea7300000000, 0x5e999dd500000000, + 0xe54cb68b00000000, 0x5147c12d00000000, 0xcc5d291c00000000, + 0x78565eba00000000, 0xf668f97f00000000, 0x42638ed900000000, + 0xdf7966e800000000, 0x6b72114e00000000, 0x820259b800000000, + 0x36092e1e00000000, 0xab13c62f00000000, 0x1f18b18900000000, + 0x9126164c00000000, 0x252d61ea00000000, 0xb83789db00000000, + 0x0c3cfe7d00000000, 0x2bd068ec00000000, 0x9fdb1f4a00000000, + 0x02c1f77b00000000, 0xb6ca80dd00000000, 0x38f4271800000000, + 0x8cff50be00000000, 0x11e5b88f00000000, 0xa5eecf2900000000, + 0x4c9e87df00000000, 0xf895f07900000000, 0x658f184800000000, + 0xd1846fee00000000, 0x5fbac82b00000000, 0xebb1bf8d00000000, + 0x76ab57bc00000000, 0xc2a0201a00000000, 0xf2ea168800000000, + 0x46e1612e00000000, 0xdbfb891f00000000, 0x6ff0feb900000000, + 0xe1ce597c00000000, 0x55c52eda00000000, 0xc8dfc6eb00000000, + 0x7cd4b14d00000000, 0x95a4f9bb00000000, 0x21af8e1d00000000, + 0xbcb5662c00000000, 0x08be118a00000000, 0x8680b64f00000000, + 0x328bc1e900000000, 0xaf9129d800000000, 0x1b9a5e7e00000000, + 0x3c76c8ef00000000, 0x887dbf4900000000, 0x1567577800000000, + 0xa16c20de00000000, 0x2f52871b00000000, 0x9b59f0bd00000000, + 0x0643188c00000000, 0xb2486f2a00000000, 0x5b3827dc00000000, + 0xef33507a00000000, 0x7229b84b00000000, 0xc622cfed00000000, + 0x481c682800000000, 0xfc171f8e00000000, 0x610df7bf00000000, + 0xd506801900000000, 0x6ed3ab4700000000, 0xdad8dce100000000, + 0x47c234d000000000, 0xf3c9437600000000, 0x7df7e4b300000000, + 0xc9fc931500000000, 0x54e67b2400000000, 0xe0ed0c8200000000, + 0x099d447400000000, 0xbd9633d200000000, 0x208cdbe300000000, + 0x9487ac4500000000, 0x1ab90b8000000000, 0xaeb27c2600000000, + 0x33a8941700000000, 0x87a3e3b100000000, 0xa04f752000000000, + 0x1444028600000000, 0x895eeab700000000, 0x3d559d1100000000, + 0xb36b3ad400000000, 0x07604d7200000000, 0x9a7aa54300000000, + 0x2e71d2e500000000, 0xc7019a1300000000, 0x730aedb500000000, + 0xee10058400000000, 0x5a1b722200000000, 0xd425d5e700000000, + 0x602ea24100000000, 0xfd344a7000000000, 0x493f3dd600000000, + 0x8b9f1dcc00000000, 0x3f946a6a00000000, 0xa28e825b00000000, + 0x1685f5fd00000000, 0x98bb523800000000, 0x2cb0259e00000000, + 0xb1aacdaf00000000, 0x05a1ba0900000000, 0xecd1f2ff00000000, + 0x58da855900000000, 0xc5c06d6800000000, 0x71cb1ace00000000, + 0xfff5bd0b00000000, 0x4bfecaad00000000, 0xd6e4229c00000000, + 0x62ef553a00000000, 0x4503c3ab00000000, 0xf108b40d00000000, + 0x6c125c3c00000000, 0xd8192b9a00000000, 0x56278c5f00000000, + 0xe22cfbf900000000, 0x7f3613c800000000, 0xcb3d646e00000000, + 0x224d2c9800000000, 0x96465b3e00000000, 0x0b5cb30f00000000, + 0xbf57c4a900000000, 0x3169636c00000000, 0x856214ca00000000, + 0x1878fcfb00000000, 0xac738b5d00000000, 0x17a6a00300000000, + 0xa3add7a500000000, 0x3eb73f9400000000, 0x8abc483200000000, + 0x0482eff700000000, 0xb089985100000000, 0x2d93706000000000, + 0x999807c600000000, 0x70e84f3000000000, 0xc4e3389600000000, + 0x59f9d0a700000000, 0xedf2a70100000000, 0x63cc00c400000000, + 0xd7c7776200000000, 0x4add9f5300000000, 0xfed6e8f500000000, + 0xd93a7e6400000000, 0x6d3109c200000000, 0xf02be1f300000000, + 0x4420965500000000, 0xca1e319000000000, 0x7e15463600000000, + 0xe30fae0700000000, 0x5704d9a100000000, 0xbe74915700000000, + 0x0a7fe6f100000000, 0x97650ec000000000, 0x236e796600000000, + 0xad50dea300000000, 0x195ba90500000000, 0x8441413400000000, + 0x304a369200000000}, + {0x0000000000000000, 0x9e00aacc00000000, 0x7d07254200000000, + 0xe3078f8e00000000, 0xfa0e4a8400000000, 0x640ee04800000000, + 0x87096fc600000000, 0x1909c50a00000000, 0xb51be5d300000000, + 0x2b1b4f1f00000000, 0xc81cc09100000000, 0x561c6a5d00000000, + 0x4f15af5700000000, 0xd115059b00000000, 0x32128a1500000000, + 0xac1220d900000000, 0x2b31bb7c00000000, 0xb53111b000000000, + 0x56369e3e00000000, 0xc83634f200000000, 0xd13ff1f800000000, + 0x4f3f5b3400000000, 0xac38d4ba00000000, 0x32387e7600000000, + 0x9e2a5eaf00000000, 0x002af46300000000, 0xe32d7bed00000000, + 0x7d2dd12100000000, 0x6424142b00000000, 0xfa24bee700000000, + 0x1923316900000000, 0x87239ba500000000, 0x566276f900000000, + 0xc862dc3500000000, 0x2b6553bb00000000, 0xb565f97700000000, + 0xac6c3c7d00000000, 0x326c96b100000000, 0xd16b193f00000000, + 0x4f6bb3f300000000, 0xe379932a00000000, 0x7d7939e600000000, + 0x9e7eb66800000000, 0x007e1ca400000000, 0x1977d9ae00000000, + 0x8777736200000000, 0x6470fcec00000000, 0xfa70562000000000, + 0x7d53cd8500000000, 0xe353674900000000, 0x0054e8c700000000, + 0x9e54420b00000000, 0x875d870100000000, 0x195d2dcd00000000, + 0xfa5aa24300000000, 0x645a088f00000000, 0xc848285600000000, + 0x5648829a00000000, 0xb54f0d1400000000, 0x2b4fa7d800000000, + 0x324662d200000000, 0xac46c81e00000000, 0x4f41479000000000, + 0xd141ed5c00000000, 0xedc29d2900000000, 0x73c237e500000000, + 0x90c5b86b00000000, 0x0ec512a700000000, 0x17ccd7ad00000000, + 0x89cc7d6100000000, 0x6acbf2ef00000000, 0xf4cb582300000000, + 0x58d978fa00000000, 0xc6d9d23600000000, 0x25de5db800000000, + 0xbbdef77400000000, 0xa2d7327e00000000, 0x3cd798b200000000, + 0xdfd0173c00000000, 0x41d0bdf000000000, 0xc6f3265500000000, + 0x58f38c9900000000, 0xbbf4031700000000, 0x25f4a9db00000000, + 0x3cfd6cd100000000, 0xa2fdc61d00000000, 0x41fa499300000000, + 0xdffae35f00000000, 0x73e8c38600000000, 0xede8694a00000000, + 0x0eefe6c400000000, 0x90ef4c0800000000, 0x89e6890200000000, + 0x17e623ce00000000, 0xf4e1ac4000000000, 0x6ae1068c00000000, + 0xbba0ebd000000000, 0x25a0411c00000000, 0xc6a7ce9200000000, + 0x58a7645e00000000, 0x41aea15400000000, 0xdfae0b9800000000, + 0x3ca9841600000000, 0xa2a92eda00000000, 0x0ebb0e0300000000, + 0x90bba4cf00000000, 0x73bc2b4100000000, 0xedbc818d00000000, + 0xf4b5448700000000, 0x6ab5ee4b00000000, 0x89b261c500000000, + 0x17b2cb0900000000, 0x909150ac00000000, 0x0e91fa6000000000, + 0xed9675ee00000000, 0x7396df2200000000, 0x6a9f1a2800000000, + 0xf49fb0e400000000, 0x17983f6a00000000, 0x899895a600000000, + 0x258ab57f00000000, 0xbb8a1fb300000000, 0x588d903d00000000, + 0xc68d3af100000000, 0xdf84fffb00000000, 0x4184553700000000, + 0xa283dab900000000, 0x3c83707500000000, 0xda853b5300000000, + 0x4485919f00000000, 0xa7821e1100000000, 0x3982b4dd00000000, + 0x208b71d700000000, 0xbe8bdb1b00000000, 0x5d8c549500000000, + 0xc38cfe5900000000, 0x6f9ede8000000000, 0xf19e744c00000000, + 0x1299fbc200000000, 0x8c99510e00000000, 0x9590940400000000, + 0x0b903ec800000000, 0xe897b14600000000, 0x76971b8a00000000, + 0xf1b4802f00000000, 0x6fb42ae300000000, 0x8cb3a56d00000000, + 0x12b30fa100000000, 0x0bbacaab00000000, 0x95ba606700000000, + 0x76bdefe900000000, 0xe8bd452500000000, 0x44af65fc00000000, + 0xdaafcf3000000000, 0x39a840be00000000, 0xa7a8ea7200000000, + 0xbea12f7800000000, 0x20a185b400000000, 0xc3a60a3a00000000, + 0x5da6a0f600000000, 0x8ce74daa00000000, 0x12e7e76600000000, + 0xf1e068e800000000, 0x6fe0c22400000000, 0x76e9072e00000000, + 0xe8e9ade200000000, 0x0bee226c00000000, 0x95ee88a000000000, + 0x39fca87900000000, 0xa7fc02b500000000, 0x44fb8d3b00000000, + 0xdafb27f700000000, 0xc3f2e2fd00000000, 0x5df2483100000000, + 0xbef5c7bf00000000, 0x20f56d7300000000, 0xa7d6f6d600000000, + 0x39d65c1a00000000, 0xdad1d39400000000, 0x44d1795800000000, + 0x5dd8bc5200000000, 0xc3d8169e00000000, 0x20df991000000000, + 0xbedf33dc00000000, 0x12cd130500000000, 0x8ccdb9c900000000, + 0x6fca364700000000, 0xf1ca9c8b00000000, 0xe8c3598100000000, + 0x76c3f34d00000000, 0x95c47cc300000000, 0x0bc4d60f00000000, + 0x3747a67a00000000, 0xa9470cb600000000, 0x4a40833800000000, + 0xd44029f400000000, 0xcd49ecfe00000000, 0x5349463200000000, + 0xb04ec9bc00000000, 0x2e4e637000000000, 0x825c43a900000000, + 0x1c5ce96500000000, 0xff5b66eb00000000, 0x615bcc2700000000, + 0x7852092d00000000, 0xe652a3e100000000, 0x05552c6f00000000, + 0x9b5586a300000000, 0x1c761d0600000000, 0x8276b7ca00000000, + 0x6171384400000000, 0xff71928800000000, 0xe678578200000000, + 0x7878fd4e00000000, 0x9b7f72c000000000, 0x057fd80c00000000, + 0xa96df8d500000000, 0x376d521900000000, 0xd46add9700000000, + 0x4a6a775b00000000, 0x5363b25100000000, 0xcd63189d00000000, + 0x2e64971300000000, 0xb0643ddf00000000, 0x6125d08300000000, + 0xff257a4f00000000, 0x1c22f5c100000000, 0x82225f0d00000000, + 0x9b2b9a0700000000, 0x052b30cb00000000, 0xe62cbf4500000000, + 0x782c158900000000, 0xd43e355000000000, 0x4a3e9f9c00000000, + 0xa939101200000000, 0x3739bade00000000, 0x2e307fd400000000, + 0xb030d51800000000, 0x53375a9600000000, 0xcd37f05a00000000, + 0x4a146bff00000000, 0xd414c13300000000, 0x37134ebd00000000, + 0xa913e47100000000, 0xb01a217b00000000, 0x2e1a8bb700000000, + 0xcd1d043900000000, 0x531daef500000000, 0xff0f8e2c00000000, + 0x610f24e000000000, 0x8208ab6e00000000, 0x1c0801a200000000, + 0x0501c4a800000000, 0x9b016e6400000000, 0x7806e1ea00000000, + 0xe6064b2600000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, 0x8f629757, + 0x37def032, 0x256b5fdc, 0x9dd738b9, 0xc5b428ef, 0x7d084f8a, + 0x6fbde064, 0xd7018701, 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, + 0x58631056, 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, 0x95ad7f70, + 0x2d111815, 0x3fa4b7fb, 0x8718d09e, 0x1acfe827, 0xa2738f42, + 0xb0c620ac, 0x087a47c9, 0xa032af3e, 0x188ec85b, 0x0a3b67b5, + 0xb28700d0, 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, 0xeae41086, + 0x525877e3, 0x40edd80d, 0xf851bf68, 0xf02bf8a1, 0x48979fc4, + 0x5a22302a, 0xe29e574f, 0x7f496ff6, 0xc7f50893, 0xd540a77d, + 0x6dfcc018, 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, 0x9b14583d, + 0x23a83f58, 0x311d90b6, 0x89a1f7d3, 0x1476cf6a, 0xaccaa80f, + 0xbe7f07e1, 0x06c36084, 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, + 0x4c15df3c, 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, 0x446f98f5, + 0xfcd3ff90, 0xee66507e, 0x56da371b, 0x0eb9274d, 0xb6054028, + 0xa4b0efc6, 0x1c0c88a3, 0x81dbb01a, 0x3967d77f, 0x2bd27891, + 0x936e1ff4, 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, 0xfe92dfec, + 0x462eb889, 0x549b1767, 0xec277002, 0x71f048bb, 0xc94c2fde, + 0xdbf98030, 0x6345e755, 0x6b3fa09c, 0xd383c7f9, 0xc1366817, + 0x798a0f72, 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, 0x21e91f24, + 0x99557841, 0x8be0d7af, 0x335cb0ca, 0xed59b63b, 0x55e5d15e, + 0x47507eb0, 0xffec19d5, 0x623b216c, 0xda874609, 0xc832e9e7, + 0x708e8e82, 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, 0xbd40e1a4, + 0x05fc86c1, 0x1749292f, 0xaff54e4a, 0x322276f3, 0x8a9e1196, + 0x982bbe78, 0x2097d91d, 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, + 0x6a4166a5, 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, 0xc2098e52, + 0x7ab5e937, 0x680046d9, 0xd0bc21bc, 0x88df31ea, 0x3063568f, + 0x22d6f961, 0x9a6a9e04, 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, + 0x15080953, 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, 0xd8c66675, + 0x607a0110, 0x72cfaefe, 0xca73c99b, 0x57a4f122, 0xef189647, + 0xfdad39a9, 0x45115ecc, 0x764dee06, 0xcef18963, 0xdc44268d, + 0x64f841e8, 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, 0x3c9b51be, + 0x842736db, 0x96929935, 0x2e2efe50, 0x2654b999, 0x9ee8defc, + 0x8c5d7112, 0x34e11677, 0xa9362ece, 0x118a49ab, 0x033fe645, + 0xbb838120, 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, 0xd67f4138, + 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, 0x591dd66f, 0xe1a1b10a, + 0xf3141ee4, 0x4ba87981, 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, + 0x017ec639, 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, 0x090481f0, + 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, 0x43d23e48, 0xfb6e592d, + 0xe9dbf6c3, 0x516791a6, 0xccb0a91f, 0x740cce7a, 0x66b96194, + 0xde0506f1}, + {0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, 0x0709a8dc, + 0x06cbc2eb, 0x048d7cb2, 0x054f1685, 0x0e1351b8, 0x0fd13b8f, + 0x0d9785d6, 0x0c55efe1, 0x091af964, 0x08d89353, 0x0a9e2d0a, + 0x0b5c473d, 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, 0x1235f2c8, + 0x13f798ff, 0x11b126a6, 0x10734c91, 0x153c5a14, 0x14fe3023, + 0x16b88e7a, 0x177ae44d, 0x384d46e0, 0x398f2cd7, 0x3bc9928e, + 0x3a0bf8b9, 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, 0x3157bf84, + 0x3095d5b3, 0x32d36bea, 0x331101dd, 0x246be590, 0x25a98fa7, + 0x27ef31fe, 0x262d5bc9, 0x23624d4c, 0x22a0277b, 0x20e69922, + 0x2124f315, 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, 0x709a8dc0, + 0x7158e7f7, 0x731e59ae, 0x72dc3399, 0x7793251c, 0x76514f2b, + 0x7417f172, 0x75d59b45, 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, + 0x7ccf6221, 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, 0x6bb5866c, + 0x6a77ec5b, 0x68315202, 0x69f33835, 0x62af7f08, 0x636d153f, + 0x612bab66, 0x60e9c151, 0x65a6d7d4, 0x6464bde3, 0x662203ba, + 0x67e0698d, 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, 0x46c49a98, + 0x4706f0af, 0x45404ef6, 0x448224c1, 0x41cd3244, 0x400f5873, + 0x4249e62a, 0x438b8c1d, 0x54f16850, 0x55330267, 0x5775bc3e, + 0x56b7d609, 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, 0x5deb9134, + 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, 0xe1351b80, 0xe0f771b7, + 0xe2b1cfee, 0xe373a5d9, 0xe63cb35c, 0xe7fed96b, 0xe5b86732, + 0xe47a0d05, 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, 0xfd13b8f0, + 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, 0xfa1a102c, 0xfbd87a1b, + 0xf99ec442, 0xf85cae75, 0xf300e948, 0xf2c2837f, 0xf0843d26, + 0xf1465711, 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, 0xde71f5bc, + 0xdfb39f8b, 0xddf521d2, 0xdc374be5, 0xd76b0cd8, 0xd6a966ef, + 0xd4efd8b6, 0xd52db281, 0xd062a404, 0xd1a0ce33, 0xd3e6706a, + 0xd2241a5d, 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, 0xcb4dafa8, + 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, 0xcc440774, 0xcd866d43, + 0xcfc0d31a, 0xce02b92d, 0x91af9640, 0x906dfc77, 0x922b422e, + 0x93e92819, 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, 0x98b56f24, + 0x99770513, 0x9b31bb4a, 0x9af3d17d, 0x8d893530, 0x8c4b5f07, + 0x8e0de15e, 0x8fcf8b69, 0x8a809dec, 0x8b42f7db, 0x89044982, + 0x88c623b5, 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, 0xa9e2d0a0, + 0xa820ba97, 0xaa6604ce, 0xaba46ef9, 0xaeeb787c, 0xaf29124b, + 0xad6fac12, 0xacadc625, 0xa7f18118, 0xa633eb2f, 0xa4755576, + 0xa5b73f41, 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, 0xb2cddb0c, + 0xb30fb13b, 0xb1490f62, 0xb08b6555, 0xbbd72268, 0xba15485f, + 0xb853f606, 0xb9919c31, 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, + 0xbe9834ed}, + {0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, 0x646cc504, + 0x7d77f445, 0x565aa786, 0x4f4196c7, 0xc8d98a08, 0xd1c2bb49, + 0xfaefe88a, 0xe3f4d9cb, 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, + 0x87981ccf, 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, 0x821b9859, + 0x9b00a918, 0xb02dfadb, 0xa936cb9a, 0xe6775d5d, 0xff6c6c1c, + 0xd4413fdf, 0xcd5a0e9e, 0x958424a2, 0x8c9f15e3, 0xa7b24620, + 0xbea97761, 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, 0x39316bae, + 0x202a5aef, 0x0b07092c, 0x121c386d, 0xdf4636f3, 0xc65d07b2, + 0xed705471, 0xf46b6530, 0xbb2af3f7, 0xa231c2b6, 0x891c9175, + 0x9007a034, 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, 0xf0794f05, + 0xe9627e44, 0xc24f2d87, 0xdb541cc6, 0x94158a01, 0x8d0ebb40, + 0xa623e883, 0xbf38d9c2, 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, + 0x138d96ce, 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, 0xded79850, + 0xc7cca911, 0xece1fad2, 0xf5facb93, 0x7262d75c, 0x6b79e61d, + 0x4054b5de, 0x594f849f, 0x160e1258, 0x0f152319, 0x243870da, + 0x3d23419b, 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, 0xad24e1af, + 0xb43fd0ee, 0x9f12832d, 0x8609b26c, 0xc94824ab, 0xd05315ea, + 0xfb7e4629, 0xe2657768, 0x2f3f79f6, 0x362448b7, 0x1d091b74, + 0x04122a35, 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, 0x838a36fa, + 0x9a9107bb, 0xb1bc5478, 0xa8a76539, 0x3b83984b, 0x2298a90a, + 0x09b5fac9, 0x10aecb88, 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, + 0x74c20e8c, 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, 0x71418a1a, + 0x685abb5b, 0x4377e898, 0x5a6cd9d9, 0x152d4f1e, 0x0c367e5f, + 0x271b2d9c, 0x3e001cdd, 0xb9980012, 0xa0833153, 0x8bae6290, + 0x92b553d1, 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, 0xca6b79ed, + 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, 0x66de36e1, 0x7fc507a0, + 0x54e85463, 0x4df36522, 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, + 0x299fa026, 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, 0x2c1c24b0, + 0x350715f1, 0x1e2a4632, 0x07317773, 0x4870e1b4, 0x516bd0f5, + 0x7a468336, 0x635db277, 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, + 0xe0d7848d, 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, 0x674f9842, + 0x7e54a903, 0x5579fac0, 0x4c62cb81, 0x8138c51f, 0x9823f45e, + 0xb30ea79d, 0xaa1596dc, 0xe554001b, 0xfc4f315a, 0xd7626299, + 0xce7953d8, 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, 0x5e7ef3ec, + 0x4765c2ad, 0x6c48916e, 0x7553a02f, 0x3a1236e8, 0x230907a9, + 0x0824546a, 0x113f652b, 0x96a779e4, 0x8fbc48a5, 0xa4911b66, + 0xbd8a2a27, 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, 0x70d024b9, + 0x69cb15f8, 0x42e6463b, 0x5bfd777a, 0xdc656bb5, 0xc57e5af4, + 0xee530937, 0xf7483876, 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, + 0x9324fd72}, + {0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x96300777, 0x2c610eee, 0xba510999, 0x19c46d07, + 0x8ff46a70, 0x35a563e9, 0xa395649e, 0x3288db0e, 0xa4b8dc79, + 0x1ee9d5e0, 0x88d9d297, 0x2b4cb609, 0xbd7cb17e, 0x072db8e7, + 0x911dbf90, 0x6410b71d, 0xf220b06a, 0x4871b9f3, 0xde41be84, + 0x7dd4da1a, 0xebe4dd6d, 0x51b5d4f4, 0xc785d383, 0x56986c13, + 0xc0a86b64, 0x7af962fd, 0xecc9658a, 0x4f5c0114, 0xd96c0663, + 0x633d0ffa, 0xf50d088d, 0xc8206e3b, 0x5e10694c, 0xe44160d5, + 0x727167a2, 0xd1e4033c, 0x47d4044b, 0xfd850dd2, 0x6bb50aa5, + 0xfaa8b535, 0x6c98b242, 0xd6c9bbdb, 0x40f9bcac, 0xe36cd832, + 0x755cdf45, 0xcf0dd6dc, 0x593dd1ab, 0xac30d926, 0x3a00de51, + 0x8051d7c8, 0x1661d0bf, 0xb5f4b421, 0x23c4b356, 0x9995bacf, + 0x0fa5bdb8, 0x9eb80228, 0x0888055f, 0xb2d90cc6, 0x24e90bb1, + 0x877c6f2f, 0x114c6858, 0xab1d61c1, 0x3d2d66b6, 0x9041dc76, + 0x0671db01, 0xbc20d298, 0x2a10d5ef, 0x8985b171, 0x1fb5b606, + 0xa5e4bf9f, 0x33d4b8e8, 0xa2c90778, 0x34f9000f, 0x8ea80996, + 0x18980ee1, 0xbb0d6a7f, 0x2d3d6d08, 0x976c6491, 0x015c63e6, + 0xf4516b6b, 0x62616c1c, 0xd8306585, 0x4e0062f2, 0xed95066c, + 0x7ba5011b, 0xc1f40882, 0x57c40ff5, 0xc6d9b065, 0x50e9b712, + 0xeab8be8b, 0x7c88b9fc, 0xdf1ddd62, 0x492dda15, 0xf37cd38c, + 0x654cd4fb, 0x5861b24d, 0xce51b53a, 0x7400bca3, 0xe230bbd4, + 0x41a5df4a, 0xd795d83d, 0x6dc4d1a4, 0xfbf4d6d3, 0x6ae96943, + 0xfcd96e34, 0x468867ad, 0xd0b860da, 0x732d0444, 0xe51d0333, + 0x5f4c0aaa, 0xc97c0ddd, 0x3c710550, 0xaa410227, 0x10100bbe, + 0x86200cc9, 0x25b56857, 0xb3856f20, 0x09d466b9, 0x9fe461ce, + 0x0ef9de5e, 0x98c9d929, 0x2298d0b0, 0xb4a8d7c7, 0x173db359, + 0x810db42e, 0x3b5cbdb7, 0xad6cbac0, 0x2083b8ed, 0xb6b3bf9a, + 0x0ce2b603, 0x9ad2b174, 0x3947d5ea, 0xaf77d29d, 0x1526db04, + 0x8316dc73, 0x120b63e3, 0x843b6494, 0x3e6a6d0d, 0xa85a6a7a, + 0x0bcf0ee4, 0x9dff0993, 0x27ae000a, 0xb19e077d, 0x44930ff0, + 0xd2a30887, 0x68f2011e, 0xfec20669, 0x5d5762f7, 0xcb676580, + 0x71366c19, 0xe7066b6e, 0x761bd4fe, 0xe02bd389, 0x5a7ada10, + 0xcc4add67, 0x6fdfb9f9, 0xf9efbe8e, 0x43beb717, 0xd58eb060, + 0xe8a3d6d6, 0x7e93d1a1, 0xc4c2d838, 0x52f2df4f, 0xf167bbd1, + 0x6757bca6, 0xdd06b53f, 0x4b36b248, 0xda2b0dd8, 0x4c1b0aaf, + 0xf64a0336, 0x607a0441, 0xc3ef60df, 0x55df67a8, 0xef8e6e31, + 0x79be6946, 0x8cb361cb, 0x1a8366bc, 0xa0d26f25, 0x36e26852, + 0x95770ccc, 0x03470bbb, 0xb9160222, 0x2f260555, 0xbe3bbac5, + 0x280bbdb2, 0x925ab42b, 0x046ab35c, 0xa7ffd7c2, 0x31cfd0b5, + 0x8b9ed92c, 0x1daede5b, 0xb0c2649b, 0x26f263ec, 0x9ca36a75, + 0x0a936d02, 0xa906099c, 0x3f360eeb, 0x85670772, 0x13570005, + 0x824abf95, 0x147ab8e2, 0xae2bb17b, 0x381bb60c, 0x9b8ed292, + 0x0dbed5e5, 0xb7efdc7c, 0x21dfdb0b, 0xd4d2d386, 0x42e2d4f1, + 0xf8b3dd68, 0x6e83da1f, 0xcd16be81, 0x5b26b9f6, 0xe177b06f, + 0x7747b718, 0xe65a0888, 0x706a0fff, 0xca3b0666, 0x5c0b0111, + 0xff9e658f, 0x69ae62f8, 0xd3ff6b61, 0x45cf6c16, 0x78e20aa0, + 0xeed20dd7, 0x5483044e, 0xc2b30339, 0x612667a7, 0xf71660d0, + 0x4d476949, 0xdb776e3e, 0x4a6ad1ae, 0xdc5ad6d9, 0x660bdf40, + 0xf03bd837, 0x53aebca9, 0xc59ebbde, 0x7fcfb247, 0xe9ffb530, + 0x1cf2bdbd, 0x8ac2baca, 0x3093b353, 0xa6a3b424, 0x0536d0ba, + 0x9306d7cd, 0x2957de54, 0xbf67d923, 0x2e7a66b3, 0xb84a61c4, + 0x021b685d, 0x942b6f2a, 0x37be0bb4, 0xa18e0cc3, 0x1bdf055a, + 0x8def022d}, + {0x00000000, 0x41311b19, 0x82623632, 0xc3532d2b, 0x04c56c64, + 0x45f4777d, 0x86a75a56, 0xc796414f, 0x088ad9c8, 0x49bbc2d1, + 0x8ae8effa, 0xcbd9f4e3, 0x0c4fb5ac, 0x4d7eaeb5, 0x8e2d839e, + 0xcf1c9887, 0x5112c24a, 0x1023d953, 0xd370f478, 0x9241ef61, + 0x55d7ae2e, 0x14e6b537, 0xd7b5981c, 0x96848305, 0x59981b82, + 0x18a9009b, 0xdbfa2db0, 0x9acb36a9, 0x5d5d77e6, 0x1c6c6cff, + 0xdf3f41d4, 0x9e0e5acd, 0xa2248495, 0xe3159f8c, 0x2046b2a7, + 0x6177a9be, 0xa6e1e8f1, 0xe7d0f3e8, 0x2483dec3, 0x65b2c5da, + 0xaaae5d5d, 0xeb9f4644, 0x28cc6b6f, 0x69fd7076, 0xae6b3139, + 0xef5a2a20, 0x2c09070b, 0x6d381c12, 0xf33646df, 0xb2075dc6, + 0x715470ed, 0x30656bf4, 0xf7f32abb, 0xb6c231a2, 0x75911c89, + 0x34a00790, 0xfbbc9f17, 0xba8d840e, 0x79dea925, 0x38efb23c, + 0xff79f373, 0xbe48e86a, 0x7d1bc541, 0x3c2ade58, 0x054f79f0, + 0x447e62e9, 0x872d4fc2, 0xc61c54db, 0x018a1594, 0x40bb0e8d, + 0x83e823a6, 0xc2d938bf, 0x0dc5a038, 0x4cf4bb21, 0x8fa7960a, + 0xce968d13, 0x0900cc5c, 0x4831d745, 0x8b62fa6e, 0xca53e177, + 0x545dbbba, 0x156ca0a3, 0xd63f8d88, 0x970e9691, 0x5098d7de, + 0x11a9ccc7, 0xd2fae1ec, 0x93cbfaf5, 0x5cd76272, 0x1de6796b, + 0xdeb55440, 0x9f844f59, 0x58120e16, 0x1923150f, 0xda703824, + 0x9b41233d, 0xa76bfd65, 0xe65ae67c, 0x2509cb57, 0x6438d04e, + 0xa3ae9101, 0xe29f8a18, 0x21cca733, 0x60fdbc2a, 0xafe124ad, + 0xeed03fb4, 0x2d83129f, 0x6cb20986, 0xab2448c9, 0xea1553d0, + 0x29467efb, 0x687765e2, 0xf6793f2f, 0xb7482436, 0x741b091d, + 0x352a1204, 0xf2bc534b, 0xb38d4852, 0x70de6579, 0x31ef7e60, + 0xfef3e6e7, 0xbfc2fdfe, 0x7c91d0d5, 0x3da0cbcc, 0xfa368a83, + 0xbb07919a, 0x7854bcb1, 0x3965a7a8, 0x4b98833b, 0x0aa99822, + 0xc9fab509, 0x88cbae10, 0x4f5def5f, 0x0e6cf446, 0xcd3fd96d, + 0x8c0ec274, 0x43125af3, 0x022341ea, 0xc1706cc1, 0x804177d8, + 0x47d73697, 0x06e62d8e, 0xc5b500a5, 0x84841bbc, 0x1a8a4171, + 0x5bbb5a68, 0x98e87743, 0xd9d96c5a, 0x1e4f2d15, 0x5f7e360c, + 0x9c2d1b27, 0xdd1c003e, 0x120098b9, 0x533183a0, 0x9062ae8b, + 0xd153b592, 0x16c5f4dd, 0x57f4efc4, 0x94a7c2ef, 0xd596d9f6, + 0xe9bc07ae, 0xa88d1cb7, 0x6bde319c, 0x2aef2a85, 0xed796bca, + 0xac4870d3, 0x6f1b5df8, 0x2e2a46e1, 0xe136de66, 0xa007c57f, + 0x6354e854, 0x2265f34d, 0xe5f3b202, 0xa4c2a91b, 0x67918430, + 0x26a09f29, 0xb8aec5e4, 0xf99fdefd, 0x3accf3d6, 0x7bfde8cf, + 0xbc6ba980, 0xfd5ab299, 0x3e099fb2, 0x7f3884ab, 0xb0241c2c, + 0xf1150735, 0x32462a1e, 0x73773107, 0xb4e17048, 0xf5d06b51, + 0x3683467a, 0x77b25d63, 0x4ed7facb, 0x0fe6e1d2, 0xccb5ccf9, + 0x8d84d7e0, 0x4a1296af, 0x0b238db6, 0xc870a09d, 0x8941bb84, + 0x465d2303, 0x076c381a, 0xc43f1531, 0x850e0e28, 0x42984f67, + 0x03a9547e, 0xc0fa7955, 0x81cb624c, 0x1fc53881, 0x5ef42398, + 0x9da70eb3, 0xdc9615aa, 0x1b0054e5, 0x5a314ffc, 0x996262d7, + 0xd85379ce, 0x174fe149, 0x567efa50, 0x952dd77b, 0xd41ccc62, + 0x138a8d2d, 0x52bb9634, 0x91e8bb1f, 0xd0d9a006, 0xecf37e5e, + 0xadc26547, 0x6e91486c, 0x2fa05375, 0xe836123a, 0xa9070923, + 0x6a542408, 0x2b653f11, 0xe479a796, 0xa548bc8f, 0x661b91a4, + 0x272a8abd, 0xe0bccbf2, 0xa18dd0eb, 0x62defdc0, 0x23efe6d9, + 0xbde1bc14, 0xfcd0a70d, 0x3f838a26, 0x7eb2913f, 0xb924d070, + 0xf815cb69, 0x3b46e642, 0x7a77fd5b, 0xb56b65dc, 0xf45a7ec5, + 0x370953ee, 0x763848f7, 0xb1ae09b8, 0xf09f12a1, 0x33cc3f8a, + 0x72fd2493}, + {0x00000000, 0x376ac201, 0x6ed48403, 0x59be4602, 0xdca80907, + 0xebc2cb06, 0xb27c8d04, 0x85164f05, 0xb851130e, 0x8f3bd10f, + 0xd685970d, 0xe1ef550c, 0x64f91a09, 0x5393d808, 0x0a2d9e0a, + 0x3d475c0b, 0x70a3261c, 0x47c9e41d, 0x1e77a21f, 0x291d601e, + 0xac0b2f1b, 0x9b61ed1a, 0xc2dfab18, 0xf5b56919, 0xc8f23512, + 0xff98f713, 0xa626b111, 0x914c7310, 0x145a3c15, 0x2330fe14, + 0x7a8eb816, 0x4de47a17, 0xe0464d38, 0xd72c8f39, 0x8e92c93b, + 0xb9f80b3a, 0x3cee443f, 0x0b84863e, 0x523ac03c, 0x6550023d, + 0x58175e36, 0x6f7d9c37, 0x36c3da35, 0x01a91834, 0x84bf5731, + 0xb3d59530, 0xea6bd332, 0xdd011133, 0x90e56b24, 0xa78fa925, + 0xfe31ef27, 0xc95b2d26, 0x4c4d6223, 0x7b27a022, 0x2299e620, + 0x15f32421, 0x28b4782a, 0x1fdeba2b, 0x4660fc29, 0x710a3e28, + 0xf41c712d, 0xc376b32c, 0x9ac8f52e, 0xada2372f, 0xc08d9a70, + 0xf7e75871, 0xae591e73, 0x9933dc72, 0x1c259377, 0x2b4f5176, + 0x72f11774, 0x459bd575, 0x78dc897e, 0x4fb64b7f, 0x16080d7d, + 0x2162cf7c, 0xa4748079, 0x931e4278, 0xcaa0047a, 0xfdcac67b, + 0xb02ebc6c, 0x87447e6d, 0xdefa386f, 0xe990fa6e, 0x6c86b56b, + 0x5bec776a, 0x02523168, 0x3538f369, 0x087faf62, 0x3f156d63, + 0x66ab2b61, 0x51c1e960, 0xd4d7a665, 0xe3bd6464, 0xba032266, + 0x8d69e067, 0x20cbd748, 0x17a11549, 0x4e1f534b, 0x7975914a, + 0xfc63de4f, 0xcb091c4e, 0x92b75a4c, 0xa5dd984d, 0x989ac446, + 0xaff00647, 0xf64e4045, 0xc1248244, 0x4432cd41, 0x73580f40, + 0x2ae64942, 0x1d8c8b43, 0x5068f154, 0x67023355, 0x3ebc7557, + 0x09d6b756, 0x8cc0f853, 0xbbaa3a52, 0xe2147c50, 0xd57ebe51, + 0xe839e25a, 0xdf53205b, 0x86ed6659, 0xb187a458, 0x3491eb5d, + 0x03fb295c, 0x5a456f5e, 0x6d2fad5f, 0x801b35e1, 0xb771f7e0, + 0xeecfb1e2, 0xd9a573e3, 0x5cb33ce6, 0x6bd9fee7, 0x3267b8e5, + 0x050d7ae4, 0x384a26ef, 0x0f20e4ee, 0x569ea2ec, 0x61f460ed, + 0xe4e22fe8, 0xd388ede9, 0x8a36abeb, 0xbd5c69ea, 0xf0b813fd, + 0xc7d2d1fc, 0x9e6c97fe, 0xa90655ff, 0x2c101afa, 0x1b7ad8fb, + 0x42c49ef9, 0x75ae5cf8, 0x48e900f3, 0x7f83c2f2, 0x263d84f0, + 0x115746f1, 0x944109f4, 0xa32bcbf5, 0xfa958df7, 0xcdff4ff6, + 0x605d78d9, 0x5737bad8, 0x0e89fcda, 0x39e33edb, 0xbcf571de, + 0x8b9fb3df, 0xd221f5dd, 0xe54b37dc, 0xd80c6bd7, 0xef66a9d6, + 0xb6d8efd4, 0x81b22dd5, 0x04a462d0, 0x33cea0d1, 0x6a70e6d3, + 0x5d1a24d2, 0x10fe5ec5, 0x27949cc4, 0x7e2adac6, 0x494018c7, + 0xcc5657c2, 0xfb3c95c3, 0xa282d3c1, 0x95e811c0, 0xa8af4dcb, + 0x9fc58fca, 0xc67bc9c8, 0xf1110bc9, 0x740744cc, 0x436d86cd, + 0x1ad3c0cf, 0x2db902ce, 0x4096af91, 0x77fc6d90, 0x2e422b92, + 0x1928e993, 0x9c3ea696, 0xab546497, 0xf2ea2295, 0xc580e094, + 0xf8c7bc9f, 0xcfad7e9e, 0x9613389c, 0xa179fa9d, 0x246fb598, + 0x13057799, 0x4abb319b, 0x7dd1f39a, 0x3035898d, 0x075f4b8c, + 0x5ee10d8e, 0x698bcf8f, 0xec9d808a, 0xdbf7428b, 0x82490489, + 0xb523c688, 0x88649a83, 0xbf0e5882, 0xe6b01e80, 0xd1dadc81, + 0x54cc9384, 0x63a65185, 0x3a181787, 0x0d72d586, 0xa0d0e2a9, + 0x97ba20a8, 0xce0466aa, 0xf96ea4ab, 0x7c78ebae, 0x4b1229af, + 0x12ac6fad, 0x25c6adac, 0x1881f1a7, 0x2feb33a6, 0x765575a4, + 0x413fb7a5, 0xc429f8a0, 0xf3433aa1, 0xaafd7ca3, 0x9d97bea2, + 0xd073c4b5, 0xe71906b4, 0xbea740b6, 0x89cd82b7, 0x0cdbcdb2, + 0x3bb10fb3, 0x620f49b1, 0x55658bb0, 0x6822d7bb, 0x5f4815ba, + 0x06f653b8, 0x319c91b9, 0xb48adebc, 0x83e01cbd, 0xda5e5abf, + 0xed3498be}, + {0x00000000, 0x6567bcb8, 0x8bc809aa, 0xeeafb512, 0x5797628f, + 0x32f0de37, 0xdc5f6b25, 0xb938d79d, 0xef28b4c5, 0x8a4f087d, + 0x64e0bd6f, 0x018701d7, 0xb8bfd64a, 0xddd86af2, 0x3377dfe0, + 0x56106358, 0x9f571950, 0xfa30a5e8, 0x149f10fa, 0x71f8ac42, + 0xc8c07bdf, 0xada7c767, 0x43087275, 0x266fcecd, 0x707fad95, + 0x1518112d, 0xfbb7a43f, 0x9ed01887, 0x27e8cf1a, 0x428f73a2, + 0xac20c6b0, 0xc9477a08, 0x3eaf32a0, 0x5bc88e18, 0xb5673b0a, + 0xd00087b2, 0x6938502f, 0x0c5fec97, 0xe2f05985, 0x8797e53d, + 0xd1878665, 0xb4e03add, 0x5a4f8fcf, 0x3f283377, 0x8610e4ea, + 0xe3775852, 0x0dd8ed40, 0x68bf51f8, 0xa1f82bf0, 0xc49f9748, + 0x2a30225a, 0x4f579ee2, 0xf66f497f, 0x9308f5c7, 0x7da740d5, + 0x18c0fc6d, 0x4ed09f35, 0x2bb7238d, 0xc518969f, 0xa07f2a27, + 0x1947fdba, 0x7c204102, 0x928ff410, 0xf7e848a8, 0x3d58149b, + 0x583fa823, 0xb6901d31, 0xd3f7a189, 0x6acf7614, 0x0fa8caac, + 0xe1077fbe, 0x8460c306, 0xd270a05e, 0xb7171ce6, 0x59b8a9f4, + 0x3cdf154c, 0x85e7c2d1, 0xe0807e69, 0x0e2fcb7b, 0x6b4877c3, + 0xa20f0dcb, 0xc768b173, 0x29c70461, 0x4ca0b8d9, 0xf5986f44, + 0x90ffd3fc, 0x7e5066ee, 0x1b37da56, 0x4d27b90e, 0x284005b6, + 0xc6efb0a4, 0xa3880c1c, 0x1ab0db81, 0x7fd76739, 0x9178d22b, + 0xf41f6e93, 0x03f7263b, 0x66909a83, 0x883f2f91, 0xed589329, + 0x546044b4, 0x3107f80c, 0xdfa84d1e, 0xbacff1a6, 0xecdf92fe, + 0x89b82e46, 0x67179b54, 0x027027ec, 0xbb48f071, 0xde2f4cc9, + 0x3080f9db, 0x55e74563, 0x9ca03f6b, 0xf9c783d3, 0x176836c1, + 0x720f8a79, 0xcb375de4, 0xae50e15c, 0x40ff544e, 0x2598e8f6, + 0x73888bae, 0x16ef3716, 0xf8408204, 0x9d273ebc, 0x241fe921, + 0x41785599, 0xafd7e08b, 0xcab05c33, 0x3bb659ed, 0x5ed1e555, + 0xb07e5047, 0xd519ecff, 0x6c213b62, 0x094687da, 0xe7e932c8, + 0x828e8e70, 0xd49eed28, 0xb1f95190, 0x5f56e482, 0x3a31583a, + 0x83098fa7, 0xe66e331f, 0x08c1860d, 0x6da63ab5, 0xa4e140bd, + 0xc186fc05, 0x2f294917, 0x4a4ef5af, 0xf3762232, 0x96119e8a, + 0x78be2b98, 0x1dd99720, 0x4bc9f478, 0x2eae48c0, 0xc001fdd2, + 0xa566416a, 0x1c5e96f7, 0x79392a4f, 0x97969f5d, 0xf2f123e5, + 0x05196b4d, 0x607ed7f5, 0x8ed162e7, 0xebb6de5f, 0x528e09c2, + 0x37e9b57a, 0xd9460068, 0xbc21bcd0, 0xea31df88, 0x8f566330, + 0x61f9d622, 0x049e6a9a, 0xbda6bd07, 0xd8c101bf, 0x366eb4ad, + 0x53090815, 0x9a4e721d, 0xff29cea5, 0x11867bb7, 0x74e1c70f, + 0xcdd91092, 0xa8beac2a, 0x46111938, 0x2376a580, 0x7566c6d8, + 0x10017a60, 0xfeaecf72, 0x9bc973ca, 0x22f1a457, 0x479618ef, + 0xa939adfd, 0xcc5e1145, 0x06ee4d76, 0x6389f1ce, 0x8d2644dc, + 0xe841f864, 0x51792ff9, 0x341e9341, 0xdab12653, 0xbfd69aeb, + 0xe9c6f9b3, 0x8ca1450b, 0x620ef019, 0x07694ca1, 0xbe519b3c, + 0xdb362784, 0x35999296, 0x50fe2e2e, 0x99b95426, 0xfcdee89e, + 0x12715d8c, 0x7716e134, 0xce2e36a9, 0xab498a11, 0x45e63f03, + 0x208183bb, 0x7691e0e3, 0x13f65c5b, 0xfd59e949, 0x983e55f1, + 0x2106826c, 0x44613ed4, 0xaace8bc6, 0xcfa9377e, 0x38417fd6, + 0x5d26c36e, 0xb389767c, 0xd6eecac4, 0x6fd61d59, 0x0ab1a1e1, + 0xe41e14f3, 0x8179a84b, 0xd769cb13, 0xb20e77ab, 0x5ca1c2b9, + 0x39c67e01, 0x80fea99c, 0xe5991524, 0x0b36a036, 0x6e511c8e, + 0xa7166686, 0xc271da3e, 0x2cde6f2c, 0x49b9d394, 0xf0810409, + 0x95e6b8b1, 0x7b490da3, 0x1e2eb11b, 0x483ed243, 0x2d596efb, + 0xc3f6dbe9, 0xa6916751, 0x1fa9b0cc, 0x7ace0c74, 0x9461b966, + 0xf10605de}}; + +#endif + +#endif + +#if N == 2 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}, + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43147b1700000000, 0x8628f62e00000000, + 0xc53c8d3900000000, 0x0c51ec5d00000000, 0x4f45974a00000000, + 0x8a791a7300000000, 0xc96d616400000000, 0x18a2d8bb00000000, + 0x5bb6a3ac00000000, 0x9e8a2e9500000000, 0xdd9e558200000000, + 0x14f334e600000000, 0x57e74ff100000000, 0x92dbc2c800000000, + 0xd1cfb9df00000000, 0x7142c0ac00000000, 0x3256bbbb00000000, + 0xf76a368200000000, 0xb47e4d9500000000, 0x7d132cf100000000, + 0x3e0757e600000000, 0xfb3bdadf00000000, 0xb82fa1c800000000, + 0x69e0181700000000, 0x2af4630000000000, 0xefc8ee3900000000, + 0xacdc952e00000000, 0x65b1f44a00000000, 0x26a58f5d00000000, + 0xe399026400000000, 0xa08d797300000000, 0xa382f18200000000, + 0xe0968a9500000000, 0x25aa07ac00000000, 0x66be7cbb00000000, + 0xafd31ddf00000000, 0xecc766c800000000, 0x29fbebf100000000, + 0x6aef90e600000000, 0xbb20293900000000, 0xf834522e00000000, + 0x3d08df1700000000, 0x7e1ca40000000000, 0xb771c56400000000, + 0xf465be7300000000, 0x3159334a00000000, 0x724d485d00000000, + 0xd2c0312e00000000, 0x91d44a3900000000, 0x54e8c70000000000, + 0x17fcbc1700000000, 0xde91dd7300000000, 0x9d85a66400000000, + 0x58b92b5d00000000, 0x1bad504a00000000, 0xca62e99500000000, + 0x8976928200000000, 0x4c4a1fbb00000000, 0x0f5e64ac00000000, + 0xc63305c800000000, 0x85277edf00000000, 0x401bf3e600000000, + 0x030f88f100000000, 0x070392de00000000, 0x4417e9c900000000, + 0x812b64f000000000, 0xc23f1fe700000000, 0x0b527e8300000000, + 0x4846059400000000, 0x8d7a88ad00000000, 0xce6ef3ba00000000, + 0x1fa14a6500000000, 0x5cb5317200000000, 0x9989bc4b00000000, + 0xda9dc75c00000000, 0x13f0a63800000000, 0x50e4dd2f00000000, + 0x95d8501600000000, 0xd6cc2b0100000000, 0x7641527200000000, + 0x3555296500000000, 0xf069a45c00000000, 0xb37ddf4b00000000, + 0x7a10be2f00000000, 0x3904c53800000000, 0xfc38480100000000, + 0xbf2c331600000000, 0x6ee38ac900000000, 0x2df7f1de00000000, + 0xe8cb7ce700000000, 0xabdf07f000000000, 0x62b2669400000000, + 0x21a61d8300000000, 0xe49a90ba00000000, 0xa78eebad00000000, + 0xa481635c00000000, 0xe795184b00000000, 0x22a9957200000000, + 0x61bdee6500000000, 0xa8d08f0100000000, 0xebc4f41600000000, + 0x2ef8792f00000000, 0x6dec023800000000, 0xbc23bbe700000000, + 0xff37c0f000000000, 0x3a0b4dc900000000, 0x791f36de00000000, + 0xb07257ba00000000, 0xf3662cad00000000, 0x365aa19400000000, + 0x754eda8300000000, 0xd5c3a3f000000000, 0x96d7d8e700000000, + 0x53eb55de00000000, 0x10ff2ec900000000, 0xd9924fad00000000, + 0x9a8634ba00000000, 0x5fbab98300000000, 0x1caec29400000000, + 0xcd617b4b00000000, 0x8e75005c00000000, 0x4b498d6500000000, + 0x085df67200000000, 0xc130971600000000, 0x8224ec0100000000, + 0x4718613800000000, 0x040c1a2f00000000, 0x4f00556600000000, + 0x0c142e7100000000, 0xc928a34800000000, 0x8a3cd85f00000000, + 0x4351b93b00000000, 0x0045c22c00000000, 0xc5794f1500000000, + 0x866d340200000000, 0x57a28ddd00000000, 0x14b6f6ca00000000, + 0xd18a7bf300000000, 0x929e00e400000000, 0x5bf3618000000000, + 0x18e71a9700000000, 0xdddb97ae00000000, 0x9ecfecb900000000, + 0x3e4295ca00000000, 0x7d56eedd00000000, 0xb86a63e400000000, + 0xfb7e18f300000000, 0x3213799700000000, 0x7107028000000000, + 0xb43b8fb900000000, 0xf72ff4ae00000000, 0x26e04d7100000000, + 0x65f4366600000000, 0xa0c8bb5f00000000, 0xe3dcc04800000000, + 0x2ab1a12c00000000, 0x69a5da3b00000000, 0xac99570200000000, + 0xef8d2c1500000000, 0xec82a4e400000000, 0xaf96dff300000000, + 0x6aaa52ca00000000, 0x29be29dd00000000, 0xe0d348b900000000, + 0xa3c733ae00000000, 0x66fbbe9700000000, 0x25efc58000000000, + 0xf4207c5f00000000, 0xb734074800000000, 0x72088a7100000000, + 0x311cf16600000000, 0xf871900200000000, 0xbb65eb1500000000, + 0x7e59662c00000000, 0x3d4d1d3b00000000, 0x9dc0644800000000, + 0xded41f5f00000000, 0x1be8926600000000, 0x58fce97100000000, + 0x9191881500000000, 0xd285f30200000000, 0x17b97e3b00000000, + 0x54ad052c00000000, 0x8562bcf300000000, 0xc676c7e400000000, + 0x034a4add00000000, 0x405e31ca00000000, 0x893350ae00000000, + 0xca272bb900000000, 0x0f1ba68000000000, 0x4c0fdd9700000000, + 0x4803c7b800000000, 0x0b17bcaf00000000, 0xce2b319600000000, + 0x8d3f4a8100000000, 0x44522be500000000, 0x074650f200000000, + 0xc27addcb00000000, 0x816ea6dc00000000, 0x50a11f0300000000, + 0x13b5641400000000, 0xd689e92d00000000, 0x959d923a00000000, + 0x5cf0f35e00000000, 0x1fe4884900000000, 0xdad8057000000000, + 0x99cc7e6700000000, 0x3941071400000000, 0x7a557c0300000000, + 0xbf69f13a00000000, 0xfc7d8a2d00000000, 0x3510eb4900000000, + 0x7604905e00000000, 0xb3381d6700000000, 0xf02c667000000000, + 0x21e3dfaf00000000, 0x62f7a4b800000000, 0xa7cb298100000000, + 0xe4df529600000000, 0x2db233f200000000, 0x6ea648e500000000, + 0xab9ac5dc00000000, 0xe88ebecb00000000, 0xeb81363a00000000, + 0xa8954d2d00000000, 0x6da9c01400000000, 0x2ebdbb0300000000, + 0xe7d0da6700000000, 0xa4c4a17000000000, 0x61f82c4900000000, + 0x22ec575e00000000, 0xf323ee8100000000, 0xb037959600000000, + 0x750b18af00000000, 0x361f63b800000000, 0xff7202dc00000000, + 0xbc6679cb00000000, 0x795af4f200000000, 0x3a4e8fe500000000, + 0x9ac3f69600000000, 0xd9d78d8100000000, 0x1ceb00b800000000, + 0x5fff7baf00000000, 0x96921acb00000000, 0xd58661dc00000000, + 0x10baece500000000, 0x53ae97f200000000, 0x82612e2d00000000, + 0xc175553a00000000, 0x0449d80300000000, 0x475da31400000000, + 0x8e30c27000000000, 0xcd24b96700000000, 0x0818345e00000000, + 0x4b0c4f4900000000}, + {0x0000000000000000, 0x3e6bc2ef00000000, 0x3dd0f50400000000, + 0x03bb37eb00000000, 0x7aa0eb0900000000, 0x44cb29e600000000, + 0x47701e0d00000000, 0x791bdce200000000, 0xf440d71300000000, + 0xca2b15fc00000000, 0xc990221700000000, 0xf7fbe0f800000000, + 0x8ee03c1a00000000, 0xb08bfef500000000, 0xb330c91e00000000, + 0x8d5b0bf100000000, 0xe881ae2700000000, 0xd6ea6cc800000000, + 0xd5515b2300000000, 0xeb3a99cc00000000, 0x9221452e00000000, + 0xac4a87c100000000, 0xaff1b02a00000000, 0x919a72c500000000, + 0x1cc1793400000000, 0x22aabbdb00000000, 0x21118c3000000000, + 0x1f7a4edf00000000, 0x6661923d00000000, 0x580a50d200000000, + 0x5bb1673900000000, 0x65daa5d600000000, 0xd0035d4f00000000, + 0xee689fa000000000, 0xedd3a84b00000000, 0xd3b86aa400000000, + 0xaaa3b64600000000, 0x94c874a900000000, 0x9773434200000000, + 0xa91881ad00000000, 0x24438a5c00000000, 0x1a2848b300000000, + 0x19937f5800000000, 0x27f8bdb700000000, 0x5ee3615500000000, + 0x6088a3ba00000000, 0x6333945100000000, 0x5d5856be00000000, + 0x3882f36800000000, 0x06e9318700000000, 0x0552066c00000000, + 0x3b39c48300000000, 0x4222186100000000, 0x7c49da8e00000000, + 0x7ff2ed6500000000, 0x41992f8a00000000, 0xccc2247b00000000, + 0xf2a9e69400000000, 0xf112d17f00000000, 0xcf79139000000000, + 0xb662cf7200000000, 0x88090d9d00000000, 0x8bb23a7600000000, + 0xb5d9f89900000000, 0xa007ba9e00000000, 0x9e6c787100000000, + 0x9dd74f9a00000000, 0xa3bc8d7500000000, 0xdaa7519700000000, + 0xe4cc937800000000, 0xe777a49300000000, 0xd91c667c00000000, + 0x54476d8d00000000, 0x6a2caf6200000000, 0x6997988900000000, + 0x57fc5a6600000000, 0x2ee7868400000000, 0x108c446b00000000, + 0x1337738000000000, 0x2d5cb16f00000000, 0x488614b900000000, + 0x76edd65600000000, 0x7556e1bd00000000, 0x4b3d235200000000, + 0x3226ffb000000000, 0x0c4d3d5f00000000, 0x0ff60ab400000000, + 0x319dc85b00000000, 0xbcc6c3aa00000000, 0x82ad014500000000, + 0x811636ae00000000, 0xbf7df44100000000, 0xc66628a300000000, + 0xf80dea4c00000000, 0xfbb6dda700000000, 0xc5dd1f4800000000, + 0x7004e7d100000000, 0x4e6f253e00000000, 0x4dd412d500000000, + 0x73bfd03a00000000, 0x0aa40cd800000000, 0x34cfce3700000000, + 0x3774f9dc00000000, 0x091f3b3300000000, 0x844430c200000000, + 0xba2ff22d00000000, 0xb994c5c600000000, 0x87ff072900000000, + 0xfee4dbcb00000000, 0xc08f192400000000, 0xc3342ecf00000000, + 0xfd5fec2000000000, 0x988549f600000000, 0xa6ee8b1900000000, + 0xa555bcf200000000, 0x9b3e7e1d00000000, 0xe225a2ff00000000, + 0xdc4e601000000000, 0xdff557fb00000000, 0xe19e951400000000, + 0x6cc59ee500000000, 0x52ae5c0a00000000, 0x51156be100000000, + 0x6f7ea90e00000000, 0x166575ec00000000, 0x280eb70300000000, + 0x2bb580e800000000, 0x15de420700000000, 0x010905e600000000, + 0x3f62c70900000000, 0x3cd9f0e200000000, 0x02b2320d00000000, + 0x7ba9eeef00000000, 0x45c22c0000000000, 0x46791beb00000000, + 0x7812d90400000000, 0xf549d2f500000000, 0xcb22101a00000000, + 0xc89927f100000000, 0xf6f2e51e00000000, 0x8fe939fc00000000, + 0xb182fb1300000000, 0xb239ccf800000000, 0x8c520e1700000000, + 0xe988abc100000000, 0xd7e3692e00000000, 0xd4585ec500000000, + 0xea339c2a00000000, 0x932840c800000000, 0xad43822700000000, + 0xaef8b5cc00000000, 0x9093772300000000, 0x1dc87cd200000000, + 0x23a3be3d00000000, 0x201889d600000000, 0x1e734b3900000000, + 0x676897db00000000, 0x5903553400000000, 0x5ab862df00000000, + 0x64d3a03000000000, 0xd10a58a900000000, 0xef619a4600000000, + 0xecdaadad00000000, 0xd2b16f4200000000, 0xabaab3a000000000, + 0x95c1714f00000000, 0x967a46a400000000, 0xa811844b00000000, + 0x254a8fba00000000, 0x1b214d5500000000, 0x189a7abe00000000, + 0x26f1b85100000000, 0x5fea64b300000000, 0x6181a65c00000000, + 0x623a91b700000000, 0x5c51535800000000, 0x398bf68e00000000, + 0x07e0346100000000, 0x045b038a00000000, 0x3a30c16500000000, + 0x432b1d8700000000, 0x7d40df6800000000, 0x7efbe88300000000, + 0x40902a6c00000000, 0xcdcb219d00000000, 0xf3a0e37200000000, + 0xf01bd49900000000, 0xce70167600000000, 0xb76bca9400000000, + 0x8900087b00000000, 0x8abb3f9000000000, 0xb4d0fd7f00000000, + 0xa10ebf7800000000, 0x9f657d9700000000, 0x9cde4a7c00000000, + 0xa2b5889300000000, 0xdbae547100000000, 0xe5c5969e00000000, + 0xe67ea17500000000, 0xd815639a00000000, 0x554e686b00000000, + 0x6b25aa8400000000, 0x689e9d6f00000000, 0x56f55f8000000000, + 0x2fee836200000000, 0x1185418d00000000, 0x123e766600000000, + 0x2c55b48900000000, 0x498f115f00000000, 0x77e4d3b000000000, + 0x745fe45b00000000, 0x4a3426b400000000, 0x332ffa5600000000, + 0x0d4438b900000000, 0x0eff0f5200000000, 0x3094cdbd00000000, + 0xbdcfc64c00000000, 0x83a404a300000000, 0x801f334800000000, + 0xbe74f1a700000000, 0xc76f2d4500000000, 0xf904efaa00000000, + 0xfabfd84100000000, 0xc4d41aae00000000, 0x710de23700000000, + 0x4f6620d800000000, 0x4cdd173300000000, 0x72b6d5dc00000000, + 0x0bad093e00000000, 0x35c6cbd100000000, 0x367dfc3a00000000, + 0x08163ed500000000, 0x854d352400000000, 0xbb26f7cb00000000, + 0xb89dc02000000000, 0x86f602cf00000000, 0xffedde2d00000000, + 0xc1861cc200000000, 0xc23d2b2900000000, 0xfc56e9c600000000, + 0x998c4c1000000000, 0xa7e78eff00000000, 0xa45cb91400000000, + 0x9a377bfb00000000, 0xe32ca71900000000, 0xdd4765f600000000, + 0xdefc521d00000000, 0xe09790f200000000, 0x6dcc9b0300000000, + 0x53a759ec00000000, 0x501c6e0700000000, 0x6e77ace800000000, + 0x176c700a00000000, 0x2907b2e500000000, 0x2abc850e00000000, + 0x14d747e100000000}, + {0x0000000000000000, 0xc0df8ec100000000, 0xc1b96c5800000000, + 0x0166e29900000000, 0x8273d9b000000000, 0x42ac577100000000, + 0x43cab5e800000000, 0x83153b2900000000, 0x45e1c3ba00000000, + 0x853e4d7b00000000, 0x8458afe200000000, 0x4487212300000000, + 0xc7921a0a00000000, 0x074d94cb00000000, 0x062b765200000000, + 0xc6f4f89300000000, 0xcbc4f6ae00000000, 0x0b1b786f00000000, + 0x0a7d9af600000000, 0xcaa2143700000000, 0x49b72f1e00000000, + 0x8968a1df00000000, 0x880e434600000000, 0x48d1cd8700000000, + 0x8e25351400000000, 0x4efabbd500000000, 0x4f9c594c00000000, + 0x8f43d78d00000000, 0x0c56eca400000000, 0xcc89626500000000, + 0xcdef80fc00000000, 0x0d300e3d00000000, 0xd78f9c8600000000, + 0x1750124700000000, 0x1636f0de00000000, 0xd6e97e1f00000000, + 0x55fc453600000000, 0x9523cbf700000000, 0x9445296e00000000, + 0x549aa7af00000000, 0x926e5f3c00000000, 0x52b1d1fd00000000, + 0x53d7336400000000, 0x9308bda500000000, 0x101d868c00000000, + 0xd0c2084d00000000, 0xd1a4ead400000000, 0x117b641500000000, + 0x1c4b6a2800000000, 0xdc94e4e900000000, 0xddf2067000000000, + 0x1d2d88b100000000, 0x9e38b39800000000, 0x5ee73d5900000000, + 0x5f81dfc000000000, 0x9f5e510100000000, 0x59aaa99200000000, + 0x9975275300000000, 0x9813c5ca00000000, 0x58cc4b0b00000000, + 0xdbd9702200000000, 0x1b06fee300000000, 0x1a601c7a00000000, + 0xdabf92bb00000000, 0xef1948d600000000, 0x2fc6c61700000000, + 0x2ea0248e00000000, 0xee7faa4f00000000, 0x6d6a916600000000, + 0xadb51fa700000000, 0xacd3fd3e00000000, 0x6c0c73ff00000000, + 0xaaf88b6c00000000, 0x6a2705ad00000000, 0x6b41e73400000000, + 0xab9e69f500000000, 0x288b52dc00000000, 0xe854dc1d00000000, + 0xe9323e8400000000, 0x29edb04500000000, 0x24ddbe7800000000, + 0xe40230b900000000, 0xe564d22000000000, 0x25bb5ce100000000, + 0xa6ae67c800000000, 0x6671e90900000000, 0x67170b9000000000, + 0xa7c8855100000000, 0x613c7dc200000000, 0xa1e3f30300000000, + 0xa085119a00000000, 0x605a9f5b00000000, 0xe34fa47200000000, + 0x23902ab300000000, 0x22f6c82a00000000, 0xe22946eb00000000, + 0x3896d45000000000, 0xf8495a9100000000, 0xf92fb80800000000, + 0x39f036c900000000, 0xbae50de000000000, 0x7a3a832100000000, + 0x7b5c61b800000000, 0xbb83ef7900000000, 0x7d7717ea00000000, + 0xbda8992b00000000, 0xbcce7bb200000000, 0x7c11f57300000000, + 0xff04ce5a00000000, 0x3fdb409b00000000, 0x3ebda20200000000, + 0xfe622cc300000000, 0xf35222fe00000000, 0x338dac3f00000000, + 0x32eb4ea600000000, 0xf234c06700000000, 0x7121fb4e00000000, + 0xb1fe758f00000000, 0xb098971600000000, 0x704719d700000000, + 0xb6b3e14400000000, 0x766c6f8500000000, 0x770a8d1c00000000, + 0xb7d503dd00000000, 0x34c038f400000000, 0xf41fb63500000000, + 0xf57954ac00000000, 0x35a6da6d00000000, 0x9f35e17700000000, + 0x5fea6fb600000000, 0x5e8c8d2f00000000, 0x9e5303ee00000000, + 0x1d4638c700000000, 0xdd99b60600000000, 0xdcff549f00000000, + 0x1c20da5e00000000, 0xdad422cd00000000, 0x1a0bac0c00000000, + 0x1b6d4e9500000000, 0xdbb2c05400000000, 0x58a7fb7d00000000, + 0x987875bc00000000, 0x991e972500000000, 0x59c119e400000000, + 0x54f117d900000000, 0x942e991800000000, 0x95487b8100000000, + 0x5597f54000000000, 0xd682ce6900000000, 0x165d40a800000000, + 0x173ba23100000000, 0xd7e42cf000000000, 0x1110d46300000000, + 0xd1cf5aa200000000, 0xd0a9b83b00000000, 0x107636fa00000000, + 0x93630dd300000000, 0x53bc831200000000, 0x52da618b00000000, + 0x9205ef4a00000000, 0x48ba7df100000000, 0x8865f33000000000, + 0x890311a900000000, 0x49dc9f6800000000, 0xcac9a44100000000, + 0x0a162a8000000000, 0x0b70c81900000000, 0xcbaf46d800000000, + 0x0d5bbe4b00000000, 0xcd84308a00000000, 0xcce2d21300000000, + 0x0c3d5cd200000000, 0x8f2867fb00000000, 0x4ff7e93a00000000, + 0x4e910ba300000000, 0x8e4e856200000000, 0x837e8b5f00000000, + 0x43a1059e00000000, 0x42c7e70700000000, 0x821869c600000000, + 0x010d52ef00000000, 0xc1d2dc2e00000000, 0xc0b43eb700000000, + 0x006bb07600000000, 0xc69f48e500000000, 0x0640c62400000000, + 0x072624bd00000000, 0xc7f9aa7c00000000, 0x44ec915500000000, + 0x84331f9400000000, 0x8555fd0d00000000, 0x458a73cc00000000, + 0x702ca9a100000000, 0xb0f3276000000000, 0xb195c5f900000000, + 0x714a4b3800000000, 0xf25f701100000000, 0x3280fed000000000, + 0x33e61c4900000000, 0xf339928800000000, 0x35cd6a1b00000000, + 0xf512e4da00000000, 0xf474064300000000, 0x34ab888200000000, + 0xb7beb3ab00000000, 0x77613d6a00000000, 0x7607dff300000000, + 0xb6d8513200000000, 0xbbe85f0f00000000, 0x7b37d1ce00000000, + 0x7a51335700000000, 0xba8ebd9600000000, 0x399b86bf00000000, + 0xf944087e00000000, 0xf822eae700000000, 0x38fd642600000000, + 0xfe099cb500000000, 0x3ed6127400000000, 0x3fb0f0ed00000000, + 0xff6f7e2c00000000, 0x7c7a450500000000, 0xbca5cbc400000000, + 0xbdc3295d00000000, 0x7d1ca79c00000000, 0xa7a3352700000000, + 0x677cbbe600000000, 0x661a597f00000000, 0xa6c5d7be00000000, + 0x25d0ec9700000000, 0xe50f625600000000, 0xe46980cf00000000, + 0x24b60e0e00000000, 0xe242f69d00000000, 0x229d785c00000000, + 0x23fb9ac500000000, 0xe324140400000000, 0x60312f2d00000000, + 0xa0eea1ec00000000, 0xa188437500000000, 0x6157cdb400000000, + 0x6c67c38900000000, 0xacb84d4800000000, 0xaddeafd100000000, + 0x6d01211000000000, 0xee141a3900000000, 0x2ecb94f800000000, + 0x2fad766100000000, 0xef72f8a000000000, 0x2986003300000000, + 0xe9598ef200000000, 0xe83f6c6b00000000, 0x28e0e2aa00000000, + 0xabf5d98300000000, 0x6b2a574200000000, 0x6a4cb5db00000000, + 0xaa933b1a00000000}, + {0x0000000000000000, 0x6f4ca59b00000000, 0x9f9e3bec00000000, + 0xf0d29e7700000000, 0x7f3b060300000000, 0x1077a39800000000, + 0xe0a53def00000000, 0x8fe9987400000000, 0xfe760c0600000000, + 0x913aa99d00000000, 0x61e837ea00000000, 0x0ea4927100000000, + 0x814d0a0500000000, 0xee01af9e00000000, 0x1ed331e900000000, + 0x719f947200000000, 0xfced180c00000000, 0x93a1bd9700000000, + 0x637323e000000000, 0x0c3f867b00000000, 0x83d61e0f00000000, + 0xec9abb9400000000, 0x1c4825e300000000, 0x7304807800000000, + 0x029b140a00000000, 0x6dd7b19100000000, 0x9d052fe600000000, + 0xf2498a7d00000000, 0x7da0120900000000, 0x12ecb79200000000, + 0xe23e29e500000000, 0x8d728c7e00000000, 0xf8db311800000000, + 0x9797948300000000, 0x67450af400000000, 0x0809af6f00000000, + 0x87e0371b00000000, 0xe8ac928000000000, 0x187e0cf700000000, + 0x7732a96c00000000, 0x06ad3d1e00000000, 0x69e1988500000000, + 0x993306f200000000, 0xf67fa36900000000, 0x79963b1d00000000, + 0x16da9e8600000000, 0xe60800f100000000, 0x8944a56a00000000, + 0x0436291400000000, 0x6b7a8c8f00000000, 0x9ba812f800000000, + 0xf4e4b76300000000, 0x7b0d2f1700000000, 0x14418a8c00000000, + 0xe49314fb00000000, 0x8bdfb16000000000, 0xfa40251200000000, + 0x950c808900000000, 0x65de1efe00000000, 0x0a92bb6500000000, + 0x857b231100000000, 0xea37868a00000000, 0x1ae518fd00000000, + 0x75a9bd6600000000, 0xf0b7633000000000, 0x9ffbc6ab00000000, + 0x6f2958dc00000000, 0x0065fd4700000000, 0x8f8c653300000000, + 0xe0c0c0a800000000, 0x10125edf00000000, 0x7f5efb4400000000, + 0x0ec16f3600000000, 0x618dcaad00000000, 0x915f54da00000000, + 0xfe13f14100000000, 0x71fa693500000000, 0x1eb6ccae00000000, + 0xee6452d900000000, 0x8128f74200000000, 0x0c5a7b3c00000000, + 0x6316dea700000000, 0x93c440d000000000, 0xfc88e54b00000000, + 0x73617d3f00000000, 0x1c2dd8a400000000, 0xecff46d300000000, + 0x83b3e34800000000, 0xf22c773a00000000, 0x9d60d2a100000000, + 0x6db24cd600000000, 0x02fee94d00000000, 0x8d17713900000000, + 0xe25bd4a200000000, 0x12894ad500000000, 0x7dc5ef4e00000000, + 0x086c522800000000, 0x6720f7b300000000, 0x97f269c400000000, + 0xf8becc5f00000000, 0x7757542b00000000, 0x181bf1b000000000, + 0xe8c96fc700000000, 0x8785ca5c00000000, 0xf61a5e2e00000000, + 0x9956fbb500000000, 0x698465c200000000, 0x06c8c05900000000, + 0x8921582d00000000, 0xe66dfdb600000000, 0x16bf63c100000000, + 0x79f3c65a00000000, 0xf4814a2400000000, 0x9bcdefbf00000000, + 0x6b1f71c800000000, 0x0453d45300000000, 0x8bba4c2700000000, + 0xe4f6e9bc00000000, 0x142477cb00000000, 0x7b68d25000000000, + 0x0af7462200000000, 0x65bbe3b900000000, 0x95697dce00000000, + 0xfa25d85500000000, 0x75cc402100000000, 0x1a80e5ba00000000, + 0xea527bcd00000000, 0x851ede5600000000, 0xe06fc76000000000, + 0x8f2362fb00000000, 0x7ff1fc8c00000000, 0x10bd591700000000, + 0x9f54c16300000000, 0xf01864f800000000, 0x00cafa8f00000000, + 0x6f865f1400000000, 0x1e19cb6600000000, 0x71556efd00000000, + 0x8187f08a00000000, 0xeecb551100000000, 0x6122cd6500000000, + 0x0e6e68fe00000000, 0xfebcf68900000000, 0x91f0531200000000, + 0x1c82df6c00000000, 0x73ce7af700000000, 0x831ce48000000000, + 0xec50411b00000000, 0x63b9d96f00000000, 0x0cf57cf400000000, + 0xfc27e28300000000, 0x936b471800000000, 0xe2f4d36a00000000, + 0x8db876f100000000, 0x7d6ae88600000000, 0x12264d1d00000000, + 0x9dcfd56900000000, 0xf28370f200000000, 0x0251ee8500000000, + 0x6d1d4b1e00000000, 0x18b4f67800000000, 0x77f853e300000000, + 0x872acd9400000000, 0xe866680f00000000, 0x678ff07b00000000, + 0x08c355e000000000, 0xf811cb9700000000, 0x975d6e0c00000000, + 0xe6c2fa7e00000000, 0x898e5fe500000000, 0x795cc19200000000, + 0x1610640900000000, 0x99f9fc7d00000000, 0xf6b559e600000000, + 0x0667c79100000000, 0x692b620a00000000, 0xe459ee7400000000, + 0x8b154bef00000000, 0x7bc7d59800000000, 0x148b700300000000, + 0x9b62e87700000000, 0xf42e4dec00000000, 0x04fcd39b00000000, + 0x6bb0760000000000, 0x1a2fe27200000000, 0x756347e900000000, + 0x85b1d99e00000000, 0xeafd7c0500000000, 0x6514e47100000000, + 0x0a5841ea00000000, 0xfa8adf9d00000000, 0x95c67a0600000000, + 0x10d8a45000000000, 0x7f9401cb00000000, 0x8f469fbc00000000, + 0xe00a3a2700000000, 0x6fe3a25300000000, 0x00af07c800000000, + 0xf07d99bf00000000, 0x9f313c2400000000, 0xeeaea85600000000, + 0x81e20dcd00000000, 0x713093ba00000000, 0x1e7c362100000000, + 0x9195ae5500000000, 0xfed90bce00000000, 0x0e0b95b900000000, + 0x6147302200000000, 0xec35bc5c00000000, 0x837919c700000000, + 0x73ab87b000000000, 0x1ce7222b00000000, 0x930eba5f00000000, + 0xfc421fc400000000, 0x0c9081b300000000, 0x63dc242800000000, + 0x1243b05a00000000, 0x7d0f15c100000000, 0x8ddd8bb600000000, + 0xe2912e2d00000000, 0x6d78b65900000000, 0x023413c200000000, + 0xf2e68db500000000, 0x9daa282e00000000, 0xe803954800000000, + 0x874f30d300000000, 0x779daea400000000, 0x18d10b3f00000000, + 0x9738934b00000000, 0xf87436d000000000, 0x08a6a8a700000000, + 0x67ea0d3c00000000, 0x1675994e00000000, 0x79393cd500000000, + 0x89eba2a200000000, 0xe6a7073900000000, 0x694e9f4d00000000, + 0x06023ad600000000, 0xf6d0a4a100000000, 0x999c013a00000000, + 0x14ee8d4400000000, 0x7ba228df00000000, 0x8b70b6a800000000, + 0xe43c133300000000, 0x6bd58b4700000000, 0x04992edc00000000, + 0xf44bb0ab00000000, 0x9b07153000000000, 0xea98814200000000, + 0x85d424d900000000, 0x7506baae00000000, 0x1a4a1f3500000000, + 0x95a3874100000000, 0xfaef22da00000000, 0x0a3dbcad00000000, + 0x6571193600000000}, + {0x0000000000000000, 0x85d996dd00000000, 0x4bb55c6000000000, + 0xce6ccabd00000000, 0x966ab9c000000000, 0x13b32f1d00000000, + 0xdddfe5a000000000, 0x5806737d00000000, 0x6dd3035a00000000, + 0xe80a958700000000, 0x26665f3a00000000, 0xa3bfc9e700000000, + 0xfbb9ba9a00000000, 0x7e602c4700000000, 0xb00ce6fa00000000, + 0x35d5702700000000, 0xdaa607b400000000, 0x5f7f916900000000, + 0x91135bd400000000, 0x14cacd0900000000, 0x4cccbe7400000000, + 0xc91528a900000000, 0x0779e21400000000, 0x82a074c900000000, + 0xb77504ee00000000, 0x32ac923300000000, 0xfcc0588e00000000, + 0x7919ce5300000000, 0x211fbd2e00000000, 0xa4c62bf300000000, + 0x6aaae14e00000000, 0xef73779300000000, 0xf54b7eb300000000, + 0x7092e86e00000000, 0xbefe22d300000000, 0x3b27b40e00000000, + 0x6321c77300000000, 0xe6f851ae00000000, 0x28949b1300000000, + 0xad4d0dce00000000, 0x98987de900000000, 0x1d41eb3400000000, + 0xd32d218900000000, 0x56f4b75400000000, 0x0ef2c42900000000, + 0x8b2b52f400000000, 0x4547984900000000, 0xc09e0e9400000000, + 0x2fed790700000000, 0xaa34efda00000000, 0x6458256700000000, + 0xe181b3ba00000000, 0xb987c0c700000000, 0x3c5e561a00000000, + 0xf2329ca700000000, 0x77eb0a7a00000000, 0x423e7a5d00000000, + 0xc7e7ec8000000000, 0x098b263d00000000, 0x8c52b0e000000000, + 0xd454c39d00000000, 0x518d554000000000, 0x9fe19ffd00000000, + 0x1a38092000000000, 0xab918dbd00000000, 0x2e481b6000000000, + 0xe024d1dd00000000, 0x65fd470000000000, 0x3dfb347d00000000, + 0xb822a2a000000000, 0x764e681d00000000, 0xf397fec000000000, + 0xc6428ee700000000, 0x439b183a00000000, 0x8df7d28700000000, + 0x082e445a00000000, 0x5028372700000000, 0xd5f1a1fa00000000, + 0x1b9d6b4700000000, 0x9e44fd9a00000000, 0x71378a0900000000, + 0xf4ee1cd400000000, 0x3a82d66900000000, 0xbf5b40b400000000, + 0xe75d33c900000000, 0x6284a51400000000, 0xace86fa900000000, + 0x2931f97400000000, 0x1ce4895300000000, 0x993d1f8e00000000, + 0x5751d53300000000, 0xd28843ee00000000, 0x8a8e309300000000, + 0x0f57a64e00000000, 0xc13b6cf300000000, 0x44e2fa2e00000000, + 0x5edaf30e00000000, 0xdb0365d300000000, 0x156faf6e00000000, + 0x90b639b300000000, 0xc8b04ace00000000, 0x4d69dc1300000000, + 0x830516ae00000000, 0x06dc807300000000, 0x3309f05400000000, + 0xb6d0668900000000, 0x78bcac3400000000, 0xfd653ae900000000, + 0xa563499400000000, 0x20badf4900000000, 0xeed615f400000000, + 0x6b0f832900000000, 0x847cf4ba00000000, 0x01a5626700000000, + 0xcfc9a8da00000000, 0x4a103e0700000000, 0x12164d7a00000000, + 0x97cfdba700000000, 0x59a3111a00000000, 0xdc7a87c700000000, + 0xe9aff7e000000000, 0x6c76613d00000000, 0xa21aab8000000000, + 0x27c33d5d00000000, 0x7fc54e2000000000, 0xfa1cd8fd00000000, + 0x3470124000000000, 0xb1a9849d00000000, 0x17256aa000000000, + 0x92fcfc7d00000000, 0x5c9036c000000000, 0xd949a01d00000000, + 0x814fd36000000000, 0x049645bd00000000, 0xcafa8f0000000000, + 0x4f2319dd00000000, 0x7af669fa00000000, 0xff2fff2700000000, + 0x3143359a00000000, 0xb49aa34700000000, 0xec9cd03a00000000, + 0x694546e700000000, 0xa7298c5a00000000, 0x22f01a8700000000, + 0xcd836d1400000000, 0x485afbc900000000, 0x8636317400000000, + 0x03efa7a900000000, 0x5be9d4d400000000, 0xde30420900000000, + 0x105c88b400000000, 0x95851e6900000000, 0xa0506e4e00000000, + 0x2589f89300000000, 0xebe5322e00000000, 0x6e3ca4f300000000, + 0x363ad78e00000000, 0xb3e3415300000000, 0x7d8f8bee00000000, + 0xf8561d3300000000, 0xe26e141300000000, 0x67b782ce00000000, + 0xa9db487300000000, 0x2c02deae00000000, 0x7404add300000000, + 0xf1dd3b0e00000000, 0x3fb1f1b300000000, 0xba68676e00000000, + 0x8fbd174900000000, 0x0a64819400000000, 0xc4084b2900000000, + 0x41d1ddf400000000, 0x19d7ae8900000000, 0x9c0e385400000000, + 0x5262f2e900000000, 0xd7bb643400000000, 0x38c813a700000000, + 0xbd11857a00000000, 0x737d4fc700000000, 0xf6a4d91a00000000, + 0xaea2aa6700000000, 0x2b7b3cba00000000, 0xe517f60700000000, + 0x60ce60da00000000, 0x551b10fd00000000, 0xd0c2862000000000, + 0x1eae4c9d00000000, 0x9b77da4000000000, 0xc371a93d00000000, + 0x46a83fe000000000, 0x88c4f55d00000000, 0x0d1d638000000000, + 0xbcb4e71d00000000, 0x396d71c000000000, 0xf701bb7d00000000, + 0x72d82da000000000, 0x2ade5edd00000000, 0xaf07c80000000000, + 0x616b02bd00000000, 0xe4b2946000000000, 0xd167e44700000000, + 0x54be729a00000000, 0x9ad2b82700000000, 0x1f0b2efa00000000, + 0x470d5d8700000000, 0xc2d4cb5a00000000, 0x0cb801e700000000, + 0x8961973a00000000, 0x6612e0a900000000, 0xe3cb767400000000, + 0x2da7bcc900000000, 0xa87e2a1400000000, 0xf078596900000000, + 0x75a1cfb400000000, 0xbbcd050900000000, 0x3e1493d400000000, + 0x0bc1e3f300000000, 0x8e18752e00000000, 0x4074bf9300000000, + 0xc5ad294e00000000, 0x9dab5a3300000000, 0x1872ccee00000000, + 0xd61e065300000000, 0x53c7908e00000000, 0x49ff99ae00000000, + 0xcc260f7300000000, 0x024ac5ce00000000, 0x8793531300000000, + 0xdf95206e00000000, 0x5a4cb6b300000000, 0x94207c0e00000000, + 0x11f9ead300000000, 0x242c9af400000000, 0xa1f50c2900000000, + 0x6f99c69400000000, 0xea40504900000000, 0xb246233400000000, + 0x379fb5e900000000, 0xf9f37f5400000000, 0x7c2ae98900000000, + 0x93599e1a00000000, 0x168008c700000000, 0xd8ecc27a00000000, + 0x5d3554a700000000, 0x053327da00000000, 0x80eab10700000000, + 0x4e867bba00000000, 0xcb5fed6700000000, 0xfe8a9d4000000000, + 0x7b530b9d00000000, 0xb53fc12000000000, 0x30e657fd00000000, + 0x68e0248000000000, 0xed39b25d00000000, 0x235578e000000000, + 0xa68cee3d00000000}, + {0x0000000000000000, 0x76e10f9d00000000, 0xadc46ee100000000, + 0xdb25617c00000000, 0x1b8fac1900000000, 0x6d6ea38400000000, + 0xb64bc2f800000000, 0xc0aacd6500000000, 0x361e593300000000, + 0x40ff56ae00000000, 0x9bda37d200000000, 0xed3b384f00000000, + 0x2d91f52a00000000, 0x5b70fab700000000, 0x80559bcb00000000, + 0xf6b4945600000000, 0x6c3cb26600000000, 0x1addbdfb00000000, + 0xc1f8dc8700000000, 0xb719d31a00000000, 0x77b31e7f00000000, + 0x015211e200000000, 0xda77709e00000000, 0xac967f0300000000, + 0x5a22eb5500000000, 0x2cc3e4c800000000, 0xf7e685b400000000, + 0x81078a2900000000, 0x41ad474c00000000, 0x374c48d100000000, + 0xec6929ad00000000, 0x9a88263000000000, 0xd87864cd00000000, + 0xae996b5000000000, 0x75bc0a2c00000000, 0x035d05b100000000, + 0xc3f7c8d400000000, 0xb516c74900000000, 0x6e33a63500000000, + 0x18d2a9a800000000, 0xee663dfe00000000, 0x9887326300000000, + 0x43a2531f00000000, 0x35435c8200000000, 0xf5e991e700000000, + 0x83089e7a00000000, 0x582dff0600000000, 0x2eccf09b00000000, + 0xb444d6ab00000000, 0xc2a5d93600000000, 0x1980b84a00000000, + 0x6f61b7d700000000, 0xafcb7ab200000000, 0xd92a752f00000000, + 0x020f145300000000, 0x74ee1bce00000000, 0x825a8f9800000000, + 0xf4bb800500000000, 0x2f9ee17900000000, 0x597feee400000000, + 0x99d5238100000000, 0xef342c1c00000000, 0x34114d6000000000, + 0x42f042fd00000000, 0xf1f7b94100000000, 0x8716b6dc00000000, + 0x5c33d7a000000000, 0x2ad2d83d00000000, 0xea78155800000000, + 0x9c991ac500000000, 0x47bc7bb900000000, 0x315d742400000000, + 0xc7e9e07200000000, 0xb108efef00000000, 0x6a2d8e9300000000, + 0x1ccc810e00000000, 0xdc664c6b00000000, 0xaa8743f600000000, + 0x71a2228a00000000, 0x07432d1700000000, 0x9dcb0b2700000000, + 0xeb2a04ba00000000, 0x300f65c600000000, 0x46ee6a5b00000000, + 0x8644a73e00000000, 0xf0a5a8a300000000, 0x2b80c9df00000000, + 0x5d61c64200000000, 0xabd5521400000000, 0xdd345d8900000000, + 0x06113cf500000000, 0x70f0336800000000, 0xb05afe0d00000000, + 0xc6bbf19000000000, 0x1d9e90ec00000000, 0x6b7f9f7100000000, + 0x298fdd8c00000000, 0x5f6ed21100000000, 0x844bb36d00000000, + 0xf2aabcf000000000, 0x3200719500000000, 0x44e17e0800000000, + 0x9fc41f7400000000, 0xe92510e900000000, 0x1f9184bf00000000, + 0x69708b2200000000, 0xb255ea5e00000000, 0xc4b4e5c300000000, + 0x041e28a600000000, 0x72ff273b00000000, 0xa9da464700000000, + 0xdf3b49da00000000, 0x45b36fea00000000, 0x3352607700000000, + 0xe877010b00000000, 0x9e960e9600000000, 0x5e3cc3f300000000, + 0x28ddcc6e00000000, 0xf3f8ad1200000000, 0x8519a28f00000000, + 0x73ad36d900000000, 0x054c394400000000, 0xde69583800000000, + 0xa88857a500000000, 0x68229ac000000000, 0x1ec3955d00000000, + 0xc5e6f42100000000, 0xb307fbbc00000000, 0xe2ef738300000000, + 0x940e7c1e00000000, 0x4f2b1d6200000000, 0x39ca12ff00000000, + 0xf960df9a00000000, 0x8f81d00700000000, 0x54a4b17b00000000, + 0x2245bee600000000, 0xd4f12ab000000000, 0xa210252d00000000, + 0x7935445100000000, 0x0fd44bcc00000000, 0xcf7e86a900000000, + 0xb99f893400000000, 0x62bae84800000000, 0x145be7d500000000, + 0x8ed3c1e500000000, 0xf832ce7800000000, 0x2317af0400000000, + 0x55f6a09900000000, 0x955c6dfc00000000, 0xe3bd626100000000, + 0x3898031d00000000, 0x4e790c8000000000, 0xb8cd98d600000000, + 0xce2c974b00000000, 0x1509f63700000000, 0x63e8f9aa00000000, + 0xa34234cf00000000, 0xd5a33b5200000000, 0x0e865a2e00000000, + 0x786755b300000000, 0x3a97174e00000000, 0x4c7618d300000000, + 0x975379af00000000, 0xe1b2763200000000, 0x2118bb5700000000, + 0x57f9b4ca00000000, 0x8cdcd5b600000000, 0xfa3dda2b00000000, + 0x0c894e7d00000000, 0x7a6841e000000000, 0xa14d209c00000000, + 0xd7ac2f0100000000, 0x1706e26400000000, 0x61e7edf900000000, + 0xbac28c8500000000, 0xcc23831800000000, 0x56aba52800000000, + 0x204aaab500000000, 0xfb6fcbc900000000, 0x8d8ec45400000000, + 0x4d24093100000000, 0x3bc506ac00000000, 0xe0e067d000000000, + 0x9601684d00000000, 0x60b5fc1b00000000, 0x1654f38600000000, + 0xcd7192fa00000000, 0xbb909d6700000000, 0x7b3a500200000000, + 0x0ddb5f9f00000000, 0xd6fe3ee300000000, 0xa01f317e00000000, + 0x1318cac200000000, 0x65f9c55f00000000, 0xbedca42300000000, + 0xc83dabbe00000000, 0x089766db00000000, 0x7e76694600000000, + 0xa553083a00000000, 0xd3b207a700000000, 0x250693f100000000, + 0x53e79c6c00000000, 0x88c2fd1000000000, 0xfe23f28d00000000, + 0x3e893fe800000000, 0x4868307500000000, 0x934d510900000000, + 0xe5ac5e9400000000, 0x7f2478a400000000, 0x09c5773900000000, + 0xd2e0164500000000, 0xa40119d800000000, 0x64abd4bd00000000, + 0x124adb2000000000, 0xc96fba5c00000000, 0xbf8eb5c100000000, + 0x493a219700000000, 0x3fdb2e0a00000000, 0xe4fe4f7600000000, + 0x921f40eb00000000, 0x52b58d8e00000000, 0x2454821300000000, + 0xff71e36f00000000, 0x8990ecf200000000, 0xcb60ae0f00000000, + 0xbd81a19200000000, 0x66a4c0ee00000000, 0x1045cf7300000000, + 0xd0ef021600000000, 0xa60e0d8b00000000, 0x7d2b6cf700000000, + 0x0bca636a00000000, 0xfd7ef73c00000000, 0x8b9ff8a100000000, + 0x50ba99dd00000000, 0x265b964000000000, 0xe6f15b2500000000, + 0x901054b800000000, 0x4b3535c400000000, 0x3dd43a5900000000, + 0xa75c1c6900000000, 0xd1bd13f400000000, 0x0a98728800000000, + 0x7c797d1500000000, 0xbcd3b07000000000, 0xca32bfed00000000, + 0x1117de9100000000, 0x67f6d10c00000000, 0x9142455a00000000, + 0xe7a34ac700000000, 0x3c862bbb00000000, 0x4a67242600000000, + 0x8acde94300000000, 0xfc2ce6de00000000, 0x270987a200000000, + 0x51e8883f00000000}, + {0x0000000000000000, 0xe8dbfbb900000000, 0x91b186a800000000, + 0x796a7d1100000000, 0x63657c8a00000000, 0x8bbe873300000000, + 0xf2d4fa2200000000, 0x1a0f019b00000000, 0x87cc89cf00000000, + 0x6f17727600000000, 0x167d0f6700000000, 0xfea6f4de00000000, + 0xe4a9f54500000000, 0x0c720efc00000000, 0x751873ed00000000, + 0x9dc3885400000000, 0x4f9f624400000000, 0xa74499fd00000000, + 0xde2ee4ec00000000, 0x36f51f5500000000, 0x2cfa1ece00000000, + 0xc421e57700000000, 0xbd4b986600000000, 0x559063df00000000, + 0xc853eb8b00000000, 0x2088103200000000, 0x59e26d2300000000, + 0xb139969a00000000, 0xab36970100000000, 0x43ed6cb800000000, + 0x3a8711a900000000, 0xd25cea1000000000, 0x9e3ec58800000000, + 0x76e53e3100000000, 0x0f8f432000000000, 0xe754b89900000000, + 0xfd5bb90200000000, 0x158042bb00000000, 0x6cea3faa00000000, + 0x8431c41300000000, 0x19f24c4700000000, 0xf129b7fe00000000, + 0x8843caef00000000, 0x6098315600000000, 0x7a9730cd00000000, + 0x924ccb7400000000, 0xeb26b66500000000, 0x03fd4ddc00000000, + 0xd1a1a7cc00000000, 0x397a5c7500000000, 0x4010216400000000, + 0xa8cbdadd00000000, 0xb2c4db4600000000, 0x5a1f20ff00000000, + 0x23755dee00000000, 0xcbaea65700000000, 0x566d2e0300000000, + 0xbeb6d5ba00000000, 0xc7dca8ab00000000, 0x2f07531200000000, + 0x3508528900000000, 0xddd3a93000000000, 0xa4b9d42100000000, + 0x4c622f9800000000, 0x7d7bfbca00000000, 0x95a0007300000000, + 0xecca7d6200000000, 0x041186db00000000, 0x1e1e874000000000, + 0xf6c57cf900000000, 0x8faf01e800000000, 0x6774fa5100000000, + 0xfab7720500000000, 0x126c89bc00000000, 0x6b06f4ad00000000, + 0x83dd0f1400000000, 0x99d20e8f00000000, 0x7109f53600000000, + 0x0863882700000000, 0xe0b8739e00000000, 0x32e4998e00000000, + 0xda3f623700000000, 0xa3551f2600000000, 0x4b8ee49f00000000, + 0x5181e50400000000, 0xb95a1ebd00000000, 0xc03063ac00000000, + 0x28eb981500000000, 0xb528104100000000, 0x5df3ebf800000000, + 0x249996e900000000, 0xcc426d5000000000, 0xd64d6ccb00000000, + 0x3e96977200000000, 0x47fcea6300000000, 0xaf2711da00000000, + 0xe3453e4200000000, 0x0b9ec5fb00000000, 0x72f4b8ea00000000, + 0x9a2f435300000000, 0x802042c800000000, 0x68fbb97100000000, + 0x1191c46000000000, 0xf94a3fd900000000, 0x6489b78d00000000, + 0x8c524c3400000000, 0xf538312500000000, 0x1de3ca9c00000000, + 0x07eccb0700000000, 0xef3730be00000000, 0x965d4daf00000000, + 0x7e86b61600000000, 0xacda5c0600000000, 0x4401a7bf00000000, + 0x3d6bdaae00000000, 0xd5b0211700000000, 0xcfbf208c00000000, + 0x2764db3500000000, 0x5e0ea62400000000, 0xb6d55d9d00000000, + 0x2b16d5c900000000, 0xc3cd2e7000000000, 0xbaa7536100000000, + 0x527ca8d800000000, 0x4873a94300000000, 0xa0a852fa00000000, + 0xd9c22feb00000000, 0x3119d45200000000, 0xbbf0874e00000000, + 0x532b7cf700000000, 0x2a4101e600000000, 0xc29afa5f00000000, + 0xd895fbc400000000, 0x304e007d00000000, 0x49247d6c00000000, + 0xa1ff86d500000000, 0x3c3c0e8100000000, 0xd4e7f53800000000, + 0xad8d882900000000, 0x4556739000000000, 0x5f59720b00000000, + 0xb78289b200000000, 0xcee8f4a300000000, 0x26330f1a00000000, + 0xf46fe50a00000000, 0x1cb41eb300000000, 0x65de63a200000000, + 0x8d05981b00000000, 0x970a998000000000, 0x7fd1623900000000, + 0x06bb1f2800000000, 0xee60e49100000000, 0x73a36cc500000000, + 0x9b78977c00000000, 0xe212ea6d00000000, 0x0ac911d400000000, + 0x10c6104f00000000, 0xf81debf600000000, 0x817796e700000000, + 0x69ac6d5e00000000, 0x25ce42c600000000, 0xcd15b97f00000000, + 0xb47fc46e00000000, 0x5ca43fd700000000, 0x46ab3e4c00000000, + 0xae70c5f500000000, 0xd71ab8e400000000, 0x3fc1435d00000000, + 0xa202cb0900000000, 0x4ad930b000000000, 0x33b34da100000000, + 0xdb68b61800000000, 0xc167b78300000000, 0x29bc4c3a00000000, + 0x50d6312b00000000, 0xb80dca9200000000, 0x6a51208200000000, + 0x828adb3b00000000, 0xfbe0a62a00000000, 0x133b5d9300000000, + 0x09345c0800000000, 0xe1efa7b100000000, 0x9885daa000000000, + 0x705e211900000000, 0xed9da94d00000000, 0x054652f400000000, + 0x7c2c2fe500000000, 0x94f7d45c00000000, 0x8ef8d5c700000000, + 0x66232e7e00000000, 0x1f49536f00000000, 0xf792a8d600000000, + 0xc68b7c8400000000, 0x2e50873d00000000, 0x573afa2c00000000, + 0xbfe1019500000000, 0xa5ee000e00000000, 0x4d35fbb700000000, + 0x345f86a600000000, 0xdc847d1f00000000, 0x4147f54b00000000, + 0xa99c0ef200000000, 0xd0f673e300000000, 0x382d885a00000000, + 0x222289c100000000, 0xcaf9727800000000, 0xb3930f6900000000, + 0x5b48f4d000000000, 0x89141ec000000000, 0x61cfe57900000000, + 0x18a5986800000000, 0xf07e63d100000000, 0xea71624a00000000, + 0x02aa99f300000000, 0x7bc0e4e200000000, 0x931b1f5b00000000, + 0x0ed8970f00000000, 0xe6036cb600000000, 0x9f6911a700000000, + 0x77b2ea1e00000000, 0x6dbdeb8500000000, 0x8566103c00000000, + 0xfc0c6d2d00000000, 0x14d7969400000000, 0x58b5b90c00000000, + 0xb06e42b500000000, 0xc9043fa400000000, 0x21dfc41d00000000, + 0x3bd0c58600000000, 0xd30b3e3f00000000, 0xaa61432e00000000, + 0x42bab89700000000, 0xdf7930c300000000, 0x37a2cb7a00000000, + 0x4ec8b66b00000000, 0xa6134dd200000000, 0xbc1c4c4900000000, + 0x54c7b7f000000000, 0x2dadcae100000000, 0xc576315800000000, + 0x172adb4800000000, 0xfff120f100000000, 0x869b5de000000000, + 0x6e40a65900000000, 0x744fa7c200000000, 0x9c945c7b00000000, + 0xe5fe216a00000000, 0x0d25dad300000000, 0x90e6528700000000, + 0x783da93e00000000, 0x0157d42f00000000, 0xe98c2f9600000000, + 0xf3832e0d00000000, 0x1b58d5b400000000, 0x6232a8a500000000, + 0x8ae9531c00000000}, + {0x0000000000000000, 0x919168ae00000000, 0x6325a08700000000, + 0xf2b4c82900000000, 0x874c31d400000000, 0x16dd597a00000000, + 0xe469915300000000, 0x75f8f9fd00000000, 0x4f9f137300000000, + 0xde0e7bdd00000000, 0x2cbab3f400000000, 0xbd2bdb5a00000000, + 0xc8d322a700000000, 0x59424a0900000000, 0xabf6822000000000, + 0x3a67ea8e00000000, 0x9e3e27e600000000, 0x0faf4f4800000000, + 0xfd1b876100000000, 0x6c8aefcf00000000, 0x1972163200000000, + 0x88e37e9c00000000, 0x7a57b6b500000000, 0xebc6de1b00000000, + 0xd1a1349500000000, 0x40305c3b00000000, 0xb284941200000000, + 0x2315fcbc00000000, 0x56ed054100000000, 0xc77c6def00000000, + 0x35c8a5c600000000, 0xa459cd6800000000, 0x7d7b3f1700000000, + 0xecea57b900000000, 0x1e5e9f9000000000, 0x8fcff73e00000000, + 0xfa370ec300000000, 0x6ba6666d00000000, 0x9912ae4400000000, + 0x0883c6ea00000000, 0x32e42c6400000000, 0xa37544ca00000000, + 0x51c18ce300000000, 0xc050e44d00000000, 0xb5a81db000000000, + 0x2439751e00000000, 0xd68dbd3700000000, 0x471cd59900000000, + 0xe34518f100000000, 0x72d4705f00000000, 0x8060b87600000000, + 0x11f1d0d800000000, 0x6409292500000000, 0xf598418b00000000, + 0x072c89a200000000, 0x96bde10c00000000, 0xacda0b8200000000, + 0x3d4b632c00000000, 0xcfffab0500000000, 0x5e6ec3ab00000000, + 0x2b963a5600000000, 0xba0752f800000000, 0x48b39ad100000000, + 0xd922f27f00000000, 0xfaf67e2e00000000, 0x6b67168000000000, + 0x99d3dea900000000, 0x0842b60700000000, 0x7dba4ffa00000000, + 0xec2b275400000000, 0x1e9fef7d00000000, 0x8f0e87d300000000, + 0xb5696d5d00000000, 0x24f805f300000000, 0xd64ccdda00000000, + 0x47dda57400000000, 0x32255c8900000000, 0xa3b4342700000000, + 0x5100fc0e00000000, 0xc09194a000000000, 0x64c859c800000000, + 0xf559316600000000, 0x07edf94f00000000, 0x967c91e100000000, + 0xe384681c00000000, 0x721500b200000000, 0x80a1c89b00000000, + 0x1130a03500000000, 0x2b574abb00000000, 0xbac6221500000000, + 0x4872ea3c00000000, 0xd9e3829200000000, 0xac1b7b6f00000000, + 0x3d8a13c100000000, 0xcf3edbe800000000, 0x5eafb34600000000, + 0x878d413900000000, 0x161c299700000000, 0xe4a8e1be00000000, + 0x7539891000000000, 0x00c170ed00000000, 0x9150184300000000, + 0x63e4d06a00000000, 0xf275b8c400000000, 0xc812524a00000000, + 0x59833ae400000000, 0xab37f2cd00000000, 0x3aa69a6300000000, + 0x4f5e639e00000000, 0xdecf0b3000000000, 0x2c7bc31900000000, + 0xbdeaabb700000000, 0x19b366df00000000, 0x88220e7100000000, + 0x7a96c65800000000, 0xeb07aef600000000, 0x9eff570b00000000, + 0x0f6e3fa500000000, 0xfddaf78c00000000, 0x6c4b9f2200000000, + 0x562c75ac00000000, 0xc7bd1d0200000000, 0x3509d52b00000000, + 0xa498bd8500000000, 0xd160447800000000, 0x40f12cd600000000, + 0xb245e4ff00000000, 0x23d48c5100000000, 0xf4edfd5c00000000, + 0x657c95f200000000, 0x97c85ddb00000000, 0x0659357500000000, + 0x73a1cc8800000000, 0xe230a42600000000, 0x10846c0f00000000, + 0x811504a100000000, 0xbb72ee2f00000000, 0x2ae3868100000000, + 0xd8574ea800000000, 0x49c6260600000000, 0x3c3edffb00000000, + 0xadafb75500000000, 0x5f1b7f7c00000000, 0xce8a17d200000000, + 0x6ad3daba00000000, 0xfb42b21400000000, 0x09f67a3d00000000, + 0x9867129300000000, 0xed9feb6e00000000, 0x7c0e83c000000000, + 0x8eba4be900000000, 0x1f2b234700000000, 0x254cc9c900000000, + 0xb4dda16700000000, 0x4669694e00000000, 0xd7f801e000000000, + 0xa200f81d00000000, 0x339190b300000000, 0xc125589a00000000, + 0x50b4303400000000, 0x8996c24b00000000, 0x1807aae500000000, + 0xeab362cc00000000, 0x7b220a6200000000, 0x0edaf39f00000000, + 0x9f4b9b3100000000, 0x6dff531800000000, 0xfc6e3bb600000000, + 0xc609d13800000000, 0x5798b99600000000, 0xa52c71bf00000000, + 0x34bd191100000000, 0x4145e0ec00000000, 0xd0d4884200000000, + 0x2260406b00000000, 0xb3f128c500000000, 0x17a8e5ad00000000, + 0x86398d0300000000, 0x748d452a00000000, 0xe51c2d8400000000, + 0x90e4d47900000000, 0x0175bcd700000000, 0xf3c174fe00000000, + 0x62501c5000000000, 0x5837f6de00000000, 0xc9a69e7000000000, + 0x3b12565900000000, 0xaa833ef700000000, 0xdf7bc70a00000000, + 0x4eeaafa400000000, 0xbc5e678d00000000, 0x2dcf0f2300000000, + 0x0e1b837200000000, 0x9f8aebdc00000000, 0x6d3e23f500000000, + 0xfcaf4b5b00000000, 0x8957b2a600000000, 0x18c6da0800000000, + 0xea72122100000000, 0x7be37a8f00000000, 0x4184900100000000, + 0xd015f8af00000000, 0x22a1308600000000, 0xb330582800000000, + 0xc6c8a1d500000000, 0x5759c97b00000000, 0xa5ed015200000000, + 0x347c69fc00000000, 0x9025a49400000000, 0x01b4cc3a00000000, + 0xf300041300000000, 0x62916cbd00000000, 0x1769954000000000, + 0x86f8fdee00000000, 0x744c35c700000000, 0xe5dd5d6900000000, + 0xdfbab7e700000000, 0x4e2bdf4900000000, 0xbc9f176000000000, + 0x2d0e7fce00000000, 0x58f6863300000000, 0xc967ee9d00000000, + 0x3bd326b400000000, 0xaa424e1a00000000, 0x7360bc6500000000, + 0xe2f1d4cb00000000, 0x10451ce200000000, 0x81d4744c00000000, + 0xf42c8db100000000, 0x65bde51f00000000, 0x97092d3600000000, + 0x0698459800000000, 0x3cffaf1600000000, 0xad6ec7b800000000, + 0x5fda0f9100000000, 0xce4b673f00000000, 0xbbb39ec200000000, + 0x2a22f66c00000000, 0xd8963e4500000000, 0x490756eb00000000, + 0xed5e9b8300000000, 0x7ccff32d00000000, 0x8e7b3b0400000000, + 0x1fea53aa00000000, 0x6a12aa5700000000, 0xfb83c2f900000000, + 0x09370ad000000000, 0x98a6627e00000000, 0xa2c188f000000000, + 0x3350e05e00000000, 0xc1e4287700000000, 0x507540d900000000, + 0x258db92400000000, 0xb41cd18a00000000, 0x46a819a300000000, + 0xd739710d00000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, 0x844a0efa, + 0x48e00e64, 0xc66f0987, 0x0ac50919, 0xd3e51bb5, 0x1f4f1b2b, + 0x91c01cc8, 0x5d6a1c56, 0x57af154f, 0x9b0515d1, 0x158a1232, + 0xd92012ac, 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, 0xaf5e2a9e, + 0x63f42a00, 0xed7b2de3, 0x21d12d7d, 0x2b142464, 0xe7be24fa, + 0x69312319, 0xa59b2387, 0xf9766256, 0x35dc62c8, 0xbb53652b, + 0x77f965b5, 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, 0xaed97719, + 0x62737787, 0xecfc7064, 0x205670fa, 0x85cd537d, 0x496753e3, + 0xc7e85400, 0x0b42549e, 0x01875d87, 0xcd2d5d19, 0x43a25afa, + 0x8f085a64, 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, 0x299dc2ed, + 0xe537c273, 0x6bb8c590, 0xa712c50e, 0xadd7cc17, 0x617dcc89, + 0xeff2cb6a, 0x2358cbf4, 0xfa78d958, 0x36d2d9c6, 0xb85dde25, + 0x74f7debb, 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, 0xd16cfd3c, + 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, 0x86c3e873, 0x4a69e8ed, + 0xc4e6ef0e, 0x084cef90, 0x0289e689, 0xce23e617, 0x40ace1f4, + 0x8c06e16a, 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, 0x030ebb0e, + 0xcfa4bb90, 0x412bbc73, 0x8d81bced, 0x8744b5f4, 0x4beeb56a, + 0xc561b289, 0x09cbb217, 0xac509190, 0x60fa910e, 0xee7596ed, + 0x22df9673, 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, 0xfbff84df, + 0x37558441, 0xb9da83a2, 0x7570833c, 0x533b85da, 0x9f918544, + 0x111e82a7, 0xddb48239, 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, + 0x59fe8cc3, 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, 0x2f80b4f1, + 0xe32ab46f, 0x6da5b38c, 0xa10fb312, 0xabcaba0b, 0x6760ba95, + 0xe9efbd76, 0x2545bde8, 0xfc65af44, 0x30cfafda, 0xbe40a839, + 0x72eaa8a7, 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, 0x2e07e976, + 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, 0x79a8fc39, 0xb502fca7, + 0x3b8dfb44, 0xf727fbda, 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, + 0x736df520, 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, 0x0513cd12, + 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, 0x8159c3e8, 0x4df3c376, + 0xc37cc495, 0x0fd6c40b, 0x7aa64737, 0xb60c47a9, 0x3883404a, + 0xf42940d4, 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, 0x2d095278, + 0xe1a352e6, 0x6f2c5505, 0xa386559b, 0x061d761c, 0xcab77682, + 0x44387161, 0x889271ff, 0x825778e6, 0x4efd7878, 0xc0727f9b, + 0x0cd87f05, 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, 0x83d02561, + 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, + 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, + 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, + 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, + 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, + 0x264b06e6}, + {0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, 0xf44f2413, + 0x52382fa7, 0x63d0353a, 0xc5a73e8e, 0x33ef4e67, 0x959845d3, + 0xa4705f4e, 0x020754fa, 0xc7a06a74, 0x61d761c0, 0x503f7b5d, + 0xf64870e9, 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, 0x5431d2a9, + 0xf246d91d, 0xc3aec380, 0x65d9c834, 0xa07ef6ba, 0x0609fd0e, + 0x37e1e793, 0x9196ec27, 0xcfbd399c, 0x69ca3228, 0x582228b5, + 0xfe552301, 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, 0x081d53e8, + 0xae6a585c, 0x9f8242c1, 0x39f54975, 0xa863a552, 0x0e14aee6, + 0x3ffcb47b, 0x998bbfcf, 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, + 0x6dc49bdc, 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, 0x440b7579, + 0xe27c7ecd, 0xd3946450, 0x75e36fe4, 0xb044516a, 0x16335ade, + 0x27db4043, 0x81ac4bf7, 0x77e43b1e, 0xd19330aa, 0xe07b2a37, + 0x460c2183, 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, 0xd79acda4, + 0x71edc610, 0x4005dc8d, 0xe672d739, 0x103aa7d0, 0xb64dac64, + 0x87a5b6f9, 0x21d2bd4d, 0xe47583c3, 0x42028877, 0x73ea92ea, + 0xd59d995e, 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, 0xb8590282, + 0x1e2e0936, 0x2fc613ab, 0x89b1181f, 0x4c162691, 0xea612d25, + 0xdb8937b8, 0x7dfe3c0c, 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, + 0xdd80cab6, 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, 0x2bc8ba5f, + 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, 0x8816eaf2, 0x2e61e146, + 0x1f89fbdb, 0xb9fef06f, 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, + 0x4db1d47c, 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, 0xefc8763c, + 0x49bf7d88, 0x78576715, 0xde206ca1, 0x1b87522f, 0xbdf0599b, + 0x8c184306, 0x2a6f48b2, 0xdc27385b, 0x7a5033ef, 0x4bb82972, + 0xedcf22c6, 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, 0xb3e4f77d, + 0x1593fcc9, 0x247be654, 0x820cede0, 0x74449d09, 0xd23396bd, + 0xe3db8c20, 0x45ac8794, 0x800bb91a, 0x267cb2ae, 0x1794a833, + 0xb1e3a387, 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, 0x139a01c7, + 0xb5ed0a73, 0x840510ee, 0x22721b5a, 0xe7d525d4, 0x41a22e60, + 0x704a34fd, 0xd63d3f49, 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, + 0xfdf58516, 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, 0x0bbdf5ff, + 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, 0xabc30345, 0x0db408f1, + 0x3c5c126c, 0x9a2b19d8, 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, + 0x6e643dcb, 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, 0x03a0a617, + 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, 0xf7ef8204, 0x519889b0, + 0x6070932d, 0xc6079899, 0x304fe870, 0x9638e3c4, 0xa7d0f959, + 0x01a7f2ed, 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, 0x90311eca, + 0x3646157e, 0x07ae0fe3, 0xa1d90457, 0x579174be, 0xf1e67f0a, + 0xc00e6597, 0x66796e23, 0xa3de50ad, 0x05a95b19, 0x34414184, + 0x92364a30}, + {0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, 0x9b914216, + 0x50cd91b3, 0xd659e31d, 0x1d0530b8, 0xec53826d, 0x270f51c8, + 0xa19b2366, 0x6ac7f0c3, 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, + 0xf156b2d5, 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, 0xef8580f6, + 0x24d95353, 0xa24d21fd, 0x6911f258, 0x7414c2e0, 0xbf481145, + 0x39dc63eb, 0xf280b04e, 0x07ac0536, 0xccf0d693, 0x4a64a43d, + 0x81387798, 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, 0x706ec54d, + 0xbb3216e8, 0x3da66446, 0xf6fab7e3, 0x047a07ad, 0xcf26d408, + 0x49b2a6a6, 0x82ee7503, 0x9feb45bb, 0x54b7961e, 0xd223e4b0, + 0x197f3715, 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, 0x0f580a6c, + 0xc404d9c9, 0x4290ab67, 0x89cc78c2, 0x94c9487a, 0x5f959bdf, + 0xd901e971, 0x125d3ad4, 0xe30b8801, 0x28575ba4, 0xaec3290a, + 0x659ffaaf, 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, 0x971f4ae1, + 0x5c439944, 0xdad7ebea, 0x118b384f, 0xe0dd8a9a, 0x2b81593f, + 0xad152b91, 0x6649f834, 0x7b4cc88c, 0xb0101b29, 0x36846987, + 0xfdd8ba22, 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, 0xe4a78d37, + 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, 0x7f36cf21, 0xb46a1c84, + 0x32fe6e2a, 0xf9a2bd8f, 0x0b220dc1, 0xc07ede64, 0x46eaacca, + 0x8db67f6f, 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, 0x7ce0cdba, + 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, 0x1eb014d8, 0xd5ecc77d, + 0x5378b5d3, 0x98246676, 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, + 0x03b52460, 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, 0x1d661643, + 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, 0x86f75455, 0x4dab87f0, + 0xcb3ff55e, 0x006326fb, 0xf135942e, 0x3a69478b, 0xbcfd3525, + 0x77a1e680, 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, 0x828d53f8, + 0x49d1805d, 0xcf45f2f3, 0x04192156, 0xf54f9383, 0x3e134026, + 0xb8873288, 0x73dbe12d, 0x6eded195, 0xa5820230, 0x2316709e, + 0xe84aa33b, 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, 0xf6999118, + 0x3dc542bd, 0xbb513013, 0x700de3b6, 0x6d08d30e, 0xa65400ab, + 0x20c07205, 0xeb9ca1a0, 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, + 0x977c6c1a, 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, 0x662adecf, + 0xad760d6a, 0x2be27fc4, 0xe0beac61, 0x123e1c2f, 0xd962cf8a, + 0x5ff6bd24, 0x94aa6e81, 0x89af5e39, 0x42f38d9c, 0xc467ff32, + 0x0f3b2c97, 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, 0x16441b82, + 0xdd18c827, 0x5b8cba89, 0x90d0692c, 0x8dd55994, 0x46898a31, + 0xc01df89f, 0x0b412b3a, 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, + 0x7c83eb41, 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, 0x8e035b0f, + 0x455f88aa, 0xc3cbfa04, 0x089729a1, 0xf9c19b74, 0x329d48d1, + 0xb4093a7f, 0x7f55e9da, 0x6250d962, 0xa90c0ac7, 0x2f987869, + 0xe4c4abcc}, + {0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, 0xf580a6c0, + 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, 0x30704bc1, 0x0d106271, + 0x4ab018a1, 0x77d03111, 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, + 0x825097d1, 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, 0x5090dc43, + 0x6df0f5f3, 0x2a508f23, 0x1730a693, 0xa5107a83, 0x98705333, + 0xdfd029e3, 0xe2b00053, 0xc1c12f04, 0xfca106b4, 0xbb017c64, + 0x866155d4, 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, 0x0431c205, + 0x3951ebb5, 0x7ef19165, 0x4391b8d5, 0xa121b886, 0x9c419136, + 0xdbe1ebe6, 0xe681c256, 0x54a11e46, 0x69c137f6, 0x2e614d26, + 0x13016496, 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, 0x58f35849, + 0x659371f9, 0x22330b29, 0x1f532299, 0xad73fe89, 0x9013d739, + 0xd7b3ade9, 0xead38459, 0x68831388, 0x55e33a38, 0x124340e8, + 0x2f236958, 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, 0xcd93690b, + 0xf0f340bb, 0xb7533a6b, 0x8a3313db, 0x0863840a, 0x3503adba, + 0x72a3d76a, 0x4fc3feda, 0xfde322ca, 0xc0830b7a, 0x872371aa, + 0xba43581a, 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, 0xa9423c8c, + 0x9422153c, 0xd3826fec, 0xeee2465c, 0x5cc29a4c, 0x61a2b3fc, + 0x2602c92c, 0x1b62e09c, 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, + 0xbe729a1f, 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, 0x3c220dce, + 0x0142247e, 0x46e25eae, 0x7b82771e, 0xb1e6b092, 0x8c869922, + 0xcb26e3f2, 0xf646ca42, 0x44661652, 0x79063fe2, 0x3ea64532, + 0x03c66c82, 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, 0xd1062710, + 0xec660ea0, 0xabc67470, 0x96a65dc0, 0x248681d0, 0x19e6a860, + 0x5e46d2b0, 0x6326fb00, 0xe1766cd1, 0xdc164561, 0x9bb63fb1, + 0xa6d61601, 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, 0x85a73956, + 0xb8c710e6, 0xff676a36, 0xc2074386, 0x4057d457, 0x7d37fde7, + 0x3a978737, 0x07f7ae87, 0xb5d77297, 0x88b75b27, 0xcf1721f7, + 0xf2770847, 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, 0x20b743d5, + 0x1dd76a65, 0x5a7710b5, 0x67173905, 0xd537e515, 0xe857cca5, + 0xaff7b675, 0x92979fc5, 0xe915e8db, 0xd475c16b, 0x93d5bbbb, + 0xaeb5920b, 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, 0x2ce505da, + 0x11852c6a, 0x562556ba, 0x6b457f0a, 0x89f57f59, 0xb49556e9, + 0xf3352c39, 0xce550589, 0x7c75d999, 0x4115f029, 0x06b58af9, + 0x3bd5a349, 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, 0x28d4c7df, + 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, 0xdd54611f, 0xe03448af, + 0xa794327f, 0x9af41bcf, 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, + 0x5f04f6ce, 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, 0xbdb4f69d, + 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, 0x78441b9c, 0x4524322c, + 0x028448fc, 0x3fe4614c, 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, + 0xca64c78c}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0xb029603d, 0x6053c07a, 0xd07aa047, 0xc0a680f5, + 0x708fe0c8, 0xa0f5408f, 0x10dc20b2, 0xc14b7030, 0x7162100d, + 0xa118b04a, 0x1131d077, 0x01edf0c5, 0xb1c490f8, 0x61be30bf, + 0xd1975082, 0x8297e060, 0x32be805d, 0xe2c4201a, 0x52ed4027, + 0x42316095, 0xf21800a8, 0x2262a0ef, 0x924bc0d2, 0x43dc9050, + 0xf3f5f06d, 0x238f502a, 0x93a63017, 0x837a10a5, 0x33537098, + 0xe329d0df, 0x5300b0e2, 0x042fc1c1, 0xb406a1fc, 0x647c01bb, + 0xd4556186, 0xc4894134, 0x74a02109, 0xa4da814e, 0x14f3e173, + 0xc564b1f1, 0x754dd1cc, 0xa537718b, 0x151e11b6, 0x05c23104, + 0xb5eb5139, 0x6591f17e, 0xd5b89143, 0x86b821a1, 0x3691419c, + 0xe6ebe1db, 0x56c281e6, 0x461ea154, 0xf637c169, 0x264d612e, + 0x96640113, 0x47f35191, 0xf7da31ac, 0x27a091eb, 0x9789f1d6, + 0x8755d164, 0x377cb159, 0xe706111e, 0x572f7123, 0x4958f358, + 0xf9719365, 0x290b3322, 0x9922531f, 0x89fe73ad, 0x39d71390, + 0xe9adb3d7, 0x5984d3ea, 0x88138368, 0x383ae355, 0xe8404312, + 0x5869232f, 0x48b5039d, 0xf89c63a0, 0x28e6c3e7, 0x98cfa3da, + 0xcbcf1338, 0x7be67305, 0xab9cd342, 0x1bb5b37f, 0x0b6993cd, + 0xbb40f3f0, 0x6b3a53b7, 0xdb13338a, 0x0a846308, 0xbaad0335, + 0x6ad7a372, 0xdafec34f, 0xca22e3fd, 0x7a0b83c0, 0xaa712387, + 0x1a5843ba, 0x4d773299, 0xfd5e52a4, 0x2d24f2e3, 0x9d0d92de, + 0x8dd1b26c, 0x3df8d251, 0xed827216, 0x5dab122b, 0x8c3c42a9, + 0x3c152294, 0xec6f82d3, 0x5c46e2ee, 0x4c9ac25c, 0xfcb3a261, + 0x2cc90226, 0x9ce0621b, 0xcfe0d2f9, 0x7fc9b2c4, 0xafb31283, + 0x1f9a72be, 0x0f46520c, 0xbf6f3231, 0x6f159276, 0xdf3cf24b, + 0x0eaba2c9, 0xbe82c2f4, 0x6ef862b3, 0xded1028e, 0xce0d223c, + 0x7e244201, 0xae5ee246, 0x1e77827b, 0x92b0e6b1, 0x2299868c, + 0xf2e326cb, 0x42ca46f6, 0x52166644, 0xe23f0679, 0x3245a63e, + 0x826cc603, 0x53fb9681, 0xe3d2f6bc, 0x33a856fb, 0x838136c6, + 0x935d1674, 0x23747649, 0xf30ed60e, 0x4327b633, 0x102706d1, + 0xa00e66ec, 0x7074c6ab, 0xc05da696, 0xd0818624, 0x60a8e619, + 0xb0d2465e, 0x00fb2663, 0xd16c76e1, 0x614516dc, 0xb13fb69b, + 0x0116d6a6, 0x11caf614, 0xa1e39629, 0x7199366e, 0xc1b05653, + 0x969f2770, 0x26b6474d, 0xf6cce70a, 0x46e58737, 0x5639a785, + 0xe610c7b8, 0x366a67ff, 0x864307c2, 0x57d45740, 0xe7fd377d, + 0x3787973a, 0x87aef707, 0x9772d7b5, 0x275bb788, 0xf72117cf, + 0x470877f2, 0x1408c710, 0xa421a72d, 0x745b076a, 0xc4726757, + 0xd4ae47e5, 0x648727d8, 0xb4fd879f, 0x04d4e7a2, 0xd543b720, + 0x656ad71d, 0xb510775a, 0x05391767, 0x15e537d5, 0xa5cc57e8, + 0x75b6f7af, 0xc59f9792, 0xdbe815e9, 0x6bc175d4, 0xbbbbd593, + 0x0b92b5ae, 0x1b4e951c, 0xab67f521, 0x7b1d5566, 0xcb34355b, + 0x1aa365d9, 0xaa8a05e4, 0x7af0a5a3, 0xcad9c59e, 0xda05e52c, + 0x6a2c8511, 0xba562556, 0x0a7f456b, 0x597ff589, 0xe95695b4, + 0x392c35f3, 0x890555ce, 0x99d9757c, 0x29f01541, 0xf98ab506, + 0x49a3d53b, 0x983485b9, 0x281de584, 0xf86745c3, 0x484e25fe, + 0x5892054c, 0xe8bb6571, 0x38c1c536, 0x88e8a50b, 0xdfc7d428, + 0x6feeb415, 0xbf941452, 0x0fbd746f, 0x1f6154dd, 0xaf4834e0, + 0x7f3294a7, 0xcf1bf49a, 0x1e8ca418, 0xaea5c425, 0x7edf6462, + 0xcef6045f, 0xde2a24ed, 0x6e0344d0, 0xbe79e497, 0x0e5084aa, + 0x5d503448, 0xed795475, 0x3d03f432, 0x8d2a940f, 0x9df6b4bd, + 0x2ddfd480, 0xfda574c7, 0x4d8c14fa, 0x9c1b4478, 0x2c322445, + 0xfc488402, 0x4c61e43f, 0x5cbdc48d, 0xec94a4b0, 0x3cee04f7, + 0x8cc764ca}, + {0x00000000, 0xa5d35ccb, 0x0ba1c84d, 0xae729486, 0x1642919b, + 0xb391cd50, 0x1de359d6, 0xb830051d, 0x6d8253ec, 0xc8510f27, + 0x66239ba1, 0xc3f0c76a, 0x7bc0c277, 0xde139ebc, 0x70610a3a, + 0xd5b256f1, 0x9b02d603, 0x3ed18ac8, 0x90a31e4e, 0x35704285, + 0x8d404798, 0x28931b53, 0x86e18fd5, 0x2332d31e, 0xf68085ef, + 0x5353d924, 0xfd214da2, 0x58f21169, 0xe0c21474, 0x451148bf, + 0xeb63dc39, 0x4eb080f2, 0x3605ac07, 0x93d6f0cc, 0x3da4644a, + 0x98773881, 0x20473d9c, 0x85946157, 0x2be6f5d1, 0x8e35a91a, + 0x5b87ffeb, 0xfe54a320, 0x502637a6, 0xf5f56b6d, 0x4dc56e70, + 0xe81632bb, 0x4664a63d, 0xe3b7faf6, 0xad077a04, 0x08d426cf, + 0xa6a6b249, 0x0375ee82, 0xbb45eb9f, 0x1e96b754, 0xb0e423d2, + 0x15377f19, 0xc08529e8, 0x65567523, 0xcb24e1a5, 0x6ef7bd6e, + 0xd6c7b873, 0x7314e4b8, 0xdd66703e, 0x78b52cf5, 0x6c0a580f, + 0xc9d904c4, 0x67ab9042, 0xc278cc89, 0x7a48c994, 0xdf9b955f, + 0x71e901d9, 0xd43a5d12, 0x01880be3, 0xa45b5728, 0x0a29c3ae, + 0xaffa9f65, 0x17ca9a78, 0xb219c6b3, 0x1c6b5235, 0xb9b80efe, + 0xf7088e0c, 0x52dbd2c7, 0xfca94641, 0x597a1a8a, 0xe14a1f97, + 0x4499435c, 0xeaebd7da, 0x4f388b11, 0x9a8adde0, 0x3f59812b, + 0x912b15ad, 0x34f84966, 0x8cc84c7b, 0x291b10b0, 0x87698436, + 0x22bad8fd, 0x5a0ff408, 0xffdca8c3, 0x51ae3c45, 0xf47d608e, + 0x4c4d6593, 0xe99e3958, 0x47ecadde, 0xe23ff115, 0x378da7e4, + 0x925efb2f, 0x3c2c6fa9, 0x99ff3362, 0x21cf367f, 0x841c6ab4, + 0x2a6efe32, 0x8fbda2f9, 0xc10d220b, 0x64de7ec0, 0xcaacea46, + 0x6f7fb68d, 0xd74fb390, 0x729cef5b, 0xdcee7bdd, 0x793d2716, + 0xac8f71e7, 0x095c2d2c, 0xa72eb9aa, 0x02fde561, 0xbacde07c, + 0x1f1ebcb7, 0xb16c2831, 0x14bf74fa, 0xd814b01e, 0x7dc7ecd5, + 0xd3b57853, 0x76662498, 0xce562185, 0x6b857d4e, 0xc5f7e9c8, + 0x6024b503, 0xb596e3f2, 0x1045bf39, 0xbe372bbf, 0x1be47774, + 0xa3d47269, 0x06072ea2, 0xa875ba24, 0x0da6e6ef, 0x4316661d, + 0xe6c53ad6, 0x48b7ae50, 0xed64f29b, 0x5554f786, 0xf087ab4d, + 0x5ef53fcb, 0xfb266300, 0x2e9435f1, 0x8b47693a, 0x2535fdbc, + 0x80e6a177, 0x38d6a46a, 0x9d05f8a1, 0x33776c27, 0x96a430ec, + 0xee111c19, 0x4bc240d2, 0xe5b0d454, 0x4063889f, 0xf8538d82, + 0x5d80d149, 0xf3f245cf, 0x56211904, 0x83934ff5, 0x2640133e, + 0x883287b8, 0x2de1db73, 0x95d1de6e, 0x300282a5, 0x9e701623, + 0x3ba34ae8, 0x7513ca1a, 0xd0c096d1, 0x7eb20257, 0xdb615e9c, + 0x63515b81, 0xc682074a, 0x68f093cc, 0xcd23cf07, 0x189199f6, + 0xbd42c53d, 0x133051bb, 0xb6e30d70, 0x0ed3086d, 0xab0054a6, + 0x0572c020, 0xa0a19ceb, 0xb41ee811, 0x11cdb4da, 0xbfbf205c, + 0x1a6c7c97, 0xa25c798a, 0x078f2541, 0xa9fdb1c7, 0x0c2eed0c, + 0xd99cbbfd, 0x7c4fe736, 0xd23d73b0, 0x77ee2f7b, 0xcfde2a66, + 0x6a0d76ad, 0xc47fe22b, 0x61acbee0, 0x2f1c3e12, 0x8acf62d9, + 0x24bdf65f, 0x816eaa94, 0x395eaf89, 0x9c8df342, 0x32ff67c4, + 0x972c3b0f, 0x429e6dfe, 0xe74d3135, 0x493fa5b3, 0xececf978, + 0x54dcfc65, 0xf10fa0ae, 0x5f7d3428, 0xfaae68e3, 0x821b4416, + 0x27c818dd, 0x89ba8c5b, 0x2c69d090, 0x9459d58d, 0x318a8946, + 0x9ff81dc0, 0x3a2b410b, 0xef9917fa, 0x4a4a4b31, 0xe438dfb7, + 0x41eb837c, 0xf9db8661, 0x5c08daaa, 0xf27a4e2c, 0x57a912e7, + 0x19199215, 0xbccacede, 0x12b85a58, 0xb76b0693, 0x0f5b038e, + 0xaa885f45, 0x04facbc3, 0xa1299708, 0x749bc1f9, 0xd1489d32, + 0x7f3a09b4, 0xdae9557f, 0x62d95062, 0xc70a0ca9, 0x6978982f, + 0xccabc4e4}, + {0x00000000, 0xb40b77a6, 0x29119f97, 0x9d1ae831, 0x13244ff4, + 0xa72f3852, 0x3a35d063, 0x8e3ea7c5, 0x674eef33, 0xd3459895, + 0x4e5f70a4, 0xfa540702, 0x746aa0c7, 0xc061d761, 0x5d7b3f50, + 0xe97048f6, 0xce9cde67, 0x7a97a9c1, 0xe78d41f0, 0x53863656, + 0xddb89193, 0x69b3e635, 0xf4a90e04, 0x40a279a2, 0xa9d23154, + 0x1dd946f2, 0x80c3aec3, 0x34c8d965, 0xbaf67ea0, 0x0efd0906, + 0x93e7e137, 0x27ec9691, 0x9c39bdcf, 0x2832ca69, 0xb5282258, + 0x012355fe, 0x8f1df23b, 0x3b16859d, 0xa60c6dac, 0x12071a0a, + 0xfb7752fc, 0x4f7c255a, 0xd266cd6b, 0x666dbacd, 0xe8531d08, + 0x5c586aae, 0xc142829f, 0x7549f539, 0x52a563a8, 0xe6ae140e, + 0x7bb4fc3f, 0xcfbf8b99, 0x41812c5c, 0xf58a5bfa, 0x6890b3cb, + 0xdc9bc46d, 0x35eb8c9b, 0x81e0fb3d, 0x1cfa130c, 0xa8f164aa, + 0x26cfc36f, 0x92c4b4c9, 0x0fde5cf8, 0xbbd52b5e, 0x79750b44, + 0xcd7e7ce2, 0x506494d3, 0xe46fe375, 0x6a5144b0, 0xde5a3316, + 0x4340db27, 0xf74bac81, 0x1e3be477, 0xaa3093d1, 0x372a7be0, + 0x83210c46, 0x0d1fab83, 0xb914dc25, 0x240e3414, 0x900543b2, + 0xb7e9d523, 0x03e2a285, 0x9ef84ab4, 0x2af33d12, 0xa4cd9ad7, + 0x10c6ed71, 0x8ddc0540, 0x39d772e6, 0xd0a73a10, 0x64ac4db6, + 0xf9b6a587, 0x4dbdd221, 0xc38375e4, 0x77880242, 0xea92ea73, + 0x5e999dd5, 0xe54cb68b, 0x5147c12d, 0xcc5d291c, 0x78565eba, + 0xf668f97f, 0x42638ed9, 0xdf7966e8, 0x6b72114e, 0x820259b8, + 0x36092e1e, 0xab13c62f, 0x1f18b189, 0x9126164c, 0x252d61ea, + 0xb83789db, 0x0c3cfe7d, 0x2bd068ec, 0x9fdb1f4a, 0x02c1f77b, + 0xb6ca80dd, 0x38f42718, 0x8cff50be, 0x11e5b88f, 0xa5eecf29, + 0x4c9e87df, 0xf895f079, 0x658f1848, 0xd1846fee, 0x5fbac82b, + 0xebb1bf8d, 0x76ab57bc, 0xc2a0201a, 0xf2ea1688, 0x46e1612e, + 0xdbfb891f, 0x6ff0feb9, 0xe1ce597c, 0x55c52eda, 0xc8dfc6eb, + 0x7cd4b14d, 0x95a4f9bb, 0x21af8e1d, 0xbcb5662c, 0x08be118a, + 0x8680b64f, 0x328bc1e9, 0xaf9129d8, 0x1b9a5e7e, 0x3c76c8ef, + 0x887dbf49, 0x15675778, 0xa16c20de, 0x2f52871b, 0x9b59f0bd, + 0x0643188c, 0xb2486f2a, 0x5b3827dc, 0xef33507a, 0x7229b84b, + 0xc622cfed, 0x481c6828, 0xfc171f8e, 0x610df7bf, 0xd5068019, + 0x6ed3ab47, 0xdad8dce1, 0x47c234d0, 0xf3c94376, 0x7df7e4b3, + 0xc9fc9315, 0x54e67b24, 0xe0ed0c82, 0x099d4474, 0xbd9633d2, + 0x208cdbe3, 0x9487ac45, 0x1ab90b80, 0xaeb27c26, 0x33a89417, + 0x87a3e3b1, 0xa04f7520, 0x14440286, 0x895eeab7, 0x3d559d11, + 0xb36b3ad4, 0x07604d72, 0x9a7aa543, 0x2e71d2e5, 0xc7019a13, + 0x730aedb5, 0xee100584, 0x5a1b7222, 0xd425d5e7, 0x602ea241, + 0xfd344a70, 0x493f3dd6, 0x8b9f1dcc, 0x3f946a6a, 0xa28e825b, + 0x1685f5fd, 0x98bb5238, 0x2cb0259e, 0xb1aacdaf, 0x05a1ba09, + 0xecd1f2ff, 0x58da8559, 0xc5c06d68, 0x71cb1ace, 0xfff5bd0b, + 0x4bfecaad, 0xd6e4229c, 0x62ef553a, 0x4503c3ab, 0xf108b40d, + 0x6c125c3c, 0xd8192b9a, 0x56278c5f, 0xe22cfbf9, 0x7f3613c8, + 0xcb3d646e, 0x224d2c98, 0x96465b3e, 0x0b5cb30f, 0xbf57c4a9, + 0x3169636c, 0x856214ca, 0x1878fcfb, 0xac738b5d, 0x17a6a003, + 0xa3add7a5, 0x3eb73f94, 0x8abc4832, 0x0482eff7, 0xb0899851, + 0x2d937060, 0x999807c6, 0x70e84f30, 0xc4e33896, 0x59f9d0a7, + 0xedf2a701, 0x63cc00c4, 0xd7c77762, 0x4add9f53, 0xfed6e8f5, + 0xd93a7e64, 0x6d3109c2, 0xf02be1f3, 0x44209655, 0xca1e3190, + 0x7e154636, 0xe30fae07, 0x5704d9a1, 0xbe749157, 0x0a7fe6f1, + 0x97650ec0, 0x236e7966, 0xad50dea3, 0x195ba905, 0x84414134, + 0x304a3692}, + {0x00000000, 0x9e00aacc, 0x7d072542, 0xe3078f8e, 0xfa0e4a84, + 0x640ee048, 0x87096fc6, 0x1909c50a, 0xb51be5d3, 0x2b1b4f1f, + 0xc81cc091, 0x561c6a5d, 0x4f15af57, 0xd115059b, 0x32128a15, + 0xac1220d9, 0x2b31bb7c, 0xb53111b0, 0x56369e3e, 0xc83634f2, + 0xd13ff1f8, 0x4f3f5b34, 0xac38d4ba, 0x32387e76, 0x9e2a5eaf, + 0x002af463, 0xe32d7bed, 0x7d2dd121, 0x6424142b, 0xfa24bee7, + 0x19233169, 0x87239ba5, 0x566276f9, 0xc862dc35, 0x2b6553bb, + 0xb565f977, 0xac6c3c7d, 0x326c96b1, 0xd16b193f, 0x4f6bb3f3, + 0xe379932a, 0x7d7939e6, 0x9e7eb668, 0x007e1ca4, 0x1977d9ae, + 0x87777362, 0x6470fcec, 0xfa705620, 0x7d53cd85, 0xe3536749, + 0x0054e8c7, 0x9e54420b, 0x875d8701, 0x195d2dcd, 0xfa5aa243, + 0x645a088f, 0xc8482856, 0x5648829a, 0xb54f0d14, 0x2b4fa7d8, + 0x324662d2, 0xac46c81e, 0x4f414790, 0xd141ed5c, 0xedc29d29, + 0x73c237e5, 0x90c5b86b, 0x0ec512a7, 0x17ccd7ad, 0x89cc7d61, + 0x6acbf2ef, 0xf4cb5823, 0x58d978fa, 0xc6d9d236, 0x25de5db8, + 0xbbdef774, 0xa2d7327e, 0x3cd798b2, 0xdfd0173c, 0x41d0bdf0, + 0xc6f32655, 0x58f38c99, 0xbbf40317, 0x25f4a9db, 0x3cfd6cd1, + 0xa2fdc61d, 0x41fa4993, 0xdffae35f, 0x73e8c386, 0xede8694a, + 0x0eefe6c4, 0x90ef4c08, 0x89e68902, 0x17e623ce, 0xf4e1ac40, + 0x6ae1068c, 0xbba0ebd0, 0x25a0411c, 0xc6a7ce92, 0x58a7645e, + 0x41aea154, 0xdfae0b98, 0x3ca98416, 0xa2a92eda, 0x0ebb0e03, + 0x90bba4cf, 0x73bc2b41, 0xedbc818d, 0xf4b54487, 0x6ab5ee4b, + 0x89b261c5, 0x17b2cb09, 0x909150ac, 0x0e91fa60, 0xed9675ee, + 0x7396df22, 0x6a9f1a28, 0xf49fb0e4, 0x17983f6a, 0x899895a6, + 0x258ab57f, 0xbb8a1fb3, 0x588d903d, 0xc68d3af1, 0xdf84fffb, + 0x41845537, 0xa283dab9, 0x3c837075, 0xda853b53, 0x4485919f, + 0xa7821e11, 0x3982b4dd, 0x208b71d7, 0xbe8bdb1b, 0x5d8c5495, + 0xc38cfe59, 0x6f9ede80, 0xf19e744c, 0x1299fbc2, 0x8c99510e, + 0x95909404, 0x0b903ec8, 0xe897b146, 0x76971b8a, 0xf1b4802f, + 0x6fb42ae3, 0x8cb3a56d, 0x12b30fa1, 0x0bbacaab, 0x95ba6067, + 0x76bdefe9, 0xe8bd4525, 0x44af65fc, 0xdaafcf30, 0x39a840be, + 0xa7a8ea72, 0xbea12f78, 0x20a185b4, 0xc3a60a3a, 0x5da6a0f6, + 0x8ce74daa, 0x12e7e766, 0xf1e068e8, 0x6fe0c224, 0x76e9072e, + 0xe8e9ade2, 0x0bee226c, 0x95ee88a0, 0x39fca879, 0xa7fc02b5, + 0x44fb8d3b, 0xdafb27f7, 0xc3f2e2fd, 0x5df24831, 0xbef5c7bf, + 0x20f56d73, 0xa7d6f6d6, 0x39d65c1a, 0xdad1d394, 0x44d17958, + 0x5dd8bc52, 0xc3d8169e, 0x20df9910, 0xbedf33dc, 0x12cd1305, + 0x8ccdb9c9, 0x6fca3647, 0xf1ca9c8b, 0xe8c35981, 0x76c3f34d, + 0x95c47cc3, 0x0bc4d60f, 0x3747a67a, 0xa9470cb6, 0x4a408338, + 0xd44029f4, 0xcd49ecfe, 0x53494632, 0xb04ec9bc, 0x2e4e6370, + 0x825c43a9, 0x1c5ce965, 0xff5b66eb, 0x615bcc27, 0x7852092d, + 0xe652a3e1, 0x05552c6f, 0x9b5586a3, 0x1c761d06, 0x8276b7ca, + 0x61713844, 0xff719288, 0xe6785782, 0x7878fd4e, 0x9b7f72c0, + 0x057fd80c, 0xa96df8d5, 0x376d5219, 0xd46add97, 0x4a6a775b, + 0x5363b251, 0xcd63189d, 0x2e649713, 0xb0643ddf, 0x6125d083, + 0xff257a4f, 0x1c22f5c1, 0x82225f0d, 0x9b2b9a07, 0x052b30cb, + 0xe62cbf45, 0x782c1589, 0xd43e3550, 0x4a3e9f9c, 0xa9391012, + 0x3739bade, 0x2e307fd4, 0xb030d518, 0x53375a96, 0xcd37f05a, + 0x4a146bff, 0xd414c133, 0x37134ebd, 0xa913e471, 0xb01a217b, + 0x2e1a8bb7, 0xcd1d0439, 0x531daef5, 0xff0f8e2c, 0x610f24e0, + 0x8208ab6e, 0x1c0801a2, 0x0501c4a8, 0x9b016e64, 0x7806e1ea, + 0xe6064b26}}; + +#endif + +#endif + +#if N == 3 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}, + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x43cba68700000000, 0xc7903cd400000000, + 0x845b9a5300000000, 0xcf27087300000000, 0x8cecaef400000000, + 0x08b734a700000000, 0x4b7c922000000000, 0x9e4f10e600000000, + 0xdd84b66100000000, 0x59df2c3200000000, 0x1a148ab500000000, + 0x5168189500000000, 0x12a3be1200000000, 0x96f8244100000000, + 0xd53382c600000000, 0x7d99511700000000, 0x3e52f79000000000, + 0xba096dc300000000, 0xf9c2cb4400000000, 0xb2be596400000000, + 0xf175ffe300000000, 0x752e65b000000000, 0x36e5c33700000000, + 0xe3d641f100000000, 0xa01de77600000000, 0x24467d2500000000, + 0x678ddba200000000, 0x2cf1498200000000, 0x6f3aef0500000000, + 0xeb61755600000000, 0xa8aad3d100000000, 0xfa32a32e00000000, + 0xb9f905a900000000, 0x3da29ffa00000000, 0x7e69397d00000000, + 0x3515ab5d00000000, 0x76de0dda00000000, 0xf285978900000000, + 0xb14e310e00000000, 0x647db3c800000000, 0x27b6154f00000000, + 0xa3ed8f1c00000000, 0xe026299b00000000, 0xab5abbbb00000000, + 0xe8911d3c00000000, 0x6cca876f00000000, 0x2f0121e800000000, + 0x87abf23900000000, 0xc46054be00000000, 0x403bceed00000000, + 0x03f0686a00000000, 0x488cfa4a00000000, 0x0b475ccd00000000, + 0x8f1cc69e00000000, 0xccd7601900000000, 0x19e4e2df00000000, + 0x5a2f445800000000, 0xde74de0b00000000, 0x9dbf788c00000000, + 0xd6c3eaac00000000, 0x95084c2b00000000, 0x1153d67800000000, + 0x529870ff00000000, 0xf465465d00000000, 0xb7aee0da00000000, + 0x33f57a8900000000, 0x703edc0e00000000, 0x3b424e2e00000000, + 0x7889e8a900000000, 0xfcd272fa00000000, 0xbf19d47d00000000, + 0x6a2a56bb00000000, 0x29e1f03c00000000, 0xadba6a6f00000000, + 0xee71cce800000000, 0xa50d5ec800000000, 0xe6c6f84f00000000, + 0x629d621c00000000, 0x2156c49b00000000, 0x89fc174a00000000, + 0xca37b1cd00000000, 0x4e6c2b9e00000000, 0x0da78d1900000000, + 0x46db1f3900000000, 0x0510b9be00000000, 0x814b23ed00000000, + 0xc280856a00000000, 0x17b307ac00000000, 0x5478a12b00000000, + 0xd0233b7800000000, 0x93e89dff00000000, 0xd8940fdf00000000, + 0x9b5fa95800000000, 0x1f04330b00000000, 0x5ccf958c00000000, + 0x0e57e57300000000, 0x4d9c43f400000000, 0xc9c7d9a700000000, + 0x8a0c7f2000000000, 0xc170ed0000000000, 0x82bb4b8700000000, + 0x06e0d1d400000000, 0x452b775300000000, 0x9018f59500000000, + 0xd3d3531200000000, 0x5788c94100000000, 0x14436fc600000000, + 0x5f3ffde600000000, 0x1cf45b6100000000, 0x98afc13200000000, + 0xdb6467b500000000, 0x73ceb46400000000, 0x300512e300000000, + 0xb45e88b000000000, 0xf7952e3700000000, 0xbce9bc1700000000, + 0xff221a9000000000, 0x7b7980c300000000, 0x38b2264400000000, + 0xed81a48200000000, 0xae4a020500000000, 0x2a11985600000000, + 0x69da3ed100000000, 0x22a6acf100000000, 0x616d0a7600000000, + 0xe536902500000000, 0xa6fd36a200000000, 0xe8cb8cba00000000, + 0xab002a3d00000000, 0x2f5bb06e00000000, 0x6c9016e900000000, + 0x27ec84c900000000, 0x6427224e00000000, 0xe07cb81d00000000, + 0xa3b71e9a00000000, 0x76849c5c00000000, 0x354f3adb00000000, + 0xb114a08800000000, 0xf2df060f00000000, 0xb9a3942f00000000, + 0xfa6832a800000000, 0x7e33a8fb00000000, 0x3df80e7c00000000, + 0x9552ddad00000000, 0xd6997b2a00000000, 0x52c2e17900000000, + 0x110947fe00000000, 0x5a75d5de00000000, 0x19be735900000000, + 0x9de5e90a00000000, 0xde2e4f8d00000000, 0x0b1dcd4b00000000, + 0x48d66bcc00000000, 0xcc8df19f00000000, 0x8f46571800000000, + 0xc43ac53800000000, 0x87f163bf00000000, 0x03aaf9ec00000000, + 0x40615f6b00000000, 0x12f92f9400000000, 0x5132891300000000, + 0xd569134000000000, 0x96a2b5c700000000, 0xddde27e700000000, + 0x9e15816000000000, 0x1a4e1b3300000000, 0x5985bdb400000000, + 0x8cb63f7200000000, 0xcf7d99f500000000, 0x4b2603a600000000, + 0x08eda52100000000, 0x4391370100000000, 0x005a918600000000, + 0x84010bd500000000, 0xc7caad5200000000, 0x6f607e8300000000, + 0x2cabd80400000000, 0xa8f0425700000000, 0xeb3be4d000000000, + 0xa04776f000000000, 0xe38cd07700000000, 0x67d74a2400000000, + 0x241ceca300000000, 0xf12f6e6500000000, 0xb2e4c8e200000000, + 0x36bf52b100000000, 0x7574f43600000000, 0x3e08661600000000, + 0x7dc3c09100000000, 0xf9985ac200000000, 0xba53fc4500000000, + 0x1caecae700000000, 0x5f656c6000000000, 0xdb3ef63300000000, + 0x98f550b400000000, 0xd389c29400000000, 0x9042641300000000, + 0x1419fe4000000000, 0x57d258c700000000, 0x82e1da0100000000, + 0xc12a7c8600000000, 0x4571e6d500000000, 0x06ba405200000000, + 0x4dc6d27200000000, 0x0e0d74f500000000, 0x8a56eea600000000, + 0xc99d482100000000, 0x61379bf000000000, 0x22fc3d7700000000, + 0xa6a7a72400000000, 0xe56c01a300000000, 0xae10938300000000, + 0xeddb350400000000, 0x6980af5700000000, 0x2a4b09d000000000, + 0xff788b1600000000, 0xbcb32d9100000000, 0x38e8b7c200000000, + 0x7b23114500000000, 0x305f836500000000, 0x739425e200000000, + 0xf7cfbfb100000000, 0xb404193600000000, 0xe69c69c900000000, + 0xa557cf4e00000000, 0x210c551d00000000, 0x62c7f39a00000000, + 0x29bb61ba00000000, 0x6a70c73d00000000, 0xee2b5d6e00000000, + 0xade0fbe900000000, 0x78d3792f00000000, 0x3b18dfa800000000, + 0xbf4345fb00000000, 0xfc88e37c00000000, 0xb7f4715c00000000, + 0xf43fd7db00000000, 0x70644d8800000000, 0x33afeb0f00000000, + 0x9b0538de00000000, 0xd8ce9e5900000000, 0x5c95040a00000000, + 0x1f5ea28d00000000, 0x542230ad00000000, 0x17e9962a00000000, + 0x93b20c7900000000, 0xd079aafe00000000, 0x054a283800000000, + 0x46818ebf00000000, 0xc2da14ec00000000, 0x8111b26b00000000, + 0xca6d204b00000000, 0x89a686cc00000000, 0x0dfd1c9f00000000, + 0x4e36ba1800000000}, + {0x0000000000000000, 0xe1b652ef00000000, 0x836bd40500000000, + 0x62dd86ea00000000, 0x06d7a80b00000000, 0xe761fae400000000, + 0x85bc7c0e00000000, 0x640a2ee100000000, 0x0cae511700000000, + 0xed1803f800000000, 0x8fc5851200000000, 0x6e73d7fd00000000, + 0x0a79f91c00000000, 0xebcfabf300000000, 0x89122d1900000000, + 0x68a47ff600000000, 0x185ca32e00000000, 0xf9eaf1c100000000, + 0x9b37772b00000000, 0x7a8125c400000000, 0x1e8b0b2500000000, + 0xff3d59ca00000000, 0x9de0df2000000000, 0x7c568dcf00000000, + 0x14f2f23900000000, 0xf544a0d600000000, 0x9799263c00000000, + 0x762f74d300000000, 0x12255a3200000000, 0xf39308dd00000000, + 0x914e8e3700000000, 0x70f8dcd800000000, 0x30b8465d00000000, + 0xd10e14b200000000, 0xb3d3925800000000, 0x5265c0b700000000, + 0x366fee5600000000, 0xd7d9bcb900000000, 0xb5043a5300000000, + 0x54b268bc00000000, 0x3c16174a00000000, 0xdda045a500000000, + 0xbf7dc34f00000000, 0x5ecb91a000000000, 0x3ac1bf4100000000, + 0xdb77edae00000000, 0xb9aa6b4400000000, 0x581c39ab00000000, + 0x28e4e57300000000, 0xc952b79c00000000, 0xab8f317600000000, + 0x4a39639900000000, 0x2e334d7800000000, 0xcf851f9700000000, + 0xad58997d00000000, 0x4ceecb9200000000, 0x244ab46400000000, + 0xc5fce68b00000000, 0xa721606100000000, 0x4697328e00000000, + 0x229d1c6f00000000, 0xc32b4e8000000000, 0xa1f6c86a00000000, + 0x40409a8500000000, 0x60708dba00000000, 0x81c6df5500000000, + 0xe31b59bf00000000, 0x02ad0b5000000000, 0x66a725b100000000, + 0x8711775e00000000, 0xe5ccf1b400000000, 0x047aa35b00000000, + 0x6cdedcad00000000, 0x8d688e4200000000, 0xefb508a800000000, + 0x0e035a4700000000, 0x6a0974a600000000, 0x8bbf264900000000, + 0xe962a0a300000000, 0x08d4f24c00000000, 0x782c2e9400000000, + 0x999a7c7b00000000, 0xfb47fa9100000000, 0x1af1a87e00000000, + 0x7efb869f00000000, 0x9f4dd47000000000, 0xfd90529a00000000, + 0x1c26007500000000, 0x74827f8300000000, 0x95342d6c00000000, + 0xf7e9ab8600000000, 0x165ff96900000000, 0x7255d78800000000, + 0x93e3856700000000, 0xf13e038d00000000, 0x1088516200000000, + 0x50c8cbe700000000, 0xb17e990800000000, 0xd3a31fe200000000, + 0x32154d0d00000000, 0x561f63ec00000000, 0xb7a9310300000000, + 0xd574b7e900000000, 0x34c2e50600000000, 0x5c669af000000000, + 0xbdd0c81f00000000, 0xdf0d4ef500000000, 0x3ebb1c1a00000000, + 0x5ab132fb00000000, 0xbb07601400000000, 0xd9dae6fe00000000, + 0x386cb41100000000, 0x489468c900000000, 0xa9223a2600000000, + 0xcbffbccc00000000, 0x2a49ee2300000000, 0x4e43c0c200000000, + 0xaff5922d00000000, 0xcd2814c700000000, 0x2c9e462800000000, + 0x443a39de00000000, 0xa58c6b3100000000, 0xc751eddb00000000, + 0x26e7bf3400000000, 0x42ed91d500000000, 0xa35bc33a00000000, + 0xc18645d000000000, 0x2030173f00000000, 0x81e66bae00000000, + 0x6050394100000000, 0x028dbfab00000000, 0xe33bed4400000000, + 0x8731c3a500000000, 0x6687914a00000000, 0x045a17a000000000, + 0xe5ec454f00000000, 0x8d483ab900000000, 0x6cfe685600000000, + 0x0e23eebc00000000, 0xef95bc5300000000, 0x8b9f92b200000000, + 0x6a29c05d00000000, 0x08f446b700000000, 0xe942145800000000, + 0x99bac88000000000, 0x780c9a6f00000000, 0x1ad11c8500000000, + 0xfb674e6a00000000, 0x9f6d608b00000000, 0x7edb326400000000, + 0x1c06b48e00000000, 0xfdb0e66100000000, 0x9514999700000000, + 0x74a2cb7800000000, 0x167f4d9200000000, 0xf7c91f7d00000000, + 0x93c3319c00000000, 0x7275637300000000, 0x10a8e59900000000, + 0xf11eb77600000000, 0xb15e2df300000000, 0x50e87f1c00000000, + 0x3235f9f600000000, 0xd383ab1900000000, 0xb78985f800000000, + 0x563fd71700000000, 0x34e251fd00000000, 0xd554031200000000, + 0xbdf07ce400000000, 0x5c462e0b00000000, 0x3e9ba8e100000000, + 0xdf2dfa0e00000000, 0xbb27d4ef00000000, 0x5a91860000000000, + 0x384c00ea00000000, 0xd9fa520500000000, 0xa9028edd00000000, + 0x48b4dc3200000000, 0x2a695ad800000000, 0xcbdf083700000000, + 0xafd526d600000000, 0x4e63743900000000, 0x2cbef2d300000000, + 0xcd08a03c00000000, 0xa5acdfca00000000, 0x441a8d2500000000, + 0x26c70bcf00000000, 0xc771592000000000, 0xa37b77c100000000, + 0x42cd252e00000000, 0x2010a3c400000000, 0xc1a6f12b00000000, + 0xe196e61400000000, 0x0020b4fb00000000, 0x62fd321100000000, + 0x834b60fe00000000, 0xe7414e1f00000000, 0x06f71cf000000000, + 0x642a9a1a00000000, 0x859cc8f500000000, 0xed38b70300000000, + 0x0c8ee5ec00000000, 0x6e53630600000000, 0x8fe531e900000000, + 0xebef1f0800000000, 0x0a594de700000000, 0x6884cb0d00000000, + 0x893299e200000000, 0xf9ca453a00000000, 0x187c17d500000000, + 0x7aa1913f00000000, 0x9b17c3d000000000, 0xff1ded3100000000, + 0x1eabbfde00000000, 0x7c76393400000000, 0x9dc06bdb00000000, + 0xf564142d00000000, 0x14d246c200000000, 0x760fc02800000000, + 0x97b992c700000000, 0xf3b3bc2600000000, 0x1205eec900000000, + 0x70d8682300000000, 0x916e3acc00000000, 0xd12ea04900000000, + 0x3098f2a600000000, 0x5245744c00000000, 0xb3f326a300000000, + 0xd7f9084200000000, 0x364f5aad00000000, 0x5492dc4700000000, + 0xb5248ea800000000, 0xdd80f15e00000000, 0x3c36a3b100000000, + 0x5eeb255b00000000, 0xbf5d77b400000000, 0xdb57595500000000, + 0x3ae10bba00000000, 0x583c8d5000000000, 0xb98adfbf00000000, + 0xc972036700000000, 0x28c4518800000000, 0x4a19d76200000000, + 0xabaf858d00000000, 0xcfa5ab6c00000000, 0x2e13f98300000000, + 0x4cce7f6900000000, 0xad782d8600000000, 0xc5dc527000000000, + 0x246a009f00000000, 0x46b7867500000000, 0xa701d49a00000000, + 0xc30bfa7b00000000, 0x22bda89400000000, 0x40602e7e00000000, + 0xa1d67c9100000000}, + {0x0000000000000000, 0x5880e2d700000000, 0xf106b47400000000, + 0xa98656a300000000, 0xe20d68e900000000, 0xba8d8a3e00000000, + 0x130bdc9d00000000, 0x4b8b3e4a00000000, 0x851da10900000000, + 0xdd9d43de00000000, 0x741b157d00000000, 0x2c9bf7aa00000000, + 0x6710c9e000000000, 0x3f902b3700000000, 0x96167d9400000000, + 0xce969f4300000000, 0x0a3b421300000000, 0x52bba0c400000000, + 0xfb3df66700000000, 0xa3bd14b000000000, 0xe8362afa00000000, + 0xb0b6c82d00000000, 0x19309e8e00000000, 0x41b07c5900000000, + 0x8f26e31a00000000, 0xd7a601cd00000000, 0x7e20576e00000000, + 0x26a0b5b900000000, 0x6d2b8bf300000000, 0x35ab692400000000, + 0x9c2d3f8700000000, 0xc4addd5000000000, 0x1476842600000000, + 0x4cf666f100000000, 0xe570305200000000, 0xbdf0d28500000000, + 0xf67beccf00000000, 0xaefb0e1800000000, 0x077d58bb00000000, + 0x5ffdba6c00000000, 0x916b252f00000000, 0xc9ebc7f800000000, + 0x606d915b00000000, 0x38ed738c00000000, 0x73664dc600000000, + 0x2be6af1100000000, 0x8260f9b200000000, 0xdae01b6500000000, + 0x1e4dc63500000000, 0x46cd24e200000000, 0xef4b724100000000, + 0xb7cb909600000000, 0xfc40aedc00000000, 0xa4c04c0b00000000, + 0x0d461aa800000000, 0x55c6f87f00000000, 0x9b50673c00000000, + 0xc3d085eb00000000, 0x6a56d34800000000, 0x32d6319f00000000, + 0x795d0fd500000000, 0x21dded0200000000, 0x885bbba100000000, + 0xd0db597600000000, 0x28ec084d00000000, 0x706cea9a00000000, + 0xd9eabc3900000000, 0x816a5eee00000000, 0xcae160a400000000, + 0x9261827300000000, 0x3be7d4d000000000, 0x6367360700000000, + 0xadf1a94400000000, 0xf5714b9300000000, 0x5cf71d3000000000, + 0x0477ffe700000000, 0x4ffcc1ad00000000, 0x177c237a00000000, + 0xbefa75d900000000, 0xe67a970e00000000, 0x22d74a5e00000000, + 0x7a57a88900000000, 0xd3d1fe2a00000000, 0x8b511cfd00000000, + 0xc0da22b700000000, 0x985ac06000000000, 0x31dc96c300000000, + 0x695c741400000000, 0xa7caeb5700000000, 0xff4a098000000000, + 0x56cc5f2300000000, 0x0e4cbdf400000000, 0x45c783be00000000, + 0x1d47616900000000, 0xb4c137ca00000000, 0xec41d51d00000000, + 0x3c9a8c6b00000000, 0x641a6ebc00000000, 0xcd9c381f00000000, + 0x951cdac800000000, 0xde97e48200000000, 0x8617065500000000, + 0x2f9150f600000000, 0x7711b22100000000, 0xb9872d6200000000, + 0xe107cfb500000000, 0x4881991600000000, 0x10017bc100000000, + 0x5b8a458b00000000, 0x030aa75c00000000, 0xaa8cf1ff00000000, + 0xf20c132800000000, 0x36a1ce7800000000, 0x6e212caf00000000, + 0xc7a77a0c00000000, 0x9f2798db00000000, 0xd4aca69100000000, + 0x8c2c444600000000, 0x25aa12e500000000, 0x7d2af03200000000, + 0xb3bc6f7100000000, 0xeb3c8da600000000, 0x42badb0500000000, + 0x1a3a39d200000000, 0x51b1079800000000, 0x0931e54f00000000, + 0xa0b7b3ec00000000, 0xf837513b00000000, 0x50d8119a00000000, + 0x0858f34d00000000, 0xa1dea5ee00000000, 0xf95e473900000000, + 0xb2d5797300000000, 0xea559ba400000000, 0x43d3cd0700000000, + 0x1b532fd000000000, 0xd5c5b09300000000, 0x8d45524400000000, + 0x24c304e700000000, 0x7c43e63000000000, 0x37c8d87a00000000, + 0x6f483aad00000000, 0xc6ce6c0e00000000, 0x9e4e8ed900000000, + 0x5ae3538900000000, 0x0263b15e00000000, 0xabe5e7fd00000000, + 0xf365052a00000000, 0xb8ee3b6000000000, 0xe06ed9b700000000, + 0x49e88f1400000000, 0x11686dc300000000, 0xdffef28000000000, + 0x877e105700000000, 0x2ef846f400000000, 0x7678a42300000000, + 0x3df39a6900000000, 0x657378be00000000, 0xccf52e1d00000000, + 0x9475ccca00000000, 0x44ae95bc00000000, 0x1c2e776b00000000, + 0xb5a821c800000000, 0xed28c31f00000000, 0xa6a3fd5500000000, + 0xfe231f8200000000, 0x57a5492100000000, 0x0f25abf600000000, + 0xc1b334b500000000, 0x9933d66200000000, 0x30b580c100000000, + 0x6835621600000000, 0x23be5c5c00000000, 0x7b3ebe8b00000000, + 0xd2b8e82800000000, 0x8a380aff00000000, 0x4e95d7af00000000, + 0x1615357800000000, 0xbf9363db00000000, 0xe713810c00000000, + 0xac98bf4600000000, 0xf4185d9100000000, 0x5d9e0b3200000000, + 0x051ee9e500000000, 0xcb8876a600000000, 0x9308947100000000, + 0x3a8ec2d200000000, 0x620e200500000000, 0x29851e4f00000000, + 0x7105fc9800000000, 0xd883aa3b00000000, 0x800348ec00000000, + 0x783419d700000000, 0x20b4fb0000000000, 0x8932ada300000000, + 0xd1b24f7400000000, 0x9a39713e00000000, 0xc2b993e900000000, + 0x6b3fc54a00000000, 0x33bf279d00000000, 0xfd29b8de00000000, + 0xa5a95a0900000000, 0x0c2f0caa00000000, 0x54afee7d00000000, + 0x1f24d03700000000, 0x47a432e000000000, 0xee22644300000000, + 0xb6a2869400000000, 0x720f5bc400000000, 0x2a8fb91300000000, + 0x8309efb000000000, 0xdb890d6700000000, 0x9002332d00000000, + 0xc882d1fa00000000, 0x6104875900000000, 0x3984658e00000000, + 0xf712facd00000000, 0xaf92181a00000000, 0x06144eb900000000, + 0x5e94ac6e00000000, 0x151f922400000000, 0x4d9f70f300000000, + 0xe419265000000000, 0xbc99c48700000000, 0x6c429df100000000, + 0x34c27f2600000000, 0x9d44298500000000, 0xc5c4cb5200000000, + 0x8e4ff51800000000, 0xd6cf17cf00000000, 0x7f49416c00000000, + 0x27c9a3bb00000000, 0xe95f3cf800000000, 0xb1dfde2f00000000, + 0x1859888c00000000, 0x40d96a5b00000000, 0x0b52541100000000, + 0x53d2b6c600000000, 0xfa54e06500000000, 0xa2d402b200000000, + 0x6679dfe200000000, 0x3ef93d3500000000, 0x977f6b9600000000, + 0xcfff894100000000, 0x8474b70b00000000, 0xdcf455dc00000000, + 0x7572037f00000000, 0x2df2e1a800000000, 0xe3647eeb00000000, + 0xbbe49c3c00000000, 0x1262ca9f00000000, 0x4ae2284800000000, + 0x0169160200000000, 0x59e9f4d500000000, 0xf06fa27600000000, + 0xa8ef40a100000000}, + {0x0000000000000000, 0x463b676500000000, 0x8c76ceca00000000, + 0xca4da9af00000000, 0x59ebed4e00000000, 0x1fd08a2b00000000, + 0xd59d238400000000, 0x93a644e100000000, 0xb2d6db9d00000000, + 0xf4edbcf800000000, 0x3ea0155700000000, 0x789b723200000000, + 0xeb3d36d300000000, 0xad0651b600000000, 0x674bf81900000000, + 0x21709f7c00000000, 0x25abc6e000000000, 0x6390a18500000000, + 0xa9dd082a00000000, 0xefe66f4f00000000, 0x7c402bae00000000, + 0x3a7b4ccb00000000, 0xf036e56400000000, 0xb60d820100000000, + 0x977d1d7d00000000, 0xd1467a1800000000, 0x1b0bd3b700000000, + 0x5d30b4d200000000, 0xce96f03300000000, 0x88ad975600000000, + 0x42e03ef900000000, 0x04db599c00000000, 0x0b50fc1a00000000, + 0x4d6b9b7f00000000, 0x872632d000000000, 0xc11d55b500000000, + 0x52bb115400000000, 0x1480763100000000, 0xdecddf9e00000000, + 0x98f6b8fb00000000, 0xb986278700000000, 0xffbd40e200000000, + 0x35f0e94d00000000, 0x73cb8e2800000000, 0xe06dcac900000000, + 0xa656adac00000000, 0x6c1b040300000000, 0x2a20636600000000, + 0x2efb3afa00000000, 0x68c05d9f00000000, 0xa28df43000000000, + 0xe4b6935500000000, 0x7710d7b400000000, 0x312bb0d100000000, + 0xfb66197e00000000, 0xbd5d7e1b00000000, 0x9c2de16700000000, + 0xda16860200000000, 0x105b2fad00000000, 0x566048c800000000, + 0xc5c60c2900000000, 0x83fd6b4c00000000, 0x49b0c2e300000000, + 0x0f8ba58600000000, 0x16a0f83500000000, 0x509b9f5000000000, + 0x9ad636ff00000000, 0xdced519a00000000, 0x4f4b157b00000000, + 0x0970721e00000000, 0xc33ddbb100000000, 0x8506bcd400000000, + 0xa47623a800000000, 0xe24d44cd00000000, 0x2800ed6200000000, + 0x6e3b8a0700000000, 0xfd9dcee600000000, 0xbba6a98300000000, + 0x71eb002c00000000, 0x37d0674900000000, 0x330b3ed500000000, + 0x753059b000000000, 0xbf7df01f00000000, 0xf946977a00000000, + 0x6ae0d39b00000000, 0x2cdbb4fe00000000, 0xe6961d5100000000, + 0xa0ad7a3400000000, 0x81dde54800000000, 0xc7e6822d00000000, + 0x0dab2b8200000000, 0x4b904ce700000000, 0xd836080600000000, + 0x9e0d6f6300000000, 0x5440c6cc00000000, 0x127ba1a900000000, + 0x1df0042f00000000, 0x5bcb634a00000000, 0x9186cae500000000, + 0xd7bdad8000000000, 0x441be96100000000, 0x02208e0400000000, + 0xc86d27ab00000000, 0x8e5640ce00000000, 0xaf26dfb200000000, + 0xe91db8d700000000, 0x2350117800000000, 0x656b761d00000000, + 0xf6cd32fc00000000, 0xb0f6559900000000, 0x7abbfc3600000000, + 0x3c809b5300000000, 0x385bc2cf00000000, 0x7e60a5aa00000000, + 0xb42d0c0500000000, 0xf2166b6000000000, 0x61b02f8100000000, + 0x278b48e400000000, 0xedc6e14b00000000, 0xabfd862e00000000, + 0x8a8d195200000000, 0xccb67e3700000000, 0x06fbd79800000000, + 0x40c0b0fd00000000, 0xd366f41c00000000, 0x955d937900000000, + 0x5f103ad600000000, 0x192b5db300000000, 0x2c40f16b00000000, + 0x6a7b960e00000000, 0xa0363fa100000000, 0xe60d58c400000000, + 0x75ab1c2500000000, 0x33907b4000000000, 0xf9ddd2ef00000000, + 0xbfe6b58a00000000, 0x9e962af600000000, 0xd8ad4d9300000000, + 0x12e0e43c00000000, 0x54db835900000000, 0xc77dc7b800000000, + 0x8146a0dd00000000, 0x4b0b097200000000, 0x0d306e1700000000, + 0x09eb378b00000000, 0x4fd050ee00000000, 0x859df94100000000, + 0xc3a69e2400000000, 0x5000dac500000000, 0x163bbda000000000, + 0xdc76140f00000000, 0x9a4d736a00000000, 0xbb3dec1600000000, + 0xfd068b7300000000, 0x374b22dc00000000, 0x717045b900000000, + 0xe2d6015800000000, 0xa4ed663d00000000, 0x6ea0cf9200000000, + 0x289ba8f700000000, 0x27100d7100000000, 0x612b6a1400000000, + 0xab66c3bb00000000, 0xed5da4de00000000, 0x7efbe03f00000000, + 0x38c0875a00000000, 0xf28d2ef500000000, 0xb4b6499000000000, + 0x95c6d6ec00000000, 0xd3fdb18900000000, 0x19b0182600000000, + 0x5f8b7f4300000000, 0xcc2d3ba200000000, 0x8a165cc700000000, + 0x405bf56800000000, 0x0660920d00000000, 0x02bbcb9100000000, + 0x4480acf400000000, 0x8ecd055b00000000, 0xc8f6623e00000000, + 0x5b5026df00000000, 0x1d6b41ba00000000, 0xd726e81500000000, + 0x911d8f7000000000, 0xb06d100c00000000, 0xf656776900000000, + 0x3c1bdec600000000, 0x7a20b9a300000000, 0xe986fd4200000000, + 0xafbd9a2700000000, 0x65f0338800000000, 0x23cb54ed00000000, + 0x3ae0095e00000000, 0x7cdb6e3b00000000, 0xb696c79400000000, + 0xf0ada0f100000000, 0x630be41000000000, 0x2530837500000000, + 0xef7d2ada00000000, 0xa9464dbf00000000, 0x8836d2c300000000, + 0xce0db5a600000000, 0x04401c0900000000, 0x427b7b6c00000000, + 0xd1dd3f8d00000000, 0x97e658e800000000, 0x5dabf14700000000, + 0x1b90962200000000, 0x1f4bcfbe00000000, 0x5970a8db00000000, + 0x933d017400000000, 0xd506661100000000, 0x46a022f000000000, + 0x009b459500000000, 0xcad6ec3a00000000, 0x8ced8b5f00000000, + 0xad9d142300000000, 0xeba6734600000000, 0x21ebdae900000000, + 0x67d0bd8c00000000, 0xf476f96d00000000, 0xb24d9e0800000000, + 0x780037a700000000, 0x3e3b50c200000000, 0x31b0f54400000000, + 0x778b922100000000, 0xbdc63b8e00000000, 0xfbfd5ceb00000000, + 0x685b180a00000000, 0x2e607f6f00000000, 0xe42dd6c000000000, + 0xa216b1a500000000, 0x83662ed900000000, 0xc55d49bc00000000, + 0x0f10e01300000000, 0x492b877600000000, 0xda8dc39700000000, + 0x9cb6a4f200000000, 0x56fb0d5d00000000, 0x10c06a3800000000, + 0x141b33a400000000, 0x522054c100000000, 0x986dfd6e00000000, + 0xde569a0b00000000, 0x4df0deea00000000, 0x0bcbb98f00000000, + 0xc186102000000000, 0x87bd774500000000, 0xa6cde83900000000, + 0xe0f68f5c00000000, 0x2abb26f300000000, 0x6c80419600000000, + 0xff26057700000000, 0xb91d621200000000, 0x7350cbbd00000000, + 0x356bacd800000000}, + {0x0000000000000000, 0x9e83da9f00000000, 0x7d01c4e400000000, + 0xe3821e7b00000000, 0xbb04f91200000000, 0x2587238d00000000, + 0xc6053df600000000, 0x5886e76900000000, 0x7609f22500000000, + 0xe88a28ba00000000, 0x0b0836c100000000, 0x958bec5e00000000, + 0xcd0d0b3700000000, 0x538ed1a800000000, 0xb00ccfd300000000, + 0x2e8f154c00000000, 0xec12e44b00000000, 0x72913ed400000000, + 0x911320af00000000, 0x0f90fa3000000000, 0x57161d5900000000, + 0xc995c7c600000000, 0x2a17d9bd00000000, 0xb494032200000000, + 0x9a1b166e00000000, 0x0498ccf100000000, 0xe71ad28a00000000, + 0x7999081500000000, 0x211fef7c00000000, 0xbf9c35e300000000, + 0x5c1e2b9800000000, 0xc29df10700000000, 0xd825c89700000000, + 0x46a6120800000000, 0xa5240c7300000000, 0x3ba7d6ec00000000, + 0x6321318500000000, 0xfda2eb1a00000000, 0x1e20f56100000000, + 0x80a32ffe00000000, 0xae2c3ab200000000, 0x30afe02d00000000, + 0xd32dfe5600000000, 0x4dae24c900000000, 0x1528c3a000000000, + 0x8bab193f00000000, 0x6829074400000000, 0xf6aadddb00000000, + 0x34372cdc00000000, 0xaab4f64300000000, 0x4936e83800000000, + 0xd7b532a700000000, 0x8f33d5ce00000000, 0x11b00f5100000000, + 0xf232112a00000000, 0x6cb1cbb500000000, 0x423edef900000000, + 0xdcbd046600000000, 0x3f3f1a1d00000000, 0xa1bcc08200000000, + 0xf93a27eb00000000, 0x67b9fd7400000000, 0x843be30f00000000, + 0x1ab8399000000000, 0xf14de1f400000000, 0x6fce3b6b00000000, + 0x8c4c251000000000, 0x12cfff8f00000000, 0x4a4918e600000000, + 0xd4cac27900000000, 0x3748dc0200000000, 0xa9cb069d00000000, + 0x874413d100000000, 0x19c7c94e00000000, 0xfa45d73500000000, + 0x64c60daa00000000, 0x3c40eac300000000, 0xa2c3305c00000000, + 0x41412e2700000000, 0xdfc2f4b800000000, 0x1d5f05bf00000000, + 0x83dcdf2000000000, 0x605ec15b00000000, 0xfedd1bc400000000, + 0xa65bfcad00000000, 0x38d8263200000000, 0xdb5a384900000000, + 0x45d9e2d600000000, 0x6b56f79a00000000, 0xf5d52d0500000000, + 0x1657337e00000000, 0x88d4e9e100000000, 0xd0520e8800000000, + 0x4ed1d41700000000, 0xad53ca6c00000000, 0x33d010f300000000, + 0x2968296300000000, 0xb7ebf3fc00000000, 0x5469ed8700000000, + 0xcaea371800000000, 0x926cd07100000000, 0x0cef0aee00000000, + 0xef6d149500000000, 0x71eece0a00000000, 0x5f61db4600000000, + 0xc1e201d900000000, 0x22601fa200000000, 0xbce3c53d00000000, + 0xe465225400000000, 0x7ae6f8cb00000000, 0x9964e6b000000000, + 0x07e73c2f00000000, 0xc57acd2800000000, 0x5bf917b700000000, + 0xb87b09cc00000000, 0x26f8d35300000000, 0x7e7e343a00000000, + 0xe0fdeea500000000, 0x037ff0de00000000, 0x9dfc2a4100000000, + 0xb3733f0d00000000, 0x2df0e59200000000, 0xce72fbe900000000, + 0x50f1217600000000, 0x0877c61f00000000, 0x96f41c8000000000, + 0x757602fb00000000, 0xebf5d86400000000, 0xa39db33200000000, + 0x3d1e69ad00000000, 0xde9c77d600000000, 0x401fad4900000000, + 0x18994a2000000000, 0x861a90bf00000000, 0x65988ec400000000, + 0xfb1b545b00000000, 0xd594411700000000, 0x4b179b8800000000, + 0xa89585f300000000, 0x36165f6c00000000, 0x6e90b80500000000, + 0xf013629a00000000, 0x13917ce100000000, 0x8d12a67e00000000, + 0x4f8f577900000000, 0xd10c8de600000000, 0x328e939d00000000, + 0xac0d490200000000, 0xf48bae6b00000000, 0x6a0874f400000000, + 0x898a6a8f00000000, 0x1709b01000000000, 0x3986a55c00000000, + 0xa7057fc300000000, 0x448761b800000000, 0xda04bb2700000000, + 0x82825c4e00000000, 0x1c0186d100000000, 0xff8398aa00000000, + 0x6100423500000000, 0x7bb87ba500000000, 0xe53ba13a00000000, + 0x06b9bf4100000000, 0x983a65de00000000, 0xc0bc82b700000000, + 0x5e3f582800000000, 0xbdbd465300000000, 0x233e9ccc00000000, + 0x0db1898000000000, 0x9332531f00000000, 0x70b04d6400000000, + 0xee3397fb00000000, 0xb6b5709200000000, 0x2836aa0d00000000, + 0xcbb4b47600000000, 0x55376ee900000000, 0x97aa9fee00000000, + 0x0929457100000000, 0xeaab5b0a00000000, 0x7428819500000000, + 0x2cae66fc00000000, 0xb22dbc6300000000, 0x51afa21800000000, + 0xcf2c788700000000, 0xe1a36dcb00000000, 0x7f20b75400000000, + 0x9ca2a92f00000000, 0x022173b000000000, 0x5aa794d900000000, + 0xc4244e4600000000, 0x27a6503d00000000, 0xb9258aa200000000, + 0x52d052c600000000, 0xcc53885900000000, 0x2fd1962200000000, + 0xb1524cbd00000000, 0xe9d4abd400000000, 0x7757714b00000000, + 0x94d56f3000000000, 0x0a56b5af00000000, 0x24d9a0e300000000, + 0xba5a7a7c00000000, 0x59d8640700000000, 0xc75bbe9800000000, + 0x9fdd59f100000000, 0x015e836e00000000, 0xe2dc9d1500000000, + 0x7c5f478a00000000, 0xbec2b68d00000000, 0x20416c1200000000, + 0xc3c3726900000000, 0x5d40a8f600000000, 0x05c64f9f00000000, + 0x9b45950000000000, 0x78c78b7b00000000, 0xe64451e400000000, + 0xc8cb44a800000000, 0x56489e3700000000, 0xb5ca804c00000000, + 0x2b495ad300000000, 0x73cfbdba00000000, 0xed4c672500000000, + 0x0ece795e00000000, 0x904da3c100000000, 0x8af59a5100000000, + 0x147640ce00000000, 0xf7f45eb500000000, 0x6977842a00000000, + 0x31f1634300000000, 0xaf72b9dc00000000, 0x4cf0a7a700000000, + 0xd2737d3800000000, 0xfcfc687400000000, 0x627fb2eb00000000, + 0x81fdac9000000000, 0x1f7e760f00000000, 0x47f8916600000000, + 0xd97b4bf900000000, 0x3af9558200000000, 0xa47a8f1d00000000, + 0x66e77e1a00000000, 0xf864a48500000000, 0x1be6bafe00000000, + 0x8565606100000000, 0xdde3870800000000, 0x43605d9700000000, + 0xa0e243ec00000000, 0x3e61997300000000, 0x10ee8c3f00000000, + 0x8e6d56a000000000, 0x6def48db00000000, 0xf36c924400000000, + 0xabea752d00000000, 0x3569afb200000000, 0xd6ebb1c900000000, + 0x48686b5600000000}, + {0x0000000000000000, 0xc064281700000000, 0x80c9502e00000000, + 0x40ad783900000000, 0x0093a15c00000000, 0xc0f7894b00000000, + 0x805af17200000000, 0x403ed96500000000, 0x002643b900000000, + 0xc0426bae00000000, 0x80ef139700000000, 0x408b3b8000000000, + 0x00b5e2e500000000, 0xc0d1caf200000000, 0x807cb2cb00000000, + 0x40189adc00000000, 0x414af7a900000000, 0x812edfbe00000000, + 0xc183a78700000000, 0x01e78f9000000000, 0x41d956f500000000, + 0x81bd7ee200000000, 0xc11006db00000000, 0x01742ecc00000000, + 0x416cb41000000000, 0x81089c0700000000, 0xc1a5e43e00000000, + 0x01c1cc2900000000, 0x41ff154c00000000, 0x819b3d5b00000000, + 0xc136456200000000, 0x01526d7500000000, 0xc3929f8800000000, + 0x03f6b79f00000000, 0x435bcfa600000000, 0x833fe7b100000000, + 0xc3013ed400000000, 0x036516c300000000, 0x43c86efa00000000, + 0x83ac46ed00000000, 0xc3b4dc3100000000, 0x03d0f42600000000, + 0x437d8c1f00000000, 0x8319a40800000000, 0xc3277d6d00000000, + 0x0343557a00000000, 0x43ee2d4300000000, 0x838a055400000000, + 0x82d8682100000000, 0x42bc403600000000, 0x0211380f00000000, + 0xc275101800000000, 0x824bc97d00000000, 0x422fe16a00000000, + 0x0282995300000000, 0xc2e6b14400000000, 0x82fe2b9800000000, + 0x429a038f00000000, 0x02377bb600000000, 0xc25353a100000000, + 0x826d8ac400000000, 0x4209a2d300000000, 0x02a4daea00000000, + 0xc2c0f2fd00000000, 0xc7234eca00000000, 0x074766dd00000000, + 0x47ea1ee400000000, 0x878e36f300000000, 0xc7b0ef9600000000, + 0x07d4c78100000000, 0x4779bfb800000000, 0x871d97af00000000, + 0xc7050d7300000000, 0x0761256400000000, 0x47cc5d5d00000000, + 0x87a8754a00000000, 0xc796ac2f00000000, 0x07f2843800000000, + 0x475ffc0100000000, 0x873bd41600000000, 0x8669b96300000000, + 0x460d917400000000, 0x06a0e94d00000000, 0xc6c4c15a00000000, + 0x86fa183f00000000, 0x469e302800000000, 0x0633481100000000, + 0xc657600600000000, 0x864ffada00000000, 0x462bd2cd00000000, + 0x0686aaf400000000, 0xc6e282e300000000, 0x86dc5b8600000000, + 0x46b8739100000000, 0x06150ba800000000, 0xc67123bf00000000, + 0x04b1d14200000000, 0xc4d5f95500000000, 0x8478816c00000000, + 0x441ca97b00000000, 0x0422701e00000000, 0xc446580900000000, + 0x84eb203000000000, 0x448f082700000000, 0x049792fb00000000, + 0xc4f3baec00000000, 0x845ec2d500000000, 0x443aeac200000000, + 0x040433a700000000, 0xc4601bb000000000, 0x84cd638900000000, + 0x44a94b9e00000000, 0x45fb26eb00000000, 0x859f0efc00000000, + 0xc53276c500000000, 0x05565ed200000000, 0x456887b700000000, + 0x850cafa000000000, 0xc5a1d79900000000, 0x05c5ff8e00000000, + 0x45dd655200000000, 0x85b94d4500000000, 0xc514357c00000000, + 0x05701d6b00000000, 0x454ec40e00000000, 0x852aec1900000000, + 0xc587942000000000, 0x05e3bc3700000000, 0xcf41ed4f00000000, + 0x0f25c55800000000, 0x4f88bd6100000000, 0x8fec957600000000, + 0xcfd24c1300000000, 0x0fb6640400000000, 0x4f1b1c3d00000000, + 0x8f7f342a00000000, 0xcf67aef600000000, 0x0f0386e100000000, + 0x4faefed800000000, 0x8fcad6cf00000000, 0xcff40faa00000000, + 0x0f9027bd00000000, 0x4f3d5f8400000000, 0x8f59779300000000, + 0x8e0b1ae600000000, 0x4e6f32f100000000, 0x0ec24ac800000000, + 0xcea662df00000000, 0x8e98bbba00000000, 0x4efc93ad00000000, + 0x0e51eb9400000000, 0xce35c38300000000, 0x8e2d595f00000000, + 0x4e49714800000000, 0x0ee4097100000000, 0xce80216600000000, + 0x8ebef80300000000, 0x4edad01400000000, 0x0e77a82d00000000, + 0xce13803a00000000, 0x0cd372c700000000, 0xccb75ad000000000, + 0x8c1a22e900000000, 0x4c7e0afe00000000, 0x0c40d39b00000000, + 0xcc24fb8c00000000, 0x8c8983b500000000, 0x4cedaba200000000, + 0x0cf5317e00000000, 0xcc91196900000000, 0x8c3c615000000000, + 0x4c58494700000000, 0x0c66902200000000, 0xcc02b83500000000, + 0x8cafc00c00000000, 0x4ccbe81b00000000, 0x4d99856e00000000, + 0x8dfdad7900000000, 0xcd50d54000000000, 0x0d34fd5700000000, + 0x4d0a243200000000, 0x8d6e0c2500000000, 0xcdc3741c00000000, + 0x0da75c0b00000000, 0x4dbfc6d700000000, 0x8ddbeec000000000, + 0xcd7696f900000000, 0x0d12beee00000000, 0x4d2c678b00000000, + 0x8d484f9c00000000, 0xcde537a500000000, 0x0d811fb200000000, + 0x0862a38500000000, 0xc8068b9200000000, 0x88abf3ab00000000, + 0x48cfdbbc00000000, 0x08f102d900000000, 0xc8952ace00000000, + 0x883852f700000000, 0x485c7ae000000000, 0x0844e03c00000000, + 0xc820c82b00000000, 0x888db01200000000, 0x48e9980500000000, + 0x08d7416000000000, 0xc8b3697700000000, 0x881e114e00000000, + 0x487a395900000000, 0x4928542c00000000, 0x894c7c3b00000000, + 0xc9e1040200000000, 0x09852c1500000000, 0x49bbf57000000000, + 0x89dfdd6700000000, 0xc972a55e00000000, 0x09168d4900000000, + 0x490e179500000000, 0x896a3f8200000000, 0xc9c747bb00000000, + 0x09a36fac00000000, 0x499db6c900000000, 0x89f99ede00000000, + 0xc954e6e700000000, 0x0930cef000000000, 0xcbf03c0d00000000, + 0x0b94141a00000000, 0x4b396c2300000000, 0x8b5d443400000000, + 0xcb639d5100000000, 0x0b07b54600000000, 0x4baacd7f00000000, + 0x8bcee56800000000, 0xcbd67fb400000000, 0x0bb257a300000000, + 0x4b1f2f9a00000000, 0x8b7b078d00000000, 0xcb45dee800000000, + 0x0b21f6ff00000000, 0x4b8c8ec600000000, 0x8be8a6d100000000, + 0x8abacba400000000, 0x4adee3b300000000, 0x0a739b8a00000000, + 0xca17b39d00000000, 0x8a296af800000000, 0x4a4d42ef00000000, + 0x0ae03ad600000000, 0xca8412c100000000, 0x8a9c881d00000000, + 0x4af8a00a00000000, 0x0a55d83300000000, 0xca31f02400000000, + 0x8a0f294100000000, 0x4a6b015600000000, 0x0ac6796f00000000, + 0xcaa2517800000000}, + {0x0000000000000000, 0xd4ea739b00000000, 0xe9d396ed00000000, + 0x3d39e57600000000, 0x93a15c0000000000, 0x474b2f9b00000000, + 0x7a72caed00000000, 0xae98b97600000000, 0x2643b90000000000, + 0xf2a9ca9b00000000, 0xcf902fed00000000, 0x1b7a5c7600000000, + 0xb5e2e50000000000, 0x6108969b00000000, 0x5c3173ed00000000, + 0x88db007600000000, 0x4c86720100000000, 0x986c019a00000000, + 0xa555e4ec00000000, 0x71bf977700000000, 0xdf272e0100000000, + 0x0bcd5d9a00000000, 0x36f4b8ec00000000, 0xe21ecb7700000000, + 0x6ac5cb0100000000, 0xbe2fb89a00000000, 0x83165dec00000000, + 0x57fc2e7700000000, 0xf964970100000000, 0x2d8ee49a00000000, + 0x10b701ec00000000, 0xc45d727700000000, 0x980ce50200000000, + 0x4ce6969900000000, 0x71df73ef00000000, 0xa535007400000000, + 0x0badb90200000000, 0xdf47ca9900000000, 0xe27e2fef00000000, + 0x36945c7400000000, 0xbe4f5c0200000000, 0x6aa52f9900000000, + 0x579ccaef00000000, 0x8376b97400000000, 0x2dee000200000000, + 0xf904739900000000, 0xc43d96ef00000000, 0x10d7e57400000000, + 0xd48a970300000000, 0x0060e49800000000, 0x3d5901ee00000000, + 0xe9b3727500000000, 0x472bcb0300000000, 0x93c1b89800000000, + 0xaef85dee00000000, 0x7a122e7500000000, 0xf2c92e0300000000, + 0x26235d9800000000, 0x1b1ab8ee00000000, 0xcff0cb7500000000, + 0x6168720300000000, 0xb582019800000000, 0x88bbe4ee00000000, + 0x5c51977500000000, 0x3019ca0500000000, 0xe4f3b99e00000000, + 0xd9ca5ce800000000, 0x0d202f7300000000, 0xa3b8960500000000, + 0x7752e59e00000000, 0x4a6b00e800000000, 0x9e81737300000000, + 0x165a730500000000, 0xc2b0009e00000000, 0xff89e5e800000000, + 0x2b63967300000000, 0x85fb2f0500000000, 0x51115c9e00000000, + 0x6c28b9e800000000, 0xb8c2ca7300000000, 0x7c9fb80400000000, + 0xa875cb9f00000000, 0x954c2ee900000000, 0x41a65d7200000000, + 0xef3ee40400000000, 0x3bd4979f00000000, 0x06ed72e900000000, + 0xd207017200000000, 0x5adc010400000000, 0x8e36729f00000000, + 0xb30f97e900000000, 0x67e5e47200000000, 0xc97d5d0400000000, + 0x1d972e9f00000000, 0x20aecbe900000000, 0xf444b87200000000, + 0xa8152f0700000000, 0x7cff5c9c00000000, 0x41c6b9ea00000000, + 0x952cca7100000000, 0x3bb4730700000000, 0xef5e009c00000000, + 0xd267e5ea00000000, 0x068d967100000000, 0x8e56960700000000, + 0x5abce59c00000000, 0x678500ea00000000, 0xb36f737100000000, + 0x1df7ca0700000000, 0xc91db99c00000000, 0xf4245cea00000000, + 0x20ce2f7100000000, 0xe4935d0600000000, 0x30792e9d00000000, + 0x0d40cbeb00000000, 0xd9aab87000000000, 0x7732010600000000, + 0xa3d8729d00000000, 0x9ee197eb00000000, 0x4a0be47000000000, + 0xc2d0e40600000000, 0x163a979d00000000, 0x2b0372eb00000000, + 0xffe9017000000000, 0x5171b80600000000, 0x859bcb9d00000000, + 0xb8a22eeb00000000, 0x6c485d7000000000, 0x6032940b00000000, + 0xb4d8e79000000000, 0x89e102e600000000, 0x5d0b717d00000000, + 0xf393c80b00000000, 0x2779bb9000000000, 0x1a405ee600000000, + 0xceaa2d7d00000000, 0x46712d0b00000000, 0x929b5e9000000000, + 0xafa2bbe600000000, 0x7b48c87d00000000, 0xd5d0710b00000000, + 0x013a029000000000, 0x3c03e7e600000000, 0xe8e9947d00000000, + 0x2cb4e60a00000000, 0xf85e959100000000, 0xc56770e700000000, + 0x118d037c00000000, 0xbf15ba0a00000000, 0x6bffc99100000000, + 0x56c62ce700000000, 0x822c5f7c00000000, 0x0af75f0a00000000, + 0xde1d2c9100000000, 0xe324c9e700000000, 0x37ceba7c00000000, + 0x9956030a00000000, 0x4dbc709100000000, 0x708595e700000000, + 0xa46fe67c00000000, 0xf83e710900000000, 0x2cd4029200000000, + 0x11ede7e400000000, 0xc507947f00000000, 0x6b9f2d0900000000, + 0xbf755e9200000000, 0x824cbbe400000000, 0x56a6c87f00000000, + 0xde7dc80900000000, 0x0a97bb9200000000, 0x37ae5ee400000000, + 0xe3442d7f00000000, 0x4ddc940900000000, 0x9936e79200000000, + 0xa40f02e400000000, 0x70e5717f00000000, 0xb4b8030800000000, + 0x6052709300000000, 0x5d6b95e500000000, 0x8981e67e00000000, + 0x27195f0800000000, 0xf3f32c9300000000, 0xcecac9e500000000, + 0x1a20ba7e00000000, 0x92fbba0800000000, 0x4611c99300000000, + 0x7b282ce500000000, 0xafc25f7e00000000, 0x015ae60800000000, + 0xd5b0959300000000, 0xe88970e500000000, 0x3c63037e00000000, + 0x502b5e0e00000000, 0x84c12d9500000000, 0xb9f8c8e300000000, + 0x6d12bb7800000000, 0xc38a020e00000000, 0x1760719500000000, + 0x2a5994e300000000, 0xfeb3e77800000000, 0x7668e70e00000000, + 0xa282949500000000, 0x9fbb71e300000000, 0x4b51027800000000, + 0xe5c9bb0e00000000, 0x3123c89500000000, 0x0c1a2de300000000, + 0xd8f05e7800000000, 0x1cad2c0f00000000, 0xc8475f9400000000, + 0xf57ebae200000000, 0x2194c97900000000, 0x8f0c700f00000000, + 0x5be6039400000000, 0x66dfe6e200000000, 0xb235957900000000, + 0x3aee950f00000000, 0xee04e69400000000, 0xd33d03e200000000, + 0x07d7707900000000, 0xa94fc90f00000000, 0x7da5ba9400000000, + 0x409c5fe200000000, 0x94762c7900000000, 0xc827bb0c00000000, + 0x1ccdc89700000000, 0x21f42de100000000, 0xf51e5e7a00000000, + 0x5b86e70c00000000, 0x8f6c949700000000, 0xb25571e100000000, + 0x66bf027a00000000, 0xee64020c00000000, 0x3a8e719700000000, + 0x07b794e100000000, 0xd35de77a00000000, 0x7dc55e0c00000000, + 0xa92f2d9700000000, 0x9416c8e100000000, 0x40fcbb7a00000000, + 0x84a1c90d00000000, 0x504bba9600000000, 0x6d725fe000000000, + 0xb9982c7b00000000, 0x1700950d00000000, 0xc3eae69600000000, + 0xfed303e000000000, 0x2a39707b00000000, 0xa2e2700d00000000, + 0x7608039600000000, 0x4b31e6e000000000, 0x9fdb957b00000000, + 0x31432c0d00000000, 0xe5a95f9600000000, 0xd890bae000000000, + 0x0c7ac97b00000000}, + {0x0000000000000000, 0x2765258100000000, 0x0fcc3bd900000000, + 0x28a91e5800000000, 0x5f9e066900000000, 0x78fb23e800000000, + 0x50523db000000000, 0x7737183100000000, 0xbe3c0dd200000000, + 0x9959285300000000, 0xb1f0360b00000000, 0x9695138a00000000, + 0xe1a20bbb00000000, 0xc6c72e3a00000000, 0xee6e306200000000, + 0xc90b15e300000000, 0x3d7f6b7f00000000, 0x1a1a4efe00000000, + 0x32b350a600000000, 0x15d6752700000000, 0x62e16d1600000000, + 0x4584489700000000, 0x6d2d56cf00000000, 0x4a48734e00000000, + 0x834366ad00000000, 0xa426432c00000000, 0x8c8f5d7400000000, + 0xabea78f500000000, 0xdcdd60c400000000, 0xfbb8454500000000, + 0xd3115b1d00000000, 0xf4747e9c00000000, 0x7afed6fe00000000, + 0x5d9bf37f00000000, 0x7532ed2700000000, 0x5257c8a600000000, + 0x2560d09700000000, 0x0205f51600000000, 0x2aaceb4e00000000, + 0x0dc9cecf00000000, 0xc4c2db2c00000000, 0xe3a7fead00000000, + 0xcb0ee0f500000000, 0xec6bc57400000000, 0x9b5cdd4500000000, + 0xbc39f8c400000000, 0x9490e69c00000000, 0xb3f5c31d00000000, + 0x4781bd8100000000, 0x60e4980000000000, 0x484d865800000000, + 0x6f28a3d900000000, 0x181fbbe800000000, 0x3f7a9e6900000000, + 0x17d3803100000000, 0x30b6a5b000000000, 0xf9bdb05300000000, + 0xded895d200000000, 0xf6718b8a00000000, 0xd114ae0b00000000, + 0xa623b63a00000000, 0x814693bb00000000, 0xa9ef8de300000000, + 0x8e8aa86200000000, 0xb5fadc2600000000, 0x929ff9a700000000, + 0xba36e7ff00000000, 0x9d53c27e00000000, 0xea64da4f00000000, + 0xcd01ffce00000000, 0xe5a8e19600000000, 0xc2cdc41700000000, + 0x0bc6d1f400000000, 0x2ca3f47500000000, 0x040aea2d00000000, + 0x236fcfac00000000, 0x5458d79d00000000, 0x733df21c00000000, + 0x5b94ec4400000000, 0x7cf1c9c500000000, 0x8885b75900000000, + 0xafe092d800000000, 0x87498c8000000000, 0xa02ca90100000000, + 0xd71bb13000000000, 0xf07e94b100000000, 0xd8d78ae900000000, + 0xffb2af6800000000, 0x36b9ba8b00000000, 0x11dc9f0a00000000, + 0x3975815200000000, 0x1e10a4d300000000, 0x6927bce200000000, + 0x4e42996300000000, 0x66eb873b00000000, 0x418ea2ba00000000, + 0xcf040ad800000000, 0xe8612f5900000000, 0xc0c8310100000000, + 0xe7ad148000000000, 0x909a0cb100000000, 0xb7ff293000000000, + 0x9f56376800000000, 0xb83312e900000000, 0x7138070a00000000, + 0x565d228b00000000, 0x7ef43cd300000000, 0x5991195200000000, + 0x2ea6016300000000, 0x09c324e200000000, 0x216a3aba00000000, + 0x060f1f3b00000000, 0xf27b61a700000000, 0xd51e442600000000, + 0xfdb75a7e00000000, 0xdad27fff00000000, 0xade567ce00000000, + 0x8a80424f00000000, 0xa2295c1700000000, 0x854c799600000000, + 0x4c476c7500000000, 0x6b2249f400000000, 0x438b57ac00000000, + 0x64ee722d00000000, 0x13d96a1c00000000, 0x34bc4f9d00000000, + 0x1c1551c500000000, 0x3b70744400000000, 0x6af5b94d00000000, + 0x4d909ccc00000000, 0x6539829400000000, 0x425ca71500000000, + 0x356bbf2400000000, 0x120e9aa500000000, 0x3aa784fd00000000, + 0x1dc2a17c00000000, 0xd4c9b49f00000000, 0xf3ac911e00000000, + 0xdb058f4600000000, 0xfc60aac700000000, 0x8b57b2f600000000, + 0xac32977700000000, 0x849b892f00000000, 0xa3feacae00000000, + 0x578ad23200000000, 0x70eff7b300000000, 0x5846e9eb00000000, + 0x7f23cc6a00000000, 0x0814d45b00000000, 0x2f71f1da00000000, + 0x07d8ef8200000000, 0x20bdca0300000000, 0xe9b6dfe000000000, + 0xced3fa6100000000, 0xe67ae43900000000, 0xc11fc1b800000000, + 0xb628d98900000000, 0x914dfc0800000000, 0xb9e4e25000000000, + 0x9e81c7d100000000, 0x100b6fb300000000, 0x376e4a3200000000, + 0x1fc7546a00000000, 0x38a271eb00000000, 0x4f9569da00000000, + 0x68f04c5b00000000, 0x4059520300000000, 0x673c778200000000, + 0xae37626100000000, 0x895247e000000000, 0xa1fb59b800000000, + 0x869e7c3900000000, 0xf1a9640800000000, 0xd6cc418900000000, + 0xfe655fd100000000, 0xd9007a5000000000, 0x2d7404cc00000000, + 0x0a11214d00000000, 0x22b83f1500000000, 0x05dd1a9400000000, + 0x72ea02a500000000, 0x558f272400000000, 0x7d26397c00000000, + 0x5a431cfd00000000, 0x9348091e00000000, 0xb42d2c9f00000000, + 0x9c8432c700000000, 0xbbe1174600000000, 0xccd60f7700000000, + 0xebb32af600000000, 0xc31a34ae00000000, 0xe47f112f00000000, + 0xdf0f656b00000000, 0xf86a40ea00000000, 0xd0c35eb200000000, + 0xf7a67b3300000000, 0x8091630200000000, 0xa7f4468300000000, + 0x8f5d58db00000000, 0xa8387d5a00000000, 0x613368b900000000, + 0x46564d3800000000, 0x6eff536000000000, 0x499a76e100000000, + 0x3ead6ed000000000, 0x19c84b5100000000, 0x3161550900000000, + 0x1604708800000000, 0xe2700e1400000000, 0xc5152b9500000000, + 0xedbc35cd00000000, 0xcad9104c00000000, 0xbdee087d00000000, + 0x9a8b2dfc00000000, 0xb22233a400000000, 0x9547162500000000, + 0x5c4c03c600000000, 0x7b29264700000000, 0x5380381f00000000, + 0x74e51d9e00000000, 0x03d205af00000000, 0x24b7202e00000000, + 0x0c1e3e7600000000, 0x2b7b1bf700000000, 0xa5f1b39500000000, + 0x8294961400000000, 0xaa3d884c00000000, 0x8d58adcd00000000, + 0xfa6fb5fc00000000, 0xdd0a907d00000000, 0xf5a38e2500000000, + 0xd2c6aba400000000, 0x1bcdbe4700000000, 0x3ca89bc600000000, + 0x1401859e00000000, 0x3364a01f00000000, 0x4453b82e00000000, + 0x63369daf00000000, 0x4b9f83f700000000, 0x6cfaa67600000000, + 0x988ed8ea00000000, 0xbfebfd6b00000000, 0x9742e33300000000, + 0xb027c6b200000000, 0xc710de8300000000, 0xe075fb0200000000, + 0xc8dce55a00000000, 0xefb9c0db00000000, 0x26b2d53800000000, + 0x01d7f0b900000000, 0x297eeee100000000, 0x0e1bcb6000000000, + 0x792cd35100000000, 0x5e49f6d000000000, 0x76e0e88800000000, + 0x5185cd0900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x9ba54c6f, 0xec3b9e9f, 0x779ed2f0, 0x03063b7f, + 0x98a37710, 0xef3da5e0, 0x7498e98f, 0x060c76fe, 0x9da93a91, + 0xea37e861, 0x7192a40e, 0x050a4d81, 0x9eaf01ee, 0xe931d31e, + 0x72949f71, 0x0c18edfc, 0x97bda193, 0xe0237363, 0x7b863f0c, + 0x0f1ed683, 0x94bb9aec, 0xe325481c, 0x78800473, 0x0a149b02, + 0x91b1d76d, 0xe62f059d, 0x7d8a49f2, 0x0912a07d, 0x92b7ec12, + 0xe5293ee2, 0x7e8c728d, 0x1831dbf8, 0x83949797, 0xf40a4567, + 0x6faf0908, 0x1b37e087, 0x8092ace8, 0xf70c7e18, 0x6ca93277, + 0x1e3dad06, 0x8598e169, 0xf2063399, 0x69a37ff6, 0x1d3b9679, + 0x869eda16, 0xf10008e6, 0x6aa54489, 0x14293604, 0x8f8c7a6b, + 0xf812a89b, 0x63b7e4f4, 0x172f0d7b, 0x8c8a4114, 0xfb1493e4, + 0x60b1df8b, 0x122540fa, 0x89800c95, 0xfe1ede65, 0x65bb920a, + 0x11237b85, 0x8a8637ea, 0xfd18e51a, 0x66bda975, 0x3063b7f0, + 0xabc6fb9f, 0xdc58296f, 0x47fd6500, 0x33658c8f, 0xa8c0c0e0, + 0xdf5e1210, 0x44fb5e7f, 0x366fc10e, 0xadca8d61, 0xda545f91, + 0x41f113fe, 0x3569fa71, 0xaeccb61e, 0xd95264ee, 0x42f72881, + 0x3c7b5a0c, 0xa7de1663, 0xd040c493, 0x4be588fc, 0x3f7d6173, + 0xa4d82d1c, 0xd346ffec, 0x48e3b383, 0x3a772cf2, 0xa1d2609d, + 0xd64cb26d, 0x4de9fe02, 0x3971178d, 0xa2d45be2, 0xd54a8912, + 0x4eefc57d, 0x28526c08, 0xb3f72067, 0xc469f297, 0x5fccbef8, + 0x2b545777, 0xb0f11b18, 0xc76fc9e8, 0x5cca8587, 0x2e5e1af6, + 0xb5fb5699, 0xc2658469, 0x59c0c806, 0x2d582189, 0xb6fd6de6, + 0xc163bf16, 0x5ac6f379, 0x244a81f4, 0xbfefcd9b, 0xc8711f6b, + 0x53d45304, 0x274cba8b, 0xbce9f6e4, 0xcb772414, 0x50d2687b, + 0x2246f70a, 0xb9e3bb65, 0xce7d6995, 0x55d825fa, 0x2140cc75, + 0xbae5801a, 0xcd7b52ea, 0x56de1e85, 0x60c76fe0, 0xfb62238f, + 0x8cfcf17f, 0x1759bd10, 0x63c1549f, 0xf86418f0, 0x8ffaca00, + 0x145f866f, 0x66cb191e, 0xfd6e5571, 0x8af08781, 0x1155cbee, + 0x65cd2261, 0xfe686e0e, 0x89f6bcfe, 0x1253f091, 0x6cdf821c, + 0xf77ace73, 0x80e41c83, 0x1b4150ec, 0x6fd9b963, 0xf47cf50c, + 0x83e227fc, 0x18476b93, 0x6ad3f4e2, 0xf176b88d, 0x86e86a7d, + 0x1d4d2612, 0x69d5cf9d, 0xf27083f2, 0x85ee5102, 0x1e4b1d6d, + 0x78f6b418, 0xe353f877, 0x94cd2a87, 0x0f6866e8, 0x7bf08f67, + 0xe055c308, 0x97cb11f8, 0x0c6e5d97, 0x7efac2e6, 0xe55f8e89, + 0x92c15c79, 0x09641016, 0x7dfcf999, 0xe659b5f6, 0x91c76706, + 0x0a622b69, 0x74ee59e4, 0xef4b158b, 0x98d5c77b, 0x03708b14, + 0x77e8629b, 0xec4d2ef4, 0x9bd3fc04, 0x0076b06b, 0x72e22f1a, + 0xe9476375, 0x9ed9b185, 0x057cfdea, 0x71e41465, 0xea41580a, + 0x9ddf8afa, 0x067ac695, 0x50a4d810, 0xcb01947f, 0xbc9f468f, + 0x273a0ae0, 0x53a2e36f, 0xc807af00, 0xbf997df0, 0x243c319f, + 0x56a8aeee, 0xcd0de281, 0xba933071, 0x21367c1e, 0x55ae9591, + 0xce0bd9fe, 0xb9950b0e, 0x22304761, 0x5cbc35ec, 0xc7197983, + 0xb087ab73, 0x2b22e71c, 0x5fba0e93, 0xc41f42fc, 0xb381900c, + 0x2824dc63, 0x5ab04312, 0xc1150f7d, 0xb68bdd8d, 0x2d2e91e2, + 0x59b6786d, 0xc2133402, 0xb58de6f2, 0x2e28aa9d, 0x489503e8, + 0xd3304f87, 0xa4ae9d77, 0x3f0bd118, 0x4b933897, 0xd03674f8, + 0xa7a8a608, 0x3c0dea67, 0x4e997516, 0xd53c3979, 0xa2a2eb89, + 0x3907a7e6, 0x4d9f4e69, 0xd63a0206, 0xa1a4d0f6, 0x3a019c99, + 0x448dee14, 0xdf28a27b, 0xa8b6708b, 0x33133ce4, 0x478bd56b, + 0xdc2e9904, 0xabb04bf4, 0x3015079b, 0x428198ea, 0xd924d485, + 0xaeba0675, 0x351f4a1a, 0x4187a395, 0xda22effa, 0xadbc3d0a, + 0x36197165}, + {0x00000000, 0xc18edfc0, 0x586cb9c1, 0x99e26601, 0xb0d97382, + 0x7157ac42, 0xe8b5ca43, 0x293b1583, 0xbac3e145, 0x7b4d3e85, + 0xe2af5884, 0x23218744, 0x0a1a92c7, 0xcb944d07, 0x52762b06, + 0x93f8f4c6, 0xaef6c4cb, 0x6f781b0b, 0xf69a7d0a, 0x3714a2ca, + 0x1e2fb749, 0xdfa16889, 0x46430e88, 0x87cdd148, 0x1435258e, + 0xd5bbfa4e, 0x4c599c4f, 0x8dd7438f, 0xa4ec560c, 0x656289cc, + 0xfc80efcd, 0x3d0e300d, 0x869c8fd7, 0x47125017, 0xdef03616, + 0x1f7ee9d6, 0x3645fc55, 0xf7cb2395, 0x6e294594, 0xafa79a54, + 0x3c5f6e92, 0xfdd1b152, 0x6433d753, 0xa5bd0893, 0x8c861d10, + 0x4d08c2d0, 0xd4eaa4d1, 0x15647b11, 0x286a4b1c, 0xe9e494dc, + 0x7006f2dd, 0xb1882d1d, 0x98b3389e, 0x593de75e, 0xc0df815f, + 0x01515e9f, 0x92a9aa59, 0x53277599, 0xcac51398, 0x0b4bcc58, + 0x2270d9db, 0xe3fe061b, 0x7a1c601a, 0xbb92bfda, 0xd64819ef, + 0x17c6c62f, 0x8e24a02e, 0x4faa7fee, 0x66916a6d, 0xa71fb5ad, + 0x3efdd3ac, 0xff730c6c, 0x6c8bf8aa, 0xad05276a, 0x34e7416b, + 0xf5699eab, 0xdc528b28, 0x1ddc54e8, 0x843e32e9, 0x45b0ed29, + 0x78bedd24, 0xb93002e4, 0x20d264e5, 0xe15cbb25, 0xc867aea6, + 0x09e97166, 0x900b1767, 0x5185c8a7, 0xc27d3c61, 0x03f3e3a1, + 0x9a1185a0, 0x5b9f5a60, 0x72a44fe3, 0xb32a9023, 0x2ac8f622, + 0xeb4629e2, 0x50d49638, 0x915a49f8, 0x08b82ff9, 0xc936f039, + 0xe00de5ba, 0x21833a7a, 0xb8615c7b, 0x79ef83bb, 0xea17777d, + 0x2b99a8bd, 0xb27bcebc, 0x73f5117c, 0x5ace04ff, 0x9b40db3f, + 0x02a2bd3e, 0xc32c62fe, 0xfe2252f3, 0x3fac8d33, 0xa64eeb32, + 0x67c034f2, 0x4efb2171, 0x8f75feb1, 0x169798b0, 0xd7194770, + 0x44e1b3b6, 0x856f6c76, 0x1c8d0a77, 0xdd03d5b7, 0xf438c034, + 0x35b61ff4, 0xac5479f5, 0x6ddaa635, 0x77e1359f, 0xb66fea5f, + 0x2f8d8c5e, 0xee03539e, 0xc738461d, 0x06b699dd, 0x9f54ffdc, + 0x5eda201c, 0xcd22d4da, 0x0cac0b1a, 0x954e6d1b, 0x54c0b2db, + 0x7dfba758, 0xbc757898, 0x25971e99, 0xe419c159, 0xd917f154, + 0x18992e94, 0x817b4895, 0x40f59755, 0x69ce82d6, 0xa8405d16, + 0x31a23b17, 0xf02ce4d7, 0x63d41011, 0xa25acfd1, 0x3bb8a9d0, + 0xfa367610, 0xd30d6393, 0x1283bc53, 0x8b61da52, 0x4aef0592, + 0xf17dba48, 0x30f36588, 0xa9110389, 0x689fdc49, 0x41a4c9ca, + 0x802a160a, 0x19c8700b, 0xd846afcb, 0x4bbe5b0d, 0x8a3084cd, + 0x13d2e2cc, 0xd25c3d0c, 0xfb67288f, 0x3ae9f74f, 0xa30b914e, + 0x62854e8e, 0x5f8b7e83, 0x9e05a143, 0x07e7c742, 0xc6691882, + 0xef520d01, 0x2edcd2c1, 0xb73eb4c0, 0x76b06b00, 0xe5489fc6, + 0x24c64006, 0xbd242607, 0x7caaf9c7, 0x5591ec44, 0x941f3384, + 0x0dfd5585, 0xcc738a45, 0xa1a92c70, 0x6027f3b0, 0xf9c595b1, + 0x384b4a71, 0x11705ff2, 0xd0fe8032, 0x491ce633, 0x889239f3, + 0x1b6acd35, 0xdae412f5, 0x430674f4, 0x8288ab34, 0xabb3beb7, + 0x6a3d6177, 0xf3df0776, 0x3251d8b6, 0x0f5fe8bb, 0xced1377b, + 0x5733517a, 0x96bd8eba, 0xbf869b39, 0x7e0844f9, 0xe7ea22f8, + 0x2664fd38, 0xb59c09fe, 0x7412d63e, 0xedf0b03f, 0x2c7e6fff, + 0x05457a7c, 0xc4cba5bc, 0x5d29c3bd, 0x9ca71c7d, 0x2735a3a7, + 0xe6bb7c67, 0x7f591a66, 0xbed7c5a6, 0x97ecd025, 0x56620fe5, + 0xcf8069e4, 0x0e0eb624, 0x9df642e2, 0x5c789d22, 0xc59afb23, + 0x041424e3, 0x2d2f3160, 0xeca1eea0, 0x754388a1, 0xb4cd5761, + 0x89c3676c, 0x484db8ac, 0xd1afdead, 0x1021016d, 0x391a14ee, + 0xf894cb2e, 0x6176ad2f, 0xa0f872ef, 0x33008629, 0xf28e59e9, + 0x6b6c3fe8, 0xaae2e028, 0x83d9f5ab, 0x42572a6b, 0xdbb54c6a, + 0x1a3b93aa}, + {0x00000000, 0xefc26b3e, 0x04f5d03d, 0xeb37bb03, 0x09eba07a, + 0xe629cb44, 0x0d1e7047, 0xe2dc1b79, 0x13d740f4, 0xfc152bca, + 0x172290c9, 0xf8e0fbf7, 0x1a3ce08e, 0xf5fe8bb0, 0x1ec930b3, + 0xf10b5b8d, 0x27ae81e8, 0xc86cead6, 0x235b51d5, 0xcc993aeb, + 0x2e452192, 0xc1874aac, 0x2ab0f1af, 0xc5729a91, 0x3479c11c, + 0xdbbbaa22, 0x308c1121, 0xdf4e7a1f, 0x3d926166, 0xd2500a58, + 0x3967b15b, 0xd6a5da65, 0x4f5d03d0, 0xa09f68ee, 0x4ba8d3ed, + 0xa46ab8d3, 0x46b6a3aa, 0xa974c894, 0x42437397, 0xad8118a9, + 0x5c8a4324, 0xb348281a, 0x587f9319, 0xb7bdf827, 0x5561e35e, + 0xbaa38860, 0x51943363, 0xbe56585d, 0x68f38238, 0x8731e906, + 0x6c065205, 0x83c4393b, 0x61182242, 0x8eda497c, 0x65edf27f, + 0x8a2f9941, 0x7b24c2cc, 0x94e6a9f2, 0x7fd112f1, 0x901379cf, + 0x72cf62b6, 0x9d0d0988, 0x763ab28b, 0x99f8d9b5, 0x9eba07a0, + 0x71786c9e, 0x9a4fd79d, 0x758dbca3, 0x9751a7da, 0x7893cce4, + 0x93a477e7, 0x7c661cd9, 0x8d6d4754, 0x62af2c6a, 0x89989769, + 0x665afc57, 0x8486e72e, 0x6b448c10, 0x80733713, 0x6fb15c2d, + 0xb9148648, 0x56d6ed76, 0xbde15675, 0x52233d4b, 0xb0ff2632, + 0x5f3d4d0c, 0xb40af60f, 0x5bc89d31, 0xaac3c6bc, 0x4501ad82, + 0xae361681, 0x41f47dbf, 0xa32866c6, 0x4cea0df8, 0xa7ddb6fb, + 0x481fddc5, 0xd1e70470, 0x3e256f4e, 0xd512d44d, 0x3ad0bf73, + 0xd80ca40a, 0x37cecf34, 0xdcf97437, 0x333b1f09, 0xc2304484, + 0x2df22fba, 0xc6c594b9, 0x2907ff87, 0xcbdbe4fe, 0x24198fc0, + 0xcf2e34c3, 0x20ec5ffd, 0xf6498598, 0x198beea6, 0xf2bc55a5, + 0x1d7e3e9b, 0xffa225e2, 0x10604edc, 0xfb57f5df, 0x14959ee1, + 0xe59ec56c, 0x0a5cae52, 0xe16b1551, 0x0ea97e6f, 0xec756516, + 0x03b70e28, 0xe880b52b, 0x0742de15, 0xe6050901, 0x09c7623f, + 0xe2f0d93c, 0x0d32b202, 0xefeea97b, 0x002cc245, 0xeb1b7946, + 0x04d91278, 0xf5d249f5, 0x1a1022cb, 0xf12799c8, 0x1ee5f2f6, + 0xfc39e98f, 0x13fb82b1, 0xf8cc39b2, 0x170e528c, 0xc1ab88e9, + 0x2e69e3d7, 0xc55e58d4, 0x2a9c33ea, 0xc8402893, 0x278243ad, + 0xccb5f8ae, 0x23779390, 0xd27cc81d, 0x3dbea323, 0xd6891820, + 0x394b731e, 0xdb976867, 0x34550359, 0xdf62b85a, 0x30a0d364, + 0xa9580ad1, 0x469a61ef, 0xadaddaec, 0x426fb1d2, 0xa0b3aaab, + 0x4f71c195, 0xa4467a96, 0x4b8411a8, 0xba8f4a25, 0x554d211b, + 0xbe7a9a18, 0x51b8f126, 0xb364ea5f, 0x5ca68161, 0xb7913a62, + 0x5853515c, 0x8ef68b39, 0x6134e007, 0x8a035b04, 0x65c1303a, + 0x871d2b43, 0x68df407d, 0x83e8fb7e, 0x6c2a9040, 0x9d21cbcd, + 0x72e3a0f3, 0x99d41bf0, 0x761670ce, 0x94ca6bb7, 0x7b080089, + 0x903fbb8a, 0x7ffdd0b4, 0x78bf0ea1, 0x977d659f, 0x7c4ade9c, + 0x9388b5a2, 0x7154aedb, 0x9e96c5e5, 0x75a17ee6, 0x9a6315d8, + 0x6b684e55, 0x84aa256b, 0x6f9d9e68, 0x805ff556, 0x6283ee2f, + 0x8d418511, 0x66763e12, 0x89b4552c, 0x5f118f49, 0xb0d3e477, + 0x5be45f74, 0xb426344a, 0x56fa2f33, 0xb938440d, 0x520fff0e, + 0xbdcd9430, 0x4cc6cfbd, 0xa304a483, 0x48331f80, 0xa7f174be, + 0x452d6fc7, 0xaaef04f9, 0x41d8bffa, 0xae1ad4c4, 0x37e20d71, + 0xd820664f, 0x3317dd4c, 0xdcd5b672, 0x3e09ad0b, 0xd1cbc635, + 0x3afc7d36, 0xd53e1608, 0x24354d85, 0xcbf726bb, 0x20c09db8, + 0xcf02f686, 0x2ddeedff, 0xc21c86c1, 0x292b3dc2, 0xc6e956fc, + 0x104c8c99, 0xff8ee7a7, 0x14b95ca4, 0xfb7b379a, 0x19a72ce3, + 0xf66547dd, 0x1d52fcde, 0xf29097e0, 0x039bcc6d, 0xec59a753, + 0x076e1c50, 0xe8ac776e, 0x0a706c17, 0xe5b20729, 0x0e85bc2a, + 0xe147d714}, + {0x00000000, 0x177b1443, 0x2ef62886, 0x398d3cc5, 0x5dec510c, + 0x4a97454f, 0x731a798a, 0x64616dc9, 0xbbd8a218, 0xaca3b65b, + 0x952e8a9e, 0x82559edd, 0xe634f314, 0xf14fe757, 0xc8c2db92, + 0xdfb9cfd1, 0xacc04271, 0xbbbb5632, 0x82366af7, 0x954d7eb4, + 0xf12c137d, 0xe657073e, 0xdfda3bfb, 0xc8a12fb8, 0x1718e069, + 0x0063f42a, 0x39eec8ef, 0x2e95dcac, 0x4af4b165, 0x5d8fa526, + 0x640299e3, 0x73798da0, 0x82f182a3, 0x958a96e0, 0xac07aa25, + 0xbb7cbe66, 0xdf1dd3af, 0xc866c7ec, 0xf1ebfb29, 0xe690ef6a, + 0x392920bb, 0x2e5234f8, 0x17df083d, 0x00a41c7e, 0x64c571b7, + 0x73be65f4, 0x4a335931, 0x5d484d72, 0x2e31c0d2, 0x394ad491, + 0x00c7e854, 0x17bcfc17, 0x73dd91de, 0x64a6859d, 0x5d2bb958, + 0x4a50ad1b, 0x95e962ca, 0x82927689, 0xbb1f4a4c, 0xac645e0f, + 0xc80533c6, 0xdf7e2785, 0xe6f31b40, 0xf1880f03, 0xde920307, + 0xc9e91744, 0xf0642b81, 0xe71f3fc2, 0x837e520b, 0x94054648, + 0xad887a8d, 0xbaf36ece, 0x654aa11f, 0x7231b55c, 0x4bbc8999, + 0x5cc79dda, 0x38a6f013, 0x2fdde450, 0x1650d895, 0x012bccd6, + 0x72524176, 0x65295535, 0x5ca469f0, 0x4bdf7db3, 0x2fbe107a, + 0x38c50439, 0x014838fc, 0x16332cbf, 0xc98ae36e, 0xdef1f72d, + 0xe77ccbe8, 0xf007dfab, 0x9466b262, 0x831da621, 0xba909ae4, + 0xadeb8ea7, 0x5c6381a4, 0x4b1895e7, 0x7295a922, 0x65eebd61, + 0x018fd0a8, 0x16f4c4eb, 0x2f79f82e, 0x3802ec6d, 0xe7bb23bc, + 0xf0c037ff, 0xc94d0b3a, 0xde361f79, 0xba5772b0, 0xad2c66f3, + 0x94a15a36, 0x83da4e75, 0xf0a3c3d5, 0xe7d8d796, 0xde55eb53, + 0xc92eff10, 0xad4f92d9, 0xba34869a, 0x83b9ba5f, 0x94c2ae1c, + 0x4b7b61cd, 0x5c00758e, 0x658d494b, 0x72f65d08, 0x169730c1, + 0x01ec2482, 0x38611847, 0x2f1a0c04, 0x6655004f, 0x712e140c, + 0x48a328c9, 0x5fd83c8a, 0x3bb95143, 0x2cc24500, 0x154f79c5, + 0x02346d86, 0xdd8da257, 0xcaf6b614, 0xf37b8ad1, 0xe4009e92, + 0x8061f35b, 0x971ae718, 0xae97dbdd, 0xb9eccf9e, 0xca95423e, + 0xddee567d, 0xe4636ab8, 0xf3187efb, 0x97791332, 0x80020771, + 0xb98f3bb4, 0xaef42ff7, 0x714de026, 0x6636f465, 0x5fbbc8a0, + 0x48c0dce3, 0x2ca1b12a, 0x3bdaa569, 0x025799ac, 0x152c8def, + 0xe4a482ec, 0xf3df96af, 0xca52aa6a, 0xdd29be29, 0xb948d3e0, + 0xae33c7a3, 0x97befb66, 0x80c5ef25, 0x5f7c20f4, 0x480734b7, + 0x718a0872, 0x66f11c31, 0x029071f8, 0x15eb65bb, 0x2c66597e, + 0x3b1d4d3d, 0x4864c09d, 0x5f1fd4de, 0x6692e81b, 0x71e9fc58, + 0x15889191, 0x02f385d2, 0x3b7eb917, 0x2c05ad54, 0xf3bc6285, + 0xe4c776c6, 0xdd4a4a03, 0xca315e40, 0xae503389, 0xb92b27ca, + 0x80a61b0f, 0x97dd0f4c, 0xb8c70348, 0xafbc170b, 0x96312bce, + 0x814a3f8d, 0xe52b5244, 0xf2504607, 0xcbdd7ac2, 0xdca66e81, + 0x031fa150, 0x1464b513, 0x2de989d6, 0x3a929d95, 0x5ef3f05c, + 0x4988e41f, 0x7005d8da, 0x677ecc99, 0x14074139, 0x037c557a, + 0x3af169bf, 0x2d8a7dfc, 0x49eb1035, 0x5e900476, 0x671d38b3, + 0x70662cf0, 0xafdfe321, 0xb8a4f762, 0x8129cba7, 0x9652dfe4, + 0xf233b22d, 0xe548a66e, 0xdcc59aab, 0xcbbe8ee8, 0x3a3681eb, + 0x2d4d95a8, 0x14c0a96d, 0x03bbbd2e, 0x67dad0e7, 0x70a1c4a4, + 0x492cf861, 0x5e57ec22, 0x81ee23f3, 0x969537b0, 0xaf180b75, + 0xb8631f36, 0xdc0272ff, 0xcb7966bc, 0xf2f45a79, 0xe58f4e3a, + 0x96f6c39a, 0x818dd7d9, 0xb800eb1c, 0xaf7bff5f, 0xcb1a9296, + 0xdc6186d5, 0xe5ecba10, 0xf297ae53, 0x2d2e6182, 0x3a5575c1, + 0x03d84904, 0x14a35d47, 0x70c2308e, 0x67b924cd, 0x5e341808, + 0x494f0c4b}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43147b17, 0x8628f62e, 0xc53c8d39, 0x0c51ec5d, + 0x4f45974a, 0x8a791a73, 0xc96d6164, 0x18a2d8bb, 0x5bb6a3ac, + 0x9e8a2e95, 0xdd9e5582, 0x14f334e6, 0x57e74ff1, 0x92dbc2c8, + 0xd1cfb9df, 0x7142c0ac, 0x3256bbbb, 0xf76a3682, 0xb47e4d95, + 0x7d132cf1, 0x3e0757e6, 0xfb3bdadf, 0xb82fa1c8, 0x69e01817, + 0x2af46300, 0xefc8ee39, 0xacdc952e, 0x65b1f44a, 0x26a58f5d, + 0xe3990264, 0xa08d7973, 0xa382f182, 0xe0968a95, 0x25aa07ac, + 0x66be7cbb, 0xafd31ddf, 0xecc766c8, 0x29fbebf1, 0x6aef90e6, + 0xbb202939, 0xf834522e, 0x3d08df17, 0x7e1ca400, 0xb771c564, + 0xf465be73, 0x3159334a, 0x724d485d, 0xd2c0312e, 0x91d44a39, + 0x54e8c700, 0x17fcbc17, 0xde91dd73, 0x9d85a664, 0x58b92b5d, + 0x1bad504a, 0xca62e995, 0x89769282, 0x4c4a1fbb, 0x0f5e64ac, + 0xc63305c8, 0x85277edf, 0x401bf3e6, 0x030f88f1, 0x070392de, + 0x4417e9c9, 0x812b64f0, 0xc23f1fe7, 0x0b527e83, 0x48460594, + 0x8d7a88ad, 0xce6ef3ba, 0x1fa14a65, 0x5cb53172, 0x9989bc4b, + 0xda9dc75c, 0x13f0a638, 0x50e4dd2f, 0x95d85016, 0xd6cc2b01, + 0x76415272, 0x35552965, 0xf069a45c, 0xb37ddf4b, 0x7a10be2f, + 0x3904c538, 0xfc384801, 0xbf2c3316, 0x6ee38ac9, 0x2df7f1de, + 0xe8cb7ce7, 0xabdf07f0, 0x62b26694, 0x21a61d83, 0xe49a90ba, + 0xa78eebad, 0xa481635c, 0xe795184b, 0x22a99572, 0x61bdee65, + 0xa8d08f01, 0xebc4f416, 0x2ef8792f, 0x6dec0238, 0xbc23bbe7, + 0xff37c0f0, 0x3a0b4dc9, 0x791f36de, 0xb07257ba, 0xf3662cad, + 0x365aa194, 0x754eda83, 0xd5c3a3f0, 0x96d7d8e7, 0x53eb55de, + 0x10ff2ec9, 0xd9924fad, 0x9a8634ba, 0x5fbab983, 0x1caec294, + 0xcd617b4b, 0x8e75005c, 0x4b498d65, 0x085df672, 0xc1309716, + 0x8224ec01, 0x47186138, 0x040c1a2f, 0x4f005566, 0x0c142e71, + 0xc928a348, 0x8a3cd85f, 0x4351b93b, 0x0045c22c, 0xc5794f15, + 0x866d3402, 0x57a28ddd, 0x14b6f6ca, 0xd18a7bf3, 0x929e00e4, + 0x5bf36180, 0x18e71a97, 0xdddb97ae, 0x9ecfecb9, 0x3e4295ca, + 0x7d56eedd, 0xb86a63e4, 0xfb7e18f3, 0x32137997, 0x71070280, + 0xb43b8fb9, 0xf72ff4ae, 0x26e04d71, 0x65f43666, 0xa0c8bb5f, + 0xe3dcc048, 0x2ab1a12c, 0x69a5da3b, 0xac995702, 0xef8d2c15, + 0xec82a4e4, 0xaf96dff3, 0x6aaa52ca, 0x29be29dd, 0xe0d348b9, + 0xa3c733ae, 0x66fbbe97, 0x25efc580, 0xf4207c5f, 0xb7340748, + 0x72088a71, 0x311cf166, 0xf8719002, 0xbb65eb15, 0x7e59662c, + 0x3d4d1d3b, 0x9dc06448, 0xded41f5f, 0x1be89266, 0x58fce971, + 0x91918815, 0xd285f302, 0x17b97e3b, 0x54ad052c, 0x8562bcf3, + 0xc676c7e4, 0x034a4add, 0x405e31ca, 0x893350ae, 0xca272bb9, + 0x0f1ba680, 0x4c0fdd97, 0x4803c7b8, 0x0b17bcaf, 0xce2b3196, + 0x8d3f4a81, 0x44522be5, 0x074650f2, 0xc27addcb, 0x816ea6dc, + 0x50a11f03, 0x13b56414, 0xd689e92d, 0x959d923a, 0x5cf0f35e, + 0x1fe48849, 0xdad80570, 0x99cc7e67, 0x39410714, 0x7a557c03, + 0xbf69f13a, 0xfc7d8a2d, 0x3510eb49, 0x7604905e, 0xb3381d67, + 0xf02c6670, 0x21e3dfaf, 0x62f7a4b8, 0xa7cb2981, 0xe4df5296, + 0x2db233f2, 0x6ea648e5, 0xab9ac5dc, 0xe88ebecb, 0xeb81363a, + 0xa8954d2d, 0x6da9c014, 0x2ebdbb03, 0xe7d0da67, 0xa4c4a170, + 0x61f82c49, 0x22ec575e, 0xf323ee81, 0xb0379596, 0x750b18af, + 0x361f63b8, 0xff7202dc, 0xbc6679cb, 0x795af4f2, 0x3a4e8fe5, + 0x9ac3f696, 0xd9d78d81, 0x1ceb00b8, 0x5fff7baf, 0x96921acb, + 0xd58661dc, 0x10baece5, 0x53ae97f2, 0x82612e2d, 0xc175553a, + 0x0449d803, 0x475da314, 0x8e30c270, 0xcd24b967, 0x0818345e, + 0x4b0c4f49}, + {0x00000000, 0x3e6bc2ef, 0x3dd0f504, 0x03bb37eb, 0x7aa0eb09, + 0x44cb29e6, 0x47701e0d, 0x791bdce2, 0xf440d713, 0xca2b15fc, + 0xc9902217, 0xf7fbe0f8, 0x8ee03c1a, 0xb08bfef5, 0xb330c91e, + 0x8d5b0bf1, 0xe881ae27, 0xd6ea6cc8, 0xd5515b23, 0xeb3a99cc, + 0x9221452e, 0xac4a87c1, 0xaff1b02a, 0x919a72c5, 0x1cc17934, + 0x22aabbdb, 0x21118c30, 0x1f7a4edf, 0x6661923d, 0x580a50d2, + 0x5bb16739, 0x65daa5d6, 0xd0035d4f, 0xee689fa0, 0xedd3a84b, + 0xd3b86aa4, 0xaaa3b646, 0x94c874a9, 0x97734342, 0xa91881ad, + 0x24438a5c, 0x1a2848b3, 0x19937f58, 0x27f8bdb7, 0x5ee36155, + 0x6088a3ba, 0x63339451, 0x5d5856be, 0x3882f368, 0x06e93187, + 0x0552066c, 0x3b39c483, 0x42221861, 0x7c49da8e, 0x7ff2ed65, + 0x41992f8a, 0xccc2247b, 0xf2a9e694, 0xf112d17f, 0xcf791390, + 0xb662cf72, 0x88090d9d, 0x8bb23a76, 0xb5d9f899, 0xa007ba9e, + 0x9e6c7871, 0x9dd74f9a, 0xa3bc8d75, 0xdaa75197, 0xe4cc9378, + 0xe777a493, 0xd91c667c, 0x54476d8d, 0x6a2caf62, 0x69979889, + 0x57fc5a66, 0x2ee78684, 0x108c446b, 0x13377380, 0x2d5cb16f, + 0x488614b9, 0x76edd656, 0x7556e1bd, 0x4b3d2352, 0x3226ffb0, + 0x0c4d3d5f, 0x0ff60ab4, 0x319dc85b, 0xbcc6c3aa, 0x82ad0145, + 0x811636ae, 0xbf7df441, 0xc66628a3, 0xf80dea4c, 0xfbb6dda7, + 0xc5dd1f48, 0x7004e7d1, 0x4e6f253e, 0x4dd412d5, 0x73bfd03a, + 0x0aa40cd8, 0x34cfce37, 0x3774f9dc, 0x091f3b33, 0x844430c2, + 0xba2ff22d, 0xb994c5c6, 0x87ff0729, 0xfee4dbcb, 0xc08f1924, + 0xc3342ecf, 0xfd5fec20, 0x988549f6, 0xa6ee8b19, 0xa555bcf2, + 0x9b3e7e1d, 0xe225a2ff, 0xdc4e6010, 0xdff557fb, 0xe19e9514, + 0x6cc59ee5, 0x52ae5c0a, 0x51156be1, 0x6f7ea90e, 0x166575ec, + 0x280eb703, 0x2bb580e8, 0x15de4207, 0x010905e6, 0x3f62c709, + 0x3cd9f0e2, 0x02b2320d, 0x7ba9eeef, 0x45c22c00, 0x46791beb, + 0x7812d904, 0xf549d2f5, 0xcb22101a, 0xc89927f1, 0xf6f2e51e, + 0x8fe939fc, 0xb182fb13, 0xb239ccf8, 0x8c520e17, 0xe988abc1, + 0xd7e3692e, 0xd4585ec5, 0xea339c2a, 0x932840c8, 0xad438227, + 0xaef8b5cc, 0x90937723, 0x1dc87cd2, 0x23a3be3d, 0x201889d6, + 0x1e734b39, 0x676897db, 0x59035534, 0x5ab862df, 0x64d3a030, + 0xd10a58a9, 0xef619a46, 0xecdaadad, 0xd2b16f42, 0xabaab3a0, + 0x95c1714f, 0x967a46a4, 0xa811844b, 0x254a8fba, 0x1b214d55, + 0x189a7abe, 0x26f1b851, 0x5fea64b3, 0x6181a65c, 0x623a91b7, + 0x5c515358, 0x398bf68e, 0x07e03461, 0x045b038a, 0x3a30c165, + 0x432b1d87, 0x7d40df68, 0x7efbe883, 0x40902a6c, 0xcdcb219d, + 0xf3a0e372, 0xf01bd499, 0xce701676, 0xb76bca94, 0x8900087b, + 0x8abb3f90, 0xb4d0fd7f, 0xa10ebf78, 0x9f657d97, 0x9cde4a7c, + 0xa2b58893, 0xdbae5471, 0xe5c5969e, 0xe67ea175, 0xd815639a, + 0x554e686b, 0x6b25aa84, 0x689e9d6f, 0x56f55f80, 0x2fee8362, + 0x1185418d, 0x123e7666, 0x2c55b489, 0x498f115f, 0x77e4d3b0, + 0x745fe45b, 0x4a3426b4, 0x332ffa56, 0x0d4438b9, 0x0eff0f52, + 0x3094cdbd, 0xbdcfc64c, 0x83a404a3, 0x801f3348, 0xbe74f1a7, + 0xc76f2d45, 0xf904efaa, 0xfabfd841, 0xc4d41aae, 0x710de237, + 0x4f6620d8, 0x4cdd1733, 0x72b6d5dc, 0x0bad093e, 0x35c6cbd1, + 0x367dfc3a, 0x08163ed5, 0x854d3524, 0xbb26f7cb, 0xb89dc020, + 0x86f602cf, 0xffedde2d, 0xc1861cc2, 0xc23d2b29, 0xfc56e9c6, + 0x998c4c10, 0xa7e78eff, 0xa45cb914, 0x9a377bfb, 0xe32ca719, + 0xdd4765f6, 0xdefc521d, 0xe09790f2, 0x6dcc9b03, 0x53a759ec, + 0x501c6e07, 0x6e77ace8, 0x176c700a, 0x2907b2e5, 0x2abc850e, + 0x14d747e1}, + {0x00000000, 0xc0df8ec1, 0xc1b96c58, 0x0166e299, 0x8273d9b0, + 0x42ac5771, 0x43cab5e8, 0x83153b29, 0x45e1c3ba, 0x853e4d7b, + 0x8458afe2, 0x44872123, 0xc7921a0a, 0x074d94cb, 0x062b7652, + 0xc6f4f893, 0xcbc4f6ae, 0x0b1b786f, 0x0a7d9af6, 0xcaa21437, + 0x49b72f1e, 0x8968a1df, 0x880e4346, 0x48d1cd87, 0x8e253514, + 0x4efabbd5, 0x4f9c594c, 0x8f43d78d, 0x0c56eca4, 0xcc896265, + 0xcdef80fc, 0x0d300e3d, 0xd78f9c86, 0x17501247, 0x1636f0de, + 0xd6e97e1f, 0x55fc4536, 0x9523cbf7, 0x9445296e, 0x549aa7af, + 0x926e5f3c, 0x52b1d1fd, 0x53d73364, 0x9308bda5, 0x101d868c, + 0xd0c2084d, 0xd1a4ead4, 0x117b6415, 0x1c4b6a28, 0xdc94e4e9, + 0xddf20670, 0x1d2d88b1, 0x9e38b398, 0x5ee73d59, 0x5f81dfc0, + 0x9f5e5101, 0x59aaa992, 0x99752753, 0x9813c5ca, 0x58cc4b0b, + 0xdbd97022, 0x1b06fee3, 0x1a601c7a, 0xdabf92bb, 0xef1948d6, + 0x2fc6c617, 0x2ea0248e, 0xee7faa4f, 0x6d6a9166, 0xadb51fa7, + 0xacd3fd3e, 0x6c0c73ff, 0xaaf88b6c, 0x6a2705ad, 0x6b41e734, + 0xab9e69f5, 0x288b52dc, 0xe854dc1d, 0xe9323e84, 0x29edb045, + 0x24ddbe78, 0xe40230b9, 0xe564d220, 0x25bb5ce1, 0xa6ae67c8, + 0x6671e909, 0x67170b90, 0xa7c88551, 0x613c7dc2, 0xa1e3f303, + 0xa085119a, 0x605a9f5b, 0xe34fa472, 0x23902ab3, 0x22f6c82a, + 0xe22946eb, 0x3896d450, 0xf8495a91, 0xf92fb808, 0x39f036c9, + 0xbae50de0, 0x7a3a8321, 0x7b5c61b8, 0xbb83ef79, 0x7d7717ea, + 0xbda8992b, 0xbcce7bb2, 0x7c11f573, 0xff04ce5a, 0x3fdb409b, + 0x3ebda202, 0xfe622cc3, 0xf35222fe, 0x338dac3f, 0x32eb4ea6, + 0xf234c067, 0x7121fb4e, 0xb1fe758f, 0xb0989716, 0x704719d7, + 0xb6b3e144, 0x766c6f85, 0x770a8d1c, 0xb7d503dd, 0x34c038f4, + 0xf41fb635, 0xf57954ac, 0x35a6da6d, 0x9f35e177, 0x5fea6fb6, + 0x5e8c8d2f, 0x9e5303ee, 0x1d4638c7, 0xdd99b606, 0xdcff549f, + 0x1c20da5e, 0xdad422cd, 0x1a0bac0c, 0x1b6d4e95, 0xdbb2c054, + 0x58a7fb7d, 0x987875bc, 0x991e9725, 0x59c119e4, 0x54f117d9, + 0x942e9918, 0x95487b81, 0x5597f540, 0xd682ce69, 0x165d40a8, + 0x173ba231, 0xd7e42cf0, 0x1110d463, 0xd1cf5aa2, 0xd0a9b83b, + 0x107636fa, 0x93630dd3, 0x53bc8312, 0x52da618b, 0x9205ef4a, + 0x48ba7df1, 0x8865f330, 0x890311a9, 0x49dc9f68, 0xcac9a441, + 0x0a162a80, 0x0b70c819, 0xcbaf46d8, 0x0d5bbe4b, 0xcd84308a, + 0xcce2d213, 0x0c3d5cd2, 0x8f2867fb, 0x4ff7e93a, 0x4e910ba3, + 0x8e4e8562, 0x837e8b5f, 0x43a1059e, 0x42c7e707, 0x821869c6, + 0x010d52ef, 0xc1d2dc2e, 0xc0b43eb7, 0x006bb076, 0xc69f48e5, + 0x0640c624, 0x072624bd, 0xc7f9aa7c, 0x44ec9155, 0x84331f94, + 0x8555fd0d, 0x458a73cc, 0x702ca9a1, 0xb0f32760, 0xb195c5f9, + 0x714a4b38, 0xf25f7011, 0x3280fed0, 0x33e61c49, 0xf3399288, + 0x35cd6a1b, 0xf512e4da, 0xf4740643, 0x34ab8882, 0xb7beb3ab, + 0x77613d6a, 0x7607dff3, 0xb6d85132, 0xbbe85f0f, 0x7b37d1ce, + 0x7a513357, 0xba8ebd96, 0x399b86bf, 0xf944087e, 0xf822eae7, + 0x38fd6426, 0xfe099cb5, 0x3ed61274, 0x3fb0f0ed, 0xff6f7e2c, + 0x7c7a4505, 0xbca5cbc4, 0xbdc3295d, 0x7d1ca79c, 0xa7a33527, + 0x677cbbe6, 0x661a597f, 0xa6c5d7be, 0x25d0ec97, 0xe50f6256, + 0xe46980cf, 0x24b60e0e, 0xe242f69d, 0x229d785c, 0x23fb9ac5, + 0xe3241404, 0x60312f2d, 0xa0eea1ec, 0xa1884375, 0x6157cdb4, + 0x6c67c389, 0xacb84d48, 0xaddeafd1, 0x6d012110, 0xee141a39, + 0x2ecb94f8, 0x2fad7661, 0xef72f8a0, 0x29860033, 0xe9598ef2, + 0xe83f6c6b, 0x28e0e2aa, 0xabf5d983, 0x6b2a5742, 0x6a4cb5db, + 0xaa933b1a}, + {0x00000000, 0x6f4ca59b, 0x9f9e3bec, 0xf0d29e77, 0x7f3b0603, + 0x1077a398, 0xe0a53def, 0x8fe99874, 0xfe760c06, 0x913aa99d, + 0x61e837ea, 0x0ea49271, 0x814d0a05, 0xee01af9e, 0x1ed331e9, + 0x719f9472, 0xfced180c, 0x93a1bd97, 0x637323e0, 0x0c3f867b, + 0x83d61e0f, 0xec9abb94, 0x1c4825e3, 0x73048078, 0x029b140a, + 0x6dd7b191, 0x9d052fe6, 0xf2498a7d, 0x7da01209, 0x12ecb792, + 0xe23e29e5, 0x8d728c7e, 0xf8db3118, 0x97979483, 0x67450af4, + 0x0809af6f, 0x87e0371b, 0xe8ac9280, 0x187e0cf7, 0x7732a96c, + 0x06ad3d1e, 0x69e19885, 0x993306f2, 0xf67fa369, 0x79963b1d, + 0x16da9e86, 0xe60800f1, 0x8944a56a, 0x04362914, 0x6b7a8c8f, + 0x9ba812f8, 0xf4e4b763, 0x7b0d2f17, 0x14418a8c, 0xe49314fb, + 0x8bdfb160, 0xfa402512, 0x950c8089, 0x65de1efe, 0x0a92bb65, + 0x857b2311, 0xea37868a, 0x1ae518fd, 0x75a9bd66, 0xf0b76330, + 0x9ffbc6ab, 0x6f2958dc, 0x0065fd47, 0x8f8c6533, 0xe0c0c0a8, + 0x10125edf, 0x7f5efb44, 0x0ec16f36, 0x618dcaad, 0x915f54da, + 0xfe13f141, 0x71fa6935, 0x1eb6ccae, 0xee6452d9, 0x8128f742, + 0x0c5a7b3c, 0x6316dea7, 0x93c440d0, 0xfc88e54b, 0x73617d3f, + 0x1c2dd8a4, 0xecff46d3, 0x83b3e348, 0xf22c773a, 0x9d60d2a1, + 0x6db24cd6, 0x02fee94d, 0x8d177139, 0xe25bd4a2, 0x12894ad5, + 0x7dc5ef4e, 0x086c5228, 0x6720f7b3, 0x97f269c4, 0xf8becc5f, + 0x7757542b, 0x181bf1b0, 0xe8c96fc7, 0x8785ca5c, 0xf61a5e2e, + 0x9956fbb5, 0x698465c2, 0x06c8c059, 0x8921582d, 0xe66dfdb6, + 0x16bf63c1, 0x79f3c65a, 0xf4814a24, 0x9bcdefbf, 0x6b1f71c8, + 0x0453d453, 0x8bba4c27, 0xe4f6e9bc, 0x142477cb, 0x7b68d250, + 0x0af74622, 0x65bbe3b9, 0x95697dce, 0xfa25d855, 0x75cc4021, + 0x1a80e5ba, 0xea527bcd, 0x851ede56, 0xe06fc760, 0x8f2362fb, + 0x7ff1fc8c, 0x10bd5917, 0x9f54c163, 0xf01864f8, 0x00cafa8f, + 0x6f865f14, 0x1e19cb66, 0x71556efd, 0x8187f08a, 0xeecb5511, + 0x6122cd65, 0x0e6e68fe, 0xfebcf689, 0x91f05312, 0x1c82df6c, + 0x73ce7af7, 0x831ce480, 0xec50411b, 0x63b9d96f, 0x0cf57cf4, + 0xfc27e283, 0x936b4718, 0xe2f4d36a, 0x8db876f1, 0x7d6ae886, + 0x12264d1d, 0x9dcfd569, 0xf28370f2, 0x0251ee85, 0x6d1d4b1e, + 0x18b4f678, 0x77f853e3, 0x872acd94, 0xe866680f, 0x678ff07b, + 0x08c355e0, 0xf811cb97, 0x975d6e0c, 0xe6c2fa7e, 0x898e5fe5, + 0x795cc192, 0x16106409, 0x99f9fc7d, 0xf6b559e6, 0x0667c791, + 0x692b620a, 0xe459ee74, 0x8b154bef, 0x7bc7d598, 0x148b7003, + 0x9b62e877, 0xf42e4dec, 0x04fcd39b, 0x6bb07600, 0x1a2fe272, + 0x756347e9, 0x85b1d99e, 0xeafd7c05, 0x6514e471, 0x0a5841ea, + 0xfa8adf9d, 0x95c67a06, 0x10d8a450, 0x7f9401cb, 0x8f469fbc, + 0xe00a3a27, 0x6fe3a253, 0x00af07c8, 0xf07d99bf, 0x9f313c24, + 0xeeaea856, 0x81e20dcd, 0x713093ba, 0x1e7c3621, 0x9195ae55, + 0xfed90bce, 0x0e0b95b9, 0x61473022, 0xec35bc5c, 0x837919c7, + 0x73ab87b0, 0x1ce7222b, 0x930eba5f, 0xfc421fc4, 0x0c9081b3, + 0x63dc2428, 0x1243b05a, 0x7d0f15c1, 0x8ddd8bb6, 0xe2912e2d, + 0x6d78b659, 0x023413c2, 0xf2e68db5, 0x9daa282e, 0xe8039548, + 0x874f30d3, 0x779daea4, 0x18d10b3f, 0x9738934b, 0xf87436d0, + 0x08a6a8a7, 0x67ea0d3c, 0x1675994e, 0x79393cd5, 0x89eba2a2, + 0xe6a70739, 0x694e9f4d, 0x06023ad6, 0xf6d0a4a1, 0x999c013a, + 0x14ee8d44, 0x7ba228df, 0x8b70b6a8, 0xe43c1333, 0x6bd58b47, + 0x04992edc, 0xf44bb0ab, 0x9b071530, 0xea988142, 0x85d424d9, + 0x7506baae, 0x1a4a1f35, 0x95a38741, 0xfaef22da, 0x0a3dbcad, + 0x65711936}}; + +#endif + +#endif + +#if N == 4 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xf1da05aa, 0x38c50d15, 0xc91f08bf, 0x718a1a2a, + 0x80501f80, 0x494f173f, 0xb8951295, 0xe3143454, 0x12ce31fe, + 0xdbd13941, 0x2a0b3ceb, 0x929e2e7e, 0x63442bd4, 0xaa5b236b, + 0x5b8126c1, 0x1d596ee9, 0xec836b43, 0x259c63fc, 0xd4466656, + 0x6cd374c3, 0x9d097169, 0x541679d6, 0xa5cc7c7c, 0xfe4d5abd, + 0x0f975f17, 0xc68857a8, 0x37525202, 0x8fc74097, 0x7e1d453d, + 0xb7024d82, 0x46d84828, 0x3ab2ddd2, 0xcb68d878, 0x0277d0c7, + 0xf3add56d, 0x4b38c7f8, 0xbae2c252, 0x73fdcaed, 0x8227cf47, + 0xd9a6e986, 0x287cec2c, 0xe163e493, 0x10b9e139, 0xa82cf3ac, + 0x59f6f606, 0x90e9feb9, 0x6133fb13, 0x27ebb33b, 0xd631b691, + 0x1f2ebe2e, 0xeef4bb84, 0x5661a911, 0xa7bbacbb, 0x6ea4a404, + 0x9f7ea1ae, 0xc4ff876f, 0x352582c5, 0xfc3a8a7a, 0x0de08fd0, + 0xb5759d45, 0x44af98ef, 0x8db09050, 0x7c6a95fa, 0x7565bba4, + 0x84bfbe0e, 0x4da0b6b1, 0xbc7ab31b, 0x04efa18e, 0xf535a424, + 0x3c2aac9b, 0xcdf0a931, 0x96718ff0, 0x67ab8a5a, 0xaeb482e5, + 0x5f6e874f, 0xe7fb95da, 0x16219070, 0xdf3e98cf, 0x2ee49d65, + 0x683cd54d, 0x99e6d0e7, 0x50f9d858, 0xa123ddf2, 0x19b6cf67, + 0xe86ccacd, 0x2173c272, 0xd0a9c7d8, 0x8b28e119, 0x7af2e4b3, + 0xb3edec0c, 0x4237e9a6, 0xfaa2fb33, 0x0b78fe99, 0xc267f626, + 0x33bdf38c, 0x4fd76676, 0xbe0d63dc, 0x77126b63, 0x86c86ec9, + 0x3e5d7c5c, 0xcf8779f6, 0x06987149, 0xf74274e3, 0xacc35222, + 0x5d195788, 0x94065f37, 0x65dc5a9d, 0xdd494808, 0x2c934da2, + 0xe58c451d, 0x145640b7, 0x528e089f, 0xa3540d35, 0x6a4b058a, + 0x9b910020, 0x230412b5, 0xd2de171f, 0x1bc11fa0, 0xea1b1a0a, + 0xb19a3ccb, 0x40403961, 0x895f31de, 0x78853474, 0xc01026e1, + 0x31ca234b, 0xf8d52bf4, 0x090f2e5e, 0xeacb7748, 0x1b1172e2, + 0xd20e7a5d, 0x23d47ff7, 0x9b416d62, 0x6a9b68c8, 0xa3846077, + 0x525e65dd, 0x09df431c, 0xf80546b6, 0x311a4e09, 0xc0c04ba3, + 0x78555936, 0x898f5c9c, 0x40905423, 0xb14a5189, 0xf79219a1, + 0x06481c0b, 0xcf5714b4, 0x3e8d111e, 0x8618038b, 0x77c20621, + 0xbedd0e9e, 0x4f070b34, 0x14862df5, 0xe55c285f, 0x2c4320e0, + 0xdd99254a, 0x650c37df, 0x94d63275, 0x5dc93aca, 0xac133f60, + 0xd079aa9a, 0x21a3af30, 0xe8bca78f, 0x1966a225, 0xa1f3b0b0, + 0x5029b51a, 0x9936bda5, 0x68ecb80f, 0x336d9ece, 0xc2b79b64, + 0x0ba893db, 0xfa729671, 0x42e784e4, 0xb33d814e, 0x7a2289f1, + 0x8bf88c5b, 0xcd20c473, 0x3cfac1d9, 0xf5e5c966, 0x043fcccc, + 0xbcaade59, 0x4d70dbf3, 0x846fd34c, 0x75b5d6e6, 0x2e34f027, + 0xdfeef58d, 0x16f1fd32, 0xe72bf898, 0x5fbeea0d, 0xae64efa7, + 0x677be718, 0x96a1e2b2, 0x9faeccec, 0x6e74c946, 0xa76bc1f9, + 0x56b1c453, 0xee24d6c6, 0x1ffed36c, 0xd6e1dbd3, 0x273bde79, + 0x7cbaf8b8, 0x8d60fd12, 0x447ff5ad, 0xb5a5f007, 0x0d30e292, + 0xfceae738, 0x35f5ef87, 0xc42fea2d, 0x82f7a205, 0x732da7af, + 0xba32af10, 0x4be8aaba, 0xf37db82f, 0x02a7bd85, 0xcbb8b53a, + 0x3a62b090, 0x61e39651, 0x903993fb, 0x59269b44, 0xa8fc9eee, + 0x10698c7b, 0xe1b389d1, 0x28ac816e, 0xd97684c4, 0xa51c113e, + 0x54c61494, 0x9dd91c2b, 0x6c031981, 0xd4960b14, 0x254c0ebe, + 0xec530601, 0x1d8903ab, 0x4608256a, 0xb7d220c0, 0x7ecd287f, + 0x8f172dd5, 0x37823f40, 0xc6583aea, 0x0f473255, 0xfe9d37ff, + 0xb8457fd7, 0x499f7a7d, 0x808072c2, 0x715a7768, 0xc9cf65fd, + 0x38156057, 0xf10a68e8, 0x00d06d42, 0x5b514b83, 0xaa8b4e29, + 0x63944696, 0x924e433c, 0x2adb51a9, 0xdb015403, 0x121e5cbc, + 0xe3c45916}, + {0x00000000, 0x0ee7e8d1, 0x1dcfd1a2, 0x13283973, 0x3b9fa344, + 0x35784b95, 0x265072e6, 0x28b79a37, 0x773f4688, 0x79d8ae59, + 0x6af0972a, 0x64177ffb, 0x4ca0e5cc, 0x42470d1d, 0x516f346e, + 0x5f88dcbf, 0xee7e8d10, 0xe09965c1, 0xf3b15cb2, 0xfd56b463, + 0xd5e12e54, 0xdb06c685, 0xc82efff6, 0xc6c91727, 0x9941cb98, + 0x97a62349, 0x848e1a3a, 0x8a69f2eb, 0xa2de68dc, 0xac39800d, + 0xbf11b97e, 0xb1f651af, 0x078c1c61, 0x096bf4b0, 0x1a43cdc3, + 0x14a42512, 0x3c13bf25, 0x32f457f4, 0x21dc6e87, 0x2f3b8656, + 0x70b35ae9, 0x7e54b238, 0x6d7c8b4b, 0x639b639a, 0x4b2cf9ad, + 0x45cb117c, 0x56e3280f, 0x5804c0de, 0xe9f29171, 0xe71579a0, + 0xf43d40d3, 0xfadaa802, 0xd26d3235, 0xdc8adae4, 0xcfa2e397, + 0xc1450b46, 0x9ecdd7f9, 0x902a3f28, 0x8302065b, 0x8de5ee8a, + 0xa55274bd, 0xabb59c6c, 0xb89da51f, 0xb67a4dce, 0x0f1838c2, + 0x01ffd013, 0x12d7e960, 0x1c3001b1, 0x34879b86, 0x3a607357, + 0x29484a24, 0x27afa2f5, 0x78277e4a, 0x76c0969b, 0x65e8afe8, + 0x6b0f4739, 0x43b8dd0e, 0x4d5f35df, 0x5e770cac, 0x5090e47d, + 0xe166b5d2, 0xef815d03, 0xfca96470, 0xf24e8ca1, 0xdaf91696, + 0xd41efe47, 0xc736c734, 0xc9d12fe5, 0x9659f35a, 0x98be1b8b, + 0x8b9622f8, 0x8571ca29, 0xadc6501e, 0xa321b8cf, 0xb00981bc, + 0xbeee696d, 0x089424a3, 0x0673cc72, 0x155bf501, 0x1bbc1dd0, + 0x330b87e7, 0x3dec6f36, 0x2ec45645, 0x2023be94, 0x7fab622b, + 0x714c8afa, 0x6264b389, 0x6c835b58, 0x4434c16f, 0x4ad329be, + 0x59fb10cd, 0x571cf81c, 0xe6eaa9b3, 0xe80d4162, 0xfb257811, + 0xf5c290c0, 0xdd750af7, 0xd392e226, 0xc0badb55, 0xce5d3384, + 0x91d5ef3b, 0x9f3207ea, 0x8c1a3e99, 0x82fdd648, 0xaa4a4c7f, + 0xa4ada4ae, 0xb7859ddd, 0xb962750c, 0x1e307184, 0x10d79955, + 0x03ffa026, 0x0d1848f7, 0x25afd2c0, 0x2b483a11, 0x38600362, + 0x3687ebb3, 0x690f370c, 0x67e8dfdd, 0x74c0e6ae, 0x7a270e7f, + 0x52909448, 0x5c777c99, 0x4f5f45ea, 0x41b8ad3b, 0xf04efc94, + 0xfea91445, 0xed812d36, 0xe366c5e7, 0xcbd15fd0, 0xc536b701, + 0xd61e8e72, 0xd8f966a3, 0x8771ba1c, 0x899652cd, 0x9abe6bbe, + 0x9459836f, 0xbcee1958, 0xb209f189, 0xa121c8fa, 0xafc6202b, + 0x19bc6de5, 0x175b8534, 0x0473bc47, 0x0a945496, 0x2223cea1, + 0x2cc42670, 0x3fec1f03, 0x310bf7d2, 0x6e832b6d, 0x6064c3bc, + 0x734cfacf, 0x7dab121e, 0x551c8829, 0x5bfb60f8, 0x48d3598b, + 0x4634b15a, 0xf7c2e0f5, 0xf9250824, 0xea0d3157, 0xe4ead986, + 0xcc5d43b1, 0xc2baab60, 0xd1929213, 0xdf757ac2, 0x80fda67d, + 0x8e1a4eac, 0x9d3277df, 0x93d59f0e, 0xbb620539, 0xb585ede8, + 0xa6add49b, 0xa84a3c4a, 0x11284946, 0x1fcfa197, 0x0ce798e4, + 0x02007035, 0x2ab7ea02, 0x245002d3, 0x37783ba0, 0x399fd371, + 0x66170fce, 0x68f0e71f, 0x7bd8de6c, 0x753f36bd, 0x5d88ac8a, + 0x536f445b, 0x40477d28, 0x4ea095f9, 0xff56c456, 0xf1b12c87, + 0xe29915f4, 0xec7efd25, 0xc4c96712, 0xca2e8fc3, 0xd906b6b0, + 0xd7e15e61, 0x886982de, 0x868e6a0f, 0x95a6537c, 0x9b41bbad, + 0xb3f6219a, 0xbd11c94b, 0xae39f038, 0xa0de18e9, 0x16a45527, + 0x1843bdf6, 0x0b6b8485, 0x058c6c54, 0x2d3bf663, 0x23dc1eb2, + 0x30f427c1, 0x3e13cf10, 0x619b13af, 0x6f7cfb7e, 0x7c54c20d, + 0x72b32adc, 0x5a04b0eb, 0x54e3583a, 0x47cb6149, 0x492c8998, + 0xf8dad837, 0xf63d30e6, 0xe5150995, 0xebf2e144, 0xc3457b73, + 0xcda293a2, 0xde8aaad1, 0xd06d4200, 0x8fe59ebf, 0x8102766e, + 0x922a4f1d, 0x9ccda7cc, 0xb47a3dfb, 0xba9dd52a, 0xa9b5ec59, + 0xa7520488}, + {0x00000000, 0x3c60e308, 0x78c1c610, 0x44a12518, 0xf1838c20, + 0xcde36f28, 0x89424a30, 0xb522a938, 0x38761e01, 0x0416fd09, + 0x40b7d811, 0x7cd73b19, 0xc9f59221, 0xf5957129, 0xb1345431, + 0x8d54b739, 0x70ec3c02, 0x4c8cdf0a, 0x082dfa12, 0x344d191a, + 0x816fb022, 0xbd0f532a, 0xf9ae7632, 0xc5ce953a, 0x489a2203, + 0x74fac10b, 0x305be413, 0x0c3b071b, 0xb919ae23, 0x85794d2b, + 0xc1d86833, 0xfdb88b3b, 0xe1d87804, 0xddb89b0c, 0x9919be14, + 0xa5795d1c, 0x105bf424, 0x2c3b172c, 0x689a3234, 0x54fad13c, + 0xd9ae6605, 0xe5ce850d, 0xa16fa015, 0x9d0f431d, 0x282dea25, + 0x144d092d, 0x50ec2c35, 0x6c8ccf3d, 0x91344406, 0xad54a70e, + 0xe9f58216, 0xd595611e, 0x60b7c826, 0x5cd72b2e, 0x18760e36, + 0x2416ed3e, 0xa9425a07, 0x9522b90f, 0xd1839c17, 0xede37f1f, + 0x58c1d627, 0x64a1352f, 0x20001037, 0x1c60f33f, 0x18c1f649, + 0x24a11541, 0x60003059, 0x5c60d351, 0xe9427a69, 0xd5229961, + 0x9183bc79, 0xade35f71, 0x20b7e848, 0x1cd70b40, 0x58762e58, + 0x6416cd50, 0xd1346468, 0xed548760, 0xa9f5a278, 0x95954170, + 0x682dca4b, 0x544d2943, 0x10ec0c5b, 0x2c8cef53, 0x99ae466b, + 0xa5cea563, 0xe16f807b, 0xdd0f6373, 0x505bd44a, 0x6c3b3742, + 0x289a125a, 0x14faf152, 0xa1d8586a, 0x9db8bb62, 0xd9199e7a, + 0xe5797d72, 0xf9198e4d, 0xc5796d45, 0x81d8485d, 0xbdb8ab55, + 0x089a026d, 0x34fae165, 0x705bc47d, 0x4c3b2775, 0xc16f904c, + 0xfd0f7344, 0xb9ae565c, 0x85ceb554, 0x30ec1c6c, 0x0c8cff64, + 0x482dda7c, 0x744d3974, 0x89f5b24f, 0xb5955147, 0xf134745f, + 0xcd549757, 0x78763e6f, 0x4416dd67, 0x00b7f87f, 0x3cd71b77, + 0xb183ac4e, 0x8de34f46, 0xc9426a5e, 0xf5228956, 0x4000206e, + 0x7c60c366, 0x38c1e67e, 0x04a10576, 0x3183ec92, 0x0de30f9a, + 0x49422a82, 0x7522c98a, 0xc00060b2, 0xfc6083ba, 0xb8c1a6a2, + 0x84a145aa, 0x09f5f293, 0x3595119b, 0x71343483, 0x4d54d78b, + 0xf8767eb3, 0xc4169dbb, 0x80b7b8a3, 0xbcd75bab, 0x416fd090, + 0x7d0f3398, 0x39ae1680, 0x05cef588, 0xb0ec5cb0, 0x8c8cbfb8, + 0xc82d9aa0, 0xf44d79a8, 0x7919ce91, 0x45792d99, 0x01d80881, + 0x3db8eb89, 0x889a42b1, 0xb4faa1b9, 0xf05b84a1, 0xcc3b67a9, + 0xd05b9496, 0xec3b779e, 0xa89a5286, 0x94fab18e, 0x21d818b6, + 0x1db8fbbe, 0x5919dea6, 0x65793dae, 0xe82d8a97, 0xd44d699f, + 0x90ec4c87, 0xac8caf8f, 0x19ae06b7, 0x25cee5bf, 0x616fc0a7, + 0x5d0f23af, 0xa0b7a894, 0x9cd74b9c, 0xd8766e84, 0xe4168d8c, + 0x513424b4, 0x6d54c7bc, 0x29f5e2a4, 0x159501ac, 0x98c1b695, + 0xa4a1559d, 0xe0007085, 0xdc60938d, 0x69423ab5, 0x5522d9bd, + 0x1183fca5, 0x2de31fad, 0x29421adb, 0x1522f9d3, 0x5183dccb, + 0x6de33fc3, 0xd8c196fb, 0xe4a175f3, 0xa00050eb, 0x9c60b3e3, + 0x113404da, 0x2d54e7d2, 0x69f5c2ca, 0x559521c2, 0xe0b788fa, + 0xdcd76bf2, 0x98764eea, 0xa416ade2, 0x59ae26d9, 0x65cec5d1, + 0x216fe0c9, 0x1d0f03c1, 0xa82daaf9, 0x944d49f1, 0xd0ec6ce9, + 0xec8c8fe1, 0x61d838d8, 0x5db8dbd0, 0x1919fec8, 0x25791dc0, + 0x905bb4f8, 0xac3b57f0, 0xe89a72e8, 0xd4fa91e0, 0xc89a62df, + 0xf4fa81d7, 0xb05ba4cf, 0x8c3b47c7, 0x3919eeff, 0x05790df7, + 0x41d828ef, 0x7db8cbe7, 0xf0ec7cde, 0xcc8c9fd6, 0x882dbace, + 0xb44d59c6, 0x016ff0fe, 0x3d0f13f6, 0x79ae36ee, 0x45ced5e6, + 0xb8765edd, 0x8416bdd5, 0xc0b798cd, 0xfcd77bc5, 0x49f5d2fd, + 0x759531f5, 0x313414ed, 0x0d54f7e5, 0x800040dc, 0xbc60a3d4, + 0xf8c186cc, 0xc4a165c4, 0x7183ccfc, 0x4de32ff4, 0x09420aec, + 0x3522e9e4}, + {0x00000000, 0x6307d924, 0xc60fb248, 0xa5086b6c, 0x576e62d1, + 0x3469bbf5, 0x9161d099, 0xf26609bd, 0xaedcc5a2, 0xcddb1c86, + 0x68d377ea, 0x0bd4aece, 0xf9b2a773, 0x9ab57e57, 0x3fbd153b, + 0x5cbacc1f, 0x86c88d05, 0xe5cf5421, 0x40c73f4d, 0x23c0e669, + 0xd1a6efd4, 0xb2a136f0, 0x17a95d9c, 0x74ae84b8, 0x281448a7, + 0x4b139183, 0xee1bfaef, 0x8d1c23cb, 0x7f7a2a76, 0x1c7df352, + 0xb975983e, 0xda72411a, 0xd6e01c4b, 0xb5e7c56f, 0x10efae03, + 0x73e87727, 0x818e7e9a, 0xe289a7be, 0x4781ccd2, 0x248615f6, + 0x783cd9e9, 0x1b3b00cd, 0xbe336ba1, 0xdd34b285, 0x2f52bb38, + 0x4c55621c, 0xe95d0970, 0x8a5ad054, 0x5028914e, 0x332f486a, + 0x96272306, 0xf520fa22, 0x0746f39f, 0x64412abb, 0xc14941d7, + 0xa24e98f3, 0xfef454ec, 0x9df38dc8, 0x38fbe6a4, 0x5bfc3f80, + 0xa99a363d, 0xca9def19, 0x6f958475, 0x0c925d51, 0x76b13ed7, + 0x15b6e7f3, 0xb0be8c9f, 0xd3b955bb, 0x21df5c06, 0x42d88522, + 0xe7d0ee4e, 0x84d7376a, 0xd86dfb75, 0xbb6a2251, 0x1e62493d, + 0x7d659019, 0x8f0399a4, 0xec044080, 0x490c2bec, 0x2a0bf2c8, + 0xf079b3d2, 0x937e6af6, 0x3676019a, 0x5571d8be, 0xa717d103, + 0xc4100827, 0x6118634b, 0x021fba6f, 0x5ea57670, 0x3da2af54, + 0x98aac438, 0xfbad1d1c, 0x09cb14a1, 0x6acccd85, 0xcfc4a6e9, + 0xacc37fcd, 0xa051229c, 0xc356fbb8, 0x665e90d4, 0x055949f0, + 0xf73f404d, 0x94389969, 0x3130f205, 0x52372b21, 0x0e8de73e, + 0x6d8a3e1a, 0xc8825576, 0xab858c52, 0x59e385ef, 0x3ae45ccb, + 0x9fec37a7, 0xfcebee83, 0x2699af99, 0x459e76bd, 0xe0961dd1, + 0x8391c4f5, 0x71f7cd48, 0x12f0146c, 0xb7f87f00, 0xd4ffa624, + 0x88456a3b, 0xeb42b31f, 0x4e4ad873, 0x2d4d0157, 0xdf2b08ea, + 0xbc2cd1ce, 0x1924baa2, 0x7a236386, 0xed627dae, 0x8e65a48a, + 0x2b6dcfe6, 0x486a16c2, 0xba0c1f7f, 0xd90bc65b, 0x7c03ad37, + 0x1f047413, 0x43beb80c, 0x20b96128, 0x85b10a44, 0xe6b6d360, + 0x14d0dadd, 0x77d703f9, 0xd2df6895, 0xb1d8b1b1, 0x6baaf0ab, + 0x08ad298f, 0xada542e3, 0xcea29bc7, 0x3cc4927a, 0x5fc34b5e, + 0xfacb2032, 0x99ccf916, 0xc5763509, 0xa671ec2d, 0x03798741, + 0x607e5e65, 0x921857d8, 0xf11f8efc, 0x5417e590, 0x37103cb4, + 0x3b8261e5, 0x5885b8c1, 0xfd8dd3ad, 0x9e8a0a89, 0x6cec0334, + 0x0febda10, 0xaae3b17c, 0xc9e46858, 0x955ea447, 0xf6597d63, + 0x5351160f, 0x3056cf2b, 0xc230c696, 0xa1371fb2, 0x043f74de, + 0x6738adfa, 0xbd4aece0, 0xde4d35c4, 0x7b455ea8, 0x1842878c, + 0xea248e31, 0x89235715, 0x2c2b3c79, 0x4f2ce55d, 0x13962942, + 0x7091f066, 0xd5999b0a, 0xb69e422e, 0x44f84b93, 0x27ff92b7, + 0x82f7f9db, 0xe1f020ff, 0x9bd34379, 0xf8d49a5d, 0x5ddcf131, + 0x3edb2815, 0xccbd21a8, 0xafbaf88c, 0x0ab293e0, 0x69b54ac4, + 0x350f86db, 0x56085fff, 0xf3003493, 0x9007edb7, 0x6261e40a, + 0x01663d2e, 0xa46e5642, 0xc7698f66, 0x1d1bce7c, 0x7e1c1758, + 0xdb147c34, 0xb813a510, 0x4a75acad, 0x29727589, 0x8c7a1ee5, + 0xef7dc7c1, 0xb3c70bde, 0xd0c0d2fa, 0x75c8b996, 0x16cf60b2, + 0xe4a9690f, 0x87aeb02b, 0x22a6db47, 0x41a10263, 0x4d335f32, + 0x2e348616, 0x8b3ced7a, 0xe83b345e, 0x1a5d3de3, 0x795ae4c7, + 0xdc528fab, 0xbf55568f, 0xe3ef9a90, 0x80e843b4, 0x25e028d8, + 0x46e7f1fc, 0xb481f841, 0xd7862165, 0x728e4a09, 0x1189932d, + 0xcbfbd237, 0xa8fc0b13, 0x0df4607f, 0x6ef3b95b, 0x9c95b0e6, + 0xff9269c2, 0x5a9a02ae, 0x399ddb8a, 0x65271795, 0x0620ceb1, + 0xa328a5dd, 0xc02f7cf9, 0x32497544, 0x514eac60, 0xf446c70c, + 0x97411e28}, + {0x00000000, 0x01b5fd1d, 0x036bfa3a, 0x02de0727, 0x06d7f474, + 0x07620969, 0x05bc0e4e, 0x0409f353, 0x0dafe8e8, 0x0c1a15f5, + 0x0ec412d2, 0x0f71efcf, 0x0b781c9c, 0x0acde181, 0x0813e6a6, + 0x09a61bbb, 0x1b5fd1d0, 0x1aea2ccd, 0x18342bea, 0x1981d6f7, + 0x1d8825a4, 0x1c3dd8b9, 0x1ee3df9e, 0x1f562283, 0x16f03938, + 0x1745c425, 0x159bc302, 0x142e3e1f, 0x1027cd4c, 0x11923051, + 0x134c3776, 0x12f9ca6b, 0x36bfa3a0, 0x370a5ebd, 0x35d4599a, + 0x3461a487, 0x306857d4, 0x31ddaac9, 0x3303adee, 0x32b650f3, + 0x3b104b48, 0x3aa5b655, 0x387bb172, 0x39ce4c6f, 0x3dc7bf3c, + 0x3c724221, 0x3eac4506, 0x3f19b81b, 0x2de07270, 0x2c558f6d, + 0x2e8b884a, 0x2f3e7557, 0x2b378604, 0x2a827b19, 0x285c7c3e, + 0x29e98123, 0x204f9a98, 0x21fa6785, 0x232460a2, 0x22919dbf, + 0x26986eec, 0x272d93f1, 0x25f394d6, 0x244669cb, 0x6d7f4740, + 0x6ccaba5d, 0x6e14bd7a, 0x6fa14067, 0x6ba8b334, 0x6a1d4e29, + 0x68c3490e, 0x6976b413, 0x60d0afa8, 0x616552b5, 0x63bb5592, + 0x620ea88f, 0x66075bdc, 0x67b2a6c1, 0x656ca1e6, 0x64d95cfb, + 0x76209690, 0x77956b8d, 0x754b6caa, 0x74fe91b7, 0x70f762e4, + 0x71429ff9, 0x739c98de, 0x722965c3, 0x7b8f7e78, 0x7a3a8365, + 0x78e48442, 0x7951795f, 0x7d588a0c, 0x7ced7711, 0x7e337036, + 0x7f868d2b, 0x5bc0e4e0, 0x5a7519fd, 0x58ab1eda, 0x591ee3c7, + 0x5d171094, 0x5ca2ed89, 0x5e7ceaae, 0x5fc917b3, 0x566f0c08, + 0x57daf115, 0x5504f632, 0x54b10b2f, 0x50b8f87c, 0x510d0561, + 0x53d30246, 0x5266ff5b, 0x409f3530, 0x412ac82d, 0x43f4cf0a, + 0x42413217, 0x4648c144, 0x47fd3c59, 0x45233b7e, 0x4496c663, + 0x4d30ddd8, 0x4c8520c5, 0x4e5b27e2, 0x4feedaff, 0x4be729ac, + 0x4a52d4b1, 0x488cd396, 0x49392e8b, 0xdafe8e80, 0xdb4b739d, + 0xd99574ba, 0xd82089a7, 0xdc297af4, 0xdd9c87e9, 0xdf4280ce, + 0xdef77dd3, 0xd7516668, 0xd6e49b75, 0xd43a9c52, 0xd58f614f, + 0xd186921c, 0xd0336f01, 0xd2ed6826, 0xd358953b, 0xc1a15f50, + 0xc014a24d, 0xc2caa56a, 0xc37f5877, 0xc776ab24, 0xc6c35639, + 0xc41d511e, 0xc5a8ac03, 0xcc0eb7b8, 0xcdbb4aa5, 0xcf654d82, + 0xced0b09f, 0xcad943cc, 0xcb6cbed1, 0xc9b2b9f6, 0xc80744eb, + 0xec412d20, 0xedf4d03d, 0xef2ad71a, 0xee9f2a07, 0xea96d954, + 0xeb232449, 0xe9fd236e, 0xe848de73, 0xe1eec5c8, 0xe05b38d5, + 0xe2853ff2, 0xe330c2ef, 0xe73931bc, 0xe68ccca1, 0xe452cb86, + 0xe5e7369b, 0xf71efcf0, 0xf6ab01ed, 0xf47506ca, 0xf5c0fbd7, + 0xf1c90884, 0xf07cf599, 0xf2a2f2be, 0xf3170fa3, 0xfab11418, + 0xfb04e905, 0xf9daee22, 0xf86f133f, 0xfc66e06c, 0xfdd31d71, + 0xff0d1a56, 0xfeb8e74b, 0xb781c9c0, 0xb63434dd, 0xb4ea33fa, + 0xb55fcee7, 0xb1563db4, 0xb0e3c0a9, 0xb23dc78e, 0xb3883a93, + 0xba2e2128, 0xbb9bdc35, 0xb945db12, 0xb8f0260f, 0xbcf9d55c, + 0xbd4c2841, 0xbf922f66, 0xbe27d27b, 0xacde1810, 0xad6be50d, + 0xafb5e22a, 0xae001f37, 0xaa09ec64, 0xabbc1179, 0xa962165e, + 0xa8d7eb43, 0xa171f0f8, 0xa0c40de5, 0xa21a0ac2, 0xa3aff7df, + 0xa7a6048c, 0xa613f991, 0xa4cdfeb6, 0xa57803ab, 0x813e6a60, + 0x808b977d, 0x8255905a, 0x83e06d47, 0x87e99e14, 0x865c6309, + 0x8482642e, 0x85379933, 0x8c918288, 0x8d247f95, 0x8ffa78b2, + 0x8e4f85af, 0x8a4676fc, 0x8bf38be1, 0x892d8cc6, 0x889871db, + 0x9a61bbb0, 0x9bd446ad, 0x990a418a, 0x98bfbc97, 0x9cb64fc4, + 0x9d03b2d9, 0x9fddb5fe, 0x9e6848e3, 0x97ce5358, 0x967bae45, + 0x94a5a962, 0x9510547f, 0x9119a72c, 0x90ac5a31, 0x92725d16, + 0x93c7a00b}, + {0x00000000, 0x6e8c1b41, 0xdd183682, 0xb3942dc3, 0x61416b45, + 0x0fcd7004, 0xbc595dc7, 0xd2d54686, 0xc282d68a, 0xac0ecdcb, + 0x1f9ae008, 0x7116fb49, 0xa3c3bdcf, 0xcd4fa68e, 0x7edb8b4d, + 0x1057900c, 0x5e74ab55, 0x30f8b014, 0x836c9dd7, 0xede08696, + 0x3f35c010, 0x51b9db51, 0xe22df692, 0x8ca1edd3, 0x9cf67ddf, + 0xf27a669e, 0x41ee4b5d, 0x2f62501c, 0xfdb7169a, 0x933b0ddb, + 0x20af2018, 0x4e233b59, 0xbce956aa, 0xd2654deb, 0x61f16028, + 0x0f7d7b69, 0xdda83def, 0xb32426ae, 0x00b00b6d, 0x6e3c102c, + 0x7e6b8020, 0x10e79b61, 0xa373b6a2, 0xcdffade3, 0x1f2aeb65, + 0x71a6f024, 0xc232dde7, 0xacbec6a6, 0xe29dfdff, 0x8c11e6be, + 0x3f85cb7d, 0x5109d03c, 0x83dc96ba, 0xed508dfb, 0x5ec4a038, + 0x3048bb79, 0x201f2b75, 0x4e933034, 0xfd071df7, 0x938b06b6, + 0x415e4030, 0x2fd25b71, 0x9c4676b2, 0xf2ca6df3, 0xa2a3ab15, + 0xcc2fb054, 0x7fbb9d97, 0x113786d6, 0xc3e2c050, 0xad6edb11, + 0x1efaf6d2, 0x7076ed93, 0x60217d9f, 0x0ead66de, 0xbd394b1d, + 0xd3b5505c, 0x016016da, 0x6fec0d9b, 0xdc782058, 0xb2f43b19, + 0xfcd70040, 0x925b1b01, 0x21cf36c2, 0x4f432d83, 0x9d966b05, + 0xf31a7044, 0x408e5d87, 0x2e0246c6, 0x3e55d6ca, 0x50d9cd8b, + 0xe34de048, 0x8dc1fb09, 0x5f14bd8f, 0x3198a6ce, 0x820c8b0d, + 0xec80904c, 0x1e4afdbf, 0x70c6e6fe, 0xc352cb3d, 0xadded07c, + 0x7f0b96fa, 0x11878dbb, 0xa213a078, 0xcc9fbb39, 0xdcc82b35, + 0xb2443074, 0x01d01db7, 0x6f5c06f6, 0xbd894070, 0xd3055b31, + 0x609176f2, 0x0e1d6db3, 0x403e56ea, 0x2eb24dab, 0x9d266068, + 0xf3aa7b29, 0x217f3daf, 0x4ff326ee, 0xfc670b2d, 0x92eb106c, + 0x82bc8060, 0xec309b21, 0x5fa4b6e2, 0x3128ada3, 0xe3fdeb25, + 0x8d71f064, 0x3ee5dda7, 0x5069c6e6, 0x9e36506b, 0xf0ba4b2a, + 0x432e66e9, 0x2da27da8, 0xff773b2e, 0x91fb206f, 0x226f0dac, + 0x4ce316ed, 0x5cb486e1, 0x32389da0, 0x81acb063, 0xef20ab22, + 0x3df5eda4, 0x5379f6e5, 0xe0eddb26, 0x8e61c067, 0xc042fb3e, + 0xaecee07f, 0x1d5acdbc, 0x73d6d6fd, 0xa103907b, 0xcf8f8b3a, + 0x7c1ba6f9, 0x1297bdb8, 0x02c02db4, 0x6c4c36f5, 0xdfd81b36, + 0xb1540077, 0x638146f1, 0x0d0d5db0, 0xbe997073, 0xd0156b32, + 0x22df06c1, 0x4c531d80, 0xffc73043, 0x914b2b02, 0x439e6d84, + 0x2d1276c5, 0x9e865b06, 0xf00a4047, 0xe05dd04b, 0x8ed1cb0a, + 0x3d45e6c9, 0x53c9fd88, 0x811cbb0e, 0xef90a04f, 0x5c048d8c, + 0x328896cd, 0x7cabad94, 0x1227b6d5, 0xa1b39b16, 0xcf3f8057, + 0x1deac6d1, 0x7366dd90, 0xc0f2f053, 0xae7eeb12, 0xbe297b1e, + 0xd0a5605f, 0x63314d9c, 0x0dbd56dd, 0xdf68105b, 0xb1e40b1a, + 0x027026d9, 0x6cfc3d98, 0x3c95fb7e, 0x5219e03f, 0xe18dcdfc, + 0x8f01d6bd, 0x5dd4903b, 0x33588b7a, 0x80cca6b9, 0xee40bdf8, + 0xfe172df4, 0x909b36b5, 0x230f1b76, 0x4d830037, 0x9f5646b1, + 0xf1da5df0, 0x424e7033, 0x2cc26b72, 0x62e1502b, 0x0c6d4b6a, + 0xbff966a9, 0xd1757de8, 0x03a03b6e, 0x6d2c202f, 0xdeb80dec, + 0xb03416ad, 0xa06386a1, 0xceef9de0, 0x7d7bb023, 0x13f7ab62, + 0xc122ede4, 0xafaef6a5, 0x1c3adb66, 0x72b6c027, 0x807cadd4, + 0xeef0b695, 0x5d649b56, 0x33e88017, 0xe13dc691, 0x8fb1ddd0, + 0x3c25f013, 0x52a9eb52, 0x42fe7b5e, 0x2c72601f, 0x9fe64ddc, + 0xf16a569d, 0x23bf101b, 0x4d330b5a, 0xfea72699, 0x902b3dd8, + 0xde080681, 0xb0841dc0, 0x03103003, 0x6d9c2b42, 0xbf496dc4, + 0xd1c57685, 0x62515b46, 0x0cdd4007, 0x1c8ad00b, 0x7206cb4a, + 0xc192e689, 0xaf1efdc8, 0x7dcbbb4e, 0x1347a00f, 0xa0d38dcc, + 0xce5f968d}, + {0x00000000, 0xe71da697, 0x154a4b6f, 0xf257edf8, 0x2a9496de, + 0xcd893049, 0x3fdeddb1, 0xd8c37b26, 0x55292dbc, 0xb2348b2b, + 0x406366d3, 0xa77ec044, 0x7fbdbb62, 0x98a01df5, 0x6af7f00d, + 0x8dea569a, 0xaa525b78, 0x4d4ffdef, 0xbf181017, 0x5805b680, + 0x80c6cda6, 0x67db6b31, 0x958c86c9, 0x7291205e, 0xff7b76c4, + 0x1866d053, 0xea313dab, 0x0d2c9b3c, 0xd5efe01a, 0x32f2468d, + 0xc0a5ab75, 0x27b80de2, 0x8fd5b0b1, 0x68c81626, 0x9a9ffbde, + 0x7d825d49, 0xa541266f, 0x425c80f8, 0xb00b6d00, 0x5716cb97, + 0xdafc9d0d, 0x3de13b9a, 0xcfb6d662, 0x28ab70f5, 0xf0680bd3, + 0x1775ad44, 0xe52240bc, 0x023fe62b, 0x2587ebc9, 0xc29a4d5e, + 0x30cda0a6, 0xd7d00631, 0x0f137d17, 0xe80edb80, 0x1a593678, + 0xfd4490ef, 0x70aec675, 0x97b360e2, 0x65e48d1a, 0x82f92b8d, + 0x5a3a50ab, 0xbd27f63c, 0x4f701bc4, 0xa86dbd53, 0xc4da6723, + 0x23c7c1b4, 0xd1902c4c, 0x368d8adb, 0xee4ef1fd, 0x0953576a, + 0xfb04ba92, 0x1c191c05, 0x91f34a9f, 0x76eeec08, 0x84b901f0, + 0x63a4a767, 0xbb67dc41, 0x5c7a7ad6, 0xae2d972e, 0x493031b9, + 0x6e883c5b, 0x89959acc, 0x7bc27734, 0x9cdfd1a3, 0x441caa85, + 0xa3010c12, 0x5156e1ea, 0xb64b477d, 0x3ba111e7, 0xdcbcb770, + 0x2eeb5a88, 0xc9f6fc1f, 0x11358739, 0xf62821ae, 0x047fcc56, + 0xe3626ac1, 0x4b0fd792, 0xac127105, 0x5e459cfd, 0xb9583a6a, + 0x619b414c, 0x8686e7db, 0x74d10a23, 0x93ccacb4, 0x1e26fa2e, + 0xf93b5cb9, 0x0b6cb141, 0xec7117d6, 0x34b26cf0, 0xd3afca67, + 0x21f8279f, 0xc6e58108, 0xe15d8cea, 0x06402a7d, 0xf417c785, + 0x130a6112, 0xcbc91a34, 0x2cd4bca3, 0xde83515b, 0x399ef7cc, + 0xb474a156, 0x536907c1, 0xa13eea39, 0x46234cae, 0x9ee03788, + 0x79fd911f, 0x8baa7ce7, 0x6cb7da70, 0x52c5c807, 0xb5d86e90, + 0x478f8368, 0xa09225ff, 0x78515ed9, 0x9f4cf84e, 0x6d1b15b6, + 0x8a06b321, 0x07ece5bb, 0xe0f1432c, 0x12a6aed4, 0xf5bb0843, + 0x2d787365, 0xca65d5f2, 0x3832380a, 0xdf2f9e9d, 0xf897937f, + 0x1f8a35e8, 0xedddd810, 0x0ac07e87, 0xd20305a1, 0x351ea336, + 0xc7494ece, 0x2054e859, 0xadbebec3, 0x4aa31854, 0xb8f4f5ac, + 0x5fe9533b, 0x872a281d, 0x60378e8a, 0x92606372, 0x757dc5e5, + 0xdd1078b6, 0x3a0dde21, 0xc85a33d9, 0x2f47954e, 0xf784ee68, + 0x109948ff, 0xe2cea507, 0x05d30390, 0x8839550a, 0x6f24f39d, + 0x9d731e65, 0x7a6eb8f2, 0xa2adc3d4, 0x45b06543, 0xb7e788bb, + 0x50fa2e2c, 0x774223ce, 0x905f8559, 0x620868a1, 0x8515ce36, + 0x5dd6b510, 0xbacb1387, 0x489cfe7f, 0xaf8158e8, 0x226b0e72, + 0xc576a8e5, 0x3721451d, 0xd03ce38a, 0x08ff98ac, 0xefe23e3b, + 0x1db5d3c3, 0xfaa87554, 0x961faf24, 0x710209b3, 0x8355e44b, + 0x644842dc, 0xbc8b39fa, 0x5b969f6d, 0xa9c17295, 0x4edcd402, + 0xc3368298, 0x242b240f, 0xd67cc9f7, 0x31616f60, 0xe9a21446, + 0x0ebfb2d1, 0xfce85f29, 0x1bf5f9be, 0x3c4df45c, 0xdb5052cb, + 0x2907bf33, 0xce1a19a4, 0x16d96282, 0xf1c4c415, 0x039329ed, + 0xe48e8f7a, 0x6964d9e0, 0x8e797f77, 0x7c2e928f, 0x9b333418, + 0x43f04f3e, 0xa4ede9a9, 0x56ba0451, 0xb1a7a2c6, 0x19ca1f95, + 0xfed7b902, 0x0c8054fa, 0xeb9df26d, 0x335e894b, 0xd4432fdc, + 0x2614c224, 0xc10964b3, 0x4ce33229, 0xabfe94be, 0x59a97946, + 0xbeb4dfd1, 0x6677a4f7, 0x816a0260, 0x733def98, 0x9420490f, + 0xb39844ed, 0x5485e27a, 0xa6d20f82, 0x41cfa915, 0x990cd233, + 0x7e1174a4, 0x8c46995c, 0x6b5b3fcb, 0xe6b16951, 0x01accfc6, + 0xf3fb223e, 0x14e684a9, 0xcc25ff8f, 0x2b385918, 0xd96fb4e0, + 0x3e721277}, + {0x00000000, 0xa58b900e, 0x9066265d, 0x35edb653, 0xfbbd4afb, + 0x5e36daf5, 0x6bdb6ca6, 0xce50fca8, 0x2c0b93b7, 0x898003b9, + 0xbc6db5ea, 0x19e625e4, 0xd7b6d94c, 0x723d4942, 0x47d0ff11, + 0xe25b6f1f, 0x5817276e, 0xfd9cb760, 0xc8710133, 0x6dfa913d, + 0xa3aa6d95, 0x0621fd9b, 0x33cc4bc8, 0x9647dbc6, 0x741cb4d9, + 0xd19724d7, 0xe47a9284, 0x41f1028a, 0x8fa1fe22, 0x2a2a6e2c, + 0x1fc7d87f, 0xba4c4871, 0xb02e4edc, 0x15a5ded2, 0x20486881, + 0x85c3f88f, 0x4b930427, 0xee189429, 0xdbf5227a, 0x7e7eb274, + 0x9c25dd6b, 0x39ae4d65, 0x0c43fb36, 0xa9c86b38, 0x67989790, + 0xc213079e, 0xf7feb1cd, 0x527521c3, 0xe83969b2, 0x4db2f9bc, + 0x785f4fef, 0xddd4dfe1, 0x13842349, 0xb60fb347, 0x83e20514, + 0x2669951a, 0xc432fa05, 0x61b96a0b, 0x5454dc58, 0xf1df4c56, + 0x3f8fb0fe, 0x9a0420f0, 0xafe996a3, 0x0a6206ad, 0xbb2d9bf9, + 0x1ea60bf7, 0x2b4bbda4, 0x8ec02daa, 0x4090d102, 0xe51b410c, + 0xd0f6f75f, 0x757d6751, 0x9726084e, 0x32ad9840, 0x07402e13, + 0xa2cbbe1d, 0x6c9b42b5, 0xc910d2bb, 0xfcfd64e8, 0x5976f4e6, + 0xe33abc97, 0x46b12c99, 0x735c9aca, 0xd6d70ac4, 0x1887f66c, + 0xbd0c6662, 0x88e1d031, 0x2d6a403f, 0xcf312f20, 0x6ababf2e, + 0x5f57097d, 0xfadc9973, 0x348c65db, 0x9107f5d5, 0xa4ea4386, + 0x0161d388, 0x0b03d525, 0xae88452b, 0x9b65f378, 0x3eee6376, + 0xf0be9fde, 0x55350fd0, 0x60d8b983, 0xc553298d, 0x27084692, + 0x8283d69c, 0xb76e60cf, 0x12e5f0c1, 0xdcb50c69, 0x793e9c67, + 0x4cd32a34, 0xe958ba3a, 0x5314f24b, 0xf69f6245, 0xc372d416, + 0x66f94418, 0xa8a9b8b0, 0x0d2228be, 0x38cf9eed, 0x9d440ee3, + 0x7f1f61fc, 0xda94f1f2, 0xef7947a1, 0x4af2d7af, 0x84a22b07, + 0x2129bb09, 0x14c40d5a, 0xb14f9d54, 0xad2a31b3, 0x08a1a1bd, + 0x3d4c17ee, 0x98c787e0, 0x56977b48, 0xf31ceb46, 0xc6f15d15, + 0x637acd1b, 0x8121a204, 0x24aa320a, 0x11478459, 0xb4cc1457, + 0x7a9ce8ff, 0xdf1778f1, 0xeafacea2, 0x4f715eac, 0xf53d16dd, + 0x50b686d3, 0x655b3080, 0xc0d0a08e, 0x0e805c26, 0xab0bcc28, + 0x9ee67a7b, 0x3b6dea75, 0xd936856a, 0x7cbd1564, 0x4950a337, + 0xecdb3339, 0x228bcf91, 0x87005f9f, 0xb2ede9cc, 0x176679c2, + 0x1d047f6f, 0xb88fef61, 0x8d625932, 0x28e9c93c, 0xe6b93594, + 0x4332a59a, 0x76df13c9, 0xd35483c7, 0x310fecd8, 0x94847cd6, + 0xa169ca85, 0x04e25a8b, 0xcab2a623, 0x6f39362d, 0x5ad4807e, + 0xff5f1070, 0x45135801, 0xe098c80f, 0xd5757e5c, 0x70feee52, + 0xbeae12fa, 0x1b2582f4, 0x2ec834a7, 0x8b43a4a9, 0x6918cbb6, + 0xcc935bb8, 0xf97eedeb, 0x5cf57de5, 0x92a5814d, 0x372e1143, + 0x02c3a710, 0xa748371e, 0x1607aa4a, 0xb38c3a44, 0x86618c17, + 0x23ea1c19, 0xedbae0b1, 0x483170bf, 0x7ddcc6ec, 0xd85756e2, + 0x3a0c39fd, 0x9f87a9f3, 0xaa6a1fa0, 0x0fe18fae, 0xc1b17306, + 0x643ae308, 0x51d7555b, 0xf45cc555, 0x4e108d24, 0xeb9b1d2a, + 0xde76ab79, 0x7bfd3b77, 0xb5adc7df, 0x102657d1, 0x25cbe182, + 0x8040718c, 0x621b1e93, 0xc7908e9d, 0xf27d38ce, 0x57f6a8c0, + 0x99a65468, 0x3c2dc466, 0x09c07235, 0xac4be23b, 0xa629e496, + 0x03a27498, 0x364fc2cb, 0x93c452c5, 0x5d94ae6d, 0xf81f3e63, + 0xcdf28830, 0x6879183e, 0x8a227721, 0x2fa9e72f, 0x1a44517c, + 0xbfcfc172, 0x719f3dda, 0xd414add4, 0xe1f91b87, 0x44728b89, + 0xfe3ec3f8, 0x5bb553f6, 0x6e58e5a5, 0xcbd375ab, 0x05838903, + 0xa008190d, 0x95e5af5e, 0x306e3f50, 0xd235504f, 0x77bec041, + 0x42537612, 0xe7d8e61c, 0x29881ab4, 0x8c038aba, 0xb9ee3ce9, + 0x1c65ace7}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0x0e908ba500000000, 0x5d26669000000000, + 0x53b6ed3500000000, 0xfb4abdfb00000000, 0xf5da365e00000000, + 0xa66cdb6b00000000, 0xa8fc50ce00000000, 0xb7930b2c00000000, + 0xb903808900000000, 0xeab56dbc00000000, 0xe425e61900000000, + 0x4cd9b6d700000000, 0x42493d7200000000, 0x11ffd04700000000, + 0x1f6f5be200000000, 0x6e27175800000000, 0x60b79cfd00000000, + 0x330171c800000000, 0x3d91fa6d00000000, 0x956daaa300000000, + 0x9bfd210600000000, 0xc84bcc3300000000, 0xc6db479600000000, + 0xd9b41c7400000000, 0xd72497d100000000, 0x84927ae400000000, + 0x8a02f14100000000, 0x22fea18f00000000, 0x2c6e2a2a00000000, + 0x7fd8c71f00000000, 0x71484cba00000000, 0xdc4e2eb000000000, + 0xd2dea51500000000, 0x8168482000000000, 0x8ff8c38500000000, + 0x2704934b00000000, 0x299418ee00000000, 0x7a22f5db00000000, + 0x74b27e7e00000000, 0x6bdd259c00000000, 0x654dae3900000000, + 0x36fb430c00000000, 0x386bc8a900000000, 0x9097986700000000, + 0x9e0713c200000000, 0xcdb1fef700000000, 0xc321755200000000, + 0xb26939e800000000, 0xbcf9b24d00000000, 0xef4f5f7800000000, + 0xe1dfd4dd00000000, 0x4923841300000000, 0x47b30fb600000000, + 0x1405e28300000000, 0x1a95692600000000, 0x05fa32c400000000, + 0x0b6ab96100000000, 0x58dc545400000000, 0x564cdff100000000, + 0xfeb08f3f00000000, 0xf020049a00000000, 0xa396e9af00000000, + 0xad06620a00000000, 0xf99b2dbb00000000, 0xf70ba61e00000000, + 0xa4bd4b2b00000000, 0xaa2dc08e00000000, 0x02d1904000000000, + 0x0c411be500000000, 0x5ff7f6d000000000, 0x51677d7500000000, + 0x4e08269700000000, 0x4098ad3200000000, 0x132e400700000000, + 0x1dbecba200000000, 0xb5429b6c00000000, 0xbbd210c900000000, + 0xe864fdfc00000000, 0xe6f4765900000000, 0x97bc3ae300000000, + 0x992cb14600000000, 0xca9a5c7300000000, 0xc40ad7d600000000, + 0x6cf6871800000000, 0x62660cbd00000000, 0x31d0e18800000000, + 0x3f406a2d00000000, 0x202f31cf00000000, 0x2ebfba6a00000000, + 0x7d09575f00000000, 0x7399dcfa00000000, 0xdb658c3400000000, + 0xd5f5079100000000, 0x8643eaa400000000, 0x88d3610100000000, + 0x25d5030b00000000, 0x2b4588ae00000000, 0x78f3659b00000000, + 0x7663ee3e00000000, 0xde9fbef000000000, 0xd00f355500000000, + 0x83b9d86000000000, 0x8d2953c500000000, 0x9246082700000000, + 0x9cd6838200000000, 0xcf606eb700000000, 0xc1f0e51200000000, + 0x690cb5dc00000000, 0x679c3e7900000000, 0x342ad34c00000000, + 0x3aba58e900000000, 0x4bf2145300000000, 0x45629ff600000000, + 0x16d472c300000000, 0x1844f96600000000, 0xb0b8a9a800000000, + 0xbe28220d00000000, 0xed9ecf3800000000, 0xe30e449d00000000, + 0xfc611f7f00000000, 0xf2f194da00000000, 0xa14779ef00000000, + 0xafd7f24a00000000, 0x072ba28400000000, 0x09bb292100000000, + 0x5a0dc41400000000, 0x549d4fb100000000, 0xb3312aad00000000, + 0xbda1a10800000000, 0xee174c3d00000000, 0xe087c79800000000, + 0x487b975600000000, 0x46eb1cf300000000, 0x155df1c600000000, + 0x1bcd7a6300000000, 0x04a2218100000000, 0x0a32aa2400000000, + 0x5984471100000000, 0x5714ccb400000000, 0xffe89c7a00000000, + 0xf17817df00000000, 0xa2cefaea00000000, 0xac5e714f00000000, + 0xdd163df500000000, 0xd386b65000000000, 0x80305b6500000000, + 0x8ea0d0c000000000, 0x265c800e00000000, 0x28cc0bab00000000, + 0x7b7ae69e00000000, 0x75ea6d3b00000000, 0x6a8536d900000000, + 0x6415bd7c00000000, 0x37a3504900000000, 0x3933dbec00000000, + 0x91cf8b2200000000, 0x9f5f008700000000, 0xcce9edb200000000, + 0xc279661700000000, 0x6f7f041d00000000, 0x61ef8fb800000000, + 0x3259628d00000000, 0x3cc9e92800000000, 0x9435b9e600000000, + 0x9aa5324300000000, 0xc913df7600000000, 0xc78354d300000000, + 0xd8ec0f3100000000, 0xd67c849400000000, 0x85ca69a100000000, + 0x8b5ae20400000000, 0x23a6b2ca00000000, 0x2d36396f00000000, + 0x7e80d45a00000000, 0x70105fff00000000, 0x0158134500000000, + 0x0fc898e000000000, 0x5c7e75d500000000, 0x52eefe7000000000, + 0xfa12aebe00000000, 0xf482251b00000000, 0xa734c82e00000000, + 0xa9a4438b00000000, 0xb6cb186900000000, 0xb85b93cc00000000, + 0xebed7ef900000000, 0xe57df55c00000000, 0x4d81a59200000000, + 0x43112e3700000000, 0x10a7c30200000000, 0x1e3748a700000000, + 0x4aaa071600000000, 0x443a8cb300000000, 0x178c618600000000, + 0x191cea2300000000, 0xb1e0baed00000000, 0xbf70314800000000, + 0xecc6dc7d00000000, 0xe25657d800000000, 0xfd390c3a00000000, + 0xf3a9879f00000000, 0xa01f6aaa00000000, 0xae8fe10f00000000, + 0x0673b1c100000000, 0x08e33a6400000000, 0x5b55d75100000000, + 0x55c55cf400000000, 0x248d104e00000000, 0x2a1d9beb00000000, + 0x79ab76de00000000, 0x773bfd7b00000000, 0xdfc7adb500000000, + 0xd157261000000000, 0x82e1cb2500000000, 0x8c71408000000000, + 0x931e1b6200000000, 0x9d8e90c700000000, 0xce387df200000000, + 0xc0a8f65700000000, 0x6854a69900000000, 0x66c42d3c00000000, + 0x3572c00900000000, 0x3be24bac00000000, 0x96e429a600000000, + 0x9874a20300000000, 0xcbc24f3600000000, 0xc552c49300000000, + 0x6dae945d00000000, 0x633e1ff800000000, 0x3088f2cd00000000, + 0x3e18796800000000, 0x2177228a00000000, 0x2fe7a92f00000000, + 0x7c51441a00000000, 0x72c1cfbf00000000, 0xda3d9f7100000000, + 0xd4ad14d400000000, 0x871bf9e100000000, 0x898b724400000000, + 0xf8c33efe00000000, 0xf653b55b00000000, 0xa5e5586e00000000, + 0xab75d3cb00000000, 0x0389830500000000, 0x0d1908a000000000, + 0x5eafe59500000000, 0x503f6e3000000000, 0x4f5035d200000000, + 0x41c0be7700000000, 0x1276534200000000, 0x1ce6d8e700000000, + 0xb41a882900000000, 0xba8a038c00000000, 0xe93ceeb900000000, + 0xe7ac651c00000000}, + {0x0000000000000000, 0x97a61de700000000, 0x6f4b4a1500000000, + 0xf8ed57f200000000, 0xde96942a00000000, 0x493089cd00000000, + 0xb1ddde3f00000000, 0x267bc3d800000000, 0xbc2d295500000000, + 0x2b8b34b200000000, 0xd366634000000000, 0x44c07ea700000000, + 0x62bbbd7f00000000, 0xf51da09800000000, 0x0df0f76a00000000, + 0x9a56ea8d00000000, 0x785b52aa00000000, 0xeffd4f4d00000000, + 0x171018bf00000000, 0x80b6055800000000, 0xa6cdc68000000000, + 0x316bdb6700000000, 0xc9868c9500000000, 0x5e20917200000000, + 0xc4767bff00000000, 0x53d0661800000000, 0xab3d31ea00000000, + 0x3c9b2c0d00000000, 0x1ae0efd500000000, 0x8d46f23200000000, + 0x75aba5c000000000, 0xe20db82700000000, 0xb1b0d58f00000000, + 0x2616c86800000000, 0xdefb9f9a00000000, 0x495d827d00000000, + 0x6f2641a500000000, 0xf8805c4200000000, 0x006d0bb000000000, + 0x97cb165700000000, 0x0d9dfcda00000000, 0x9a3be13d00000000, + 0x62d6b6cf00000000, 0xf570ab2800000000, 0xd30b68f000000000, + 0x44ad751700000000, 0xbc4022e500000000, 0x2be63f0200000000, + 0xc9eb872500000000, 0x5e4d9ac200000000, 0xa6a0cd3000000000, + 0x3106d0d700000000, 0x177d130f00000000, 0x80db0ee800000000, + 0x7836591a00000000, 0xef9044fd00000000, 0x75c6ae7000000000, + 0xe260b39700000000, 0x1a8de46500000000, 0x8d2bf98200000000, + 0xab503a5a00000000, 0x3cf627bd00000000, 0xc41b704f00000000, + 0x53bd6da800000000, 0x2367dac400000000, 0xb4c1c72300000000, + 0x4c2c90d100000000, 0xdb8a8d3600000000, 0xfdf14eee00000000, + 0x6a57530900000000, 0x92ba04fb00000000, 0x051c191c00000000, + 0x9f4af39100000000, 0x08ecee7600000000, 0xf001b98400000000, + 0x67a7a46300000000, 0x41dc67bb00000000, 0xd67a7a5c00000000, + 0x2e972dae00000000, 0xb931304900000000, 0x5b3c886e00000000, + 0xcc9a958900000000, 0x3477c27b00000000, 0xa3d1df9c00000000, + 0x85aa1c4400000000, 0x120c01a300000000, 0xeae1565100000000, + 0x7d474bb600000000, 0xe711a13b00000000, 0x70b7bcdc00000000, + 0x885aeb2e00000000, 0x1ffcf6c900000000, 0x3987351100000000, + 0xae2128f600000000, 0x56cc7f0400000000, 0xc16a62e300000000, + 0x92d70f4b00000000, 0x057112ac00000000, 0xfd9c455e00000000, + 0x6a3a58b900000000, 0x4c419b6100000000, 0xdbe7868600000000, + 0x230ad17400000000, 0xb4accc9300000000, 0x2efa261e00000000, + 0xb95c3bf900000000, 0x41b16c0b00000000, 0xd61771ec00000000, + 0xf06cb23400000000, 0x67caafd300000000, 0x9f27f82100000000, + 0x0881e5c600000000, 0xea8c5de100000000, 0x7d2a400600000000, + 0x85c717f400000000, 0x12610a1300000000, 0x341ac9cb00000000, + 0xa3bcd42c00000000, 0x5b5183de00000000, 0xccf79e3900000000, + 0x56a174b400000000, 0xc107695300000000, 0x39ea3ea100000000, + 0xae4c234600000000, 0x8837e09e00000000, 0x1f91fd7900000000, + 0xe77caa8b00000000, 0x70dab76c00000000, 0x07c8c55200000000, + 0x906ed8b500000000, 0x68838f4700000000, 0xff2592a000000000, + 0xd95e517800000000, 0x4ef84c9f00000000, 0xb6151b6d00000000, + 0x21b3068a00000000, 0xbbe5ec0700000000, 0x2c43f1e000000000, + 0xd4aea61200000000, 0x4308bbf500000000, 0x6573782d00000000, + 0xf2d565ca00000000, 0x0a38323800000000, 0x9d9e2fdf00000000, + 0x7f9397f800000000, 0xe8358a1f00000000, 0x10d8dded00000000, + 0x877ec00a00000000, 0xa10503d200000000, 0x36a31e3500000000, + 0xce4e49c700000000, 0x59e8542000000000, 0xc3bebead00000000, + 0x5418a34a00000000, 0xacf5f4b800000000, 0x3b53e95f00000000, + 0x1d282a8700000000, 0x8a8e376000000000, 0x7263609200000000, + 0xe5c57d7500000000, 0xb67810dd00000000, 0x21de0d3a00000000, + 0xd9335ac800000000, 0x4e95472f00000000, 0x68ee84f700000000, + 0xff48991000000000, 0x07a5cee200000000, 0x9003d30500000000, + 0x0a55398800000000, 0x9df3246f00000000, 0x651e739d00000000, + 0xf2b86e7a00000000, 0xd4c3ada200000000, 0x4365b04500000000, + 0xbb88e7b700000000, 0x2c2efa5000000000, 0xce23427700000000, + 0x59855f9000000000, 0xa168086200000000, 0x36ce158500000000, + 0x10b5d65d00000000, 0x8713cbba00000000, 0x7ffe9c4800000000, + 0xe85881af00000000, 0x720e6b2200000000, 0xe5a876c500000000, + 0x1d45213700000000, 0x8ae33cd000000000, 0xac98ff0800000000, + 0x3b3ee2ef00000000, 0xc3d3b51d00000000, 0x5475a8fa00000000, + 0x24af1f9600000000, 0xb309027100000000, 0x4be4558300000000, + 0xdc42486400000000, 0xfa398bbc00000000, 0x6d9f965b00000000, + 0x9572c1a900000000, 0x02d4dc4e00000000, 0x988236c300000000, + 0x0f242b2400000000, 0xf7c97cd600000000, 0x606f613100000000, + 0x4614a2e900000000, 0xd1b2bf0e00000000, 0x295fe8fc00000000, + 0xbef9f51b00000000, 0x5cf44d3c00000000, 0xcb5250db00000000, + 0x33bf072900000000, 0xa4191ace00000000, 0x8262d91600000000, + 0x15c4c4f100000000, 0xed29930300000000, 0x7a8f8ee400000000, + 0xe0d9646900000000, 0x777f798e00000000, 0x8f922e7c00000000, + 0x1834339b00000000, 0x3e4ff04300000000, 0xa9e9eda400000000, + 0x5104ba5600000000, 0xc6a2a7b100000000, 0x951fca1900000000, + 0x02b9d7fe00000000, 0xfa54800c00000000, 0x6df29deb00000000, + 0x4b895e3300000000, 0xdc2f43d400000000, 0x24c2142600000000, + 0xb36409c100000000, 0x2932e34c00000000, 0xbe94feab00000000, + 0x4679a95900000000, 0xd1dfb4be00000000, 0xf7a4776600000000, + 0x60026a8100000000, 0x98ef3d7300000000, 0x0f49209400000000, + 0xed4498b300000000, 0x7ae2855400000000, 0x820fd2a600000000, + 0x15a9cf4100000000, 0x33d20c9900000000, 0xa474117e00000000, + 0x5c99468c00000000, 0xcb3f5b6b00000000, 0x5169b1e600000000, + 0xc6cfac0100000000, 0x3e22fbf300000000, 0xa984e61400000000, + 0x8fff25cc00000000, 0x1859382b00000000, 0xe0b46fd900000000, + 0x7712723e00000000}, + {0x0000000000000000, 0x411b8c6e00000000, 0x823618dd00000000, + 0xc32d94b300000000, 0x456b416100000000, 0x0470cd0f00000000, + 0xc75d59bc00000000, 0x8646d5d200000000, 0x8ad682c200000000, + 0xcbcd0eac00000000, 0x08e09a1f00000000, 0x49fb167100000000, + 0xcfbdc3a300000000, 0x8ea64fcd00000000, 0x4d8bdb7e00000000, + 0x0c90571000000000, 0x55ab745e00000000, 0x14b0f83000000000, + 0xd79d6c8300000000, 0x9686e0ed00000000, 0x10c0353f00000000, + 0x51dbb95100000000, 0x92f62de200000000, 0xd3eda18c00000000, + 0xdf7df69c00000000, 0x9e667af200000000, 0x5d4bee4100000000, + 0x1c50622f00000000, 0x9a16b7fd00000000, 0xdb0d3b9300000000, + 0x1820af2000000000, 0x593b234e00000000, 0xaa56e9bc00000000, + 0xeb4d65d200000000, 0x2860f16100000000, 0x697b7d0f00000000, + 0xef3da8dd00000000, 0xae2624b300000000, 0x6d0bb00000000000, + 0x2c103c6e00000000, 0x20806b7e00000000, 0x619be71000000000, + 0xa2b673a300000000, 0xe3adffcd00000000, 0x65eb2a1f00000000, + 0x24f0a67100000000, 0xe7dd32c200000000, 0xa6c6beac00000000, + 0xfffd9de200000000, 0xbee6118c00000000, 0x7dcb853f00000000, + 0x3cd0095100000000, 0xba96dc8300000000, 0xfb8d50ed00000000, + 0x38a0c45e00000000, 0x79bb483000000000, 0x752b1f2000000000, + 0x3430934e00000000, 0xf71d07fd00000000, 0xb6068b9300000000, + 0x30405e4100000000, 0x715bd22f00000000, 0xb276469c00000000, + 0xf36dcaf200000000, 0x15aba3a200000000, 0x54b02fcc00000000, + 0x979dbb7f00000000, 0xd686371100000000, 0x50c0e2c300000000, + 0x11db6ead00000000, 0xd2f6fa1e00000000, 0x93ed767000000000, + 0x9f7d216000000000, 0xde66ad0e00000000, 0x1d4b39bd00000000, + 0x5c50b5d300000000, 0xda16600100000000, 0x9b0dec6f00000000, + 0x582078dc00000000, 0x193bf4b200000000, 0x4000d7fc00000000, + 0x011b5b9200000000, 0xc236cf2100000000, 0x832d434f00000000, + 0x056b969d00000000, 0x44701af300000000, 0x875d8e4000000000, + 0xc646022e00000000, 0xcad6553e00000000, 0x8bcdd95000000000, + 0x48e04de300000000, 0x09fbc18d00000000, 0x8fbd145f00000000, + 0xcea6983100000000, 0x0d8b0c8200000000, 0x4c9080ec00000000, + 0xbffd4a1e00000000, 0xfee6c67000000000, 0x3dcb52c300000000, + 0x7cd0dead00000000, 0xfa960b7f00000000, 0xbb8d871100000000, + 0x78a013a200000000, 0x39bb9fcc00000000, 0x352bc8dc00000000, + 0x743044b200000000, 0xb71dd00100000000, 0xf6065c6f00000000, + 0x704089bd00000000, 0x315b05d300000000, 0xf276916000000000, + 0xb36d1d0e00000000, 0xea563e4000000000, 0xab4db22e00000000, + 0x6860269d00000000, 0x297baaf300000000, 0xaf3d7f2100000000, + 0xee26f34f00000000, 0x2d0b67fc00000000, 0x6c10eb9200000000, + 0x6080bc8200000000, 0x219b30ec00000000, 0xe2b6a45f00000000, + 0xa3ad283100000000, 0x25ebfde300000000, 0x64f0718d00000000, + 0xa7dde53e00000000, 0xe6c6695000000000, 0x6b50369e00000000, + 0x2a4bbaf000000000, 0xe9662e4300000000, 0xa87da22d00000000, + 0x2e3b77ff00000000, 0x6f20fb9100000000, 0xac0d6f2200000000, + 0xed16e34c00000000, 0xe186b45c00000000, 0xa09d383200000000, + 0x63b0ac8100000000, 0x22ab20ef00000000, 0xa4edf53d00000000, + 0xe5f6795300000000, 0x26dbede000000000, 0x67c0618e00000000, + 0x3efb42c000000000, 0x7fe0ceae00000000, 0xbccd5a1d00000000, + 0xfdd6d67300000000, 0x7b9003a100000000, 0x3a8b8fcf00000000, + 0xf9a61b7c00000000, 0xb8bd971200000000, 0xb42dc00200000000, + 0xf5364c6c00000000, 0x361bd8df00000000, 0x770054b100000000, + 0xf146816300000000, 0xb05d0d0d00000000, 0x737099be00000000, + 0x326b15d000000000, 0xc106df2200000000, 0x801d534c00000000, + 0x4330c7ff00000000, 0x022b4b9100000000, 0x846d9e4300000000, + 0xc576122d00000000, 0x065b869e00000000, 0x47400af000000000, + 0x4bd05de000000000, 0x0acbd18e00000000, 0xc9e6453d00000000, + 0x88fdc95300000000, 0x0ebb1c8100000000, 0x4fa090ef00000000, + 0x8c8d045c00000000, 0xcd96883200000000, 0x94adab7c00000000, + 0xd5b6271200000000, 0x169bb3a100000000, 0x57803fcf00000000, + 0xd1c6ea1d00000000, 0x90dd667300000000, 0x53f0f2c000000000, + 0x12eb7eae00000000, 0x1e7b29be00000000, 0x5f60a5d000000000, + 0x9c4d316300000000, 0xdd56bd0d00000000, 0x5b1068df00000000, + 0x1a0be4b100000000, 0xd926700200000000, 0x983dfc6c00000000, + 0x7efb953c00000000, 0x3fe0195200000000, 0xfccd8de100000000, + 0xbdd6018f00000000, 0x3b90d45d00000000, 0x7a8b583300000000, + 0xb9a6cc8000000000, 0xf8bd40ee00000000, 0xf42d17fe00000000, + 0xb5369b9000000000, 0x761b0f2300000000, 0x3700834d00000000, + 0xb146569f00000000, 0xf05ddaf100000000, 0x33704e4200000000, + 0x726bc22c00000000, 0x2b50e16200000000, 0x6a4b6d0c00000000, + 0xa966f9bf00000000, 0xe87d75d100000000, 0x6e3ba00300000000, + 0x2f202c6d00000000, 0xec0db8de00000000, 0xad1634b000000000, + 0xa18663a000000000, 0xe09defce00000000, 0x23b07b7d00000000, + 0x62abf71300000000, 0xe4ed22c100000000, 0xa5f6aeaf00000000, + 0x66db3a1c00000000, 0x27c0b67200000000, 0xd4ad7c8000000000, + 0x95b6f0ee00000000, 0x569b645d00000000, 0x1780e83300000000, + 0x91c63de100000000, 0xd0ddb18f00000000, 0x13f0253c00000000, + 0x52eba95200000000, 0x5e7bfe4200000000, 0x1f60722c00000000, + 0xdc4de69f00000000, 0x9d566af100000000, 0x1b10bf2300000000, + 0x5a0b334d00000000, 0x9926a7fe00000000, 0xd83d2b9000000000, + 0x810608de00000000, 0xc01d84b000000000, 0x0330100300000000, + 0x422b9c6d00000000, 0xc46d49bf00000000, 0x8576c5d100000000, + 0x465b516200000000, 0x0740dd0c00000000, 0x0bd08a1c00000000, + 0x4acb067200000000, 0x89e692c100000000, 0xc8fd1eaf00000000, + 0x4ebbcb7d00000000, 0x0fa0471300000000, 0xcc8dd3a000000000, + 0x8d965fce00000000}, + {0x0000000000000000, 0x1dfdb50100000000, 0x3afa6b0300000000, + 0x2707de0200000000, 0x74f4d70600000000, 0x6909620700000000, + 0x4e0ebc0500000000, 0x53f3090400000000, 0xe8e8af0d00000000, + 0xf5151a0c00000000, 0xd212c40e00000000, 0xcfef710f00000000, + 0x9c1c780b00000000, 0x81e1cd0a00000000, 0xa6e6130800000000, + 0xbb1ba60900000000, 0xd0d15f1b00000000, 0xcd2cea1a00000000, + 0xea2b341800000000, 0xf7d6811900000000, 0xa425881d00000000, + 0xb9d83d1c00000000, 0x9edfe31e00000000, 0x8322561f00000000, + 0x3839f01600000000, 0x25c4451700000000, 0x02c39b1500000000, + 0x1f3e2e1400000000, 0x4ccd271000000000, 0x5130921100000000, + 0x76374c1300000000, 0x6bcaf91200000000, 0xa0a3bf3600000000, + 0xbd5e0a3700000000, 0x9a59d43500000000, 0x87a4613400000000, + 0xd457683000000000, 0xc9aadd3100000000, 0xeead033300000000, + 0xf350b63200000000, 0x484b103b00000000, 0x55b6a53a00000000, + 0x72b17b3800000000, 0x6f4cce3900000000, 0x3cbfc73d00000000, + 0x2142723c00000000, 0x0645ac3e00000000, 0x1bb8193f00000000, + 0x7072e02d00000000, 0x6d8f552c00000000, 0x4a888b2e00000000, + 0x57753e2f00000000, 0x0486372b00000000, 0x197b822a00000000, + 0x3e7c5c2800000000, 0x2381e92900000000, 0x989a4f2000000000, + 0x8567fa2100000000, 0xa260242300000000, 0xbf9d912200000000, + 0xec6e982600000000, 0xf1932d2700000000, 0xd694f32500000000, + 0xcb69462400000000, 0x40477f6d00000000, 0x5dbaca6c00000000, + 0x7abd146e00000000, 0x6740a16f00000000, 0x34b3a86b00000000, + 0x294e1d6a00000000, 0x0e49c36800000000, 0x13b4766900000000, + 0xa8afd06000000000, 0xb552656100000000, 0x9255bb6300000000, + 0x8fa80e6200000000, 0xdc5b076600000000, 0xc1a6b26700000000, + 0xe6a16c6500000000, 0xfb5cd96400000000, 0x9096207600000000, + 0x8d6b957700000000, 0xaa6c4b7500000000, 0xb791fe7400000000, + 0xe462f77000000000, 0xf99f427100000000, 0xde989c7300000000, + 0xc365297200000000, 0x787e8f7b00000000, 0x65833a7a00000000, + 0x4284e47800000000, 0x5f79517900000000, 0x0c8a587d00000000, + 0x1177ed7c00000000, 0x3670337e00000000, 0x2b8d867f00000000, + 0xe0e4c05b00000000, 0xfd19755a00000000, 0xda1eab5800000000, + 0xc7e31e5900000000, 0x9410175d00000000, 0x89eda25c00000000, + 0xaeea7c5e00000000, 0xb317c95f00000000, 0x080c6f5600000000, + 0x15f1da5700000000, 0x32f6045500000000, 0x2f0bb15400000000, + 0x7cf8b85000000000, 0x61050d5100000000, 0x4602d35300000000, + 0x5bff665200000000, 0x30359f4000000000, 0x2dc82a4100000000, + 0x0acff44300000000, 0x1732414200000000, 0x44c1484600000000, + 0x593cfd4700000000, 0x7e3b234500000000, 0x63c6964400000000, + 0xd8dd304d00000000, 0xc520854c00000000, 0xe2275b4e00000000, + 0xffdaee4f00000000, 0xac29e74b00000000, 0xb1d4524a00000000, + 0x96d38c4800000000, 0x8b2e394900000000, 0x808efeda00000000, + 0x9d734bdb00000000, 0xba7495d900000000, 0xa78920d800000000, + 0xf47a29dc00000000, 0xe9879cdd00000000, 0xce8042df00000000, + 0xd37df7de00000000, 0x686651d700000000, 0x759be4d600000000, + 0x529c3ad400000000, 0x4f618fd500000000, 0x1c9286d100000000, + 0x016f33d000000000, 0x2668edd200000000, 0x3b9558d300000000, + 0x505fa1c100000000, 0x4da214c000000000, 0x6aa5cac200000000, + 0x77587fc300000000, 0x24ab76c700000000, 0x3956c3c600000000, + 0x1e511dc400000000, 0x03aca8c500000000, 0xb8b70ecc00000000, + 0xa54abbcd00000000, 0x824d65cf00000000, 0x9fb0d0ce00000000, + 0xcc43d9ca00000000, 0xd1be6ccb00000000, 0xf6b9b2c900000000, + 0xeb4407c800000000, 0x202d41ec00000000, 0x3dd0f4ed00000000, + 0x1ad72aef00000000, 0x072a9fee00000000, 0x54d996ea00000000, + 0x492423eb00000000, 0x6e23fde900000000, 0x73de48e800000000, + 0xc8c5eee100000000, 0xd5385be000000000, 0xf23f85e200000000, + 0xefc230e300000000, 0xbc3139e700000000, 0xa1cc8ce600000000, + 0x86cb52e400000000, 0x9b36e7e500000000, 0xf0fc1ef700000000, + 0xed01abf600000000, 0xca0675f400000000, 0xd7fbc0f500000000, + 0x8408c9f100000000, 0x99f57cf000000000, 0xbef2a2f200000000, + 0xa30f17f300000000, 0x1814b1fa00000000, 0x05e904fb00000000, + 0x22eedaf900000000, 0x3f136ff800000000, 0x6ce066fc00000000, + 0x711dd3fd00000000, 0x561a0dff00000000, 0x4be7b8fe00000000, + 0xc0c981b700000000, 0xdd3434b600000000, 0xfa33eab400000000, + 0xe7ce5fb500000000, 0xb43d56b100000000, 0xa9c0e3b000000000, + 0x8ec73db200000000, 0x933a88b300000000, 0x28212eba00000000, + 0x35dc9bbb00000000, 0x12db45b900000000, 0x0f26f0b800000000, + 0x5cd5f9bc00000000, 0x41284cbd00000000, 0x662f92bf00000000, + 0x7bd227be00000000, 0x1018deac00000000, 0x0de56bad00000000, + 0x2ae2b5af00000000, 0x371f00ae00000000, 0x64ec09aa00000000, + 0x7911bcab00000000, 0x5e1662a900000000, 0x43ebd7a800000000, + 0xf8f071a100000000, 0xe50dc4a000000000, 0xc20a1aa200000000, + 0xdff7afa300000000, 0x8c04a6a700000000, 0x91f913a600000000, + 0xb6fecda400000000, 0xab0378a500000000, 0x606a3e8100000000, + 0x7d978b8000000000, 0x5a90558200000000, 0x476de08300000000, + 0x149ee98700000000, 0x09635c8600000000, 0x2e64828400000000, + 0x3399378500000000, 0x8882918c00000000, 0x957f248d00000000, + 0xb278fa8f00000000, 0xaf854f8e00000000, 0xfc76468a00000000, + 0xe18bf38b00000000, 0xc68c2d8900000000, 0xdb71988800000000, + 0xb0bb619a00000000, 0xad46d49b00000000, 0x8a410a9900000000, + 0x97bcbf9800000000, 0xc44fb69c00000000, 0xd9b2039d00000000, + 0xfeb5dd9f00000000, 0xe348689e00000000, 0x5853ce9700000000, + 0x45ae7b9600000000, 0x62a9a59400000000, 0x7f54109500000000, + 0x2ca7199100000000, 0x315aac9000000000, 0x165d729200000000, + 0x0ba0c79300000000}, + {0x0000000000000000, 0x24d9076300000000, 0x48b20fc600000000, + 0x6c6b08a500000000, 0xd1626e5700000000, 0xf5bb693400000000, + 0x99d0619100000000, 0xbd0966f200000000, 0xa2c5dcae00000000, + 0x861cdbcd00000000, 0xea77d36800000000, 0xceaed40b00000000, + 0x73a7b2f900000000, 0x577eb59a00000000, 0x3b15bd3f00000000, + 0x1fccba5c00000000, 0x058dc88600000000, 0x2154cfe500000000, + 0x4d3fc74000000000, 0x69e6c02300000000, 0xd4efa6d100000000, + 0xf036a1b200000000, 0x9c5da91700000000, 0xb884ae7400000000, + 0xa748142800000000, 0x8391134b00000000, 0xeffa1bee00000000, + 0xcb231c8d00000000, 0x762a7a7f00000000, 0x52f37d1c00000000, + 0x3e9875b900000000, 0x1a4172da00000000, 0x4b1ce0d600000000, + 0x6fc5e7b500000000, 0x03aeef1000000000, 0x2777e87300000000, + 0x9a7e8e8100000000, 0xbea789e200000000, 0xd2cc814700000000, + 0xf615862400000000, 0xe9d93c7800000000, 0xcd003b1b00000000, + 0xa16b33be00000000, 0x85b234dd00000000, 0x38bb522f00000000, + 0x1c62554c00000000, 0x70095de900000000, 0x54d05a8a00000000, + 0x4e91285000000000, 0x6a482f3300000000, 0x0623279600000000, + 0x22fa20f500000000, 0x9ff3460700000000, 0xbb2a416400000000, + 0xd74149c100000000, 0xf3984ea200000000, 0xec54f4fe00000000, + 0xc88df39d00000000, 0xa4e6fb3800000000, 0x803ffc5b00000000, + 0x3d369aa900000000, 0x19ef9dca00000000, 0x7584956f00000000, + 0x515d920c00000000, 0xd73eb17600000000, 0xf3e7b61500000000, + 0x9f8cbeb000000000, 0xbb55b9d300000000, 0x065cdf2100000000, + 0x2285d84200000000, 0x4eeed0e700000000, 0x6a37d78400000000, + 0x75fb6dd800000000, 0x51226abb00000000, 0x3d49621e00000000, + 0x1990657d00000000, 0xa499038f00000000, 0x804004ec00000000, + 0xec2b0c4900000000, 0xc8f20b2a00000000, 0xd2b379f000000000, + 0xf66a7e9300000000, 0x9a01763600000000, 0xbed8715500000000, + 0x03d117a700000000, 0x270810c400000000, 0x4b63186100000000, + 0x6fba1f0200000000, 0x7076a55e00000000, 0x54afa23d00000000, + 0x38c4aa9800000000, 0x1c1dadfb00000000, 0xa114cb0900000000, + 0x85cdcc6a00000000, 0xe9a6c4cf00000000, 0xcd7fc3ac00000000, + 0x9c2251a000000000, 0xb8fb56c300000000, 0xd4905e6600000000, + 0xf049590500000000, 0x4d403ff700000000, 0x6999389400000000, + 0x05f2303100000000, 0x212b375200000000, 0x3ee78d0e00000000, + 0x1a3e8a6d00000000, 0x765582c800000000, 0x528c85ab00000000, + 0xef85e35900000000, 0xcb5ce43a00000000, 0xa737ec9f00000000, + 0x83eeebfc00000000, 0x99af992600000000, 0xbd769e4500000000, + 0xd11d96e000000000, 0xf5c4918300000000, 0x48cdf77100000000, + 0x6c14f01200000000, 0x007ff8b700000000, 0x24a6ffd400000000, + 0x3b6a458800000000, 0x1fb342eb00000000, 0x73d84a4e00000000, + 0x57014d2d00000000, 0xea082bdf00000000, 0xced12cbc00000000, + 0xa2ba241900000000, 0x8663237a00000000, 0xae7d62ed00000000, + 0x8aa4658e00000000, 0xe6cf6d2b00000000, 0xc2166a4800000000, + 0x7f1f0cba00000000, 0x5bc60bd900000000, 0x37ad037c00000000, + 0x1374041f00000000, 0x0cb8be4300000000, 0x2861b92000000000, + 0x440ab18500000000, 0x60d3b6e600000000, 0xdddad01400000000, + 0xf903d77700000000, 0x9568dfd200000000, 0xb1b1d8b100000000, + 0xabf0aa6b00000000, 0x8f29ad0800000000, 0xe342a5ad00000000, + 0xc79ba2ce00000000, 0x7a92c43c00000000, 0x5e4bc35f00000000, + 0x3220cbfa00000000, 0x16f9cc9900000000, 0x093576c500000000, + 0x2dec71a600000000, 0x4187790300000000, 0x655e7e6000000000, + 0xd857189200000000, 0xfc8e1ff100000000, 0x90e5175400000000, + 0xb43c103700000000, 0xe561823b00000000, 0xc1b8855800000000, + 0xadd38dfd00000000, 0x890a8a9e00000000, 0x3403ec6c00000000, + 0x10daeb0f00000000, 0x7cb1e3aa00000000, 0x5868e4c900000000, + 0x47a45e9500000000, 0x637d59f600000000, 0x0f16515300000000, + 0x2bcf563000000000, 0x96c630c200000000, 0xb21f37a100000000, + 0xde743f0400000000, 0xfaad386700000000, 0xe0ec4abd00000000, + 0xc4354dde00000000, 0xa85e457b00000000, 0x8c87421800000000, + 0x318e24ea00000000, 0x1557238900000000, 0x793c2b2c00000000, + 0x5de52c4f00000000, 0x4229961300000000, 0x66f0917000000000, + 0x0a9b99d500000000, 0x2e429eb600000000, 0x934bf84400000000, + 0xb792ff2700000000, 0xdbf9f78200000000, 0xff20f0e100000000, + 0x7943d39b00000000, 0x5d9ad4f800000000, 0x31f1dc5d00000000, + 0x1528db3e00000000, 0xa821bdcc00000000, 0x8cf8baaf00000000, + 0xe093b20a00000000, 0xc44ab56900000000, 0xdb860f3500000000, + 0xff5f085600000000, 0x933400f300000000, 0xb7ed079000000000, + 0x0ae4616200000000, 0x2e3d660100000000, 0x42566ea400000000, + 0x668f69c700000000, 0x7cce1b1d00000000, 0x58171c7e00000000, + 0x347c14db00000000, 0x10a513b800000000, 0xadac754a00000000, + 0x8975722900000000, 0xe51e7a8c00000000, 0xc1c77def00000000, + 0xde0bc7b300000000, 0xfad2c0d000000000, 0x96b9c87500000000, + 0xb260cf1600000000, 0x0f69a9e400000000, 0x2bb0ae8700000000, + 0x47dba62200000000, 0x6302a14100000000, 0x325f334d00000000, + 0x1686342e00000000, 0x7aed3c8b00000000, 0x5e343be800000000, + 0xe33d5d1a00000000, 0xc7e45a7900000000, 0xab8f52dc00000000, + 0x8f5655bf00000000, 0x909aefe300000000, 0xb443e88000000000, + 0xd828e02500000000, 0xfcf1e74600000000, 0x41f881b400000000, + 0x652186d700000000, 0x094a8e7200000000, 0x2d93891100000000, + 0x37d2fbcb00000000, 0x130bfca800000000, 0x7f60f40d00000000, + 0x5bb9f36e00000000, 0xe6b0959c00000000, 0xc26992ff00000000, + 0xae029a5a00000000, 0x8adb9d3900000000, 0x9517276500000000, + 0xb1ce200600000000, 0xdda528a300000000, 0xf97c2fc000000000, + 0x4475493200000000, 0x60ac4e5100000000, 0x0cc746f400000000, + 0x281e419700000000}, + {0x0000000000000000, 0x08e3603c00000000, 0x10c6c17800000000, + 0x1825a14400000000, 0x208c83f100000000, 0x286fe3cd00000000, + 0x304a428900000000, 0x38a922b500000000, 0x011e763800000000, + 0x09fd160400000000, 0x11d8b74000000000, 0x193bd77c00000000, + 0x2192f5c900000000, 0x297195f500000000, 0x315434b100000000, + 0x39b7548d00000000, 0x023cec7000000000, 0x0adf8c4c00000000, + 0x12fa2d0800000000, 0x1a194d3400000000, 0x22b06f8100000000, + 0x2a530fbd00000000, 0x3276aef900000000, 0x3a95cec500000000, + 0x03229a4800000000, 0x0bc1fa7400000000, 0x13e45b3000000000, + 0x1b073b0c00000000, 0x23ae19b900000000, 0x2b4d798500000000, + 0x3368d8c100000000, 0x3b8bb8fd00000000, 0x0478d8e100000000, + 0x0c9bb8dd00000000, 0x14be199900000000, 0x1c5d79a500000000, + 0x24f45b1000000000, 0x2c173b2c00000000, 0x34329a6800000000, + 0x3cd1fa5400000000, 0x0566aed900000000, 0x0d85cee500000000, + 0x15a06fa100000000, 0x1d430f9d00000000, 0x25ea2d2800000000, + 0x2d094d1400000000, 0x352cec5000000000, 0x3dcf8c6c00000000, + 0x0644349100000000, 0x0ea754ad00000000, 0x1682f5e900000000, + 0x1e6195d500000000, 0x26c8b76000000000, 0x2e2bd75c00000000, + 0x360e761800000000, 0x3eed162400000000, 0x075a42a900000000, + 0x0fb9229500000000, 0x179c83d100000000, 0x1f7fe3ed00000000, + 0x27d6c15800000000, 0x2f35a16400000000, 0x3710002000000000, + 0x3ff3601c00000000, 0x49f6c11800000000, 0x4115a12400000000, + 0x5930006000000000, 0x51d3605c00000000, 0x697a42e900000000, + 0x619922d500000000, 0x79bc839100000000, 0x715fe3ad00000000, + 0x48e8b72000000000, 0x400bd71c00000000, 0x582e765800000000, + 0x50cd166400000000, 0x686434d100000000, 0x608754ed00000000, + 0x78a2f5a900000000, 0x7041959500000000, 0x4bca2d6800000000, + 0x43294d5400000000, 0x5b0cec1000000000, 0x53ef8c2c00000000, + 0x6b46ae9900000000, 0x63a5cea500000000, 0x7b806fe100000000, + 0x73630fdd00000000, 0x4ad45b5000000000, 0x42373b6c00000000, + 0x5a129a2800000000, 0x52f1fa1400000000, 0x6a58d8a100000000, + 0x62bbb89d00000000, 0x7a9e19d900000000, 0x727d79e500000000, + 0x4d8e19f900000000, 0x456d79c500000000, 0x5d48d88100000000, + 0x55abb8bd00000000, 0x6d029a0800000000, 0x65e1fa3400000000, + 0x7dc45b7000000000, 0x75273b4c00000000, 0x4c906fc100000000, + 0x44730ffd00000000, 0x5c56aeb900000000, 0x54b5ce8500000000, + 0x6c1cec3000000000, 0x64ff8c0c00000000, 0x7cda2d4800000000, + 0x74394d7400000000, 0x4fb2f58900000000, 0x475195b500000000, + 0x5f7434f100000000, 0x579754cd00000000, 0x6f3e767800000000, + 0x67dd164400000000, 0x7ff8b70000000000, 0x771bd73c00000000, + 0x4eac83b100000000, 0x464fe38d00000000, 0x5e6a42c900000000, + 0x568922f500000000, 0x6e20004000000000, 0x66c3607c00000000, + 0x7ee6c13800000000, 0x7605a10400000000, 0x92ec833100000000, + 0x9a0fe30d00000000, 0x822a424900000000, 0x8ac9227500000000, + 0xb26000c000000000, 0xba8360fc00000000, 0xa2a6c1b800000000, + 0xaa45a18400000000, 0x93f2f50900000000, 0x9b11953500000000, + 0x8334347100000000, 0x8bd7544d00000000, 0xb37e76f800000000, + 0xbb9d16c400000000, 0xa3b8b78000000000, 0xab5bd7bc00000000, + 0x90d06f4100000000, 0x98330f7d00000000, 0x8016ae3900000000, + 0x88f5ce0500000000, 0xb05cecb000000000, 0xb8bf8c8c00000000, + 0xa09a2dc800000000, 0xa8794df400000000, 0x91ce197900000000, + 0x992d794500000000, 0x8108d80100000000, 0x89ebb83d00000000, + 0xb1429a8800000000, 0xb9a1fab400000000, 0xa1845bf000000000, + 0xa9673bcc00000000, 0x96945bd000000000, 0x9e773bec00000000, + 0x86529aa800000000, 0x8eb1fa9400000000, 0xb618d82100000000, + 0xbefbb81d00000000, 0xa6de195900000000, 0xae3d796500000000, + 0x978a2de800000000, 0x9f694dd400000000, 0x874cec9000000000, + 0x8faf8cac00000000, 0xb706ae1900000000, 0xbfe5ce2500000000, + 0xa7c06f6100000000, 0xaf230f5d00000000, 0x94a8b7a000000000, + 0x9c4bd79c00000000, 0x846e76d800000000, 0x8c8d16e400000000, + 0xb424345100000000, 0xbcc7546d00000000, 0xa4e2f52900000000, + 0xac01951500000000, 0x95b6c19800000000, 0x9d55a1a400000000, + 0x857000e000000000, 0x8d9360dc00000000, 0xb53a426900000000, + 0xbdd9225500000000, 0xa5fc831100000000, 0xad1fe32d00000000, + 0xdb1a422900000000, 0xd3f9221500000000, 0xcbdc835100000000, + 0xc33fe36d00000000, 0xfb96c1d800000000, 0xf375a1e400000000, + 0xeb5000a000000000, 0xe3b3609c00000000, 0xda04341100000000, + 0xd2e7542d00000000, 0xcac2f56900000000, 0xc221955500000000, + 0xfa88b7e000000000, 0xf26bd7dc00000000, 0xea4e769800000000, + 0xe2ad16a400000000, 0xd926ae5900000000, 0xd1c5ce6500000000, + 0xc9e06f2100000000, 0xc1030f1d00000000, 0xf9aa2da800000000, + 0xf1494d9400000000, 0xe96cecd000000000, 0xe18f8cec00000000, + 0xd838d86100000000, 0xd0dbb85d00000000, 0xc8fe191900000000, + 0xc01d792500000000, 0xf8b45b9000000000, 0xf0573bac00000000, + 0xe8729ae800000000, 0xe091fad400000000, 0xdf629ac800000000, + 0xd781faf400000000, 0xcfa45bb000000000, 0xc7473b8c00000000, + 0xffee193900000000, 0xf70d790500000000, 0xef28d84100000000, + 0xe7cbb87d00000000, 0xde7cecf000000000, 0xd69f8ccc00000000, + 0xceba2d8800000000, 0xc6594db400000000, 0xfef06f0100000000, + 0xf6130f3d00000000, 0xee36ae7900000000, 0xe6d5ce4500000000, + 0xdd5e76b800000000, 0xd5bd168400000000, 0xcd98b7c000000000, + 0xc57bd7fc00000000, 0xfdd2f54900000000, 0xf531957500000000, + 0xed14343100000000, 0xe5f7540d00000000, 0xdc40008000000000, + 0xd4a360bc00000000, 0xcc86c1f800000000, 0xc465a1c400000000, + 0xfccc837100000000, 0xf42fe34d00000000, 0xec0a420900000000, + 0xe4e9223500000000}, + {0x0000000000000000, 0xd1e8e70e00000000, 0xa2d1cf1d00000000, + 0x7339281300000000, 0x44a39f3b00000000, 0x954b783500000000, + 0xe672502600000000, 0x379ab72800000000, 0x88463f7700000000, + 0x59aed87900000000, 0x2a97f06a00000000, 0xfb7f176400000000, + 0xcce5a04c00000000, 0x1d0d474200000000, 0x6e346f5100000000, + 0xbfdc885f00000000, 0x108d7eee00000000, 0xc16599e000000000, + 0xb25cb1f300000000, 0x63b456fd00000000, 0x542ee1d500000000, + 0x85c606db00000000, 0xf6ff2ec800000000, 0x2717c9c600000000, + 0x98cb419900000000, 0x4923a69700000000, 0x3a1a8e8400000000, + 0xebf2698a00000000, 0xdc68dea200000000, 0x0d8039ac00000000, + 0x7eb911bf00000000, 0xaf51f6b100000000, 0x611c8c0700000000, + 0xb0f46b0900000000, 0xc3cd431a00000000, 0x1225a41400000000, + 0x25bf133c00000000, 0xf457f43200000000, 0x876edc2100000000, + 0x56863b2f00000000, 0xe95ab37000000000, 0x38b2547e00000000, + 0x4b8b7c6d00000000, 0x9a639b6300000000, 0xadf92c4b00000000, + 0x7c11cb4500000000, 0x0f28e35600000000, 0xdec0045800000000, + 0x7191f2e900000000, 0xa07915e700000000, 0xd3403df400000000, + 0x02a8dafa00000000, 0x35326dd200000000, 0xe4da8adc00000000, + 0x97e3a2cf00000000, 0x460b45c100000000, 0xf9d7cd9e00000000, + 0x283f2a9000000000, 0x5b06028300000000, 0x8aeee58d00000000, + 0xbd7452a500000000, 0x6c9cb5ab00000000, 0x1fa59db800000000, + 0xce4d7ab600000000, 0xc238180f00000000, 0x13d0ff0100000000, + 0x60e9d71200000000, 0xb101301c00000000, 0x869b873400000000, + 0x5773603a00000000, 0x244a482900000000, 0xf5a2af2700000000, + 0x4a7e277800000000, 0x9b96c07600000000, 0xe8afe86500000000, + 0x39470f6b00000000, 0x0eddb84300000000, 0xdf355f4d00000000, + 0xac0c775e00000000, 0x7de4905000000000, 0xd2b566e100000000, + 0x035d81ef00000000, 0x7064a9fc00000000, 0xa18c4ef200000000, + 0x9616f9da00000000, 0x47fe1ed400000000, 0x34c736c700000000, + 0xe52fd1c900000000, 0x5af3599600000000, 0x8b1bbe9800000000, + 0xf822968b00000000, 0x29ca718500000000, 0x1e50c6ad00000000, + 0xcfb821a300000000, 0xbc8109b000000000, 0x6d69eebe00000000, + 0xa324940800000000, 0x72cc730600000000, 0x01f55b1500000000, + 0xd01dbc1b00000000, 0xe7870b3300000000, 0x366fec3d00000000, + 0x4556c42e00000000, 0x94be232000000000, 0x2b62ab7f00000000, + 0xfa8a4c7100000000, 0x89b3646200000000, 0x585b836c00000000, + 0x6fc1344400000000, 0xbe29d34a00000000, 0xcd10fb5900000000, + 0x1cf81c5700000000, 0xb3a9eae600000000, 0x62410de800000000, + 0x117825fb00000000, 0xc090c2f500000000, 0xf70a75dd00000000, + 0x26e292d300000000, 0x55dbbac000000000, 0x84335dce00000000, + 0x3befd59100000000, 0xea07329f00000000, 0x993e1a8c00000000, + 0x48d6fd8200000000, 0x7f4c4aaa00000000, 0xaea4ada400000000, + 0xdd9d85b700000000, 0x0c7562b900000000, 0x8471301e00000000, + 0x5599d71000000000, 0x26a0ff0300000000, 0xf748180d00000000, + 0xc0d2af2500000000, 0x113a482b00000000, 0x6203603800000000, + 0xb3eb873600000000, 0x0c370f6900000000, 0xdddfe86700000000, + 0xaee6c07400000000, 0x7f0e277a00000000, 0x4894905200000000, + 0x997c775c00000000, 0xea455f4f00000000, 0x3badb84100000000, + 0x94fc4ef000000000, 0x4514a9fe00000000, 0x362d81ed00000000, + 0xe7c566e300000000, 0xd05fd1cb00000000, 0x01b736c500000000, + 0x728e1ed600000000, 0xa366f9d800000000, 0x1cba718700000000, + 0xcd52968900000000, 0xbe6bbe9a00000000, 0x6f83599400000000, + 0x5819eebc00000000, 0x89f109b200000000, 0xfac821a100000000, + 0x2b20c6af00000000, 0xe56dbc1900000000, 0x34855b1700000000, + 0x47bc730400000000, 0x9654940a00000000, 0xa1ce232200000000, + 0x7026c42c00000000, 0x031fec3f00000000, 0xd2f70b3100000000, + 0x6d2b836e00000000, 0xbcc3646000000000, 0xcffa4c7300000000, + 0x1e12ab7d00000000, 0x29881c5500000000, 0xf860fb5b00000000, + 0x8b59d34800000000, 0x5ab1344600000000, 0xf5e0c2f700000000, + 0x240825f900000000, 0x57310dea00000000, 0x86d9eae400000000, + 0xb1435dcc00000000, 0x60abbac200000000, 0x139292d100000000, + 0xc27a75df00000000, 0x7da6fd8000000000, 0xac4e1a8e00000000, + 0xdf77329d00000000, 0x0e9fd59300000000, 0x390562bb00000000, + 0xe8ed85b500000000, 0x9bd4ada600000000, 0x4a3c4aa800000000, + 0x4649281100000000, 0x97a1cf1f00000000, 0xe498e70c00000000, + 0x3570000200000000, 0x02eab72a00000000, 0xd302502400000000, + 0xa03b783700000000, 0x71d39f3900000000, 0xce0f176600000000, + 0x1fe7f06800000000, 0x6cded87b00000000, 0xbd363f7500000000, + 0x8aac885d00000000, 0x5b446f5300000000, 0x287d474000000000, + 0xf995a04e00000000, 0x56c456ff00000000, 0x872cb1f100000000, + 0xf41599e200000000, 0x25fd7eec00000000, 0x1267c9c400000000, + 0xc38f2eca00000000, 0xb0b606d900000000, 0x615ee1d700000000, + 0xde82698800000000, 0x0f6a8e8600000000, 0x7c53a69500000000, + 0xadbb419b00000000, 0x9a21f6b300000000, 0x4bc911bd00000000, + 0x38f039ae00000000, 0xe918dea000000000, 0x2755a41600000000, + 0xf6bd431800000000, 0x85846b0b00000000, 0x546c8c0500000000, + 0x63f63b2d00000000, 0xb21edc2300000000, 0xc127f43000000000, + 0x10cf133e00000000, 0xaf139b6100000000, 0x7efb7c6f00000000, + 0x0dc2547c00000000, 0xdc2ab37200000000, 0xebb0045a00000000, + 0x3a58e35400000000, 0x4961cb4700000000, 0x98892c4900000000, + 0x37d8daf800000000, 0xe6303df600000000, 0x950915e500000000, + 0x44e1f2eb00000000, 0x737b45c300000000, 0xa293a2cd00000000, + 0xd1aa8ade00000000, 0x00426dd000000000, 0xbf9ee58f00000000, + 0x6e76028100000000, 0x1d4f2a9200000000, 0xcca7cd9c00000000, + 0xfb3d7ab400000000, 0x2ad59dba00000000, 0x59ecb5a900000000, + 0x880452a700000000}, + {0x0000000000000000, 0xaa05daf100000000, 0x150dc53800000000, + 0xbf081fc900000000, 0x2a1a8a7100000000, 0x801f508000000000, + 0x3f174f4900000000, 0x951295b800000000, 0x543414e300000000, + 0xfe31ce1200000000, 0x4139d1db00000000, 0xeb3c0b2a00000000, + 0x7e2e9e9200000000, 0xd42b446300000000, 0x6b235baa00000000, + 0xc126815b00000000, 0xe96e591d00000000, 0x436b83ec00000000, + 0xfc639c2500000000, 0x566646d400000000, 0xc374d36c00000000, + 0x6971099d00000000, 0xd679165400000000, 0x7c7ccca500000000, + 0xbd5a4dfe00000000, 0x175f970f00000000, 0xa85788c600000000, + 0x0252523700000000, 0x9740c78f00000000, 0x3d451d7e00000000, + 0x824d02b700000000, 0x2848d84600000000, 0xd2ddb23a00000000, + 0x78d868cb00000000, 0xc7d0770200000000, 0x6dd5adf300000000, + 0xf8c7384b00000000, 0x52c2e2ba00000000, 0xedcafd7300000000, + 0x47cf278200000000, 0x86e9a6d900000000, 0x2cec7c2800000000, + 0x93e463e100000000, 0x39e1b91000000000, 0xacf32ca800000000, + 0x06f6f65900000000, 0xb9fee99000000000, 0x13fb336100000000, + 0x3bb3eb2700000000, 0x91b631d600000000, 0x2ebe2e1f00000000, + 0x84bbf4ee00000000, 0x11a9615600000000, 0xbbacbba700000000, + 0x04a4a46e00000000, 0xaea17e9f00000000, 0x6f87ffc400000000, + 0xc582253500000000, 0x7a8a3afc00000000, 0xd08fe00d00000000, + 0x459d75b500000000, 0xef98af4400000000, 0x5090b08d00000000, + 0xfa956a7c00000000, 0xa4bb657500000000, 0x0ebebf8400000000, + 0xb1b6a04d00000000, 0x1bb37abc00000000, 0x8ea1ef0400000000, + 0x24a435f500000000, 0x9bac2a3c00000000, 0x31a9f0cd00000000, + 0xf08f719600000000, 0x5a8aab6700000000, 0xe582b4ae00000000, + 0x4f876e5f00000000, 0xda95fbe700000000, 0x7090211600000000, + 0xcf983edf00000000, 0x659de42e00000000, 0x4dd53c6800000000, + 0xe7d0e69900000000, 0x58d8f95000000000, 0xf2dd23a100000000, + 0x67cfb61900000000, 0xcdca6ce800000000, 0x72c2732100000000, + 0xd8c7a9d000000000, 0x19e1288b00000000, 0xb3e4f27a00000000, + 0x0cecedb300000000, 0xa6e9374200000000, 0x33fba2fa00000000, + 0x99fe780b00000000, 0x26f667c200000000, 0x8cf3bd3300000000, + 0x7666d74f00000000, 0xdc630dbe00000000, 0x636b127700000000, + 0xc96ec88600000000, 0x5c7c5d3e00000000, 0xf67987cf00000000, + 0x4971980600000000, 0xe37442f700000000, 0x2252c3ac00000000, + 0x8857195d00000000, 0x375f069400000000, 0x9d5adc6500000000, + 0x084849dd00000000, 0xa24d932c00000000, 0x1d458ce500000000, + 0xb740561400000000, 0x9f088e5200000000, 0x350d54a300000000, + 0x8a054b6a00000000, 0x2000919b00000000, 0xb512042300000000, + 0x1f17ded200000000, 0xa01fc11b00000000, 0x0a1a1bea00000000, + 0xcb3c9ab100000000, 0x6139404000000000, 0xde315f8900000000, + 0x7434857800000000, 0xe12610c000000000, 0x4b23ca3100000000, + 0xf42bd5f800000000, 0x5e2e0f0900000000, 0x4877cbea00000000, + 0xe272111b00000000, 0x5d7a0ed200000000, 0xf77fd42300000000, + 0x626d419b00000000, 0xc8689b6a00000000, 0x776084a300000000, + 0xdd655e5200000000, 0x1c43df0900000000, 0xb64605f800000000, + 0x094e1a3100000000, 0xa34bc0c000000000, 0x3659557800000000, + 0x9c5c8f8900000000, 0x2354904000000000, 0x89514ab100000000, + 0xa11992f700000000, 0x0b1c480600000000, 0xb41457cf00000000, + 0x1e118d3e00000000, 0x8b03188600000000, 0x2106c27700000000, + 0x9e0eddbe00000000, 0x340b074f00000000, 0xf52d861400000000, + 0x5f285ce500000000, 0xe020432c00000000, 0x4a2599dd00000000, + 0xdf370c6500000000, 0x7532d69400000000, 0xca3ac95d00000000, + 0x603f13ac00000000, 0x9aaa79d000000000, 0x30afa32100000000, + 0x8fa7bce800000000, 0x25a2661900000000, 0xb0b0f3a100000000, + 0x1ab5295000000000, 0xa5bd369900000000, 0x0fb8ec6800000000, + 0xce9e6d3300000000, 0x649bb7c200000000, 0xdb93a80b00000000, + 0x719672fa00000000, 0xe484e74200000000, 0x4e813db300000000, + 0xf189227a00000000, 0x5b8cf88b00000000, 0x73c420cd00000000, + 0xd9c1fa3c00000000, 0x66c9e5f500000000, 0xcccc3f0400000000, + 0x59deaabc00000000, 0xf3db704d00000000, 0x4cd36f8400000000, + 0xe6d6b57500000000, 0x27f0342e00000000, 0x8df5eedf00000000, + 0x32fdf11600000000, 0x98f82be700000000, 0x0deabe5f00000000, + 0xa7ef64ae00000000, 0x18e77b6700000000, 0xb2e2a19600000000, + 0xecccae9f00000000, 0x46c9746e00000000, 0xf9c16ba700000000, + 0x53c4b15600000000, 0xc6d624ee00000000, 0x6cd3fe1f00000000, + 0xd3dbe1d600000000, 0x79de3b2700000000, 0xb8f8ba7c00000000, + 0x12fd608d00000000, 0xadf57f4400000000, 0x07f0a5b500000000, + 0x92e2300d00000000, 0x38e7eafc00000000, 0x87eff53500000000, + 0x2dea2fc400000000, 0x05a2f78200000000, 0xafa72d7300000000, + 0x10af32ba00000000, 0xbaaae84b00000000, 0x2fb87df300000000, + 0x85bda70200000000, 0x3ab5b8cb00000000, 0x90b0623a00000000, + 0x5196e36100000000, 0xfb93399000000000, 0x449b265900000000, + 0xee9efca800000000, 0x7b8c691000000000, 0xd189b3e100000000, + 0x6e81ac2800000000, 0xc48476d900000000, 0x3e111ca500000000, + 0x9414c65400000000, 0x2b1cd99d00000000, 0x8119036c00000000, + 0x140b96d400000000, 0xbe0e4c2500000000, 0x010653ec00000000, + 0xab03891d00000000, 0x6a25084600000000, 0xc020d2b700000000, + 0x7f28cd7e00000000, 0xd52d178f00000000, 0x403f823700000000, + 0xea3a58c600000000, 0x5532470f00000000, 0xff379dfe00000000, + 0xd77f45b800000000, 0x7d7a9f4900000000, 0xc272808000000000, + 0x68775a7100000000, 0xfd65cfc900000000, 0x5760153800000000, + 0xe8680af100000000, 0x426dd00000000000, 0x834b515b00000000, + 0x294e8baa00000000, 0x9646946300000000, 0x3c434e9200000000, + 0xa951db2a00000000, 0x035401db00000000, 0xbc5c1e1200000000, + 0x1659c4e300000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xae689191, 0x87a02563, 0x29c8b4f2, 0xd4314c87, + 0x7a59dd16, 0x539169e4, 0xfdf9f875, 0x73139f4f, 0xdd7b0ede, + 0xf4b3ba2c, 0x5adb2bbd, 0xa722d3c8, 0x094a4259, 0x2082f6ab, + 0x8eea673a, 0xe6273e9e, 0x484faf0f, 0x61871bfd, 0xcfef8a6c, + 0x32167219, 0x9c7ee388, 0xb5b6577a, 0x1bdec6eb, 0x9534a1d1, + 0x3b5c3040, 0x129484b2, 0xbcfc1523, 0x4105ed56, 0xef6d7cc7, + 0xc6a5c835, 0x68cd59a4, 0x173f7b7d, 0xb957eaec, 0x909f5e1e, + 0x3ef7cf8f, 0xc30e37fa, 0x6d66a66b, 0x44ae1299, 0xeac68308, + 0x642ce432, 0xca4475a3, 0xe38cc151, 0x4de450c0, 0xb01da8b5, + 0x1e753924, 0x37bd8dd6, 0x99d51c47, 0xf11845e3, 0x5f70d472, + 0x76b86080, 0xd8d0f111, 0x25290964, 0x8b4198f5, 0xa2892c07, + 0x0ce1bd96, 0x820bdaac, 0x2c634b3d, 0x05abffcf, 0xabc36e5e, + 0x563a962b, 0xf85207ba, 0xd19ab348, 0x7ff222d9, 0x2e7ef6fa, + 0x8016676b, 0xa9ded399, 0x07b64208, 0xfa4fba7d, 0x54272bec, + 0x7def9f1e, 0xd3870e8f, 0x5d6d69b5, 0xf305f824, 0xdacd4cd6, + 0x74a5dd47, 0x895c2532, 0x2734b4a3, 0x0efc0051, 0xa09491c0, + 0xc859c864, 0x663159f5, 0x4ff9ed07, 0xe1917c96, 0x1c6884e3, + 0xb2001572, 0x9bc8a180, 0x35a03011, 0xbb4a572b, 0x1522c6ba, + 0x3cea7248, 0x9282e3d9, 0x6f7b1bac, 0xc1138a3d, 0xe8db3ecf, + 0x46b3af5e, 0x39418d87, 0x97291c16, 0xbee1a8e4, 0x10893975, + 0xed70c100, 0x43185091, 0x6ad0e463, 0xc4b875f2, 0x4a5212c8, + 0xe43a8359, 0xcdf237ab, 0x639aa63a, 0x9e635e4f, 0x300bcfde, + 0x19c37b2c, 0xb7abeabd, 0xdf66b319, 0x710e2288, 0x58c6967a, + 0xf6ae07eb, 0x0b57ff9e, 0xa53f6e0f, 0x8cf7dafd, 0x229f4b6c, + 0xac752c56, 0x021dbdc7, 0x2bd50935, 0x85bd98a4, 0x784460d1, + 0xd62cf140, 0xffe445b2, 0x518cd423, 0x5cfdedf4, 0xf2957c65, + 0xdb5dc897, 0x75355906, 0x88cca173, 0x26a430e2, 0x0f6c8410, + 0xa1041581, 0x2fee72bb, 0x8186e32a, 0xa84e57d8, 0x0626c649, + 0xfbdf3e3c, 0x55b7afad, 0x7c7f1b5f, 0xd2178ace, 0xbadad36a, + 0x14b242fb, 0x3d7af609, 0x93126798, 0x6eeb9fed, 0xc0830e7c, + 0xe94bba8e, 0x47232b1f, 0xc9c94c25, 0x67a1ddb4, 0x4e696946, + 0xe001f8d7, 0x1df800a2, 0xb3909133, 0x9a5825c1, 0x3430b450, + 0x4bc29689, 0xe5aa0718, 0xcc62b3ea, 0x620a227b, 0x9ff3da0e, + 0x319b4b9f, 0x1853ff6d, 0xb63b6efc, 0x38d109c6, 0x96b99857, + 0xbf712ca5, 0x1119bd34, 0xece04541, 0x4288d4d0, 0x6b406022, + 0xc528f1b3, 0xade5a817, 0x038d3986, 0x2a458d74, 0x842d1ce5, + 0x79d4e490, 0xd7bc7501, 0xfe74c1f3, 0x501c5062, 0xdef63758, + 0x709ea6c9, 0x5956123b, 0xf73e83aa, 0x0ac77bdf, 0xa4afea4e, + 0x8d675ebc, 0x230fcf2d, 0x72831b0e, 0xdceb8a9f, 0xf5233e6d, + 0x5b4baffc, 0xa6b25789, 0x08dac618, 0x211272ea, 0x8f7ae37b, + 0x01908441, 0xaff815d0, 0x8630a122, 0x285830b3, 0xd5a1c8c6, + 0x7bc95957, 0x5201eda5, 0xfc697c34, 0x94a42590, 0x3accb401, + 0x130400f3, 0xbd6c9162, 0x40956917, 0xeefdf886, 0xc7354c74, + 0x695ddde5, 0xe7b7badf, 0x49df2b4e, 0x60179fbc, 0xce7f0e2d, + 0x3386f658, 0x9dee67c9, 0xb426d33b, 0x1a4e42aa, 0x65bc6073, + 0xcbd4f1e2, 0xe21c4510, 0x4c74d481, 0xb18d2cf4, 0x1fe5bd65, + 0x362d0997, 0x98459806, 0x16afff3c, 0xb8c76ead, 0x910fda5f, + 0x3f674bce, 0xc29eb3bb, 0x6cf6222a, 0x453e96d8, 0xeb560749, + 0x839b5eed, 0x2df3cf7c, 0x043b7b8e, 0xaa53ea1f, 0x57aa126a, + 0xf9c283fb, 0xd00a3709, 0x7e62a698, 0xf088c1a2, 0x5ee05033, + 0x7728e4c1, 0xd9407550, 0x24b98d25, 0x8ad11cb4, 0xa319a846, + 0x0d7139d7}, + {0x00000000, 0xb9fbdbe8, 0xa886b191, 0x117d6a79, 0x8a7c6563, + 0x3387be8b, 0x22fad4f2, 0x9b010f1a, 0xcf89cc87, 0x7672176f, + 0x670f7d16, 0xdef4a6fe, 0x45f5a9e4, 0xfc0e720c, 0xed731875, + 0x5488c39d, 0x44629f4f, 0xfd9944a7, 0xece42ede, 0x551ff536, + 0xce1efa2c, 0x77e521c4, 0x66984bbd, 0xdf639055, 0x8beb53c8, + 0x32108820, 0x236de259, 0x9a9639b1, 0x019736ab, 0xb86ced43, + 0xa911873a, 0x10ea5cd2, 0x88c53e9e, 0x313ee576, 0x20438f0f, + 0x99b854e7, 0x02b95bfd, 0xbb428015, 0xaa3fea6c, 0x13c43184, + 0x474cf219, 0xfeb729f1, 0xefca4388, 0x56319860, 0xcd30977a, + 0x74cb4c92, 0x65b626eb, 0xdc4dfd03, 0xcca7a1d1, 0x755c7a39, + 0x64211040, 0xdddacba8, 0x46dbc4b2, 0xff201f5a, 0xee5d7523, + 0x57a6aecb, 0x032e6d56, 0xbad5b6be, 0xaba8dcc7, 0x1253072f, + 0x89520835, 0x30a9d3dd, 0x21d4b9a4, 0x982f624c, 0xcafb7b7d, + 0x7300a095, 0x627dcaec, 0xdb861104, 0x40871e1e, 0xf97cc5f6, + 0xe801af8f, 0x51fa7467, 0x0572b7fa, 0xbc896c12, 0xadf4066b, + 0x140fdd83, 0x8f0ed299, 0x36f50971, 0x27886308, 0x9e73b8e0, + 0x8e99e432, 0x37623fda, 0x261f55a3, 0x9fe48e4b, 0x04e58151, + 0xbd1e5ab9, 0xac6330c0, 0x1598eb28, 0x411028b5, 0xf8ebf35d, + 0xe9969924, 0x506d42cc, 0xcb6c4dd6, 0x7297963e, 0x63eafc47, + 0xda1127af, 0x423e45e3, 0xfbc59e0b, 0xeab8f472, 0x53432f9a, + 0xc8422080, 0x71b9fb68, 0x60c49111, 0xd93f4af9, 0x8db78964, + 0x344c528c, 0x253138f5, 0x9ccae31d, 0x07cbec07, 0xbe3037ef, + 0xaf4d5d96, 0x16b6867e, 0x065cdaac, 0xbfa70144, 0xaeda6b3d, + 0x1721b0d5, 0x8c20bfcf, 0x35db6427, 0x24a60e5e, 0x9d5dd5b6, + 0xc9d5162b, 0x702ecdc3, 0x6153a7ba, 0xd8a87c52, 0x43a97348, + 0xfa52a8a0, 0xeb2fc2d9, 0x52d41931, 0x4e87f0bb, 0xf77c2b53, + 0xe601412a, 0x5ffa9ac2, 0xc4fb95d8, 0x7d004e30, 0x6c7d2449, + 0xd586ffa1, 0x810e3c3c, 0x38f5e7d4, 0x29888dad, 0x90735645, + 0x0b72595f, 0xb28982b7, 0xa3f4e8ce, 0x1a0f3326, 0x0ae56ff4, + 0xb31eb41c, 0xa263de65, 0x1b98058d, 0x80990a97, 0x3962d17f, + 0x281fbb06, 0x91e460ee, 0xc56ca373, 0x7c97789b, 0x6dea12e2, + 0xd411c90a, 0x4f10c610, 0xf6eb1df8, 0xe7967781, 0x5e6dac69, + 0xc642ce25, 0x7fb915cd, 0x6ec47fb4, 0xd73fa45c, 0x4c3eab46, + 0xf5c570ae, 0xe4b81ad7, 0x5d43c13f, 0x09cb02a2, 0xb030d94a, + 0xa14db333, 0x18b668db, 0x83b767c1, 0x3a4cbc29, 0x2b31d650, + 0x92ca0db8, 0x8220516a, 0x3bdb8a82, 0x2aa6e0fb, 0x935d3b13, + 0x085c3409, 0xb1a7efe1, 0xa0da8598, 0x19215e70, 0x4da99ded, + 0xf4524605, 0xe52f2c7c, 0x5cd4f794, 0xc7d5f88e, 0x7e2e2366, + 0x6f53491f, 0xd6a892f7, 0x847c8bc6, 0x3d87502e, 0x2cfa3a57, + 0x9501e1bf, 0x0e00eea5, 0xb7fb354d, 0xa6865f34, 0x1f7d84dc, + 0x4bf54741, 0xf20e9ca9, 0xe373f6d0, 0x5a882d38, 0xc1892222, + 0x7872f9ca, 0x690f93b3, 0xd0f4485b, 0xc01e1489, 0x79e5cf61, + 0x6898a518, 0xd1637ef0, 0x4a6271ea, 0xf399aa02, 0xe2e4c07b, + 0x5b1f1b93, 0x0f97d80e, 0xb66c03e6, 0xa711699f, 0x1eeab277, + 0x85ebbd6d, 0x3c106685, 0x2d6d0cfc, 0x9496d714, 0x0cb9b558, + 0xb5426eb0, 0xa43f04c9, 0x1dc4df21, 0x86c5d03b, 0x3f3e0bd3, + 0x2e4361aa, 0x97b8ba42, 0xc33079df, 0x7acba237, 0x6bb6c84e, + 0xd24d13a6, 0x494c1cbc, 0xf0b7c754, 0xe1caad2d, 0x583176c5, + 0x48db2a17, 0xf120f1ff, 0xe05d9b86, 0x59a6406e, 0xc2a74f74, + 0x7b5c949c, 0x6a21fee5, 0xd3da250d, 0x8752e690, 0x3ea93d78, + 0x2fd45701, 0x962f8ce9, 0x0d2e83f3, 0xb4d5581b, 0xa5a83262, + 0x1c53e98a}, + {0x00000000, 0x9d0fe176, 0xe16ec4ad, 0x7c6125db, 0x19ac8f1b, + 0x84a36e6d, 0xf8c24bb6, 0x65cdaac0, 0x33591e36, 0xae56ff40, + 0xd237da9b, 0x4f383bed, 0x2af5912d, 0xb7fa705b, 0xcb9b5580, + 0x5694b4f6, 0x66b23c6c, 0xfbbddd1a, 0x87dcf8c1, 0x1ad319b7, + 0x7f1eb377, 0xe2115201, 0x9e7077da, 0x037f96ac, 0x55eb225a, + 0xc8e4c32c, 0xb485e6f7, 0x298a0781, 0x4c47ad41, 0xd1484c37, + 0xad2969ec, 0x3026889a, 0xcd6478d8, 0x506b99ae, 0x2c0abc75, + 0xb1055d03, 0xd4c8f7c3, 0x49c716b5, 0x35a6336e, 0xa8a9d218, + 0xfe3d66ee, 0x63328798, 0x1f53a243, 0x825c4335, 0xe791e9f5, + 0x7a9e0883, 0x06ff2d58, 0x9bf0cc2e, 0xabd644b4, 0x36d9a5c2, + 0x4ab88019, 0xd7b7616f, 0xb27acbaf, 0x2f752ad9, 0x53140f02, + 0xce1bee74, 0x988f5a82, 0x0580bbf4, 0x79e19e2f, 0xe4ee7f59, + 0x8123d599, 0x1c2c34ef, 0x604d1134, 0xfd42f042, 0x41b9f7f1, + 0xdcb61687, 0xa0d7335c, 0x3dd8d22a, 0x581578ea, 0xc51a999c, + 0xb97bbc47, 0x24745d31, 0x72e0e9c7, 0xefef08b1, 0x938e2d6a, + 0x0e81cc1c, 0x6b4c66dc, 0xf64387aa, 0x8a22a271, 0x172d4307, + 0x270bcb9d, 0xba042aeb, 0xc6650f30, 0x5b6aee46, 0x3ea74486, + 0xa3a8a5f0, 0xdfc9802b, 0x42c6615d, 0x1452d5ab, 0x895d34dd, + 0xf53c1106, 0x6833f070, 0x0dfe5ab0, 0x90f1bbc6, 0xec909e1d, + 0x719f7f6b, 0x8cdd8f29, 0x11d26e5f, 0x6db34b84, 0xf0bcaaf2, + 0x95710032, 0x087ee144, 0x741fc49f, 0xe91025e9, 0xbf84911f, + 0x228b7069, 0x5eea55b2, 0xc3e5b4c4, 0xa6281e04, 0x3b27ff72, + 0x4746daa9, 0xda493bdf, 0xea6fb345, 0x77605233, 0x0b0177e8, + 0x960e969e, 0xf3c33c5e, 0x6eccdd28, 0x12adf8f3, 0x8fa21985, + 0xd936ad73, 0x44394c05, 0x385869de, 0xa55788a8, 0xc09a2268, + 0x5d95c31e, 0x21f4e6c5, 0xbcfb07b3, 0x8373efe2, 0x1e7c0e94, + 0x621d2b4f, 0xff12ca39, 0x9adf60f9, 0x07d0818f, 0x7bb1a454, + 0xe6be4522, 0xb02af1d4, 0x2d2510a2, 0x51443579, 0xcc4bd40f, + 0xa9867ecf, 0x34899fb9, 0x48e8ba62, 0xd5e75b14, 0xe5c1d38e, + 0x78ce32f8, 0x04af1723, 0x99a0f655, 0xfc6d5c95, 0x6162bde3, + 0x1d039838, 0x800c794e, 0xd698cdb8, 0x4b972cce, 0x37f60915, + 0xaaf9e863, 0xcf3442a3, 0x523ba3d5, 0x2e5a860e, 0xb3556778, + 0x4e17973a, 0xd318764c, 0xaf795397, 0x3276b2e1, 0x57bb1821, + 0xcab4f957, 0xb6d5dc8c, 0x2bda3dfa, 0x7d4e890c, 0xe041687a, + 0x9c204da1, 0x012facd7, 0x64e20617, 0xf9ede761, 0x858cc2ba, + 0x188323cc, 0x28a5ab56, 0xb5aa4a20, 0xc9cb6ffb, 0x54c48e8d, + 0x3109244d, 0xac06c53b, 0xd067e0e0, 0x4d680196, 0x1bfcb560, + 0x86f35416, 0xfa9271cd, 0x679d90bb, 0x02503a7b, 0x9f5fdb0d, + 0xe33efed6, 0x7e311fa0, 0xc2ca1813, 0x5fc5f965, 0x23a4dcbe, + 0xbeab3dc8, 0xdb669708, 0x4669767e, 0x3a0853a5, 0xa707b2d3, + 0xf1930625, 0x6c9ce753, 0x10fdc288, 0x8df223fe, 0xe83f893e, + 0x75306848, 0x09514d93, 0x945eace5, 0xa478247f, 0x3977c509, + 0x4516e0d2, 0xd81901a4, 0xbdd4ab64, 0x20db4a12, 0x5cba6fc9, + 0xc1b58ebf, 0x97213a49, 0x0a2edb3f, 0x764ffee4, 0xeb401f92, + 0x8e8db552, 0x13825424, 0x6fe371ff, 0xf2ec9089, 0x0fae60cb, + 0x92a181bd, 0xeec0a466, 0x73cf4510, 0x1602efd0, 0x8b0d0ea6, + 0xf76c2b7d, 0x6a63ca0b, 0x3cf77efd, 0xa1f89f8b, 0xdd99ba50, + 0x40965b26, 0x255bf1e6, 0xb8541090, 0xc435354b, 0x593ad43d, + 0x691c5ca7, 0xf413bdd1, 0x8872980a, 0x157d797c, 0x70b0d3bc, + 0xedbf32ca, 0x91de1711, 0x0cd1f667, 0x5a454291, 0xc74aa3e7, + 0xbb2b863c, 0x2624674a, 0x43e9cd8a, 0xdee62cfc, 0xa2870927, + 0x3f88e851}, + {0x00000000, 0xdd96d985, 0x605cb54b, 0xbdca6cce, 0xc0b96a96, + 0x1d2fb313, 0xa0e5dfdd, 0x7d730658, 0x5a03d36d, 0x87950ae8, + 0x3a5f6626, 0xe7c9bfa3, 0x9abab9fb, 0x472c607e, 0xfae60cb0, + 0x2770d535, 0xb407a6da, 0x69917f5f, 0xd45b1391, 0x09cdca14, + 0x74becc4c, 0xa92815c9, 0x14e27907, 0xc974a082, 0xee0475b7, + 0x3392ac32, 0x8e58c0fc, 0x53ce1979, 0x2ebd1f21, 0xf32bc6a4, + 0x4ee1aa6a, 0x937773ef, 0xb37e4bf5, 0x6ee89270, 0xd322febe, + 0x0eb4273b, 0x73c72163, 0xae51f8e6, 0x139b9428, 0xce0d4dad, + 0xe97d9898, 0x34eb411d, 0x89212dd3, 0x54b7f456, 0x29c4f20e, + 0xf4522b8b, 0x49984745, 0x940e9ec0, 0x0779ed2f, 0xdaef34aa, + 0x67255864, 0xbab381e1, 0xc7c087b9, 0x1a565e3c, 0xa79c32f2, + 0x7a0aeb77, 0x5d7a3e42, 0x80ece7c7, 0x3d268b09, 0xe0b0528c, + 0x9dc354d4, 0x40558d51, 0xfd9fe19f, 0x2009381a, 0xbd8d91ab, + 0x601b482e, 0xddd124e0, 0x0047fd65, 0x7d34fb3d, 0xa0a222b8, + 0x1d684e76, 0xc0fe97f3, 0xe78e42c6, 0x3a189b43, 0x87d2f78d, + 0x5a442e08, 0x27372850, 0xfaa1f1d5, 0x476b9d1b, 0x9afd449e, + 0x098a3771, 0xd41ceef4, 0x69d6823a, 0xb4405bbf, 0xc9335de7, + 0x14a58462, 0xa96fe8ac, 0x74f93129, 0x5389e41c, 0x8e1f3d99, + 0x33d55157, 0xee4388d2, 0x93308e8a, 0x4ea6570f, 0xf36c3bc1, + 0x2efae244, 0x0ef3da5e, 0xd36503db, 0x6eaf6f15, 0xb339b690, + 0xce4ab0c8, 0x13dc694d, 0xae160583, 0x7380dc06, 0x54f00933, + 0x8966d0b6, 0x34acbc78, 0xe93a65fd, 0x944963a5, 0x49dfba20, + 0xf415d6ee, 0x29830f6b, 0xbaf47c84, 0x6762a501, 0xdaa8c9cf, + 0x073e104a, 0x7a4d1612, 0xa7dbcf97, 0x1a11a359, 0xc7877adc, + 0xe0f7afe9, 0x3d61766c, 0x80ab1aa2, 0x5d3dc327, 0x204ec57f, + 0xfdd81cfa, 0x40127034, 0x9d84a9b1, 0xa06a2517, 0x7dfcfc92, + 0xc036905c, 0x1da049d9, 0x60d34f81, 0xbd459604, 0x008ffaca, + 0xdd19234f, 0xfa69f67a, 0x27ff2fff, 0x9a354331, 0x47a39ab4, + 0x3ad09cec, 0xe7464569, 0x5a8c29a7, 0x871af022, 0x146d83cd, + 0xc9fb5a48, 0x74313686, 0xa9a7ef03, 0xd4d4e95b, 0x094230de, + 0xb4885c10, 0x691e8595, 0x4e6e50a0, 0x93f88925, 0x2e32e5eb, + 0xf3a43c6e, 0x8ed73a36, 0x5341e3b3, 0xee8b8f7d, 0x331d56f8, + 0x13146ee2, 0xce82b767, 0x7348dba9, 0xaede022c, 0xd3ad0474, + 0x0e3bddf1, 0xb3f1b13f, 0x6e6768ba, 0x4917bd8f, 0x9481640a, + 0x294b08c4, 0xf4ddd141, 0x89aed719, 0x54380e9c, 0xe9f26252, + 0x3464bbd7, 0xa713c838, 0x7a8511bd, 0xc74f7d73, 0x1ad9a4f6, + 0x67aaa2ae, 0xba3c7b2b, 0x07f617e5, 0xda60ce60, 0xfd101b55, + 0x2086c2d0, 0x9d4cae1e, 0x40da779b, 0x3da971c3, 0xe03fa846, + 0x5df5c488, 0x80631d0d, 0x1de7b4bc, 0xc0716d39, 0x7dbb01f7, + 0xa02dd872, 0xdd5ede2a, 0x00c807af, 0xbd026b61, 0x6094b2e4, + 0x47e467d1, 0x9a72be54, 0x27b8d29a, 0xfa2e0b1f, 0x875d0d47, + 0x5acbd4c2, 0xe701b80c, 0x3a976189, 0xa9e01266, 0x7476cbe3, + 0xc9bca72d, 0x142a7ea8, 0x695978f0, 0xb4cfa175, 0x0905cdbb, + 0xd493143e, 0xf3e3c10b, 0x2e75188e, 0x93bf7440, 0x4e29adc5, + 0x335aab9d, 0xeecc7218, 0x53061ed6, 0x8e90c753, 0xae99ff49, + 0x730f26cc, 0xcec54a02, 0x13539387, 0x6e2095df, 0xb3b64c5a, + 0x0e7c2094, 0xd3eaf911, 0xf49a2c24, 0x290cf5a1, 0x94c6996f, + 0x495040ea, 0x342346b2, 0xe9b59f37, 0x547ff3f9, 0x89e92a7c, + 0x1a9e5993, 0xc7088016, 0x7ac2ecd8, 0xa754355d, 0xda273305, + 0x07b1ea80, 0xba7b864e, 0x67ed5fcb, 0x409d8afe, 0x9d0b537b, + 0x20c13fb5, 0xfd57e630, 0x8024e068, 0x5db239ed, 0xe0785523, + 0x3dee8ca6}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x85d996dd, 0x4bb55c60, 0xce6ccabd, 0x966ab9c0, + 0x13b32f1d, 0xdddfe5a0, 0x5806737d, 0x6dd3035a, 0xe80a9587, + 0x26665f3a, 0xa3bfc9e7, 0xfbb9ba9a, 0x7e602c47, 0xb00ce6fa, + 0x35d57027, 0xdaa607b4, 0x5f7f9169, 0x91135bd4, 0x14cacd09, + 0x4cccbe74, 0xc91528a9, 0x0779e214, 0x82a074c9, 0xb77504ee, + 0x32ac9233, 0xfcc0588e, 0x7919ce53, 0x211fbd2e, 0xa4c62bf3, + 0x6aaae14e, 0xef737793, 0xf54b7eb3, 0x7092e86e, 0xbefe22d3, + 0x3b27b40e, 0x6321c773, 0xe6f851ae, 0x28949b13, 0xad4d0dce, + 0x98987de9, 0x1d41eb34, 0xd32d2189, 0x56f4b754, 0x0ef2c429, + 0x8b2b52f4, 0x45479849, 0xc09e0e94, 0x2fed7907, 0xaa34efda, + 0x64582567, 0xe181b3ba, 0xb987c0c7, 0x3c5e561a, 0xf2329ca7, + 0x77eb0a7a, 0x423e7a5d, 0xc7e7ec80, 0x098b263d, 0x8c52b0e0, + 0xd454c39d, 0x518d5540, 0x9fe19ffd, 0x1a380920, 0xab918dbd, + 0x2e481b60, 0xe024d1dd, 0x65fd4700, 0x3dfb347d, 0xb822a2a0, + 0x764e681d, 0xf397fec0, 0xc6428ee7, 0x439b183a, 0x8df7d287, + 0x082e445a, 0x50283727, 0xd5f1a1fa, 0x1b9d6b47, 0x9e44fd9a, + 0x71378a09, 0xf4ee1cd4, 0x3a82d669, 0xbf5b40b4, 0xe75d33c9, + 0x6284a514, 0xace86fa9, 0x2931f974, 0x1ce48953, 0x993d1f8e, + 0x5751d533, 0xd28843ee, 0x8a8e3093, 0x0f57a64e, 0xc13b6cf3, + 0x44e2fa2e, 0x5edaf30e, 0xdb0365d3, 0x156faf6e, 0x90b639b3, + 0xc8b04ace, 0x4d69dc13, 0x830516ae, 0x06dc8073, 0x3309f054, + 0xb6d06689, 0x78bcac34, 0xfd653ae9, 0xa5634994, 0x20badf49, + 0xeed615f4, 0x6b0f8329, 0x847cf4ba, 0x01a56267, 0xcfc9a8da, + 0x4a103e07, 0x12164d7a, 0x97cfdba7, 0x59a3111a, 0xdc7a87c7, + 0xe9aff7e0, 0x6c76613d, 0xa21aab80, 0x27c33d5d, 0x7fc54e20, + 0xfa1cd8fd, 0x34701240, 0xb1a9849d, 0x17256aa0, 0x92fcfc7d, + 0x5c9036c0, 0xd949a01d, 0x814fd360, 0x049645bd, 0xcafa8f00, + 0x4f2319dd, 0x7af669fa, 0xff2fff27, 0x3143359a, 0xb49aa347, + 0xec9cd03a, 0x694546e7, 0xa7298c5a, 0x22f01a87, 0xcd836d14, + 0x485afbc9, 0x86363174, 0x03efa7a9, 0x5be9d4d4, 0xde304209, + 0x105c88b4, 0x95851e69, 0xa0506e4e, 0x2589f893, 0xebe5322e, + 0x6e3ca4f3, 0x363ad78e, 0xb3e34153, 0x7d8f8bee, 0xf8561d33, + 0xe26e1413, 0x67b782ce, 0xa9db4873, 0x2c02deae, 0x7404add3, + 0xf1dd3b0e, 0x3fb1f1b3, 0xba68676e, 0x8fbd1749, 0x0a648194, + 0xc4084b29, 0x41d1ddf4, 0x19d7ae89, 0x9c0e3854, 0x5262f2e9, + 0xd7bb6434, 0x38c813a7, 0xbd11857a, 0x737d4fc7, 0xf6a4d91a, + 0xaea2aa67, 0x2b7b3cba, 0xe517f607, 0x60ce60da, 0x551b10fd, + 0xd0c28620, 0x1eae4c9d, 0x9b77da40, 0xc371a93d, 0x46a83fe0, + 0x88c4f55d, 0x0d1d6380, 0xbcb4e71d, 0x396d71c0, 0xf701bb7d, + 0x72d82da0, 0x2ade5edd, 0xaf07c800, 0x616b02bd, 0xe4b29460, + 0xd167e447, 0x54be729a, 0x9ad2b827, 0x1f0b2efa, 0x470d5d87, + 0xc2d4cb5a, 0x0cb801e7, 0x8961973a, 0x6612e0a9, 0xe3cb7674, + 0x2da7bcc9, 0xa87e2a14, 0xf0785969, 0x75a1cfb4, 0xbbcd0509, + 0x3e1493d4, 0x0bc1e3f3, 0x8e18752e, 0x4074bf93, 0xc5ad294e, + 0x9dab5a33, 0x1872ccee, 0xd61e0653, 0x53c7908e, 0x49ff99ae, + 0xcc260f73, 0x024ac5ce, 0x87935313, 0xdf95206e, 0x5a4cb6b3, + 0x94207c0e, 0x11f9ead3, 0x242c9af4, 0xa1f50c29, 0x6f99c694, + 0xea405049, 0xb2462334, 0x379fb5e9, 0xf9f37f54, 0x7c2ae989, + 0x93599e1a, 0x168008c7, 0xd8ecc27a, 0x5d3554a7, 0x053327da, + 0x80eab107, 0x4e867bba, 0xcb5fed67, 0xfe8a9d40, 0x7b530b9d, + 0xb53fc120, 0x30e657fd, 0x68e02480, 0xed39b25d, 0x235578e0, + 0xa68cee3d}, + {0x00000000, 0x76e10f9d, 0xadc46ee1, 0xdb25617c, 0x1b8fac19, + 0x6d6ea384, 0xb64bc2f8, 0xc0aacd65, 0x361e5933, 0x40ff56ae, + 0x9bda37d2, 0xed3b384f, 0x2d91f52a, 0x5b70fab7, 0x80559bcb, + 0xf6b49456, 0x6c3cb266, 0x1addbdfb, 0xc1f8dc87, 0xb719d31a, + 0x77b31e7f, 0x015211e2, 0xda77709e, 0xac967f03, 0x5a22eb55, + 0x2cc3e4c8, 0xf7e685b4, 0x81078a29, 0x41ad474c, 0x374c48d1, + 0xec6929ad, 0x9a882630, 0xd87864cd, 0xae996b50, 0x75bc0a2c, + 0x035d05b1, 0xc3f7c8d4, 0xb516c749, 0x6e33a635, 0x18d2a9a8, + 0xee663dfe, 0x98873263, 0x43a2531f, 0x35435c82, 0xf5e991e7, + 0x83089e7a, 0x582dff06, 0x2eccf09b, 0xb444d6ab, 0xc2a5d936, + 0x1980b84a, 0x6f61b7d7, 0xafcb7ab2, 0xd92a752f, 0x020f1453, + 0x74ee1bce, 0x825a8f98, 0xf4bb8005, 0x2f9ee179, 0x597feee4, + 0x99d52381, 0xef342c1c, 0x34114d60, 0x42f042fd, 0xf1f7b941, + 0x8716b6dc, 0x5c33d7a0, 0x2ad2d83d, 0xea781558, 0x9c991ac5, + 0x47bc7bb9, 0x315d7424, 0xc7e9e072, 0xb108efef, 0x6a2d8e93, + 0x1ccc810e, 0xdc664c6b, 0xaa8743f6, 0x71a2228a, 0x07432d17, + 0x9dcb0b27, 0xeb2a04ba, 0x300f65c6, 0x46ee6a5b, 0x8644a73e, + 0xf0a5a8a3, 0x2b80c9df, 0x5d61c642, 0xabd55214, 0xdd345d89, + 0x06113cf5, 0x70f03368, 0xb05afe0d, 0xc6bbf190, 0x1d9e90ec, + 0x6b7f9f71, 0x298fdd8c, 0x5f6ed211, 0x844bb36d, 0xf2aabcf0, + 0x32007195, 0x44e17e08, 0x9fc41f74, 0xe92510e9, 0x1f9184bf, + 0x69708b22, 0xb255ea5e, 0xc4b4e5c3, 0x041e28a6, 0x72ff273b, + 0xa9da4647, 0xdf3b49da, 0x45b36fea, 0x33526077, 0xe877010b, + 0x9e960e96, 0x5e3cc3f3, 0x28ddcc6e, 0xf3f8ad12, 0x8519a28f, + 0x73ad36d9, 0x054c3944, 0xde695838, 0xa88857a5, 0x68229ac0, + 0x1ec3955d, 0xc5e6f421, 0xb307fbbc, 0xe2ef7383, 0x940e7c1e, + 0x4f2b1d62, 0x39ca12ff, 0xf960df9a, 0x8f81d007, 0x54a4b17b, + 0x2245bee6, 0xd4f12ab0, 0xa210252d, 0x79354451, 0x0fd44bcc, + 0xcf7e86a9, 0xb99f8934, 0x62bae848, 0x145be7d5, 0x8ed3c1e5, + 0xf832ce78, 0x2317af04, 0x55f6a099, 0x955c6dfc, 0xe3bd6261, + 0x3898031d, 0x4e790c80, 0xb8cd98d6, 0xce2c974b, 0x1509f637, + 0x63e8f9aa, 0xa34234cf, 0xd5a33b52, 0x0e865a2e, 0x786755b3, + 0x3a97174e, 0x4c7618d3, 0x975379af, 0xe1b27632, 0x2118bb57, + 0x57f9b4ca, 0x8cdcd5b6, 0xfa3dda2b, 0x0c894e7d, 0x7a6841e0, + 0xa14d209c, 0xd7ac2f01, 0x1706e264, 0x61e7edf9, 0xbac28c85, + 0xcc238318, 0x56aba528, 0x204aaab5, 0xfb6fcbc9, 0x8d8ec454, + 0x4d240931, 0x3bc506ac, 0xe0e067d0, 0x9601684d, 0x60b5fc1b, + 0x1654f386, 0xcd7192fa, 0xbb909d67, 0x7b3a5002, 0x0ddb5f9f, + 0xd6fe3ee3, 0xa01f317e, 0x1318cac2, 0x65f9c55f, 0xbedca423, + 0xc83dabbe, 0x089766db, 0x7e766946, 0xa553083a, 0xd3b207a7, + 0x250693f1, 0x53e79c6c, 0x88c2fd10, 0xfe23f28d, 0x3e893fe8, + 0x48683075, 0x934d5109, 0xe5ac5e94, 0x7f2478a4, 0x09c57739, + 0xd2e01645, 0xa40119d8, 0x64abd4bd, 0x124adb20, 0xc96fba5c, + 0xbf8eb5c1, 0x493a2197, 0x3fdb2e0a, 0xe4fe4f76, 0x921f40eb, + 0x52b58d8e, 0x24548213, 0xff71e36f, 0x8990ecf2, 0xcb60ae0f, + 0xbd81a192, 0x66a4c0ee, 0x1045cf73, 0xd0ef0216, 0xa60e0d8b, + 0x7d2b6cf7, 0x0bca636a, 0xfd7ef73c, 0x8b9ff8a1, 0x50ba99dd, + 0x265b9640, 0xe6f15b25, 0x901054b8, 0x4b3535c4, 0x3dd43a59, + 0xa75c1c69, 0xd1bd13f4, 0x0a987288, 0x7c797d15, 0xbcd3b070, + 0xca32bfed, 0x1117de91, 0x67f6d10c, 0x9142455a, 0xe7a34ac7, + 0x3c862bbb, 0x4a672426, 0x8acde943, 0xfc2ce6de, 0x270987a2, + 0x51e8883f}, + {0x00000000, 0xe8dbfbb9, 0x91b186a8, 0x796a7d11, 0x63657c8a, + 0x8bbe8733, 0xf2d4fa22, 0x1a0f019b, 0x87cc89cf, 0x6f177276, + 0x167d0f67, 0xfea6f4de, 0xe4a9f545, 0x0c720efc, 0x751873ed, + 0x9dc38854, 0x4f9f6244, 0xa74499fd, 0xde2ee4ec, 0x36f51f55, + 0x2cfa1ece, 0xc421e577, 0xbd4b9866, 0x559063df, 0xc853eb8b, + 0x20881032, 0x59e26d23, 0xb139969a, 0xab369701, 0x43ed6cb8, + 0x3a8711a9, 0xd25cea10, 0x9e3ec588, 0x76e53e31, 0x0f8f4320, + 0xe754b899, 0xfd5bb902, 0x158042bb, 0x6cea3faa, 0x8431c413, + 0x19f24c47, 0xf129b7fe, 0x8843caef, 0x60983156, 0x7a9730cd, + 0x924ccb74, 0xeb26b665, 0x03fd4ddc, 0xd1a1a7cc, 0x397a5c75, + 0x40102164, 0xa8cbdadd, 0xb2c4db46, 0x5a1f20ff, 0x23755dee, + 0xcbaea657, 0x566d2e03, 0xbeb6d5ba, 0xc7dca8ab, 0x2f075312, + 0x35085289, 0xddd3a930, 0xa4b9d421, 0x4c622f98, 0x7d7bfbca, + 0x95a00073, 0xecca7d62, 0x041186db, 0x1e1e8740, 0xf6c57cf9, + 0x8faf01e8, 0x6774fa51, 0xfab77205, 0x126c89bc, 0x6b06f4ad, + 0x83dd0f14, 0x99d20e8f, 0x7109f536, 0x08638827, 0xe0b8739e, + 0x32e4998e, 0xda3f6237, 0xa3551f26, 0x4b8ee49f, 0x5181e504, + 0xb95a1ebd, 0xc03063ac, 0x28eb9815, 0xb5281041, 0x5df3ebf8, + 0x249996e9, 0xcc426d50, 0xd64d6ccb, 0x3e969772, 0x47fcea63, + 0xaf2711da, 0xe3453e42, 0x0b9ec5fb, 0x72f4b8ea, 0x9a2f4353, + 0x802042c8, 0x68fbb971, 0x1191c460, 0xf94a3fd9, 0x6489b78d, + 0x8c524c34, 0xf5383125, 0x1de3ca9c, 0x07eccb07, 0xef3730be, + 0x965d4daf, 0x7e86b616, 0xacda5c06, 0x4401a7bf, 0x3d6bdaae, + 0xd5b02117, 0xcfbf208c, 0x2764db35, 0x5e0ea624, 0xb6d55d9d, + 0x2b16d5c9, 0xc3cd2e70, 0xbaa75361, 0x527ca8d8, 0x4873a943, + 0xa0a852fa, 0xd9c22feb, 0x3119d452, 0xbbf0874e, 0x532b7cf7, + 0x2a4101e6, 0xc29afa5f, 0xd895fbc4, 0x304e007d, 0x49247d6c, + 0xa1ff86d5, 0x3c3c0e81, 0xd4e7f538, 0xad8d8829, 0x45567390, + 0x5f59720b, 0xb78289b2, 0xcee8f4a3, 0x26330f1a, 0xf46fe50a, + 0x1cb41eb3, 0x65de63a2, 0x8d05981b, 0x970a9980, 0x7fd16239, + 0x06bb1f28, 0xee60e491, 0x73a36cc5, 0x9b78977c, 0xe212ea6d, + 0x0ac911d4, 0x10c6104f, 0xf81debf6, 0x817796e7, 0x69ac6d5e, + 0x25ce42c6, 0xcd15b97f, 0xb47fc46e, 0x5ca43fd7, 0x46ab3e4c, + 0xae70c5f5, 0xd71ab8e4, 0x3fc1435d, 0xa202cb09, 0x4ad930b0, + 0x33b34da1, 0xdb68b618, 0xc167b783, 0x29bc4c3a, 0x50d6312b, + 0xb80dca92, 0x6a512082, 0x828adb3b, 0xfbe0a62a, 0x133b5d93, + 0x09345c08, 0xe1efa7b1, 0x9885daa0, 0x705e2119, 0xed9da94d, + 0x054652f4, 0x7c2c2fe5, 0x94f7d45c, 0x8ef8d5c7, 0x66232e7e, + 0x1f49536f, 0xf792a8d6, 0xc68b7c84, 0x2e50873d, 0x573afa2c, + 0xbfe10195, 0xa5ee000e, 0x4d35fbb7, 0x345f86a6, 0xdc847d1f, + 0x4147f54b, 0xa99c0ef2, 0xd0f673e3, 0x382d885a, 0x222289c1, + 0xcaf97278, 0xb3930f69, 0x5b48f4d0, 0x89141ec0, 0x61cfe579, + 0x18a59868, 0xf07e63d1, 0xea71624a, 0x02aa99f3, 0x7bc0e4e2, + 0x931b1f5b, 0x0ed8970f, 0xe6036cb6, 0x9f6911a7, 0x77b2ea1e, + 0x6dbdeb85, 0x8566103c, 0xfc0c6d2d, 0x14d79694, 0x58b5b90c, + 0xb06e42b5, 0xc9043fa4, 0x21dfc41d, 0x3bd0c586, 0xd30b3e3f, + 0xaa61432e, 0x42bab897, 0xdf7930c3, 0x37a2cb7a, 0x4ec8b66b, + 0xa6134dd2, 0xbc1c4c49, 0x54c7b7f0, 0x2dadcae1, 0xc5763158, + 0x172adb48, 0xfff120f1, 0x869b5de0, 0x6e40a659, 0x744fa7c2, + 0x9c945c7b, 0xe5fe216a, 0x0d25dad3, 0x90e65287, 0x783da93e, + 0x0157d42f, 0xe98c2f96, 0xf3832e0d, 0x1b58d5b4, 0x6232a8a5, + 0x8ae9531c}, + {0x00000000, 0x919168ae, 0x6325a087, 0xf2b4c829, 0x874c31d4, + 0x16dd597a, 0xe4699153, 0x75f8f9fd, 0x4f9f1373, 0xde0e7bdd, + 0x2cbab3f4, 0xbd2bdb5a, 0xc8d322a7, 0x59424a09, 0xabf68220, + 0x3a67ea8e, 0x9e3e27e6, 0x0faf4f48, 0xfd1b8761, 0x6c8aefcf, + 0x19721632, 0x88e37e9c, 0x7a57b6b5, 0xebc6de1b, 0xd1a13495, + 0x40305c3b, 0xb2849412, 0x2315fcbc, 0x56ed0541, 0xc77c6def, + 0x35c8a5c6, 0xa459cd68, 0x7d7b3f17, 0xecea57b9, 0x1e5e9f90, + 0x8fcff73e, 0xfa370ec3, 0x6ba6666d, 0x9912ae44, 0x0883c6ea, + 0x32e42c64, 0xa37544ca, 0x51c18ce3, 0xc050e44d, 0xb5a81db0, + 0x2439751e, 0xd68dbd37, 0x471cd599, 0xe34518f1, 0x72d4705f, + 0x8060b876, 0x11f1d0d8, 0x64092925, 0xf598418b, 0x072c89a2, + 0x96bde10c, 0xacda0b82, 0x3d4b632c, 0xcfffab05, 0x5e6ec3ab, + 0x2b963a56, 0xba0752f8, 0x48b39ad1, 0xd922f27f, 0xfaf67e2e, + 0x6b671680, 0x99d3dea9, 0x0842b607, 0x7dba4ffa, 0xec2b2754, + 0x1e9fef7d, 0x8f0e87d3, 0xb5696d5d, 0x24f805f3, 0xd64ccdda, + 0x47dda574, 0x32255c89, 0xa3b43427, 0x5100fc0e, 0xc09194a0, + 0x64c859c8, 0xf5593166, 0x07edf94f, 0x967c91e1, 0xe384681c, + 0x721500b2, 0x80a1c89b, 0x1130a035, 0x2b574abb, 0xbac62215, + 0x4872ea3c, 0xd9e38292, 0xac1b7b6f, 0x3d8a13c1, 0xcf3edbe8, + 0x5eafb346, 0x878d4139, 0x161c2997, 0xe4a8e1be, 0x75398910, + 0x00c170ed, 0x91501843, 0x63e4d06a, 0xf275b8c4, 0xc812524a, + 0x59833ae4, 0xab37f2cd, 0x3aa69a63, 0x4f5e639e, 0xdecf0b30, + 0x2c7bc319, 0xbdeaabb7, 0x19b366df, 0x88220e71, 0x7a96c658, + 0xeb07aef6, 0x9eff570b, 0x0f6e3fa5, 0xfddaf78c, 0x6c4b9f22, + 0x562c75ac, 0xc7bd1d02, 0x3509d52b, 0xa498bd85, 0xd1604478, + 0x40f12cd6, 0xb245e4ff, 0x23d48c51, 0xf4edfd5c, 0x657c95f2, + 0x97c85ddb, 0x06593575, 0x73a1cc88, 0xe230a426, 0x10846c0f, + 0x811504a1, 0xbb72ee2f, 0x2ae38681, 0xd8574ea8, 0x49c62606, + 0x3c3edffb, 0xadafb755, 0x5f1b7f7c, 0xce8a17d2, 0x6ad3daba, + 0xfb42b214, 0x09f67a3d, 0x98671293, 0xed9feb6e, 0x7c0e83c0, + 0x8eba4be9, 0x1f2b2347, 0x254cc9c9, 0xb4dda167, 0x4669694e, + 0xd7f801e0, 0xa200f81d, 0x339190b3, 0xc125589a, 0x50b43034, + 0x8996c24b, 0x1807aae5, 0xeab362cc, 0x7b220a62, 0x0edaf39f, + 0x9f4b9b31, 0x6dff5318, 0xfc6e3bb6, 0xc609d138, 0x5798b996, + 0xa52c71bf, 0x34bd1911, 0x4145e0ec, 0xd0d48842, 0x2260406b, + 0xb3f128c5, 0x17a8e5ad, 0x86398d03, 0x748d452a, 0xe51c2d84, + 0x90e4d479, 0x0175bcd7, 0xf3c174fe, 0x62501c50, 0x5837f6de, + 0xc9a69e70, 0x3b125659, 0xaa833ef7, 0xdf7bc70a, 0x4eeaafa4, + 0xbc5e678d, 0x2dcf0f23, 0x0e1b8372, 0x9f8aebdc, 0x6d3e23f5, + 0xfcaf4b5b, 0x8957b2a6, 0x18c6da08, 0xea721221, 0x7be37a8f, + 0x41849001, 0xd015f8af, 0x22a13086, 0xb3305828, 0xc6c8a1d5, + 0x5759c97b, 0xa5ed0152, 0x347c69fc, 0x9025a494, 0x01b4cc3a, + 0xf3000413, 0x62916cbd, 0x17699540, 0x86f8fdee, 0x744c35c7, + 0xe5dd5d69, 0xdfbab7e7, 0x4e2bdf49, 0xbc9f1760, 0x2d0e7fce, + 0x58f68633, 0xc967ee9d, 0x3bd326b4, 0xaa424e1a, 0x7360bc65, + 0xe2f1d4cb, 0x10451ce2, 0x81d4744c, 0xf42c8db1, 0x65bde51f, + 0x97092d36, 0x06984598, 0x3cffaf16, 0xad6ec7b8, 0x5fda0f91, + 0xce4b673f, 0xbbb39ec2, 0x2a22f66c, 0xd8963e45, 0x490756eb, + 0xed5e9b83, 0x7ccff32d, 0x8e7b3b04, 0x1fea53aa, 0x6a12aa57, + 0xfb83c2f9, 0x09370ad0, 0x98a6627e, 0xa2c188f0, 0x3350e05e, + 0xc1e42877, 0x507540d9, 0x258db924, 0xb41cd18a, 0x46a819a3, + 0xd739710d}}; + +#endif + +#endif + +#if N == 5 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0xaf449247, 0x85f822cf, 0x2abcb088, 0xd08143df, + 0x7fc5d198, 0x55796110, 0xfa3df357, 0x7a7381ff, 0xd53713b8, + 0xff8ba330, 0x50cf3177, 0xaaf2c220, 0x05b65067, 0x2f0ae0ef, + 0x804e72a8, 0xf4e703fe, 0x5ba391b9, 0x711f2131, 0xde5bb376, + 0x24664021, 0x8b22d266, 0xa19e62ee, 0x0edaf0a9, 0x8e948201, + 0x21d01046, 0x0b6ca0ce, 0xa4283289, 0x5e15c1de, 0xf1515399, + 0xdbede311, 0x74a97156, 0x32bf01bd, 0x9dfb93fa, 0xb7472372, + 0x1803b135, 0xe23e4262, 0x4d7ad025, 0x67c660ad, 0xc882f2ea, + 0x48cc8042, 0xe7881205, 0xcd34a28d, 0x627030ca, 0x984dc39d, + 0x370951da, 0x1db5e152, 0xb2f17315, 0xc6580243, 0x691c9004, + 0x43a0208c, 0xece4b2cb, 0x16d9419c, 0xb99dd3db, 0x93216353, + 0x3c65f114, 0xbc2b83bc, 0x136f11fb, 0x39d3a173, 0x96973334, + 0x6caac063, 0xc3ee5224, 0xe952e2ac, 0x461670eb, 0x657e037a, + 0xca3a913d, 0xe08621b5, 0x4fc2b3f2, 0xb5ff40a5, 0x1abbd2e2, + 0x3007626a, 0x9f43f02d, 0x1f0d8285, 0xb04910c2, 0x9af5a04a, + 0x35b1320d, 0xcf8cc15a, 0x60c8531d, 0x4a74e395, 0xe53071d2, + 0x91990084, 0x3edd92c3, 0x1461224b, 0xbb25b00c, 0x4118435b, + 0xee5cd11c, 0xc4e06194, 0x6ba4f3d3, 0xebea817b, 0x44ae133c, + 0x6e12a3b4, 0xc15631f3, 0x3b6bc2a4, 0x942f50e3, 0xbe93e06b, + 0x11d7722c, 0x57c102c7, 0xf8859080, 0xd2392008, 0x7d7db24f, + 0x87404118, 0x2804d35f, 0x02b863d7, 0xadfcf190, 0x2db28338, + 0x82f6117f, 0xa84aa1f7, 0x070e33b0, 0xfd33c0e7, 0x527752a0, + 0x78cbe228, 0xd78f706f, 0xa3260139, 0x0c62937e, 0x26de23f6, + 0x899ab1b1, 0x73a742e6, 0xdce3d0a1, 0xf65f6029, 0x591bf26e, + 0xd95580c6, 0x76111281, 0x5cada209, 0xf3e9304e, 0x09d4c319, + 0xa690515e, 0x8c2ce1d6, 0x23687391, 0xcafc06f4, 0x65b894b3, + 0x4f04243b, 0xe040b67c, 0x1a7d452b, 0xb539d76c, 0x9f8567e4, + 0x30c1f5a3, 0xb08f870b, 0x1fcb154c, 0x3577a5c4, 0x9a333783, + 0x600ec4d4, 0xcf4a5693, 0xe5f6e61b, 0x4ab2745c, 0x3e1b050a, + 0x915f974d, 0xbbe327c5, 0x14a7b582, 0xee9a46d5, 0x41ded492, + 0x6b62641a, 0xc426f65d, 0x446884f5, 0xeb2c16b2, 0xc190a63a, + 0x6ed4347d, 0x94e9c72a, 0x3bad556d, 0x1111e5e5, 0xbe5577a2, + 0xf8430749, 0x5707950e, 0x7dbb2586, 0xd2ffb7c1, 0x28c24496, + 0x8786d6d1, 0xad3a6659, 0x027ef41e, 0x823086b6, 0x2d7414f1, + 0x07c8a479, 0xa88c363e, 0x52b1c569, 0xfdf5572e, 0xd749e7a6, + 0x780d75e1, 0x0ca404b7, 0xa3e096f0, 0x895c2678, 0x2618b43f, + 0xdc254768, 0x7361d52f, 0x59dd65a7, 0xf699f7e0, 0x76d78548, + 0xd993170f, 0xf32fa787, 0x5c6b35c0, 0xa656c697, 0x091254d0, + 0x23aee458, 0x8cea761f, 0xaf82058e, 0x00c697c9, 0x2a7a2741, + 0x853eb506, 0x7f034651, 0xd047d416, 0xfafb649e, 0x55bff6d9, + 0xd5f18471, 0x7ab51636, 0x5009a6be, 0xff4d34f9, 0x0570c7ae, + 0xaa3455e9, 0x8088e561, 0x2fcc7726, 0x5b650670, 0xf4219437, + 0xde9d24bf, 0x71d9b6f8, 0x8be445af, 0x24a0d7e8, 0x0e1c6760, + 0xa158f527, 0x2116878f, 0x8e5215c8, 0xa4eea540, 0x0baa3707, + 0xf197c450, 0x5ed35617, 0x746fe69f, 0xdb2b74d8, 0x9d3d0433, + 0x32799674, 0x18c526fc, 0xb781b4bb, 0x4dbc47ec, 0xe2f8d5ab, + 0xc8446523, 0x6700f764, 0xe74e85cc, 0x480a178b, 0x62b6a703, + 0xcdf23544, 0x37cfc613, 0x988b5454, 0xb237e4dc, 0x1d73769b, + 0x69da07cd, 0xc69e958a, 0xec222502, 0x4366b745, 0xb95b4412, + 0x161fd655, 0x3ca366dd, 0x93e7f49a, 0x13a98632, 0xbced1475, + 0x9651a4fd, 0x391536ba, 0xc328c5ed, 0x6c6c57aa, 0x46d0e722, + 0xe9947565}, + {0x00000000, 0x4e890ba9, 0x9d121752, 0xd39b1cfb, 0xe15528e5, + 0xafdc234c, 0x7c473fb7, 0x32ce341e, 0x19db578b, 0x57525c22, + 0x84c940d9, 0xca404b70, 0xf88e7f6e, 0xb60774c7, 0x659c683c, + 0x2b156395, 0x33b6af16, 0x7d3fa4bf, 0xaea4b844, 0xe02db3ed, + 0xd2e387f3, 0x9c6a8c5a, 0x4ff190a1, 0x01789b08, 0x2a6df89d, + 0x64e4f334, 0xb77fefcf, 0xf9f6e466, 0xcb38d078, 0x85b1dbd1, + 0x562ac72a, 0x18a3cc83, 0x676d5e2c, 0x29e45585, 0xfa7f497e, + 0xb4f642d7, 0x863876c9, 0xc8b17d60, 0x1b2a619b, 0x55a36a32, + 0x7eb609a7, 0x303f020e, 0xe3a41ef5, 0xad2d155c, 0x9fe32142, + 0xd16a2aeb, 0x02f13610, 0x4c783db9, 0x54dbf13a, 0x1a52fa93, + 0xc9c9e668, 0x8740edc1, 0xb58ed9df, 0xfb07d276, 0x289cce8d, + 0x6615c524, 0x4d00a6b1, 0x0389ad18, 0xd012b1e3, 0x9e9bba4a, + 0xac558e54, 0xe2dc85fd, 0x31479906, 0x7fce92af, 0xcedabc58, + 0x8053b7f1, 0x53c8ab0a, 0x1d41a0a3, 0x2f8f94bd, 0x61069f14, + 0xb29d83ef, 0xfc148846, 0xd701ebd3, 0x9988e07a, 0x4a13fc81, + 0x049af728, 0x3654c336, 0x78ddc89f, 0xab46d464, 0xe5cfdfcd, + 0xfd6c134e, 0xb3e518e7, 0x607e041c, 0x2ef70fb5, 0x1c393bab, + 0x52b03002, 0x812b2cf9, 0xcfa22750, 0xe4b744c5, 0xaa3e4f6c, + 0x79a55397, 0x372c583e, 0x05e26c20, 0x4b6b6789, 0x98f07b72, + 0xd67970db, 0xa9b7e274, 0xe73ee9dd, 0x34a5f526, 0x7a2cfe8f, + 0x48e2ca91, 0x066bc138, 0xd5f0ddc3, 0x9b79d66a, 0xb06cb5ff, + 0xfee5be56, 0x2d7ea2ad, 0x63f7a904, 0x51399d1a, 0x1fb096b3, + 0xcc2b8a48, 0x82a281e1, 0x9a014d62, 0xd48846cb, 0x07135a30, + 0x499a5199, 0x7b546587, 0x35dd6e2e, 0xe64672d5, 0xa8cf797c, + 0x83da1ae9, 0xcd531140, 0x1ec80dbb, 0x50410612, 0x628f320c, + 0x2c0639a5, 0xff9d255e, 0xb1142ef7, 0x46c47ef1, 0x084d7558, + 0xdbd669a3, 0x955f620a, 0xa7915614, 0xe9185dbd, 0x3a834146, + 0x740a4aef, 0x5f1f297a, 0x119622d3, 0xc20d3e28, 0x8c843581, + 0xbe4a019f, 0xf0c30a36, 0x235816cd, 0x6dd11d64, 0x7572d1e7, + 0x3bfbda4e, 0xe860c6b5, 0xa6e9cd1c, 0x9427f902, 0xdaaef2ab, + 0x0935ee50, 0x47bce5f9, 0x6ca9866c, 0x22208dc5, 0xf1bb913e, + 0xbf329a97, 0x8dfcae89, 0xc375a520, 0x10eeb9db, 0x5e67b272, + 0x21a920dd, 0x6f202b74, 0xbcbb378f, 0xf2323c26, 0xc0fc0838, + 0x8e750391, 0x5dee1f6a, 0x136714c3, 0x38727756, 0x76fb7cff, + 0xa5606004, 0xebe96bad, 0xd9275fb3, 0x97ae541a, 0x443548e1, + 0x0abc4348, 0x121f8fcb, 0x5c968462, 0x8f0d9899, 0xc1849330, + 0xf34aa72e, 0xbdc3ac87, 0x6e58b07c, 0x20d1bbd5, 0x0bc4d840, + 0x454dd3e9, 0x96d6cf12, 0xd85fc4bb, 0xea91f0a5, 0xa418fb0c, + 0x7783e7f7, 0x390aec5e, 0x881ec2a9, 0xc697c900, 0x150cd5fb, + 0x5b85de52, 0x694bea4c, 0x27c2e1e5, 0xf459fd1e, 0xbad0f6b7, + 0x91c59522, 0xdf4c9e8b, 0x0cd78270, 0x425e89d9, 0x7090bdc7, + 0x3e19b66e, 0xed82aa95, 0xa30ba13c, 0xbba86dbf, 0xf5216616, + 0x26ba7aed, 0x68337144, 0x5afd455a, 0x14744ef3, 0xc7ef5208, + 0x896659a1, 0xa2733a34, 0xecfa319d, 0x3f612d66, 0x71e826cf, + 0x432612d1, 0x0daf1978, 0xde340583, 0x90bd0e2a, 0xef739c85, + 0xa1fa972c, 0x72618bd7, 0x3ce8807e, 0x0e26b460, 0x40afbfc9, + 0x9334a332, 0xddbda89b, 0xf6a8cb0e, 0xb821c0a7, 0x6bbadc5c, + 0x2533d7f5, 0x17fde3eb, 0x5974e842, 0x8aeff4b9, 0xc466ff10, + 0xdcc53393, 0x924c383a, 0x41d724c1, 0x0f5e2f68, 0x3d901b76, + 0x731910df, 0xa0820c24, 0xee0b078d, 0xc51e6418, 0x8b976fb1, + 0x580c734a, 0x168578e3, 0x244b4cfd, 0x6ac24754, 0xb9595baf, + 0xf7d05006}, + {0x00000000, 0x8d88fde2, 0xc060fd85, 0x4de80067, 0x5bb0fd4b, + 0xd63800a9, 0x9bd000ce, 0x1658fd2c, 0xb761fa96, 0x3ae90774, + 0x77010713, 0xfa89faf1, 0xecd107dd, 0x6159fa3f, 0x2cb1fa58, + 0xa13907ba, 0xb5b2f36d, 0x383a0e8f, 0x75d20ee8, 0xf85af30a, + 0xee020e26, 0x638af3c4, 0x2e62f3a3, 0xa3ea0e41, 0x02d309fb, + 0x8f5bf419, 0xc2b3f47e, 0x4f3b099c, 0x5963f4b0, 0xd4eb0952, + 0x99030935, 0x148bf4d7, 0xb014e09b, 0x3d9c1d79, 0x70741d1e, + 0xfdfce0fc, 0xeba41dd0, 0x662ce032, 0x2bc4e055, 0xa64c1db7, + 0x07751a0d, 0x8afde7ef, 0xc715e788, 0x4a9d1a6a, 0x5cc5e746, + 0xd14d1aa4, 0x9ca51ac3, 0x112de721, 0x05a613f6, 0x882eee14, + 0xc5c6ee73, 0x484e1391, 0x5e16eebd, 0xd39e135f, 0x9e761338, + 0x13feeeda, 0xb2c7e960, 0x3f4f1482, 0x72a714e5, 0xff2fe907, + 0xe977142b, 0x64ffe9c9, 0x2917e9ae, 0xa49f144c, 0xbb58c777, + 0x36d03a95, 0x7b383af2, 0xf6b0c710, 0xe0e83a3c, 0x6d60c7de, + 0x2088c7b9, 0xad003a5b, 0x0c393de1, 0x81b1c003, 0xcc59c064, + 0x41d13d86, 0x5789c0aa, 0xda013d48, 0x97e93d2f, 0x1a61c0cd, + 0x0eea341a, 0x8362c9f8, 0xce8ac99f, 0x4302347d, 0x555ac951, + 0xd8d234b3, 0x953a34d4, 0x18b2c936, 0xb98bce8c, 0x3403336e, + 0x79eb3309, 0xf463ceeb, 0xe23b33c7, 0x6fb3ce25, 0x225bce42, + 0xafd333a0, 0x0b4c27ec, 0x86c4da0e, 0xcb2cda69, 0x46a4278b, + 0x50fcdaa7, 0xdd742745, 0x909c2722, 0x1d14dac0, 0xbc2ddd7a, + 0x31a52098, 0x7c4d20ff, 0xf1c5dd1d, 0xe79d2031, 0x6a15ddd3, + 0x27fdddb4, 0xaa752056, 0xbefed481, 0x33762963, 0x7e9e2904, + 0xf316d4e6, 0xe54e29ca, 0x68c6d428, 0x252ed44f, 0xa8a629ad, + 0x099f2e17, 0x8417d3f5, 0xc9ffd392, 0x44772e70, 0x522fd35c, + 0xdfa72ebe, 0x924f2ed9, 0x1fc7d33b, 0xadc088af, 0x2048754d, + 0x6da0752a, 0xe02888c8, 0xf67075e4, 0x7bf88806, 0x36108861, + 0xbb987583, 0x1aa17239, 0x97298fdb, 0xdac18fbc, 0x5749725e, + 0x41118f72, 0xcc997290, 0x817172f7, 0x0cf98f15, 0x18727bc2, + 0x95fa8620, 0xd8128647, 0x559a7ba5, 0x43c28689, 0xce4a7b6b, + 0x83a27b0c, 0x0e2a86ee, 0xaf138154, 0x229b7cb6, 0x6f737cd1, + 0xe2fb8133, 0xf4a37c1f, 0x792b81fd, 0x34c3819a, 0xb94b7c78, + 0x1dd46834, 0x905c95d6, 0xddb495b1, 0x503c6853, 0x4664957f, + 0xcbec689d, 0x860468fa, 0x0b8c9518, 0xaab592a2, 0x273d6f40, + 0x6ad56f27, 0xe75d92c5, 0xf1056fe9, 0x7c8d920b, 0x3165926c, + 0xbced6f8e, 0xa8669b59, 0x25ee66bb, 0x680666dc, 0xe58e9b3e, + 0xf3d66612, 0x7e5e9bf0, 0x33b69b97, 0xbe3e6675, 0x1f0761cf, + 0x928f9c2d, 0xdf679c4a, 0x52ef61a8, 0x44b79c84, 0xc93f6166, + 0x84d76101, 0x095f9ce3, 0x16984fd8, 0x9b10b23a, 0xd6f8b25d, + 0x5b704fbf, 0x4d28b293, 0xc0a04f71, 0x8d484f16, 0x00c0b2f4, + 0xa1f9b54e, 0x2c7148ac, 0x619948cb, 0xec11b529, 0xfa494805, + 0x77c1b5e7, 0x3a29b580, 0xb7a14862, 0xa32abcb5, 0x2ea24157, + 0x634a4130, 0xeec2bcd2, 0xf89a41fe, 0x7512bc1c, 0x38fabc7b, + 0xb5724199, 0x144b4623, 0x99c3bbc1, 0xd42bbba6, 0x59a34644, + 0x4ffbbb68, 0xc273468a, 0x8f9b46ed, 0x0213bb0f, 0xa68caf43, + 0x2b0452a1, 0x66ec52c6, 0xeb64af24, 0xfd3c5208, 0x70b4afea, + 0x3d5caf8d, 0xb0d4526f, 0x11ed55d5, 0x9c65a837, 0xd18da850, + 0x5c0555b2, 0x4a5da89e, 0xc7d5557c, 0x8a3d551b, 0x07b5a8f9, + 0x133e5c2e, 0x9eb6a1cc, 0xd35ea1ab, 0x5ed65c49, 0x488ea165, + 0xc5065c87, 0x88ee5ce0, 0x0566a102, 0xa45fa6b8, 0x29d75b5a, + 0x643f5b3d, 0xe9b7a6df, 0xffef5bf3, 0x7267a611, 0x3f8fa676, + 0xb2075b94}, + {0x00000000, 0x80f0171f, 0xda91287f, 0x5a613f60, 0x6e5356bf, + 0xeea341a0, 0xb4c27ec0, 0x343269df, 0xdca6ad7e, 0x5c56ba61, + 0x06378501, 0x86c7921e, 0xb2f5fbc1, 0x3205ecde, 0x6864d3be, + 0xe894c4a1, 0x623c5cbd, 0xe2cc4ba2, 0xb8ad74c2, 0x385d63dd, + 0x0c6f0a02, 0x8c9f1d1d, 0xd6fe227d, 0x560e3562, 0xbe9af1c3, + 0x3e6ae6dc, 0x640bd9bc, 0xe4fbcea3, 0xd0c9a77c, 0x5039b063, + 0x0a588f03, 0x8aa8981c, 0xc478b97a, 0x4488ae65, 0x1ee99105, + 0x9e19861a, 0xaa2befc5, 0x2adbf8da, 0x70bac7ba, 0xf04ad0a5, + 0x18de1404, 0x982e031b, 0xc24f3c7b, 0x42bf2b64, 0x768d42bb, + 0xf67d55a4, 0xac1c6ac4, 0x2cec7ddb, 0xa644e5c7, 0x26b4f2d8, + 0x7cd5cdb8, 0xfc25daa7, 0xc817b378, 0x48e7a467, 0x12869b07, + 0x92768c18, 0x7ae248b9, 0xfa125fa6, 0xa07360c6, 0x208377d9, + 0x14b11e06, 0x94410919, 0xce203679, 0x4ed02166, 0x538074b5, + 0xd37063aa, 0x89115cca, 0x09e14bd5, 0x3dd3220a, 0xbd233515, + 0xe7420a75, 0x67b21d6a, 0x8f26d9cb, 0x0fd6ced4, 0x55b7f1b4, + 0xd547e6ab, 0xe1758f74, 0x6185986b, 0x3be4a70b, 0xbb14b014, + 0x31bc2808, 0xb14c3f17, 0xeb2d0077, 0x6bdd1768, 0x5fef7eb7, + 0xdf1f69a8, 0x857e56c8, 0x058e41d7, 0xed1a8576, 0x6dea9269, + 0x378bad09, 0xb77bba16, 0x8349d3c9, 0x03b9c4d6, 0x59d8fbb6, + 0xd928eca9, 0x97f8cdcf, 0x1708dad0, 0x4d69e5b0, 0xcd99f2af, + 0xf9ab9b70, 0x795b8c6f, 0x233ab30f, 0xa3caa410, 0x4b5e60b1, + 0xcbae77ae, 0x91cf48ce, 0x113f5fd1, 0x250d360e, 0xa5fd2111, + 0xff9c1e71, 0x7f6c096e, 0xf5c49172, 0x7534866d, 0x2f55b90d, + 0xafa5ae12, 0x9b97c7cd, 0x1b67d0d2, 0x4106efb2, 0xc1f6f8ad, + 0x29623c0c, 0xa9922b13, 0xf3f31473, 0x7303036c, 0x47316ab3, + 0xc7c17dac, 0x9da042cc, 0x1d5055d3, 0xa700e96a, 0x27f0fe75, + 0x7d91c115, 0xfd61d60a, 0xc953bfd5, 0x49a3a8ca, 0x13c297aa, + 0x933280b5, 0x7ba64414, 0xfb56530b, 0xa1376c6b, 0x21c77b74, + 0x15f512ab, 0x950505b4, 0xcf643ad4, 0x4f942dcb, 0xc53cb5d7, + 0x45cca2c8, 0x1fad9da8, 0x9f5d8ab7, 0xab6fe368, 0x2b9ff477, + 0x71fecb17, 0xf10edc08, 0x199a18a9, 0x996a0fb6, 0xc30b30d6, + 0x43fb27c9, 0x77c94e16, 0xf7395909, 0xad586669, 0x2da87176, + 0x63785010, 0xe388470f, 0xb9e9786f, 0x39196f70, 0x0d2b06af, + 0x8ddb11b0, 0xd7ba2ed0, 0x574a39cf, 0xbfdefd6e, 0x3f2eea71, + 0x654fd511, 0xe5bfc20e, 0xd18dabd1, 0x517dbcce, 0x0b1c83ae, + 0x8bec94b1, 0x01440cad, 0x81b41bb2, 0xdbd524d2, 0x5b2533cd, + 0x6f175a12, 0xefe74d0d, 0xb586726d, 0x35766572, 0xdde2a1d3, + 0x5d12b6cc, 0x077389ac, 0x87839eb3, 0xb3b1f76c, 0x3341e073, + 0x6920df13, 0xe9d0c80c, 0xf4809ddf, 0x74708ac0, 0x2e11b5a0, + 0xaee1a2bf, 0x9ad3cb60, 0x1a23dc7f, 0x4042e31f, 0xc0b2f400, + 0x282630a1, 0xa8d627be, 0xf2b718de, 0x72470fc1, 0x4675661e, + 0xc6857101, 0x9ce44e61, 0x1c14597e, 0x96bcc162, 0x164cd67d, + 0x4c2de91d, 0xccddfe02, 0xf8ef97dd, 0x781f80c2, 0x227ebfa2, + 0xa28ea8bd, 0x4a1a6c1c, 0xcaea7b03, 0x908b4463, 0x107b537c, + 0x24493aa3, 0xa4b92dbc, 0xfed812dc, 0x7e2805c3, 0x30f824a5, + 0xb00833ba, 0xea690cda, 0x6a991bc5, 0x5eab721a, 0xde5b6505, + 0x843a5a65, 0x04ca4d7a, 0xec5e89db, 0x6cae9ec4, 0x36cfa1a4, + 0xb63fb6bb, 0x820ddf64, 0x02fdc87b, 0x589cf71b, 0xd86ce004, + 0x52c47818, 0xd2346f07, 0x88555067, 0x08a54778, 0x3c972ea7, + 0xbc6739b8, 0xe60606d8, 0x66f611c7, 0x8e62d566, 0x0e92c279, + 0x54f3fd19, 0xd403ea06, 0xe03183d9, 0x60c194c6, 0x3aa0aba6, + 0xba50bcb9}, + {0x00000000, 0x9570d495, 0xf190af6b, 0x64e07bfe, 0x38505897, + 0xad208c02, 0xc9c0f7fc, 0x5cb02369, 0x70a0b12e, 0xe5d065bb, + 0x81301e45, 0x1440cad0, 0x48f0e9b9, 0xdd803d2c, 0xb96046d2, + 0x2c109247, 0xe141625c, 0x7431b6c9, 0x10d1cd37, 0x85a119a2, + 0xd9113acb, 0x4c61ee5e, 0x288195a0, 0xbdf14135, 0x91e1d372, + 0x049107e7, 0x60717c19, 0xf501a88c, 0xa9b18be5, 0x3cc15f70, + 0x5821248e, 0xcd51f01b, 0x19f3c2f9, 0x8c83166c, 0xe8636d92, + 0x7d13b907, 0x21a39a6e, 0xb4d34efb, 0xd0333505, 0x4543e190, + 0x695373d7, 0xfc23a742, 0x98c3dcbc, 0x0db30829, 0x51032b40, + 0xc473ffd5, 0xa093842b, 0x35e350be, 0xf8b2a0a5, 0x6dc27430, + 0x09220fce, 0x9c52db5b, 0xc0e2f832, 0x55922ca7, 0x31725759, + 0xa40283cc, 0x8812118b, 0x1d62c51e, 0x7982bee0, 0xecf26a75, + 0xb042491c, 0x25329d89, 0x41d2e677, 0xd4a232e2, 0x33e785f2, + 0xa6975167, 0xc2772a99, 0x5707fe0c, 0x0bb7dd65, 0x9ec709f0, + 0xfa27720e, 0x6f57a69b, 0x434734dc, 0xd637e049, 0xb2d79bb7, + 0x27a74f22, 0x7b176c4b, 0xee67b8de, 0x8a87c320, 0x1ff717b5, + 0xd2a6e7ae, 0x47d6333b, 0x233648c5, 0xb6469c50, 0xeaf6bf39, + 0x7f866bac, 0x1b661052, 0x8e16c4c7, 0xa2065680, 0x37768215, + 0x5396f9eb, 0xc6e62d7e, 0x9a560e17, 0x0f26da82, 0x6bc6a17c, + 0xfeb675e9, 0x2a14470b, 0xbf64939e, 0xdb84e860, 0x4ef43cf5, + 0x12441f9c, 0x8734cb09, 0xe3d4b0f7, 0x76a46462, 0x5ab4f625, + 0xcfc422b0, 0xab24594e, 0x3e548ddb, 0x62e4aeb2, 0xf7947a27, + 0x937401d9, 0x0604d54c, 0xcb552557, 0x5e25f1c2, 0x3ac58a3c, + 0xafb55ea9, 0xf3057dc0, 0x6675a955, 0x0295d2ab, 0x97e5063e, + 0xbbf59479, 0x2e8540ec, 0x4a653b12, 0xdf15ef87, 0x83a5ccee, + 0x16d5187b, 0x72356385, 0xe745b710, 0x67cf0be4, 0xf2bfdf71, + 0x965fa48f, 0x032f701a, 0x5f9f5373, 0xcaef87e6, 0xae0ffc18, + 0x3b7f288d, 0x176fbaca, 0x821f6e5f, 0xe6ff15a1, 0x738fc134, + 0x2f3fe25d, 0xba4f36c8, 0xdeaf4d36, 0x4bdf99a3, 0x868e69b8, + 0x13febd2d, 0x771ec6d3, 0xe26e1246, 0xbede312f, 0x2baee5ba, + 0x4f4e9e44, 0xda3e4ad1, 0xf62ed896, 0x635e0c03, 0x07be77fd, + 0x92cea368, 0xce7e8001, 0x5b0e5494, 0x3fee2f6a, 0xaa9efbff, + 0x7e3cc91d, 0xeb4c1d88, 0x8fac6676, 0x1adcb2e3, 0x466c918a, + 0xd31c451f, 0xb7fc3ee1, 0x228cea74, 0x0e9c7833, 0x9becaca6, + 0xff0cd758, 0x6a7c03cd, 0x36cc20a4, 0xa3bcf431, 0xc75c8fcf, + 0x522c5b5a, 0x9f7dab41, 0x0a0d7fd4, 0x6eed042a, 0xfb9dd0bf, + 0xa72df3d6, 0x325d2743, 0x56bd5cbd, 0xc3cd8828, 0xefdd1a6f, + 0x7aadcefa, 0x1e4db504, 0x8b3d6191, 0xd78d42f8, 0x42fd966d, + 0x261ded93, 0xb36d3906, 0x54288e16, 0xc1585a83, 0xa5b8217d, + 0x30c8f5e8, 0x6c78d681, 0xf9080214, 0x9de879ea, 0x0898ad7f, + 0x24883f38, 0xb1f8ebad, 0xd5189053, 0x406844c6, 0x1cd867af, + 0x89a8b33a, 0xed48c8c4, 0x78381c51, 0xb569ec4a, 0x201938df, + 0x44f94321, 0xd18997b4, 0x8d39b4dd, 0x18496048, 0x7ca91bb6, + 0xe9d9cf23, 0xc5c95d64, 0x50b989f1, 0x3459f20f, 0xa129269a, + 0xfd9905f3, 0x68e9d166, 0x0c09aa98, 0x99797e0d, 0x4ddb4cef, + 0xd8ab987a, 0xbc4be384, 0x293b3711, 0x758b1478, 0xe0fbc0ed, + 0x841bbb13, 0x116b6f86, 0x3d7bfdc1, 0xa80b2954, 0xcceb52aa, + 0x599b863f, 0x052ba556, 0x905b71c3, 0xf4bb0a3d, 0x61cbdea8, + 0xac9a2eb3, 0x39eafa26, 0x5d0a81d8, 0xc87a554d, 0x94ca7624, + 0x01baa2b1, 0x655ad94f, 0xf02a0dda, 0xdc3a9f9d, 0x494a4b08, + 0x2daa30f6, 0xb8dae463, 0xe46ac70a, 0x711a139f, 0x15fa6861, + 0x808abcf4}, + {0x00000000, 0xcf9e17c8, 0x444d29d1, 0x8bd33e19, 0x889a53a2, + 0x4704446a, 0xccd77a73, 0x03496dbb, 0xca45a105, 0x05dbb6cd, + 0x8e0888d4, 0x41969f1c, 0x42dff2a7, 0x8d41e56f, 0x0692db76, + 0xc90cccbe, 0x4ffa444b, 0x80645383, 0x0bb76d9a, 0xc4297a52, + 0xc76017e9, 0x08fe0021, 0x832d3e38, 0x4cb329f0, 0x85bfe54e, + 0x4a21f286, 0xc1f2cc9f, 0x0e6cdb57, 0x0d25b6ec, 0xc2bba124, + 0x49689f3d, 0x86f688f5, 0x9ff48896, 0x506a9f5e, 0xdbb9a147, + 0x1427b68f, 0x176edb34, 0xd8f0ccfc, 0x5323f2e5, 0x9cbde52d, + 0x55b12993, 0x9a2f3e5b, 0x11fc0042, 0xde62178a, 0xdd2b7a31, + 0x12b56df9, 0x996653e0, 0x56f84428, 0xd00eccdd, 0x1f90db15, + 0x9443e50c, 0x5bddf2c4, 0x58949f7f, 0x970a88b7, 0x1cd9b6ae, + 0xd347a166, 0x1a4b6dd8, 0xd5d57a10, 0x5e064409, 0x919853c1, + 0x92d13e7a, 0x5d4f29b2, 0xd69c17ab, 0x19020063, 0xe498176d, + 0x2b0600a5, 0xa0d53ebc, 0x6f4b2974, 0x6c0244cf, 0xa39c5307, + 0x284f6d1e, 0xe7d17ad6, 0x2eddb668, 0xe143a1a0, 0x6a909fb9, + 0xa50e8871, 0xa647e5ca, 0x69d9f202, 0xe20acc1b, 0x2d94dbd3, + 0xab625326, 0x64fc44ee, 0xef2f7af7, 0x20b16d3f, 0x23f80084, + 0xec66174c, 0x67b52955, 0xa82b3e9d, 0x6127f223, 0xaeb9e5eb, + 0x256adbf2, 0xeaf4cc3a, 0xe9bda181, 0x2623b649, 0xadf08850, + 0x626e9f98, 0x7b6c9ffb, 0xb4f28833, 0x3f21b62a, 0xf0bfa1e2, + 0xf3f6cc59, 0x3c68db91, 0xb7bbe588, 0x7825f240, 0xb1293efe, + 0x7eb72936, 0xf564172f, 0x3afa00e7, 0x39b36d5c, 0xf62d7a94, + 0x7dfe448d, 0xb2605345, 0x3496dbb0, 0xfb08cc78, 0x70dbf261, + 0xbf45e5a9, 0xbc0c8812, 0x73929fda, 0xf841a1c3, 0x37dfb60b, + 0xfed37ab5, 0x314d6d7d, 0xba9e5364, 0x750044ac, 0x76492917, + 0xb9d73edf, 0x320400c6, 0xfd9a170e, 0x1241289b, 0xdddf3f53, + 0x560c014a, 0x99921682, 0x9adb7b39, 0x55456cf1, 0xde9652e8, + 0x11084520, 0xd804899e, 0x179a9e56, 0x9c49a04f, 0x53d7b787, + 0x509eda3c, 0x9f00cdf4, 0x14d3f3ed, 0xdb4de425, 0x5dbb6cd0, + 0x92257b18, 0x19f64501, 0xd66852c9, 0xd5213f72, 0x1abf28ba, + 0x916c16a3, 0x5ef2016b, 0x97fecdd5, 0x5860da1d, 0xd3b3e404, + 0x1c2df3cc, 0x1f649e77, 0xd0fa89bf, 0x5b29b7a6, 0x94b7a06e, + 0x8db5a00d, 0x422bb7c5, 0xc9f889dc, 0x06669e14, 0x052ff3af, + 0xcab1e467, 0x4162da7e, 0x8efccdb6, 0x47f00108, 0x886e16c0, + 0x03bd28d9, 0xcc233f11, 0xcf6a52aa, 0x00f44562, 0x8b277b7b, + 0x44b96cb3, 0xc24fe446, 0x0dd1f38e, 0x8602cd97, 0x499cda5f, + 0x4ad5b7e4, 0x854ba02c, 0x0e989e35, 0xc10689fd, 0x080a4543, + 0xc794528b, 0x4c476c92, 0x83d97b5a, 0x809016e1, 0x4f0e0129, + 0xc4dd3f30, 0x0b4328f8, 0xf6d93ff6, 0x3947283e, 0xb2941627, + 0x7d0a01ef, 0x7e436c54, 0xb1dd7b9c, 0x3a0e4585, 0xf590524d, + 0x3c9c9ef3, 0xf302893b, 0x78d1b722, 0xb74fa0ea, 0xb406cd51, + 0x7b98da99, 0xf04be480, 0x3fd5f348, 0xb9237bbd, 0x76bd6c75, + 0xfd6e526c, 0x32f045a4, 0x31b9281f, 0xfe273fd7, 0x75f401ce, + 0xba6a1606, 0x7366dab8, 0xbcf8cd70, 0x372bf369, 0xf8b5e4a1, + 0xfbfc891a, 0x34629ed2, 0xbfb1a0cb, 0x702fb703, 0x692db760, + 0xa6b3a0a8, 0x2d609eb1, 0xe2fe8979, 0xe1b7e4c2, 0x2e29f30a, + 0xa5facd13, 0x6a64dadb, 0xa3681665, 0x6cf601ad, 0xe7253fb4, + 0x28bb287c, 0x2bf245c7, 0xe46c520f, 0x6fbf6c16, 0xa0217bde, + 0x26d7f32b, 0xe949e4e3, 0x629adafa, 0xad04cd32, 0xae4da089, + 0x61d3b741, 0xea008958, 0x259e9e90, 0xec92522e, 0x230c45e6, + 0xa8df7bff, 0x67416c37, 0x6408018c, 0xab961644, 0x2045285d, + 0xefdb3f95}, + {0x00000000, 0x24825136, 0x4904a26c, 0x6d86f35a, 0x920944d8, + 0xb68b15ee, 0xdb0de6b4, 0xff8fb782, 0xff638ff1, 0xdbe1dec7, + 0xb6672d9d, 0x92e57cab, 0x6d6acb29, 0x49e89a1f, 0x246e6945, + 0x00ec3873, 0x25b619a3, 0x01344895, 0x6cb2bbcf, 0x4830eaf9, + 0xb7bf5d7b, 0x933d0c4d, 0xfebbff17, 0xda39ae21, 0xdad59652, + 0xfe57c764, 0x93d1343e, 0xb7536508, 0x48dcd28a, 0x6c5e83bc, + 0x01d870e6, 0x255a21d0, 0x4b6c3346, 0x6fee6270, 0x0268912a, + 0x26eac01c, 0xd965779e, 0xfde726a8, 0x9061d5f2, 0xb4e384c4, + 0xb40fbcb7, 0x908ded81, 0xfd0b1edb, 0xd9894fed, 0x2606f86f, + 0x0284a959, 0x6f025a03, 0x4b800b35, 0x6eda2ae5, 0x4a587bd3, + 0x27de8889, 0x035cd9bf, 0xfcd36e3d, 0xd8513f0b, 0xb5d7cc51, + 0x91559d67, 0x91b9a514, 0xb53bf422, 0xd8bd0778, 0xfc3f564e, + 0x03b0e1cc, 0x2732b0fa, 0x4ab443a0, 0x6e361296, 0x96d8668c, + 0xb25a37ba, 0xdfdcc4e0, 0xfb5e95d6, 0x04d12254, 0x20537362, + 0x4dd58038, 0x6957d10e, 0x69bbe97d, 0x4d39b84b, 0x20bf4b11, + 0x043d1a27, 0xfbb2ada5, 0xdf30fc93, 0xb2b60fc9, 0x96345eff, + 0xb36e7f2f, 0x97ec2e19, 0xfa6add43, 0xdee88c75, 0x21673bf7, + 0x05e56ac1, 0x6863999b, 0x4ce1c8ad, 0x4c0df0de, 0x688fa1e8, + 0x050952b2, 0x218b0384, 0xde04b406, 0xfa86e530, 0x9700166a, + 0xb382475c, 0xddb455ca, 0xf93604fc, 0x94b0f7a6, 0xb032a690, + 0x4fbd1112, 0x6b3f4024, 0x06b9b37e, 0x223be248, 0x22d7da3b, + 0x06558b0d, 0x6bd37857, 0x4f512961, 0xb0de9ee3, 0x945ccfd5, + 0xf9da3c8f, 0xdd586db9, 0xf8024c69, 0xdc801d5f, 0xb106ee05, + 0x9584bf33, 0x6a0b08b1, 0x4e895987, 0x230faadd, 0x078dfbeb, + 0x0761c398, 0x23e392ae, 0x4e6561f4, 0x6ae730c2, 0x95688740, + 0xb1ead676, 0xdc6c252c, 0xf8ee741a, 0xf6c1cb59, 0xd2439a6f, + 0xbfc56935, 0x9b473803, 0x64c88f81, 0x404adeb7, 0x2dcc2ded, + 0x094e7cdb, 0x09a244a8, 0x2d20159e, 0x40a6e6c4, 0x6424b7f2, + 0x9bab0070, 0xbf295146, 0xd2afa21c, 0xf62df32a, 0xd377d2fa, + 0xf7f583cc, 0x9a737096, 0xbef121a0, 0x417e9622, 0x65fcc714, + 0x087a344e, 0x2cf86578, 0x2c145d0b, 0x08960c3d, 0x6510ff67, + 0x4192ae51, 0xbe1d19d3, 0x9a9f48e5, 0xf719bbbf, 0xd39bea89, + 0xbdadf81f, 0x992fa929, 0xf4a95a73, 0xd02b0b45, 0x2fa4bcc7, + 0x0b26edf1, 0x66a01eab, 0x42224f9d, 0x42ce77ee, 0x664c26d8, + 0x0bcad582, 0x2f4884b4, 0xd0c73336, 0xf4456200, 0x99c3915a, + 0xbd41c06c, 0x981be1bc, 0xbc99b08a, 0xd11f43d0, 0xf59d12e6, + 0x0a12a564, 0x2e90f452, 0x43160708, 0x6794563e, 0x67786e4d, + 0x43fa3f7b, 0x2e7ccc21, 0x0afe9d17, 0xf5712a95, 0xd1f37ba3, + 0xbc7588f9, 0x98f7d9cf, 0x6019add5, 0x449bfce3, 0x291d0fb9, + 0x0d9f5e8f, 0xf210e90d, 0xd692b83b, 0xbb144b61, 0x9f961a57, + 0x9f7a2224, 0xbbf87312, 0xd67e8048, 0xf2fcd17e, 0x0d7366fc, + 0x29f137ca, 0x4477c490, 0x60f595a6, 0x45afb476, 0x612de540, + 0x0cab161a, 0x2829472c, 0xd7a6f0ae, 0xf324a198, 0x9ea252c2, + 0xba2003f4, 0xbacc3b87, 0x9e4e6ab1, 0xf3c899eb, 0xd74ac8dd, + 0x28c57f5f, 0x0c472e69, 0x61c1dd33, 0x45438c05, 0x2b759e93, + 0x0ff7cfa5, 0x62713cff, 0x46f36dc9, 0xb97cda4b, 0x9dfe8b7d, + 0xf0787827, 0xd4fa2911, 0xd4161162, 0xf0944054, 0x9d12b30e, + 0xb990e238, 0x461f55ba, 0x629d048c, 0x0f1bf7d6, 0x2b99a6e0, + 0x0ec38730, 0x2a41d606, 0x47c7255c, 0x6345746a, 0x9ccac3e8, + 0xb84892de, 0xd5ce6184, 0xf14c30b2, 0xf1a008c1, 0xd52259f7, + 0xb8a4aaad, 0x9c26fb9b, 0x63a94c19, 0x472b1d2f, 0x2aadee75, + 0x0e2fbf43}, + {0x00000000, 0x36f290f3, 0x6de521e6, 0x5b17b115, 0xdbca43cc, + 0xed38d33f, 0xb62f622a, 0x80ddf2d9, 0x6ce581d9, 0x5a17112a, + 0x0100a03f, 0x37f230cc, 0xb72fc215, 0x81dd52e6, 0xdacae3f3, + 0xec387300, 0xd9cb03b2, 0xef399341, 0xb42e2254, 0x82dcb2a7, + 0x0201407e, 0x34f3d08d, 0x6fe46198, 0x5916f16b, 0xb52e826b, + 0x83dc1298, 0xd8cba38d, 0xee39337e, 0x6ee4c1a7, 0x58165154, + 0x0301e041, 0x35f370b2, 0x68e70125, 0x5e1591d6, 0x050220c3, + 0x33f0b030, 0xb32d42e9, 0x85dfd21a, 0xdec8630f, 0xe83af3fc, + 0x040280fc, 0x32f0100f, 0x69e7a11a, 0x5f1531e9, 0xdfc8c330, + 0xe93a53c3, 0xb22de2d6, 0x84df7225, 0xb12c0297, 0x87de9264, + 0xdcc92371, 0xea3bb382, 0x6ae6415b, 0x5c14d1a8, 0x070360bd, + 0x31f1f04e, 0xddc9834e, 0xeb3b13bd, 0xb02ca2a8, 0x86de325b, + 0x0603c082, 0x30f15071, 0x6be6e164, 0x5d147197, 0xd1ce024a, + 0xe73c92b9, 0xbc2b23ac, 0x8ad9b35f, 0x0a044186, 0x3cf6d175, + 0x67e16060, 0x5113f093, 0xbd2b8393, 0x8bd91360, 0xd0cea275, + 0xe63c3286, 0x66e1c05f, 0x501350ac, 0x0b04e1b9, 0x3df6714a, + 0x080501f8, 0x3ef7910b, 0x65e0201e, 0x5312b0ed, 0xd3cf4234, + 0xe53dd2c7, 0xbe2a63d2, 0x88d8f321, 0x64e08021, 0x521210d2, + 0x0905a1c7, 0x3ff73134, 0xbf2ac3ed, 0x89d8531e, 0xd2cfe20b, + 0xe43d72f8, 0xb929036f, 0x8fdb939c, 0xd4cc2289, 0xe23eb27a, + 0x62e340a3, 0x5411d050, 0x0f066145, 0x39f4f1b6, 0xd5cc82b6, + 0xe33e1245, 0xb829a350, 0x8edb33a3, 0x0e06c17a, 0x38f45189, + 0x63e3e09c, 0x5511706f, 0x60e200dd, 0x5610902e, 0x0d07213b, + 0x3bf5b1c8, 0xbb284311, 0x8ddad3e2, 0xd6cd62f7, 0xe03ff204, + 0x0c078104, 0x3af511f7, 0x61e2a0e2, 0x57103011, 0xd7cdc2c8, + 0xe13f523b, 0xba28e32e, 0x8cda73dd, 0x78ed02d5, 0x4e1f9226, + 0x15082333, 0x23fab3c0, 0xa3274119, 0x95d5d1ea, 0xcec260ff, + 0xf830f00c, 0x1408830c, 0x22fa13ff, 0x79eda2ea, 0x4f1f3219, + 0xcfc2c0c0, 0xf9305033, 0xa227e126, 0x94d571d5, 0xa1260167, + 0x97d49194, 0xccc32081, 0xfa31b072, 0x7aec42ab, 0x4c1ed258, + 0x1709634d, 0x21fbf3be, 0xcdc380be, 0xfb31104d, 0xa026a158, + 0x96d431ab, 0x1609c372, 0x20fb5381, 0x7bece294, 0x4d1e7267, + 0x100a03f0, 0x26f89303, 0x7def2216, 0x4b1db2e5, 0xcbc0403c, + 0xfd32d0cf, 0xa62561da, 0x90d7f129, 0x7cef8229, 0x4a1d12da, + 0x110aa3cf, 0x27f8333c, 0xa725c1e5, 0x91d75116, 0xcac0e003, + 0xfc3270f0, 0xc9c10042, 0xff3390b1, 0xa42421a4, 0x92d6b157, + 0x120b438e, 0x24f9d37d, 0x7fee6268, 0x491cf29b, 0xa524819b, + 0x93d61168, 0xc8c1a07d, 0xfe33308e, 0x7eeec257, 0x481c52a4, + 0x130be3b1, 0x25f97342, 0xa923009f, 0x9fd1906c, 0xc4c62179, + 0xf234b18a, 0x72e94353, 0x441bd3a0, 0x1f0c62b5, 0x29fef246, + 0xc5c68146, 0xf33411b5, 0xa823a0a0, 0x9ed13053, 0x1e0cc28a, + 0x28fe5279, 0x73e9e36c, 0x451b739f, 0x70e8032d, 0x461a93de, + 0x1d0d22cb, 0x2bffb238, 0xab2240e1, 0x9dd0d012, 0xc6c76107, + 0xf035f1f4, 0x1c0d82f4, 0x2aff1207, 0x71e8a312, 0x471a33e1, + 0xc7c7c138, 0xf13551cb, 0xaa22e0de, 0x9cd0702d, 0xc1c401ba, + 0xf7369149, 0xac21205c, 0x9ad3b0af, 0x1a0e4276, 0x2cfcd285, + 0x77eb6390, 0x4119f363, 0xad218063, 0x9bd31090, 0xc0c4a185, + 0xf6363176, 0x76ebc3af, 0x4019535c, 0x1b0ee249, 0x2dfc72ba, + 0x180f0208, 0x2efd92fb, 0x75ea23ee, 0x4318b31d, 0xc3c541c4, + 0xf537d137, 0xae206022, 0x98d2f0d1, 0x74ea83d1, 0x42181322, + 0x190fa237, 0x2ffd32c4, 0xaf20c01d, 0x99d250ee, 0xc2c5e1fb, + 0xf4377108}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xf390f23600000000, 0xe621e56d00000000, + 0x15b1175b00000000, 0xcc43cadb00000000, 0x3fd338ed00000000, + 0x2a622fb600000000, 0xd9f2dd8000000000, 0xd981e56c00000000, + 0x2a11175a00000000, 0x3fa0000100000000, 0xcc30f23700000000, + 0x15c22fb700000000, 0xe652dd8100000000, 0xf3e3cada00000000, + 0x007338ec00000000, 0xb203cbd900000000, 0x419339ef00000000, + 0x54222eb400000000, 0xa7b2dc8200000000, 0x7e40010200000000, + 0x8dd0f33400000000, 0x9861e46f00000000, 0x6bf1165900000000, + 0x6b822eb500000000, 0x9812dc8300000000, 0x8da3cbd800000000, + 0x7e3339ee00000000, 0xa7c1e46e00000000, 0x5451165800000000, + 0x41e0010300000000, 0xb270f33500000000, 0x2501e76800000000, + 0xd691155e00000000, 0xc320020500000000, 0x30b0f03300000000, + 0xe9422db300000000, 0x1ad2df8500000000, 0x0f63c8de00000000, + 0xfcf33ae800000000, 0xfc80020400000000, 0x0f10f03200000000, + 0x1aa1e76900000000, 0xe931155f00000000, 0x30c3c8df00000000, + 0xc3533ae900000000, 0xd6e22db200000000, 0x2572df8400000000, + 0x97022cb100000000, 0x6492de8700000000, 0x7123c9dc00000000, + 0x82b33bea00000000, 0x5b41e66a00000000, 0xa8d1145c00000000, + 0xbd60030700000000, 0x4ef0f13100000000, 0x4e83c9dd00000000, + 0xbd133beb00000000, 0xa8a22cb000000000, 0x5b32de8600000000, + 0x82c0030600000000, 0x7150f13000000000, 0x64e1e66b00000000, + 0x9771145d00000000, 0x4a02ced100000000, 0xb9923ce700000000, + 0xac232bbc00000000, 0x5fb3d98a00000000, 0x8641040a00000000, + 0x75d1f63c00000000, 0x6060e16700000000, 0x93f0135100000000, + 0x93832bbd00000000, 0x6013d98b00000000, 0x75a2ced000000000, + 0x86323ce600000000, 0x5fc0e16600000000, 0xac50135000000000, + 0xb9e1040b00000000, 0x4a71f63d00000000, 0xf801050800000000, + 0x0b91f73e00000000, 0x1e20e06500000000, 0xedb0125300000000, + 0x3442cfd300000000, 0xc7d23de500000000, 0xd2632abe00000000, + 0x21f3d88800000000, 0x2180e06400000000, 0xd210125200000000, + 0xc7a1050900000000, 0x3431f73f00000000, 0xedc32abf00000000, + 0x1e53d88900000000, 0x0be2cfd200000000, 0xf8723de400000000, + 0x6f0329b900000000, 0x9c93db8f00000000, 0x8922ccd400000000, + 0x7ab23ee200000000, 0xa340e36200000000, 0x50d0115400000000, + 0x4561060f00000000, 0xb6f1f43900000000, 0xb682ccd500000000, + 0x45123ee300000000, 0x50a329b800000000, 0xa333db8e00000000, + 0x7ac1060e00000000, 0x8951f43800000000, 0x9ce0e36300000000, + 0x6f70115500000000, 0xdd00e26000000000, 0x2e90105600000000, + 0x3b21070d00000000, 0xc8b1f53b00000000, 0x114328bb00000000, + 0xe2d3da8d00000000, 0xf762cdd600000000, 0x04f23fe000000000, + 0x0481070c00000000, 0xf711f53a00000000, 0xe2a0e26100000000, + 0x1130105700000000, 0xc8c2cdd700000000, 0x3b523fe100000000, + 0x2ee328ba00000000, 0xdd73da8c00000000, 0xd502ed7800000000, + 0x26921f4e00000000, 0x3323081500000000, 0xc0b3fa2300000000, + 0x194127a300000000, 0xead1d59500000000, 0xff60c2ce00000000, + 0x0cf030f800000000, 0x0c83081400000000, 0xff13fa2200000000, + 0xeaa2ed7900000000, 0x19321f4f00000000, 0xc0c0c2cf00000000, + 0x335030f900000000, 0x26e127a200000000, 0xd571d59400000000, + 0x670126a100000000, 0x9491d49700000000, 0x8120c3cc00000000, + 0x72b031fa00000000, 0xab42ec7a00000000, 0x58d21e4c00000000, + 0x4d63091700000000, 0xbef3fb2100000000, 0xbe80c3cd00000000, + 0x4d1031fb00000000, 0x58a126a000000000, 0xab31d49600000000, + 0x72c3091600000000, 0x8153fb2000000000, 0x94e2ec7b00000000, + 0x67721e4d00000000, 0xf0030a1000000000, 0x0393f82600000000, + 0x1622ef7d00000000, 0xe5b21d4b00000000, 0x3c40c0cb00000000, + 0xcfd032fd00000000, 0xda6125a600000000, 0x29f1d79000000000, + 0x2982ef7c00000000, 0xda121d4a00000000, 0xcfa30a1100000000, + 0x3c33f82700000000, 0xe5c125a700000000, 0x1651d79100000000, + 0x03e0c0ca00000000, 0xf07032fc00000000, 0x4200c1c900000000, + 0xb19033ff00000000, 0xa42124a400000000, 0x57b1d69200000000, + 0x8e430b1200000000, 0x7dd3f92400000000, 0x6862ee7f00000000, + 0x9bf21c4900000000, 0x9b8124a500000000, 0x6811d69300000000, + 0x7da0c1c800000000, 0x8e3033fe00000000, 0x57c2ee7e00000000, + 0xa4521c4800000000, 0xb1e30b1300000000, 0x4273f92500000000, + 0x9f0023a900000000, 0x6c90d19f00000000, 0x7921c6c400000000, + 0x8ab134f200000000, 0x5343e97200000000, 0xa0d31b4400000000, + 0xb5620c1f00000000, 0x46f2fe2900000000, 0x4681c6c500000000, + 0xb51134f300000000, 0xa0a023a800000000, 0x5330d19e00000000, + 0x8ac20c1e00000000, 0x7952fe2800000000, 0x6ce3e97300000000, + 0x9f731b4500000000, 0x2d03e87000000000, 0xde931a4600000000, + 0xcb220d1d00000000, 0x38b2ff2b00000000, 0xe14022ab00000000, + 0x12d0d09d00000000, 0x0761c7c600000000, 0xf4f135f000000000, + 0xf4820d1c00000000, 0x0712ff2a00000000, 0x12a3e87100000000, + 0xe1331a4700000000, 0x38c1c7c700000000, 0xcb5135f100000000, + 0xdee022aa00000000, 0x2d70d09c00000000, 0xba01c4c100000000, + 0x499136f700000000, 0x5c2021ac00000000, 0xafb0d39a00000000, + 0x76420e1a00000000, 0x85d2fc2c00000000, 0x9063eb7700000000, + 0x63f3194100000000, 0x638021ad00000000, 0x9010d39b00000000, + 0x85a1c4c000000000, 0x763136f600000000, 0xafc3eb7600000000, + 0x5c53194000000000, 0x49e20e1b00000000, 0xba72fc2d00000000, + 0x08020f1800000000, 0xfb92fd2e00000000, 0xee23ea7500000000, + 0x1db3184300000000, 0xc441c5c300000000, 0x37d137f500000000, + 0x226020ae00000000, 0xd1f0d29800000000, 0xd183ea7400000000, + 0x2213184200000000, 0x37a20f1900000000, 0xc432fd2f00000000, + 0x1dc020af00000000, 0xee50d29900000000, 0xfbe1c5c200000000, + 0x087137f400000000}, + {0x0000000000000000, 0x3651822400000000, 0x6ca2044900000000, + 0x5af3866d00000000, 0xd844099200000000, 0xee158bb600000000, + 0xb4e60ddb00000000, 0x82b78fff00000000, 0xf18f63ff00000000, + 0xc7dee1db00000000, 0x9d2d67b600000000, 0xab7ce59200000000, + 0x29cb6a6d00000000, 0x1f9ae84900000000, 0x45696e2400000000, + 0x7338ec0000000000, 0xa319b62500000000, 0x9548340100000000, + 0xcfbbb26c00000000, 0xf9ea304800000000, 0x7b5dbfb700000000, + 0x4d0c3d9300000000, 0x17ffbbfe00000000, 0x21ae39da00000000, + 0x5296d5da00000000, 0x64c757fe00000000, 0x3e34d19300000000, + 0x086553b700000000, 0x8ad2dc4800000000, 0xbc835e6c00000000, + 0xe670d80100000000, 0xd0215a2500000000, 0x46336c4b00000000, + 0x7062ee6f00000000, 0x2a91680200000000, 0x1cc0ea2600000000, + 0x9e7765d900000000, 0xa826e7fd00000000, 0xf2d5619000000000, + 0xc484e3b400000000, 0xb7bc0fb400000000, 0x81ed8d9000000000, + 0xdb1e0bfd00000000, 0xed4f89d900000000, 0x6ff8062600000000, + 0x59a9840200000000, 0x035a026f00000000, 0x350b804b00000000, + 0xe52ada6e00000000, 0xd37b584a00000000, 0x8988de2700000000, + 0xbfd95c0300000000, 0x3d6ed3fc00000000, 0x0b3f51d800000000, + 0x51ccd7b500000000, 0x679d559100000000, 0x14a5b99100000000, + 0x22f43bb500000000, 0x7807bdd800000000, 0x4e563ffc00000000, + 0xcce1b00300000000, 0xfab0322700000000, 0xa043b44a00000000, + 0x9612366e00000000, 0x8c66d89600000000, 0xba375ab200000000, + 0xe0c4dcdf00000000, 0xd6955efb00000000, 0x5422d10400000000, + 0x6273532000000000, 0x3880d54d00000000, 0x0ed1576900000000, + 0x7de9bb6900000000, 0x4bb8394d00000000, 0x114bbf2000000000, + 0x271a3d0400000000, 0xa5adb2fb00000000, 0x93fc30df00000000, + 0xc90fb6b200000000, 0xff5e349600000000, 0x2f7f6eb300000000, + 0x192eec9700000000, 0x43dd6afa00000000, 0x758ce8de00000000, + 0xf73b672100000000, 0xc16ae50500000000, 0x9b99636800000000, + 0xadc8e14c00000000, 0xdef00d4c00000000, 0xe8a18f6800000000, + 0xb252090500000000, 0x84038b2100000000, 0x06b404de00000000, + 0x30e586fa00000000, 0x6a16009700000000, 0x5c4782b300000000, + 0xca55b4dd00000000, 0xfc0436f900000000, 0xa6f7b09400000000, + 0x90a632b000000000, 0x1211bd4f00000000, 0x24403f6b00000000, + 0x7eb3b90600000000, 0x48e23b2200000000, 0x3bdad72200000000, + 0x0d8b550600000000, 0x5778d36b00000000, 0x6129514f00000000, + 0xe39edeb000000000, 0xd5cf5c9400000000, 0x8f3cdaf900000000, + 0xb96d58dd00000000, 0x694c02f800000000, 0x5f1d80dc00000000, + 0x05ee06b100000000, 0x33bf849500000000, 0xb1080b6a00000000, + 0x8759894e00000000, 0xddaa0f2300000000, 0xebfb8d0700000000, + 0x98c3610700000000, 0xae92e32300000000, 0xf461654e00000000, + 0xc230e76a00000000, 0x4087689500000000, 0x76d6eab100000000, + 0x2c256cdc00000000, 0x1a74eef800000000, 0x59cbc1f600000000, + 0x6f9a43d200000000, 0x3569c5bf00000000, 0x0338479b00000000, + 0x818fc86400000000, 0xb7de4a4000000000, 0xed2dcc2d00000000, + 0xdb7c4e0900000000, 0xa844a20900000000, 0x9e15202d00000000, + 0xc4e6a64000000000, 0xf2b7246400000000, 0x7000ab9b00000000, + 0x465129bf00000000, 0x1ca2afd200000000, 0x2af32df600000000, + 0xfad277d300000000, 0xcc83f5f700000000, 0x9670739a00000000, + 0xa021f1be00000000, 0x22967e4100000000, 0x14c7fc6500000000, + 0x4e347a0800000000, 0x7865f82c00000000, 0x0b5d142c00000000, + 0x3d0c960800000000, 0x67ff106500000000, 0x51ae924100000000, + 0xd3191dbe00000000, 0xe5489f9a00000000, 0xbfbb19f700000000, + 0x89ea9bd300000000, 0x1ff8adbd00000000, 0x29a92f9900000000, + 0x735aa9f400000000, 0x450b2bd000000000, 0xc7bca42f00000000, + 0xf1ed260b00000000, 0xab1ea06600000000, 0x9d4f224200000000, + 0xee77ce4200000000, 0xd8264c6600000000, 0x82d5ca0b00000000, + 0xb484482f00000000, 0x3633c7d000000000, 0x006245f400000000, + 0x5a91c39900000000, 0x6cc041bd00000000, 0xbce11b9800000000, + 0x8ab099bc00000000, 0xd0431fd100000000, 0xe6129df500000000, + 0x64a5120a00000000, 0x52f4902e00000000, 0x0807164300000000, + 0x3e56946700000000, 0x4d6e786700000000, 0x7b3ffa4300000000, + 0x21cc7c2e00000000, 0x179dfe0a00000000, 0x952a71f500000000, + 0xa37bf3d100000000, 0xf98875bc00000000, 0xcfd9f79800000000, + 0xd5ad196000000000, 0xe3fc9b4400000000, 0xb90f1d2900000000, + 0x8f5e9f0d00000000, 0x0de910f200000000, 0x3bb892d600000000, + 0x614b14bb00000000, 0x571a969f00000000, 0x24227a9f00000000, + 0x1273f8bb00000000, 0x48807ed600000000, 0x7ed1fcf200000000, + 0xfc66730d00000000, 0xca37f12900000000, 0x90c4774400000000, + 0xa695f56000000000, 0x76b4af4500000000, 0x40e52d6100000000, + 0x1a16ab0c00000000, 0x2c47292800000000, 0xaef0a6d700000000, + 0x98a124f300000000, 0xc252a29e00000000, 0xf40320ba00000000, + 0x873bccba00000000, 0xb16a4e9e00000000, 0xeb99c8f300000000, + 0xddc84ad700000000, 0x5f7fc52800000000, 0x692e470c00000000, + 0x33ddc16100000000, 0x058c434500000000, 0x939e752b00000000, + 0xa5cff70f00000000, 0xff3c716200000000, 0xc96df34600000000, + 0x4bda7cb900000000, 0x7d8bfe9d00000000, 0x277878f000000000, + 0x1129fad400000000, 0x621116d400000000, 0x544094f000000000, + 0x0eb3129d00000000, 0x38e290b900000000, 0xba551f4600000000, + 0x8c049d6200000000, 0xd6f71b0f00000000, 0xe0a6992b00000000, + 0x3087c30e00000000, 0x06d6412a00000000, 0x5c25c74700000000, + 0x6a74456300000000, 0xe8c3ca9c00000000, 0xde9248b800000000, + 0x8461ced500000000, 0xb2304cf100000000, 0xc108a0f100000000, + 0xf75922d500000000, 0xadaaa4b800000000, 0x9bfb269c00000000, + 0x194ca96300000000, 0x2f1d2b4700000000, 0x75eead2a00000000, + 0x43bf2f0e00000000}, + {0x0000000000000000, 0xc8179ecf00000000, 0xd1294d4400000000, + 0x193ed38b00000000, 0xa2539a8800000000, 0x6a44044700000000, + 0x737ad7cc00000000, 0xbb6d490300000000, 0x05a145ca00000000, + 0xcdb6db0500000000, 0xd488088e00000000, 0x1c9f964100000000, + 0xa7f2df4200000000, 0x6fe5418d00000000, 0x76db920600000000, + 0xbecc0cc900000000, 0x4b44fa4f00000000, 0x8353648000000000, + 0x9a6db70b00000000, 0x527a29c400000000, 0xe91760c700000000, + 0x2100fe0800000000, 0x383e2d8300000000, 0xf029b34c00000000, + 0x4ee5bf8500000000, 0x86f2214a00000000, 0x9fccf2c100000000, + 0x57db6c0e00000000, 0xecb6250d00000000, 0x24a1bbc200000000, + 0x3d9f684900000000, 0xf588f68600000000, 0x9688f49f00000000, + 0x5e9f6a5000000000, 0x47a1b9db00000000, 0x8fb6271400000000, + 0x34db6e1700000000, 0xfcccf0d800000000, 0xe5f2235300000000, + 0x2de5bd9c00000000, 0x9329b15500000000, 0x5b3e2f9a00000000, + 0x4200fc1100000000, 0x8a1762de00000000, 0x317a2bdd00000000, + 0xf96db51200000000, 0xe053669900000000, 0x2844f85600000000, + 0xddcc0ed000000000, 0x15db901f00000000, 0x0ce5439400000000, + 0xc4f2dd5b00000000, 0x7f9f945800000000, 0xb7880a9700000000, + 0xaeb6d91c00000000, 0x66a147d300000000, 0xd86d4b1a00000000, + 0x107ad5d500000000, 0x0944065e00000000, 0xc153989100000000, + 0x7a3ed19200000000, 0xb2294f5d00000000, 0xab179cd600000000, + 0x6300021900000000, 0x6d1798e400000000, 0xa500062b00000000, + 0xbc3ed5a000000000, 0x74294b6f00000000, 0xcf44026c00000000, + 0x07539ca300000000, 0x1e6d4f2800000000, 0xd67ad1e700000000, + 0x68b6dd2e00000000, 0xa0a143e100000000, 0xb99f906a00000000, + 0x71880ea500000000, 0xcae547a600000000, 0x02f2d96900000000, + 0x1bcc0ae200000000, 0xd3db942d00000000, 0x265362ab00000000, + 0xee44fc6400000000, 0xf77a2fef00000000, 0x3f6db12000000000, + 0x8400f82300000000, 0x4c1766ec00000000, 0x5529b56700000000, + 0x9d3e2ba800000000, 0x23f2276100000000, 0xebe5b9ae00000000, + 0xf2db6a2500000000, 0x3accf4ea00000000, 0x81a1bde900000000, + 0x49b6232600000000, 0x5088f0ad00000000, 0x989f6e6200000000, + 0xfb9f6c7b00000000, 0x3388f2b400000000, 0x2ab6213f00000000, + 0xe2a1bff000000000, 0x59ccf6f300000000, 0x91db683c00000000, + 0x88e5bbb700000000, 0x40f2257800000000, 0xfe3e29b100000000, + 0x3629b77e00000000, 0x2f1764f500000000, 0xe700fa3a00000000, + 0x5c6db33900000000, 0x947a2df600000000, 0x8d44fe7d00000000, + 0x455360b200000000, 0xb0db963400000000, 0x78cc08fb00000000, + 0x61f2db7000000000, 0xa9e545bf00000000, 0x12880cbc00000000, + 0xda9f927300000000, 0xc3a141f800000000, 0x0bb6df3700000000, + 0xb57ad3fe00000000, 0x7d6d4d3100000000, 0x64539eba00000000, + 0xac44007500000000, 0x1729497600000000, 0xdf3ed7b900000000, + 0xc600043200000000, 0x0e179afd00000000, 0x9b28411200000000, + 0x533fdfdd00000000, 0x4a010c5600000000, 0x8216929900000000, + 0x397bdb9a00000000, 0xf16c455500000000, 0xe85296de00000000, + 0x2045081100000000, 0x9e8904d800000000, 0x569e9a1700000000, + 0x4fa0499c00000000, 0x87b7d75300000000, 0x3cda9e5000000000, + 0xf4cd009f00000000, 0xedf3d31400000000, 0x25e44ddb00000000, + 0xd06cbb5d00000000, 0x187b259200000000, 0x0145f61900000000, + 0xc95268d600000000, 0x723f21d500000000, 0xba28bf1a00000000, + 0xa3166c9100000000, 0x6b01f25e00000000, 0xd5cdfe9700000000, + 0x1dda605800000000, 0x04e4b3d300000000, 0xccf32d1c00000000, + 0x779e641f00000000, 0xbf89fad000000000, 0xa6b7295b00000000, + 0x6ea0b79400000000, 0x0da0b58d00000000, 0xc5b72b4200000000, + 0xdc89f8c900000000, 0x149e660600000000, 0xaff32f0500000000, + 0x67e4b1ca00000000, 0x7eda624100000000, 0xb6cdfc8e00000000, + 0x0801f04700000000, 0xc0166e8800000000, 0xd928bd0300000000, + 0x113f23cc00000000, 0xaa526acf00000000, 0x6245f40000000000, + 0x7b7b278b00000000, 0xb36cb94400000000, 0x46e44fc200000000, + 0x8ef3d10d00000000, 0x97cd028600000000, 0x5fda9c4900000000, + 0xe4b7d54a00000000, 0x2ca04b8500000000, 0x359e980e00000000, + 0xfd8906c100000000, 0x43450a0800000000, 0x8b5294c700000000, + 0x926c474c00000000, 0x5a7bd98300000000, 0xe116908000000000, + 0x29010e4f00000000, 0x303fddc400000000, 0xf828430b00000000, + 0xf63fd9f600000000, 0x3e28473900000000, 0x271694b200000000, + 0xef010a7d00000000, 0x546c437e00000000, 0x9c7bddb100000000, + 0x85450e3a00000000, 0x4d5290f500000000, 0xf39e9c3c00000000, + 0x3b8902f300000000, 0x22b7d17800000000, 0xeaa04fb700000000, + 0x51cd06b400000000, 0x99da987b00000000, 0x80e44bf000000000, + 0x48f3d53f00000000, 0xbd7b23b900000000, 0x756cbd7600000000, + 0x6c526efd00000000, 0xa445f03200000000, 0x1f28b93100000000, + 0xd73f27fe00000000, 0xce01f47500000000, 0x06166aba00000000, + 0xb8da667300000000, 0x70cdf8bc00000000, 0x69f32b3700000000, + 0xa1e4b5f800000000, 0x1a89fcfb00000000, 0xd29e623400000000, + 0xcba0b1bf00000000, 0x03b72f7000000000, 0x60b72d6900000000, + 0xa8a0b3a600000000, 0xb19e602d00000000, 0x7989fee200000000, + 0xc2e4b7e100000000, 0x0af3292e00000000, 0x13cdfaa500000000, + 0xdbda646a00000000, 0x651668a300000000, 0xad01f66c00000000, + 0xb43f25e700000000, 0x7c28bb2800000000, 0xc745f22b00000000, + 0x0f526ce400000000, 0x166cbf6f00000000, 0xde7b21a000000000, + 0x2bf3d72600000000, 0xe3e449e900000000, 0xfada9a6200000000, + 0x32cd04ad00000000, 0x89a04dae00000000, 0x41b7d36100000000, + 0x588900ea00000000, 0x909e9e2500000000, 0x2e5292ec00000000, + 0xe6450c2300000000, 0xff7bdfa800000000, 0x376c416700000000, + 0x8c01086400000000, 0x441696ab00000000, 0x5d28452000000000, + 0x953fdbef00000000}, + {0x0000000000000000, 0x95d4709500000000, 0x6baf90f100000000, + 0xfe7be06400000000, 0x9758503800000000, 0x028c20ad00000000, + 0xfcf7c0c900000000, 0x6923b05c00000000, 0x2eb1a07000000000, + 0xbb65d0e500000000, 0x451e308100000000, 0xd0ca401400000000, + 0xb9e9f04800000000, 0x2c3d80dd00000000, 0xd24660b900000000, + 0x4792102c00000000, 0x5c6241e100000000, 0xc9b6317400000000, + 0x37cdd11000000000, 0xa219a18500000000, 0xcb3a11d900000000, + 0x5eee614c00000000, 0xa095812800000000, 0x3541f1bd00000000, + 0x72d3e19100000000, 0xe707910400000000, 0x197c716000000000, + 0x8ca801f500000000, 0xe58bb1a900000000, 0x705fc13c00000000, + 0x8e24215800000000, 0x1bf051cd00000000, 0xf9c2f31900000000, + 0x6c16838c00000000, 0x926d63e800000000, 0x07b9137d00000000, + 0x6e9aa32100000000, 0xfb4ed3b400000000, 0x053533d000000000, + 0x90e1434500000000, 0xd773536900000000, 0x42a723fc00000000, + 0xbcdcc39800000000, 0x2908b30d00000000, 0x402b035100000000, + 0xd5ff73c400000000, 0x2b8493a000000000, 0xbe50e33500000000, + 0xa5a0b2f800000000, 0x3074c26d00000000, 0xce0f220900000000, + 0x5bdb529c00000000, 0x32f8e2c000000000, 0xa72c925500000000, + 0x5957723100000000, 0xcc8302a400000000, 0x8b11128800000000, + 0x1ec5621d00000000, 0xe0be827900000000, 0x756af2ec00000000, + 0x1c4942b000000000, 0x899d322500000000, 0x77e6d24100000000, + 0xe232a2d400000000, 0xf285e73300000000, 0x675197a600000000, + 0x992a77c200000000, 0x0cfe075700000000, 0x65ddb70b00000000, + 0xf009c79e00000000, 0x0e7227fa00000000, 0x9ba6576f00000000, + 0xdc34474300000000, 0x49e037d600000000, 0xb79bd7b200000000, + 0x224fa72700000000, 0x4b6c177b00000000, 0xdeb867ee00000000, + 0x20c3878a00000000, 0xb517f71f00000000, 0xaee7a6d200000000, + 0x3b33d64700000000, 0xc548362300000000, 0x509c46b600000000, + 0x39bff6ea00000000, 0xac6b867f00000000, 0x5210661b00000000, + 0xc7c4168e00000000, 0x805606a200000000, 0x1582763700000000, + 0xebf9965300000000, 0x7e2de6c600000000, 0x170e569a00000000, + 0x82da260f00000000, 0x7ca1c66b00000000, 0xe975b6fe00000000, + 0x0b47142a00000000, 0x9e9364bf00000000, 0x60e884db00000000, + 0xf53cf44e00000000, 0x9c1f441200000000, 0x09cb348700000000, + 0xf7b0d4e300000000, 0x6264a47600000000, 0x25f6b45a00000000, + 0xb022c4cf00000000, 0x4e5924ab00000000, 0xdb8d543e00000000, + 0xb2aee46200000000, 0x277a94f700000000, 0xd901749300000000, + 0x4cd5040600000000, 0x572555cb00000000, 0xc2f1255e00000000, + 0x3c8ac53a00000000, 0xa95eb5af00000000, 0xc07d05f300000000, + 0x55a9756600000000, 0xabd2950200000000, 0x3e06e59700000000, + 0x7994f5bb00000000, 0xec40852e00000000, 0x123b654a00000000, + 0x87ef15df00000000, 0xeecca58300000000, 0x7b18d51600000000, + 0x8563357200000000, 0x10b745e700000000, 0xe40bcf6700000000, + 0x71dfbff200000000, 0x8fa45f9600000000, 0x1a702f0300000000, + 0x73539f5f00000000, 0xe687efca00000000, 0x18fc0fae00000000, + 0x8d287f3b00000000, 0xcaba6f1700000000, 0x5f6e1f8200000000, + 0xa115ffe600000000, 0x34c18f7300000000, 0x5de23f2f00000000, + 0xc8364fba00000000, 0x364dafde00000000, 0xa399df4b00000000, + 0xb8698e8600000000, 0x2dbdfe1300000000, 0xd3c61e7700000000, + 0x46126ee200000000, 0x2f31debe00000000, 0xbae5ae2b00000000, + 0x449e4e4f00000000, 0xd14a3eda00000000, 0x96d82ef600000000, + 0x030c5e6300000000, 0xfd77be0700000000, 0x68a3ce9200000000, + 0x01807ece00000000, 0x94540e5b00000000, 0x6a2fee3f00000000, + 0xfffb9eaa00000000, 0x1dc93c7e00000000, 0x881d4ceb00000000, + 0x7666ac8f00000000, 0xe3b2dc1a00000000, 0x8a916c4600000000, + 0x1f451cd300000000, 0xe13efcb700000000, 0x74ea8c2200000000, + 0x33789c0e00000000, 0xa6acec9b00000000, 0x58d70cff00000000, + 0xcd037c6a00000000, 0xa420cc3600000000, 0x31f4bca300000000, + 0xcf8f5cc700000000, 0x5a5b2c5200000000, 0x41ab7d9f00000000, + 0xd47f0d0a00000000, 0x2a04ed6e00000000, 0xbfd09dfb00000000, + 0xd6f32da700000000, 0x43275d3200000000, 0xbd5cbd5600000000, + 0x2888cdc300000000, 0x6f1addef00000000, 0xfacead7a00000000, + 0x04b54d1e00000000, 0x91613d8b00000000, 0xf8428dd700000000, + 0x6d96fd4200000000, 0x93ed1d2600000000, 0x06396db300000000, + 0x168e285400000000, 0x835a58c100000000, 0x7d21b8a500000000, + 0xe8f5c83000000000, 0x81d6786c00000000, 0x140208f900000000, + 0xea79e89d00000000, 0x7fad980800000000, 0x383f882400000000, + 0xadebf8b100000000, 0x539018d500000000, 0xc644684000000000, + 0xaf67d81c00000000, 0x3ab3a88900000000, 0xc4c848ed00000000, + 0x511c387800000000, 0x4aec69b500000000, 0xdf38192000000000, + 0x2143f94400000000, 0xb49789d100000000, 0xddb4398d00000000, + 0x4860491800000000, 0xb61ba97c00000000, 0x23cfd9e900000000, + 0x645dc9c500000000, 0xf189b95000000000, 0x0ff2593400000000, + 0x9a2629a100000000, 0xf30599fd00000000, 0x66d1e96800000000, + 0x98aa090c00000000, 0x0d7e799900000000, 0xef4cdb4d00000000, + 0x7a98abd800000000, 0x84e34bbc00000000, 0x11373b2900000000, + 0x78148b7500000000, 0xedc0fbe000000000, 0x13bb1b8400000000, + 0x866f6b1100000000, 0xc1fd7b3d00000000, 0x54290ba800000000, + 0xaa52ebcc00000000, 0x3f869b5900000000, 0x56a52b0500000000, + 0xc3715b9000000000, 0x3d0abbf400000000, 0xa8decb6100000000, + 0xb32e9aac00000000, 0x26faea3900000000, 0xd8810a5d00000000, + 0x4d557ac800000000, 0x2476ca9400000000, 0xb1a2ba0100000000, + 0x4fd95a6500000000, 0xda0d2af000000000, 0x9d9f3adc00000000, + 0x084b4a4900000000, 0xf630aa2d00000000, 0x63e4dab800000000, + 0x0ac76ae400000000, 0x9f131a7100000000, 0x6168fa1500000000, + 0xf4bc8a8000000000}, + {0x0000000000000000, 0x1f17f08000000000, 0x7f2891da00000000, + 0x603f615a00000000, 0xbf56536e00000000, 0xa041a3ee00000000, + 0xc07ec2b400000000, 0xdf69323400000000, 0x7eada6dc00000000, + 0x61ba565c00000000, 0x0185370600000000, 0x1e92c78600000000, + 0xc1fbf5b200000000, 0xdeec053200000000, 0xbed3646800000000, + 0xa1c494e800000000, 0xbd5c3c6200000000, 0xa24bcce200000000, + 0xc274adb800000000, 0xdd635d3800000000, 0x020a6f0c00000000, + 0x1d1d9f8c00000000, 0x7d22fed600000000, 0x62350e5600000000, + 0xc3f19abe00000000, 0xdce66a3e00000000, 0xbcd90b6400000000, + 0xa3cefbe400000000, 0x7ca7c9d000000000, 0x63b0395000000000, + 0x038f580a00000000, 0x1c98a88a00000000, 0x7ab978c400000000, + 0x65ae884400000000, 0x0591e91e00000000, 0x1a86199e00000000, + 0xc5ef2baa00000000, 0xdaf8db2a00000000, 0xbac7ba7000000000, + 0xa5d04af000000000, 0x0414de1800000000, 0x1b032e9800000000, + 0x7b3c4fc200000000, 0x642bbf4200000000, 0xbb428d7600000000, + 0xa4557df600000000, 0xc46a1cac00000000, 0xdb7dec2c00000000, + 0xc7e544a600000000, 0xd8f2b42600000000, 0xb8cdd57c00000000, + 0xa7da25fc00000000, 0x78b317c800000000, 0x67a4e74800000000, + 0x079b861200000000, 0x188c769200000000, 0xb948e27a00000000, + 0xa65f12fa00000000, 0xc66073a000000000, 0xd977832000000000, + 0x061eb11400000000, 0x1909419400000000, 0x793620ce00000000, + 0x6621d04e00000000, 0xb574805300000000, 0xaa6370d300000000, + 0xca5c118900000000, 0xd54be10900000000, 0x0a22d33d00000000, + 0x153523bd00000000, 0x750a42e700000000, 0x6a1db26700000000, + 0xcbd9268f00000000, 0xd4ced60f00000000, 0xb4f1b75500000000, + 0xabe647d500000000, 0x748f75e100000000, 0x6b98856100000000, + 0x0ba7e43b00000000, 0x14b014bb00000000, 0x0828bc3100000000, + 0x173f4cb100000000, 0x77002deb00000000, 0x6817dd6b00000000, + 0xb77eef5f00000000, 0xa8691fdf00000000, 0xc8567e8500000000, + 0xd7418e0500000000, 0x76851aed00000000, 0x6992ea6d00000000, + 0x09ad8b3700000000, 0x16ba7bb700000000, 0xc9d3498300000000, + 0xd6c4b90300000000, 0xb6fbd85900000000, 0xa9ec28d900000000, + 0xcfcdf89700000000, 0xd0da081700000000, 0xb0e5694d00000000, + 0xaff299cd00000000, 0x709babf900000000, 0x6f8c5b7900000000, + 0x0fb33a2300000000, 0x10a4caa300000000, 0xb1605e4b00000000, + 0xae77aecb00000000, 0xce48cf9100000000, 0xd15f3f1100000000, + 0x0e360d2500000000, 0x1121fda500000000, 0x711e9cff00000000, + 0x6e096c7f00000000, 0x7291c4f500000000, 0x6d86347500000000, + 0x0db9552f00000000, 0x12aea5af00000000, 0xcdc7979b00000000, + 0xd2d0671b00000000, 0xb2ef064100000000, 0xadf8f6c100000000, + 0x0c3c622900000000, 0x132b92a900000000, 0x7314f3f300000000, + 0x6c03037300000000, 0xb36a314700000000, 0xac7dc1c700000000, + 0xcc42a09d00000000, 0xd355501d00000000, 0x6ae900a700000000, + 0x75fef02700000000, 0x15c1917d00000000, 0x0ad661fd00000000, + 0xd5bf53c900000000, 0xcaa8a34900000000, 0xaa97c21300000000, + 0xb580329300000000, 0x1444a67b00000000, 0x0b5356fb00000000, + 0x6b6c37a100000000, 0x747bc72100000000, 0xab12f51500000000, + 0xb405059500000000, 0xd43a64cf00000000, 0xcb2d944f00000000, + 0xd7b53cc500000000, 0xc8a2cc4500000000, 0xa89dad1f00000000, + 0xb78a5d9f00000000, 0x68e36fab00000000, 0x77f49f2b00000000, + 0x17cbfe7100000000, 0x08dc0ef100000000, 0xa9189a1900000000, + 0xb60f6a9900000000, 0xd6300bc300000000, 0xc927fb4300000000, + 0x164ec97700000000, 0x095939f700000000, 0x696658ad00000000, + 0x7671a82d00000000, 0x1050786300000000, 0x0f4788e300000000, + 0x6f78e9b900000000, 0x706f193900000000, 0xaf062b0d00000000, + 0xb011db8d00000000, 0xd02ebad700000000, 0xcf394a5700000000, + 0x6efddebf00000000, 0x71ea2e3f00000000, 0x11d54f6500000000, + 0x0ec2bfe500000000, 0xd1ab8dd100000000, 0xcebc7d5100000000, + 0xae831c0b00000000, 0xb194ec8b00000000, 0xad0c440100000000, + 0xb21bb48100000000, 0xd224d5db00000000, 0xcd33255b00000000, + 0x125a176f00000000, 0x0d4de7ef00000000, 0x6d7286b500000000, + 0x7265763500000000, 0xd3a1e2dd00000000, 0xccb6125d00000000, + 0xac89730700000000, 0xb39e838700000000, 0x6cf7b1b300000000, + 0x73e0413300000000, 0x13df206900000000, 0x0cc8d0e900000000, + 0xdf9d80f400000000, 0xc08a707400000000, 0xa0b5112e00000000, + 0xbfa2e1ae00000000, 0x60cbd39a00000000, 0x7fdc231a00000000, + 0x1fe3424000000000, 0x00f4b2c000000000, 0xa130262800000000, + 0xbe27d6a800000000, 0xde18b7f200000000, 0xc10f477200000000, + 0x1e66754600000000, 0x017185c600000000, 0x614ee49c00000000, + 0x7e59141c00000000, 0x62c1bc9600000000, 0x7dd64c1600000000, + 0x1de92d4c00000000, 0x02feddcc00000000, 0xdd97eff800000000, + 0xc2801f7800000000, 0xa2bf7e2200000000, 0xbda88ea200000000, + 0x1c6c1a4a00000000, 0x037beaca00000000, 0x63448b9000000000, + 0x7c537b1000000000, 0xa33a492400000000, 0xbc2db9a400000000, + 0xdc12d8fe00000000, 0xc305287e00000000, 0xa524f83000000000, + 0xba3308b000000000, 0xda0c69ea00000000, 0xc51b996a00000000, + 0x1a72ab5e00000000, 0x05655bde00000000, 0x655a3a8400000000, + 0x7a4dca0400000000, 0xdb895eec00000000, 0xc49eae6c00000000, + 0xa4a1cf3600000000, 0xbbb63fb600000000, 0x64df0d8200000000, + 0x7bc8fd0200000000, 0x1bf79c5800000000, 0x04e06cd800000000, + 0x1878c45200000000, 0x076f34d200000000, 0x6750558800000000, + 0x7847a50800000000, 0xa72e973c00000000, 0xb83967bc00000000, + 0xd80606e600000000, 0xc711f66600000000, 0x66d5628e00000000, + 0x79c2920e00000000, 0x19fdf35400000000, 0x06ea03d400000000, + 0xd98331e000000000, 0xc694c16000000000, 0xa6aba03a00000000, + 0xb9bc50ba00000000}, + {0x0000000000000000, 0xe2fd888d00000000, 0x85fd60c000000000, + 0x6700e84d00000000, 0x4bfdb05b00000000, 0xa90038d600000000, + 0xce00d09b00000000, 0x2cfd581600000000, 0x96fa61b700000000, + 0x7407e93a00000000, 0x1307017700000000, 0xf1fa89fa00000000, + 0xdd07d1ec00000000, 0x3ffa596100000000, 0x58fab12c00000000, + 0xba0739a100000000, 0x6df3b2b500000000, 0x8f0e3a3800000000, + 0xe80ed27500000000, 0x0af35af800000000, 0x260e02ee00000000, + 0xc4f38a6300000000, 0xa3f3622e00000000, 0x410eeaa300000000, + 0xfb09d30200000000, 0x19f45b8f00000000, 0x7ef4b3c200000000, + 0x9c093b4f00000000, 0xb0f4635900000000, 0x5209ebd400000000, + 0x3509039900000000, 0xd7f48b1400000000, 0x9be014b000000000, + 0x791d9c3d00000000, 0x1e1d747000000000, 0xfce0fcfd00000000, + 0xd01da4eb00000000, 0x32e02c6600000000, 0x55e0c42b00000000, + 0xb71d4ca600000000, 0x0d1a750700000000, 0xefe7fd8a00000000, + 0x88e715c700000000, 0x6a1a9d4a00000000, 0x46e7c55c00000000, + 0xa41a4dd100000000, 0xc31aa59c00000000, 0x21e72d1100000000, + 0xf613a60500000000, 0x14ee2e8800000000, 0x73eec6c500000000, + 0x91134e4800000000, 0xbdee165e00000000, 0x5f139ed300000000, + 0x3813769e00000000, 0xdaeefe1300000000, 0x60e9c7b200000000, + 0x82144f3f00000000, 0xe514a77200000000, 0x07e92fff00000000, + 0x2b1477e900000000, 0xc9e9ff6400000000, 0xaee9172900000000, + 0x4c149fa400000000, 0x77c758bb00000000, 0x953ad03600000000, + 0xf23a387b00000000, 0x10c7b0f600000000, 0x3c3ae8e000000000, + 0xdec7606d00000000, 0xb9c7882000000000, 0x5b3a00ad00000000, + 0xe13d390c00000000, 0x03c0b18100000000, 0x64c059cc00000000, + 0x863dd14100000000, 0xaac0895700000000, 0x483d01da00000000, + 0x2f3de99700000000, 0xcdc0611a00000000, 0x1a34ea0e00000000, + 0xf8c9628300000000, 0x9fc98ace00000000, 0x7d34024300000000, + 0x51c95a5500000000, 0xb334d2d800000000, 0xd4343a9500000000, + 0x36c9b21800000000, 0x8cce8bb900000000, 0x6e33033400000000, + 0x0933eb7900000000, 0xebce63f400000000, 0xc7333be200000000, + 0x25ceb36f00000000, 0x42ce5b2200000000, 0xa033d3af00000000, + 0xec274c0b00000000, 0x0edac48600000000, 0x69da2ccb00000000, + 0x8b27a44600000000, 0xa7dafc5000000000, 0x452774dd00000000, + 0x22279c9000000000, 0xc0da141d00000000, 0x7add2dbc00000000, + 0x9820a53100000000, 0xff204d7c00000000, 0x1dddc5f100000000, + 0x31209de700000000, 0xd3dd156a00000000, 0xb4ddfd2700000000, + 0x562075aa00000000, 0x81d4febe00000000, 0x6329763300000000, + 0x04299e7e00000000, 0xe6d416f300000000, 0xca294ee500000000, + 0x28d4c66800000000, 0x4fd42e2500000000, 0xad29a6a800000000, + 0x172e9f0900000000, 0xf5d3178400000000, 0x92d3ffc900000000, + 0x702e774400000000, 0x5cd32f5200000000, 0xbe2ea7df00000000, + 0xd92e4f9200000000, 0x3bd3c71f00000000, 0xaf88c0ad00000000, + 0x4d75482000000000, 0x2a75a06d00000000, 0xc88828e000000000, + 0xe47570f600000000, 0x0688f87b00000000, 0x6188103600000000, + 0x837598bb00000000, 0x3972a11a00000000, 0xdb8f299700000000, + 0xbc8fc1da00000000, 0x5e72495700000000, 0x728f114100000000, + 0x907299cc00000000, 0xf772718100000000, 0x158ff90c00000000, + 0xc27b721800000000, 0x2086fa9500000000, 0x478612d800000000, + 0xa57b9a5500000000, 0x8986c24300000000, 0x6b7b4ace00000000, + 0x0c7ba28300000000, 0xee862a0e00000000, 0x548113af00000000, + 0xb67c9b2200000000, 0xd17c736f00000000, 0x3381fbe200000000, + 0x1f7ca3f400000000, 0xfd812b7900000000, 0x9a81c33400000000, + 0x787c4bb900000000, 0x3468d41d00000000, 0xd6955c9000000000, + 0xb195b4dd00000000, 0x53683c5000000000, 0x7f95644600000000, + 0x9d68eccb00000000, 0xfa68048600000000, 0x18958c0b00000000, + 0xa292b5aa00000000, 0x406f3d2700000000, 0x276fd56a00000000, + 0xc5925de700000000, 0xe96f05f100000000, 0x0b928d7c00000000, + 0x6c92653100000000, 0x8e6fedbc00000000, 0x599b66a800000000, + 0xbb66ee2500000000, 0xdc66066800000000, 0x3e9b8ee500000000, + 0x1266d6f300000000, 0xf09b5e7e00000000, 0x979bb63300000000, + 0x75663ebe00000000, 0xcf61071f00000000, 0x2d9c8f9200000000, + 0x4a9c67df00000000, 0xa861ef5200000000, 0x849cb74400000000, + 0x66613fc900000000, 0x0161d78400000000, 0xe39c5f0900000000, + 0xd84f981600000000, 0x3ab2109b00000000, 0x5db2f8d600000000, + 0xbf4f705b00000000, 0x93b2284d00000000, 0x714fa0c000000000, + 0x164f488d00000000, 0xf4b2c00000000000, 0x4eb5f9a100000000, + 0xac48712c00000000, 0xcb48996100000000, 0x29b511ec00000000, + 0x054849fa00000000, 0xe7b5c17700000000, 0x80b5293a00000000, + 0x6248a1b700000000, 0xb5bc2aa300000000, 0x5741a22e00000000, + 0x30414a6300000000, 0xd2bcc2ee00000000, 0xfe419af800000000, + 0x1cbc127500000000, 0x7bbcfa3800000000, 0x994172b500000000, + 0x23464b1400000000, 0xc1bbc39900000000, 0xa6bb2bd400000000, + 0x4446a35900000000, 0x68bbfb4f00000000, 0x8a4673c200000000, + 0xed469b8f00000000, 0x0fbb130200000000, 0x43af8ca600000000, + 0xa152042b00000000, 0xc652ec6600000000, 0x24af64eb00000000, + 0x08523cfd00000000, 0xeaafb47000000000, 0x8daf5c3d00000000, + 0x6f52d4b000000000, 0xd555ed1100000000, 0x37a8659c00000000, + 0x50a88dd100000000, 0xb255055c00000000, 0x9ea85d4a00000000, + 0x7c55d5c700000000, 0x1b553d8a00000000, 0xf9a8b50700000000, + 0x2e5c3e1300000000, 0xcca1b69e00000000, 0xaba15ed300000000, + 0x495cd65e00000000, 0x65a18e4800000000, 0x875c06c500000000, + 0xe05cee8800000000, 0x02a1660500000000, 0xb8a65fa400000000, + 0x5a5bd72900000000, 0x3d5b3f6400000000, 0xdfa6b7e900000000, + 0xf35befff00000000, 0x11a6677200000000, 0x76a68f3f00000000, + 0x945b07b200000000}, + {0x0000000000000000, 0xa90b894e00000000, 0x5217129d00000000, + 0xfb1c9bd300000000, 0xe52855e100000000, 0x4c23dcaf00000000, + 0xb73f477c00000000, 0x1e34ce3200000000, 0x8b57db1900000000, + 0x225c525700000000, 0xd940c98400000000, 0x704b40ca00000000, + 0x6e7f8ef800000000, 0xc77407b600000000, 0x3c689c6500000000, + 0x9563152b00000000, 0x16afb63300000000, 0xbfa43f7d00000000, + 0x44b8a4ae00000000, 0xedb32de000000000, 0xf387e3d200000000, + 0x5a8c6a9c00000000, 0xa190f14f00000000, 0x089b780100000000, + 0x9df86d2a00000000, 0x34f3e46400000000, 0xcfef7fb700000000, + 0x66e4f6f900000000, 0x78d038cb00000000, 0xd1dbb18500000000, + 0x2ac72a5600000000, 0x83cca31800000000, 0x2c5e6d6700000000, + 0x8555e42900000000, 0x7e497ffa00000000, 0xd742f6b400000000, + 0xc976388600000000, 0x607db1c800000000, 0x9b612a1b00000000, + 0x326aa35500000000, 0xa709b67e00000000, 0x0e023f3000000000, + 0xf51ea4e300000000, 0x5c152dad00000000, 0x4221e39f00000000, + 0xeb2a6ad100000000, 0x1036f10200000000, 0xb93d784c00000000, + 0x3af1db5400000000, 0x93fa521a00000000, 0x68e6c9c900000000, + 0xc1ed408700000000, 0xdfd98eb500000000, 0x76d207fb00000000, + 0x8dce9c2800000000, 0x24c5156600000000, 0xb1a6004d00000000, + 0x18ad890300000000, 0xe3b112d000000000, 0x4aba9b9e00000000, + 0x548e55ac00000000, 0xfd85dce200000000, 0x0699473100000000, + 0xaf92ce7f00000000, 0x58bcdace00000000, 0xf1b7538000000000, + 0x0aabc85300000000, 0xa3a0411d00000000, 0xbd948f2f00000000, + 0x149f066100000000, 0xef839db200000000, 0x468814fc00000000, + 0xd3eb01d700000000, 0x7ae0889900000000, 0x81fc134a00000000, + 0x28f79a0400000000, 0x36c3543600000000, 0x9fc8dd7800000000, + 0x64d446ab00000000, 0xcddfcfe500000000, 0x4e136cfd00000000, + 0xe718e5b300000000, 0x1c047e6000000000, 0xb50ff72e00000000, + 0xab3b391c00000000, 0x0230b05200000000, 0xf92c2b8100000000, + 0x5027a2cf00000000, 0xc544b7e400000000, 0x6c4f3eaa00000000, + 0x9753a57900000000, 0x3e582c3700000000, 0x206ce20500000000, + 0x89676b4b00000000, 0x727bf09800000000, 0xdb7079d600000000, + 0x74e2b7a900000000, 0xdde93ee700000000, 0x26f5a53400000000, + 0x8ffe2c7a00000000, 0x91cae24800000000, 0x38c16b0600000000, + 0xc3ddf0d500000000, 0x6ad6799b00000000, 0xffb56cb000000000, + 0x56bee5fe00000000, 0xada27e2d00000000, 0x04a9f76300000000, + 0x1a9d395100000000, 0xb396b01f00000000, 0x488a2bcc00000000, + 0xe181a28200000000, 0x624d019a00000000, 0xcb4688d400000000, + 0x305a130700000000, 0x99519a4900000000, 0x8765547b00000000, + 0x2e6edd3500000000, 0xd57246e600000000, 0x7c79cfa800000000, + 0xe91ada8300000000, 0x401153cd00000000, 0xbb0dc81e00000000, + 0x1206415000000000, 0x0c328f6200000000, 0xa539062c00000000, + 0x5e259dff00000000, 0xf72e14b100000000, 0xf17ec44600000000, + 0x58754d0800000000, 0xa369d6db00000000, 0x0a625f9500000000, + 0x145691a700000000, 0xbd5d18e900000000, 0x4641833a00000000, + 0xef4a0a7400000000, 0x7a291f5f00000000, 0xd322961100000000, + 0x283e0dc200000000, 0x8135848c00000000, 0x9f014abe00000000, + 0x360ac3f000000000, 0xcd16582300000000, 0x641dd16d00000000, + 0xe7d1727500000000, 0x4edafb3b00000000, 0xb5c660e800000000, + 0x1ccde9a600000000, 0x02f9279400000000, 0xabf2aeda00000000, + 0x50ee350900000000, 0xf9e5bc4700000000, 0x6c86a96c00000000, + 0xc58d202200000000, 0x3e91bbf100000000, 0x979a32bf00000000, + 0x89aefc8d00000000, 0x20a575c300000000, 0xdbb9ee1000000000, + 0x72b2675e00000000, 0xdd20a92100000000, 0x742b206f00000000, + 0x8f37bbbc00000000, 0x263c32f200000000, 0x3808fcc000000000, + 0x9103758e00000000, 0x6a1fee5d00000000, 0xc314671300000000, + 0x5677723800000000, 0xff7cfb7600000000, 0x046060a500000000, + 0xad6be9eb00000000, 0xb35f27d900000000, 0x1a54ae9700000000, + 0xe148354400000000, 0x4843bc0a00000000, 0xcb8f1f1200000000, + 0x6284965c00000000, 0x99980d8f00000000, 0x309384c100000000, + 0x2ea74af300000000, 0x87acc3bd00000000, 0x7cb0586e00000000, + 0xd5bbd12000000000, 0x40d8c40b00000000, 0xe9d34d4500000000, + 0x12cfd69600000000, 0xbbc45fd800000000, 0xa5f091ea00000000, + 0x0cfb18a400000000, 0xf7e7837700000000, 0x5eec0a3900000000, + 0xa9c21e8800000000, 0x00c997c600000000, 0xfbd50c1500000000, + 0x52de855b00000000, 0x4cea4b6900000000, 0xe5e1c22700000000, + 0x1efd59f400000000, 0xb7f6d0ba00000000, 0x2295c59100000000, + 0x8b9e4cdf00000000, 0x7082d70c00000000, 0xd9895e4200000000, + 0xc7bd907000000000, 0x6eb6193e00000000, 0x95aa82ed00000000, + 0x3ca10ba300000000, 0xbf6da8bb00000000, 0x166621f500000000, + 0xed7aba2600000000, 0x4471336800000000, 0x5a45fd5a00000000, + 0xf34e741400000000, 0x0852efc700000000, 0xa159668900000000, + 0x343a73a200000000, 0x9d31faec00000000, 0x662d613f00000000, + 0xcf26e87100000000, 0xd112264300000000, 0x7819af0d00000000, + 0x830534de00000000, 0x2a0ebd9000000000, 0x859c73ef00000000, + 0x2c97faa100000000, 0xd78b617200000000, 0x7e80e83c00000000, + 0x60b4260e00000000, 0xc9bfaf4000000000, 0x32a3349300000000, + 0x9ba8bddd00000000, 0x0ecba8f600000000, 0xa7c021b800000000, + 0x5cdcba6b00000000, 0xf5d7332500000000, 0xebe3fd1700000000, + 0x42e8745900000000, 0xb9f4ef8a00000000, 0x10ff66c400000000, + 0x9333c5dc00000000, 0x3a384c9200000000, 0xc124d74100000000, + 0x682f5e0f00000000, 0x761b903d00000000, 0xdf10197300000000, + 0x240c82a000000000, 0x8d070bee00000000, 0x18641ec500000000, + 0xb16f978b00000000, 0x4a730c5800000000, 0xe378851600000000, + 0xfd4c4b2400000000, 0x5447c26a00000000, 0xaf5b59b900000000, + 0x0650d0f700000000}, + {0x0000000000000000, 0x479244af00000000, 0xcf22f88500000000, + 0x88b0bc2a00000000, 0xdf4381d000000000, 0x98d1c57f00000000, + 0x1061795500000000, 0x57f33dfa00000000, 0xff81737a00000000, + 0xb81337d500000000, 0x30a38bff00000000, 0x7731cf5000000000, + 0x20c2f2aa00000000, 0x6750b60500000000, 0xefe00a2f00000000, + 0xa8724e8000000000, 0xfe03e7f400000000, 0xb991a35b00000000, + 0x31211f7100000000, 0x76b35bde00000000, 0x2140662400000000, + 0x66d2228b00000000, 0xee629ea100000000, 0xa9f0da0e00000000, + 0x0182948e00000000, 0x4610d02100000000, 0xcea06c0b00000000, + 0x893228a400000000, 0xdec1155e00000000, 0x995351f100000000, + 0x11e3eddb00000000, 0x5671a97400000000, 0xbd01bf3200000000, + 0xfa93fb9d00000000, 0x722347b700000000, 0x35b1031800000000, + 0x62423ee200000000, 0x25d07a4d00000000, 0xad60c66700000000, + 0xeaf282c800000000, 0x4280cc4800000000, 0x051288e700000000, + 0x8da234cd00000000, 0xca30706200000000, 0x9dc34d9800000000, + 0xda51093700000000, 0x52e1b51d00000000, 0x1573f1b200000000, + 0x430258c600000000, 0x04901c6900000000, 0x8c20a04300000000, + 0xcbb2e4ec00000000, 0x9c41d91600000000, 0xdbd39db900000000, + 0x5363219300000000, 0x14f1653c00000000, 0xbc832bbc00000000, + 0xfb116f1300000000, 0x73a1d33900000000, 0x3433979600000000, + 0x63c0aa6c00000000, 0x2452eec300000000, 0xace252e900000000, + 0xeb70164600000000, 0x7a037e6500000000, 0x3d913aca00000000, + 0xb52186e000000000, 0xf2b3c24f00000000, 0xa540ffb500000000, + 0xe2d2bb1a00000000, 0x6a62073000000000, 0x2df0439f00000000, + 0x85820d1f00000000, 0xc21049b000000000, 0x4aa0f59a00000000, + 0x0d32b13500000000, 0x5ac18ccf00000000, 0x1d53c86000000000, + 0x95e3744a00000000, 0xd27130e500000000, 0x8400999100000000, + 0xc392dd3e00000000, 0x4b22611400000000, 0x0cb025bb00000000, + 0x5b43184100000000, 0x1cd15cee00000000, 0x9461e0c400000000, + 0xd3f3a46b00000000, 0x7b81eaeb00000000, 0x3c13ae4400000000, + 0xb4a3126e00000000, 0xf33156c100000000, 0xa4c26b3b00000000, + 0xe3502f9400000000, 0x6be093be00000000, 0x2c72d71100000000, + 0xc702c15700000000, 0x809085f800000000, 0x082039d200000000, + 0x4fb27d7d00000000, 0x1841408700000000, 0x5fd3042800000000, + 0xd763b80200000000, 0x90f1fcad00000000, 0x3883b22d00000000, + 0x7f11f68200000000, 0xf7a14aa800000000, 0xb0330e0700000000, + 0xe7c033fd00000000, 0xa052775200000000, 0x28e2cb7800000000, + 0x6f708fd700000000, 0x390126a300000000, 0x7e93620c00000000, + 0xf623de2600000000, 0xb1b19a8900000000, 0xe642a77300000000, + 0xa1d0e3dc00000000, 0x29605ff600000000, 0x6ef21b5900000000, + 0xc68055d900000000, 0x8112117600000000, 0x09a2ad5c00000000, + 0x4e30e9f300000000, 0x19c3d40900000000, 0x5e5190a600000000, + 0xd6e12c8c00000000, 0x9173682300000000, 0xf406fcca00000000, + 0xb394b86500000000, 0x3b24044f00000000, 0x7cb640e000000000, + 0x2b457d1a00000000, 0x6cd739b500000000, 0xe467859f00000000, + 0xa3f5c13000000000, 0x0b878fb000000000, 0x4c15cb1f00000000, + 0xc4a5773500000000, 0x8337339a00000000, 0xd4c40e6000000000, + 0x93564acf00000000, 0x1be6f6e500000000, 0x5c74b24a00000000, + 0x0a051b3e00000000, 0x4d975f9100000000, 0xc527e3bb00000000, + 0x82b5a71400000000, 0xd5469aee00000000, 0x92d4de4100000000, + 0x1a64626b00000000, 0x5df626c400000000, 0xf584684400000000, + 0xb2162ceb00000000, 0x3aa690c100000000, 0x7d34d46e00000000, + 0x2ac7e99400000000, 0x6d55ad3b00000000, 0xe5e5111100000000, + 0xa27755be00000000, 0x490743f800000000, 0x0e95075700000000, + 0x8625bb7d00000000, 0xc1b7ffd200000000, 0x9644c22800000000, + 0xd1d6868700000000, 0x59663aad00000000, 0x1ef47e0200000000, + 0xb686308200000000, 0xf114742d00000000, 0x79a4c80700000000, + 0x3e368ca800000000, 0x69c5b15200000000, 0x2e57f5fd00000000, + 0xa6e749d700000000, 0xe1750d7800000000, 0xb704a40c00000000, + 0xf096e0a300000000, 0x78265c8900000000, 0x3fb4182600000000, + 0x684725dc00000000, 0x2fd5617300000000, 0xa765dd5900000000, + 0xe0f799f600000000, 0x4885d77600000000, 0x0f1793d900000000, + 0x87a72ff300000000, 0xc0356b5c00000000, 0x97c656a600000000, + 0xd054120900000000, 0x58e4ae2300000000, 0x1f76ea8c00000000, + 0x8e0582af00000000, 0xc997c60000000000, 0x41277a2a00000000, + 0x06b53e8500000000, 0x5146037f00000000, 0x16d447d000000000, + 0x9e64fbfa00000000, 0xd9f6bf5500000000, 0x7184f1d500000000, + 0x3616b57a00000000, 0xbea6095000000000, 0xf9344dff00000000, + 0xaec7700500000000, 0xe95534aa00000000, 0x61e5888000000000, + 0x2677cc2f00000000, 0x7006655b00000000, 0x379421f400000000, + 0xbf249dde00000000, 0xf8b6d97100000000, 0xaf45e48b00000000, + 0xe8d7a02400000000, 0x60671c0e00000000, 0x27f558a100000000, + 0x8f87162100000000, 0xc815528e00000000, 0x40a5eea400000000, + 0x0737aa0b00000000, 0x50c497f100000000, 0x1756d35e00000000, + 0x9fe66f7400000000, 0xd8742bdb00000000, 0x33043d9d00000000, + 0x7496793200000000, 0xfc26c51800000000, 0xbbb481b700000000, + 0xec47bc4d00000000, 0xabd5f8e200000000, 0x236544c800000000, + 0x64f7006700000000, 0xcc854ee700000000, 0x8b170a4800000000, + 0x03a7b66200000000, 0x4435f2cd00000000, 0x13c6cf3700000000, + 0x54548b9800000000, 0xdce437b200000000, 0x9b76731d00000000, + 0xcd07da6900000000, 0x8a959ec600000000, 0x022522ec00000000, + 0x45b7664300000000, 0x12445bb900000000, 0x55d61f1600000000, + 0xdd66a33c00000000, 0x9af4e79300000000, 0x3286a91300000000, + 0x7514edbc00000000, 0xfda4519600000000, 0xba36153900000000, + 0xedc528c300000000, 0xaa576c6c00000000, 0x22e7d04600000000, + 0x657594e900000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x65673b46, 0xcace768c, 0xafa94dca, 0x4eedeb59, + 0x2b8ad01f, 0x84239dd5, 0xe144a693, 0x9ddbd6b2, 0xf8bcedf4, + 0x5715a03e, 0x32729b78, 0xd3363deb, 0xb65106ad, 0x19f84b67, + 0x7c9f7021, 0xe0c6ab25, 0x85a19063, 0x2a08dda9, 0x4f6fe6ef, + 0xae2b407c, 0xcb4c7b3a, 0x64e536f0, 0x01820db6, 0x7d1d7d97, + 0x187a46d1, 0xb7d30b1b, 0xd2b4305d, 0x33f096ce, 0x5697ad88, + 0xf93ee042, 0x9c59db04, 0x1afc500b, 0x7f9b6b4d, 0xd0322687, + 0xb5551dc1, 0x5411bb52, 0x31768014, 0x9edfcdde, 0xfbb8f698, + 0x872786b9, 0xe240bdff, 0x4de9f035, 0x288ecb73, 0xc9ca6de0, + 0xacad56a6, 0x03041b6c, 0x6663202a, 0xfa3afb2e, 0x9f5dc068, + 0x30f48da2, 0x5593b6e4, 0xb4d71077, 0xd1b02b31, 0x7e1966fb, + 0x1b7e5dbd, 0x67e12d9c, 0x028616da, 0xad2f5b10, 0xc8486056, + 0x290cc6c5, 0x4c6bfd83, 0xe3c2b049, 0x86a58b0f, 0x35f8a016, + 0x509f9b50, 0xff36d69a, 0x9a51eddc, 0x7b154b4f, 0x1e727009, + 0xb1db3dc3, 0xd4bc0685, 0xa82376a4, 0xcd444de2, 0x62ed0028, + 0x078a3b6e, 0xe6ce9dfd, 0x83a9a6bb, 0x2c00eb71, 0x4967d037, + 0xd53e0b33, 0xb0593075, 0x1ff07dbf, 0x7a9746f9, 0x9bd3e06a, + 0xfeb4db2c, 0x511d96e6, 0x347aada0, 0x48e5dd81, 0x2d82e6c7, + 0x822bab0d, 0xe74c904b, 0x060836d8, 0x636f0d9e, 0xccc64054, + 0xa9a17b12, 0x2f04f01d, 0x4a63cb5b, 0xe5ca8691, 0x80adbdd7, + 0x61e91b44, 0x048e2002, 0xab276dc8, 0xce40568e, 0xb2df26af, + 0xd7b81de9, 0x78115023, 0x1d766b65, 0xfc32cdf6, 0x9955f6b0, + 0x36fcbb7a, 0x539b803c, 0xcfc25b38, 0xaaa5607e, 0x050c2db4, + 0x606b16f2, 0x812fb061, 0xe4488b27, 0x4be1c6ed, 0x2e86fdab, + 0x52198d8a, 0x377eb6cc, 0x98d7fb06, 0xfdb0c040, 0x1cf466d3, + 0x79935d95, 0xd63a105f, 0xb35d2b19, 0x6bf1402c, 0x0e967b6a, + 0xa13f36a0, 0xc4580de6, 0x251cab75, 0x407b9033, 0xefd2ddf9, + 0x8ab5e6bf, 0xf62a969e, 0x934dadd8, 0x3ce4e012, 0x5983db54, + 0xb8c77dc7, 0xdda04681, 0x72090b4b, 0x176e300d, 0x8b37eb09, + 0xee50d04f, 0x41f99d85, 0x249ea6c3, 0xc5da0050, 0xa0bd3b16, + 0x0f1476dc, 0x6a734d9a, 0x16ec3dbb, 0x738b06fd, 0xdc224b37, + 0xb9457071, 0x5801d6e2, 0x3d66eda4, 0x92cfa06e, 0xf7a89b28, + 0x710d1027, 0x146a2b61, 0xbbc366ab, 0xdea45ded, 0x3fe0fb7e, + 0x5a87c038, 0xf52e8df2, 0x9049b6b4, 0xecd6c695, 0x89b1fdd3, + 0x2618b019, 0x437f8b5f, 0xa23b2dcc, 0xc75c168a, 0x68f55b40, + 0x0d926006, 0x91cbbb02, 0xf4ac8044, 0x5b05cd8e, 0x3e62f6c8, + 0xdf26505b, 0xba416b1d, 0x15e826d7, 0x708f1d91, 0x0c106db0, + 0x697756f6, 0xc6de1b3c, 0xa3b9207a, 0x42fd86e9, 0x279abdaf, + 0x8833f065, 0xed54cb23, 0x5e09e03a, 0x3b6edb7c, 0x94c796b6, + 0xf1a0adf0, 0x10e40b63, 0x75833025, 0xda2a7def, 0xbf4d46a9, + 0xc3d23688, 0xa6b50dce, 0x091c4004, 0x6c7b7b42, 0x8d3fddd1, + 0xe858e697, 0x47f1ab5d, 0x2296901b, 0xbecf4b1f, 0xdba87059, + 0x74013d93, 0x116606d5, 0xf022a046, 0x95459b00, 0x3aecd6ca, + 0x5f8bed8c, 0x23149dad, 0x4673a6eb, 0xe9daeb21, 0x8cbdd067, + 0x6df976f4, 0x089e4db2, 0xa7370078, 0xc2503b3e, 0x44f5b031, + 0x21928b77, 0x8e3bc6bd, 0xeb5cfdfb, 0x0a185b68, 0x6f7f602e, + 0xc0d62de4, 0xa5b116a2, 0xd92e6683, 0xbc495dc5, 0x13e0100f, + 0x76872b49, 0x97c38dda, 0xf2a4b69c, 0x5d0dfb56, 0x386ac010, + 0xa4331b14, 0xc1542052, 0x6efd6d98, 0x0b9a56de, 0xeadef04d, + 0x8fb9cb0b, 0x201086c1, 0x4577bd87, 0x39e8cda6, 0x5c8ff6e0, + 0xf326bb2a, 0x9641806c, 0x770526ff, 0x12621db9, 0xbdcb5073, + 0xd8ac6b35}, + {0x00000000, 0xd7e28058, 0x74b406f1, 0xa35686a9, 0xe9680de2, + 0x3e8a8dba, 0x9ddc0b13, 0x4a3e8b4b, 0x09a11d85, 0xde439ddd, + 0x7d151b74, 0xaaf79b2c, 0xe0c91067, 0x372b903f, 0x947d1696, + 0x439f96ce, 0x13423b0a, 0xc4a0bb52, 0x67f63dfb, 0xb014bda3, + 0xfa2a36e8, 0x2dc8b6b0, 0x8e9e3019, 0x597cb041, 0x1ae3268f, + 0xcd01a6d7, 0x6e57207e, 0xb9b5a026, 0xf38b2b6d, 0x2469ab35, + 0x873f2d9c, 0x50ddadc4, 0x26847614, 0xf166f64c, 0x523070e5, + 0x85d2f0bd, 0xcfec7bf6, 0x180efbae, 0xbb587d07, 0x6cbafd5f, + 0x2f256b91, 0xf8c7ebc9, 0x5b916d60, 0x8c73ed38, 0xc64d6673, + 0x11afe62b, 0xb2f96082, 0x651be0da, 0x35c64d1e, 0xe224cd46, + 0x41724bef, 0x9690cbb7, 0xdcae40fc, 0x0b4cc0a4, 0xa81a460d, + 0x7ff8c655, 0x3c67509b, 0xeb85d0c3, 0x48d3566a, 0x9f31d632, + 0xd50f5d79, 0x02eddd21, 0xa1bb5b88, 0x7659dbd0, 0x4d08ec28, + 0x9aea6c70, 0x39bcead9, 0xee5e6a81, 0xa460e1ca, 0x73826192, + 0xd0d4e73b, 0x07366763, 0x44a9f1ad, 0x934b71f5, 0x301df75c, + 0xe7ff7704, 0xadc1fc4f, 0x7a237c17, 0xd975fabe, 0x0e977ae6, + 0x5e4ad722, 0x89a8577a, 0x2afed1d3, 0xfd1c518b, 0xb722dac0, + 0x60c05a98, 0xc396dc31, 0x14745c69, 0x57ebcaa7, 0x80094aff, + 0x235fcc56, 0xf4bd4c0e, 0xbe83c745, 0x6961471d, 0xca37c1b4, + 0x1dd541ec, 0x6b8c9a3c, 0xbc6e1a64, 0x1f389ccd, 0xc8da1c95, + 0x82e497de, 0x55061786, 0xf650912f, 0x21b21177, 0x622d87b9, + 0xb5cf07e1, 0x16998148, 0xc17b0110, 0x8b458a5b, 0x5ca70a03, + 0xfff18caa, 0x28130cf2, 0x78cea136, 0xaf2c216e, 0x0c7aa7c7, + 0xdb98279f, 0x91a6acd4, 0x46442c8c, 0xe512aa25, 0x32f02a7d, + 0x716fbcb3, 0xa68d3ceb, 0x05dbba42, 0xd2393a1a, 0x9807b151, + 0x4fe53109, 0xecb3b7a0, 0x3b5137f8, 0x9a11d850, 0x4df35808, + 0xeea5dea1, 0x39475ef9, 0x7379d5b2, 0xa49b55ea, 0x07cdd343, + 0xd02f531b, 0x93b0c5d5, 0x4452458d, 0xe704c324, 0x30e6437c, + 0x7ad8c837, 0xad3a486f, 0x0e6ccec6, 0xd98e4e9e, 0x8953e35a, + 0x5eb16302, 0xfde7e5ab, 0x2a0565f3, 0x603beeb8, 0xb7d96ee0, + 0x148fe849, 0xc36d6811, 0x80f2fedf, 0x57107e87, 0xf446f82e, + 0x23a47876, 0x699af33d, 0xbe787365, 0x1d2ef5cc, 0xcacc7594, + 0xbc95ae44, 0x6b772e1c, 0xc821a8b5, 0x1fc328ed, 0x55fda3a6, + 0x821f23fe, 0x2149a557, 0xf6ab250f, 0xb534b3c1, 0x62d63399, + 0xc180b530, 0x16623568, 0x5c5cbe23, 0x8bbe3e7b, 0x28e8b8d2, + 0xff0a388a, 0xafd7954e, 0x78351516, 0xdb6393bf, 0x0c8113e7, + 0x46bf98ac, 0x915d18f4, 0x320b9e5d, 0xe5e91e05, 0xa67688cb, + 0x71940893, 0xd2c28e3a, 0x05200e62, 0x4f1e8529, 0x98fc0571, + 0x3baa83d8, 0xec480380, 0xd7193478, 0x00fbb420, 0xa3ad3289, + 0x744fb2d1, 0x3e71399a, 0xe993b9c2, 0x4ac53f6b, 0x9d27bf33, + 0xdeb829fd, 0x095aa9a5, 0xaa0c2f0c, 0x7deeaf54, 0x37d0241f, + 0xe032a447, 0x436422ee, 0x9486a2b6, 0xc45b0f72, 0x13b98f2a, + 0xb0ef0983, 0x670d89db, 0x2d330290, 0xfad182c8, 0x59870461, + 0x8e658439, 0xcdfa12f7, 0x1a1892af, 0xb94e1406, 0x6eac945e, + 0x24921f15, 0xf3709f4d, 0x502619e4, 0x87c499bc, 0xf19d426c, + 0x267fc234, 0x8529449d, 0x52cbc4c5, 0x18f54f8e, 0xcf17cfd6, + 0x6c41497f, 0xbba3c927, 0xf83c5fe9, 0x2fdedfb1, 0x8c885918, + 0x5b6ad940, 0x1154520b, 0xc6b6d253, 0x65e054fa, 0xb202d4a2, + 0xe2df7966, 0x353df93e, 0x966b7f97, 0x4189ffcf, 0x0bb77484, + 0xdc55f4dc, 0x7f037275, 0xa8e1f22d, 0xeb7e64e3, 0x3c9ce4bb, + 0x9fca6212, 0x4828e24a, 0x02166901, 0xd5f4e959, 0x76a26ff0, + 0xa140efa8}, + {0x00000000, 0xef52b6e1, 0x05d46b83, 0xea86dd62, 0x0ba8d706, + 0xe4fa61e7, 0x0e7cbc85, 0xe12e0a64, 0x1751ae0c, 0xf80318ed, + 0x1285c58f, 0xfdd7736e, 0x1cf9790a, 0xf3abcfeb, 0x192d1289, + 0xf67fa468, 0x2ea35c18, 0xc1f1eaf9, 0x2b77379b, 0xc425817a, + 0x250b8b1e, 0xca593dff, 0x20dfe09d, 0xcf8d567c, 0x39f2f214, + 0xd6a044f5, 0x3c269997, 0xd3742f76, 0x325a2512, 0xdd0893f3, + 0x378e4e91, 0xd8dcf870, 0x5d46b830, 0xb2140ed1, 0x5892d3b3, + 0xb7c06552, 0x56ee6f36, 0xb9bcd9d7, 0x533a04b5, 0xbc68b254, + 0x4a17163c, 0xa545a0dd, 0x4fc37dbf, 0xa091cb5e, 0x41bfc13a, + 0xaeed77db, 0x446baab9, 0xab391c58, 0x73e5e428, 0x9cb752c9, + 0x76318fab, 0x9963394a, 0x784d332e, 0x971f85cf, 0x7d9958ad, + 0x92cbee4c, 0x64b44a24, 0x8be6fcc5, 0x616021a7, 0x8e329746, + 0x6f1c9d22, 0x804e2bc3, 0x6ac8f6a1, 0x859a4040, 0xba8d7060, + 0x55dfc681, 0xbf591be3, 0x500bad02, 0xb125a766, 0x5e771187, + 0xb4f1cce5, 0x5ba37a04, 0xaddcde6c, 0x428e688d, 0xa808b5ef, + 0x475a030e, 0xa674096a, 0x4926bf8b, 0xa3a062e9, 0x4cf2d408, + 0x942e2c78, 0x7b7c9a99, 0x91fa47fb, 0x7ea8f11a, 0x9f86fb7e, + 0x70d44d9f, 0x9a5290fd, 0x7500261c, 0x837f8274, 0x6c2d3495, + 0x86abe9f7, 0x69f95f16, 0x88d75572, 0x6785e393, 0x8d033ef1, + 0x62518810, 0xe7cbc850, 0x08997eb1, 0xe21fa3d3, 0x0d4d1532, + 0xec631f56, 0x0331a9b7, 0xe9b774d5, 0x06e5c234, 0xf09a665c, + 0x1fc8d0bd, 0xf54e0ddf, 0x1a1cbb3e, 0xfb32b15a, 0x146007bb, + 0xfee6dad9, 0x11b46c38, 0xc9689448, 0x263a22a9, 0xccbcffcb, + 0x23ee492a, 0xc2c0434e, 0x2d92f5af, 0xc71428cd, 0x28469e2c, + 0xde393a44, 0x316b8ca5, 0xdbed51c7, 0x34bfe726, 0xd591ed42, + 0x3ac35ba3, 0xd04586c1, 0x3f173020, 0xae6be681, 0x41395060, + 0xabbf8d02, 0x44ed3be3, 0xa5c33187, 0x4a918766, 0xa0175a04, + 0x4f45ece5, 0xb93a488d, 0x5668fe6c, 0xbcee230e, 0x53bc95ef, + 0xb2929f8b, 0x5dc0296a, 0xb746f408, 0x581442e9, 0x80c8ba99, + 0x6f9a0c78, 0x851cd11a, 0x6a4e67fb, 0x8b606d9f, 0x6432db7e, + 0x8eb4061c, 0x61e6b0fd, 0x97991495, 0x78cba274, 0x924d7f16, + 0x7d1fc9f7, 0x9c31c393, 0x73637572, 0x99e5a810, 0x76b71ef1, + 0xf32d5eb1, 0x1c7fe850, 0xf6f93532, 0x19ab83d3, 0xf88589b7, + 0x17d73f56, 0xfd51e234, 0x120354d5, 0xe47cf0bd, 0x0b2e465c, + 0xe1a89b3e, 0x0efa2ddf, 0xefd427bb, 0x0086915a, 0xea004c38, + 0x0552fad9, 0xdd8e02a9, 0x32dcb448, 0xd85a692a, 0x3708dfcb, + 0xd626d5af, 0x3974634e, 0xd3f2be2c, 0x3ca008cd, 0xcadfaca5, + 0x258d1a44, 0xcf0bc726, 0x205971c7, 0xc1777ba3, 0x2e25cd42, + 0xc4a31020, 0x2bf1a6c1, 0x14e696e1, 0xfbb42000, 0x1132fd62, + 0xfe604b83, 0x1f4e41e7, 0xf01cf706, 0x1a9a2a64, 0xf5c89c85, + 0x03b738ed, 0xece58e0c, 0x0663536e, 0xe931e58f, 0x081fefeb, + 0xe74d590a, 0x0dcb8468, 0xe2993289, 0x3a45caf9, 0xd5177c18, + 0x3f91a17a, 0xd0c3179b, 0x31ed1dff, 0xdebfab1e, 0x3439767c, + 0xdb6bc09d, 0x2d1464f5, 0xc246d214, 0x28c00f76, 0xc792b997, + 0x26bcb3f3, 0xc9ee0512, 0x2368d870, 0xcc3a6e91, 0x49a02ed1, + 0xa6f29830, 0x4c744552, 0xa326f3b3, 0x4208f9d7, 0xad5a4f36, + 0x47dc9254, 0xa88e24b5, 0x5ef180dd, 0xb1a3363c, 0x5b25eb5e, + 0xb4775dbf, 0x555957db, 0xba0be13a, 0x508d3c58, 0xbfdf8ab9, + 0x670372c9, 0x8851c428, 0x62d7194a, 0x8d85afab, 0x6caba5cf, + 0x83f9132e, 0x697fce4c, 0x862d78ad, 0x7052dcc5, 0x9f006a24, + 0x7586b746, 0x9ad401a7, 0x7bfa0bc3, 0x94a8bd22, 0x7e2e6040, + 0x917cd6a1}, + {0x00000000, 0x87a6cb43, 0xd43c90c7, 0x539a5b84, 0x730827cf, + 0xf4aeec8c, 0xa734b708, 0x20927c4b, 0xe6104f9e, 0x61b684dd, + 0x322cdf59, 0xb58a141a, 0x95186851, 0x12bea312, 0x4124f896, + 0xc68233d5, 0x1751997d, 0x90f7523e, 0xc36d09ba, 0x44cbc2f9, + 0x6459beb2, 0xe3ff75f1, 0xb0652e75, 0x37c3e536, 0xf141d6e3, + 0x76e71da0, 0x257d4624, 0xa2db8d67, 0x8249f12c, 0x05ef3a6f, + 0x567561eb, 0xd1d3aaa8, 0x2ea332fa, 0xa905f9b9, 0xfa9fa23d, + 0x7d39697e, 0x5dab1535, 0xda0dde76, 0x899785f2, 0x0e314eb1, + 0xc8b37d64, 0x4f15b627, 0x1c8feda3, 0x9b2926e0, 0xbbbb5aab, + 0x3c1d91e8, 0x6f87ca6c, 0xe821012f, 0x39f2ab87, 0xbe5460c4, + 0xedce3b40, 0x6a68f003, 0x4afa8c48, 0xcd5c470b, 0x9ec61c8f, + 0x1960d7cc, 0xdfe2e419, 0x58442f5a, 0x0bde74de, 0x8c78bf9d, + 0xaceac3d6, 0x2b4c0895, 0x78d65311, 0xff709852, 0x5d4665f4, + 0xdae0aeb7, 0x897af533, 0x0edc3e70, 0x2e4e423b, 0xa9e88978, + 0xfa72d2fc, 0x7dd419bf, 0xbb562a6a, 0x3cf0e129, 0x6f6abaad, + 0xe8cc71ee, 0xc85e0da5, 0x4ff8c6e6, 0x1c629d62, 0x9bc45621, + 0x4a17fc89, 0xcdb137ca, 0x9e2b6c4e, 0x198da70d, 0x391fdb46, + 0xbeb91005, 0xed234b81, 0x6a8580c2, 0xac07b317, 0x2ba17854, + 0x783b23d0, 0xff9de893, 0xdf0f94d8, 0x58a95f9b, 0x0b33041f, + 0x8c95cf5c, 0x73e5570e, 0xf4439c4d, 0xa7d9c7c9, 0x207f0c8a, + 0x00ed70c1, 0x874bbb82, 0xd4d1e006, 0x53772b45, 0x95f51890, + 0x1253d3d3, 0x41c98857, 0xc66f4314, 0xe6fd3f5f, 0x615bf41c, + 0x32c1af98, 0xb56764db, 0x64b4ce73, 0xe3120530, 0xb0885eb4, + 0x372e95f7, 0x17bce9bc, 0x901a22ff, 0xc380797b, 0x4426b238, + 0x82a481ed, 0x05024aae, 0x5698112a, 0xd13eda69, 0xf1aca622, + 0x760a6d61, 0x259036e5, 0xa236fda6, 0xba8ccbe8, 0x3d2a00ab, + 0x6eb05b2f, 0xe916906c, 0xc984ec27, 0x4e222764, 0x1db87ce0, + 0x9a1eb7a3, 0x5c9c8476, 0xdb3a4f35, 0x88a014b1, 0x0f06dff2, + 0x2f94a3b9, 0xa83268fa, 0xfba8337e, 0x7c0ef83d, 0xaddd5295, + 0x2a7b99d6, 0x79e1c252, 0xfe470911, 0xded5755a, 0x5973be19, + 0x0ae9e59d, 0x8d4f2ede, 0x4bcd1d0b, 0xcc6bd648, 0x9ff18dcc, + 0x1857468f, 0x38c53ac4, 0xbf63f187, 0xecf9aa03, 0x6b5f6140, + 0x942ff912, 0x13893251, 0x401369d5, 0xc7b5a296, 0xe727dedd, + 0x6081159e, 0x331b4e1a, 0xb4bd8559, 0x723fb68c, 0xf5997dcf, + 0xa603264b, 0x21a5ed08, 0x01379143, 0x86915a00, 0xd50b0184, + 0x52adcac7, 0x837e606f, 0x04d8ab2c, 0x5742f0a8, 0xd0e43beb, + 0xf07647a0, 0x77d08ce3, 0x244ad767, 0xa3ec1c24, 0x656e2ff1, + 0xe2c8e4b2, 0xb152bf36, 0x36f47475, 0x1666083e, 0x91c0c37d, + 0xc25a98f9, 0x45fc53ba, 0xe7caae1c, 0x606c655f, 0x33f63edb, + 0xb450f598, 0x94c289d3, 0x13644290, 0x40fe1914, 0xc758d257, + 0x01dae182, 0x867c2ac1, 0xd5e67145, 0x5240ba06, 0x72d2c64d, + 0xf5740d0e, 0xa6ee568a, 0x21489dc9, 0xf09b3761, 0x773dfc22, + 0x24a7a7a6, 0xa3016ce5, 0x839310ae, 0x0435dbed, 0x57af8069, + 0xd0094b2a, 0x168b78ff, 0x912db3bc, 0xc2b7e838, 0x4511237b, + 0x65835f30, 0xe2259473, 0xb1bfcff7, 0x361904b4, 0xc9699ce6, + 0x4ecf57a5, 0x1d550c21, 0x9af3c762, 0xba61bb29, 0x3dc7706a, + 0x6e5d2bee, 0xe9fbe0ad, 0x2f79d378, 0xa8df183b, 0xfb4543bf, + 0x7ce388fc, 0x5c71f4b7, 0xdbd73ff4, 0x884d6470, 0x0febaf33, + 0xde38059b, 0x599eced8, 0x0a04955c, 0x8da25e1f, 0xad302254, + 0x2a96e917, 0x790cb293, 0xfeaa79d0, 0x38284a05, 0xbf8e8146, + 0xec14dac2, 0x6bb21181, 0x4b206dca, 0xcc86a689, 0x9f1cfd0d, + 0x18ba364e}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x43cba687, 0xc7903cd4, 0x845b9a53, 0xcf270873, + 0x8cecaef4, 0x08b734a7, 0x4b7c9220, 0x9e4f10e6, 0xdd84b661, + 0x59df2c32, 0x1a148ab5, 0x51681895, 0x12a3be12, 0x96f82441, + 0xd53382c6, 0x7d995117, 0x3e52f790, 0xba096dc3, 0xf9c2cb44, + 0xb2be5964, 0xf175ffe3, 0x752e65b0, 0x36e5c337, 0xe3d641f1, + 0xa01de776, 0x24467d25, 0x678ddba2, 0x2cf14982, 0x6f3aef05, + 0xeb617556, 0xa8aad3d1, 0xfa32a32e, 0xb9f905a9, 0x3da29ffa, + 0x7e69397d, 0x3515ab5d, 0x76de0dda, 0xf2859789, 0xb14e310e, + 0x647db3c8, 0x27b6154f, 0xa3ed8f1c, 0xe026299b, 0xab5abbbb, + 0xe8911d3c, 0x6cca876f, 0x2f0121e8, 0x87abf239, 0xc46054be, + 0x403bceed, 0x03f0686a, 0x488cfa4a, 0x0b475ccd, 0x8f1cc69e, + 0xccd76019, 0x19e4e2df, 0x5a2f4458, 0xde74de0b, 0x9dbf788c, + 0xd6c3eaac, 0x95084c2b, 0x1153d678, 0x529870ff, 0xf465465d, + 0xb7aee0da, 0x33f57a89, 0x703edc0e, 0x3b424e2e, 0x7889e8a9, + 0xfcd272fa, 0xbf19d47d, 0x6a2a56bb, 0x29e1f03c, 0xadba6a6f, + 0xee71cce8, 0xa50d5ec8, 0xe6c6f84f, 0x629d621c, 0x2156c49b, + 0x89fc174a, 0xca37b1cd, 0x4e6c2b9e, 0x0da78d19, 0x46db1f39, + 0x0510b9be, 0x814b23ed, 0xc280856a, 0x17b307ac, 0x5478a12b, + 0xd0233b78, 0x93e89dff, 0xd8940fdf, 0x9b5fa958, 0x1f04330b, + 0x5ccf958c, 0x0e57e573, 0x4d9c43f4, 0xc9c7d9a7, 0x8a0c7f20, + 0xc170ed00, 0x82bb4b87, 0x06e0d1d4, 0x452b7753, 0x9018f595, + 0xd3d35312, 0x5788c941, 0x14436fc6, 0x5f3ffde6, 0x1cf45b61, + 0x98afc132, 0xdb6467b5, 0x73ceb464, 0x300512e3, 0xb45e88b0, + 0xf7952e37, 0xbce9bc17, 0xff221a90, 0x7b7980c3, 0x38b22644, + 0xed81a482, 0xae4a0205, 0x2a119856, 0x69da3ed1, 0x22a6acf1, + 0x616d0a76, 0xe5369025, 0xa6fd36a2, 0xe8cb8cba, 0xab002a3d, + 0x2f5bb06e, 0x6c9016e9, 0x27ec84c9, 0x6427224e, 0xe07cb81d, + 0xa3b71e9a, 0x76849c5c, 0x354f3adb, 0xb114a088, 0xf2df060f, + 0xb9a3942f, 0xfa6832a8, 0x7e33a8fb, 0x3df80e7c, 0x9552ddad, + 0xd6997b2a, 0x52c2e179, 0x110947fe, 0x5a75d5de, 0x19be7359, + 0x9de5e90a, 0xde2e4f8d, 0x0b1dcd4b, 0x48d66bcc, 0xcc8df19f, + 0x8f465718, 0xc43ac538, 0x87f163bf, 0x03aaf9ec, 0x40615f6b, + 0x12f92f94, 0x51328913, 0xd5691340, 0x96a2b5c7, 0xddde27e7, + 0x9e158160, 0x1a4e1b33, 0x5985bdb4, 0x8cb63f72, 0xcf7d99f5, + 0x4b2603a6, 0x08eda521, 0x43913701, 0x005a9186, 0x84010bd5, + 0xc7caad52, 0x6f607e83, 0x2cabd804, 0xa8f04257, 0xeb3be4d0, + 0xa04776f0, 0xe38cd077, 0x67d74a24, 0x241ceca3, 0xf12f6e65, + 0xb2e4c8e2, 0x36bf52b1, 0x7574f436, 0x3e086616, 0x7dc3c091, + 0xf9985ac2, 0xba53fc45, 0x1caecae7, 0x5f656c60, 0xdb3ef633, + 0x98f550b4, 0xd389c294, 0x90426413, 0x1419fe40, 0x57d258c7, + 0x82e1da01, 0xc12a7c86, 0x4571e6d5, 0x06ba4052, 0x4dc6d272, + 0x0e0d74f5, 0x8a56eea6, 0xc99d4821, 0x61379bf0, 0x22fc3d77, + 0xa6a7a724, 0xe56c01a3, 0xae109383, 0xeddb3504, 0x6980af57, + 0x2a4b09d0, 0xff788b16, 0xbcb32d91, 0x38e8b7c2, 0x7b231145, + 0x305f8365, 0x739425e2, 0xf7cfbfb1, 0xb4041936, 0xe69c69c9, + 0xa557cf4e, 0x210c551d, 0x62c7f39a, 0x29bb61ba, 0x6a70c73d, + 0xee2b5d6e, 0xade0fbe9, 0x78d3792f, 0x3b18dfa8, 0xbf4345fb, + 0xfc88e37c, 0xb7f4715c, 0xf43fd7db, 0x70644d88, 0x33afeb0f, + 0x9b0538de, 0xd8ce9e59, 0x5c95040a, 0x1f5ea28d, 0x542230ad, + 0x17e9962a, 0x93b20c79, 0xd079aafe, 0x054a2838, 0x46818ebf, + 0xc2da14ec, 0x8111b26b, 0xca6d204b, 0x89a686cc, 0x0dfd1c9f, + 0x4e36ba18}, + {0x00000000, 0xe1b652ef, 0x836bd405, 0x62dd86ea, 0x06d7a80b, + 0xe761fae4, 0x85bc7c0e, 0x640a2ee1, 0x0cae5117, 0xed1803f8, + 0x8fc58512, 0x6e73d7fd, 0x0a79f91c, 0xebcfabf3, 0x89122d19, + 0x68a47ff6, 0x185ca32e, 0xf9eaf1c1, 0x9b37772b, 0x7a8125c4, + 0x1e8b0b25, 0xff3d59ca, 0x9de0df20, 0x7c568dcf, 0x14f2f239, + 0xf544a0d6, 0x9799263c, 0x762f74d3, 0x12255a32, 0xf39308dd, + 0x914e8e37, 0x70f8dcd8, 0x30b8465d, 0xd10e14b2, 0xb3d39258, + 0x5265c0b7, 0x366fee56, 0xd7d9bcb9, 0xb5043a53, 0x54b268bc, + 0x3c16174a, 0xdda045a5, 0xbf7dc34f, 0x5ecb91a0, 0x3ac1bf41, + 0xdb77edae, 0xb9aa6b44, 0x581c39ab, 0x28e4e573, 0xc952b79c, + 0xab8f3176, 0x4a396399, 0x2e334d78, 0xcf851f97, 0xad58997d, + 0x4ceecb92, 0x244ab464, 0xc5fce68b, 0xa7216061, 0x4697328e, + 0x229d1c6f, 0xc32b4e80, 0xa1f6c86a, 0x40409a85, 0x60708dba, + 0x81c6df55, 0xe31b59bf, 0x02ad0b50, 0x66a725b1, 0x8711775e, + 0xe5ccf1b4, 0x047aa35b, 0x6cdedcad, 0x8d688e42, 0xefb508a8, + 0x0e035a47, 0x6a0974a6, 0x8bbf2649, 0xe962a0a3, 0x08d4f24c, + 0x782c2e94, 0x999a7c7b, 0xfb47fa91, 0x1af1a87e, 0x7efb869f, + 0x9f4dd470, 0xfd90529a, 0x1c260075, 0x74827f83, 0x95342d6c, + 0xf7e9ab86, 0x165ff969, 0x7255d788, 0x93e38567, 0xf13e038d, + 0x10885162, 0x50c8cbe7, 0xb17e9908, 0xd3a31fe2, 0x32154d0d, + 0x561f63ec, 0xb7a93103, 0xd574b7e9, 0x34c2e506, 0x5c669af0, + 0xbdd0c81f, 0xdf0d4ef5, 0x3ebb1c1a, 0x5ab132fb, 0xbb076014, + 0xd9dae6fe, 0x386cb411, 0x489468c9, 0xa9223a26, 0xcbffbccc, + 0x2a49ee23, 0x4e43c0c2, 0xaff5922d, 0xcd2814c7, 0x2c9e4628, + 0x443a39de, 0xa58c6b31, 0xc751eddb, 0x26e7bf34, 0x42ed91d5, + 0xa35bc33a, 0xc18645d0, 0x2030173f, 0x81e66bae, 0x60503941, + 0x028dbfab, 0xe33bed44, 0x8731c3a5, 0x6687914a, 0x045a17a0, + 0xe5ec454f, 0x8d483ab9, 0x6cfe6856, 0x0e23eebc, 0xef95bc53, + 0x8b9f92b2, 0x6a29c05d, 0x08f446b7, 0xe9421458, 0x99bac880, + 0x780c9a6f, 0x1ad11c85, 0xfb674e6a, 0x9f6d608b, 0x7edb3264, + 0x1c06b48e, 0xfdb0e661, 0x95149997, 0x74a2cb78, 0x167f4d92, + 0xf7c91f7d, 0x93c3319c, 0x72756373, 0x10a8e599, 0xf11eb776, + 0xb15e2df3, 0x50e87f1c, 0x3235f9f6, 0xd383ab19, 0xb78985f8, + 0x563fd717, 0x34e251fd, 0xd5540312, 0xbdf07ce4, 0x5c462e0b, + 0x3e9ba8e1, 0xdf2dfa0e, 0xbb27d4ef, 0x5a918600, 0x384c00ea, + 0xd9fa5205, 0xa9028edd, 0x48b4dc32, 0x2a695ad8, 0xcbdf0837, + 0xafd526d6, 0x4e637439, 0x2cbef2d3, 0xcd08a03c, 0xa5acdfca, + 0x441a8d25, 0x26c70bcf, 0xc7715920, 0xa37b77c1, 0x42cd252e, + 0x2010a3c4, 0xc1a6f12b, 0xe196e614, 0x0020b4fb, 0x62fd3211, + 0x834b60fe, 0xe7414e1f, 0x06f71cf0, 0x642a9a1a, 0x859cc8f5, + 0xed38b703, 0x0c8ee5ec, 0x6e536306, 0x8fe531e9, 0xebef1f08, + 0x0a594de7, 0x6884cb0d, 0x893299e2, 0xf9ca453a, 0x187c17d5, + 0x7aa1913f, 0x9b17c3d0, 0xff1ded31, 0x1eabbfde, 0x7c763934, + 0x9dc06bdb, 0xf564142d, 0x14d246c2, 0x760fc028, 0x97b992c7, + 0xf3b3bc26, 0x1205eec9, 0x70d86823, 0x916e3acc, 0xd12ea049, + 0x3098f2a6, 0x5245744c, 0xb3f326a3, 0xd7f90842, 0x364f5aad, + 0x5492dc47, 0xb5248ea8, 0xdd80f15e, 0x3c36a3b1, 0x5eeb255b, + 0xbf5d77b4, 0xdb575955, 0x3ae10bba, 0x583c8d50, 0xb98adfbf, + 0xc9720367, 0x28c45188, 0x4a19d762, 0xabaf858d, 0xcfa5ab6c, + 0x2e13f983, 0x4cce7f69, 0xad782d86, 0xc5dc5270, 0x246a009f, + 0x46b78675, 0xa701d49a, 0xc30bfa7b, 0x22bda894, 0x40602e7e, + 0xa1d67c91}, + {0x00000000, 0x5880e2d7, 0xf106b474, 0xa98656a3, 0xe20d68e9, + 0xba8d8a3e, 0x130bdc9d, 0x4b8b3e4a, 0x851da109, 0xdd9d43de, + 0x741b157d, 0x2c9bf7aa, 0x6710c9e0, 0x3f902b37, 0x96167d94, + 0xce969f43, 0x0a3b4213, 0x52bba0c4, 0xfb3df667, 0xa3bd14b0, + 0xe8362afa, 0xb0b6c82d, 0x19309e8e, 0x41b07c59, 0x8f26e31a, + 0xd7a601cd, 0x7e20576e, 0x26a0b5b9, 0x6d2b8bf3, 0x35ab6924, + 0x9c2d3f87, 0xc4addd50, 0x14768426, 0x4cf666f1, 0xe5703052, + 0xbdf0d285, 0xf67beccf, 0xaefb0e18, 0x077d58bb, 0x5ffdba6c, + 0x916b252f, 0xc9ebc7f8, 0x606d915b, 0x38ed738c, 0x73664dc6, + 0x2be6af11, 0x8260f9b2, 0xdae01b65, 0x1e4dc635, 0x46cd24e2, + 0xef4b7241, 0xb7cb9096, 0xfc40aedc, 0xa4c04c0b, 0x0d461aa8, + 0x55c6f87f, 0x9b50673c, 0xc3d085eb, 0x6a56d348, 0x32d6319f, + 0x795d0fd5, 0x21dded02, 0x885bbba1, 0xd0db5976, 0x28ec084d, + 0x706cea9a, 0xd9eabc39, 0x816a5eee, 0xcae160a4, 0x92618273, + 0x3be7d4d0, 0x63673607, 0xadf1a944, 0xf5714b93, 0x5cf71d30, + 0x0477ffe7, 0x4ffcc1ad, 0x177c237a, 0xbefa75d9, 0xe67a970e, + 0x22d74a5e, 0x7a57a889, 0xd3d1fe2a, 0x8b511cfd, 0xc0da22b7, + 0x985ac060, 0x31dc96c3, 0x695c7414, 0xa7caeb57, 0xff4a0980, + 0x56cc5f23, 0x0e4cbdf4, 0x45c783be, 0x1d476169, 0xb4c137ca, + 0xec41d51d, 0x3c9a8c6b, 0x641a6ebc, 0xcd9c381f, 0x951cdac8, + 0xde97e482, 0x86170655, 0x2f9150f6, 0x7711b221, 0xb9872d62, + 0xe107cfb5, 0x48819916, 0x10017bc1, 0x5b8a458b, 0x030aa75c, + 0xaa8cf1ff, 0xf20c1328, 0x36a1ce78, 0x6e212caf, 0xc7a77a0c, + 0x9f2798db, 0xd4aca691, 0x8c2c4446, 0x25aa12e5, 0x7d2af032, + 0xb3bc6f71, 0xeb3c8da6, 0x42badb05, 0x1a3a39d2, 0x51b10798, + 0x0931e54f, 0xa0b7b3ec, 0xf837513b, 0x50d8119a, 0x0858f34d, + 0xa1dea5ee, 0xf95e4739, 0xb2d57973, 0xea559ba4, 0x43d3cd07, + 0x1b532fd0, 0xd5c5b093, 0x8d455244, 0x24c304e7, 0x7c43e630, + 0x37c8d87a, 0x6f483aad, 0xc6ce6c0e, 0x9e4e8ed9, 0x5ae35389, + 0x0263b15e, 0xabe5e7fd, 0xf365052a, 0xb8ee3b60, 0xe06ed9b7, + 0x49e88f14, 0x11686dc3, 0xdffef280, 0x877e1057, 0x2ef846f4, + 0x7678a423, 0x3df39a69, 0x657378be, 0xccf52e1d, 0x9475ccca, + 0x44ae95bc, 0x1c2e776b, 0xb5a821c8, 0xed28c31f, 0xa6a3fd55, + 0xfe231f82, 0x57a54921, 0x0f25abf6, 0xc1b334b5, 0x9933d662, + 0x30b580c1, 0x68356216, 0x23be5c5c, 0x7b3ebe8b, 0xd2b8e828, + 0x8a380aff, 0x4e95d7af, 0x16153578, 0xbf9363db, 0xe713810c, + 0xac98bf46, 0xf4185d91, 0x5d9e0b32, 0x051ee9e5, 0xcb8876a6, + 0x93089471, 0x3a8ec2d2, 0x620e2005, 0x29851e4f, 0x7105fc98, + 0xd883aa3b, 0x800348ec, 0x783419d7, 0x20b4fb00, 0x8932ada3, + 0xd1b24f74, 0x9a39713e, 0xc2b993e9, 0x6b3fc54a, 0x33bf279d, + 0xfd29b8de, 0xa5a95a09, 0x0c2f0caa, 0x54afee7d, 0x1f24d037, + 0x47a432e0, 0xee226443, 0xb6a28694, 0x720f5bc4, 0x2a8fb913, + 0x8309efb0, 0xdb890d67, 0x9002332d, 0xc882d1fa, 0x61048759, + 0x3984658e, 0xf712facd, 0xaf92181a, 0x06144eb9, 0x5e94ac6e, + 0x151f9224, 0x4d9f70f3, 0xe4192650, 0xbc99c487, 0x6c429df1, + 0x34c27f26, 0x9d442985, 0xc5c4cb52, 0x8e4ff518, 0xd6cf17cf, + 0x7f49416c, 0x27c9a3bb, 0xe95f3cf8, 0xb1dfde2f, 0x1859888c, + 0x40d96a5b, 0x0b525411, 0x53d2b6c6, 0xfa54e065, 0xa2d402b2, + 0x6679dfe2, 0x3ef93d35, 0x977f6b96, 0xcfff8941, 0x8474b70b, + 0xdcf455dc, 0x7572037f, 0x2df2e1a8, 0xe3647eeb, 0xbbe49c3c, + 0x1262ca9f, 0x4ae22848, 0x01691602, 0x59e9f4d5, 0xf06fa276, + 0xa8ef40a1}, + {0x00000000, 0x463b6765, 0x8c76ceca, 0xca4da9af, 0x59ebed4e, + 0x1fd08a2b, 0xd59d2384, 0x93a644e1, 0xb2d6db9d, 0xf4edbcf8, + 0x3ea01557, 0x789b7232, 0xeb3d36d3, 0xad0651b6, 0x674bf819, + 0x21709f7c, 0x25abc6e0, 0x6390a185, 0xa9dd082a, 0xefe66f4f, + 0x7c402bae, 0x3a7b4ccb, 0xf036e564, 0xb60d8201, 0x977d1d7d, + 0xd1467a18, 0x1b0bd3b7, 0x5d30b4d2, 0xce96f033, 0x88ad9756, + 0x42e03ef9, 0x04db599c, 0x0b50fc1a, 0x4d6b9b7f, 0x872632d0, + 0xc11d55b5, 0x52bb1154, 0x14807631, 0xdecddf9e, 0x98f6b8fb, + 0xb9862787, 0xffbd40e2, 0x35f0e94d, 0x73cb8e28, 0xe06dcac9, + 0xa656adac, 0x6c1b0403, 0x2a206366, 0x2efb3afa, 0x68c05d9f, + 0xa28df430, 0xe4b69355, 0x7710d7b4, 0x312bb0d1, 0xfb66197e, + 0xbd5d7e1b, 0x9c2de167, 0xda168602, 0x105b2fad, 0x566048c8, + 0xc5c60c29, 0x83fd6b4c, 0x49b0c2e3, 0x0f8ba586, 0x16a0f835, + 0x509b9f50, 0x9ad636ff, 0xdced519a, 0x4f4b157b, 0x0970721e, + 0xc33ddbb1, 0x8506bcd4, 0xa47623a8, 0xe24d44cd, 0x2800ed62, + 0x6e3b8a07, 0xfd9dcee6, 0xbba6a983, 0x71eb002c, 0x37d06749, + 0x330b3ed5, 0x753059b0, 0xbf7df01f, 0xf946977a, 0x6ae0d39b, + 0x2cdbb4fe, 0xe6961d51, 0xa0ad7a34, 0x81dde548, 0xc7e6822d, + 0x0dab2b82, 0x4b904ce7, 0xd8360806, 0x9e0d6f63, 0x5440c6cc, + 0x127ba1a9, 0x1df0042f, 0x5bcb634a, 0x9186cae5, 0xd7bdad80, + 0x441be961, 0x02208e04, 0xc86d27ab, 0x8e5640ce, 0xaf26dfb2, + 0xe91db8d7, 0x23501178, 0x656b761d, 0xf6cd32fc, 0xb0f65599, + 0x7abbfc36, 0x3c809b53, 0x385bc2cf, 0x7e60a5aa, 0xb42d0c05, + 0xf2166b60, 0x61b02f81, 0x278b48e4, 0xedc6e14b, 0xabfd862e, + 0x8a8d1952, 0xccb67e37, 0x06fbd798, 0x40c0b0fd, 0xd366f41c, + 0x955d9379, 0x5f103ad6, 0x192b5db3, 0x2c40f16b, 0x6a7b960e, + 0xa0363fa1, 0xe60d58c4, 0x75ab1c25, 0x33907b40, 0xf9ddd2ef, + 0xbfe6b58a, 0x9e962af6, 0xd8ad4d93, 0x12e0e43c, 0x54db8359, + 0xc77dc7b8, 0x8146a0dd, 0x4b0b0972, 0x0d306e17, 0x09eb378b, + 0x4fd050ee, 0x859df941, 0xc3a69e24, 0x5000dac5, 0x163bbda0, + 0xdc76140f, 0x9a4d736a, 0xbb3dec16, 0xfd068b73, 0x374b22dc, + 0x717045b9, 0xe2d60158, 0xa4ed663d, 0x6ea0cf92, 0x289ba8f7, + 0x27100d71, 0x612b6a14, 0xab66c3bb, 0xed5da4de, 0x7efbe03f, + 0x38c0875a, 0xf28d2ef5, 0xb4b64990, 0x95c6d6ec, 0xd3fdb189, + 0x19b01826, 0x5f8b7f43, 0xcc2d3ba2, 0x8a165cc7, 0x405bf568, + 0x0660920d, 0x02bbcb91, 0x4480acf4, 0x8ecd055b, 0xc8f6623e, + 0x5b5026df, 0x1d6b41ba, 0xd726e815, 0x911d8f70, 0xb06d100c, + 0xf6567769, 0x3c1bdec6, 0x7a20b9a3, 0xe986fd42, 0xafbd9a27, + 0x65f03388, 0x23cb54ed, 0x3ae0095e, 0x7cdb6e3b, 0xb696c794, + 0xf0ada0f1, 0x630be410, 0x25308375, 0xef7d2ada, 0xa9464dbf, + 0x8836d2c3, 0xce0db5a6, 0x04401c09, 0x427b7b6c, 0xd1dd3f8d, + 0x97e658e8, 0x5dabf147, 0x1b909622, 0x1f4bcfbe, 0x5970a8db, + 0x933d0174, 0xd5066611, 0x46a022f0, 0x009b4595, 0xcad6ec3a, + 0x8ced8b5f, 0xad9d1423, 0xeba67346, 0x21ebdae9, 0x67d0bd8c, + 0xf476f96d, 0xb24d9e08, 0x780037a7, 0x3e3b50c2, 0x31b0f544, + 0x778b9221, 0xbdc63b8e, 0xfbfd5ceb, 0x685b180a, 0x2e607f6f, + 0xe42dd6c0, 0xa216b1a5, 0x83662ed9, 0xc55d49bc, 0x0f10e013, + 0x492b8776, 0xda8dc397, 0x9cb6a4f2, 0x56fb0d5d, 0x10c06a38, + 0x141b33a4, 0x522054c1, 0x986dfd6e, 0xde569a0b, 0x4df0deea, + 0x0bcbb98f, 0xc1861020, 0x87bd7745, 0xa6cde839, 0xe0f68f5c, + 0x2abb26f3, 0x6c804196, 0xff260577, 0xb91d6212, 0x7350cbbd, + 0x356bacd8}}; + +#endif + +#endif + +#if N == 6 + +#if W == 8 + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x3db1ecdc, 0x7b63d9b8, 0x46d23564, 0xf6c7b370, + 0xcb765fac, 0x8da46ac8, 0xb0158614, 0x36fe60a1, 0x0b4f8c7d, + 0x4d9db919, 0x702c55c5, 0xc039d3d1, 0xfd883f0d, 0xbb5a0a69, + 0x86ebe6b5, 0x6dfcc142, 0x504d2d9e, 0x169f18fa, 0x2b2ef426, + 0x9b3b7232, 0xa68a9eee, 0xe058ab8a, 0xdde94756, 0x5b02a1e3, + 0x66b34d3f, 0x2061785b, 0x1dd09487, 0xadc51293, 0x9074fe4f, + 0xd6a6cb2b, 0xeb1727f7, 0xdbf98284, 0xe6486e58, 0xa09a5b3c, + 0x9d2bb7e0, 0x2d3e31f4, 0x108fdd28, 0x565de84c, 0x6bec0490, + 0xed07e225, 0xd0b60ef9, 0x96643b9d, 0xabd5d741, 0x1bc05155, + 0x2671bd89, 0x60a388ed, 0x5d126431, 0xb60543c6, 0x8bb4af1a, + 0xcd669a7e, 0xf0d776a2, 0x40c2f0b6, 0x7d731c6a, 0x3ba1290e, + 0x0610c5d2, 0x80fb2367, 0xbd4acfbb, 0xfb98fadf, 0xc6291603, + 0x763c9017, 0x4b8d7ccb, 0x0d5f49af, 0x30eea573, 0x6c820349, + 0x5133ef95, 0x17e1daf1, 0x2a50362d, 0x9a45b039, 0xa7f45ce5, + 0xe1266981, 0xdc97855d, 0x5a7c63e8, 0x67cd8f34, 0x211fba50, + 0x1cae568c, 0xacbbd098, 0x910a3c44, 0xd7d80920, 0xea69e5fc, + 0x017ec20b, 0x3ccf2ed7, 0x7a1d1bb3, 0x47acf76f, 0xf7b9717b, + 0xca089da7, 0x8cdaa8c3, 0xb16b441f, 0x3780a2aa, 0x0a314e76, + 0x4ce37b12, 0x715297ce, 0xc14711da, 0xfcf6fd06, 0xba24c862, + 0x879524be, 0xb77b81cd, 0x8aca6d11, 0xcc185875, 0xf1a9b4a9, + 0x41bc32bd, 0x7c0dde61, 0x3adfeb05, 0x076e07d9, 0x8185e16c, + 0xbc340db0, 0xfae638d4, 0xc757d408, 0x7742521c, 0x4af3bec0, + 0x0c218ba4, 0x31906778, 0xda87408f, 0xe736ac53, 0xa1e49937, + 0x9c5575eb, 0x2c40f3ff, 0x11f11f23, 0x57232a47, 0x6a92c69b, + 0xec79202e, 0xd1c8ccf2, 0x971af996, 0xaaab154a, 0x1abe935e, + 0x270f7f82, 0x61dd4ae6, 0x5c6ca63a, 0xd9040692, 0xe4b5ea4e, + 0xa267df2a, 0x9fd633f6, 0x2fc3b5e2, 0x1272593e, 0x54a06c5a, + 0x69118086, 0xeffa6633, 0xd24b8aef, 0x9499bf8b, 0xa9285357, + 0x193dd543, 0x248c399f, 0x625e0cfb, 0x5fefe027, 0xb4f8c7d0, + 0x89492b0c, 0xcf9b1e68, 0xf22af2b4, 0x423f74a0, 0x7f8e987c, + 0x395cad18, 0x04ed41c4, 0x8206a771, 0xbfb74bad, 0xf9657ec9, + 0xc4d49215, 0x74c11401, 0x4970f8dd, 0x0fa2cdb9, 0x32132165, + 0x02fd8416, 0x3f4c68ca, 0x799e5dae, 0x442fb172, 0xf43a3766, + 0xc98bdbba, 0x8f59eede, 0xb2e80202, 0x3403e4b7, 0x09b2086b, + 0x4f603d0f, 0x72d1d1d3, 0xc2c457c7, 0xff75bb1b, 0xb9a78e7f, + 0x841662a3, 0x6f014554, 0x52b0a988, 0x14629cec, 0x29d37030, + 0x99c6f624, 0xa4771af8, 0xe2a52f9c, 0xdf14c340, 0x59ff25f5, + 0x644ec929, 0x229cfc4d, 0x1f2d1091, 0xaf389685, 0x92897a59, + 0xd45b4f3d, 0xe9eaa3e1, 0xb58605db, 0x8837e907, 0xcee5dc63, + 0xf35430bf, 0x4341b6ab, 0x7ef05a77, 0x38226f13, 0x059383cf, + 0x8378657a, 0xbec989a6, 0xf81bbcc2, 0xc5aa501e, 0x75bfd60a, + 0x480e3ad6, 0x0edc0fb2, 0x336de36e, 0xd87ac499, 0xe5cb2845, + 0xa3191d21, 0x9ea8f1fd, 0x2ebd77e9, 0x130c9b35, 0x55deae51, + 0x686f428d, 0xee84a438, 0xd33548e4, 0x95e77d80, 0xa856915c, + 0x18431748, 0x25f2fb94, 0x6320cef0, 0x5e91222c, 0x6e7f875f, + 0x53ce6b83, 0x151c5ee7, 0x28adb23b, 0x98b8342f, 0xa509d8f3, + 0xe3dbed97, 0xde6a014b, 0x5881e7fe, 0x65300b22, 0x23e23e46, + 0x1e53d29a, 0xae46548e, 0x93f7b852, 0xd5258d36, 0xe89461ea, + 0x0383461d, 0x3e32aac1, 0x78e09fa5, 0x45517379, 0xf544f56d, + 0xc8f519b1, 0x8e272cd5, 0xb396c009, 0x357d26bc, 0x08ccca60, + 0x4e1eff04, 0x73af13d8, 0xc3ba95cc, 0xfe0b7910, 0xb8d94c74, + 0x8568a0a8}, + {0x00000000, 0x69790b65, 0xd2f216ca, 0xbb8b1daf, 0x7e952bd5, + 0x17ec20b0, 0xac673d1f, 0xc51e367a, 0xfd2a57aa, 0x94535ccf, + 0x2fd84160, 0x46a14a05, 0x83bf7c7f, 0xeac6771a, 0x514d6ab5, + 0x383461d0, 0x2125a915, 0x485ca270, 0xf3d7bfdf, 0x9aaeb4ba, + 0x5fb082c0, 0x36c989a5, 0x8d42940a, 0xe43b9f6f, 0xdc0ffebf, + 0xb576f5da, 0x0efde875, 0x6784e310, 0xa29ad56a, 0xcbe3de0f, + 0x7068c3a0, 0x1911c8c5, 0x424b522a, 0x2b32594f, 0x90b944e0, + 0xf9c04f85, 0x3cde79ff, 0x55a7729a, 0xee2c6f35, 0x87556450, + 0xbf610580, 0xd6180ee5, 0x6d93134a, 0x04ea182f, 0xc1f42e55, + 0xa88d2530, 0x1306389f, 0x7a7f33fa, 0x636efb3f, 0x0a17f05a, + 0xb19cedf5, 0xd8e5e690, 0x1dfbd0ea, 0x7482db8f, 0xcf09c620, + 0xa670cd45, 0x9e44ac95, 0xf73da7f0, 0x4cb6ba5f, 0x25cfb13a, + 0xe0d18740, 0x89a88c25, 0x3223918a, 0x5b5a9aef, 0x8496a454, + 0xedefaf31, 0x5664b29e, 0x3f1db9fb, 0xfa038f81, 0x937a84e4, + 0x28f1994b, 0x4188922e, 0x79bcf3fe, 0x10c5f89b, 0xab4ee534, + 0xc237ee51, 0x0729d82b, 0x6e50d34e, 0xd5dbcee1, 0xbca2c584, + 0xa5b30d41, 0xccca0624, 0x77411b8b, 0x1e3810ee, 0xdb262694, + 0xb25f2df1, 0x09d4305e, 0x60ad3b3b, 0x58995aeb, 0x31e0518e, + 0x8a6b4c21, 0xe3124744, 0x260c713e, 0x4f757a5b, 0xf4fe67f4, + 0x9d876c91, 0xc6ddf67e, 0xafa4fd1b, 0x142fe0b4, 0x7d56ebd1, + 0xb848ddab, 0xd131d6ce, 0x6abacb61, 0x03c3c004, 0x3bf7a1d4, + 0x528eaab1, 0xe905b71e, 0x807cbc7b, 0x45628a01, 0x2c1b8164, + 0x97909ccb, 0xfee997ae, 0xe7f85f6b, 0x8e81540e, 0x350a49a1, + 0x5c7342c4, 0x996d74be, 0xf0147fdb, 0x4b9f6274, 0x22e66911, + 0x1ad208c1, 0x73ab03a4, 0xc8201e0b, 0xa159156e, 0x64472314, + 0x0d3e2871, 0xb6b535de, 0xdfcc3ebb, 0xd25c4ee9, 0xbb25458c, + 0x00ae5823, 0x69d75346, 0xacc9653c, 0xc5b06e59, 0x7e3b73f6, + 0x17427893, 0x2f761943, 0x460f1226, 0xfd840f89, 0x94fd04ec, + 0x51e33296, 0x389a39f3, 0x8311245c, 0xea682f39, 0xf379e7fc, + 0x9a00ec99, 0x218bf136, 0x48f2fa53, 0x8deccc29, 0xe495c74c, + 0x5f1edae3, 0x3667d186, 0x0e53b056, 0x672abb33, 0xdca1a69c, + 0xb5d8adf9, 0x70c69b83, 0x19bf90e6, 0xa2348d49, 0xcb4d862c, + 0x90171cc3, 0xf96e17a6, 0x42e50a09, 0x2b9c016c, 0xee823716, + 0x87fb3c73, 0x3c7021dc, 0x55092ab9, 0x6d3d4b69, 0x0444400c, + 0xbfcf5da3, 0xd6b656c6, 0x13a860bc, 0x7ad16bd9, 0xc15a7676, + 0xa8237d13, 0xb132b5d6, 0xd84bbeb3, 0x63c0a31c, 0x0ab9a879, + 0xcfa79e03, 0xa6de9566, 0x1d5588c9, 0x742c83ac, 0x4c18e27c, + 0x2561e919, 0x9eeaf4b6, 0xf793ffd3, 0x328dc9a9, 0x5bf4c2cc, + 0xe07fdf63, 0x8906d406, 0x56caeabd, 0x3fb3e1d8, 0x8438fc77, + 0xed41f712, 0x285fc168, 0x4126ca0d, 0xfaadd7a2, 0x93d4dcc7, + 0xabe0bd17, 0xc299b672, 0x7912abdd, 0x106ba0b8, 0xd57596c2, + 0xbc0c9da7, 0x07878008, 0x6efe8b6d, 0x77ef43a8, 0x1e9648cd, + 0xa51d5562, 0xcc645e07, 0x097a687d, 0x60036318, 0xdb887eb7, + 0xb2f175d2, 0x8ac51402, 0xe3bc1f67, 0x583702c8, 0x314e09ad, + 0xf4503fd7, 0x9d2934b2, 0x26a2291d, 0x4fdb2278, 0x1481b897, + 0x7df8b3f2, 0xc673ae5d, 0xaf0aa538, 0x6a149342, 0x036d9827, + 0xb8e68588, 0xd19f8eed, 0xe9abef3d, 0x80d2e458, 0x3b59f9f7, + 0x5220f292, 0x973ec4e8, 0xfe47cf8d, 0x45ccd222, 0x2cb5d947, + 0x35a41182, 0x5cdd1ae7, 0xe7560748, 0x8e2f0c2d, 0x4b313a57, + 0x22483132, 0x99c32c9d, 0xf0ba27f8, 0xc88e4628, 0xa1f74d4d, + 0x1a7c50e2, 0x73055b87, 0xb61b6dfd, 0xdf626698, 0x64e97b37, + 0x0d907052}, + {0x00000000, 0x7fc99b93, 0xff933726, 0x805aacb5, 0x2457680d, + 0x5b9ef39e, 0xdbc45f2b, 0xa40dc4b8, 0x48aed01a, 0x37674b89, + 0xb73de73c, 0xc8f47caf, 0x6cf9b817, 0x13302384, 0x936a8f31, + 0xeca314a2, 0x915da034, 0xee943ba7, 0x6ece9712, 0x11070c81, + 0xb50ac839, 0xcac353aa, 0x4a99ff1f, 0x3550648c, 0xd9f3702e, + 0xa63aebbd, 0x26604708, 0x59a9dc9b, 0xfda41823, 0x826d83b0, + 0x02372f05, 0x7dfeb496, 0xf9ca4629, 0x8603ddba, 0x0659710f, + 0x7990ea9c, 0xdd9d2e24, 0xa254b5b7, 0x220e1902, 0x5dc78291, + 0xb1649633, 0xcead0da0, 0x4ef7a115, 0x313e3a86, 0x9533fe3e, + 0xeafa65ad, 0x6aa0c918, 0x1569528b, 0x6897e61d, 0x175e7d8e, + 0x9704d13b, 0xe8cd4aa8, 0x4cc08e10, 0x33091583, 0xb353b936, + 0xcc9a22a5, 0x20393607, 0x5ff0ad94, 0xdfaa0121, 0xa0639ab2, + 0x046e5e0a, 0x7ba7c599, 0xfbfd692c, 0x8434f2bf, 0x28e58a13, + 0x572c1180, 0xd776bd35, 0xa8bf26a6, 0x0cb2e21e, 0x737b798d, + 0xf321d538, 0x8ce84eab, 0x604b5a09, 0x1f82c19a, 0x9fd86d2f, + 0xe011f6bc, 0x441c3204, 0x3bd5a997, 0xbb8f0522, 0xc4469eb1, + 0xb9b82a27, 0xc671b1b4, 0x462b1d01, 0x39e28692, 0x9def422a, + 0xe226d9b9, 0x627c750c, 0x1db5ee9f, 0xf116fa3d, 0x8edf61ae, + 0x0e85cd1b, 0x714c5688, 0xd5419230, 0xaa8809a3, 0x2ad2a516, + 0x551b3e85, 0xd12fcc3a, 0xaee657a9, 0x2ebcfb1c, 0x5175608f, + 0xf578a437, 0x8ab13fa4, 0x0aeb9311, 0x75220882, 0x99811c20, + 0xe64887b3, 0x66122b06, 0x19dbb095, 0xbdd6742d, 0xc21fefbe, + 0x4245430b, 0x3d8cd898, 0x40726c0e, 0x3fbbf79d, 0xbfe15b28, + 0xc028c0bb, 0x64250403, 0x1bec9f90, 0x9bb63325, 0xe47fa8b6, + 0x08dcbc14, 0x77152787, 0xf74f8b32, 0x888610a1, 0x2c8bd419, + 0x53424f8a, 0xd318e33f, 0xacd178ac, 0x51cb1426, 0x2e028fb5, + 0xae582300, 0xd191b893, 0x759c7c2b, 0x0a55e7b8, 0x8a0f4b0d, + 0xf5c6d09e, 0x1965c43c, 0x66ac5faf, 0xe6f6f31a, 0x993f6889, + 0x3d32ac31, 0x42fb37a2, 0xc2a19b17, 0xbd680084, 0xc096b412, + 0xbf5f2f81, 0x3f058334, 0x40cc18a7, 0xe4c1dc1f, 0x9b08478c, + 0x1b52eb39, 0x649b70aa, 0x88386408, 0xf7f1ff9b, 0x77ab532e, + 0x0862c8bd, 0xac6f0c05, 0xd3a69796, 0x53fc3b23, 0x2c35a0b0, + 0xa801520f, 0xd7c8c99c, 0x57926529, 0x285bfeba, 0x8c563a02, + 0xf39fa191, 0x73c50d24, 0x0c0c96b7, 0xe0af8215, 0x9f661986, + 0x1f3cb533, 0x60f52ea0, 0xc4f8ea18, 0xbb31718b, 0x3b6bdd3e, + 0x44a246ad, 0x395cf23b, 0x469569a8, 0xc6cfc51d, 0xb9065e8e, + 0x1d0b9a36, 0x62c201a5, 0xe298ad10, 0x9d513683, 0x71f22221, + 0x0e3bb9b2, 0x8e611507, 0xf1a88e94, 0x55a54a2c, 0x2a6cd1bf, + 0xaa367d0a, 0xd5ffe699, 0x792e9e35, 0x06e705a6, 0x86bda913, + 0xf9743280, 0x5d79f638, 0x22b06dab, 0xa2eac11e, 0xdd235a8d, + 0x31804e2f, 0x4e49d5bc, 0xce137909, 0xb1dae29a, 0x15d72622, + 0x6a1ebdb1, 0xea441104, 0x958d8a97, 0xe8733e01, 0x97baa592, + 0x17e00927, 0x682992b4, 0xcc24560c, 0xb3edcd9f, 0x33b7612a, + 0x4c7efab9, 0xa0ddee1b, 0xdf147588, 0x5f4ed93d, 0x208742ae, + 0x848a8616, 0xfb431d85, 0x7b19b130, 0x04d02aa3, 0x80e4d81c, + 0xff2d438f, 0x7f77ef3a, 0x00be74a9, 0xa4b3b011, 0xdb7a2b82, + 0x5b208737, 0x24e91ca4, 0xc84a0806, 0xb7839395, 0x37d93f20, + 0x4810a4b3, 0xec1d600b, 0x93d4fb98, 0x138e572d, 0x6c47ccbe, + 0x11b97828, 0x6e70e3bb, 0xee2a4f0e, 0x91e3d49d, 0x35ee1025, + 0x4a278bb6, 0xca7d2703, 0xb5b4bc90, 0x5917a832, 0x26de33a1, + 0xa6849f14, 0xd94d0487, 0x7d40c03f, 0x02895bac, 0x82d3f719, + 0xfd1a6c8a}, + {0x00000000, 0xa396284c, 0x9c5d56d9, 0x3fcb7e95, 0xe3cbabf3, + 0x405d83bf, 0x7f96fd2a, 0xdc00d566, 0x1ce651a7, 0xbf7079eb, + 0x80bb077e, 0x232d2f32, 0xff2dfa54, 0x5cbbd218, 0x6370ac8d, + 0xc0e684c1, 0x39cca34e, 0x9a5a8b02, 0xa591f597, 0x0607dddb, + 0xda0708bd, 0x799120f1, 0x465a5e64, 0xe5cc7628, 0x252af2e9, + 0x86bcdaa5, 0xb977a430, 0x1ae18c7c, 0xc6e1591a, 0x65777156, + 0x5abc0fc3, 0xf92a278f, 0x7399469c, 0xd00f6ed0, 0xefc41045, + 0x4c523809, 0x9052ed6f, 0x33c4c523, 0x0c0fbbb6, 0xaf9993fa, + 0x6f7f173b, 0xcce93f77, 0xf32241e2, 0x50b469ae, 0x8cb4bcc8, + 0x2f229484, 0x10e9ea11, 0xb37fc25d, 0x4a55e5d2, 0xe9c3cd9e, + 0xd608b30b, 0x759e9b47, 0xa99e4e21, 0x0a08666d, 0x35c318f8, + 0x965530b4, 0x56b3b475, 0xf5259c39, 0xcaeee2ac, 0x6978cae0, + 0xb5781f86, 0x16ee37ca, 0x2925495f, 0x8ab36113, 0xe7328d38, + 0x44a4a574, 0x7b6fdbe1, 0xd8f9f3ad, 0x04f926cb, 0xa76f0e87, + 0x98a47012, 0x3b32585e, 0xfbd4dc9f, 0x5842f4d3, 0x67898a46, + 0xc41fa20a, 0x181f776c, 0xbb895f20, 0x844221b5, 0x27d409f9, + 0xdefe2e76, 0x7d68063a, 0x42a378af, 0xe13550e3, 0x3d358585, + 0x9ea3adc9, 0xa168d35c, 0x02fefb10, 0xc2187fd1, 0x618e579d, + 0x5e452908, 0xfdd30144, 0x21d3d422, 0x8245fc6e, 0xbd8e82fb, + 0x1e18aab7, 0x94abcba4, 0x373de3e8, 0x08f69d7d, 0xab60b531, + 0x77606057, 0xd4f6481b, 0xeb3d368e, 0x48ab1ec2, 0x884d9a03, + 0x2bdbb24f, 0x1410ccda, 0xb786e496, 0x6b8631f0, 0xc81019bc, + 0xf7db6729, 0x544d4f65, 0xad6768ea, 0x0ef140a6, 0x313a3e33, + 0x92ac167f, 0x4eacc319, 0xed3aeb55, 0xd2f195c0, 0x7167bd8c, + 0xb181394d, 0x12171101, 0x2ddc6f94, 0x8e4a47d8, 0x524a92be, + 0xf1dcbaf2, 0xce17c467, 0x6d81ec2b, 0x15141c31, 0xb682347d, + 0x89494ae8, 0x2adf62a4, 0xf6dfb7c2, 0x55499f8e, 0x6a82e11b, + 0xc914c957, 0x09f24d96, 0xaa6465da, 0x95af1b4f, 0x36393303, + 0xea39e665, 0x49afce29, 0x7664b0bc, 0xd5f298f0, 0x2cd8bf7f, + 0x8f4e9733, 0xb085e9a6, 0x1313c1ea, 0xcf13148c, 0x6c853cc0, + 0x534e4255, 0xf0d86a19, 0x303eeed8, 0x93a8c694, 0xac63b801, + 0x0ff5904d, 0xd3f5452b, 0x70636d67, 0x4fa813f2, 0xec3e3bbe, + 0x668d5aad, 0xc51b72e1, 0xfad00c74, 0x59462438, 0x8546f15e, + 0x26d0d912, 0x191ba787, 0xba8d8fcb, 0x7a6b0b0a, 0xd9fd2346, + 0xe6365dd3, 0x45a0759f, 0x99a0a0f9, 0x3a3688b5, 0x05fdf620, + 0xa66bde6c, 0x5f41f9e3, 0xfcd7d1af, 0xc31caf3a, 0x608a8776, + 0xbc8a5210, 0x1f1c7a5c, 0x20d704c9, 0x83412c85, 0x43a7a844, + 0xe0318008, 0xdffafe9d, 0x7c6cd6d1, 0xa06c03b7, 0x03fa2bfb, + 0x3c31556e, 0x9fa77d22, 0xf2269109, 0x51b0b945, 0x6e7bc7d0, + 0xcdedef9c, 0x11ed3afa, 0xb27b12b6, 0x8db06c23, 0x2e26446f, + 0xeec0c0ae, 0x4d56e8e2, 0x729d9677, 0xd10bbe3b, 0x0d0b6b5d, + 0xae9d4311, 0x91563d84, 0x32c015c8, 0xcbea3247, 0x687c1a0b, + 0x57b7649e, 0xf4214cd2, 0x282199b4, 0x8bb7b1f8, 0xb47ccf6d, + 0x17eae721, 0xd70c63e0, 0x749a4bac, 0x4b513539, 0xe8c71d75, + 0x34c7c813, 0x9751e05f, 0xa89a9eca, 0x0b0cb686, 0x81bfd795, + 0x2229ffd9, 0x1de2814c, 0xbe74a900, 0x62747c66, 0xc1e2542a, + 0xfe292abf, 0x5dbf02f3, 0x9d598632, 0x3ecfae7e, 0x0104d0eb, + 0xa292f8a7, 0x7e922dc1, 0xdd04058d, 0xe2cf7b18, 0x41595354, + 0xb87374db, 0x1be55c97, 0x242e2202, 0x87b80a4e, 0x5bb8df28, + 0xf82ef764, 0xc7e589f1, 0x6473a1bd, 0xa495257c, 0x07030d30, + 0x38c873a5, 0x9b5e5be9, 0x475e8e8f, 0xe4c8a6c3, 0xdb03d856, + 0x7895f01a}, + {0x00000000, 0x2a283862, 0x545070c4, 0x7e7848a6, 0xa8a0e188, + 0x8288d9ea, 0xfcf0914c, 0xd6d8a92e, 0x8a30c551, 0xa018fd33, + 0xde60b595, 0xf4488df7, 0x229024d9, 0x08b81cbb, 0x76c0541d, + 0x5ce86c7f, 0xcf108ce3, 0xe538b481, 0x9b40fc27, 0xb168c445, + 0x67b06d6b, 0x4d985509, 0x33e01daf, 0x19c825cd, 0x452049b2, + 0x6f0871d0, 0x11703976, 0x3b580114, 0xed80a83a, 0xc7a89058, + 0xb9d0d8fe, 0x93f8e09c, 0x45501f87, 0x6f7827e5, 0x11006f43, + 0x3b285721, 0xedf0fe0f, 0xc7d8c66d, 0xb9a08ecb, 0x9388b6a9, + 0xcf60dad6, 0xe548e2b4, 0x9b30aa12, 0xb1189270, 0x67c03b5e, + 0x4de8033c, 0x33904b9a, 0x19b873f8, 0x8a409364, 0xa068ab06, + 0xde10e3a0, 0xf438dbc2, 0x22e072ec, 0x08c84a8e, 0x76b00228, + 0x5c983a4a, 0x00705635, 0x2a586e57, 0x542026f1, 0x7e081e93, + 0xa8d0b7bd, 0x82f88fdf, 0xfc80c779, 0xd6a8ff1b, 0x8aa03f0e, + 0xa088076c, 0xdef04fca, 0xf4d877a8, 0x2200de86, 0x0828e6e4, + 0x7650ae42, 0x5c789620, 0x0090fa5f, 0x2ab8c23d, 0x54c08a9b, + 0x7ee8b2f9, 0xa8301bd7, 0x821823b5, 0xfc606b13, 0xd6485371, + 0x45b0b3ed, 0x6f988b8f, 0x11e0c329, 0x3bc8fb4b, 0xed105265, + 0xc7386a07, 0xb94022a1, 0x93681ac3, 0xcf8076bc, 0xe5a84ede, + 0x9bd00678, 0xb1f83e1a, 0x67209734, 0x4d08af56, 0x3370e7f0, + 0x1958df92, 0xcff02089, 0xe5d818eb, 0x9ba0504d, 0xb188682f, + 0x6750c101, 0x4d78f963, 0x3300b1c5, 0x192889a7, 0x45c0e5d8, + 0x6fe8ddba, 0x1190951c, 0x3bb8ad7e, 0xed600450, 0xc7483c32, + 0xb9307494, 0x93184cf6, 0x00e0ac6a, 0x2ac89408, 0x54b0dcae, + 0x7e98e4cc, 0xa8404de2, 0x82687580, 0xfc103d26, 0xd6380544, + 0x8ad0693b, 0xa0f85159, 0xde8019ff, 0xf4a8219d, 0x227088b3, + 0x0858b0d1, 0x7620f877, 0x5c08c015, 0xce31785d, 0xe419403f, + 0x9a610899, 0xb04930fb, 0x669199d5, 0x4cb9a1b7, 0x32c1e911, + 0x18e9d173, 0x4401bd0c, 0x6e29856e, 0x1051cdc8, 0x3a79f5aa, + 0xeca15c84, 0xc68964e6, 0xb8f12c40, 0x92d91422, 0x0121f4be, + 0x2b09ccdc, 0x5571847a, 0x7f59bc18, 0xa9811536, 0x83a92d54, + 0xfdd165f2, 0xd7f95d90, 0x8b1131ef, 0xa139098d, 0xdf41412b, + 0xf5697949, 0x23b1d067, 0x0999e805, 0x77e1a0a3, 0x5dc998c1, + 0x8b6167da, 0xa1495fb8, 0xdf31171e, 0xf5192f7c, 0x23c18652, + 0x09e9be30, 0x7791f696, 0x5db9cef4, 0x0151a28b, 0x2b799ae9, + 0x5501d24f, 0x7f29ea2d, 0xa9f14303, 0x83d97b61, 0xfda133c7, + 0xd7890ba5, 0x4471eb39, 0x6e59d35b, 0x10219bfd, 0x3a09a39f, + 0xecd10ab1, 0xc6f932d3, 0xb8817a75, 0x92a94217, 0xce412e68, + 0xe469160a, 0x9a115eac, 0xb03966ce, 0x66e1cfe0, 0x4cc9f782, + 0x32b1bf24, 0x18998746, 0x44914753, 0x6eb97f31, 0x10c13797, + 0x3ae90ff5, 0xec31a6db, 0xc6199eb9, 0xb861d61f, 0x9249ee7d, + 0xcea18202, 0xe489ba60, 0x9af1f2c6, 0xb0d9caa4, 0x6601638a, + 0x4c295be8, 0x3251134e, 0x18792b2c, 0x8b81cbb0, 0xa1a9f3d2, + 0xdfd1bb74, 0xf5f98316, 0x23212a38, 0x0909125a, 0x77715afc, + 0x5d59629e, 0x01b10ee1, 0x2b993683, 0x55e17e25, 0x7fc94647, + 0xa911ef69, 0x8339d70b, 0xfd419fad, 0xd769a7cf, 0x01c158d4, + 0x2be960b6, 0x55912810, 0x7fb91072, 0xa961b95c, 0x8349813e, + 0xfd31c998, 0xd719f1fa, 0x8bf19d85, 0xa1d9a5e7, 0xdfa1ed41, + 0xf589d523, 0x23517c0d, 0x0979446f, 0x77010cc9, 0x5d2934ab, + 0xced1d437, 0xe4f9ec55, 0x9a81a4f3, 0xb0a99c91, 0x667135bf, + 0x4c590ddd, 0x3221457b, 0x18097d19, 0x44e11166, 0x6ec92904, + 0x10b161a2, 0x3a9959c0, 0xec41f0ee, 0xc669c88c, 0xb811802a, + 0x9239b848}, + {0x00000000, 0x4713f6fb, 0x8e27edf6, 0xc9341b0d, 0xc73eddad, + 0x802d2b56, 0x4919305b, 0x0e0ac6a0, 0x550cbd1b, 0x121f4be0, + 0xdb2b50ed, 0x9c38a616, 0x923260b6, 0xd521964d, 0x1c158d40, + 0x5b067bbb, 0xaa197a36, 0xed0a8ccd, 0x243e97c0, 0x632d613b, + 0x6d27a79b, 0x2a345160, 0xe3004a6d, 0xa413bc96, 0xff15c72d, + 0xb80631d6, 0x71322adb, 0x3621dc20, 0x382b1a80, 0x7f38ec7b, + 0xb60cf776, 0xf11f018d, 0x8f43f22d, 0xc85004d6, 0x01641fdb, + 0x4677e920, 0x487d2f80, 0x0f6ed97b, 0xc65ac276, 0x8149348d, + 0xda4f4f36, 0x9d5cb9cd, 0x5468a2c0, 0x137b543b, 0x1d71929b, + 0x5a626460, 0x93567f6d, 0xd4458996, 0x255a881b, 0x62497ee0, + 0xab7d65ed, 0xec6e9316, 0xe26455b6, 0xa577a34d, 0x6c43b840, + 0x2b504ebb, 0x70563500, 0x3745c3fb, 0xfe71d8f6, 0xb9622e0d, + 0xb768e8ad, 0xf07b1e56, 0x394f055b, 0x7e5cf3a0, 0xc5f6e21b, + 0x82e514e0, 0x4bd10fed, 0x0cc2f916, 0x02c83fb6, 0x45dbc94d, + 0x8cefd240, 0xcbfc24bb, 0x90fa5f00, 0xd7e9a9fb, 0x1eddb2f6, + 0x59ce440d, 0x57c482ad, 0x10d77456, 0xd9e36f5b, 0x9ef099a0, + 0x6fef982d, 0x28fc6ed6, 0xe1c875db, 0xa6db8320, 0xa8d14580, + 0xefc2b37b, 0x26f6a876, 0x61e55e8d, 0x3ae32536, 0x7df0d3cd, + 0xb4c4c8c0, 0xf3d73e3b, 0xfdddf89b, 0xbace0e60, 0x73fa156d, + 0x34e9e396, 0x4ab51036, 0x0da6e6cd, 0xc492fdc0, 0x83810b3b, + 0x8d8bcd9b, 0xca983b60, 0x03ac206d, 0x44bfd696, 0x1fb9ad2d, + 0x58aa5bd6, 0x919e40db, 0xd68db620, 0xd8877080, 0x9f94867b, + 0x56a09d76, 0x11b36b8d, 0xe0ac6a00, 0xa7bf9cfb, 0x6e8b87f6, + 0x2998710d, 0x2792b7ad, 0x60814156, 0xa9b55a5b, 0xeea6aca0, + 0xb5a0d71b, 0xf2b321e0, 0x3b873aed, 0x7c94cc16, 0x729e0ab6, + 0x358dfc4d, 0xfcb9e740, 0xbbaa11bb, 0x509cc277, 0x178f348c, + 0xdebb2f81, 0x99a8d97a, 0x97a21fda, 0xd0b1e921, 0x1985f22c, + 0x5e9604d7, 0x05907f6c, 0x42838997, 0x8bb7929a, 0xcca46461, + 0xc2aea2c1, 0x85bd543a, 0x4c894f37, 0x0b9ab9cc, 0xfa85b841, + 0xbd964eba, 0x74a255b7, 0x33b1a34c, 0x3dbb65ec, 0x7aa89317, + 0xb39c881a, 0xf48f7ee1, 0xaf89055a, 0xe89af3a1, 0x21aee8ac, + 0x66bd1e57, 0x68b7d8f7, 0x2fa42e0c, 0xe6903501, 0xa183c3fa, + 0xdfdf305a, 0x98ccc6a1, 0x51f8ddac, 0x16eb2b57, 0x18e1edf7, + 0x5ff21b0c, 0x96c60001, 0xd1d5f6fa, 0x8ad38d41, 0xcdc07bba, + 0x04f460b7, 0x43e7964c, 0x4ded50ec, 0x0afea617, 0xc3cabd1a, + 0x84d94be1, 0x75c64a6c, 0x32d5bc97, 0xfbe1a79a, 0xbcf25161, + 0xb2f897c1, 0xf5eb613a, 0x3cdf7a37, 0x7bcc8ccc, 0x20caf777, + 0x67d9018c, 0xaeed1a81, 0xe9feec7a, 0xe7f42ada, 0xa0e7dc21, + 0x69d3c72c, 0x2ec031d7, 0x956a206c, 0xd279d697, 0x1b4dcd9a, + 0x5c5e3b61, 0x5254fdc1, 0x15470b3a, 0xdc731037, 0x9b60e6cc, + 0xc0669d77, 0x87756b8c, 0x4e417081, 0x0952867a, 0x075840da, + 0x404bb621, 0x897fad2c, 0xce6c5bd7, 0x3f735a5a, 0x7860aca1, + 0xb154b7ac, 0xf6474157, 0xf84d87f7, 0xbf5e710c, 0x766a6a01, + 0x31799cfa, 0x6a7fe741, 0x2d6c11ba, 0xe4580ab7, 0xa34bfc4c, + 0xad413aec, 0xea52cc17, 0x2366d71a, 0x647521e1, 0x1a29d241, + 0x5d3a24ba, 0x940e3fb7, 0xd31dc94c, 0xdd170fec, 0x9a04f917, + 0x5330e21a, 0x142314e1, 0x4f256f5a, 0x083699a1, 0xc10282ac, + 0x86117457, 0x881bb2f7, 0xcf08440c, 0x063c5f01, 0x412fa9fa, + 0xb030a877, 0xf7235e8c, 0x3e174581, 0x7904b37a, 0x770e75da, + 0x301d8321, 0xf929982c, 0xbe3a6ed7, 0xe53c156c, 0xa22fe397, + 0x6b1bf89a, 0x2c080e61, 0x2202c8c1, 0x65113e3a, 0xac252537, + 0xeb36d3cc}, + {0x00000000, 0xa13984ee, 0x99020f9d, 0x383b8b73, 0xe975197b, + 0x484c9d95, 0x707716e6, 0xd14e9208, 0x099b34b7, 0xa8a2b059, + 0x90993b2a, 0x31a0bfc4, 0xe0ee2dcc, 0x41d7a922, 0x79ec2251, + 0xd8d5a6bf, 0x1336696e, 0xb20fed80, 0x8a3466f3, 0x2b0de21d, + 0xfa437015, 0x5b7af4fb, 0x63417f88, 0xc278fb66, 0x1aad5dd9, + 0xbb94d937, 0x83af5244, 0x2296d6aa, 0xf3d844a2, 0x52e1c04c, + 0x6ada4b3f, 0xcbe3cfd1, 0x266cd2dc, 0x87555632, 0xbf6edd41, + 0x1e5759af, 0xcf19cba7, 0x6e204f49, 0x561bc43a, 0xf72240d4, + 0x2ff7e66b, 0x8ece6285, 0xb6f5e9f6, 0x17cc6d18, 0xc682ff10, + 0x67bb7bfe, 0x5f80f08d, 0xfeb97463, 0x355abbb2, 0x94633f5c, + 0xac58b42f, 0x0d6130c1, 0xdc2fa2c9, 0x7d162627, 0x452dad54, + 0xe41429ba, 0x3cc18f05, 0x9df80beb, 0xa5c38098, 0x04fa0476, + 0xd5b4967e, 0x748d1290, 0x4cb699e3, 0xed8f1d0d, 0x4cd9a5b8, + 0xede02156, 0xd5dbaa25, 0x74e22ecb, 0xa5acbcc3, 0x0495382d, + 0x3caeb35e, 0x9d9737b0, 0x4542910f, 0xe47b15e1, 0xdc409e92, + 0x7d791a7c, 0xac378874, 0x0d0e0c9a, 0x353587e9, 0x940c0307, + 0x5fefccd6, 0xfed64838, 0xc6edc34b, 0x67d447a5, 0xb69ad5ad, + 0x17a35143, 0x2f98da30, 0x8ea15ede, 0x5674f861, 0xf74d7c8f, + 0xcf76f7fc, 0x6e4f7312, 0xbf01e11a, 0x1e3865f4, 0x2603ee87, + 0x873a6a69, 0x6ab57764, 0xcb8cf38a, 0xf3b778f9, 0x528efc17, + 0x83c06e1f, 0x22f9eaf1, 0x1ac26182, 0xbbfbe56c, 0x632e43d3, + 0xc217c73d, 0xfa2c4c4e, 0x5b15c8a0, 0x8a5b5aa8, 0x2b62de46, + 0x13595535, 0xb260d1db, 0x79831e0a, 0xd8ba9ae4, 0xe0811197, + 0x41b89579, 0x90f60771, 0x31cf839f, 0x09f408ec, 0xa8cd8c02, + 0x70182abd, 0xd121ae53, 0xe91a2520, 0x4823a1ce, 0x996d33c6, + 0x3854b728, 0x006f3c5b, 0xa156b8b5, 0x99b34b70, 0x388acf9e, + 0x00b144ed, 0xa188c003, 0x70c6520b, 0xd1ffd6e5, 0xe9c45d96, + 0x48fdd978, 0x90287fc7, 0x3111fb29, 0x092a705a, 0xa813f4b4, + 0x795d66bc, 0xd864e252, 0xe05f6921, 0x4166edcf, 0x8a85221e, + 0x2bbca6f0, 0x13872d83, 0xb2bea96d, 0x63f03b65, 0xc2c9bf8b, + 0xfaf234f8, 0x5bcbb016, 0x831e16a9, 0x22279247, 0x1a1c1934, + 0xbb259dda, 0x6a6b0fd2, 0xcb528b3c, 0xf369004f, 0x525084a1, + 0xbfdf99ac, 0x1ee61d42, 0x26dd9631, 0x87e412df, 0x56aa80d7, + 0xf7930439, 0xcfa88f4a, 0x6e910ba4, 0xb644ad1b, 0x177d29f5, + 0x2f46a286, 0x8e7f2668, 0x5f31b460, 0xfe08308e, 0xc633bbfd, + 0x670a3f13, 0xace9f0c2, 0x0dd0742c, 0x35ebff5f, 0x94d27bb1, + 0x459ce9b9, 0xe4a56d57, 0xdc9ee624, 0x7da762ca, 0xa572c475, + 0x044b409b, 0x3c70cbe8, 0x9d494f06, 0x4c07dd0e, 0xed3e59e0, + 0xd505d293, 0x743c567d, 0xd56aeec8, 0x74536a26, 0x4c68e155, + 0xed5165bb, 0x3c1ff7b3, 0x9d26735d, 0xa51df82e, 0x04247cc0, + 0xdcf1da7f, 0x7dc85e91, 0x45f3d5e2, 0xe4ca510c, 0x3584c304, + 0x94bd47ea, 0xac86cc99, 0x0dbf4877, 0xc65c87a6, 0x67650348, + 0x5f5e883b, 0xfe670cd5, 0x2f299edd, 0x8e101a33, 0xb62b9140, + 0x171215ae, 0xcfc7b311, 0x6efe37ff, 0x56c5bc8c, 0xf7fc3862, + 0x26b2aa6a, 0x878b2e84, 0xbfb0a5f7, 0x1e892119, 0xf3063c14, + 0x523fb8fa, 0x6a043389, 0xcb3db767, 0x1a73256f, 0xbb4aa181, + 0x83712af2, 0x2248ae1c, 0xfa9d08a3, 0x5ba48c4d, 0x639f073e, + 0xc2a683d0, 0x13e811d8, 0xb2d19536, 0x8aea1e45, 0x2bd39aab, + 0xe030557a, 0x4109d194, 0x79325ae7, 0xd80bde09, 0x09454c01, + 0xa87cc8ef, 0x9047439c, 0x317ec772, 0xe9ab61cd, 0x4892e523, + 0x70a96e50, 0xd190eabe, 0x00de78b6, 0xa1e7fc58, 0x99dc772b, + 0x38e5f3c5}, + {0x00000000, 0xe81790a1, 0x0b5e2703, 0xe349b7a2, 0x16bc4e06, + 0xfeabdea7, 0x1de26905, 0xf5f5f9a4, 0x2d789c0c, 0xc56f0cad, + 0x2626bb0f, 0xce312bae, 0x3bc4d20a, 0xd3d342ab, 0x309af509, + 0xd88d65a8, 0x5af13818, 0xb2e6a8b9, 0x51af1f1b, 0xb9b88fba, + 0x4c4d761e, 0xa45ae6bf, 0x4713511d, 0xaf04c1bc, 0x7789a414, + 0x9f9e34b5, 0x7cd78317, 0x94c013b6, 0x6135ea12, 0x89227ab3, + 0x6a6bcd11, 0x827c5db0, 0xb5e27030, 0x5df5e091, 0xbebc5733, + 0x56abc792, 0xa35e3e36, 0x4b49ae97, 0xa8001935, 0x40178994, + 0x989aec3c, 0x708d7c9d, 0x93c4cb3f, 0x7bd35b9e, 0x8e26a23a, + 0x6631329b, 0x85788539, 0x6d6f1598, 0xef134828, 0x0704d889, + 0xe44d6f2b, 0x0c5aff8a, 0xf9af062e, 0x11b8968f, 0xf2f1212d, + 0x1ae6b18c, 0xc26bd424, 0x2a7c4485, 0xc935f327, 0x21226386, + 0xd4d79a22, 0x3cc00a83, 0xdf89bd21, 0x379e2d80, 0xb0b5e621, + 0x58a27680, 0xbbebc122, 0x53fc5183, 0xa609a827, 0x4e1e3886, + 0xad578f24, 0x45401f85, 0x9dcd7a2d, 0x75daea8c, 0x96935d2e, + 0x7e84cd8f, 0x8b71342b, 0x6366a48a, 0x802f1328, 0x68388389, + 0xea44de39, 0x02534e98, 0xe11af93a, 0x090d699b, 0xfcf8903f, + 0x14ef009e, 0xf7a6b73c, 0x1fb1279d, 0xc73c4235, 0x2f2bd294, + 0xcc626536, 0x2475f597, 0xd1800c33, 0x39979c92, 0xdade2b30, + 0x32c9bb91, 0x05579611, 0xed4006b0, 0x0e09b112, 0xe61e21b3, + 0x13ebd817, 0xfbfc48b6, 0x18b5ff14, 0xf0a26fb5, 0x282f0a1d, + 0xc0389abc, 0x23712d1e, 0xcb66bdbf, 0x3e93441b, 0xd684d4ba, + 0x35cd6318, 0xdddaf3b9, 0x5fa6ae09, 0xb7b13ea8, 0x54f8890a, + 0xbcef19ab, 0x491ae00f, 0xa10d70ae, 0x4244c70c, 0xaa5357ad, + 0x72de3205, 0x9ac9a2a4, 0x79801506, 0x919785a7, 0x64627c03, + 0x8c75eca2, 0x6f3c5b00, 0x872bcba1, 0xba1aca03, 0x520d5aa2, + 0xb144ed00, 0x59537da1, 0xaca68405, 0x44b114a4, 0xa7f8a306, + 0x4fef33a7, 0x9762560f, 0x7f75c6ae, 0x9c3c710c, 0x742be1ad, + 0x81de1809, 0x69c988a8, 0x8a803f0a, 0x6297afab, 0xe0ebf21b, + 0x08fc62ba, 0xebb5d518, 0x03a245b9, 0xf657bc1d, 0x1e402cbc, + 0xfd099b1e, 0x151e0bbf, 0xcd936e17, 0x2584feb6, 0xc6cd4914, + 0x2edad9b5, 0xdb2f2011, 0x3338b0b0, 0xd0710712, 0x386697b3, + 0x0ff8ba33, 0xe7ef2a92, 0x04a69d30, 0xecb10d91, 0x1944f435, + 0xf1536494, 0x121ad336, 0xfa0d4397, 0x2280263f, 0xca97b69e, + 0x29de013c, 0xc1c9919d, 0x343c6839, 0xdc2bf898, 0x3f624f3a, + 0xd775df9b, 0x5509822b, 0xbd1e128a, 0x5e57a528, 0xb6403589, + 0x43b5cc2d, 0xaba25c8c, 0x48ebeb2e, 0xa0fc7b8f, 0x78711e27, + 0x90668e86, 0x732f3924, 0x9b38a985, 0x6ecd5021, 0x86dac080, + 0x65937722, 0x8d84e783, 0x0aaf2c22, 0xe2b8bc83, 0x01f10b21, + 0xe9e69b80, 0x1c136224, 0xf404f285, 0x174d4527, 0xff5ad586, + 0x27d7b02e, 0xcfc0208f, 0x2c89972d, 0xc49e078c, 0x316bfe28, + 0xd97c6e89, 0x3a35d92b, 0xd222498a, 0x505e143a, 0xb849849b, + 0x5b003339, 0xb317a398, 0x46e25a3c, 0xaef5ca9d, 0x4dbc7d3f, + 0xa5abed9e, 0x7d268836, 0x95311897, 0x7678af35, 0x9e6f3f94, + 0x6b9ac630, 0x838d5691, 0x60c4e133, 0x88d37192, 0xbf4d5c12, + 0x575accb3, 0xb4137b11, 0x5c04ebb0, 0xa9f11214, 0x41e682b5, + 0xa2af3517, 0x4ab8a5b6, 0x9235c01e, 0x7a2250bf, 0x996be71d, + 0x717c77bc, 0x84898e18, 0x6c9e1eb9, 0x8fd7a91b, 0x67c039ba, + 0xe5bc640a, 0x0dabf4ab, 0xeee24309, 0x06f5d3a8, 0xf3002a0c, + 0x1b17baad, 0xf85e0d0f, 0x10499dae, 0xc8c4f806, 0x20d368a7, + 0xc39adf05, 0x2b8d4fa4, 0xde78b600, 0x366f26a1, 0xd5269103, + 0x3d3101a2}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x0000000000000000, 0xa19017e800000000, 0x03275e0b00000000, + 0xa2b749e300000000, 0x064ebc1600000000, 0xa7deabfe00000000, + 0x0569e21d00000000, 0xa4f9f5f500000000, 0x0c9c782d00000000, + 0xad0c6fc500000000, 0x0fbb262600000000, 0xae2b31ce00000000, + 0x0ad2c43b00000000, 0xab42d3d300000000, 0x09f59a3000000000, + 0xa8658dd800000000, 0x1838f15a00000000, 0xb9a8e6b200000000, + 0x1b1faf5100000000, 0xba8fb8b900000000, 0x1e764d4c00000000, + 0xbfe65aa400000000, 0x1d51134700000000, 0xbcc104af00000000, + 0x14a4897700000000, 0xb5349e9f00000000, 0x1783d77c00000000, + 0xb613c09400000000, 0x12ea356100000000, 0xb37a228900000000, + 0x11cd6b6a00000000, 0xb05d7c8200000000, 0x3070e2b500000000, + 0x91e0f55d00000000, 0x3357bcbe00000000, 0x92c7ab5600000000, + 0x363e5ea300000000, 0x97ae494b00000000, 0x351900a800000000, + 0x9489174000000000, 0x3cec9a9800000000, 0x9d7c8d7000000000, + 0x3fcbc49300000000, 0x9e5bd37b00000000, 0x3aa2268e00000000, + 0x9b32316600000000, 0x3985788500000000, 0x98156f6d00000000, + 0x284813ef00000000, 0x89d8040700000000, 0x2b6f4de400000000, + 0x8aff5a0c00000000, 0x2e06aff900000000, 0x8f96b81100000000, + 0x2d21f1f200000000, 0x8cb1e61a00000000, 0x24d46bc200000000, + 0x85447c2a00000000, 0x27f335c900000000, 0x8663222100000000, + 0x229ad7d400000000, 0x830ac03c00000000, 0x21bd89df00000000, + 0x802d9e3700000000, 0x21e6b5b000000000, 0x8076a25800000000, + 0x22c1ebbb00000000, 0x8351fc5300000000, 0x27a809a600000000, + 0x86381e4e00000000, 0x248f57ad00000000, 0x851f404500000000, + 0x2d7acd9d00000000, 0x8ceada7500000000, 0x2e5d939600000000, + 0x8fcd847e00000000, 0x2b34718b00000000, 0x8aa4666300000000, + 0x28132f8000000000, 0x8983386800000000, 0x39de44ea00000000, + 0x984e530200000000, 0x3af91ae100000000, 0x9b690d0900000000, + 0x3f90f8fc00000000, 0x9e00ef1400000000, 0x3cb7a6f700000000, + 0x9d27b11f00000000, 0x35423cc700000000, 0x94d22b2f00000000, + 0x366562cc00000000, 0x97f5752400000000, 0x330c80d100000000, + 0x929c973900000000, 0x302bdeda00000000, 0x91bbc93200000000, + 0x1196570500000000, 0xb00640ed00000000, 0x12b1090e00000000, + 0xb3211ee600000000, 0x17d8eb1300000000, 0xb648fcfb00000000, + 0x14ffb51800000000, 0xb56fa2f000000000, 0x1d0a2f2800000000, + 0xbc9a38c000000000, 0x1e2d712300000000, 0xbfbd66cb00000000, + 0x1b44933e00000000, 0xbad484d600000000, 0x1863cd3500000000, + 0xb9f3dadd00000000, 0x09aea65f00000000, 0xa83eb1b700000000, + 0x0a89f85400000000, 0xab19efbc00000000, 0x0fe01a4900000000, + 0xae700da100000000, 0x0cc7444200000000, 0xad5753aa00000000, + 0x0532de7200000000, 0xa4a2c99a00000000, 0x0615807900000000, + 0xa785979100000000, 0x037c626400000000, 0xa2ec758c00000000, + 0x005b3c6f00000000, 0xa1cb2b8700000000, 0x03ca1aba00000000, + 0xa25a0d5200000000, 0x00ed44b100000000, 0xa17d535900000000, + 0x0584a6ac00000000, 0xa414b14400000000, 0x06a3f8a700000000, + 0xa733ef4f00000000, 0x0f56629700000000, 0xaec6757f00000000, + 0x0c713c9c00000000, 0xade12b7400000000, 0x0918de8100000000, + 0xa888c96900000000, 0x0a3f808a00000000, 0xabaf976200000000, + 0x1bf2ebe000000000, 0xba62fc0800000000, 0x18d5b5eb00000000, + 0xb945a20300000000, 0x1dbc57f600000000, 0xbc2c401e00000000, + 0x1e9b09fd00000000, 0xbf0b1e1500000000, 0x176e93cd00000000, + 0xb6fe842500000000, 0x1449cdc600000000, 0xb5d9da2e00000000, + 0x11202fdb00000000, 0xb0b0383300000000, 0x120771d000000000, + 0xb397663800000000, 0x33baf80f00000000, 0x922aefe700000000, + 0x309da60400000000, 0x910db1ec00000000, 0x35f4441900000000, + 0x946453f100000000, 0x36d31a1200000000, 0x97430dfa00000000, + 0x3f26802200000000, 0x9eb697ca00000000, 0x3c01de2900000000, + 0x9d91c9c100000000, 0x39683c3400000000, 0x98f82bdc00000000, + 0x3a4f623f00000000, 0x9bdf75d700000000, 0x2b82095500000000, + 0x8a121ebd00000000, 0x28a5575e00000000, 0x893540b600000000, + 0x2dccb54300000000, 0x8c5ca2ab00000000, 0x2eebeb4800000000, + 0x8f7bfca000000000, 0x271e717800000000, 0x868e669000000000, + 0x24392f7300000000, 0x85a9389b00000000, 0x2150cd6e00000000, + 0x80c0da8600000000, 0x2277936500000000, 0x83e7848d00000000, + 0x222caf0a00000000, 0x83bcb8e200000000, 0x210bf10100000000, + 0x809be6e900000000, 0x2462131c00000000, 0x85f204f400000000, + 0x27454d1700000000, 0x86d55aff00000000, 0x2eb0d72700000000, + 0x8f20c0cf00000000, 0x2d97892c00000000, 0x8c079ec400000000, + 0x28fe6b3100000000, 0x896e7cd900000000, 0x2bd9353a00000000, + 0x8a4922d200000000, 0x3a145e5000000000, 0x9b8449b800000000, + 0x3933005b00000000, 0x98a317b300000000, 0x3c5ae24600000000, + 0x9dcaf5ae00000000, 0x3f7dbc4d00000000, 0x9eedaba500000000, + 0x3688267d00000000, 0x9718319500000000, 0x35af787600000000, + 0x943f6f9e00000000, 0x30c69a6b00000000, 0x91568d8300000000, + 0x33e1c46000000000, 0x9271d38800000000, 0x125c4dbf00000000, + 0xb3cc5a5700000000, 0x117b13b400000000, 0xb0eb045c00000000, + 0x1412f1a900000000, 0xb582e64100000000, 0x1735afa200000000, + 0xb6a5b84a00000000, 0x1ec0359200000000, 0xbf50227a00000000, + 0x1de76b9900000000, 0xbc777c7100000000, 0x188e898400000000, + 0xb91e9e6c00000000, 0x1ba9d78f00000000, 0xba39c06700000000, + 0x0a64bce500000000, 0xabf4ab0d00000000, 0x0943e2ee00000000, + 0xa8d3f50600000000, 0x0c2a00f300000000, 0xadba171b00000000, + 0x0f0d5ef800000000, 0xae9d491000000000, 0x06f8c4c800000000, + 0xa768d32000000000, 0x05df9ac300000000, 0xa44f8d2b00000000, + 0x00b678de00000000, 0xa1266f3600000000, 0x039126d500000000, + 0xa201313d00000000}, + {0x0000000000000000, 0xee8439a100000000, 0x9d0f029900000000, + 0x738b3b3800000000, 0x7b1975e900000000, 0x959d4c4800000000, + 0xe616777000000000, 0x08924ed100000000, 0xb7349b0900000000, + 0x59b0a2a800000000, 0x2a3b999000000000, 0xc4bfa03100000000, + 0xcc2deee000000000, 0x22a9d74100000000, 0x5122ec7900000000, + 0xbfa6d5d800000000, 0x6e69361300000000, 0x80ed0fb200000000, + 0xf366348a00000000, 0x1de20d2b00000000, 0x157043fa00000000, + 0xfbf47a5b00000000, 0x887f416300000000, 0x66fb78c200000000, + 0xd95dad1a00000000, 0x37d994bb00000000, 0x4452af8300000000, + 0xaad6962200000000, 0xa244d8f300000000, 0x4cc0e15200000000, + 0x3f4bda6a00000000, 0xd1cfe3cb00000000, 0xdcd26c2600000000, + 0x3256558700000000, 0x41dd6ebf00000000, 0xaf59571e00000000, + 0xa7cb19cf00000000, 0x494f206e00000000, 0x3ac41b5600000000, + 0xd44022f700000000, 0x6be6f72f00000000, 0x8562ce8e00000000, + 0xf6e9f5b600000000, 0x186dcc1700000000, 0x10ff82c600000000, + 0xfe7bbb6700000000, 0x8df0805f00000000, 0x6374b9fe00000000, + 0xb2bb5a3500000000, 0x5c3f639400000000, 0x2fb458ac00000000, + 0xc130610d00000000, 0xc9a22fdc00000000, 0x2726167d00000000, + 0x54ad2d4500000000, 0xba2914e400000000, 0x058fc13c00000000, + 0xeb0bf89d00000000, 0x9880c3a500000000, 0x7604fa0400000000, + 0x7e96b4d500000000, 0x90128d7400000000, 0xe399b64c00000000, + 0x0d1d8fed00000000, 0xb8a5d94c00000000, 0x5621e0ed00000000, + 0x25aadbd500000000, 0xcb2ee27400000000, 0xc3bcaca500000000, + 0x2d38950400000000, 0x5eb3ae3c00000000, 0xb037979d00000000, + 0x0f91424500000000, 0xe1157be400000000, 0x929e40dc00000000, + 0x7c1a797d00000000, 0x748837ac00000000, 0x9a0c0e0d00000000, + 0xe987353500000000, 0x07030c9400000000, 0xd6ccef5f00000000, + 0x3848d6fe00000000, 0x4bc3edc600000000, 0xa547d46700000000, + 0xadd59ab600000000, 0x4351a31700000000, 0x30da982f00000000, + 0xde5ea18e00000000, 0x61f8745600000000, 0x8f7c4df700000000, + 0xfcf776cf00000000, 0x12734f6e00000000, 0x1ae101bf00000000, + 0xf465381e00000000, 0x87ee032600000000, 0x696a3a8700000000, + 0x6477b56a00000000, 0x8af38ccb00000000, 0xf978b7f300000000, + 0x17fc8e5200000000, 0x1f6ec08300000000, 0xf1eaf92200000000, + 0x8261c21a00000000, 0x6ce5fbbb00000000, 0xd3432e6300000000, + 0x3dc717c200000000, 0x4e4c2cfa00000000, 0xa0c8155b00000000, + 0xa85a5b8a00000000, 0x46de622b00000000, 0x3555591300000000, + 0xdbd160b200000000, 0x0a1e837900000000, 0xe49abad800000000, + 0x971181e000000000, 0x7995b84100000000, 0x7107f69000000000, + 0x9f83cf3100000000, 0xec08f40900000000, 0x028ccda800000000, + 0xbd2a187000000000, 0x53ae21d100000000, 0x20251ae900000000, + 0xcea1234800000000, 0xc6336d9900000000, 0x28b7543800000000, + 0x5b3c6f0000000000, 0xb5b856a100000000, 0x704bb39900000000, + 0x9ecf8a3800000000, 0xed44b10000000000, 0x03c088a100000000, + 0x0b52c67000000000, 0xe5d6ffd100000000, 0x965dc4e900000000, + 0x78d9fd4800000000, 0xc77f289000000000, 0x29fb113100000000, + 0x5a702a0900000000, 0xb4f413a800000000, 0xbc665d7900000000, + 0x52e264d800000000, 0x21695fe000000000, 0xcfed664100000000, + 0x1e22858a00000000, 0xf0a6bc2b00000000, 0x832d871300000000, + 0x6da9beb200000000, 0x653bf06300000000, 0x8bbfc9c200000000, + 0xf834f2fa00000000, 0x16b0cb5b00000000, 0xa9161e8300000000, + 0x4792272200000000, 0x34191c1a00000000, 0xda9d25bb00000000, + 0xd20f6b6a00000000, 0x3c8b52cb00000000, 0x4f0069f300000000, + 0xa184505200000000, 0xac99dfbf00000000, 0x421de61e00000000, + 0x3196dd2600000000, 0xdf12e48700000000, 0xd780aa5600000000, + 0x390493f700000000, 0x4a8fa8cf00000000, 0xa40b916e00000000, + 0x1bad44b600000000, 0xf5297d1700000000, 0x86a2462f00000000, + 0x68267f8e00000000, 0x60b4315f00000000, 0x8e3008fe00000000, + 0xfdbb33c600000000, 0x133f0a6700000000, 0xc2f0e9ac00000000, + 0x2c74d00d00000000, 0x5fffeb3500000000, 0xb17bd29400000000, + 0xb9e99c4500000000, 0x576da5e400000000, 0x24e69edc00000000, + 0xca62a77d00000000, 0x75c472a500000000, 0x9b404b0400000000, + 0xe8cb703c00000000, 0x064f499d00000000, 0x0edd074c00000000, + 0xe0593eed00000000, 0x93d205d500000000, 0x7d563c7400000000, + 0xc8ee6ad500000000, 0x266a537400000000, 0x55e1684c00000000, + 0xbb6551ed00000000, 0xb3f71f3c00000000, 0x5d73269d00000000, + 0x2ef81da500000000, 0xc07c240400000000, 0x7fdaf1dc00000000, + 0x915ec87d00000000, 0xe2d5f34500000000, 0x0c51cae400000000, + 0x04c3843500000000, 0xea47bd9400000000, 0x99cc86ac00000000, + 0x7748bf0d00000000, 0xa6875cc600000000, 0x4803656700000000, + 0x3b885e5f00000000, 0xd50c67fe00000000, 0xdd9e292f00000000, + 0x331a108e00000000, 0x40912bb600000000, 0xae15121700000000, + 0x11b3c7cf00000000, 0xff37fe6e00000000, 0x8cbcc55600000000, + 0x6238fcf700000000, 0x6aaab22600000000, 0x842e8b8700000000, + 0xf7a5b0bf00000000, 0x1921891e00000000, 0x143c06f300000000, + 0xfab83f5200000000, 0x8933046a00000000, 0x67b73dcb00000000, + 0x6f25731a00000000, 0x81a14abb00000000, 0xf22a718300000000, + 0x1cae482200000000, 0xa3089dfa00000000, 0x4d8ca45b00000000, + 0x3e079f6300000000, 0xd083a6c200000000, 0xd811e81300000000, + 0x3695d1b200000000, 0x451eea8a00000000, 0xab9ad32b00000000, + 0x7a5530e000000000, 0x94d1094100000000, 0xe75a327900000000, + 0x09de0bd800000000, 0x014c450900000000, 0xefc87ca800000000, + 0x9c43479000000000, 0x72c77e3100000000, 0xcd61abe900000000, + 0x23e5924800000000, 0x506ea97000000000, 0xbeea90d100000000, + 0xb678de0000000000, 0x58fce7a100000000, 0x2b77dc9900000000, + 0xc5f3e53800000000}, + {0x0000000000000000, 0xfbf6134700000000, 0xf6ed278e00000000, + 0x0d1b34c900000000, 0xaddd3ec700000000, 0x562b2d8000000000, + 0x5b30194900000000, 0xa0c60a0e00000000, 0x1bbd0c5500000000, + 0xe04b1f1200000000, 0xed502bdb00000000, 0x16a6389c00000000, + 0xb660329200000000, 0x4d9621d500000000, 0x408d151c00000000, + 0xbb7b065b00000000, 0x367a19aa00000000, 0xcd8c0aed00000000, + 0xc0973e2400000000, 0x3b612d6300000000, 0x9ba7276d00000000, + 0x6051342a00000000, 0x6d4a00e300000000, 0x96bc13a400000000, + 0x2dc715ff00000000, 0xd63106b800000000, 0xdb2a327100000000, + 0x20dc213600000000, 0x801a2b3800000000, 0x7bec387f00000000, + 0x76f70cb600000000, 0x8d011ff100000000, 0x2df2438f00000000, + 0xd60450c800000000, 0xdb1f640100000000, 0x20e9774600000000, + 0x802f7d4800000000, 0x7bd96e0f00000000, 0x76c25ac600000000, + 0x8d34498100000000, 0x364f4fda00000000, 0xcdb95c9d00000000, + 0xc0a2685400000000, 0x3b547b1300000000, 0x9b92711d00000000, + 0x6064625a00000000, 0x6d7f569300000000, 0x968945d400000000, + 0x1b885a2500000000, 0xe07e496200000000, 0xed657dab00000000, + 0x16936eec00000000, 0xb65564e200000000, 0x4da377a500000000, + 0x40b8436c00000000, 0xbb4e502b00000000, 0x0035567000000000, + 0xfbc3453700000000, 0xf6d871fe00000000, 0x0d2e62b900000000, + 0xade868b700000000, 0x561e7bf000000000, 0x5b054f3900000000, + 0xa0f35c7e00000000, 0x1be2f6c500000000, 0xe014e58200000000, + 0xed0fd14b00000000, 0x16f9c20c00000000, 0xb63fc80200000000, + 0x4dc9db4500000000, 0x40d2ef8c00000000, 0xbb24fccb00000000, + 0x005ffa9000000000, 0xfba9e9d700000000, 0xf6b2dd1e00000000, + 0x0d44ce5900000000, 0xad82c45700000000, 0x5674d71000000000, + 0x5b6fe3d900000000, 0xa099f09e00000000, 0x2d98ef6f00000000, + 0xd66efc2800000000, 0xdb75c8e100000000, 0x2083dba600000000, + 0x8045d1a800000000, 0x7bb3c2ef00000000, 0x76a8f62600000000, + 0x8d5ee56100000000, 0x3625e33a00000000, 0xcdd3f07d00000000, + 0xc0c8c4b400000000, 0x3b3ed7f300000000, 0x9bf8ddfd00000000, + 0x600eceba00000000, 0x6d15fa7300000000, 0x96e3e93400000000, + 0x3610b54a00000000, 0xcde6a60d00000000, 0xc0fd92c400000000, + 0x3b0b818300000000, 0x9bcd8b8d00000000, 0x603b98ca00000000, + 0x6d20ac0300000000, 0x96d6bf4400000000, 0x2dadb91f00000000, + 0xd65baa5800000000, 0xdb409e9100000000, 0x20b68dd600000000, + 0x807087d800000000, 0x7b86949f00000000, 0x769da05600000000, + 0x8d6bb31100000000, 0x006aace000000000, 0xfb9cbfa700000000, + 0xf6878b6e00000000, 0x0d71982900000000, 0xadb7922700000000, + 0x5641816000000000, 0x5b5ab5a900000000, 0xa0aca6ee00000000, + 0x1bd7a0b500000000, 0xe021b3f200000000, 0xed3a873b00000000, + 0x16cc947c00000000, 0xb60a9e7200000000, 0x4dfc8d3500000000, + 0x40e7b9fc00000000, 0xbb11aabb00000000, 0x77c29c5000000000, + 0x8c348f1700000000, 0x812fbbde00000000, 0x7ad9a89900000000, + 0xda1fa29700000000, 0x21e9b1d000000000, 0x2cf2851900000000, + 0xd704965e00000000, 0x6c7f900500000000, 0x9789834200000000, + 0x9a92b78b00000000, 0x6164a4cc00000000, 0xc1a2aec200000000, + 0x3a54bd8500000000, 0x374f894c00000000, 0xccb99a0b00000000, + 0x41b885fa00000000, 0xba4e96bd00000000, 0xb755a27400000000, + 0x4ca3b13300000000, 0xec65bb3d00000000, 0x1793a87a00000000, + 0x1a889cb300000000, 0xe17e8ff400000000, 0x5a0589af00000000, + 0xa1f39ae800000000, 0xace8ae2100000000, 0x571ebd6600000000, + 0xf7d8b76800000000, 0x0c2ea42f00000000, 0x013590e600000000, + 0xfac383a100000000, 0x5a30dfdf00000000, 0xa1c6cc9800000000, + 0xacddf85100000000, 0x572beb1600000000, 0xf7ede11800000000, + 0x0c1bf25f00000000, 0x0100c69600000000, 0xfaf6d5d100000000, + 0x418dd38a00000000, 0xba7bc0cd00000000, 0xb760f40400000000, + 0x4c96e74300000000, 0xec50ed4d00000000, 0x17a6fe0a00000000, + 0x1abdcac300000000, 0xe14bd98400000000, 0x6c4ac67500000000, + 0x97bcd53200000000, 0x9aa7e1fb00000000, 0x6151f2bc00000000, + 0xc197f8b200000000, 0x3a61ebf500000000, 0x377adf3c00000000, + 0xcc8ccc7b00000000, 0x77f7ca2000000000, 0x8c01d96700000000, + 0x811aedae00000000, 0x7aecfee900000000, 0xda2af4e700000000, + 0x21dce7a000000000, 0x2cc7d36900000000, 0xd731c02e00000000, + 0x6c206a9500000000, 0x97d679d200000000, 0x9acd4d1b00000000, + 0x613b5e5c00000000, 0xc1fd545200000000, 0x3a0b471500000000, + 0x371073dc00000000, 0xcce6609b00000000, 0x779d66c000000000, + 0x8c6b758700000000, 0x8170414e00000000, 0x7a86520900000000, + 0xda40580700000000, 0x21b64b4000000000, 0x2cad7f8900000000, + 0xd75b6cce00000000, 0x5a5a733f00000000, 0xa1ac607800000000, + 0xacb754b100000000, 0x574147f600000000, 0xf7874df800000000, + 0x0c715ebf00000000, 0x016a6a7600000000, 0xfa9c793100000000, + 0x41e77f6a00000000, 0xba116c2d00000000, 0xb70a58e400000000, + 0x4cfc4ba300000000, 0xec3a41ad00000000, 0x17cc52ea00000000, + 0x1ad7662300000000, 0xe121756400000000, 0x41d2291a00000000, + 0xba243a5d00000000, 0xb73f0e9400000000, 0x4cc91dd300000000, + 0xec0f17dd00000000, 0x17f9049a00000000, 0x1ae2305300000000, + 0xe114231400000000, 0x5a6f254f00000000, 0xa199360800000000, + 0xac8202c100000000, 0x5774118600000000, 0xf7b21b8800000000, + 0x0c4408cf00000000, 0x015f3c0600000000, 0xfaa92f4100000000, + 0x77a830b000000000, 0x8c5e23f700000000, 0x8145173e00000000, + 0x7ab3047900000000, 0xda750e7700000000, 0x21831d3000000000, + 0x2c9829f900000000, 0xd76e3abe00000000, 0x6c153ce500000000, + 0x97e32fa200000000, 0x9af81b6b00000000, 0x610e082c00000000, + 0xc1c8022200000000, 0x3a3e116500000000, 0x372525ac00000000, + 0xccd336eb00000000}, + {0x0000000000000000, 0x6238282a00000000, 0xc470505400000000, + 0xa648787e00000000, 0x88e1a0a800000000, 0xead9888200000000, + 0x4c91f0fc00000000, 0x2ea9d8d600000000, 0x51c5308a00000000, + 0x33fd18a000000000, 0x95b560de00000000, 0xf78d48f400000000, + 0xd924902200000000, 0xbb1cb80800000000, 0x1d54c07600000000, + 0x7f6ce85c00000000, 0xe38c10cf00000000, 0x81b438e500000000, + 0x27fc409b00000000, 0x45c468b100000000, 0x6b6db06700000000, + 0x0955984d00000000, 0xaf1de03300000000, 0xcd25c81900000000, + 0xb249204500000000, 0xd071086f00000000, 0x7639701100000000, + 0x1401583b00000000, 0x3aa880ed00000000, 0x5890a8c700000000, + 0xfed8d0b900000000, 0x9ce0f89300000000, 0x871f504500000000, + 0xe527786f00000000, 0x436f001100000000, 0x2157283b00000000, + 0x0ffef0ed00000000, 0x6dc6d8c700000000, 0xcb8ea0b900000000, + 0xa9b6889300000000, 0xd6da60cf00000000, 0xb4e248e500000000, + 0x12aa309b00000000, 0x709218b100000000, 0x5e3bc06700000000, + 0x3c03e84d00000000, 0x9a4b903300000000, 0xf873b81900000000, + 0x6493408a00000000, 0x06ab68a000000000, 0xa0e310de00000000, + 0xc2db38f400000000, 0xec72e02200000000, 0x8e4ac80800000000, + 0x2802b07600000000, 0x4a3a985c00000000, 0x3556700000000000, + 0x576e582a00000000, 0xf126205400000000, 0x931e087e00000000, + 0xbdb7d0a800000000, 0xdf8ff88200000000, 0x79c780fc00000000, + 0x1bffa8d600000000, 0x0e3fa08a00000000, 0x6c0788a000000000, + 0xca4ff0de00000000, 0xa877d8f400000000, 0x86de002200000000, + 0xe4e6280800000000, 0x42ae507600000000, 0x2096785c00000000, + 0x5ffa900000000000, 0x3dc2b82a00000000, 0x9b8ac05400000000, + 0xf9b2e87e00000000, 0xd71b30a800000000, 0xb523188200000000, + 0x136b60fc00000000, 0x715348d600000000, 0xedb3b04500000000, + 0x8f8b986f00000000, 0x29c3e01100000000, 0x4bfbc83b00000000, + 0x655210ed00000000, 0x076a38c700000000, 0xa12240b900000000, + 0xc31a689300000000, 0xbc7680cf00000000, 0xde4ea8e500000000, + 0x7806d09b00000000, 0x1a3ef8b100000000, 0x3497206700000000, + 0x56af084d00000000, 0xf0e7703300000000, 0x92df581900000000, + 0x8920f0cf00000000, 0xeb18d8e500000000, 0x4d50a09b00000000, + 0x2f6888b100000000, 0x01c1506700000000, 0x63f9784d00000000, + 0xc5b1003300000000, 0xa789281900000000, 0xd8e5c04500000000, + 0xbadde86f00000000, 0x1c95901100000000, 0x7eadb83b00000000, + 0x500460ed00000000, 0x323c48c700000000, 0x947430b900000000, + 0xf64c189300000000, 0x6aace00000000000, 0x0894c82a00000000, + 0xaedcb05400000000, 0xcce4987e00000000, 0xe24d40a800000000, + 0x8075688200000000, 0x263d10fc00000000, 0x440538d600000000, + 0x3b69d08a00000000, 0x5951f8a000000000, 0xff1980de00000000, + 0x9d21a8f400000000, 0xb388702200000000, 0xd1b0580800000000, + 0x77f8207600000000, 0x15c0085c00000000, 0x5d7831ce00000000, + 0x3f4019e400000000, 0x9908619a00000000, 0xfb3049b000000000, + 0xd599916600000000, 0xb7a1b94c00000000, 0x11e9c13200000000, + 0x73d1e91800000000, 0x0cbd014400000000, 0x6e85296e00000000, + 0xc8cd511000000000, 0xaaf5793a00000000, 0x845ca1ec00000000, + 0xe66489c600000000, 0x402cf1b800000000, 0x2214d99200000000, + 0xbef4210100000000, 0xdccc092b00000000, 0x7a84715500000000, + 0x18bc597f00000000, 0x361581a900000000, 0x542da98300000000, + 0xf265d1fd00000000, 0x905df9d700000000, 0xef31118b00000000, + 0x8d0939a100000000, 0x2b4141df00000000, 0x497969f500000000, + 0x67d0b12300000000, 0x05e8990900000000, 0xa3a0e17700000000, + 0xc198c95d00000000, 0xda67618b00000000, 0xb85f49a100000000, + 0x1e1731df00000000, 0x7c2f19f500000000, 0x5286c12300000000, + 0x30bee90900000000, 0x96f6917700000000, 0xf4ceb95d00000000, + 0x8ba2510100000000, 0xe99a792b00000000, 0x4fd2015500000000, + 0x2dea297f00000000, 0x0343f1a900000000, 0x617bd98300000000, + 0xc733a1fd00000000, 0xa50b89d700000000, 0x39eb714400000000, + 0x5bd3596e00000000, 0xfd9b211000000000, 0x9fa3093a00000000, + 0xb10ad1ec00000000, 0xd332f9c600000000, 0x757a81b800000000, + 0x1742a99200000000, 0x682e41ce00000000, 0x0a1669e400000000, + 0xac5e119a00000000, 0xce6639b000000000, 0xe0cfe16600000000, + 0x82f7c94c00000000, 0x24bfb13200000000, 0x4687991800000000, + 0x5347914400000000, 0x317fb96e00000000, 0x9737c11000000000, + 0xf50fe93a00000000, 0xdba631ec00000000, 0xb99e19c600000000, + 0x1fd661b800000000, 0x7dee499200000000, 0x0282a1ce00000000, + 0x60ba89e400000000, 0xc6f2f19a00000000, 0xa4cad9b000000000, + 0x8a63016600000000, 0xe85b294c00000000, 0x4e13513200000000, + 0x2c2b791800000000, 0xb0cb818b00000000, 0xd2f3a9a100000000, + 0x74bbd1df00000000, 0x1683f9f500000000, 0x382a212300000000, + 0x5a12090900000000, 0xfc5a717700000000, 0x9e62595d00000000, + 0xe10eb10100000000, 0x8336992b00000000, 0x257ee15500000000, + 0x4746c97f00000000, 0x69ef11a900000000, 0x0bd7398300000000, + 0xad9f41fd00000000, 0xcfa769d700000000, 0xd458c10100000000, + 0xb660e92b00000000, 0x1028915500000000, 0x7210b97f00000000, + 0x5cb961a900000000, 0x3e81498300000000, 0x98c931fd00000000, + 0xfaf119d700000000, 0x859df18b00000000, 0xe7a5d9a100000000, + 0x41eda1df00000000, 0x23d589f500000000, 0x0d7c512300000000, + 0x6f44790900000000, 0xc90c017700000000, 0xab34295d00000000, + 0x37d4d1ce00000000, 0x55ecf9e400000000, 0xf3a4819a00000000, + 0x919ca9b000000000, 0xbf35716600000000, 0xdd0d594c00000000, + 0x7b45213200000000, 0x197d091800000000, 0x6611e14400000000, + 0x0429c96e00000000, 0xa261b11000000000, 0xc059993a00000000, + 0xeef041ec00000000, 0x8cc869c600000000, 0x2a8011b800000000, + 0x48b8399200000000}, + {0x0000000000000000, 0x4c2896a300000000, 0xd9565d9c00000000, + 0x957ecb3f00000000, 0xf3abcbe300000000, 0xbf835d4000000000, + 0x2afd967f00000000, 0x66d500dc00000000, 0xa751e61c00000000, + 0xeb7970bf00000000, 0x7e07bb8000000000, 0x322f2d2300000000, + 0x54fa2dff00000000, 0x18d2bb5c00000000, 0x8dac706300000000, + 0xc184e6c000000000, 0x4ea3cc3900000000, 0x028b5a9a00000000, + 0x97f591a500000000, 0xdbdd070600000000, 0xbd0807da00000000, + 0xf120917900000000, 0x645e5a4600000000, 0x2876cce500000000, + 0xe9f22a2500000000, 0xa5dabc8600000000, 0x30a477b900000000, + 0x7c8ce11a00000000, 0x1a59e1c600000000, 0x5671776500000000, + 0xc30fbc5a00000000, 0x8f272af900000000, 0x9c46997300000000, + 0xd06e0fd000000000, 0x4510c4ef00000000, 0x0938524c00000000, + 0x6fed529000000000, 0x23c5c43300000000, 0xb6bb0f0c00000000, + 0xfa9399af00000000, 0x3b177f6f00000000, 0x773fe9cc00000000, + 0xe24122f300000000, 0xae69b45000000000, 0xc8bcb48c00000000, + 0x8494222f00000000, 0x11eae91000000000, 0x5dc27fb300000000, + 0xd2e5554a00000000, 0x9ecdc3e900000000, 0x0bb308d600000000, + 0x479b9e7500000000, 0x214e9ea900000000, 0x6d66080a00000000, + 0xf818c33500000000, 0xb430559600000000, 0x75b4b35600000000, + 0x399c25f500000000, 0xace2eeca00000000, 0xe0ca786900000000, + 0x861f78b500000000, 0xca37ee1600000000, 0x5f49252900000000, + 0x1361b38a00000000, 0x388d32e700000000, 0x74a5a44400000000, + 0xe1db6f7b00000000, 0xadf3f9d800000000, 0xcb26f90400000000, + 0x870e6fa700000000, 0x1270a49800000000, 0x5e58323b00000000, + 0x9fdcd4fb00000000, 0xd3f4425800000000, 0x468a896700000000, + 0x0aa21fc400000000, 0x6c771f1800000000, 0x205f89bb00000000, + 0xb521428400000000, 0xf909d42700000000, 0x762efede00000000, + 0x3a06687d00000000, 0xaf78a34200000000, 0xe35035e100000000, + 0x8585353d00000000, 0xc9ada39e00000000, 0x5cd368a100000000, + 0x10fbfe0200000000, 0xd17f18c200000000, 0x9d578e6100000000, + 0x0829455e00000000, 0x4401d3fd00000000, 0x22d4d32100000000, + 0x6efc458200000000, 0xfb828ebd00000000, 0xb7aa181e00000000, + 0xa4cbab9400000000, 0xe8e33d3700000000, 0x7d9df60800000000, + 0x31b560ab00000000, 0x5760607700000000, 0x1b48f6d400000000, + 0x8e363deb00000000, 0xc21eab4800000000, 0x039a4d8800000000, + 0x4fb2db2b00000000, 0xdacc101400000000, 0x96e486b700000000, + 0xf031866b00000000, 0xbc1910c800000000, 0x2967dbf700000000, + 0x654f4d5400000000, 0xea6867ad00000000, 0xa640f10e00000000, + 0x333e3a3100000000, 0x7f16ac9200000000, 0x19c3ac4e00000000, + 0x55eb3aed00000000, 0xc095f1d200000000, 0x8cbd677100000000, + 0x4d3981b100000000, 0x0111171200000000, 0x946fdc2d00000000, + 0xd8474a8e00000000, 0xbe924a5200000000, 0xf2badcf100000000, + 0x67c417ce00000000, 0x2bec816d00000000, 0x311c141500000000, + 0x7d3482b600000000, 0xe84a498900000000, 0xa462df2a00000000, + 0xc2b7dff600000000, 0x8e9f495500000000, 0x1be1826a00000000, + 0x57c914c900000000, 0x964df20900000000, 0xda6564aa00000000, + 0x4f1baf9500000000, 0x0333393600000000, 0x65e639ea00000000, + 0x29ceaf4900000000, 0xbcb0647600000000, 0xf098f2d500000000, + 0x7fbfd82c00000000, 0x33974e8f00000000, 0xa6e985b000000000, + 0xeac1131300000000, 0x8c1413cf00000000, 0xc03c856c00000000, + 0x55424e5300000000, 0x196ad8f000000000, 0xd8ee3e3000000000, + 0x94c6a89300000000, 0x01b863ac00000000, 0x4d90f50f00000000, + 0x2b45f5d300000000, 0x676d637000000000, 0xf213a84f00000000, + 0xbe3b3eec00000000, 0xad5a8d6600000000, 0xe1721bc500000000, + 0x740cd0fa00000000, 0x3824465900000000, 0x5ef1468500000000, + 0x12d9d02600000000, 0x87a71b1900000000, 0xcb8f8dba00000000, + 0x0a0b6b7a00000000, 0x4623fdd900000000, 0xd35d36e600000000, + 0x9f75a04500000000, 0xf9a0a09900000000, 0xb588363a00000000, + 0x20f6fd0500000000, 0x6cde6ba600000000, 0xe3f9415f00000000, + 0xafd1d7fc00000000, 0x3aaf1cc300000000, 0x76878a6000000000, + 0x10528abc00000000, 0x5c7a1c1f00000000, 0xc904d72000000000, + 0x852c418300000000, 0x44a8a74300000000, 0x088031e000000000, + 0x9dfefadf00000000, 0xd1d66c7c00000000, 0xb7036ca000000000, + 0xfb2bfa0300000000, 0x6e55313c00000000, 0x227da79f00000000, + 0x099126f200000000, 0x45b9b05100000000, 0xd0c77b6e00000000, + 0x9cefedcd00000000, 0xfa3aed1100000000, 0xb6127bb200000000, + 0x236cb08d00000000, 0x6f44262e00000000, 0xaec0c0ee00000000, + 0xe2e8564d00000000, 0x77969d7200000000, 0x3bbe0bd100000000, + 0x5d6b0b0d00000000, 0x11439dae00000000, 0x843d569100000000, + 0xc815c03200000000, 0x4732eacb00000000, 0x0b1a7c6800000000, + 0x9e64b75700000000, 0xd24c21f400000000, 0xb499212800000000, + 0xf8b1b78b00000000, 0x6dcf7cb400000000, 0x21e7ea1700000000, + 0xe0630cd700000000, 0xac4b9a7400000000, 0x3935514b00000000, + 0x751dc7e800000000, 0x13c8c73400000000, 0x5fe0519700000000, + 0xca9e9aa800000000, 0x86b60c0b00000000, 0x95d7bf8100000000, + 0xd9ff292200000000, 0x4c81e21d00000000, 0x00a974be00000000, + 0x667c746200000000, 0x2a54e2c100000000, 0xbf2a29fe00000000, + 0xf302bf5d00000000, 0x3286599d00000000, 0x7eaecf3e00000000, + 0xebd0040100000000, 0xa7f892a200000000, 0xc12d927e00000000, + 0x8d0504dd00000000, 0x187bcfe200000000, 0x5453594100000000, + 0xdb7473b800000000, 0x975ce51b00000000, 0x02222e2400000000, + 0x4e0ab88700000000, 0x28dfb85b00000000, 0x64f72ef800000000, + 0xf189e5c700000000, 0xbda1736400000000, 0x7c2595a400000000, + 0x300d030700000000, 0xa573c83800000000, 0xe95b5e9b00000000, + 0x8f8e5e4700000000, 0xc3a6c8e400000000, 0x56d803db00000000, + 0x1af0957800000000}, + {0x0000000000000000, 0x939bc97f00000000, 0x263793ff00000000, + 0xb5ac5a8000000000, 0x0d68572400000000, 0x9ef39e5b00000000, + 0x2b5fc4db00000000, 0xb8c40da400000000, 0x1ad0ae4800000000, + 0x894b673700000000, 0x3ce73db700000000, 0xaf7cf4c800000000, + 0x17b8f96c00000000, 0x8423301300000000, 0x318f6a9300000000, + 0xa214a3ec00000000, 0x34a05d9100000000, 0xa73b94ee00000000, + 0x1297ce6e00000000, 0x810c071100000000, 0x39c80ab500000000, + 0xaa53c3ca00000000, 0x1fff994a00000000, 0x8c64503500000000, + 0x2e70f3d900000000, 0xbdeb3aa600000000, 0x0847602600000000, + 0x9bdca95900000000, 0x2318a4fd00000000, 0xb0836d8200000000, + 0x052f370200000000, 0x96b4fe7d00000000, 0x2946caf900000000, + 0xbadd038600000000, 0x0f71590600000000, 0x9cea907900000000, + 0x242e9ddd00000000, 0xb7b554a200000000, 0x02190e2200000000, + 0x9182c75d00000000, 0x339664b100000000, 0xa00dadce00000000, + 0x15a1f74e00000000, 0x863a3e3100000000, 0x3efe339500000000, + 0xad65faea00000000, 0x18c9a06a00000000, 0x8b52691500000000, + 0x1de6976800000000, 0x8e7d5e1700000000, 0x3bd1049700000000, + 0xa84acde800000000, 0x108ec04c00000000, 0x8315093300000000, + 0x36b953b300000000, 0xa5229acc00000000, 0x0736392000000000, + 0x94adf05f00000000, 0x2101aadf00000000, 0xb29a63a000000000, + 0x0a5e6e0400000000, 0x99c5a77b00000000, 0x2c69fdfb00000000, + 0xbff2348400000000, 0x138ae52800000000, 0x80112c5700000000, + 0x35bd76d700000000, 0xa626bfa800000000, 0x1ee2b20c00000000, + 0x8d797b7300000000, 0x38d521f300000000, 0xab4ee88c00000000, + 0x095a4b6000000000, 0x9ac1821f00000000, 0x2f6dd89f00000000, + 0xbcf611e000000000, 0x04321c4400000000, 0x97a9d53b00000000, + 0x22058fbb00000000, 0xb19e46c400000000, 0x272ab8b900000000, + 0xb4b171c600000000, 0x011d2b4600000000, 0x9286e23900000000, + 0x2a42ef9d00000000, 0xb9d926e200000000, 0x0c757c6200000000, + 0x9feeb51d00000000, 0x3dfa16f100000000, 0xae61df8e00000000, + 0x1bcd850e00000000, 0x88564c7100000000, 0x309241d500000000, + 0xa30988aa00000000, 0x16a5d22a00000000, 0x853e1b5500000000, + 0x3acc2fd100000000, 0xa957e6ae00000000, 0x1cfbbc2e00000000, + 0x8f60755100000000, 0x37a478f500000000, 0xa43fb18a00000000, + 0x1193eb0a00000000, 0x8208227500000000, 0x201c819900000000, + 0xb38748e600000000, 0x062b126600000000, 0x95b0db1900000000, + 0x2d74d6bd00000000, 0xbeef1fc200000000, 0x0b43454200000000, + 0x98d88c3d00000000, 0x0e6c724000000000, 0x9df7bb3f00000000, + 0x285be1bf00000000, 0xbbc028c000000000, 0x0304256400000000, + 0x909fec1b00000000, 0x2533b69b00000000, 0xb6a87fe400000000, + 0x14bcdc0800000000, 0x8727157700000000, 0x328b4ff700000000, + 0xa110868800000000, 0x19d48b2c00000000, 0x8a4f425300000000, + 0x3fe318d300000000, 0xac78d1ac00000000, 0x2614cb5100000000, + 0xb58f022e00000000, 0x002358ae00000000, 0x93b891d100000000, + 0x2b7c9c7500000000, 0xb8e7550a00000000, 0x0d4b0f8a00000000, + 0x9ed0c6f500000000, 0x3cc4651900000000, 0xaf5fac6600000000, + 0x1af3f6e600000000, 0x89683f9900000000, 0x31ac323d00000000, + 0xa237fb4200000000, 0x179ba1c200000000, 0x840068bd00000000, + 0x12b496c000000000, 0x812f5fbf00000000, 0x3483053f00000000, + 0xa718cc4000000000, 0x1fdcc1e400000000, 0x8c47089b00000000, + 0x39eb521b00000000, 0xaa709b6400000000, 0x0864388800000000, + 0x9bfff1f700000000, 0x2e53ab7700000000, 0xbdc8620800000000, + 0x050c6fac00000000, 0x9697a6d300000000, 0x233bfc5300000000, + 0xb0a0352c00000000, 0x0f5201a800000000, 0x9cc9c8d700000000, + 0x2965925700000000, 0xbafe5b2800000000, 0x023a568c00000000, + 0x91a19ff300000000, 0x240dc57300000000, 0xb7960c0c00000000, + 0x1582afe000000000, 0x8619669f00000000, 0x33b53c1f00000000, + 0xa02ef56000000000, 0x18eaf8c400000000, 0x8b7131bb00000000, + 0x3edd6b3b00000000, 0xad46a24400000000, 0x3bf25c3900000000, + 0xa869954600000000, 0x1dc5cfc600000000, 0x8e5e06b900000000, + 0x369a0b1d00000000, 0xa501c26200000000, 0x10ad98e200000000, + 0x8336519d00000000, 0x2122f27100000000, 0xb2b93b0e00000000, + 0x0715618e00000000, 0x948ea8f100000000, 0x2c4aa55500000000, + 0xbfd16c2a00000000, 0x0a7d36aa00000000, 0x99e6ffd500000000, + 0x359e2e7900000000, 0xa605e70600000000, 0x13a9bd8600000000, + 0x803274f900000000, 0x38f6795d00000000, 0xab6db02200000000, + 0x1ec1eaa200000000, 0x8d5a23dd00000000, 0x2f4e803100000000, + 0xbcd5494e00000000, 0x097913ce00000000, 0x9ae2dab100000000, + 0x2226d71500000000, 0xb1bd1e6a00000000, 0x041144ea00000000, + 0x978a8d9500000000, 0x013e73e800000000, 0x92a5ba9700000000, + 0x2709e01700000000, 0xb492296800000000, 0x0c5624cc00000000, + 0x9fcdedb300000000, 0x2a61b73300000000, 0xb9fa7e4c00000000, + 0x1beedda000000000, 0x887514df00000000, 0x3dd94e5f00000000, + 0xae42872000000000, 0x16868a8400000000, 0x851d43fb00000000, + 0x30b1197b00000000, 0xa32ad00400000000, 0x1cd8e48000000000, + 0x8f432dff00000000, 0x3aef777f00000000, 0xa974be0000000000, + 0x11b0b3a400000000, 0x822b7adb00000000, 0x3787205b00000000, + 0xa41ce92400000000, 0x06084ac800000000, 0x959383b700000000, + 0x203fd93700000000, 0xb3a4104800000000, 0x0b601dec00000000, + 0x98fbd49300000000, 0x2d578e1300000000, 0xbecc476c00000000, + 0x2878b91100000000, 0xbbe3706e00000000, 0x0e4f2aee00000000, + 0x9dd4e39100000000, 0x2510ee3500000000, 0xb68b274a00000000, + 0x03277dca00000000, 0x90bcb4b500000000, 0x32a8175900000000, + 0xa133de2600000000, 0x149f84a600000000, 0x87044dd900000000, + 0x3fc0407d00000000, 0xac5b890200000000, 0x19f7d38200000000, + 0x8a6c1afd00000000}, + {0x0000000000000000, 0x650b796900000000, 0xca16f2d200000000, + 0xaf1d8bbb00000000, 0xd52b957e00000000, 0xb020ec1700000000, + 0x1f3d67ac00000000, 0x7a361ec500000000, 0xaa572afd00000000, + 0xcf5c539400000000, 0x6041d82f00000000, 0x054aa14600000000, + 0x7f7cbf8300000000, 0x1a77c6ea00000000, 0xb56a4d5100000000, + 0xd061343800000000, 0x15a9252100000000, 0x70a25c4800000000, + 0xdfbfd7f300000000, 0xbab4ae9a00000000, 0xc082b05f00000000, + 0xa589c93600000000, 0x0a94428d00000000, 0x6f9f3be400000000, + 0xbffe0fdc00000000, 0xdaf576b500000000, 0x75e8fd0e00000000, + 0x10e3846700000000, 0x6ad59aa200000000, 0x0fdee3cb00000000, + 0xa0c3687000000000, 0xc5c8111900000000, 0x2a524b4200000000, + 0x4f59322b00000000, 0xe044b99000000000, 0x854fc0f900000000, + 0xff79de3c00000000, 0x9a72a75500000000, 0x356f2cee00000000, + 0x5064558700000000, 0x800561bf00000000, 0xe50e18d600000000, + 0x4a13936d00000000, 0x2f18ea0400000000, 0x552ef4c100000000, + 0x30258da800000000, 0x9f38061300000000, 0xfa337f7a00000000, + 0x3ffb6e6300000000, 0x5af0170a00000000, 0xf5ed9cb100000000, + 0x90e6e5d800000000, 0xead0fb1d00000000, 0x8fdb827400000000, + 0x20c609cf00000000, 0x45cd70a600000000, 0x95ac449e00000000, + 0xf0a73df700000000, 0x5fbab64c00000000, 0x3ab1cf2500000000, + 0x4087d1e000000000, 0x258ca88900000000, 0x8a91233200000000, + 0xef9a5a5b00000000, 0x54a4968400000000, 0x31afefed00000000, + 0x9eb2645600000000, 0xfbb91d3f00000000, 0x818f03fa00000000, + 0xe4847a9300000000, 0x4b99f12800000000, 0x2e92884100000000, + 0xfef3bc7900000000, 0x9bf8c51000000000, 0x34e54eab00000000, + 0x51ee37c200000000, 0x2bd8290700000000, 0x4ed3506e00000000, + 0xe1cedbd500000000, 0x84c5a2bc00000000, 0x410db3a500000000, + 0x2406cacc00000000, 0x8b1b417700000000, 0xee10381e00000000, + 0x942626db00000000, 0xf12d5fb200000000, 0x5e30d40900000000, + 0x3b3bad6000000000, 0xeb5a995800000000, 0x8e51e03100000000, + 0x214c6b8a00000000, 0x444712e300000000, 0x3e710c2600000000, + 0x5b7a754f00000000, 0xf467fef400000000, 0x916c879d00000000, + 0x7ef6ddc600000000, 0x1bfda4af00000000, 0xb4e02f1400000000, + 0xd1eb567d00000000, 0xabdd48b800000000, 0xced631d100000000, + 0x61cbba6a00000000, 0x04c0c30300000000, 0xd4a1f73b00000000, + 0xb1aa8e5200000000, 0x1eb705e900000000, 0x7bbc7c8000000000, + 0x018a624500000000, 0x64811b2c00000000, 0xcb9c909700000000, + 0xae97e9fe00000000, 0x6b5ff8e700000000, 0x0e54818e00000000, + 0xa1490a3500000000, 0xc442735c00000000, 0xbe746d9900000000, + 0xdb7f14f000000000, 0x74629f4b00000000, 0x1169e62200000000, + 0xc108d21a00000000, 0xa403ab7300000000, 0x0b1e20c800000000, + 0x6e1559a100000000, 0x1423476400000000, 0x71283e0d00000000, + 0xde35b5b600000000, 0xbb3eccdf00000000, 0xe94e5cd200000000, + 0x8c4525bb00000000, 0x2358ae0000000000, 0x4653d76900000000, + 0x3c65c9ac00000000, 0x596eb0c500000000, 0xf6733b7e00000000, + 0x9378421700000000, 0x4319762f00000000, 0x26120f4600000000, + 0x890f84fd00000000, 0xec04fd9400000000, 0x9632e35100000000, + 0xf3399a3800000000, 0x5c24118300000000, 0x392f68ea00000000, + 0xfce779f300000000, 0x99ec009a00000000, 0x36f18b2100000000, + 0x53faf24800000000, 0x29ccec8d00000000, 0x4cc795e400000000, + 0xe3da1e5f00000000, 0x86d1673600000000, 0x56b0530e00000000, + 0x33bb2a6700000000, 0x9ca6a1dc00000000, 0xf9add8b500000000, + 0x839bc67000000000, 0xe690bf1900000000, 0x498d34a200000000, + 0x2c864dcb00000000, 0xc31c179000000000, 0xa6176ef900000000, + 0x090ae54200000000, 0x6c019c2b00000000, 0x163782ee00000000, + 0x733cfb8700000000, 0xdc21703c00000000, 0xb92a095500000000, + 0x694b3d6d00000000, 0x0c40440400000000, 0xa35dcfbf00000000, + 0xc656b6d600000000, 0xbc60a81300000000, 0xd96bd17a00000000, + 0x76765ac100000000, 0x137d23a800000000, 0xd6b532b100000000, + 0xb3be4bd800000000, 0x1ca3c06300000000, 0x79a8b90a00000000, + 0x039ea7cf00000000, 0x6695dea600000000, 0xc988551d00000000, + 0xac832c7400000000, 0x7ce2184c00000000, 0x19e9612500000000, + 0xb6f4ea9e00000000, 0xd3ff93f700000000, 0xa9c98d3200000000, + 0xccc2f45b00000000, 0x63df7fe000000000, 0x06d4068900000000, + 0xbdeaca5600000000, 0xd8e1b33f00000000, 0x77fc388400000000, + 0x12f741ed00000000, 0x68c15f2800000000, 0x0dca264100000000, + 0xa2d7adfa00000000, 0xc7dcd49300000000, 0x17bde0ab00000000, + 0x72b699c200000000, 0xddab127900000000, 0xb8a06b1000000000, + 0xc29675d500000000, 0xa79d0cbc00000000, 0x0880870700000000, + 0x6d8bfe6e00000000, 0xa843ef7700000000, 0xcd48961e00000000, + 0x62551da500000000, 0x075e64cc00000000, 0x7d687a0900000000, + 0x1863036000000000, 0xb77e88db00000000, 0xd275f1b200000000, + 0x0214c58a00000000, 0x671fbce300000000, 0xc802375800000000, + 0xad094e3100000000, 0xd73f50f400000000, 0xb234299d00000000, + 0x1d29a22600000000, 0x7822db4f00000000, 0x97b8811400000000, + 0xf2b3f87d00000000, 0x5dae73c600000000, 0x38a50aaf00000000, + 0x4293146a00000000, 0x27986d0300000000, 0x8885e6b800000000, + 0xed8e9fd100000000, 0x3defabe900000000, 0x58e4d28000000000, + 0xf7f9593b00000000, 0x92f2205200000000, 0xe8c43e9700000000, + 0x8dcf47fe00000000, 0x22d2cc4500000000, 0x47d9b52c00000000, + 0x8211a43500000000, 0xe71add5c00000000, 0x480756e700000000, + 0x2d0c2f8e00000000, 0x573a314b00000000, 0x3231482200000000, + 0x9d2cc39900000000, 0xf827baf000000000, 0x28468ec800000000, + 0x4d4df7a100000000, 0xe2507c1a00000000, 0x875b057300000000, + 0xfd6d1bb600000000, 0x986662df00000000, 0x377be96400000000, + 0x5270900d00000000}, + {0x0000000000000000, 0xdcecb13d00000000, 0xb8d9637b00000000, + 0x6435d24600000000, 0x70b3c7f600000000, 0xac5f76cb00000000, + 0xc86aa48d00000000, 0x148615b000000000, 0xa160fe3600000000, + 0x7d8c4f0b00000000, 0x19b99d4d00000000, 0xc5552c7000000000, + 0xd1d339c000000000, 0x0d3f88fd00000000, 0x690a5abb00000000, + 0xb5e6eb8600000000, 0x42c1fc6d00000000, 0x9e2d4d5000000000, + 0xfa189f1600000000, 0x26f42e2b00000000, 0x32723b9b00000000, + 0xee9e8aa600000000, 0x8aab58e000000000, 0x5647e9dd00000000, + 0xe3a1025b00000000, 0x3f4db36600000000, 0x5b78612000000000, + 0x8794d01d00000000, 0x9312c5ad00000000, 0x4ffe749000000000, + 0x2bcba6d600000000, 0xf72717eb00000000, 0x8482f9db00000000, + 0x586e48e600000000, 0x3c5b9aa000000000, 0xe0b72b9d00000000, + 0xf4313e2d00000000, 0x28dd8f1000000000, 0x4ce85d5600000000, + 0x9004ec6b00000000, 0x25e207ed00000000, 0xf90eb6d000000000, + 0x9d3b649600000000, 0x41d7d5ab00000000, 0x5551c01b00000000, + 0x89bd712600000000, 0xed88a36000000000, 0x3164125d00000000, + 0xc64305b600000000, 0x1aafb48b00000000, 0x7e9a66cd00000000, + 0xa276d7f000000000, 0xb6f0c24000000000, 0x6a1c737d00000000, + 0x0e29a13b00000000, 0xd2c5100600000000, 0x6723fb8000000000, + 0xbbcf4abd00000000, 0xdffa98fb00000000, 0x031629c600000000, + 0x17903c7600000000, 0xcb7c8d4b00000000, 0xaf495f0d00000000, + 0x73a5ee3000000000, 0x4903826c00000000, 0x95ef335100000000, + 0xf1dae11700000000, 0x2d36502a00000000, 0x39b0459a00000000, + 0xe55cf4a700000000, 0x816926e100000000, 0x5d8597dc00000000, + 0xe8637c5a00000000, 0x348fcd6700000000, 0x50ba1f2100000000, + 0x8c56ae1c00000000, 0x98d0bbac00000000, 0x443c0a9100000000, + 0x2009d8d700000000, 0xfce569ea00000000, 0x0bc27e0100000000, + 0xd72ecf3c00000000, 0xb31b1d7a00000000, 0x6ff7ac4700000000, + 0x7b71b9f700000000, 0xa79d08ca00000000, 0xc3a8da8c00000000, + 0x1f446bb100000000, 0xaaa2803700000000, 0x764e310a00000000, + 0x127be34c00000000, 0xce97527100000000, 0xda1147c100000000, + 0x06fdf6fc00000000, 0x62c824ba00000000, 0xbe24958700000000, + 0xcd817bb700000000, 0x116dca8a00000000, 0x755818cc00000000, + 0xa9b4a9f100000000, 0xbd32bc4100000000, 0x61de0d7c00000000, + 0x05ebdf3a00000000, 0xd9076e0700000000, 0x6ce1858100000000, + 0xb00d34bc00000000, 0xd438e6fa00000000, 0x08d457c700000000, + 0x1c52427700000000, 0xc0bef34a00000000, 0xa48b210c00000000, + 0x7867903100000000, 0x8f4087da00000000, 0x53ac36e700000000, + 0x3799e4a100000000, 0xeb75559c00000000, 0xfff3402c00000000, + 0x231ff11100000000, 0x472a235700000000, 0x9bc6926a00000000, + 0x2e2079ec00000000, 0xf2ccc8d100000000, 0x96f91a9700000000, + 0x4a15abaa00000000, 0x5e93be1a00000000, 0x827f0f2700000000, + 0xe64add6100000000, 0x3aa66c5c00000000, 0x920604d900000000, + 0x4eeab5e400000000, 0x2adf67a200000000, 0xf633d69f00000000, + 0xe2b5c32f00000000, 0x3e59721200000000, 0x5a6ca05400000000, + 0x8680116900000000, 0x3366faef00000000, 0xef8a4bd200000000, + 0x8bbf999400000000, 0x575328a900000000, 0x43d53d1900000000, + 0x9f398c2400000000, 0xfb0c5e6200000000, 0x27e0ef5f00000000, + 0xd0c7f8b400000000, 0x0c2b498900000000, 0x681e9bcf00000000, + 0xb4f22af200000000, 0xa0743f4200000000, 0x7c988e7f00000000, + 0x18ad5c3900000000, 0xc441ed0400000000, 0x71a7068200000000, + 0xad4bb7bf00000000, 0xc97e65f900000000, 0x1592d4c400000000, + 0x0114c17400000000, 0xddf8704900000000, 0xb9cda20f00000000, + 0x6521133200000000, 0x1684fd0200000000, 0xca684c3f00000000, + 0xae5d9e7900000000, 0x72b12f4400000000, 0x66373af400000000, + 0xbadb8bc900000000, 0xdeee598f00000000, 0x0202e8b200000000, + 0xb7e4033400000000, 0x6b08b20900000000, 0x0f3d604f00000000, + 0xd3d1d17200000000, 0xc757c4c200000000, 0x1bbb75ff00000000, + 0x7f8ea7b900000000, 0xa362168400000000, 0x5445016f00000000, + 0x88a9b05200000000, 0xec9c621400000000, 0x3070d32900000000, + 0x24f6c69900000000, 0xf81a77a400000000, 0x9c2fa5e200000000, + 0x40c314df00000000, 0xf525ff5900000000, 0x29c94e6400000000, + 0x4dfc9c2200000000, 0x91102d1f00000000, 0x859638af00000000, + 0x597a899200000000, 0x3d4f5bd400000000, 0xe1a3eae900000000, + 0xdb0586b500000000, 0x07e9378800000000, 0x63dce5ce00000000, + 0xbf3054f300000000, 0xabb6414300000000, 0x775af07e00000000, + 0x136f223800000000, 0xcf83930500000000, 0x7a65788300000000, + 0xa689c9be00000000, 0xc2bc1bf800000000, 0x1e50aac500000000, + 0x0ad6bf7500000000, 0xd63a0e4800000000, 0xb20fdc0e00000000, + 0x6ee36d3300000000, 0x99c47ad800000000, 0x4528cbe500000000, + 0x211d19a300000000, 0xfdf1a89e00000000, 0xe977bd2e00000000, + 0x359b0c1300000000, 0x51aede5500000000, 0x8d426f6800000000, + 0x38a484ee00000000, 0xe44835d300000000, 0x807de79500000000, + 0x5c9156a800000000, 0x4817431800000000, 0x94fbf22500000000, + 0xf0ce206300000000, 0x2c22915e00000000, 0x5f877f6e00000000, + 0x836bce5300000000, 0xe75e1c1500000000, 0x3bb2ad2800000000, + 0x2f34b89800000000, 0xf3d809a500000000, 0x97eddbe300000000, + 0x4b016ade00000000, 0xfee7815800000000, 0x220b306500000000, + 0x463ee22300000000, 0x9ad2531e00000000, 0x8e5446ae00000000, + 0x52b8f79300000000, 0x368d25d500000000, 0xea6194e800000000, + 0x1d46830300000000, 0xc1aa323e00000000, 0xa59fe07800000000, + 0x7973514500000000, 0x6df544f500000000, 0xb119f5c800000000, + 0xd52c278e00000000, 0x09c096b300000000, 0xbc267d3500000000, + 0x60cacc0800000000, 0x04ff1e4e00000000, 0xd813af7300000000, + 0xcc95bac300000000, 0x10790bfe00000000, 0x744cd9b800000000, + 0xa8a0688500000000}}; + +#else /* W == 4 */ + +local const z_crc_t FAR crc_braid_table[][256] = { + {0x00000000, 0x81256527, 0xd93bcc0f, 0x581ea928, 0x69069e5f, + 0xe823fb78, 0xb03d5250, 0x31183777, 0xd20d3cbe, 0x53285999, + 0x0b36f0b1, 0x8a139596, 0xbb0ba2e1, 0x3a2ec7c6, 0x62306eee, + 0xe3150bc9, 0x7f6b7f3d, 0xfe4e1a1a, 0xa650b332, 0x2775d615, + 0x166de162, 0x97488445, 0xcf562d6d, 0x4e73484a, 0xad664383, + 0x2c4326a4, 0x745d8f8c, 0xf578eaab, 0xc460dddc, 0x4545b8fb, + 0x1d5b11d3, 0x9c7e74f4, 0xfed6fe7a, 0x7ff39b5d, 0x27ed3275, + 0xa6c85752, 0x97d06025, 0x16f50502, 0x4eebac2a, 0xcfcec90d, + 0x2cdbc2c4, 0xadfea7e3, 0xf5e00ecb, 0x74c56bec, 0x45dd5c9b, + 0xc4f839bc, 0x9ce69094, 0x1dc3f5b3, 0x81bd8147, 0x0098e460, + 0x58864d48, 0xd9a3286f, 0xe8bb1f18, 0x699e7a3f, 0x3180d317, + 0xb0a5b630, 0x53b0bdf9, 0xd295d8de, 0x8a8b71f6, 0x0bae14d1, + 0x3ab623a6, 0xbb934681, 0xe38defa9, 0x62a88a8e, 0x26dcfab5, + 0xa7f99f92, 0xffe736ba, 0x7ec2539d, 0x4fda64ea, 0xceff01cd, + 0x96e1a8e5, 0x17c4cdc2, 0xf4d1c60b, 0x75f4a32c, 0x2dea0a04, + 0xaccf6f23, 0x9dd75854, 0x1cf23d73, 0x44ec945b, 0xc5c9f17c, + 0x59b78588, 0xd892e0af, 0x808c4987, 0x01a92ca0, 0x30b11bd7, + 0xb1947ef0, 0xe98ad7d8, 0x68afb2ff, 0x8bbab936, 0x0a9fdc11, + 0x52817539, 0xd3a4101e, 0xe2bc2769, 0x6399424e, 0x3b87eb66, + 0xbaa28e41, 0xd80a04cf, 0x592f61e8, 0x0131c8c0, 0x8014ade7, + 0xb10c9a90, 0x3029ffb7, 0x6837569f, 0xe91233b8, 0x0a073871, + 0x8b225d56, 0xd33cf47e, 0x52199159, 0x6301a62e, 0xe224c309, + 0xba3a6a21, 0x3b1f0f06, 0xa7617bf2, 0x26441ed5, 0x7e5ab7fd, + 0xff7fd2da, 0xce67e5ad, 0x4f42808a, 0x175c29a2, 0x96794c85, + 0x756c474c, 0xf449226b, 0xac578b43, 0x2d72ee64, 0x1c6ad913, + 0x9d4fbc34, 0xc551151c, 0x4474703b, 0x4db9f56a, 0xcc9c904d, + 0x94823965, 0x15a75c42, 0x24bf6b35, 0xa59a0e12, 0xfd84a73a, + 0x7ca1c21d, 0x9fb4c9d4, 0x1e91acf3, 0x468f05db, 0xc7aa60fc, + 0xf6b2578b, 0x779732ac, 0x2f899b84, 0xaeacfea3, 0x32d28a57, + 0xb3f7ef70, 0xebe94658, 0x6acc237f, 0x5bd41408, 0xdaf1712f, + 0x82efd807, 0x03cabd20, 0xe0dfb6e9, 0x61fad3ce, 0x39e47ae6, + 0xb8c11fc1, 0x89d928b6, 0x08fc4d91, 0x50e2e4b9, 0xd1c7819e, + 0xb36f0b10, 0x324a6e37, 0x6a54c71f, 0xeb71a238, 0xda69954f, + 0x5b4cf068, 0x03525940, 0x82773c67, 0x616237ae, 0xe0475289, + 0xb859fba1, 0x397c9e86, 0x0864a9f1, 0x8941ccd6, 0xd15f65fe, + 0x507a00d9, 0xcc04742d, 0x4d21110a, 0x153fb822, 0x941add05, + 0xa502ea72, 0x24278f55, 0x7c39267d, 0xfd1c435a, 0x1e094893, + 0x9f2c2db4, 0xc732849c, 0x4617e1bb, 0x770fd6cc, 0xf62ab3eb, + 0xae341ac3, 0x2f117fe4, 0x6b650fdf, 0xea406af8, 0xb25ec3d0, + 0x337ba6f7, 0x02639180, 0x8346f4a7, 0xdb585d8f, 0x5a7d38a8, + 0xb9683361, 0x384d5646, 0x6053ff6e, 0xe1769a49, 0xd06ead3e, + 0x514bc819, 0x09556131, 0x88700416, 0x140e70e2, 0x952b15c5, + 0xcd35bced, 0x4c10d9ca, 0x7d08eebd, 0xfc2d8b9a, 0xa43322b2, + 0x25164795, 0xc6034c5c, 0x4726297b, 0x1f388053, 0x9e1de574, + 0xaf05d203, 0x2e20b724, 0x763e1e0c, 0xf71b7b2b, 0x95b3f1a5, + 0x14969482, 0x4c883daa, 0xcdad588d, 0xfcb56ffa, 0x7d900add, + 0x258ea3f5, 0xa4abc6d2, 0x47becd1b, 0xc69ba83c, 0x9e850114, + 0x1fa06433, 0x2eb85344, 0xaf9d3663, 0xf7839f4b, 0x76a6fa6c, + 0xead88e98, 0x6bfdebbf, 0x33e34297, 0xb2c627b0, 0x83de10c7, + 0x02fb75e0, 0x5ae5dcc8, 0xdbc0b9ef, 0x38d5b226, 0xb9f0d701, + 0xe1ee7e29, 0x60cb1b0e, 0x51d32c79, 0xd0f6495e, 0x88e8e076, + 0x09cd8551}, + {0x00000000, 0x9b73ead4, 0xed96d3e9, 0x76e5393d, 0x005ca193, + 0x9b2f4b47, 0xedca727a, 0x76b998ae, 0x00b94326, 0x9bcaa9f2, + 0xed2f90cf, 0x765c7a1b, 0x00e5e2b5, 0x9b960861, 0xed73315c, + 0x7600db88, 0x0172864c, 0x9a016c98, 0xece455a5, 0x7797bf71, + 0x012e27df, 0x9a5dcd0b, 0xecb8f436, 0x77cb1ee2, 0x01cbc56a, + 0x9ab82fbe, 0xec5d1683, 0x772efc57, 0x019764f9, 0x9ae48e2d, + 0xec01b710, 0x77725dc4, 0x02e50c98, 0x9996e64c, 0xef73df71, + 0x740035a5, 0x02b9ad0b, 0x99ca47df, 0xef2f7ee2, 0x745c9436, + 0x025c4fbe, 0x992fa56a, 0xefca9c57, 0x74b97683, 0x0200ee2d, + 0x997304f9, 0xef963dc4, 0x74e5d710, 0x03978ad4, 0x98e46000, + 0xee01593d, 0x7572b3e9, 0x03cb2b47, 0x98b8c193, 0xee5df8ae, + 0x752e127a, 0x032ec9f2, 0x985d2326, 0xeeb81a1b, 0x75cbf0cf, + 0x03726861, 0x980182b5, 0xeee4bb88, 0x7597515c, 0x05ca1930, + 0x9eb9f3e4, 0xe85ccad9, 0x732f200d, 0x0596b8a3, 0x9ee55277, + 0xe8006b4a, 0x7373819e, 0x05735a16, 0x9e00b0c2, 0xe8e589ff, + 0x7396632b, 0x052ffb85, 0x9e5c1151, 0xe8b9286c, 0x73cac2b8, + 0x04b89f7c, 0x9fcb75a8, 0xe92e4c95, 0x725da641, 0x04e43eef, + 0x9f97d43b, 0xe972ed06, 0x720107d2, 0x0401dc5a, 0x9f72368e, + 0xe9970fb3, 0x72e4e567, 0x045d7dc9, 0x9f2e971d, 0xe9cbae20, + 0x72b844f4, 0x072f15a8, 0x9c5cff7c, 0xeab9c641, 0x71ca2c95, + 0x0773b43b, 0x9c005eef, 0xeae567d2, 0x71968d06, 0x0796568e, + 0x9ce5bc5a, 0xea008567, 0x71736fb3, 0x07caf71d, 0x9cb91dc9, + 0xea5c24f4, 0x712fce20, 0x065d93e4, 0x9d2e7930, 0xebcb400d, + 0x70b8aad9, 0x06013277, 0x9d72d8a3, 0xeb97e19e, 0x70e40b4a, + 0x06e4d0c2, 0x9d973a16, 0xeb72032b, 0x7001e9ff, 0x06b87151, + 0x9dcb9b85, 0xeb2ea2b8, 0x705d486c, 0x0b943260, 0x90e7d8b4, + 0xe602e189, 0x7d710b5d, 0x0bc893f3, 0x90bb7927, 0xe65e401a, + 0x7d2daace, 0x0b2d7146, 0x905e9b92, 0xe6bba2af, 0x7dc8487b, + 0x0b71d0d5, 0x90023a01, 0xe6e7033c, 0x7d94e9e8, 0x0ae6b42c, + 0x91955ef8, 0xe77067c5, 0x7c038d11, 0x0aba15bf, 0x91c9ff6b, + 0xe72cc656, 0x7c5f2c82, 0x0a5ff70a, 0x912c1dde, 0xe7c924e3, + 0x7cbace37, 0x0a035699, 0x9170bc4d, 0xe7958570, 0x7ce66fa4, + 0x09713ef8, 0x9202d42c, 0xe4e7ed11, 0x7f9407c5, 0x092d9f6b, + 0x925e75bf, 0xe4bb4c82, 0x7fc8a656, 0x09c87dde, 0x92bb970a, + 0xe45eae37, 0x7f2d44e3, 0x0994dc4d, 0x92e73699, 0xe4020fa4, + 0x7f71e570, 0x0803b8b4, 0x93705260, 0xe5956b5d, 0x7ee68189, + 0x085f1927, 0x932cf3f3, 0xe5c9cace, 0x7eba201a, 0x08bafb92, + 0x93c91146, 0xe52c287b, 0x7e5fc2af, 0x08e65a01, 0x9395b0d5, + 0xe57089e8, 0x7e03633c, 0x0e5e2b50, 0x952dc184, 0xe3c8f8b9, + 0x78bb126d, 0x0e028ac3, 0x95716017, 0xe394592a, 0x78e7b3fe, + 0x0ee76876, 0x959482a2, 0xe371bb9f, 0x7802514b, 0x0ebbc9e5, + 0x95c82331, 0xe32d1a0c, 0x785ef0d8, 0x0f2cad1c, 0x945f47c8, + 0xe2ba7ef5, 0x79c99421, 0x0f700c8f, 0x9403e65b, 0xe2e6df66, + 0x799535b2, 0x0f95ee3a, 0x94e604ee, 0xe2033dd3, 0x7970d707, + 0x0fc94fa9, 0x94baa57d, 0xe25f9c40, 0x792c7694, 0x0cbb27c8, + 0x97c8cd1c, 0xe12df421, 0x7a5e1ef5, 0x0ce7865b, 0x97946c8f, + 0xe17155b2, 0x7a02bf66, 0x0c0264ee, 0x97718e3a, 0xe194b707, + 0x7ae75dd3, 0x0c5ec57d, 0x972d2fa9, 0xe1c81694, 0x7abbfc40, + 0x0dc9a184, 0x96ba4b50, 0xe05f726d, 0x7b2c98b9, 0x0d950017, + 0x96e6eac3, 0xe003d3fe, 0x7b70392a, 0x0d70e2a2, 0x96030876, + 0xe0e6314b, 0x7b95db9f, 0x0d2c4331, 0x965fa9e5, 0xe0ba90d8, + 0x7bc97a0c}, + {0x00000000, 0x172864c0, 0x2e50c980, 0x3978ad40, 0x5ca19300, + 0x4b89f7c0, 0x72f15a80, 0x65d93e40, 0xb9432600, 0xae6b42c0, + 0x9713ef80, 0x803b8b40, 0xe5e2b500, 0xf2cad1c0, 0xcbb27c80, + 0xdc9a1840, 0xa9f74a41, 0xbedf2e81, 0x87a783c1, 0x908fe701, + 0xf556d941, 0xe27ebd81, 0xdb0610c1, 0xcc2e7401, 0x10b46c41, + 0x079c0881, 0x3ee4a5c1, 0x29ccc101, 0x4c15ff41, 0x5b3d9b81, + 0x624536c1, 0x756d5201, 0x889f92c3, 0x9fb7f603, 0xa6cf5b43, + 0xb1e73f83, 0xd43e01c3, 0xc3166503, 0xfa6ec843, 0xed46ac83, + 0x31dcb4c3, 0x26f4d003, 0x1f8c7d43, 0x08a41983, 0x6d7d27c3, + 0x7a554303, 0x432dee43, 0x54058a83, 0x2168d882, 0x3640bc42, + 0x0f381102, 0x181075c2, 0x7dc94b82, 0x6ae12f42, 0x53998202, + 0x44b1e6c2, 0x982bfe82, 0x8f039a42, 0xb67b3702, 0xa15353c2, + 0xc48a6d82, 0xd3a20942, 0xeadaa402, 0xfdf2c0c2, 0xca4e23c7, + 0xdd664707, 0xe41eea47, 0xf3368e87, 0x96efb0c7, 0x81c7d407, + 0xb8bf7947, 0xaf971d87, 0x730d05c7, 0x64256107, 0x5d5dcc47, + 0x4a75a887, 0x2fac96c7, 0x3884f207, 0x01fc5f47, 0x16d43b87, + 0x63b96986, 0x74910d46, 0x4de9a006, 0x5ac1c4c6, 0x3f18fa86, + 0x28309e46, 0x11483306, 0x066057c6, 0xdafa4f86, 0xcdd22b46, + 0xf4aa8606, 0xe382e2c6, 0x865bdc86, 0x9173b846, 0xa80b1506, + 0xbf2371c6, 0x42d1b104, 0x55f9d5c4, 0x6c817884, 0x7ba91c44, + 0x1e702204, 0x095846c4, 0x3020eb84, 0x27088f44, 0xfb929704, + 0xecbaf3c4, 0xd5c25e84, 0xc2ea3a44, 0xa7330404, 0xb01b60c4, + 0x8963cd84, 0x9e4ba944, 0xeb26fb45, 0xfc0e9f85, 0xc57632c5, + 0xd25e5605, 0xb7876845, 0xa0af0c85, 0x99d7a1c5, 0x8effc505, + 0x5265dd45, 0x454db985, 0x7c3514c5, 0x6b1d7005, 0x0ec44e45, + 0x19ec2a85, 0x209487c5, 0x37bce305, 0x4fed41cf, 0x58c5250f, + 0x61bd884f, 0x7695ec8f, 0x134cd2cf, 0x0464b60f, 0x3d1c1b4f, + 0x2a347f8f, 0xf6ae67cf, 0xe186030f, 0xd8feae4f, 0xcfd6ca8f, + 0xaa0ff4cf, 0xbd27900f, 0x845f3d4f, 0x9377598f, 0xe61a0b8e, + 0xf1326f4e, 0xc84ac20e, 0xdf62a6ce, 0xbabb988e, 0xad93fc4e, + 0x94eb510e, 0x83c335ce, 0x5f592d8e, 0x4871494e, 0x7109e40e, + 0x662180ce, 0x03f8be8e, 0x14d0da4e, 0x2da8770e, 0x3a8013ce, + 0xc772d30c, 0xd05ab7cc, 0xe9221a8c, 0xfe0a7e4c, 0x9bd3400c, + 0x8cfb24cc, 0xb583898c, 0xa2abed4c, 0x7e31f50c, 0x691991cc, + 0x50613c8c, 0x4749584c, 0x2290660c, 0x35b802cc, 0x0cc0af8c, + 0x1be8cb4c, 0x6e85994d, 0x79adfd8d, 0x40d550cd, 0x57fd340d, + 0x32240a4d, 0x250c6e8d, 0x1c74c3cd, 0x0b5ca70d, 0xd7c6bf4d, + 0xc0eedb8d, 0xf99676cd, 0xeebe120d, 0x8b672c4d, 0x9c4f488d, + 0xa537e5cd, 0xb21f810d, 0x85a36208, 0x928b06c8, 0xabf3ab88, + 0xbcdbcf48, 0xd902f108, 0xce2a95c8, 0xf7523888, 0xe07a5c48, + 0x3ce04408, 0x2bc820c8, 0x12b08d88, 0x0598e948, 0x6041d708, + 0x7769b3c8, 0x4e111e88, 0x59397a48, 0x2c542849, 0x3b7c4c89, + 0x0204e1c9, 0x152c8509, 0x70f5bb49, 0x67dddf89, 0x5ea572c9, + 0x498d1609, 0x95170e49, 0x823f6a89, 0xbb47c7c9, 0xac6fa309, + 0xc9b69d49, 0xde9ef989, 0xe7e654c9, 0xf0ce3009, 0x0d3cf0cb, + 0x1a14940b, 0x236c394b, 0x34445d8b, 0x519d63cb, 0x46b5070b, + 0x7fcdaa4b, 0x68e5ce8b, 0xb47fd6cb, 0xa357b20b, 0x9a2f1f4b, + 0x8d077b8b, 0xe8de45cb, 0xfff6210b, 0xc68e8c4b, 0xd1a6e88b, + 0xa4cbba8a, 0xb3e3de4a, 0x8a9b730a, 0x9db317ca, 0xf86a298a, + 0xef424d4a, 0xd63ae00a, 0xc11284ca, 0x1d889c8a, 0x0aa0f84a, + 0x33d8550a, 0x24f031ca, 0x41290f8a, 0x56016b4a, 0x6f79c60a, + 0x7851a2ca}, + {0x00000000, 0x9fda839e, 0xe4c4017d, 0x7b1e82e3, 0x12f904bb, + 0x8d238725, 0xf63d05c6, 0x69e78658, 0x25f20976, 0xba288ae8, + 0xc136080b, 0x5eec8b95, 0x370b0dcd, 0xa8d18e53, 0xd3cf0cb0, + 0x4c158f2e, 0x4be412ec, 0xd43e9172, 0xaf201391, 0x30fa900f, + 0x591d1657, 0xc6c795c9, 0xbdd9172a, 0x220394b4, 0x6e161b9a, + 0xf1cc9804, 0x8ad21ae7, 0x15089979, 0x7cef1f21, 0xe3359cbf, + 0x982b1e5c, 0x07f19dc2, 0x97c825d8, 0x0812a646, 0x730c24a5, + 0xecd6a73b, 0x85312163, 0x1aeba2fd, 0x61f5201e, 0xfe2fa380, + 0xb23a2cae, 0x2de0af30, 0x56fe2dd3, 0xc924ae4d, 0xa0c32815, + 0x3f19ab8b, 0x44072968, 0xdbddaaf6, 0xdc2c3734, 0x43f6b4aa, + 0x38e83649, 0xa732b5d7, 0xced5338f, 0x510fb011, 0x2a1132f2, + 0xb5cbb16c, 0xf9de3e42, 0x6604bddc, 0x1d1a3f3f, 0x82c0bca1, + 0xeb273af9, 0x74fdb967, 0x0fe33b84, 0x9039b81a, 0xf4e14df1, + 0x6b3bce6f, 0x10254c8c, 0x8fffcf12, 0xe618494a, 0x79c2cad4, + 0x02dc4837, 0x9d06cba9, 0xd1134487, 0x4ec9c719, 0x35d745fa, + 0xaa0dc664, 0xc3ea403c, 0x5c30c3a2, 0x272e4141, 0xb8f4c2df, + 0xbf055f1d, 0x20dfdc83, 0x5bc15e60, 0xc41bddfe, 0xadfc5ba6, + 0x3226d838, 0x49385adb, 0xd6e2d945, 0x9af7566b, 0x052dd5f5, + 0x7e335716, 0xe1e9d488, 0x880e52d0, 0x17d4d14e, 0x6cca53ad, + 0xf310d033, 0x63296829, 0xfcf3ebb7, 0x87ed6954, 0x1837eaca, + 0x71d06c92, 0xee0aef0c, 0x95146def, 0x0aceee71, 0x46db615f, + 0xd901e2c1, 0xa21f6022, 0x3dc5e3bc, 0x542265e4, 0xcbf8e67a, + 0xb0e66499, 0x2f3ce707, 0x28cd7ac5, 0xb717f95b, 0xcc097bb8, + 0x53d3f826, 0x3a347e7e, 0xa5eefde0, 0xdef07f03, 0x412afc9d, + 0x0d3f73b3, 0x92e5f02d, 0xe9fb72ce, 0x7621f150, 0x1fc67708, + 0x801cf496, 0xfb027675, 0x64d8f5eb, 0x32b39da3, 0xad691e3d, + 0xd6779cde, 0x49ad1f40, 0x204a9918, 0xbf901a86, 0xc48e9865, + 0x5b541bfb, 0x174194d5, 0x889b174b, 0xf38595a8, 0x6c5f1636, + 0x05b8906e, 0x9a6213f0, 0xe17c9113, 0x7ea6128d, 0x79578f4f, + 0xe68d0cd1, 0x9d938e32, 0x02490dac, 0x6bae8bf4, 0xf474086a, + 0x8f6a8a89, 0x10b00917, 0x5ca58639, 0xc37f05a7, 0xb8618744, + 0x27bb04da, 0x4e5c8282, 0xd186011c, 0xaa9883ff, 0x35420061, + 0xa57bb87b, 0x3aa13be5, 0x41bfb906, 0xde653a98, 0xb782bcc0, + 0x28583f5e, 0x5346bdbd, 0xcc9c3e23, 0x8089b10d, 0x1f533293, + 0x644db070, 0xfb9733ee, 0x9270b5b6, 0x0daa3628, 0x76b4b4cb, + 0xe96e3755, 0xee9faa97, 0x71452909, 0x0a5babea, 0x95812874, + 0xfc66ae2c, 0x63bc2db2, 0x18a2af51, 0x87782ccf, 0xcb6da3e1, + 0x54b7207f, 0x2fa9a29c, 0xb0732102, 0xd994a75a, 0x464e24c4, + 0x3d50a627, 0xa28a25b9, 0xc652d052, 0x598853cc, 0x2296d12f, + 0xbd4c52b1, 0xd4abd4e9, 0x4b715777, 0x306fd594, 0xafb5560a, + 0xe3a0d924, 0x7c7a5aba, 0x0764d859, 0x98be5bc7, 0xf159dd9f, + 0x6e835e01, 0x159ddce2, 0x8a475f7c, 0x8db6c2be, 0x126c4120, + 0x6972c3c3, 0xf6a8405d, 0x9f4fc605, 0x0095459b, 0x7b8bc778, + 0xe45144e6, 0xa844cbc8, 0x379e4856, 0x4c80cab5, 0xd35a492b, + 0xbabdcf73, 0x25674ced, 0x5e79ce0e, 0xc1a34d90, 0x519af58a, + 0xce407614, 0xb55ef4f7, 0x2a847769, 0x4363f131, 0xdcb972af, + 0xa7a7f04c, 0x387d73d2, 0x7468fcfc, 0xebb27f62, 0x90acfd81, + 0x0f767e1f, 0x6691f847, 0xf94b7bd9, 0x8255f93a, 0x1d8f7aa4, + 0x1a7ee766, 0x85a464f8, 0xfebae61b, 0x61606585, 0x0887e3dd, + 0x975d6043, 0xec43e2a0, 0x7399613e, 0x3f8cee10, 0xa0566d8e, + 0xdb48ef6d, 0x44926cf3, 0x2d75eaab, 0xb2af6935, 0xc9b1ebd6, + 0x566b6848}}; + +local const z_word_t FAR crc_braid_big_table[][256] = { + {0x00000000, 0x9e83da9f, 0x7d01c4e4, 0xe3821e7b, 0xbb04f912, + 0x2587238d, 0xc6053df6, 0x5886e769, 0x7609f225, 0xe88a28ba, + 0x0b0836c1, 0x958bec5e, 0xcd0d0b37, 0x538ed1a8, 0xb00ccfd3, + 0x2e8f154c, 0xec12e44b, 0x72913ed4, 0x911320af, 0x0f90fa30, + 0x57161d59, 0xc995c7c6, 0x2a17d9bd, 0xb4940322, 0x9a1b166e, + 0x0498ccf1, 0xe71ad28a, 0x79990815, 0x211fef7c, 0xbf9c35e3, + 0x5c1e2b98, 0xc29df107, 0xd825c897, 0x46a61208, 0xa5240c73, + 0x3ba7d6ec, 0x63213185, 0xfda2eb1a, 0x1e20f561, 0x80a32ffe, + 0xae2c3ab2, 0x30afe02d, 0xd32dfe56, 0x4dae24c9, 0x1528c3a0, + 0x8bab193f, 0x68290744, 0xf6aadddb, 0x34372cdc, 0xaab4f643, + 0x4936e838, 0xd7b532a7, 0x8f33d5ce, 0x11b00f51, 0xf232112a, + 0x6cb1cbb5, 0x423edef9, 0xdcbd0466, 0x3f3f1a1d, 0xa1bcc082, + 0xf93a27eb, 0x67b9fd74, 0x843be30f, 0x1ab83990, 0xf14de1f4, + 0x6fce3b6b, 0x8c4c2510, 0x12cfff8f, 0x4a4918e6, 0xd4cac279, + 0x3748dc02, 0xa9cb069d, 0x874413d1, 0x19c7c94e, 0xfa45d735, + 0x64c60daa, 0x3c40eac3, 0xa2c3305c, 0x41412e27, 0xdfc2f4b8, + 0x1d5f05bf, 0x83dcdf20, 0x605ec15b, 0xfedd1bc4, 0xa65bfcad, + 0x38d82632, 0xdb5a3849, 0x45d9e2d6, 0x6b56f79a, 0xf5d52d05, + 0x1657337e, 0x88d4e9e1, 0xd0520e88, 0x4ed1d417, 0xad53ca6c, + 0x33d010f3, 0x29682963, 0xb7ebf3fc, 0x5469ed87, 0xcaea3718, + 0x926cd071, 0x0cef0aee, 0xef6d1495, 0x71eece0a, 0x5f61db46, + 0xc1e201d9, 0x22601fa2, 0xbce3c53d, 0xe4652254, 0x7ae6f8cb, + 0x9964e6b0, 0x07e73c2f, 0xc57acd28, 0x5bf917b7, 0xb87b09cc, + 0x26f8d353, 0x7e7e343a, 0xe0fdeea5, 0x037ff0de, 0x9dfc2a41, + 0xb3733f0d, 0x2df0e592, 0xce72fbe9, 0x50f12176, 0x0877c61f, + 0x96f41c80, 0x757602fb, 0xebf5d864, 0xa39db332, 0x3d1e69ad, + 0xde9c77d6, 0x401fad49, 0x18994a20, 0x861a90bf, 0x65988ec4, + 0xfb1b545b, 0xd5944117, 0x4b179b88, 0xa89585f3, 0x36165f6c, + 0x6e90b805, 0xf013629a, 0x13917ce1, 0x8d12a67e, 0x4f8f5779, + 0xd10c8de6, 0x328e939d, 0xac0d4902, 0xf48bae6b, 0x6a0874f4, + 0x898a6a8f, 0x1709b010, 0x3986a55c, 0xa7057fc3, 0x448761b8, + 0xda04bb27, 0x82825c4e, 0x1c0186d1, 0xff8398aa, 0x61004235, + 0x7bb87ba5, 0xe53ba13a, 0x06b9bf41, 0x983a65de, 0xc0bc82b7, + 0x5e3f5828, 0xbdbd4653, 0x233e9ccc, 0x0db18980, 0x9332531f, + 0x70b04d64, 0xee3397fb, 0xb6b57092, 0x2836aa0d, 0xcbb4b476, + 0x55376ee9, 0x97aa9fee, 0x09294571, 0xeaab5b0a, 0x74288195, + 0x2cae66fc, 0xb22dbc63, 0x51afa218, 0xcf2c7887, 0xe1a36dcb, + 0x7f20b754, 0x9ca2a92f, 0x022173b0, 0x5aa794d9, 0xc4244e46, + 0x27a6503d, 0xb9258aa2, 0x52d052c6, 0xcc538859, 0x2fd19622, + 0xb1524cbd, 0xe9d4abd4, 0x7757714b, 0x94d56f30, 0x0a56b5af, + 0x24d9a0e3, 0xba5a7a7c, 0x59d86407, 0xc75bbe98, 0x9fdd59f1, + 0x015e836e, 0xe2dc9d15, 0x7c5f478a, 0xbec2b68d, 0x20416c12, + 0xc3c37269, 0x5d40a8f6, 0x05c64f9f, 0x9b459500, 0x78c78b7b, + 0xe64451e4, 0xc8cb44a8, 0x56489e37, 0xb5ca804c, 0x2b495ad3, + 0x73cfbdba, 0xed4c6725, 0x0ece795e, 0x904da3c1, 0x8af59a51, + 0x147640ce, 0xf7f45eb5, 0x6977842a, 0x31f16343, 0xaf72b9dc, + 0x4cf0a7a7, 0xd2737d38, 0xfcfc6874, 0x627fb2eb, 0x81fdac90, + 0x1f7e760f, 0x47f89166, 0xd97b4bf9, 0x3af95582, 0xa47a8f1d, + 0x66e77e1a, 0xf864a485, 0x1be6bafe, 0x85656061, 0xdde38708, + 0x43605d97, 0xa0e243ec, 0x3e619973, 0x10ee8c3f, 0x8e6d56a0, + 0x6def48db, 0xf36c9244, 0xabea752d, 0x3569afb2, 0xd6ebb1c9, + 0x48686b56}, + {0x00000000, 0xc0642817, 0x80c9502e, 0x40ad7839, 0x0093a15c, + 0xc0f7894b, 0x805af172, 0x403ed965, 0x002643b9, 0xc0426bae, + 0x80ef1397, 0x408b3b80, 0x00b5e2e5, 0xc0d1caf2, 0x807cb2cb, + 0x40189adc, 0x414af7a9, 0x812edfbe, 0xc183a787, 0x01e78f90, + 0x41d956f5, 0x81bd7ee2, 0xc11006db, 0x01742ecc, 0x416cb410, + 0x81089c07, 0xc1a5e43e, 0x01c1cc29, 0x41ff154c, 0x819b3d5b, + 0xc1364562, 0x01526d75, 0xc3929f88, 0x03f6b79f, 0x435bcfa6, + 0x833fe7b1, 0xc3013ed4, 0x036516c3, 0x43c86efa, 0x83ac46ed, + 0xc3b4dc31, 0x03d0f426, 0x437d8c1f, 0x8319a408, 0xc3277d6d, + 0x0343557a, 0x43ee2d43, 0x838a0554, 0x82d86821, 0x42bc4036, + 0x0211380f, 0xc2751018, 0x824bc97d, 0x422fe16a, 0x02829953, + 0xc2e6b144, 0x82fe2b98, 0x429a038f, 0x02377bb6, 0xc25353a1, + 0x826d8ac4, 0x4209a2d3, 0x02a4daea, 0xc2c0f2fd, 0xc7234eca, + 0x074766dd, 0x47ea1ee4, 0x878e36f3, 0xc7b0ef96, 0x07d4c781, + 0x4779bfb8, 0x871d97af, 0xc7050d73, 0x07612564, 0x47cc5d5d, + 0x87a8754a, 0xc796ac2f, 0x07f28438, 0x475ffc01, 0x873bd416, + 0x8669b963, 0x460d9174, 0x06a0e94d, 0xc6c4c15a, 0x86fa183f, + 0x469e3028, 0x06334811, 0xc6576006, 0x864ffada, 0x462bd2cd, + 0x0686aaf4, 0xc6e282e3, 0x86dc5b86, 0x46b87391, 0x06150ba8, + 0xc67123bf, 0x04b1d142, 0xc4d5f955, 0x8478816c, 0x441ca97b, + 0x0422701e, 0xc4465809, 0x84eb2030, 0x448f0827, 0x049792fb, + 0xc4f3baec, 0x845ec2d5, 0x443aeac2, 0x040433a7, 0xc4601bb0, + 0x84cd6389, 0x44a94b9e, 0x45fb26eb, 0x859f0efc, 0xc53276c5, + 0x05565ed2, 0x456887b7, 0x850cafa0, 0xc5a1d799, 0x05c5ff8e, + 0x45dd6552, 0x85b94d45, 0xc514357c, 0x05701d6b, 0x454ec40e, + 0x852aec19, 0xc5879420, 0x05e3bc37, 0xcf41ed4f, 0x0f25c558, + 0x4f88bd61, 0x8fec9576, 0xcfd24c13, 0x0fb66404, 0x4f1b1c3d, + 0x8f7f342a, 0xcf67aef6, 0x0f0386e1, 0x4faefed8, 0x8fcad6cf, + 0xcff40faa, 0x0f9027bd, 0x4f3d5f84, 0x8f597793, 0x8e0b1ae6, + 0x4e6f32f1, 0x0ec24ac8, 0xcea662df, 0x8e98bbba, 0x4efc93ad, + 0x0e51eb94, 0xce35c383, 0x8e2d595f, 0x4e497148, 0x0ee40971, + 0xce802166, 0x8ebef803, 0x4edad014, 0x0e77a82d, 0xce13803a, + 0x0cd372c7, 0xccb75ad0, 0x8c1a22e9, 0x4c7e0afe, 0x0c40d39b, + 0xcc24fb8c, 0x8c8983b5, 0x4cedaba2, 0x0cf5317e, 0xcc911969, + 0x8c3c6150, 0x4c584947, 0x0c669022, 0xcc02b835, 0x8cafc00c, + 0x4ccbe81b, 0x4d99856e, 0x8dfdad79, 0xcd50d540, 0x0d34fd57, + 0x4d0a2432, 0x8d6e0c25, 0xcdc3741c, 0x0da75c0b, 0x4dbfc6d7, + 0x8ddbeec0, 0xcd7696f9, 0x0d12beee, 0x4d2c678b, 0x8d484f9c, + 0xcde537a5, 0x0d811fb2, 0x0862a385, 0xc8068b92, 0x88abf3ab, + 0x48cfdbbc, 0x08f102d9, 0xc8952ace, 0x883852f7, 0x485c7ae0, + 0x0844e03c, 0xc820c82b, 0x888db012, 0x48e99805, 0x08d74160, + 0xc8b36977, 0x881e114e, 0x487a3959, 0x4928542c, 0x894c7c3b, + 0xc9e10402, 0x09852c15, 0x49bbf570, 0x89dfdd67, 0xc972a55e, + 0x09168d49, 0x490e1795, 0x896a3f82, 0xc9c747bb, 0x09a36fac, + 0x499db6c9, 0x89f99ede, 0xc954e6e7, 0x0930cef0, 0xcbf03c0d, + 0x0b94141a, 0x4b396c23, 0x8b5d4434, 0xcb639d51, 0x0b07b546, + 0x4baacd7f, 0x8bcee568, 0xcbd67fb4, 0x0bb257a3, 0x4b1f2f9a, + 0x8b7b078d, 0xcb45dee8, 0x0b21f6ff, 0x4b8c8ec6, 0x8be8a6d1, + 0x8abacba4, 0x4adee3b3, 0x0a739b8a, 0xca17b39d, 0x8a296af8, + 0x4a4d42ef, 0x0ae03ad6, 0xca8412c1, 0x8a9c881d, 0x4af8a00a, + 0x0a55d833, 0xca31f024, 0x8a0f2941, 0x4a6b0156, 0x0ac6796f, + 0xcaa25178}, + {0x00000000, 0xd4ea739b, 0xe9d396ed, 0x3d39e576, 0x93a15c00, + 0x474b2f9b, 0x7a72caed, 0xae98b976, 0x2643b900, 0xf2a9ca9b, + 0xcf902fed, 0x1b7a5c76, 0xb5e2e500, 0x6108969b, 0x5c3173ed, + 0x88db0076, 0x4c867201, 0x986c019a, 0xa555e4ec, 0x71bf9777, + 0xdf272e01, 0x0bcd5d9a, 0x36f4b8ec, 0xe21ecb77, 0x6ac5cb01, + 0xbe2fb89a, 0x83165dec, 0x57fc2e77, 0xf9649701, 0x2d8ee49a, + 0x10b701ec, 0xc45d7277, 0x980ce502, 0x4ce69699, 0x71df73ef, + 0xa5350074, 0x0badb902, 0xdf47ca99, 0xe27e2fef, 0x36945c74, + 0xbe4f5c02, 0x6aa52f99, 0x579ccaef, 0x8376b974, 0x2dee0002, + 0xf9047399, 0xc43d96ef, 0x10d7e574, 0xd48a9703, 0x0060e498, + 0x3d5901ee, 0xe9b37275, 0x472bcb03, 0x93c1b898, 0xaef85dee, + 0x7a122e75, 0xf2c92e03, 0x26235d98, 0x1b1ab8ee, 0xcff0cb75, + 0x61687203, 0xb5820198, 0x88bbe4ee, 0x5c519775, 0x3019ca05, + 0xe4f3b99e, 0xd9ca5ce8, 0x0d202f73, 0xa3b89605, 0x7752e59e, + 0x4a6b00e8, 0x9e817373, 0x165a7305, 0xc2b0009e, 0xff89e5e8, + 0x2b639673, 0x85fb2f05, 0x51115c9e, 0x6c28b9e8, 0xb8c2ca73, + 0x7c9fb804, 0xa875cb9f, 0x954c2ee9, 0x41a65d72, 0xef3ee404, + 0x3bd4979f, 0x06ed72e9, 0xd2070172, 0x5adc0104, 0x8e36729f, + 0xb30f97e9, 0x67e5e472, 0xc97d5d04, 0x1d972e9f, 0x20aecbe9, + 0xf444b872, 0xa8152f07, 0x7cff5c9c, 0x41c6b9ea, 0x952cca71, + 0x3bb47307, 0xef5e009c, 0xd267e5ea, 0x068d9671, 0x8e569607, + 0x5abce59c, 0x678500ea, 0xb36f7371, 0x1df7ca07, 0xc91db99c, + 0xf4245cea, 0x20ce2f71, 0xe4935d06, 0x30792e9d, 0x0d40cbeb, + 0xd9aab870, 0x77320106, 0xa3d8729d, 0x9ee197eb, 0x4a0be470, + 0xc2d0e406, 0x163a979d, 0x2b0372eb, 0xffe90170, 0x5171b806, + 0x859bcb9d, 0xb8a22eeb, 0x6c485d70, 0x6032940b, 0xb4d8e790, + 0x89e102e6, 0x5d0b717d, 0xf393c80b, 0x2779bb90, 0x1a405ee6, + 0xceaa2d7d, 0x46712d0b, 0x929b5e90, 0xafa2bbe6, 0x7b48c87d, + 0xd5d0710b, 0x013a0290, 0x3c03e7e6, 0xe8e9947d, 0x2cb4e60a, + 0xf85e9591, 0xc56770e7, 0x118d037c, 0xbf15ba0a, 0x6bffc991, + 0x56c62ce7, 0x822c5f7c, 0x0af75f0a, 0xde1d2c91, 0xe324c9e7, + 0x37ceba7c, 0x9956030a, 0x4dbc7091, 0x708595e7, 0xa46fe67c, + 0xf83e7109, 0x2cd40292, 0x11ede7e4, 0xc507947f, 0x6b9f2d09, + 0xbf755e92, 0x824cbbe4, 0x56a6c87f, 0xde7dc809, 0x0a97bb92, + 0x37ae5ee4, 0xe3442d7f, 0x4ddc9409, 0x9936e792, 0xa40f02e4, + 0x70e5717f, 0xb4b80308, 0x60527093, 0x5d6b95e5, 0x8981e67e, + 0x27195f08, 0xf3f32c93, 0xcecac9e5, 0x1a20ba7e, 0x92fbba08, + 0x4611c993, 0x7b282ce5, 0xafc25f7e, 0x015ae608, 0xd5b09593, + 0xe88970e5, 0x3c63037e, 0x502b5e0e, 0x84c12d95, 0xb9f8c8e3, + 0x6d12bb78, 0xc38a020e, 0x17607195, 0x2a5994e3, 0xfeb3e778, + 0x7668e70e, 0xa2829495, 0x9fbb71e3, 0x4b510278, 0xe5c9bb0e, + 0x3123c895, 0x0c1a2de3, 0xd8f05e78, 0x1cad2c0f, 0xc8475f94, + 0xf57ebae2, 0x2194c979, 0x8f0c700f, 0x5be60394, 0x66dfe6e2, + 0xb2359579, 0x3aee950f, 0xee04e694, 0xd33d03e2, 0x07d77079, + 0xa94fc90f, 0x7da5ba94, 0x409c5fe2, 0x94762c79, 0xc827bb0c, + 0x1ccdc897, 0x21f42de1, 0xf51e5e7a, 0x5b86e70c, 0x8f6c9497, + 0xb25571e1, 0x66bf027a, 0xee64020c, 0x3a8e7197, 0x07b794e1, + 0xd35de77a, 0x7dc55e0c, 0xa92f2d97, 0x9416c8e1, 0x40fcbb7a, + 0x84a1c90d, 0x504bba96, 0x6d725fe0, 0xb9982c7b, 0x1700950d, + 0xc3eae696, 0xfed303e0, 0x2a39707b, 0xa2e2700d, 0x76080396, + 0x4b31e6e0, 0x9fdb957b, 0x31432c0d, 0xe5a95f96, 0xd890bae0, + 0x0c7ac97b}, + {0x00000000, 0x27652581, 0x0fcc3bd9, 0x28a91e58, 0x5f9e0669, + 0x78fb23e8, 0x50523db0, 0x77371831, 0xbe3c0dd2, 0x99592853, + 0xb1f0360b, 0x9695138a, 0xe1a20bbb, 0xc6c72e3a, 0xee6e3062, + 0xc90b15e3, 0x3d7f6b7f, 0x1a1a4efe, 0x32b350a6, 0x15d67527, + 0x62e16d16, 0x45844897, 0x6d2d56cf, 0x4a48734e, 0x834366ad, + 0xa426432c, 0x8c8f5d74, 0xabea78f5, 0xdcdd60c4, 0xfbb84545, + 0xd3115b1d, 0xf4747e9c, 0x7afed6fe, 0x5d9bf37f, 0x7532ed27, + 0x5257c8a6, 0x2560d097, 0x0205f516, 0x2aaceb4e, 0x0dc9cecf, + 0xc4c2db2c, 0xe3a7fead, 0xcb0ee0f5, 0xec6bc574, 0x9b5cdd45, + 0xbc39f8c4, 0x9490e69c, 0xb3f5c31d, 0x4781bd81, 0x60e49800, + 0x484d8658, 0x6f28a3d9, 0x181fbbe8, 0x3f7a9e69, 0x17d38031, + 0x30b6a5b0, 0xf9bdb053, 0xded895d2, 0xf6718b8a, 0xd114ae0b, + 0xa623b63a, 0x814693bb, 0xa9ef8de3, 0x8e8aa862, 0xb5fadc26, + 0x929ff9a7, 0xba36e7ff, 0x9d53c27e, 0xea64da4f, 0xcd01ffce, + 0xe5a8e196, 0xc2cdc417, 0x0bc6d1f4, 0x2ca3f475, 0x040aea2d, + 0x236fcfac, 0x5458d79d, 0x733df21c, 0x5b94ec44, 0x7cf1c9c5, + 0x8885b759, 0xafe092d8, 0x87498c80, 0xa02ca901, 0xd71bb130, + 0xf07e94b1, 0xd8d78ae9, 0xffb2af68, 0x36b9ba8b, 0x11dc9f0a, + 0x39758152, 0x1e10a4d3, 0x6927bce2, 0x4e429963, 0x66eb873b, + 0x418ea2ba, 0xcf040ad8, 0xe8612f59, 0xc0c83101, 0xe7ad1480, + 0x909a0cb1, 0xb7ff2930, 0x9f563768, 0xb83312e9, 0x7138070a, + 0x565d228b, 0x7ef43cd3, 0x59911952, 0x2ea60163, 0x09c324e2, + 0x216a3aba, 0x060f1f3b, 0xf27b61a7, 0xd51e4426, 0xfdb75a7e, + 0xdad27fff, 0xade567ce, 0x8a80424f, 0xa2295c17, 0x854c7996, + 0x4c476c75, 0x6b2249f4, 0x438b57ac, 0x64ee722d, 0x13d96a1c, + 0x34bc4f9d, 0x1c1551c5, 0x3b707444, 0x6af5b94d, 0x4d909ccc, + 0x65398294, 0x425ca715, 0x356bbf24, 0x120e9aa5, 0x3aa784fd, + 0x1dc2a17c, 0xd4c9b49f, 0xf3ac911e, 0xdb058f46, 0xfc60aac7, + 0x8b57b2f6, 0xac329777, 0x849b892f, 0xa3feacae, 0x578ad232, + 0x70eff7b3, 0x5846e9eb, 0x7f23cc6a, 0x0814d45b, 0x2f71f1da, + 0x07d8ef82, 0x20bdca03, 0xe9b6dfe0, 0xced3fa61, 0xe67ae439, + 0xc11fc1b8, 0xb628d989, 0x914dfc08, 0xb9e4e250, 0x9e81c7d1, + 0x100b6fb3, 0x376e4a32, 0x1fc7546a, 0x38a271eb, 0x4f9569da, + 0x68f04c5b, 0x40595203, 0x673c7782, 0xae376261, 0x895247e0, + 0xa1fb59b8, 0x869e7c39, 0xf1a96408, 0xd6cc4189, 0xfe655fd1, + 0xd9007a50, 0x2d7404cc, 0x0a11214d, 0x22b83f15, 0x05dd1a94, + 0x72ea02a5, 0x558f2724, 0x7d26397c, 0x5a431cfd, 0x9348091e, + 0xb42d2c9f, 0x9c8432c7, 0xbbe11746, 0xccd60f77, 0xebb32af6, + 0xc31a34ae, 0xe47f112f, 0xdf0f656b, 0xf86a40ea, 0xd0c35eb2, + 0xf7a67b33, 0x80916302, 0xa7f44683, 0x8f5d58db, 0xa8387d5a, + 0x613368b9, 0x46564d38, 0x6eff5360, 0x499a76e1, 0x3ead6ed0, + 0x19c84b51, 0x31615509, 0x16047088, 0xe2700e14, 0xc5152b95, + 0xedbc35cd, 0xcad9104c, 0xbdee087d, 0x9a8b2dfc, 0xb22233a4, + 0x95471625, 0x5c4c03c6, 0x7b292647, 0x5380381f, 0x74e51d9e, + 0x03d205af, 0x24b7202e, 0x0c1e3e76, 0x2b7b1bf7, 0xa5f1b395, + 0x82949614, 0xaa3d884c, 0x8d58adcd, 0xfa6fb5fc, 0xdd0a907d, + 0xf5a38e25, 0xd2c6aba4, 0x1bcdbe47, 0x3ca89bc6, 0x1401859e, + 0x3364a01f, 0x4453b82e, 0x63369daf, 0x4b9f83f7, 0x6cfaa676, + 0x988ed8ea, 0xbfebfd6b, 0x9742e333, 0xb027c6b2, 0xc710de83, + 0xe075fb02, 0xc8dce55a, 0xefb9c0db, 0x26b2d538, 0x01d7f0b9, + 0x297eeee1, 0x0e1bcb60, 0x792cd351, 0x5e49f6d0, 0x76e0e888, + 0x5185cd09}}; + +#endif + +#endif + +#endif + +local const z_crc_t FAR x2n_table[] = { + 0x40000000, 0x20000000, 0x08000000, 0x00800000, 0x00008000, + 0xedb88320, 0xb1e6b092, 0xa06a2517, 0xed627dae, 0x88d14467, + 0xd7bbfe6a, 0xec447f11, 0x8e7ea170, 0x6427800e, 0x4d47bae0, + 0x09fe548f, 0x83852d0f, 0x30362f1a, 0x7b5a9cc3, 0x31fec169, + 0x9fec022a, 0x6c8dedc4, 0x15d6874d, 0x5fde7a4e, 0xbad90e37, + 0x2e4e5eef, 0x4eaba214, 0xa8a472c0, 0x429a969e, 0x148d302a, + 0xc40ba6d0, 0xc4e22c3c}; diff --git a/src/dependencies/zlib-1.2.11/deflate.c b/src/dependencies/zlib-1.2.13/deflate.c similarity index 87% rename from src/dependencies/zlib-1.2.11/deflate.c rename to src/dependencies/zlib-1.2.13/deflate.c index 1ec7614..4a689db 100644 --- a/src/dependencies/zlib-1.2.11/deflate.c +++ b/src/dependencies/zlib-1.2.13/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -87,13 +87,7 @@ local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV -# pragma message("Assembler code may have bugs -- use at your own risk") - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif #ifdef ZLIB_DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, @@ -160,7 +154,7 @@ local const config configuration_table[10] = { * characters, so that a running hash key can be computed from the previous * key instead of complete recalculation each time. */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) +#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== @@ -190,8 +184,11 @@ local const config configuration_table[10] = { * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + do { \ + s->head[s->hash_size - 1] = NIL; \ + zmemzero((Bytef *)s->head, \ + (unsigned)(s->hash_size - 1)*sizeof(*s->head)); \ + } while (0) /* =========================================================================== * Slide the hash table when sliding the window down (could be avoided with 32 @@ -252,11 +249,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, int wrap = 1; static const char my_version[] = ZLIB_VERSION; - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; @@ -287,6 +279,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; + if (windowBits < -15) + return Z_STREAM_ERROR; windowBits = -windowBits; } #ifdef GZIP @@ -316,7 +310,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); @@ -326,9 +320,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + /* We overlay pending_buf and sym_buf. This works since the average size + * for length/distance pairs over any compressed block is assured to be 31 + * bits or less. + * + * Analysis: The longest fixed codes are a length code of 8 bits plus 5 + * extra bits, for lengths 131 to 257. The longest fixed distance codes are + * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest + * possible fixed-codes length/distance pair is then 31 bits total. + * + * sym_buf starts one-fourth of the way into pending_buf. So there are + * three bytes in sym_buf for every four bytes in pending_buf. Each symbol + * in sym_buf is three bytes -- two for the distance and one for the + * literal/length. As each symbol is consumed, the pointer to the next + * sym_buf value to read moves forward three bytes. From that symbol, up to + * 31 bits are written to pending_buf. The closest the written pending_buf + * bits gets to the next sym_buf symbol to read is just before the last + * code is written. At that time, 31*(n - 2) bits have been written, just + * after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at + * 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1 + * symbols are written.) The closest the writing gets to what is unread is + * then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and + * can range from 128 to 32768. + * + * Therefore, at a minimum, there are 142 bits of space between what is + * written and what is read in the overlain buffers, so the symbols cannot + * be overwritten by the compressed data. That space is actually 139 bits, + * due to the three-bit fixed-code block header. + * + * That covers the case where either Z_FIXED is specified, forcing fixed + * codes, or when the use of fixed codes is chosen, because that choice + * results in a smaller compressed block than dynamic codes. That latter + * condition then assures that the above analysis also covers all dynamic + * blocks. A dynamic-code block will only be chosen to be emitted if it has + * fewer bits than a fixed-code block would for the same set of symbols. + * Therefore its average symbol length is assured to be less than 31. So + * the compressed data for a dynamic block also cannot overwrite the + * symbols from which it is being constructed. + */ + + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { @@ -337,8 +369,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, deflateEnd (strm); return Z_MEM_ERROR; } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + s->sym_buf = s->pending_buf + s->lit_bufsize; + s->sym_end = (s->lit_bufsize - 1) * 3; + /* We avoid equality with lit_bufsize*3 because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ s->level = level; s->strategy = strategy; @@ -350,7 +386,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) +local int deflateStateCheck(strm) z_streamp strm; { deflate_state *s; @@ -373,7 +409,7 @@ local int deflateStateCheck (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; @@ -442,7 +478,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) +int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) z_streamp strm; Bytef *dictionary; uInt *dictLength; @@ -464,7 +500,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) } /* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) +int ZEXPORT deflateResetKeep(strm) z_streamp strm; { deflate_state *s; @@ -488,13 +524,13 @@ int ZEXPORT deflateResetKeep (strm) #ifdef GZIP s->wrap == 2 ? GZIP_STATE : #endif - s->wrap ? INIT_STATE : BUSY_STATE; + INIT_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; + s->last_flush = -2; _tr_init(s); @@ -502,7 +538,7 @@ int ZEXPORT deflateResetKeep (strm) } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateReset(strm) z_streamp strm; { int ret; @@ -514,7 +550,7 @@ int ZEXPORT deflateReset (strm) } /* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) +int ZEXPORT deflateSetHeader(strm, head) z_streamp strm; gz_headerp head; { @@ -525,7 +561,7 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) +int ZEXPORT deflatePending(strm, pending, bits) unsigned *pending; int *bits; z_streamp strm; @@ -539,7 +575,7 @@ int ZEXPORT deflatePending (strm, pending, bits) } /* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) +int ZEXPORT deflatePrime(strm, bits, value) z_streamp strm; int bits; int value; @@ -549,7 +585,8 @@ int ZEXPORT deflatePrime (strm, bits, value) if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; - if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) + if (bits < 0 || bits > 16 || + s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; do { put = Buf_size - s->bi_valid; @@ -587,12 +624,12 @@ int ZEXPORT deflateParams(strm, level, strategy) func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { + s->last_flush != -2) { /* Flush the last buffer: */ int err = deflate(strm, Z_BLOCK); if (err == Z_STREAM_ERROR) return err; - if (strm->avail_out == 0) + if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead) return Z_BUF_ERROR; } if (s->level != level) { @@ -633,36 +670,50 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) } /* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. + * For the default windowBits of 15 and memLevel of 8, this function returns a + * close to exact, as well as small, upper bound on the compressed size. This + * is an expansion of ~0.03%, plus a small constant. * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. + * For any setting other than those defaults for windowBits and memLevel, one + * of two worst case bounds is returned. This is at most an expansion of ~4% or + * ~13%, plus a small constant. * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. + * Both the 0.03% and 4% derive from the overhead of stored blocks. The first + * one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second + * is for stored blocks of 127 bytes (the worst case memLevel == 1). The + * expansion results from five bytes of header for each stored block. + * + * The larger expansion of 13% results from a window size less than or equal to + * the symbols buffer size (windowBits <= memLevel + 7). In that case some of + * the data being compressed may have slid out of the sliding window, impeding + * a stored block from being emitted. Then the only choice is a fixed or + * dynamic block, where a fixed block limits the maximum expansion to 9 bits + * per 8-bit byte, plus 10 bits for every block. The smallest block size for + * which this can occur is 255 (memLevel == 2). + * + * Shifts are used to approximate divisions, for speed. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; - uLong complen, wraplen; + uLong fixedlen, storelen, wraplen; - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; + /* upper bound for fixed blocks with 9-bit literals and length 255 + (memLevel == 2, which is the lowest that may not use stored blocks) -- + ~13% overhead plus a small constant */ + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) + + (sourceLen >> 9) + 4; - /* if can't get parameters, return conservative bound plus zlib wrapper */ + /* upper bound for stored blocks with length 127 (memLevel == 1) -- + ~4% overhead plus a small constant */ + storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) + + (sourceLen >> 11) + 7; + + /* if can't get parameters, return larger bound plus a zlib wrapper */ if (deflateStateCheck(strm)) - return complen + 6; + return (fixedlen > storelen ? fixedlen : storelen) + 6; /* compute wrapper length */ s = strm->state; @@ -699,11 +750,12 @@ uLong ZEXPORT deflateBound(strm, sourceLen) wraplen = 6; } - /* if not default parameters, return conservative bound */ + /* if not default parameters, return one of the conservative bounds */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; + return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen; - /* default settings: return tight bound for that case */ + /* default settings: return tight bound for that case -- ~0.03% overhead + plus a small constant */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } @@ -713,7 +765,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ -local void putShortMSB (s, b) +local void putShortMSB(s, b) deflate_state *s; uInt b; { @@ -760,7 +812,7 @@ local void flush_pending(strm) } while (0) /* ========================================================================= */ -int ZEXPORT deflate (strm, flush) +int ZEXPORT deflate(strm, flush) z_streamp strm; int flush; { @@ -811,9 +863,11 @@ int ZEXPORT deflate (strm, flush) } /* Write the header */ + if (s->status == INIT_STATE && s->wrap == 0) + s->status = BUSY_STATE; if (s->status == INIT_STATE) { /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) @@ -1073,7 +1127,7 @@ int ZEXPORT deflate (strm, flush) } /* ========================================================================= */ -int ZEXPORT deflateEnd (strm) +int ZEXPORT deflateEnd(strm) z_streamp strm; { int status; @@ -1099,7 +1153,7 @@ int ZEXPORT deflateEnd (strm) * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ -int ZEXPORT deflateCopy (dest, source) +int ZEXPORT deflateCopy(dest, source) z_streamp dest; z_streamp source; { @@ -1108,7 +1162,6 @@ int ZEXPORT deflateCopy (dest, source) #else deflate_state *ds; deflate_state *ss; - ushf *overlay; if (deflateStateCheck(source) || dest == Z_NULL) { @@ -1128,8 +1181,7 @@ int ZEXPORT deflateCopy (dest, source) ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1143,8 +1195,7 @@ int ZEXPORT deflateCopy (dest, source) zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + ds->sym_buf = ds->pending_buf + ds->lit_bufsize; ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1191,7 +1242,7 @@ local unsigned read_buf(strm, buf, size) /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ -local void lm_init (s) +local void lm_init(s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; @@ -1212,11 +1263,6 @@ local void lm_init (s) s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif } #ifndef FASTEST @@ -1229,10 +1275,6 @@ local void lm_init (s) * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ @@ -1257,10 +1299,10 @@ local uInt longest_match(s, cur_match) */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); + register ush scan_end = *(ushf*)(scan + best_len - 1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end1 = scan[best_len - 1]; register Byte scan_end = scan[best_len]; #endif @@ -1278,7 +1320,8 @@ local uInt longest_match(s, cur_match) */ if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); @@ -1296,43 +1339,44 @@ local uInt longest_match(s, cur_match) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ - if (*(ushf*)(match+best_len-1) != scan_end || + if (*(ushf*)(match + best_len - 1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient + * strstart + 3, + 5, up to strstart + 257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + } while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && + *(ushf*)(scan += 2) == *(ushf*)(match += 2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + /* Here, scan <= window + strstart + 257 */ + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); if (*scan == *match) scan++; - len = (MAX_MATCH - 1) - (int)(strend-scan); + len = (MAX_MATCH - 1) - (int)(strend - scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; + if (match[best_len] != scan_end || + match[best_len - 1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1342,7 +1386,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1351,7 +1395,8 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), + "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; @@ -1363,9 +1408,9 @@ local uInt longest_match(s, cur_match) best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); + scan_end = *(ushf*)(scan + best_len - 1); #else - scan_end1 = scan[best_len-1]; + scan_end1 = scan[best_len - 1]; scan_end = scan[best_len]; #endif } @@ -1375,7 +1420,6 @@ local uInt longest_match(s, cur_match) if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } -#endif /* ASMV */ #else /* FASTEST */ @@ -1396,7 +1440,8 @@ local uInt longest_match(s, cur_match) */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "need lookahead"); Assert(cur_match < s->strstart, "no future"); @@ -1406,7 +1451,7 @@ local uInt longest_match(s, cur_match) */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - /* The check at best_len-1 can be removed because it will be made + /* The check at best_len - 1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that @@ -1416,7 +1461,7 @@ local uInt longest_match(s, cur_match) Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. + * the 256th check will be made at strstart + 258. */ do { } while (*++scan == *++match && *++scan == *++match && @@ -1425,7 +1470,7 @@ local uInt longest_match(s, cur_match) *++scan == *++match && *++scan == *++match && scan < strend); - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); @@ -1461,7 +1506,7 @@ local void check_match(s, start, match, length) z_error("invalid match"); } if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); + fprintf(stderr,"\\[%d,%d]", start - match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } @@ -1507,12 +1552,14 @@ local void fill_window(s) /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ - if (s->strstart >= wsize+MAX_DIST(s)) { + if (s->strstart >= wsize + MAX_DIST(s)) { - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); + zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; + if (s->insert > s->strstart) + s->insert = s->strstart; slide_hash(s); more += wsize; } @@ -1638,7 +1685,7 @@ local void fill_window(s) * * deflate_stored() is written to minimize the number of times an input byte is * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. + * maximizes the opportunities to have a single copy from next_in to next_out. */ local block_state deflate_stored(s, flush) deflate_state *s; @@ -1742,6 +1789,7 @@ local block_state deflate_stored(s, flush) s->matches = 2; /* clear hash */ zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size); s->strstart = s->w_size; + s->insert = s->strstart; } else { if (s->window_size - s->strstart <= used) { @@ -1750,12 +1798,14 @@ local block_state deflate_stored(s, flush) zmemcpy(s->window, s->window + s->w_size, s->strstart); if (s->matches < 2) s->matches++; /* add a pending slide_hash() */ + if (s->insert > s->strstart) + s->insert = s->strstart; } zmemcpy(s->window + s->strstart, s->strm->next_in - used, used); s->strstart += used; + s->insert += MIN(used, s->w_size - s->insert); } s->block_start = s->strstart; - s->insert += MIN(used, s->w_size - s->insert); } if (s->high_water < s->strstart) s->high_water = s->strstart; @@ -1770,7 +1820,7 @@ local block_state deflate_stored(s, flush) return block_done; /* Fill the window with any remaining input. */ - have = s->window_size - s->strstart - 1; + have = s->window_size - s->strstart; if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) { /* Slide the window down. */ s->block_start -= s->w_size; @@ -1779,12 +1829,15 @@ local block_state deflate_stored(s, flush) if (s->matches < 2) s->matches++; /* add a pending slide_hash() */ have += s->w_size; /* more space now */ + if (s->insert > s->strstart) + s->insert = s->strstart; } if (have > s->strm->avail_in) have = s->strm->avail_in; if (have) { read_buf(s->strm, s->window + s->strstart, have); s->strstart += have; + s->insert += MIN(have, s->w_size - s->insert); } if (s->high_water < s->strstart) s->high_water = s->strstart; @@ -1842,7 +1895,7 @@ local block_state deflate_fast(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1890,7 +1943,7 @@ local block_state deflate_fast(s, flush) s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif @@ -1901,7 +1954,7 @@ local block_state deflate_fast(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -1912,7 +1965,7 @@ local block_state deflate_fast(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -1945,7 +1998,7 @@ local block_state deflate_slow(s, flush) if (s->lookahead == 0) break; /* flush the current block */ } - /* Insert the string window[strstart .. strstart+2] in the + /* Insert the string window[strstart .. strstart + 2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; @@ -1987,17 +2040,17 @@ local block_state deflate_slow(s, flush) uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ - check_match(s, s->strstart-1, s->prev_match, s->prev_length); + check_match(s, s->strstart - 1, s->prev_match, s->prev_length); - _tr_tally_dist(s, s->strstart -1 - s->prev_match, + _tr_tally_dist(s, s->strstart - 1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not + * strstart - 1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ - s->lookahead -= s->prev_length-1; + s->lookahead -= s->prev_length - 1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { @@ -2015,8 +2068,8 @@ local block_state deflate_slow(s, flush) * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } @@ -2034,8 +2087,8 @@ local block_state deflate_slow(s, flush) } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); + Tracevv((stderr,"%c", s->window[s->strstart - 1])); + _tr_tally_lit(s, s->window[s->strstart - 1], bflush); s->match_available = 0; } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; @@ -2043,7 +2096,7 @@ local block_state deflate_slow(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -2092,7 +2145,8 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + Assert(scan <= s->window + (uInt)(s->window_size - 1), + "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -2107,7 +2161,7 @@ local block_state deflate_rle(s, flush) } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } @@ -2118,7 +2172,7 @@ local block_state deflate_rle(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } @@ -2147,7 +2201,7 @@ local block_state deflate_huff(s, flush) /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); + _tr_tally_lit(s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); @@ -2157,7 +2211,7 @@ local block_state deflate_huff(s, flush) FLUSH_BLOCK(s, 1); return finish_done; } - if (s->last_lit) + if (s->sym_next) FLUSH_BLOCK(s, 0); return block_done; } diff --git a/src/dependencies/zlib-1.2.11/deflate.h b/src/dependencies/zlib-1.2.13/deflate.h similarity index 95% rename from src/dependencies/zlib-1.2.11/deflate.h rename to src/dependencies/zlib-1.2.13/deflate.h index 23ecdd3..1a06cd5 100644 --- a/src/dependencies/zlib-1.2.11/deflate.h +++ b/src/dependencies/zlib-1.2.13/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2016 Jean-loup Gailly + * Copyright (C) 1995-2018 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -217,7 +217,7 @@ typedef struct internal_state { /* Depth of each subtree used as tie breaker for trees of equal frequency */ - uchf *l_buf; /* buffer for literals or lengths */ + uchf *sym_buf; /* buffer for distances and literals/lengths */ uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,13 +239,8 @@ typedef struct internal_state { * - I can't count above 4 */ - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ + uInt sym_next; /* running index in sym_buf */ + uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ @@ -325,20 +320,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = 0; \ + s->sym_buf[s->sym_next++] = cc; \ s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ + s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ + flush = (s->sym_next == s->sym_end); \ } #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) diff --git a/src/dependencies/zlib-1.2.11/doc/algorithm.txt b/src/dependencies/zlib-1.2.13/doc/algorithm.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/doc/algorithm.txt rename to src/dependencies/zlib-1.2.13/doc/algorithm.txt diff --git a/src/dependencies/zlib-1.2.13/doc/crc-doc.1.0.pdf b/src/dependencies/zlib-1.2.13/doc/crc-doc.1.0.pdf new file mode 100644 index 0000000..d6942ec Binary files /dev/null and b/src/dependencies/zlib-1.2.13/doc/crc-doc.1.0.pdf differ diff --git a/src/dependencies/zlib-1.2.11/doc/rfc1950.txt b/src/dependencies/zlib-1.2.13/doc/rfc1950.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/doc/rfc1950.txt rename to src/dependencies/zlib-1.2.13/doc/rfc1950.txt diff --git a/src/dependencies/zlib-1.2.11/doc/rfc1951.txt b/src/dependencies/zlib-1.2.13/doc/rfc1951.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/doc/rfc1951.txt rename to src/dependencies/zlib-1.2.13/doc/rfc1951.txt diff --git a/src/dependencies/zlib-1.2.11/doc/rfc1952.txt b/src/dependencies/zlib-1.2.13/doc/rfc1952.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/doc/rfc1952.txt rename to src/dependencies/zlib-1.2.13/doc/rfc1952.txt diff --git a/src/dependencies/zlib-1.2.11/doc/txtvsbin.txt b/src/dependencies/zlib-1.2.13/doc/txtvsbin.txt similarity index 93% rename from src/dependencies/zlib-1.2.11/doc/txtvsbin.txt rename to src/dependencies/zlib-1.2.13/doc/txtvsbin.txt index 3d0f063..2a901ea 100644 --- a/src/dependencies/zlib-1.2.11/doc/txtvsbin.txt +++ b/src/dependencies/zlib-1.2.13/doc/txtvsbin.txt @@ -38,15 +38,15 @@ The Algorithm The algorithm works by dividing the set of bytecodes [0..255] into three categories: -- The white list of textual bytecodes: +- The allow list of textual bytecodes: 9 (TAB), 10 (LF), 13 (CR), 32 (SPACE) to 255. - The gray list of tolerated bytecodes: 7 (BEL), 8 (BS), 11 (VT), 12 (FF), 26 (SUB), 27 (ESC). -- The black list of undesired, non-textual bytecodes: +- The block list of undesired, non-textual bytecodes: 0 (NUL) to 6, 14 to 31. -If a file contains at least one byte that belongs to the white list and -no byte that belongs to the black list, then the file is categorized as +If a file contains at least one byte that belongs to the allow list and +no byte that belongs to the block list, then the file is categorized as plain text; otherwise, it is categorized as binary. (The boundary case, when the file is empty, automatically falls into the latter category.) @@ -84,9 +84,9 @@ consistent results, regardless what alphabet encoding is being used. results on a text encoded, say, using ISO-8859-16 versus UTF-8.) There is an extra category of plain text files that are "polluted" with -one or more black-listed codes, either by mistake or by peculiar design +one or more block-listed codes, either by mistake or by peculiar design considerations. In such cases, a scheme that tolerates a small fraction -of black-listed codes would provide an increased recall (i.e. more true +of block-listed codes would provide an increased recall (i.e. more true positives). This, however, incurs a reduced precision overall, since false positives are more likely to appear in binary files that contain large chunks of textual data. Furthermore, "polluted" plain text should diff --git a/src/dependencies/zlib-1.2.11/examples/README.examples b/src/dependencies/zlib-1.2.13/examples/README.examples similarity index 92% rename from src/dependencies/zlib-1.2.11/examples/README.examples rename to src/dependencies/zlib-1.2.13/examples/README.examples index 56a3171..e3a4b88 100644 --- a/src/dependencies/zlib-1.2.11/examples/README.examples +++ b/src/dependencies/zlib-1.2.13/examples/README.examples @@ -34,6 +34,10 @@ gzlog.h and deflateSetDictionary() - illustrates use of a gzip header extra field +gznorm.c + normalize a gzip file by combining members into a single member + - demonstrates how to concatenate deflate streams using Z_BLOCK + zlib_how.html painfully comprehensive description of zpipe.c (see below) - describes in excruciating detail the use of deflate() and inflate() @@ -44,6 +48,7 @@ zpipe.c - deeply commented in zlib_how.html (see above) zran.c +zran.h index a zlib or gzip stream and randomly access it - illustrates the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() to provide random access diff --git a/src/dependencies/zlib-1.2.13/examples/enough.c b/src/dependencies/zlib-1.2.13/examples/enough.c new file mode 100644 index 0000000..8a3cade --- /dev/null +++ b/src/dependencies/zlib-1.2.13/examples/enough.c @@ -0,0 +1,597 @@ +/* enough.c -- determine the maximum size of inflate's Huffman code tables over + * all possible valid and complete prefix codes, subject to a length limit. + * Copyright (C) 2007, 2008, 2012, 2018 Mark Adler + * Version 1.5 5 August 2018 Mark Adler + */ + +/* Version history: + 1.0 3 Jan 2007 First version (derived from codecount.c version 1.4) + 1.1 4 Jan 2007 Use faster incremental table usage computation + Prune examine() search on previously visited states + 1.2 5 Jan 2007 Comments clean up + As inflate does, decrease root for short codes + Refuse cases where inflate would increase root + 1.3 17 Feb 2008 Add argument for initial root table size + Fix bug for initial root table size == max - 1 + Use a macro to compute the history index + 1.4 18 Aug 2012 Avoid shifts more than bits in type (caused endless loop!) + Clean up comparisons of different types + Clean up code indentation + 1.5 5 Aug 2018 Clean up code style, formatting, and comments + Show all the codes for the maximum, and only the maximum + */ + +/* + Examine all possible prefix codes for a given number of symbols and a + maximum code length in bits to determine the maximum table size for zlib's + inflate. Only complete prefix codes are counted. + + Two codes are considered distinct if the vectors of the number of codes per + length are not identical. So permutations of the symbol assignments result + in the same code for the counting, as do permutations of the assignments of + the bit values to the codes (i.e. only canonical codes are counted). + + We build a code from shorter to longer lengths, determining how many symbols + are coded at each length. At each step, we have how many symbols remain to + be coded, what the last code length used was, and how many bit patterns of + that length remain unused. Then we add one to the code length and double the + number of unused patterns to graduate to the next code length. We then + assign all portions of the remaining symbols to that code length that + preserve the properties of a correct and eventually complete code. Those + properties are: we cannot use more bit patterns than are available; and when + all the symbols are used, there are exactly zero possible bit patterns left + unused. + + The inflate Huffman decoding algorithm uses two-level lookup tables for + speed. There is a single first-level table to decode codes up to root bits + in length (root == 9 for literal/length codes and root == 6 for distance + codes, in the current inflate implementation). The base table has 1 << root + entries and is indexed by the next root bits of input. Codes shorter than + root bits have replicated table entries, so that the correct entry is + pointed to regardless of the bits that follow the short code. If the code is + longer than root bits, then the table entry points to a second-level table. + The size of that table is determined by the longest code with that root-bit + prefix. If that longest code has length len, then the table has size 1 << + (len - root), to index the remaining bits in that set of codes. Each + subsequent root-bit prefix then has its own sub-table. The total number of + table entries required by the code is calculated incrementally as the number + of codes at each bit length is populated. When all of the codes are shorter + than root bits, then root is reduced to the longest code length, resulting + in a single, smaller, one-level table. + + The inflate algorithm also provides for small values of root (relative to + the log2 of the number of symbols), where the shortest code has more bits + than root. In that case, root is increased to the length of the shortest + code. This program, by design, does not handle that case, so it is verified + that the number of symbols is less than 1 << (root + 1). + + In order to speed up the examination (by about ten orders of magnitude for + the default arguments), the intermediate states in the build-up of a code + are remembered and previously visited branches are pruned. The memory + required for this will increase rapidly with the total number of symbols and + the maximum code length in bits. However this is a very small price to pay + for the vast speedup. + + First, all of the possible prefix codes are counted, and reachable + intermediate states are noted by a non-zero count in a saved-results array. + Second, the intermediate states that lead to (root + 1) bit or longer codes + are used to look at all sub-codes from those junctures for their inflate + memory usage. (The amount of memory used is not affected by the number of + codes of root bits or less in length.) Third, the visited states in the + construction of those sub-codes and the associated calculation of the table + size is recalled in order to avoid recalculating from the same juncture. + Beginning the code examination at (root + 1) bit codes, which is enabled by + identifying the reachable nodes, accounts for about six of the orders of + magnitude of improvement for the default arguments. About another four + orders of magnitude come from not revisiting previous states. Out of + approximately 2x10^16 possible prefix codes, only about 2x10^6 sub-codes + need to be examined to cover all of the possible table memory usage cases + for the default arguments of 286 symbols limited to 15-bit codes. + + Note that the uintmax_t type is used for counting. It is quite easy to + exceed the capacity of an eight-byte integer with a large number of symbols + and a large maximum code length, so multiple-precision arithmetic would need + to replace the integer arithmetic in that case. This program will abort if + an overflow occurs. The big_t type identifies where the counting takes + place. + + The uintmax_t type is also used for calculating the number of possible codes + remaining at the maximum length. This limits the maximum code length to the + number of bits in a long long minus the number of bits needed to represent + the symbols in a flat code. The code_t type identifies where the bit-pattern + counting takes place. + */ + +#include +#include +#include +#include +#include +#include + +#define local static + +// Special data types. +typedef uintmax_t big_t; // type for code counting +#define PRIbig "ju" // printf format for big_t +typedef uintmax_t code_t; // type for bit pattern counting +struct tab { // type for been-here check + size_t len; // allocated length of bit vector in octets + char *vec; // allocated bit vector +}; + +/* The array for saving results, num[], is indexed with this triplet: + + syms: number of symbols remaining to code + left: number of available bit patterns at length len + len: number of bits in the codes currently being assigned + + Those indices are constrained thusly when saving results: + + syms: 3..totsym (totsym == total symbols to code) + left: 2..syms - 1, but only the evens (so syms == 8 -> 2, 4, 6) + len: 1..max - 1 (max == maximum code length in bits) + + syms == 2 is not saved since that immediately leads to a single code. left + must be even, since it represents the number of available bit patterns at + the current length, which is double the number at the previous length. left + ends at syms-1 since left == syms immediately results in a single code. + (left > sym is not allowed since that would result in an incomplete code.) + len is less than max, since the code completes immediately when len == max. + + The offset into the array is calculated for the three indices with the first + one (syms) being outermost, and the last one (len) being innermost. We build + the array with length max-1 lists for the len index, with syms-3 of those + for each symbol. There are totsym-2 of those, with each one varying in + length as a function of sym. See the calculation of index in map() for the + index, and the calculation of size in main() for the size of the array. + + For the deflate example of 286 symbols limited to 15-bit codes, the array + has 284,284 entries, taking up 2.17 MB for an 8-byte big_t. More than half + of the space allocated for saved results is actually used -- not all + possible triplets are reached in the generation of valid prefix codes. + */ + +/* The array for tracking visited states, done[], is itself indexed identically + to the num[] array as described above for the (syms, left, len) triplet. + Each element in the array is further indexed by the (mem, rem) doublet, + where mem is the amount of inflate table space used so far, and rem is the + remaining unused entries in the current inflate sub-table. Each indexed + element is simply one bit indicating whether the state has been visited or + not. Since the ranges for mem and rem are not known a priori, each bit + vector is of a variable size, and grows as needed to accommodate the visited + states. mem and rem are used to calculate a single index in a triangular + array. Since the range of mem is expected in the default case to be about + ten times larger than the range of rem, the array is skewed to reduce the + memory usage, with eight times the range for mem than for rem. See the + calculations for offset and bit in been_here() for the details. + + For the deflate example of 286 symbols limited to 15-bit codes, the bit + vectors grow to total 5.5 MB, in addition to the 4.3 MB done array itself. + */ + +// Type for a variable-length, allocated string. +typedef struct { + char *str; // pointer to allocated string + size_t size; // size of allocation + size_t len; // length of string, not including terminating zero +} string_t; + +// Clear a string_t. +local void string_clear(string_t *s) { + s->str[0] = 0; + s->len = 0; +} + +// Initialize a string_t. +local void string_init(string_t *s) { + s->size = 16; + s->str = malloc(s->size); + assert(s->str != NULL && "out of memory"); + string_clear(s); +} + +// Release the allocation of a string_t. +local void string_free(string_t *s) { + free(s->str); + s->str = NULL; + s->size = 0; + s->len = 0; +} + +// Save the results of printf with fmt and the subsequent argument list to s. +// Each call appends to s. The allocated space for s is increased as needed. +local void string_printf(string_t *s, char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + size_t len = s->len; + int ret = vsnprintf(s->str + len, s->size - len, fmt, ap); + assert(ret >= 0 && "out of memory"); + s->len += ret; + if (s->size < s->len + 1) { + do { + s->size <<= 1; + assert(s->size != 0 && "overflow"); + } while (s->size < s->len + 1); + s->str = realloc(s->str, s->size); + assert(s->str != NULL && "out of memory"); + vsnprintf(s->str + len, s->size - len, fmt, ap); + } + va_end(ap); +} + +// Globals to avoid propagating constants or constant pointers recursively. +struct { + int max; // maximum allowed bit length for the codes + int root; // size of base code table in bits + int large; // largest code table so far + size_t size; // number of elements in num and done + big_t tot; // total number of codes with maximum tables size + string_t out; // display of subcodes for maximum tables size + int *code; // number of symbols assigned to each bit length + big_t *num; // saved results array for code counting + struct tab *done; // states already evaluated array +} g; + +// Index function for num[] and done[]. +local inline size_t map(int syms, int left, int len) { + return ((size_t)((syms - 1) >> 1) * ((syms - 2) >> 1) + + (left >> 1) - 1) * (g.max - 1) + + len - 1; +} + +// Free allocated space in globals. +local void cleanup(void) { + if (g.done != NULL) { + for (size_t n = 0; n < g.size; n++) + if (g.done[n].len) + free(g.done[n].vec); + g.size = 0; + free(g.done); g.done = NULL; + } + free(g.num); g.num = NULL; + free(g.code); g.code = NULL; + string_free(&g.out); +} + +// Return the number of possible prefix codes using bit patterns of lengths len +// through max inclusive, coding syms symbols, with left bit patterns of length +// len unused -- return -1 if there is an overflow in the counting. Keep a +// record of previous results in num to prevent repeating the same calculation. +local big_t count(int syms, int left, int len) { + // see if only one possible code + if (syms == left) + return 1; + + // note and verify the expected state + assert(syms > left && left > 0 && len < g.max); + + // see if we've done this one already + size_t index = map(syms, left, len); + big_t got = g.num[index]; + if (got) + return got; // we have -- return the saved result + + // we need to use at least this many bit patterns so that the code won't be + // incomplete at the next length (more bit patterns than symbols) + int least = (left << 1) - syms; + if (least < 0) + least = 0; + + // we can use at most this many bit patterns, lest there not be enough + // available for the remaining symbols at the maximum length (if there were + // no limit to the code length, this would become: most = left - 1) + int most = (((code_t)left << (g.max - len)) - syms) / + (((code_t)1 << (g.max - len)) - 1); + + // count all possible codes from this juncture and add them up + big_t sum = 0; + for (int use = least; use <= most; use++) { + got = count(syms - use, (left - use) << 1, len + 1); + sum += got; + if (got == (big_t)-1 || sum < got) // overflow + return (big_t)-1; + } + + // verify that all recursive calls are productive + assert(sum != 0); + + // save the result and return it + g.num[index] = sum; + return sum; +} + +// Return true if we've been here before, set to true if not. Set a bit in a +// bit vector to indicate visiting this state. Each (syms,len,left) state has a +// variable size bit vector indexed by (mem,rem). The bit vector is lengthened +// as needed to allow setting the (mem,rem) bit. +local int been_here(int syms, int left, int len, int mem, int rem) { + // point to vector for (syms,left,len), bit in vector for (mem,rem) + size_t index = map(syms, left, len); + mem -= 1 << g.root; // mem always includes the root table + mem >>= 1; // mem and rem are always even + rem >>= 1; + size_t offset = (mem >> 3) + rem; + offset = ((offset * (offset + 1)) >> 1) + rem; + int bit = 1 << (mem & 7); + + // see if we've been here + size_t length = g.done[index].len; + if (offset < length && (g.done[index].vec[offset] & bit) != 0) + return 1; // done this! + + // we haven't been here before -- set the bit to show we have now + + // see if we need to lengthen the vector in order to set the bit + if (length <= offset) { + // if we have one already, enlarge it, zero out the appended space + char *vector; + if (length) { + do { + length <<= 1; + } while (length <= offset); + vector = realloc(g.done[index].vec, length); + assert(vector != NULL && "out of memory"); + memset(vector + g.done[index].len, 0, length - g.done[index].len); + } + + // otherwise we need to make a new vector and zero it out + else { + length = 16; + while (length <= offset) + length <<= 1; + vector = calloc(length, 1); + assert(vector != NULL && "out of memory"); + } + + // install the new vector + g.done[index].len = length; + g.done[index].vec = vector; + } + + // set the bit + g.done[index].vec[offset] |= bit; + return 0; +} + +// Examine all possible codes from the given node (syms, len, left). Compute +// the amount of memory required to build inflate's decoding tables, where the +// number of code structures used so far is mem, and the number remaining in +// the current sub-table is rem. +local void examine(int syms, int left, int len, int mem, int rem) { + // see if we have a complete code + if (syms == left) { + // set the last code entry + g.code[len] = left; + + // complete computation of memory used by this code + while (rem < left) { + left -= rem; + rem = 1 << (len - g.root); + mem += rem; + } + assert(rem == left); + + // if this is at the maximum, show the sub-code + if (mem >= g.large) { + // if this is a new maximum, update the maximum and clear out the + // printed sub-codes from the previous maximum + if (mem > g.large) { + g.large = mem; + string_clear(&g.out); + } + + // compute the starting state for this sub-code + syms = 0; + left = 1 << g.max; + for (int bits = g.max; bits > g.root; bits--) { + syms += g.code[bits]; + left -= g.code[bits]; + assert((left & 1) == 0); + left >>= 1; + } + + // print the starting state and the resulting sub-code to g.out + string_printf(&g.out, "<%u, %u, %u>:", + syms, g.root + 1, ((1 << g.root) - left) << 1); + for (int bits = g.root + 1; bits <= g.max; bits++) + if (g.code[bits]) + string_printf(&g.out, " %d[%d]", g.code[bits], bits); + string_printf(&g.out, "\n"); + } + + // remove entries as we drop back down in the recursion + g.code[len] = 0; + return; + } + + // prune the tree if we can + if (been_here(syms, left, len, mem, rem)) + return; + + // we need to use at least this many bit patterns so that the code won't be + // incomplete at the next length (more bit patterns than symbols) + int least = (left << 1) - syms; + if (least < 0) + least = 0; + + // we can use at most this many bit patterns, lest there not be enough + // available for the remaining symbols at the maximum length (if there were + // no limit to the code length, this would become: most = left - 1) + int most = (((code_t)left << (g.max - len)) - syms) / + (((code_t)1 << (g.max - len)) - 1); + + // occupy least table spaces, creating new sub-tables as needed + int use = least; + while (rem < use) { + use -= rem; + rem = 1 << (len - g.root); + mem += rem; + } + rem -= use; + + // examine codes from here, updating table space as we go + for (use = least; use <= most; use++) { + g.code[len] = use; + examine(syms - use, (left - use) << 1, len + 1, + mem + (rem ? 1 << (len - g.root) : 0), rem << 1); + if (rem == 0) { + rem = 1 << (len - g.root); + mem += rem; + } + rem--; + } + + // remove entries as we drop back down in the recursion + g.code[len] = 0; +} + +// Look at all sub-codes starting with root + 1 bits. Look at only the valid +// intermediate code states (syms, left, len). For each completed code, +// calculate the amount of memory required by inflate to build the decoding +// tables. Find the maximum amount of memory required and show the codes that +// require that maximum. +local void enough(int syms) { + // clear code + for (int n = 0; n <= g.max; n++) + g.code[n] = 0; + + // look at all (root + 1) bit and longer codes + string_clear(&g.out); // empty saved results + g.large = 1 << g.root; // base table + if (g.root < g.max) // otherwise, there's only a base table + for (int n = 3; n <= syms; n++) + for (int left = 2; left < n; left += 2) { + // look at all reachable (root + 1) bit nodes, and the + // resulting codes (complete at root + 2 or more) + size_t index = map(n, left, g.root + 1); + if (g.root + 1 < g.max && g.num[index]) // reachable node + examine(n, left, g.root + 1, 1 << g.root, 0); + + // also look at root bit codes with completions at root + 1 + // bits (not saved in num, since complete), just in case + if (g.num[index - 1] && n <= left << 1) + examine((n - left) << 1, (n - left) << 1, g.root + 1, + 1 << g.root, 0); + } + + // done + printf("maximum of %d table entries for root = %d\n", g.large, g.root); + fputs(g.out.str, stdout); +} + +// Examine and show the total number of possible prefix codes for a given +// maximum number of symbols, initial root table size, and maximum code length +// in bits -- those are the command arguments in that order. The default values +// are 286, 9, and 15 respectively, for the deflate literal/length code. The +// possible codes are counted for each number of coded symbols from two to the +// maximum. The counts for each of those and the total number of codes are +// shown. The maximum number of inflate table entries is then calculated across +// all possible codes. Each new maximum number of table entries and the +// associated sub-code (starting at root + 1 == 10 bits) is shown. +// +// To count and examine prefix codes that are not length-limited, provide a +// maximum length equal to the number of symbols minus one. +// +// For the deflate literal/length code, use "enough". For the deflate distance +// code, use "enough 30 6". +int main(int argc, char **argv) { + // set up globals for cleanup() + g.code = NULL; + g.num = NULL; + g.done = NULL; + string_init(&g.out); + + // get arguments -- default to the deflate literal/length code + int syms = 286; + g.root = 9; + g.max = 15; + if (argc > 1) { + syms = atoi(argv[1]); + if (argc > 2) { + g.root = atoi(argv[2]); + if (argc > 3) + g.max = atoi(argv[3]); + } + } + if (argc > 4 || syms < 2 || g.root < 1 || g.max < 1) { + fputs("invalid arguments, need: [sym >= 2 [root >= 1 [max >= 1]]]\n", + stderr); + return 1; + } + + // if not restricting the code length, the longest is syms - 1 + if (g.max > syms - 1) + g.max = syms - 1; + + // determine the number of bits in a code_t + int bits = 0; + for (code_t word = 1; word; word <<= 1) + bits++; + + // make sure that the calculation of most will not overflow + if (g.max > bits || (code_t)(syms - 2) >= ((code_t)-1 >> (g.max - 1))) { + fputs("abort: code length too long for internal types\n", stderr); + return 1; + } + + // reject impossible code requests + if ((code_t)(syms - 1) > ((code_t)1 << g.max) - 1) { + fprintf(stderr, "%d symbols cannot be coded in %d bits\n", + syms, g.max); + return 1; + } + + // allocate code vector + g.code = calloc(g.max + 1, sizeof(int)); + assert(g.code != NULL && "out of memory"); + + // determine size of saved results array, checking for overflows, + // allocate and clear the array (set all to zero with calloc()) + if (syms == 2) // iff max == 1 + g.num = NULL; // won't be saving any results + else { + g.size = syms >> 1; + int n = (syms - 1) >> 1; + assert(g.size <= (size_t)-1 / n && "overflow"); + g.size *= n; + n = g.max - 1; + assert(g.size <= (size_t)-1 / n && "overflow"); + g.size *= n; + g.num = calloc(g.size, sizeof(big_t)); + assert(g.num != NULL && "out of memory"); + } + + // count possible codes for all numbers of symbols, add up counts + big_t sum = 0; + for (int n = 2; n <= syms; n++) { + big_t got = count(n, 2, 1); + sum += got; + assert(got != (big_t)-1 && sum >= got && "overflow"); + } + printf("%"PRIbig" total codes for 2 to %d symbols", sum, syms); + if (g.max < syms - 1) + printf(" (%d-bit length limit)\n", g.max); + else + puts(" (no length limit)"); + + // allocate and clear done array for been_here() + if (syms == 2) + g.done = NULL; + else { + g.done = calloc(g.size, sizeof(struct tab)); + assert(g.done != NULL && "out of memory"); + } + + // find and show maximum inflate table usage + if (g.root > g.max) // reduce root to max length + g.root = g.max; + if ((code_t)syms < ((code_t)1 << (g.root + 1))) + enough(syms); + else + fputs("cannot handle minimum code lengths > root", stderr); + + // done + cleanup(); + return 0; +} diff --git a/src/dependencies/zlib-1.2.11/examples/fitblk.c b/src/dependencies/zlib-1.2.13/examples/fitblk.c similarity index 98% rename from src/dependencies/zlib-1.2.11/examples/fitblk.c rename to src/dependencies/zlib-1.2.13/examples/fitblk.c index c61de5c..68f5680 100644 --- a/src/dependencies/zlib-1.2.11/examples/fitblk.c +++ b/src/dependencies/zlib-1.2.13/examples/fitblk.c @@ -17,7 +17,7 @@ data in order to determine how much of that input will compress to nearly the requested output block size. The first pass generates enough deflate blocks to produce output to fill the requested - output size plus a specfied excess amount (see the EXCESS define + output size plus a specified excess amount (see the EXCESS define below). The last deflate block may go quite a bit past that, but is discarded. The second pass decompresses and recompresses just the compressed data that fit in the requested plus excess sized @@ -109,7 +109,7 @@ local int recompress(z_streamp inf, z_streamp def) if (ret == Z_MEM_ERROR) return ret; - /* compress what was decompresed until done or no room */ + /* compress what was decompressed until done or no room */ def->avail_in = RAWLEN - inf->avail_out; def->next_in = raw; if (inf->avail_out != 0) diff --git a/src/dependencies/zlib-1.2.11/examples/gun.c b/src/dependencies/zlib-1.2.13/examples/gun.c similarity index 99% rename from src/dependencies/zlib-1.2.11/examples/gun.c rename to src/dependencies/zlib-1.2.13/examples/gun.c index be44fa5..bea5497 100644 --- a/src/dependencies/zlib-1.2.11/examples/gun.c +++ b/src/dependencies/zlib-1.2.13/examples/gun.c @@ -43,7 +43,7 @@ gun will also decompress files made by Unix compress, which uses LZW compression. These files are automatically detected by virtue of their magic header bytes. Since the end of Unix compress stream is marked by the - end-of-file, they cannot be concantenated. If a Unix compress stream is + end-of-file, they cannot be concatenated. If a Unix compress stream is encountered in an input file, it is the last stream in that file. Like gunzip and uncompress, the file attributes of the original compressed diff --git a/src/dependencies/zlib-1.2.11/examples/gzappend.c b/src/dependencies/zlib-1.2.13/examples/gzappend.c similarity index 98% rename from src/dependencies/zlib-1.2.11/examples/gzappend.c rename to src/dependencies/zlib-1.2.13/examples/gzappend.c index 662dec3..23e93cf 100644 --- a/src/dependencies/zlib-1.2.11/examples/gzappend.c +++ b/src/dependencies/zlib-1.2.13/examples/gzappend.c @@ -33,7 +33,7 @@ * - Add L to constants in lseek() calls * - Remove some debugging information in error messages * - Use new data_type definition for zlib 1.2.1 - * - Simplfy and unify file operations + * - Simplify and unify file operations * - Finish off gzip file in gztack() * - Use deflatePrime() instead of adding empty blocks * - Keep gzip file clean on appended file read errors @@ -54,7 +54,7 @@ block boundary to facilitate locating and modifying the last block bit at the start of the final deflate block. Also whether using Z_BLOCK or not, another required feature of zlib 1.2.x is that inflate() now provides the - number of unusued bits in the last input byte used. gzappend will not work + number of unused bits in the last input byte used. gzappend will not work with versions of zlib earlier than 1.2.1. gzappend first decompresses the gzip file internally, discarding all but @@ -137,7 +137,7 @@ local void rotate(unsigned char *list, unsigned len, unsigned rot) /* do simple left shift by one */ if (rot == 1) { tmp = *list; - memcpy(list, list + 1, len - 1); + memmove(list, list + 1, len - 1); *last = tmp; return; } diff --git a/src/dependencies/zlib-1.2.11/examples/gzjoin.c b/src/dependencies/zlib-1.2.13/examples/gzjoin.c similarity index 100% rename from src/dependencies/zlib-1.2.11/examples/gzjoin.c rename to src/dependencies/zlib-1.2.13/examples/gzjoin.c diff --git a/src/dependencies/zlib-1.2.11/examples/gzlog.c b/src/dependencies/zlib-1.2.13/examples/gzlog.c similarity index 99% rename from src/dependencies/zlib-1.2.11/examples/gzlog.c rename to src/dependencies/zlib-1.2.13/examples/gzlog.c index b8c2927..b977802 100644 --- a/src/dependencies/zlib-1.2.11/examples/gzlog.c +++ b/src/dependencies/zlib-1.2.13/examples/gzlog.c @@ -1,8 +1,8 @@ /* * gzlog.c - * Copyright (C) 2004, 2008, 2012, 2016 Mark Adler, all rights reserved + * Copyright (C) 2004, 2008, 2012, 2016, 2019 Mark Adler, all rights reserved * For conditions of distribution and use, see copyright notice in gzlog.h - * version 2.2, 14 Aug 2012 + * version 2.3, 25 May 2019 */ /* @@ -756,12 +756,14 @@ local int log_recover(struct log *log, int op) return -2; } if ((fd = open(log->path, O_RDONLY, 0)) < 0) { + free(data); log_log(log, op, ".add file read failure"); return -1; } ret = (size_t)read(fd, data, len) != len; close(fd); if (ret) { + free(data); log_log(log, op, ".add file read failure"); return -1; } diff --git a/src/dependencies/zlib-1.2.11/examples/gzlog.h b/src/dependencies/zlib-1.2.13/examples/gzlog.h similarity index 98% rename from src/dependencies/zlib-1.2.11/examples/gzlog.h rename to src/dependencies/zlib-1.2.13/examples/gzlog.h index 86f0cec..4f05109 100644 --- a/src/dependencies/zlib-1.2.11/examples/gzlog.h +++ b/src/dependencies/zlib-1.2.13/examples/gzlog.h @@ -40,7 +40,7 @@ its new size at that time. After each write operation, the log file is a valid gzip file that can decompressed to recover what was written. - The gzlog operations can be interupted at any point due to an application or + The gzlog operations can be interrupted at any point due to an application or system crash, and the log file will be recovered the next time the log is opened with gzlog_open(). */ diff --git a/src/dependencies/zlib-1.2.13/examples/gznorm.c b/src/dependencies/zlib-1.2.13/examples/gznorm.c new file mode 100644 index 0000000..68e0a0f --- /dev/null +++ b/src/dependencies/zlib-1.2.13/examples/gznorm.c @@ -0,0 +1,470 @@ +/* gznorm.c -- normalize a gzip stream + * Copyright (C) 2018 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * Version 1.0 7 Oct 2018 Mark Adler */ + +// gznorm takes a gzip stream, potentially containing multiple members, and +// converts it to a gzip stream with a single member. In addition the gzip +// header is normalized, removing the file name and time stamp, and setting the +// other header contents (XFL, OS) to fixed values. gznorm does not recompress +// the data, so it is fast, but no advantage is gained from the history that +// could be available across member boundaries. + +#include // fread, fwrite, putc, fflush, ferror, fprintf, + // vsnprintf, stdout, stderr, NULL, FILE +#include // malloc, free +#include // strerror +#include // errno +#include // va_list, va_start, va_end +#include "zlib.h" // inflateInit2, inflate, inflateReset, inflateEnd, + // z_stream, z_off_t, crc32_combine, Z_NULL, Z_BLOCK, + // Z_OK, Z_STREAM_END, Z_BUF_ERROR, Z_DATA_ERROR, + // Z_MEM_ERROR + +#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) +# include +# include +# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) +#else +# define SET_BINARY_MODE(file) +#endif + +#define local static + +// printf to an allocated string. Return the string, or NULL if the printf or +// allocation fails. +local char *aprintf(char *fmt, ...) { + // Get the length of the result of the printf. + va_list args; + va_start(args, fmt); + int len = vsnprintf(NULL, 0, fmt, args); + va_end(args); + if (len < 0) + return NULL; + + // Allocate the required space and printf to it. + char *str = malloc(len + 1); + if (str == NULL) + return NULL; + va_start(args, fmt); + vsnprintf(str, len + 1, fmt, args); + va_end(args); + return str; +} + +// Return with an error, putting an allocated error message in *err. Doing an +// inflateEnd() on an already ended state, or one with state set to Z_NULL, is +// permitted. +#define BYE(...) \ + do { \ + inflateEnd(&strm); \ + *err = aprintf(__VA_ARGS__); \ + return 1; \ + } while (0) + +// Chunk size for buffered reads and for decompression. Twice this many bytes +// will be allocated on the stack by gzip_normalize(). Must fit in an unsigned. +#define CHUNK 16384 + +// Read a gzip stream from in and write an equivalent normalized gzip stream to +// out. If given no input, an empty gzip stream will be written. If successful, +// 0 is returned, and *err is set to NULL. On error, 1 is returned, where the +// details of the error are returned in *err, a pointer to an allocated string. +// +// The input may be a stream with multiple gzip members, which is converted to +// a single gzip member on the output. Each gzip member is decompressed at the +// level of deflate blocks. This enables clearing the last-block bit, shifting +// the compressed data to concatenate to the previous member's compressed data, +// which can end at an arbitrary bit boundary, and identifying stored blocks in +// order to resynchronize those to byte boundaries. The deflate compressed data +// is terminated with a 10-bit empty fixed block. If any members on the input +// end with a 10-bit empty fixed block, then that block is excised from the +// stream. This avoids appending empty fixed blocks for every normalization, +// and assures that gzip_normalize applied a second time will not change the +// input. The pad bits after stored block headers and after the final deflate +// block are all forced to zeros. +local int gzip_normalize(FILE *in, FILE *out, char **err) { + // initialize the inflate engine to process a gzip member + z_stream strm; + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + strm.avail_in = 0; + strm.next_in = Z_NULL; + if (inflateInit2(&strm, 15 + 16) != Z_OK) + BYE("out of memory"); + + // State while processing the input gzip stream. + enum { // BETWEEN -> HEAD -> BLOCK -> TAIL -> BETWEEN -> ... + BETWEEN, // between gzip members (must end in this state) + HEAD, // reading a gzip header + BLOCK, // reading deflate blocks + TAIL // reading a gzip trailer + } state = BETWEEN; // current component being processed + unsigned long crc = 0; // accumulated CRC of uncompressed data + unsigned long len = 0; // accumulated length of uncompressed data + unsigned long buf = 0; // deflate stream bit buffer of num bits + int num = 0; // number of bits in buf (at bottom) + + // Write a canonical gzip header (no mod time, file name, comment, extra + // block, or extra flags, and OS is marked as unknown). + fwrite("\x1f\x8b\x08\0\0\0\0\0\0\xff", 1, 10, out); + + // Process the gzip stream from in until reaching the end of the input, + // encountering invalid input, or experiencing an i/o error. + int more; // true if not at the end of the input + do { + // State inside this loop. + unsigned char *put; // next input buffer location to process + int prev; // number of bits from previous block in + // the bit buffer, or -1 if not at the + // start of a block + unsigned long long memb; // uncompressed length of member + size_t tail; // number of trailer bytes read (0..8) + unsigned long part; // accumulated trailer component + + // Get the next chunk of input from in. + unsigned char dat[CHUNK]; + strm.avail_in = fread(dat, 1, CHUNK, in); + if (strm.avail_in == 0) + break; + more = strm.avail_in == CHUNK; + strm.next_in = put = dat; + + // Run that chunk of input through the inflate engine to exhaustion. + do { + // At this point it is assured that strm.avail_in > 0. + + // Inflate until the end of a gzip component (header, deflate + // block, trailer) is reached, or until all of the chunk is + // consumed. The resulting decompressed data is discarded, though + // the total size of the decompressed data in each member is + // tracked, for the calculation of the total CRC. + do { + // inflate and handle any errors + unsigned char scrap[CHUNK]; + strm.avail_out = CHUNK; + strm.next_out = scrap; + int ret = inflate(&strm, Z_BLOCK); + if (ret == Z_MEM_ERROR) + BYE("out of memory"); + if (ret == Z_DATA_ERROR) + BYE("input invalid: %s", strm.msg); + if (ret != Z_OK && ret != Z_BUF_ERROR && ret != Z_STREAM_END) + BYE("internal error"); + + // Update the number of uncompressed bytes generated in this + // member. The actual count (not modulo 2^32) is required to + // correctly compute the total CRC. + unsigned got = CHUNK - strm.avail_out; + memb += got; + if (memb < got) + BYE("overflow error"); + + // Continue to process this chunk until it is consumed, or + // until the end of a component (header, deflate block, or + // trailer) is reached. + } while (strm.avail_out == 0 && (strm.data_type & 0x80) == 0); + + // Since strm.avail_in was > 0 for the inflate call, some input was + // just consumed. It is therefore assured that put < strm.next_in. + + // Disposition the consumed component or part of a component. + switch (state) { + case BETWEEN: + state = HEAD; + // Fall through to HEAD when some or all of the header is + // processed. + + case HEAD: + // Discard the header. + if (strm.data_type & 0x80) { + // End of header reached -- deflate blocks follow. + put = strm.next_in; + prev = num; + memb = 0; + state = BLOCK; + } + break; + + case BLOCK: + // Copy the deflate stream to the output, but with the + // last-block-bit cleared. Re-synchronize stored block + // headers to the output byte boundaries. The bytes at + // put..strm.next_in-1 is the compressed data that has been + // processed and is ready to be copied to the output. + + // At this point, it is assured that new compressed data is + // available, i.e., put < strm.next_in. If prev is -1, then + // that compressed data starts in the middle of a deflate + // block. If prev is not -1, then the bits in the bit + // buffer, possibly combined with the bits in *put, contain + // the three-bit header of the new deflate block. In that + // case, prev is the number of bits from the previous block + // that remain in the bit buffer. Since num is the number + // of bits in the bit buffer, we have that num - prev is + // the number of bits from the new block currently in the + // bit buffer. + + // If strm.data_type & 0xc0 is 0x80, then the last byte of + // the available compressed data includes the last bits of + // the end of a deflate block. In that case, that last byte + // also has strm.data_type & 0x1f bits of the next deflate + // block, in the range 0..7. If strm.data_type & 0xc0 is + // 0xc0, then the last byte of the compressed data is the + // end of the deflate stream, followed by strm.data_type & + // 0x1f pad bits, also in the range 0..7. + + // Set bits to the number of bits not yet consumed from the + // last byte. If we are at the end of the block, bits is + // either the number of bits in the last byte belonging to + // the next block, or the number of pad bits after the + // final block. In either of those cases, bits is in the + // range 0..7. + ; // (required due to C syntax oddity) + int bits = strm.data_type & 0x1f; + + if (prev != -1) { + // We are at the start of a new block. Clear the last + // block bit, and check for special cases. If it is a + // stored block, then emit the header and pad to the + // next byte boundary. If it is a final, empty fixed + // block, then excise it. + + // Some or all of the three header bits for this block + // may already be in the bit buffer. Load any remaining + // header bits into the bit buffer. + if (num - prev < 3) { + buf += (unsigned long)*put++ << num; + num += 8; + } + + // Set last to have a 1 in the position of the last + // block bit in the bit buffer. + unsigned long last = (unsigned long)1 << prev; + + if (((buf >> prev) & 7) == 3) { + // This is a final fixed block. Load at least ten + // bits from this block, including the header, into + // the bit buffer. We already have at least three, + // so at most one more byte needs to be loaded. + if (num - prev < 10) { + if (put == strm.next_in) + // Need to go get and process more input. + // We'll end up back here to finish this. + break; + buf += (unsigned long)*put++ << num; + num += 8; + } + if (((buf >> prev) & 0x3ff) == 3) { + // That final fixed block is empty. Delete it + // to avoid adding an empty block every time a + // gzip stream is normalized. + num = prev; + buf &= last - 1; // zero the pad bits + } + } + else if (((buf >> prev) & 6) == 0) { + // This is a stored block. Flush to the next + // byte boundary after the three-bit header. + num = (prev + 10) & ~7; + buf &= last - 1; // zero the pad bits + } + + // Clear the last block bit. + buf &= ~last; + + // Write out complete bytes in the bit buffer. + while (num >= 8) { + putc(buf, out); + buf >>= 8; + num -= 8; + } + + // If no more bytes left to process, then we have + // consumed the byte that had bits from the next block. + if (put == strm.next_in) + bits = 0; + } + + // We are done handling the deflate block header. Now copy + // all or almost all of the remaining compressed data that + // has been processed so far. Don't copy one byte at the + // end if it contains bits from the next deflate block or + // pad bits at the end of a deflate block. + + // mix is 1 if we are at the end of a deflate block, and if + // some of the bits in the last byte follow this block. mix + // is 0 if we are in the middle of a deflate block, if the + // deflate block ended on a byte boundary, or if all of the + // compressed data processed so far has been consumed. + int mix = (strm.data_type & 0x80) && bits; + + // Copy all of the processed compressed data to the output, + // except for the last byte if it contains bits from the + // next deflate block or pad bits at the end of the deflate + // stream. Copy the data after shifting in num bits from + // buf in front of it, leaving num bits from the end of the + // compressed data in buf when done. + unsigned char *end = strm.next_in - mix; + if (put < end) { + if (num) + // Insert num bits from buf before the data being + // copied. + do { + buf += (unsigned)(*put++) << num; + putc(buf, out); + buf >>= 8; + } while (put < end); + else { + // No shifting needed -- write directly. + fwrite(put, 1, end - put, out); + put = end; + } + } + + // Process the last processed byte if it wasn't written. + if (mix) { + // Load the last byte into the bit buffer. + buf += (unsigned)(*put++) << num; + num += 8; + + if (strm.data_type & 0x40) { + // We are at the end of the deflate stream and + // there are bits pad bits. Discard the pad bits + // and write a byte to the output, if available. + // Leave the num bits left over in buf to prepend + // to the next deflate stream. + num -= bits; + if (num >= 8) { + putc(buf, out); + num -= 8; + buf >>= 8; + } + + // Force the pad bits in the bit buffer to zeros. + buf &= ((unsigned long)1 << num) - 1; + + // Don't need to set prev here since going to TAIL. + } + else + // At the end of an internal deflate block. Leave + // the last byte in the bit buffer to examine on + // the next entry to BLOCK, when more bits from the + // next block will be available. + prev = num - bits; // number of bits in buffer + // from current block + } + + // Don't have a byte left over, so we are in the middle of + // a deflate block, or the deflate block ended on a byte + // boundary. Set prev appropriately for the next entry into + // BLOCK. + else if (strm.data_type & 0x80) + // The block ended on a byte boundary, so no header + // bits are in the bit buffer. + prev = num; + else + // In the middle of a deflate block, so no header here. + prev = -1; + + // Check for the end of the deflate stream. + if ((strm.data_type & 0xc0) == 0xc0) { + // That ends the deflate stream on the input side, the + // pad bits were discarded, and any remaining bits from + // the last block in the stream are saved in the bit + // buffer to prepend to the next stream. Process the + // gzip trailer next. + tail = 0; + part = 0; + state = TAIL; + } + break; + + case TAIL: + // Accumulate available trailer bytes to update the total + // CRC and the total uncompressed length. + do { + part = (part >> 8) + ((unsigned long)(*put++) << 24); + tail++; + if (tail == 4) { + // Update the total CRC. + z_off_t len2 = memb; + if (len2 < 0 || (unsigned long long)len2 != memb) + BYE("overflow error"); + crc = crc ? crc32_combine(crc, part, len2) : part; + part = 0; + } + else if (tail == 8) { + // Update the total uncompressed length. (It's ok + // if this sum is done modulo 2^32.) + len += part; + + // At the end of a member. Set up to inflate an + // immediately following gzip member. (If we made + // it this far, then the trailer was valid.) + if (inflateReset(&strm) != Z_OK) + BYE("internal error"); + state = BETWEEN; + break; + } + } while (put < strm.next_in); + break; + } + + // Process the input buffer until completely consumed. + } while (strm.avail_in > 0); + + // Process input until end of file, invalid input, or i/o error. + } while (more); + + // Done with the inflate engine. + inflateEnd(&strm); + + // Verify the validity of the input. + if (state != BETWEEN) + BYE("input invalid: incomplete gzip stream"); + + // Write the remaining deflate stream bits, followed by a terminating + // deflate fixed block. + buf += (unsigned long)3 << num; + putc(buf, out); + putc(buf >> 8, out); + if (num > 6) + putc(0, out); + + // Write the gzip trailer, which is the CRC and the uncompressed length + // modulo 2^32, both in little-endian order. + putc(crc, out); + putc(crc >> 8, out); + putc(crc >> 16, out); + putc(crc >> 24, out); + putc(len, out); + putc(len >> 8, out); + putc(len >> 16, out); + putc(len >> 24, out); + fflush(out); + + // Check for any i/o errors. + if (ferror(in) || ferror(out)) + BYE("i/o error: %s", strerror(errno)); + + // All good! + *err = NULL; + return 0; +} + +// Normalize the gzip stream on stdin, writing the result to stdout. +int main(void) { + // Avoid end-of-line conversions on evil operating systems. + SET_BINARY_MODE(stdin); + SET_BINARY_MODE(stdout); + + // Normalize from stdin to stdout, returning 1 on error, 0 if ok. + char *err; + int ret = gzip_normalize(stdin, stdout, &err); + if (ret) + fprintf(stderr, "gznorm error: %s\n", err); + free(err); + return ret; +} diff --git a/src/dependencies/zlib-1.2.11/examples/zlib_how.html b/src/dependencies/zlib-1.2.13/examples/zlib_how.html similarity index 100% rename from src/dependencies/zlib-1.2.11/examples/zlib_how.html rename to src/dependencies/zlib-1.2.13/examples/zlib_how.html diff --git a/src/dependencies/zlib-1.2.11/examples/zpipe.c b/src/dependencies/zlib-1.2.13/examples/zpipe.c similarity index 100% rename from src/dependencies/zlib-1.2.11/examples/zpipe.c rename to src/dependencies/zlib-1.2.13/examples/zpipe.c diff --git a/src/dependencies/zlib-1.2.11/examples/zran.c b/src/dependencies/zlib-1.2.13/examples/zran.c similarity index 60% rename from src/dependencies/zlib-1.2.11/examples/zran.c rename to src/dependencies/zlib-1.2.13/examples/zran.c index 4fec659..879c47c 100644 --- a/src/dependencies/zlib-1.2.11/examples/zran.c +++ b/src/dependencies/zlib-1.2.13/examples/zran.c @@ -1,11 +1,13 @@ /* zran.c -- example of zlib/gzip stream indexing and random access - * Copyright (C) 2005, 2012 Mark Adler + * Copyright (C) 2005, 2012, 2018 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h - Version 1.1 29 Sep 2012 Mark Adler */ + * Version 1.2 14 Oct 2018 Mark Adler */ /* Version History: 1.0 29 May 2005 First version 1.1 29 Sep 2012 Fix memory reallocation error + 1.2 14 Oct 2018 Handle gzip streams with multiple members + Add a header file to facilitate usage in applications */ /* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() @@ -19,12 +21,12 @@ An access point can be created at the start of any deflate block, by saving the starting file offset and bit of that block, and the 32K bytes of uncompressed data that precede that block. Also the uncompressed offset of - that block is saved to provide a referece for locating a desired starting - point in the uncompressed stream. build_index() works by decompressing the - input zlib or gzip stream a block at a time, and at the end of each block - deciding if enough uncompressed data has gone by to justify the creation of - a new access point. If so, that point is saved in a data structure that - grows as needed to accommodate the points. + that block is saved to provide a reference for locating a desired starting + point in the uncompressed stream. deflate_index_build() works by + decompressing the input zlib or gzip stream a block at a time, and at the + end of each block deciding if enough uncompressed data has gone by to + justify the creation of a new access point. If so, that point is saved in a + data structure that grows as needed to accommodate the points. To use the index, an offset in the uncompressed data is provided, for which the latest access point at or preceding that offset is located in the index. @@ -43,7 +45,8 @@ There is some fair bit of overhead to starting inflation for the random access, mainly copying the 32K byte dictionary. So if small pieces of the file are being accessed, it would make sense to implement a cache to hold - some lookahead and avoid many calls to extract() for small lengths. + some lookahead and avoid many calls to deflate_index_extract() for small + lengths. Another way to build an index would be to use inflateCopy(). That would not be constrained to have access points at block boundaries, but requires @@ -56,30 +59,21 @@ #include #include #include "zlib.h" +#include "zran.h" -#define local static - -#define SPAN 1048576L /* desired distance between access points */ #define WINSIZE 32768U /* sliding window size */ #define CHUNK 16384 /* file input buffer size */ -/* access point entry */ +/* Access point entry. */ struct point { off_t out; /* corresponding offset in uncompressed data */ off_t in; /* offset in input file of first full byte */ - int bits; /* number of bits (1-7) from byte at in - 1, or 0 */ + int bits; /* number of bits (1-7) from byte at in-1, or 0 */ unsigned char window[WINSIZE]; /* preceding 32K of uncompressed data */ }; -/* access point list */ -struct access { - int have; /* number of list entries filled in */ - int size; /* number of list entries allocated */ - struct point *list; /* allocated list */ -}; - -/* Deallocate an index built by build_index() */ -local void free_index(struct access *index) +/* See comments in zran.h. */ +void deflate_index_free(struct deflate_index *index) { if (index != NULL) { free(index->list); @@ -87,39 +81,43 @@ local void free_index(struct access *index) } } -/* Add an entry to the access point list. If out of memory, deallocate the - existing list and return NULL. */ -local struct access *addpoint(struct access *index, int bits, - off_t in, off_t out, unsigned left, unsigned char *window) +/* Add an entry to the access point list. If out of memory, deallocate the + existing list and return NULL. index->gzip is the allocated size of the + index in point entries, until it is time for deflate_index_build() to + return, at which point gzip is set to indicate a gzip file or not. + */ +static struct deflate_index *addpoint(struct deflate_index *index, int bits, + off_t in, off_t out, unsigned left, + unsigned char *window) { struct point *next; /* if list is empty, create it (start with eight points) */ if (index == NULL) { - index = malloc(sizeof(struct access)); + index = malloc(sizeof(struct deflate_index)); if (index == NULL) return NULL; index->list = malloc(sizeof(struct point) << 3); if (index->list == NULL) { free(index); return NULL; } - index->size = 8; + index->gzip = 8; index->have = 0; } /* if list is full, make it bigger */ - else if (index->have == index->size) { - index->size <<= 1; - next = realloc(index->list, sizeof(struct point) * index->size); + else if (index->have == index->gzip) { + index->gzip <<= 1; + next = realloc(index->list, sizeof(struct point) * index->gzip); if (next == NULL) { - free_index(index); + deflate_index_free(index); return NULL; } index->list = next; } /* fill in entry and increment how many we have */ - next = index->list + index->have; + next = (struct point *)(index->list) + index->have; next->bits = bits; next->in = in; next->out = out; @@ -133,20 +131,14 @@ local struct access *addpoint(struct access *index, int bits, return index; } -/* Make one entire pass through the compressed stream and build an index, with - access points about every span bytes of uncompressed output -- span is - chosen to balance the speed of random access against the memory requirements - of the list, about 32K bytes per access point. Note that data after the end - of the first zlib or gzip stream in the file is ignored. build_index() - returns the number of access points on success (>= 1), Z_MEM_ERROR for out - of memory, Z_DATA_ERROR for an error in the input file, or Z_ERRNO for a - file read error. On success, *built points to the resulting index. */ -local int build_index(FILE *in, off_t span, struct access **built) +/* See comments in zran.h. */ +int deflate_index_build(FILE *in, off_t span, struct deflate_index **built) { int ret; + int gzip = 0; /* true if reading a gzip file */ off_t totin, totout; /* our own total counters to avoid 4GB limit */ off_t last; /* totout value of last access point */ - struct access *index; /* access points being generated */ + struct deflate_index *index; /* access points being generated */ z_stream strm; unsigned char input[CHUNK]; unsigned char window[WINSIZE]; @@ -163,7 +155,7 @@ local int build_index(FILE *in, off_t span, struct access **built) /* inflate the input, maintain a sliding window, and build an index -- this also validates the integrity of the compressed data using the check - information at the end of the gzip or zlib stream */ + information in the gzip or zlib stream */ totin = totout = last = 0; index = NULL; /* will be allocated by first addpoint() */ strm.avail_out = 0; @@ -172,14 +164,19 @@ local int build_index(FILE *in, off_t span, struct access **built) strm.avail_in = fread(input, 1, CHUNK, in); if (ferror(in)) { ret = Z_ERRNO; - goto build_index_error; + goto deflate_index_build_error; } if (strm.avail_in == 0) { ret = Z_DATA_ERROR; - goto build_index_error; + goto deflate_index_build_error; } strm.next_in = input; + /* check for a gzip stream */ + if (totin == 0 && strm.avail_in >= 3 && + input[0] == 31 && input[1] == 139 && input[2] == 8) + gzip = 1; + /* process all of that, or until end of stream */ do { /* reset sliding window if necessary */ @@ -198,9 +195,17 @@ local int build_index(FILE *in, off_t span, struct access **built) if (ret == Z_NEED_DICT) ret = Z_DATA_ERROR; if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR) - goto build_index_error; - if (ret == Z_STREAM_END) + goto deflate_index_build_error; + if (ret == Z_STREAM_END) { + if (gzip && + (strm.avail_in || ungetc(getc(in), in) != EOF)) { + ret = inflateReset(&strm); + if (ret != Z_OK) + goto deflate_index_build_error; + continue; + } break; + } /* if at end of block, consider adding an index entry (note that if data_type indicates an end-of-block, then all of the @@ -217,7 +222,7 @@ local int build_index(FILE *in, off_t span, struct access **built) totout, strm.avail_out, window); if (index == NULL) { ret = Z_MEM_ERROR; - goto build_index_error; + goto deflate_index_build_error; } last = totout; } @@ -227,27 +232,21 @@ local int build_index(FILE *in, off_t span, struct access **built) /* clean up and return index (release unused entries in list) */ (void)inflateEnd(&strm); index->list = realloc(index->list, sizeof(struct point) * index->have); - index->size = index->have; + index->gzip = gzip; + index->length = totout; *built = index; - return index->size; + return index->have; /* return error */ - build_index_error: + deflate_index_build_error: (void)inflateEnd(&strm); - if (index != NULL) - free_index(index); + deflate_index_free(index); return ret; } -/* Use the index to read len bytes from offset into buf, return bytes read or - negative for error (Z_DATA_ERROR or Z_MEM_ERROR). If data is requested past - the end of the uncompressed data, then extract() will return a value less - than len, indicating how much as actually read into buf. This function - should not return a data error unless the file was modified since the index - was generated. extract() may also return Z_ERRNO if there is an error on - reading or seeking the input file. */ -local int extract(FILE *in, struct access *index, off_t offset, - unsigned char *buf, int len) +/* See comments in zran.h. */ +int deflate_index_extract(FILE *in, struct deflate_index *index, off_t offset, + unsigned char *buf, int len) { int ret, skip; z_stream strm; @@ -276,12 +275,12 @@ local int extract(FILE *in, struct access *index, off_t offset, return ret; ret = fseeko(in, here->in - (here->bits ? 1 : 0), SEEK_SET); if (ret == -1) - goto extract_ret; + goto deflate_index_extract_ret; if (here->bits) { ret = getc(in); if (ret == -1) { ret = ferror(in) ? Z_ERRNO : Z_DATA_ERROR; - goto extract_ret; + goto deflate_index_extract_ret; } (void)inflatePrime(&strm, here->bits, ret >> (8 - here->bits)); } @@ -293,21 +292,21 @@ local int extract(FILE *in, struct access *index, off_t offset, skip = 1; /* while skipping to offset */ do { /* define where to put uncompressed data, and how much */ - if (offset == 0 && skip) { /* at offset now */ - strm.avail_out = len; - strm.next_out = buf; - skip = 0; /* only do this once */ - } if (offset > WINSIZE) { /* skip WINSIZE bytes */ strm.avail_out = WINSIZE; strm.next_out = discard; offset -= WINSIZE; } - else if (offset != 0) { /* last skip */ + else if (offset > 0) { /* last skip */ strm.avail_out = (unsigned)offset; strm.next_out = discard; offset = 0; } + else if (skip) { /* at offset now */ + strm.avail_out = len; + strm.next_out = buf; + skip = 0; /* only do this once */ + } /* uncompress until avail_out filled, or end of stream */ do { @@ -315,11 +314,11 @@ local int extract(FILE *in, struct access *index, off_t offset, strm.avail_in = fread(input, 1, CHUNK, in); if (ferror(in)) { ret = Z_ERRNO; - goto extract_ret; + goto deflate_index_extract_ret; } if (strm.avail_in == 0) { ret = Z_DATA_ERROR; - goto extract_ret; + goto deflate_index_extract_ret; } strm.next_in = input; } @@ -327,41 +326,99 @@ local int extract(FILE *in, struct access *index, off_t offset, if (ret == Z_NEED_DICT) ret = Z_DATA_ERROR; if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR) - goto extract_ret; - if (ret == Z_STREAM_END) - break; + goto deflate_index_extract_ret; + if (ret == Z_STREAM_END) { + /* the raw deflate stream has ended */ + if (index->gzip == 0) + /* this is a zlib stream that has ended -- done */ + break; + + /* near the end of a gzip member, which might be followed by + another gzip member -- skip the gzip trailer and see if + there is more input after it */ + if (strm.avail_in < 8) { + fseeko(in, 8 - strm.avail_in, SEEK_CUR); + strm.avail_in = 0; + } + else { + strm.avail_in -= 8; + strm.next_in += 8; + } + if (strm.avail_in == 0 && ungetc(getc(in), in) == EOF) + /* the input ended after the gzip trailer -- done */ + break; + + /* there is more input, so another gzip member should follow -- + validate and skip the gzip header */ + ret = inflateReset2(&strm, 31); + if (ret != Z_OK) + goto deflate_index_extract_ret; + do { + if (strm.avail_in == 0) { + strm.avail_in = fread(input, 1, CHUNK, in); + if (ferror(in)) { + ret = Z_ERRNO; + goto deflate_index_extract_ret; + } + if (strm.avail_in == 0) { + ret = Z_DATA_ERROR; + goto deflate_index_extract_ret; + } + strm.next_in = input; + } + ret = inflate(&strm, Z_BLOCK); + if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR) + goto deflate_index_extract_ret; + } while ((strm.data_type & 128) == 0); + + /* set up to continue decompression of the raw deflate stream + that follows the gzip header */ + ret = inflateReset2(&strm, -15); + if (ret != Z_OK) + goto deflate_index_extract_ret; + } + + /* continue to process the available input before reading more */ } while (strm.avail_out != 0); - /* if reach end of stream, then don't keep trying to get more */ if (ret == Z_STREAM_END) + /* reached the end of the compressed data -- return the data that + was available, possibly less than requested */ break; - /* do until offset reached and requested data read, or stream ends */ + /* do until offset reached and requested data read */ } while (skip); - /* compute number of uncompressed bytes read after offset */ + /* compute the number of uncompressed bytes read after the offset */ ret = skip ? 0 : len - strm.avail_out; - /* clean up and return bytes read or error */ - extract_ret: + /* clean up and return the bytes read, or the negative error */ + deflate_index_extract_ret: (void)inflateEnd(&strm); return ret; } -/* Demonstrate the use of build_index() and extract() by processing the file - provided on the command line, and the extracting 16K from about 2/3rds of - the way through the uncompressed output, and writing that to stdout. */ +#ifdef TEST + +#define SPAN 1048576L /* desired distance between access points */ +#define LEN 16384 /* number of bytes to extract */ + +/* Demonstrate the use of deflate_index_build() and deflate_index_extract() by + processing the file provided on the command line, and extracting LEN bytes + from 2/3rds of the way through the uncompressed output, writing that to + stdout. An offset can be provided as the second argument, in which case the + data is extracted from there instead. */ int main(int argc, char **argv) { int len; - off_t offset; + off_t offset = -1; FILE *in; - struct access *index = NULL; - unsigned char buf[CHUNK]; + struct deflate_index *index = NULL; + unsigned char buf[LEN]; /* open input file */ - if (argc != 2) { - fprintf(stderr, "usage: zran file.gz\n"); + if (argc < 2 || argc > 3) { + fprintf(stderr, "usage: zran file.gz [offset]\n"); return 1; } in = fopen(argv[1], "rb"); @@ -370,8 +427,18 @@ int main(int argc, char **argv) return 1; } + /* get optional offset */ + if (argc == 3) { + char *end; + offset = strtoll(argv[2], &end, 10); + if (*end || offset < 0) { + fprintf(stderr, "zran: %s is not a valid offset\n", argv[2]); + return 1; + } + } + /* build index */ - len = build_index(in, SPAN, &index); + len = deflate_index_build(in, SPAN, &index); if (len < 0) { fclose(in); switch (len) { @@ -392,8 +459,9 @@ int main(int argc, char **argv) fprintf(stderr, "zran: built index with %d access points\n", len); /* use index by reading some bytes from an arbitrary offset */ - offset = (index->list[index->have - 1].out << 1) / 3; - len = extract(in, index, offset, buf, CHUNK); + if (offset == -1) + offset = (index->length << 1) / 3; + len = deflate_index_extract(in, index, offset, buf, LEN); if (len < 0) fprintf(stderr, "zran: extraction failed: %s error\n", len == Z_MEM_ERROR ? "out of memory" : "input corrupted"); @@ -403,7 +471,9 @@ int main(int argc, char **argv) } /* clean up and exit */ - free_index(index); + deflate_index_free(index); fclose(in); return 0; } + +#endif diff --git a/src/dependencies/zlib-1.2.13/examples/zran.h b/src/dependencies/zlib-1.2.13/examples/zran.h new file mode 100644 index 0000000..2314125 --- /dev/null +++ b/src/dependencies/zlib-1.2.13/examples/zran.h @@ -0,0 +1,40 @@ +/* zran.h -- example of zlib/gzip stream indexing and random access + * Copyright (C) 2005, 2012, 2018 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * Version 1.2 14 Oct 2018 Mark Adler */ + +#include +#include "zlib.h" + +/* Access point list. */ +struct deflate_index { + int have; /* number of list entries */ + int gzip; /* 1 if the index is of a gzip file, 0 if it is of a + zlib stream */ + off_t length; /* total length of uncompressed data */ + void *list; /* allocated list of entries */ +}; + +/* Make one entire pass through a zlib or gzip compressed stream and build an + index, with access points about every span bytes of uncompressed output. + gzip files with multiple members are indexed in their entirety. span should + be chosen to balance the speed of random access against the memory + requirements of the list, about 32K bytes per access point. The return value + is the number of access points on success (>= 1), Z_MEM_ERROR for out of + memory, Z_DATA_ERROR for an error in the input file, or Z_ERRNO for a file + read error. On success, *built points to the resulting index. */ +int deflate_index_build(FILE *in, off_t span, struct deflate_index **built); + +/* Deallocate an index built by deflate_index_build() */ +void deflate_index_free(struct deflate_index *index); + +/* Use the index to read len bytes from offset into buf. Return bytes read or + negative for error (Z_DATA_ERROR or Z_MEM_ERROR). If data is requested past + the end of the uncompressed data, then deflate_index_extract() will return a + value less than len, indicating how much was actually read into buf. This + function should not return a data error unless the file was modified since + the index was generated, since deflate_index_build() validated all of the + input. deflate_index_extract() will return Z_ERRNO if there is an error on + reading or seeking the input file. */ +int deflate_index_extract(FILE *in, struct deflate_index *index, off_t offset, + unsigned char *buf, int len); diff --git a/src/dependencies/zlib-1.2.11/gzclose.c b/src/dependencies/zlib-1.2.13/gzclose.c similarity index 100% rename from src/dependencies/zlib-1.2.11/gzclose.c rename to src/dependencies/zlib-1.2.13/gzclose.c diff --git a/src/dependencies/zlib-1.2.11/gzguts.h b/src/dependencies/zlib-1.2.13/gzguts.h similarity index 98% rename from src/dependencies/zlib-1.2.11/gzguts.h rename to src/dependencies/zlib-1.2.13/gzguts.h index 990a4d2..57faf37 100644 --- a/src/dependencies/zlib-1.2.11/gzguts.h +++ b/src/dependencies/zlib-1.2.13/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler + * Copyright (C) 2004-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -39,7 +39,7 @@ # include #endif -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) # define WIDECHAR #endif @@ -190,6 +190,7 @@ typedef struct { /* just for writing */ int level; /* compression level */ int strategy; /* compression strategy */ + int reset; /* true if a reset is pending after a Z_FINISH */ /* seek request */ z_off64_t skip; /* amount to skip (already rewound if backwards) */ int seek; /* true if seek request pending */ diff --git a/src/dependencies/zlib-1.2.11/gzlib.c b/src/dependencies/zlib-1.2.13/gzlib.c similarity index 98% rename from src/dependencies/zlib-1.2.11/gzlib.c rename to src/dependencies/zlib-1.2.13/gzlib.c index 4105e6a..55da46a 100644 --- a/src/dependencies/zlib-1.2.11/gzlib.c +++ b/src/dependencies/zlib-1.2.13/gzlib.c @@ -1,11 +1,11 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2017 Mark Adler + * Copyright (C) 2004-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" -#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__) +#if defined(_WIN32) && !defined(__BORLANDC__) # define LSEEK _lseeki64 #else #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 @@ -30,7 +30,7 @@ local gzFile gz_open OF((const void *, int, const char *)); The gz_strwinerror function does not change the current setting of GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) +char ZLIB_INTERNAL *gz_strwinerror(error) DWORD error; { static char buf[1024]; @@ -81,6 +81,8 @@ local void gz_reset(state) state->past = 0; /* have not read past end yet */ state->how = LOOK; /* look for gzip header */ } + else /* for writing ... */ + state->reset = 0; /* no deflateReset pending */ state->seek = 0; /* no seek request pending */ gz_error(state, Z_OK, NULL); /* clear error */ state->x.pos = 0; /* no uncompressed data yet */ @@ -397,7 +399,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) /* if within raw area while reading, just go there */ if (state->mode == GZ_READ && state->how == COPY && state->x.pos + offset >= 0) { - ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); + ret = LSEEK(state->fd, offset - (z_off64_t)state->x.have, SEEK_CUR); if (ret == -1) return -1; state->x.have = 0; diff --git a/src/dependencies/zlib-1.2.11/gzread.c b/src/dependencies/zlib-1.2.13/gzread.c similarity index 98% rename from src/dependencies/zlib-1.2.11/gzread.c rename to src/dependencies/zlib-1.2.13/gzread.c index 956b91e..dd77381 100644 --- a/src/dependencies/zlib-1.2.11/gzread.c +++ b/src/dependencies/zlib-1.2.13/gzread.c @@ -1,5 +1,5 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler + * Copyright (C) 2004-2017 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -157,11 +157,9 @@ local int gz_look(state) the output buffer is larger than the input buffer, which also assures space for gzungetc() */ state->x.next = state->out; - if (strm->avail_in) { - memcpy(state->x.next, strm->next_in, strm->avail_in); - state->x.have = strm->avail_in; - strm->avail_in = 0; - } + memcpy(state->x.next, strm->next_in, strm->avail_in); + state->x.have = strm->avail_in; + strm->avail_in = 0; state->how = COPY; state->direct = 1; return 0; @@ -314,9 +312,9 @@ local z_size_t gz_read(state, buf, len) got = 0; do { /* set n to the maximum amount of len that fits in an unsigned int */ - n = -1; + n = (unsigned)-1; if (n > len) - n = len; + n = (unsigned)len; /* first just try copying data from the output buffer */ if (state->x.have) { @@ -397,7 +395,7 @@ int ZEXPORT gzread(file, buf, len) } /* read len or fewer bytes to buf */ - len = gz_read(state, buf, len); + len = (unsigned)gz_read(state, buf, len); /* check for an error */ if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR) @@ -447,7 +445,6 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file) int ZEXPORT gzgetc(file) gzFile file; { - int ret; unsigned char buf[1]; gz_statep state; @@ -469,8 +466,7 @@ int ZEXPORT gzgetc(file) } /* nothing there -- try gz_read() */ - ret = gz_read(state, buf, 1); - return ret < 1 ? -1 : buf[0]; + return gz_read(state, buf, 1) < 1 ? -1 : buf[0]; } int ZEXPORT gzgetc_(file) diff --git a/src/dependencies/zlib-1.2.11/gzwrite.c b/src/dependencies/zlib-1.2.13/gzwrite.c similarity index 95% rename from src/dependencies/zlib-1.2.11/gzwrite.c rename to src/dependencies/zlib-1.2.13/gzwrite.c index c7b5651..eb8a0e5 100644 --- a/src/dependencies/zlib-1.2.11/gzwrite.c +++ b/src/dependencies/zlib-1.2.13/gzwrite.c @@ -1,5 +1,5 @@ /* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004-2017 Mark Adler + * Copyright (C) 2004-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -97,6 +97,15 @@ local int gz_comp(state, flush) return 0; } + /* check for a pending reset */ + if (state->reset) { + /* don't start a new gzip member unless there is data to write */ + if (strm->avail_in == 0) + return 0; + deflateReset(strm); + state->reset = 0; + } + /* run deflate() on provided input until it produces no more output */ ret = Z_OK; do { @@ -134,7 +143,7 @@ local int gz_comp(state, flush) /* if that completed a deflate stream, allow another to start */ if (flush == Z_FINISH) - deflateReset(strm); + state->reset = 1; /* all done, no errors */ return 0; @@ -209,7 +218,7 @@ local z_size_t gz_write(state, buf, len) state->in); copy = state->size - have; if (copy > len) - copy = len; + copy = (unsigned)len; memcpy(state->in + have, buf, copy); state->strm.avail_in += copy; state->x.pos += copy; @@ -229,7 +238,7 @@ local z_size_t gz_write(state, buf, len) do { unsigned n = (unsigned)-1; if (n > len) - n = len; + n = (unsigned)len; state->strm.avail_in = n; state->x.pos += n; if (gz_comp(state, Z_NO_FLUSH) == -1) @@ -349,12 +358,11 @@ int ZEXPORT gzputc(file, c) } /* -- see zlib.h -- */ -int ZEXPORT gzputs(file, str) +int ZEXPORT gzputs(file, s) gzFile file; - const char *str; + const char *s; { - int ret; - z_size_t len; + z_size_t len, put; gz_statep state; /* get internal structure */ @@ -367,9 +375,13 @@ int ZEXPORT gzputs(file, str) return -1; /* write string */ - len = strlen(str); - ret = gz_write(state, str, len); - return ret == 0 && len != 0 ? -1 : ret; + len = strlen(s); + if ((int)len < 0 || (unsigned)len != len) { + gz_error(state, Z_STREAM_ERROR, "string length does not fit in int"); + return -1; + } + put = gz_write(state, s, len); + return put < len ? -1 : (int)len; } #if defined(STDC) || defined(Z_HAVE_STDARG_H) @@ -441,7 +453,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) strm->avail_in = state->size; if (gz_comp(state, Z_NO_FLUSH) == -1) return state->err; - memcpy(state->in, state->in + state->size, left); + memmove(state->in, state->in + state->size, left); strm->next_in = state->in; strm->avail_in = left; } @@ -462,7 +474,7 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, +int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) gzFile file; const char *format; @@ -540,7 +552,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, strm->avail_in = state->size; if (gz_comp(state, Z_NO_FLUSH) == -1) return state->err; - memcpy(state->in, state->in + state->size, left); + memmove(state->in, state->in + state->size, left); strm->next_in = state->in; strm->avail_in = left; } diff --git a/src/dependencies/zlib-1.2.11/infback.c b/src/dependencies/zlib-1.2.13/infback.c similarity index 98% rename from src/dependencies/zlib-1.2.11/infback.c rename to src/dependencies/zlib-1.2.13/infback.c index 59679ec..babeaf1 100644 --- a/src/dependencies/zlib-1.2.11/infback.c +++ b/src/dependencies/zlib-1.2.13/infback.c @@ -1,5 +1,5 @@ /* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -66,6 +66,7 @@ int stream_size; state->window = window; state->wnext = 0; state->whave = 0; + state->sane = 1; return Z_OK; } @@ -477,6 +478,7 @@ void FAR *out_desc; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; + /* fallthrough */ case LEN: /* use inflate_fast() if we have enough input and output */ @@ -604,25 +606,27 @@ void FAR *out_desc; break; case DONE: - /* inflate stream terminated properly -- write leftover output */ + /* inflate stream terminated properly */ ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; - default: /* can't happen, but makes compilers happy */ + default: + /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } - /* Return unused input */ + /* Write leftover output and return unused input */ inf_leave: + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left) && + ret == Z_STREAM_END) + ret = Z_BUF_ERROR; + } strm->next_in = next; strm->avail_in = have; return ret; diff --git a/src/dependencies/zlib-1.2.11/inffast.c b/src/dependencies/zlib-1.2.13/inffast.c similarity index 94% rename from src/dependencies/zlib-1.2.11/inffast.c rename to src/dependencies/zlib-1.2.13/inffast.c index 0dbd1db..1fec7f3 100644 --- a/src/dependencies/zlib-1.2.11/inffast.c +++ b/src/dependencies/zlib-1.2.13/inffast.c @@ -70,7 +70,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ code const FAR *dcode; /* local strm->distcode */ unsigned lmask; /* mask for first level of length codes */ unsigned dmask; /* mask for first level of distance codes */ - code here; /* retrieved table entry */ + code const *here; /* retrieved table entry */ unsigned op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ unsigned len; /* match length, unused bytes */ @@ -107,20 +107,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ hold += (unsigned long)(*in++) << bits; bits += 8; } - here = lcode[hold & lmask]; + here = lcode + (hold & lmask); dolen: - op = (unsigned)(here.bits); + op = (unsigned)(here->bits); hold >>= op; bits -= op; - op = (unsigned)(here.op); + op = (unsigned)(here->op); if (op == 0) { /* literal */ - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ? "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - *out++ = (unsigned char)(here.val); + "inflate: literal 0x%02x\n", here->val)); + *out++ = (unsigned char)(here->val); } else if (op & 16) { /* length base */ - len = (unsigned)(here.val); + len = (unsigned)(here->val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { @@ -138,14 +138,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ hold += (unsigned long)(*in++) << bits; bits += 8; } - here = dcode[hold & dmask]; + here = dcode + (hold & dmask); dodist: - op = (unsigned)(here.bits); + op = (unsigned)(here->bits); hold >>= op; bits -= op; - op = (unsigned)(here.op); + op = (unsigned)(here->op); if (op & 16) { /* distance base */ - dist = (unsigned)(here.val); + dist = (unsigned)(here->val); op &= 15; /* number of extra bits */ if (bits < op) { hold += (unsigned long)(*in++) << bits; @@ -264,7 +264,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } } else if ((op & 64) == 0) { /* 2nd level distance code */ - here = dcode[here.val + (hold & ((1U << op) - 1))]; + here = dcode + here->val + (hold & ((1U << op) - 1)); goto dodist; } else { @@ -274,7 +274,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ } } else if ((op & 64) == 0) { /* 2nd level length code */ - here = lcode[here.val + (hold & ((1U << op) - 1))]; + here = lcode + here->val + (hold & ((1U << op) - 1)); goto dolen; } else if (op & 32) { /* end-of-block */ diff --git a/src/dependencies/zlib-1.2.11/inffast.h b/src/dependencies/zlib-1.2.13/inffast.h similarity index 100% rename from src/dependencies/zlib-1.2.11/inffast.h rename to src/dependencies/zlib-1.2.13/inffast.h diff --git a/src/dependencies/zlib-1.2.11/inffixed.h b/src/dependencies/zlib-1.2.13/inffixed.h similarity index 100% rename from src/dependencies/zlib-1.2.11/inffixed.h rename to src/dependencies/zlib-1.2.13/inffixed.h diff --git a/src/dependencies/zlib-1.2.11/inflate.c b/src/dependencies/zlib-1.2.13/inflate.c similarity index 96% rename from src/dependencies/zlib-1.2.11/inflate.c rename to src/dependencies/zlib-1.2.13/inflate.c index ac333e8..8acbef4 100644 --- a/src/dependencies/zlib-1.2.11/inflate.c +++ b/src/dependencies/zlib-1.2.13/inflate.c @@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -130,6 +130,7 @@ z_streamp strm; state->mode = HEAD; state->last = 0; state->havedict = 0; + state->flags = -1; state->dmax = 32768U; state->head = Z_NULL; state->hold = 0; @@ -167,6 +168,8 @@ int windowBits; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { + if (windowBits < -15) + return Z_STREAM_ERROR; wrap = 0; windowBits = -windowBits; } @@ -447,10 +450,10 @@ unsigned copy; /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP -# define UPDATE(check, buf, len) \ +# define UPDATE_CHECK(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else -# define UPDATE(check, buf, len) adler32(check, buf, len) +# define UPDATE_CHECK(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ @@ -670,7 +673,6 @@ int flush; state->mode = FLAGS; break; } - state->flags = 0; /* expect zlib header */ if (state->head != Z_NULL) state->head->done = -1; if (!(state->wrap & 1) || /* check if zlib header allowed */ @@ -697,6 +699,7 @@ int flush; break; } state->dmax = 1U << len; + state->flags = 0; /* indicate zlib header */ Tracev((stderr, "inflate: zlib header ok\n")); strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = hold & 0x200 ? DICTID : TYPE; @@ -722,6 +725,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = TIME; + /* fallthrough */ case TIME: NEEDBITS(32); if (state->head != Z_NULL) @@ -730,6 +734,7 @@ int flush; CRC4(state->check, hold); INITBITS(); state->mode = OS; + /* fallthrough */ case OS: NEEDBITS(16); if (state->head != Z_NULL) { @@ -740,6 +745,7 @@ int flush; CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; + /* fallthrough */ case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); @@ -753,14 +759,16 @@ int flush; else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; + /* fallthrough */ case EXTRA: if (state->flags & 0x0400) { copy = state->length; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; + state->head->extra != Z_NULL && + (len = state->head->extra_len - state->length) < + state->head->extra_max) { zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); @@ -775,6 +783,7 @@ int flush; } state->length = 0; state->mode = NAME; + /* fallthrough */ case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; @@ -796,6 +805,7 @@ int flush; state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; + /* fallthrough */ case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; @@ -816,6 +826,7 @@ int flush; else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; + /* fallthrough */ case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); @@ -839,6 +850,7 @@ int flush; strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; + /* fallthrough */ case DICT: if (state->havedict == 0) { RESTORE(); @@ -846,8 +858,10 @@ int flush; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; + /* fallthrough */ case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; + /* fallthrough */ case TYPEDO: if (state->last) { BYTEBITS(); @@ -898,8 +912,10 @@ int flush; INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case COPY_: state->mode = COPY; + /* fallthrough */ case COPY: copy = state->length; if (copy) { @@ -935,6 +951,7 @@ int flush; Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; + /* fallthrough */ case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); @@ -956,6 +973,7 @@ int flush; Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; + /* fallthrough */ case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { @@ -1039,8 +1057,10 @@ int flush; Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; + /* fallthrough */ case LEN_: state->mode = LEN; + /* fallthrough */ case LEN: if (have >= 6 && left >= 258) { RESTORE(); @@ -1090,6 +1110,7 @@ int flush; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; + /* fallthrough */ case LENEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1100,6 +1121,7 @@ int flush; Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; + /* fallthrough */ case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; @@ -1127,6 +1149,7 @@ int flush; state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; + /* fallthrough */ case DISTEXT: if (state->extra) { NEEDBITS(state->extra); @@ -1143,6 +1166,7 @@ int flush; #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; + /* fallthrough */ case MATCH: if (left == 0) goto inf_leave; copy = out - left; @@ -1202,7 +1226,7 @@ int flush; state->total += out; if ((state->wrap & 4) && out) strm->adler = state->check = - UPDATE(state->check, put - out, out); + UPDATE_CHECK(state->check, put - out, out); out = left; if ((state->wrap & 4) && ( #ifdef GUNZIP @@ -1218,10 +1242,11 @@ int flush; } #ifdef GUNZIP state->mode = LENGTH; + /* fallthrough */ case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { + if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { strm->msg = (char *)"incorrect length check"; state->mode = BAD; break; @@ -1231,6 +1256,7 @@ int flush; } #endif state->mode = DONE; + /* fallthrough */ case DONE: ret = Z_STREAM_END; goto inf_leave; @@ -1240,6 +1266,7 @@ int flush; case MEM: return Z_MEM_ERROR; case SYNC: + /* fallthrough */ default: return Z_STREAM_ERROR; } @@ -1265,7 +1292,7 @@ int flush; state->total += out; if ((state->wrap & 4) && out) strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); + UPDATE_CHECK(state->check, strm->next_out - out, out); strm->data_type = (int)state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); @@ -1401,6 +1428,7 @@ int ZEXPORT inflateSync(strm) z_streamp strm; { unsigned len; /* number of bytes to look at or looked at */ + int flags; /* temporary to save header status */ unsigned long in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; @@ -1433,9 +1461,15 @@ z_streamp strm; /* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; + if (state->flags == -1) + state->wrap = 0; /* if no header yet, treat as raw */ + else + state->wrap &= ~4; /* no point in computing a check value now */ + flags = state->flags; in = strm->total_in; out = strm->total_out; inflateReset(strm); strm->total_in = in; strm->total_out = out; + state->flags = flags; state->mode = TYPE; return Z_OK; } @@ -1531,7 +1565,7 @@ int check; if (inflateStateCheck(strm)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; - if (check) + if (check && state->wrap) state->wrap |= 4; else state->wrap &= ~4; diff --git a/src/dependencies/zlib-1.2.11/inflate.h b/src/dependencies/zlib-1.2.13/inflate.h similarity index 97% rename from src/dependencies/zlib-1.2.11/inflate.h rename to src/dependencies/zlib-1.2.13/inflate.h index a46cce6..f127b6b 100644 --- a/src/dependencies/zlib-1.2.11/inflate.h +++ b/src/dependencies/zlib-1.2.13/inflate.h @@ -1,5 +1,5 @@ /* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2016 Mark Adler + * Copyright (C) 1995-2019 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -86,7 +86,8 @@ struct inflate_state { int wrap; /* bit 0 true for zlib, bit 1 true for gzip, bit 2 true to validate check value */ int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ + int flags; /* gzip header method and flags, 0 if zlib, or + -1 if raw or no header yet */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ unsigned long check; /* protected copy of check value */ unsigned long total; /* protected copy of output count */ diff --git a/src/dependencies/zlib-1.2.11/inftrees.c b/src/dependencies/zlib-1.2.13/inftrees.c similarity index 98% rename from src/dependencies/zlib-1.2.11/inftrees.c rename to src/dependencies/zlib-1.2.13/inftrees.c index 2ea08fc..57d2793 100644 --- a/src/dependencies/zlib-1.2.11/inftrees.c +++ b/src/dependencies/zlib-1.2.13/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2017 Mark Adler + * Copyright (C) 1995-2022 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.11 Copyright 1995-2017 Mark Adler "; + " inflate 1.2.13 Copyright 1995-2022 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, diff --git a/src/dependencies/zlib-1.2.11/inftrees.h b/src/dependencies/zlib-1.2.13/inftrees.h similarity index 97% rename from src/dependencies/zlib-1.2.11/inftrees.h rename to src/dependencies/zlib-1.2.13/inftrees.h index baa53a0..f536653 100644 --- a/src/dependencies/zlib-1.2.11/inftrees.h +++ b/src/dependencies/zlib-1.2.13/inftrees.h @@ -38,7 +38,7 @@ typedef struct { /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that + examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes returns returns 852, and "enough 30 6 15" for distance codes returns 592. diff --git a/src/dependencies/zlib-1.2.11/make_vms.com b/src/dependencies/zlib-1.2.13/make_vms.com similarity index 99% rename from src/dependencies/zlib-1.2.11/make_vms.com rename to src/dependencies/zlib-1.2.13/make_vms.com index 65e9d0c..4dc8a89 100644 --- a/src/dependencies/zlib-1.2.11/make_vms.com +++ b/src/dependencies/zlib-1.2.13/make_vms.com @@ -14,9 +14,9 @@ $! 0.02 20061008 Adapt to new Makefile.in $! 0.03 20091224 Add support for large file check $! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite $! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in -$! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new exmples +$! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new examples $! subdir path, update module search in makefile.in -$! 0.07 20120115 Triggered by work done by Alexey Chupahin completly redesigned +$! 0.07 20120115 Triggered by work done by Alexey Chupahin completely redesigned $! shared image creation $! 0.08 20120219 Make it work on VAX again, pre-load missing symbols to shared $! image diff --git a/src/dependencies/zlib-1.2.11/msdos/Makefile.bor b/src/dependencies/zlib-1.2.13/msdos/Makefile.bor similarity index 100% rename from src/dependencies/zlib-1.2.11/msdos/Makefile.bor rename to src/dependencies/zlib-1.2.13/msdos/Makefile.bor diff --git a/src/dependencies/zlib-1.2.11/msdos/Makefile.dj2 b/src/dependencies/zlib-1.2.13/msdos/Makefile.dj2 similarity index 100% rename from src/dependencies/zlib-1.2.11/msdos/Makefile.dj2 rename to src/dependencies/zlib-1.2.13/msdos/Makefile.dj2 diff --git a/src/dependencies/zlib-1.2.11/msdos/Makefile.emx b/src/dependencies/zlib-1.2.13/msdos/Makefile.emx similarity index 100% rename from src/dependencies/zlib-1.2.11/msdos/Makefile.emx rename to src/dependencies/zlib-1.2.13/msdos/Makefile.emx diff --git a/src/dependencies/zlib-1.2.11/msdos/Makefile.msc b/src/dependencies/zlib-1.2.13/msdos/Makefile.msc similarity index 100% rename from src/dependencies/zlib-1.2.11/msdos/Makefile.msc rename to src/dependencies/zlib-1.2.13/msdos/Makefile.msc diff --git a/src/dependencies/zlib-1.2.11/msdos/Makefile.tc b/src/dependencies/zlib-1.2.13/msdos/Makefile.tc similarity index 100% rename from src/dependencies/zlib-1.2.11/msdos/Makefile.tc rename to src/dependencies/zlib-1.2.13/msdos/Makefile.tc diff --git a/src/dependencies/zlib-1.2.11/nintendods/Makefile b/src/dependencies/zlib-1.2.13/nintendods/Makefile similarity index 100% rename from src/dependencies/zlib-1.2.11/nintendods/Makefile rename to src/dependencies/zlib-1.2.13/nintendods/Makefile diff --git a/src/dependencies/zlib-1.2.11/nintendods/README b/src/dependencies/zlib-1.2.13/nintendods/README similarity index 100% rename from src/dependencies/zlib-1.2.11/nintendods/README rename to src/dependencies/zlib-1.2.13/nintendods/README diff --git a/src/dependencies/zlib-1.2.11/old/Makefile.emx b/src/dependencies/zlib-1.2.13/old/Makefile.emx similarity index 100% rename from src/dependencies/zlib-1.2.11/old/Makefile.emx rename to src/dependencies/zlib-1.2.13/old/Makefile.emx diff --git a/src/dependencies/zlib-1.2.11/old/Makefile.riscos b/src/dependencies/zlib-1.2.13/old/Makefile.riscos similarity index 100% rename from src/dependencies/zlib-1.2.11/old/Makefile.riscos rename to src/dependencies/zlib-1.2.13/old/Makefile.riscos diff --git a/src/dependencies/zlib-1.2.11/old/README b/src/dependencies/zlib-1.2.13/old/README similarity index 100% rename from src/dependencies/zlib-1.2.11/old/README rename to src/dependencies/zlib-1.2.13/old/README diff --git a/src/dependencies/zlib-1.2.11/old/descrip.mms b/src/dependencies/zlib-1.2.13/old/descrip.mms similarity index 100% rename from src/dependencies/zlib-1.2.11/old/descrip.mms rename to src/dependencies/zlib-1.2.13/old/descrip.mms diff --git a/src/dependencies/zlib-1.2.11/old/os2/Makefile.os2 b/src/dependencies/zlib-1.2.13/old/os2/Makefile.os2 similarity index 100% rename from src/dependencies/zlib-1.2.11/old/os2/Makefile.os2 rename to src/dependencies/zlib-1.2.13/old/os2/Makefile.os2 diff --git a/src/dependencies/zlib-1.2.11/old/os2/zlib.def b/src/dependencies/zlib-1.2.13/old/os2/zlib.def similarity index 100% rename from src/dependencies/zlib-1.2.11/old/os2/zlib.def rename to src/dependencies/zlib-1.2.13/old/os2/zlib.def diff --git a/src/dependencies/zlib-1.2.11/old/visual-basic.txt b/src/dependencies/zlib-1.2.13/old/visual-basic.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/old/visual-basic.txt rename to src/dependencies/zlib-1.2.13/old/visual-basic.txt diff --git a/src/dependencies/zlib-1.2.11/os400/README400 b/src/dependencies/zlib-1.2.13/os400/README400 similarity index 92% rename from src/dependencies/zlib-1.2.11/os400/README400 rename to src/dependencies/zlib-1.2.13/os400/README400 index 4f98334..c06fa84 100644 --- a/src/dependencies/zlib-1.2.11/os400/README400 +++ b/src/dependencies/zlib-1.2.13/os400/README400 @@ -1,9 +1,9 @@ - ZLIB version 1.2.11 for OS/400 installation instructions + ZLIB version 1.2.13 for OS/400 installation instructions 1) Download and unpack the zlib tarball to some IFS directory. (i.e.: /path/to/the/zlib/ifs/source/directory) - If the installed IFS command suppors gzip format, this is straightforward, + If the installed IFS command supports gzip format, this is straightforward, else you have to unpack first to some directory on a system supporting it, then move the whole directory to the IFS via the network (via SMB or FTP). @@ -43,6 +43,6 @@ Notes: For OS/400 ILE RPG programmers, a /copy member defining the ZLIB Remember that most foreign textual data are ASCII coded: this implementation does not handle conversion from/to ASCII, so - text data code conversions must be done explicitely. + text data code conversions must be done explicitly. Mainly for the reason above, always open zipped files in binary mode. diff --git a/src/dependencies/zlib-1.2.11/os400/bndsrc b/src/dependencies/zlib-1.2.13/os400/bndsrc similarity index 92% rename from src/dependencies/zlib-1.2.11/os400/bndsrc rename to src/dependencies/zlib-1.2.13/os400/bndsrc index 5e6e0a2..9f92bb1 100644 --- a/src/dependencies/zlib-1.2.11/os400/bndsrc +++ b/src/dependencies/zlib-1.2.13/os400/bndsrc @@ -116,4 +116,12 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB') EXPORT SYMBOL("inflateValidate") EXPORT SYMBOL("uncompress2") +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ +/* Version 1.2.12 additional entry points. */ +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ + + EXPORT SYMBOL("crc32_combine_gen64") + EXPORT SYMBOL("crc32_combine_gen") + EXPORT SYMBOL("crc32_combine_op") + ENDPGMEXP diff --git a/src/dependencies/zlib-1.2.11/os400/make.sh b/src/dependencies/zlib-1.2.13/os400/make.sh similarity index 100% rename from src/dependencies/zlib-1.2.11/os400/make.sh rename to src/dependencies/zlib-1.2.13/os400/make.sh diff --git a/src/dependencies/zlib-1.2.11/os400/zlib.inc b/src/dependencies/zlib-1.2.13/os400/zlib.inc similarity index 99% rename from src/dependencies/zlib-1.2.11/os400/zlib.inc rename to src/dependencies/zlib-1.2.13/os400/zlib.inc index c6aca2c..c273c86 100644 --- a/src/dependencies/zlib-1.2.11/os400/zlib.inc +++ b/src/dependencies/zlib-1.2.13/os400/zlib.inc @@ -1,7 +1,7 @@ * ZLIB.INC - Interface to the general purpose compression library * * ILE RPG400 version by Patrick Monnerat, DATASPHERE. - * Version 1.2.11 + * Version 1.2.13 * * * WARNING: @@ -22,12 +22,12 @@ * * Versioning information. * - D ZLIB_VERSION C '1.2.11' + D ZLIB_VERSION C '1.2.13' D ZLIB_VERNUM C X'12a0' D ZLIB_VER_MAJOR C 1 D ZLIB_VER_MINOR C 2 D ZLIB_VER_REVISION... - D C 11 + D C 13 D ZLIB_VER_SUBREVISION... D C 0 * diff --git a/src/dependencies/zlib-1.2.11/qnx/package.qpg b/src/dependencies/zlib-1.2.13/qnx/package.qpg similarity index 95% rename from src/dependencies/zlib-1.2.11/qnx/package.qpg rename to src/dependencies/zlib-1.2.13/qnx/package.qpg index 31e8e90..ba2f1a2 100644 --- a/src/dependencies/zlib-1.2.11/qnx/package.qpg +++ b/src/dependencies/zlib-1.2.13/qnx/package.qpg @@ -25,10 +25,10 @@ - - - - + + + + @@ -63,7 +63,7 @@ - 1.2.11 + 1.2.13 Medium Stable diff --git a/src/dependencies/zlib-1.2.11/test/example.c b/src/dependencies/zlib-1.2.13/test/example.c similarity index 98% rename from src/dependencies/zlib-1.2.11/test/example.c rename to src/dependencies/zlib-1.2.13/test/example.c index eee17ce..1470bc8 100644 --- a/src/dependencies/zlib-1.2.11/test/example.c +++ b/src/dependencies/zlib-1.2.13/test/example.c @@ -440,9 +440,8 @@ void test_sync(compr, comprLen, uncompr, uncomprLen) CHECK_ERR(err, "inflateSync"); err = inflate(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ + if (err != Z_STREAM_END) { + fprintf(stderr, "inflate should report Z_STREAM_END\n"); exit(1); } err = inflateEnd(&d_stream); @@ -556,7 +555,8 @@ int main(argc, argv) exit(1); } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { - fprintf(stderr, "warning: different zlib version\n"); + fprintf(stderr, "warning: different zlib version linked: %s\n", + zlibVersion()); } printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", diff --git a/src/dependencies/zlib-1.2.11/test/infcover.c b/src/dependencies/zlib-1.2.13/test/infcover.c similarity index 100% rename from src/dependencies/zlib-1.2.11/test/infcover.c rename to src/dependencies/zlib-1.2.13/test/infcover.c diff --git a/src/dependencies/zlib-1.2.11/test/minigzip.c b/src/dependencies/zlib-1.2.13/test/minigzip.c similarity index 99% rename from src/dependencies/zlib-1.2.11/test/minigzip.c rename to src/dependencies/zlib-1.2.13/test/minigzip.c index e22fb08..a649d2b 100644 --- a/src/dependencies/zlib-1.2.11/test/minigzip.c +++ b/src/dependencies/zlib-1.2.13/test/minigzip.c @@ -500,7 +500,7 @@ void file_uncompress(file) char *infile, *outfile; FILE *out; gzFile in; - unsigned len = strlen(file); + z_size_t len = strlen(file); if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { fprintf(stderr, "%s: filename too long\n", prog); diff --git a/src/dependencies/zlib-1.2.11/treebuild.xml b/src/dependencies/zlib-1.2.13/treebuild.xml similarity index 96% rename from src/dependencies/zlib-1.2.11/treebuild.xml rename to src/dependencies/zlib-1.2.13/treebuild.xml index fd75525..0017a45 100644 --- a/src/dependencies/zlib-1.2.11/treebuild.xml +++ b/src/dependencies/zlib-1.2.13/treebuild.xml @@ -1,6 +1,6 @@ - - + + zip compression library diff --git a/src/dependencies/zlib-1.2.11/trees.c b/src/dependencies/zlib-1.2.13/trees.c similarity index 88% rename from src/dependencies/zlib-1.2.11/trees.c rename to src/dependencies/zlib-1.2.13/trees.c index 50cf4b4..5f305c4 100644 --- a/src/dependencies/zlib-1.2.11/trees.c +++ b/src/dependencies/zlib-1.2.13/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2017 Jean-loup Gailly + * Copyright (C) 1995-2021 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -149,7 +149,7 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, local void compress_block OF((deflate_state *s, const ct_data *ltree, const ct_data *dtree)); local int detect_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); +local unsigned bi_reverse OF((unsigned code, int len)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); @@ -193,7 +193,7 @@ local void send_bits(s, value, length) s->bits_sent += (ulg)length; /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * (16 - bi_valid) bits from value, leaving (width - (16 - bi_valid)) * unused bits in value. */ if (s->bi_valid > (int)Buf_size - length) { @@ -256,7 +256,7 @@ local void tr_static_init() length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { _dist_code[256 + dist++] = (uch)code; } } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); + Assert (dist == 256, "tr_static_init: 256 + dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; @@ -312,7 +312,7 @@ local void tr_static_init() } /* =========================================================================== - * Genererate the file trees.h describing the static trees. + * Generate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef ZLIB_DEBUG @@ -321,7 +321,7 @@ local void tr_static_init() # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) + ((i) % (width) == (width) - 1 ? ",\n" : ", ")) void gen_trees_header() { @@ -416,7 +416,7 @@ local void init_block(s) s->dyn_ltree[END_BLOCK].Freq = 1; s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; + s->sym_next = s->matches = 0; } #define SMALLEST 1 @@ -458,7 +458,7 @@ local void pqdownheap(s, tree, k) while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + smaller(tree, s->heap[j + 1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ @@ -507,7 +507,7 @@ local void gen_bitlen(s, desc) */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + for (h = s->heap_max + 1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; @@ -518,7 +518,7 @@ local void gen_bitlen(s, desc) s->bl_count[bits]++; xbits = 0; - if (n >= base) xbits = extra[n-base]; + if (n >= base) xbits = extra[n - base]; f = tree[n].Freq; s->opt_len += (ulg)f * (unsigned)(bits + xbits); if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); @@ -530,10 +530,10 @@ local void gen_bitlen(s, desc) /* Find the first bit length which could increase: */ do { - bits = max_length-1; + bits = max_length - 1; while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits + 1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] @@ -569,7 +569,7 @@ local void gen_bitlen(s, desc) * OUT assertion: the field code is set for all tree elements of non * zero code length. */ -local void gen_codes (tree, max_code, bl_count) +local void gen_codes(tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ @@ -583,13 +583,13 @@ local void gen_codes (tree, max_code, bl_count) * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits-1]) << 1; + code = (code + bl_count[bits - 1]) << 1; next_code[bits] = (ush)code; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ - Assert (code + bl_count[MAX_BITS]-1 == (1<heap_len = 0, s->heap_max = HEAP_SIZE; @@ -652,7 +652,7 @@ local void build_tree(s, desc) } desc->max_code = max_code; - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + /* The elements heap[heap_len/2 + 1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); @@ -700,7 +700,7 @@ local void build_tree(s, desc) * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ -local void scan_tree (s, tree, max_code) +local void scan_tree(s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ @@ -714,10 +714,10 @@ local void scan_tree (s, tree, max_code) int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ + tree[max_code + 1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { @@ -745,7 +745,7 @@ local void scan_tree (s, tree, max_code) * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ -local void send_tree (s, tree, max_code) +local void send_tree(s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ @@ -758,11 +758,11 @@ local void send_tree (s, tree, max_code) int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ - /* tree[max_code+1].Len = -1; */ /* guard already set */ + /* tree[max_code + 1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; + curlen = nextlen; nextlen = tree[n + 1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { @@ -773,13 +773,13 @@ local void send_tree (s, tree, max_code) send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count - 3, 2); } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count - 3, 3); } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count - 11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { @@ -807,8 +807,8 @@ local int build_bl_tree(s) /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + /* opt_len now includes the length of the tree representations, except the + * lengths of the bit lengths codes and the 5 + 5 + 4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format @@ -819,7 +819,7 @@ local int build_bl_tree(s) if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4; + s->opt_len += 3*((ulg)max_blindex + 1) + 5 + 5 + 4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); @@ -841,19 +841,19 @@ local void send_all_trees(s, lcodes, dcodes, blcodes) Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + send_tree(s, (ct_data *)s->dyn_ltree, lcodes - 1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + send_tree(s, (ct_data *)s->dyn_dtree, dcodes - 1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } @@ -866,17 +866,18 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ + send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */ bi_windup(s); /* align on byte boundary */ put_short(s, (ush)stored_len); put_short(s, (ush)~stored_len); - zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); + if (stored_len) + zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); s->pending += stored_len; #ifdef ZLIB_DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; s->bits_sent += 2*16; - s->bits_sent += stored_len<<3; + s->bits_sent += stored_len << 3; #endif } @@ -942,14 +943,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; + opt_lenb = (s->opt_len + 3 + 7) >> 3; + static_lenb = (s->static_len + 3 + 7) >> 3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); + s->sym_next / 3)); - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; +#ifndef FORCE_STATIC + if (static_lenb <= opt_lenb || s->strategy == Z_FIXED) +#endif + opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); @@ -959,7 +963,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { + if (stored_len + 4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. @@ -970,21 +974,17 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) */ _tr_stored_block(s, buf, stored_len, last); -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+last, 3); + } else if (static_lenb == opt_lenb) { + send_bits(s, (STATIC_TREES<<1) + last, 3); compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); #ifdef ZLIB_DEBUG s->compressed_len += 3 + s->static_len; #endif } else { - send_bits(s, (DYN_TREES<<1)+last, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); + send_bits(s, (DYN_TREES<<1) + last, 3); + send_all_trees(s, s->l_desc.max_code + 1, s->d_desc.max_code + 1, + max_blindex + 1); compress_block(s, (const ct_data *)s->dyn_ltree, (const ct_data *)s->dyn_dtree); #ifdef ZLIB_DEBUG @@ -1003,21 +1003,22 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) s->compressed_len += 7; /* align on byte boundary */ #endif } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*last)); + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3, + s->compressed_len - 7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) +int ZLIB_INTERNAL _tr_tally(s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ + unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */ { - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; + s->sym_buf[s->sym_next++] = (uch)dist; + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); + s->sym_buf[s->sym_next++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; @@ -1029,33 +1030,10 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_ltree[_length_code[lc] + LITERALS + 1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ + return (s->sym_next == s->sym_end); } /* =========================================================================== @@ -1068,20 +1046,21 @@ local void compress_block(s, ltree, dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ + unsigned sx = 0; /* running index in sym_buf */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; + if (s->sym_next != 0) do { + dist = s->sym_buf[sx++] & 0xff; + dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; + lc = s->sym_buf[sx++]; if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ + send_code(s, code + LITERALS + 1, ltree); /* send length code */ extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; @@ -1099,11 +1078,10 @@ local void compress_block(s, ltree, dtree) } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); + /* Check that the overlay between pending_buf and sym_buf is ok: */ + Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); - } while (lx < s->last_lit); + } while (sx < s->sym_next); send_code(s, END_BLOCK, ltree); } @@ -1112,9 +1090,9 @@ local void compress_block(s, ltree, dtree) * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). + * "block list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: @@ -1124,19 +1102,19 @@ local void compress_block(s, ltree, dtree) local int detect_data_type(s) deflate_state *s; { - /* black_mask is the bit mask of black-listed bytes + /* block_mask is the bit mask of block-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ - unsigned long black_mask = 0xf3ffc07fUL; + unsigned long block_mask = 0xf3ffc07fUL; int n; - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>= 1) - if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) + /* Check for non-textual ("block-listed") bytes. */ + for (n = 0; n <= 31; n++, block_mask >>= 1) + if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0)) return Z_BINARY; - /* Check for textual ("white-listed") bytes. */ + /* Check for textual ("allow-listed") bytes. */ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0) return Z_TEXT; @@ -1144,7 +1122,7 @@ local int detect_data_type(s) if (s->dyn_ltree[n].Freq != 0) return Z_TEXT; - /* There are no "black-listed" or "white-listed" bytes: + /* There are no "block-listed" or "allow-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; @@ -1198,6 +1176,6 @@ local void bi_windup(s) s->bi_buf = 0; s->bi_valid = 0; #ifdef ZLIB_DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; + s->bits_sent = (s->bits_sent + 7) & ~7; #endif } diff --git a/src/dependencies/zlib-1.2.11/trees.h b/src/dependencies/zlib-1.2.13/trees.h similarity index 100% rename from src/dependencies/zlib-1.2.11/trees.h rename to src/dependencies/zlib-1.2.13/trees.h diff --git a/src/dependencies/zlib-1.2.11/uncompr.c b/src/dependencies/zlib-1.2.13/uncompr.c similarity index 96% rename from src/dependencies/zlib-1.2.11/uncompr.c rename to src/dependencies/zlib-1.2.13/uncompr.c index f03a1a8..f9532f4 100644 --- a/src/dependencies/zlib-1.2.11/uncompr.c +++ b/src/dependencies/zlib-1.2.13/uncompr.c @@ -24,7 +24,7 @@ Z_DATA_ERROR if the input data was corrupted, including if the input data is an incomplete zlib stream. */ -int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) +int ZEXPORT uncompress2(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; @@ -83,7 +83,7 @@ int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) err; } -int ZEXPORT uncompress (dest, destLen, source, sourceLen) +int ZEXPORT uncompress(dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; diff --git a/src/dependencies/zlib-1.2.11/watcom/watcom_f.mak b/src/dependencies/zlib-1.2.13/watcom/watcom_f.mak similarity index 100% rename from src/dependencies/zlib-1.2.11/watcom/watcom_f.mak rename to src/dependencies/zlib-1.2.13/watcom/watcom_f.mak diff --git a/src/dependencies/zlib-1.2.11/watcom/watcom_l.mak b/src/dependencies/zlib-1.2.13/watcom/watcom_l.mak similarity index 100% rename from src/dependencies/zlib-1.2.11/watcom/watcom_l.mak rename to src/dependencies/zlib-1.2.13/watcom/watcom_l.mak diff --git a/src/dependencies/zlib-1.2.11/win32/DLL_FAQ.txt b/src/dependencies/zlib-1.2.13/win32/DLL_FAQ.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/win32/DLL_FAQ.txt rename to src/dependencies/zlib-1.2.13/win32/DLL_FAQ.txt diff --git a/src/dependencies/zlib-1.2.11/win32/Makefile.bor b/src/dependencies/zlib-1.2.13/win32/Makefile.bor similarity index 96% rename from src/dependencies/zlib-1.2.11/win32/Makefile.bor rename to src/dependencies/zlib-1.2.13/win32/Makefile.bor index d152bbb..4495353 100644 --- a/src/dependencies/zlib-1.2.11/win32/Makefile.bor +++ b/src/dependencies/zlib-1.2.13/win32/Makefile.bor @@ -3,7 +3,6 @@ # # Usage: # make -f win32/Makefile.bor -# make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj # ------------ Borland C++ ------------ diff --git a/src/dependencies/zlib-1.2.11/win32/Makefile.gcc b/src/dependencies/zlib-1.2.13/win32/Makefile.gcc similarity index 97% rename from src/dependencies/zlib-1.2.11/win32/Makefile.gcc rename to src/dependencies/zlib-1.2.13/win32/Makefile.gcc index 305be50..081e391 100644 --- a/src/dependencies/zlib-1.2.11/win32/Makefile.gcc +++ b/src/dependencies/zlib-1.2.13/win32/Makefile.gcc @@ -11,10 +11,6 @@ # # make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.gcc # -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc -# # To install libz.a, zconf.h and zlib.h in the system directories, type: # # make install -fwin32/Makefile.gcc @@ -38,7 +34,6 @@ IMPLIB = libz.dll.a # SHARED_MODE=0 -#LOC = -DASMV #LOC = -DZLIB_DEBUG -g PREFIX = diff --git a/src/dependencies/zlib-1.2.11/win32/Makefile.msc b/src/dependencies/zlib-1.2.13/win32/Makefile.msc similarity index 94% rename from src/dependencies/zlib-1.2.11/win32/Makefile.msc rename to src/dependencies/zlib-1.2.13/win32/Makefile.msc index 6831882..9c65153 100644 --- a/src/dependencies/zlib-1.2.11/win32/Makefile.msc +++ b/src/dependencies/zlib-1.2.13/win32/Makefile.msc @@ -4,10 +4,6 @@ # Usage: # nmake -f win32/Makefile.msc (standard build) # nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) -# nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \ -# OBJA="inffas32.obj match686.obj" (use ASM code, x86) -# nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." \ -# OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64) # The toplevel directory of the source tree. # diff --git a/src/dependencies/zlib-1.2.11/win32/README-WIN32.txt b/src/dependencies/zlib-1.2.13/win32/README-WIN32.txt similarity index 97% rename from src/dependencies/zlib-1.2.11/win32/README-WIN32.txt rename to src/dependencies/zlib-1.2.13/win32/README-WIN32.txt index df7ab7f..050197d 100644 --- a/src/dependencies/zlib-1.2.11/win32/README-WIN32.txt +++ b/src/dependencies/zlib-1.2.13/win32/README-WIN32.txt @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.11 is a general purpose data compression library. All the code is +zlib 1.2.13 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) @@ -22,7 +22,7 @@ before asking for help. Manifest: -The package zlib-1.2.11-win32-x86.zip will contain the following files: +The package zlib-1.2.13-win32-x86.zip will contain the following files: README-WIN32.txt This document ChangeLog Changes since previous zlib packages diff --git a/src/dependencies/zlib-1.2.11/win32/VisualC.txt b/src/dependencies/zlib-1.2.13/win32/VisualC.txt similarity index 100% rename from src/dependencies/zlib-1.2.11/win32/VisualC.txt rename to src/dependencies/zlib-1.2.13/win32/VisualC.txt diff --git a/src/dependencies/zlib-1.2.11/win32/zlib.def b/src/dependencies/zlib-1.2.13/win32/zlib.def similarity index 90% rename from src/dependencies/zlib-1.2.11/win32/zlib.def rename to src/dependencies/zlib-1.2.13/win32/zlib.def index 784b138..53c8011 100644 --- a/src/dependencies/zlib-1.2.11/win32/zlib.def +++ b/src/dependencies/zlib-1.2.13/win32/zlib.def @@ -69,6 +69,7 @@ EXPORTS gzoffset64 adler32_combine64 crc32_combine64 + crc32_combine_gen64 ; checksum functions adler32 adler32_z @@ -76,6 +77,8 @@ EXPORTS crc32_z adler32_combine crc32_combine + crc32_combine_gen + crc32_combine_op ; various hacks, don't look :) deflateInit_ deflateInit2_ diff --git a/src/dependencies/zlib-1.2.11/win32/zlib1.rc b/src/dependencies/zlib-1.2.13/win32/zlib1.rc similarity index 94% rename from src/dependencies/zlib-1.2.11/win32/zlib1.rc rename to src/dependencies/zlib-1.2.13/win32/zlib1.rc index 234e641..ceb4ee5 100644 --- a/src/dependencies/zlib-1.2.11/win32/zlib1.rc +++ b/src/dependencies/zlib-1.2.13/win32/zlib1.rc @@ -26,7 +26,7 @@ BEGIN VALUE "FileDescription", "zlib data compression library\0" VALUE "FileVersion", ZLIB_VERSION "\0" VALUE "InternalName", "zlib1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2022 Jean-loup Gailly & Mark Adler\0" VALUE "OriginalFilename", "zlib1.dll\0" VALUE "ProductName", "zlib\0" VALUE "ProductVersion", ZLIB_VERSION "\0" diff --git a/src/dependencies/zlib-1.2.11/zconf.h.included b/src/dependencies/zlib-1.2.13/zconf.h similarity index 97% rename from src/dependencies/zlib-1.2.11/zconf.h.included rename to src/dependencies/zlib-1.2.13/zconf.h index 5e1d68a..bf977d3 100644 --- a/src/dependencies/zlib-1.2.11/zconf.h.included +++ b/src/dependencies/zlib-1.2.13/zconf.h @@ -38,6 +38,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -349,6 +352,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -467,11 +473,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/src/dependencies/zlib-1.2.11/zconf.h.cmakein b/src/dependencies/zlib-1.2.13/zconf.h.cmakein similarity index 97% rename from src/dependencies/zlib-1.2.11/zconf.h.cmakein rename to src/dependencies/zlib-1.2.13/zconf.h.cmakein index a7f24cc..247ba24 100644 --- a/src/dependencies/zlib-1.2.11/zconf.h.cmakein +++ b/src/dependencies/zlib-1.2.13/zconf.h.cmakein @@ -40,6 +40,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -351,6 +354,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -469,11 +475,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/src/dependencies/zlib-1.2.11/zconf.h.in b/src/dependencies/zlib-1.2.13/zconf.h.in similarity index 97% rename from src/dependencies/zlib-1.2.11/zconf.h.in rename to src/dependencies/zlib-1.2.13/zconf.h.in index 5e1d68a..bf977d3 100644 --- a/src/dependencies/zlib-1.2.11/zconf.h.in +++ b/src/dependencies/zlib-1.2.13/zconf.h.in @@ -38,6 +38,9 @@ # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 +# define crc32_combine_gen z_crc32_combine_gen +# define crc32_combine_gen64 z_crc32_combine_gen64 +# define crc32_combine_op z_crc32_combine_op # define crc32_z z_crc32_z # define deflate z_deflate # define deflateBound z_deflateBound @@ -349,6 +352,9 @@ # ifdef FAR # undef FAR # endif +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ @@ -467,11 +473,18 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H +#ifndef Z_HAVE_UNISTD_H +# ifdef __WATCOMC__ +# define Z_HAVE_UNISTD_H +# endif +#endif +#ifndef Z_HAVE_UNISTD_H +# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32) +# define Z_HAVE_UNISTD_H +# endif #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/src/dependencies/zlib-1.2.11/zlib.3 b/src/dependencies/zlib-1.2.13/zlib.3 similarity index 97% rename from src/dependencies/zlib-1.2.11/zlib.3 rename to src/dependencies/zlib-1.2.13/zlib.3 index bda4eb0..6f6e914 100644 --- a/src/dependencies/zlib-1.2.11/zlib.3 +++ b/src/dependencies/zlib-1.2.13/zlib.3 @@ -1,4 +1,4 @@ -.TH ZLIB 3 "15 Jan 2017" +.TH ZLIB 3 "13 Oct 2022" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -105,9 +105,9 @@ before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS AND LICENSE -Version 1.2.11 +Version 1.2.13 .LP -Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler +Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler .LP This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/dependencies/zlib-1.2.13/zlib.3.pdf b/src/dependencies/zlib-1.2.13/zlib.3.pdf new file mode 100644 index 0000000..8132d84 Binary files /dev/null and b/src/dependencies/zlib-1.2.13/zlib.3.pdf differ diff --git a/src/dependencies/zlib-1.2.11/zlib.h b/src/dependencies/zlib-1.2.13/zlib.h similarity index 91% rename from src/dependencies/zlib-1.2.11/zlib.h rename to src/dependencies/zlib-1.2.13/zlib.h index f09cdaf..953cb50 100644 --- a/src/dependencies/zlib-1.2.11/zlib.h +++ b/src/dependencies/zlib-1.2.13/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 + version 1.2.13, October 13th, 2022 - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.11" -#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VERSION "1.2.13" +#define ZLIB_VERNUM 0x12d0 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_REVISION 13 #define ZLIB_VER_SUBREVISION 0 /* @@ -276,7 +276,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput + which can be used if desired to determine whether or not there is more output in that case. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to @@ -543,8 +543,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int strategy)); This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. + fields zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. @@ -661,7 +660,7 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If deflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. deflateGetDictionary() may return a length less than the window size, even when more than the window size in input has been provided. It may return up @@ -712,11 +711,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). + strategy is changed, and if there have been any deflate() calls since the + state was initialized or reset, then the input available so far is + compressed with the old level and strategy using deflate(strm, Z_BLOCK). + There are three approaches for the compression levels 0, 1..3, and 4..9 + respectively. The new level and strategy will take effect at the next call + of deflate(). If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does not have enough output space to complete, then the parameter change will not @@ -865,9 +865,11 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will not automatically decode concatenated gzip streams. - inflate() will return Z_STREAM_END at the end of the gzip stream. The state - would need to be reset to continue decoding a subsequent gzip stream. + below), inflate() will *not* automatically decode concatenated gzip members. + inflate() will return Z_STREAM_END at the end of the gzip member. The state + would need to be reset to continue decoding a subsequent gzip member. This + *must* be done if there is more data after a gzip member, in order for the + decompression to be compliant with the gzip standard (RFC 1952). inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the @@ -913,7 +915,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, to dictionary. dictionary must have enough space, where 32768 bytes is always enough. If inflateGetDictionary() is called with dictionary equal to Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. + Similarly, if dictLength is Z_NULL, then it is not set. inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the stream state is inconsistent. @@ -1302,14 +1304,14 @@ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. + Open the gzip (.gz) file at path for reading and decompressing, or + compressing and writing. The mode parameter is as in fopen ("rb" or "wb") + but can also include a compression level ("wb9") or a strategy: 'f' for + filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", + 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression + as in "wb9F". (See the description of deflateInit2 for more information + about the strategy parameter.) 'T' will request transparent writing or + appending with no compression and not using the gzip format. "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since @@ -1339,9 +1341,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. + Associate a gzFile with the file descriptor fd. File descriptors are + obtained from calls like open, dup, creat, pipe or fileno (if the file has + been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor @@ -1362,13 +1364,13 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); /* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Three times that size in buffer space is allocated. A larger buffer - size of, for example, 64K or 128K bytes will noticeably increase the speed - of decompression (reading). + Set the internal buffer size used by this library's functions for file to + size. The default buffer size is 8192 bytes. This function must be called + after gzopen() or gzdopen(), and before any other calls that read or write + the file. The buffer memory allocation is always deferred to the first read + or write. Three times that size in buffer space is allocated. A larger + buffer size of, for example, 64K or 128K bytes will noticeably increase the + speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). @@ -1378,9 +1380,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. Previously provided - data is flushed before the parameter change. + Dynamically update the compression level and strategy for file. See the + description of deflateInit2 for the meaning of these parameters. Previously + provided data is flushed before applying the parameter changes. gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not opened for writing, Z_ERRNO if there is an error writing the flushed data, @@ -1389,7 +1391,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* - Reads the given number of uncompressed bytes from the compressed file. If + Read and decompress up to len uncompressed bytes from file into buf. If the input file is not in gzip format, gzread copies the given number of bytes into the buffer directly from the file. @@ -1420,11 +1422,11 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, gzFile file)); /* - Read up to nitems items of size size from file to buf, otherwise operating - as gzread() does. This duplicates the interface of stdio's fread(), with - size_t request and return types. If the library defines size_t, then - z_size_t is identical to size_t. If not, then z_size_t is an unsigned - integer type that can contain a pointer. + Read and decompress up to nitems items of size size from file into buf, + otherwise operating as gzread() does. This duplicates the interface of + stdio's fread(), with size_t request and return types. If the library + defines size_t, then z_size_t is identical to size_t. If not, then z_size_t + is an unsigned integer type that can contain a pointer. gzfread() returns the number of full items read of size size, or zero if the end of the file was reached and a full item could not be read, or if @@ -1435,26 +1437,24 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, In the event that the end of file is reached and only a partial item is available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf + multiple of size, then the final partial item is nevertheless read into buf and the end-of-file flag is set. The length of the partial item read is not provided, but could be inferred from the result of gztell(). This behavior is the same as the behavior of fread() implementations in common libraries, but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. + file, resetting and retrying on end-of-file, when size is not 1. */ -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. + Compress and write the len uncompressed bytes at buf to file. gzwrite + returns the number of uncompressed bytes written or 0 in case of error. */ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, z_size_t nitems, gzFile file)); /* - gzfwrite() writes nitems items of size size from buf to file, duplicating + Compress and write nitems items of size size from buf to file, duplicating the interface of stdio's fwrite(), with size_t request and return types. If the library defines size_t, then z_size_t is identical to size_t. If not, then z_size_t is an unsigned integer type that can contain a pointer. @@ -1467,22 +1467,22 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of + Convert, format, compress, and write the arguments (...) to file under + control of the string format, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or a negative zlib error code in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() + zlib was compiled with the insecure functions sprintf() or vsprintf(), because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* - Writes the given null-terminated string to the compressed file, excluding + Compress and write the given null-terminated string s to file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. @@ -1490,11 +1490,12 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. + Read and decompress bytes from file into buf, until len-1 characters are + read, or until a newline character is read and transferred to buf, or an + end-of-file condition is encountered. If any characters are read or if len + is one, the string is terminated with a null character. If no characters + are read due to an end-of-file or len is less than one, then the buffer is + left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at @@ -1503,13 +1504,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* - Writes c, converted to an unsigned char, into the compressed file. gzputc + Compress and write c, converted to an unsigned char, into file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* - Reads one byte from the compressed file. gzgetc returns this byte or -1 + Read and decompress one byte from file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e. it does not check to see if file is NULL, nor whether the structure file @@ -1518,8 +1519,8 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. + Push c back onto the stream for file to be read as the first character on + the next read. At least one character of push-back is always allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the @@ -1530,9 +1531,9 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. + Flush all pending output to file. The parameter flush is as in the + deflate() function. The return value is the zlib error number (see function + gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new @@ -1547,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the + Set the starting position to offset relative to whence for the next gzread + or gzwrite on file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. @@ -1565,18 +1566,18 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* - Rewinds the given file. This function is supported only for reading. + Rewind file. This function is supported only for reading. - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET). */ /* ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). + Return the starting position for the next gzread or gzwrite on file. + This position represents a number of bytes in the uncompressed data stream, + and is zero when starting, even if appending or reading a gzip stream from + the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ @@ -1584,22 +1585,22 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); /* ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. + Return the current compressed (actual) read or write offset of file. This + offset includes the count of bytes that precede the gzip stream, for example + when appending or when using gzdopen() for reading. When reading, the + offset does not include as yet unused buffered input. This information can + be used for a progress indicator. On error, gzoffset() returns -1. */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. + Return true (1) if the end-of-file indicator for file has been set while + reading, false (0) otherwise. Note that the end-of-file indicator is set + only if the read tried to go past the end of the input, but came up short. + Therefore, just like feof(), gzeof() may return false even if there is no + more data to read, in the event that the last read request was for the exact + number of bytes remaining in the input file. This will happen if the input + file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file @@ -1608,7 +1609,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* - Returns true (1) if file is being copied directly while reading, or false + Return true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input @@ -1629,8 +1630,8 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you + Flush all pending output for file, if necessary, close file and + deallocate the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. @@ -1654,10 +1655,10 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. + Return the error message for the last error which occurred on file. + errnum is set to zlib error number. If an error occurred in the file system + and not in the compression library, errnum is set to Z_ERRNO and the + application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is @@ -1670,7 +1671,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* - Clears the error and end-of-file flags for file. This is analogous to the + Clear the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ @@ -1688,8 +1689,9 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. + return the updated checksum. An Adler-32 value is in the range of a 32-bit + unsigned integer. If buf is Z_NULL, this function returns the required + initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed much faster. @@ -1722,12 +1724,13 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, negative, the result has no meaning or utility. */ -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. + updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer. + If buf is Z_NULL, this function returns the required initial value for the + crc. Pre- and post-conditioning (one's complement) is performed within this + function so it shouldn't be done by the application. Usage example: @@ -1739,7 +1742,7 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); if (crc != original_crc) error(); */ -ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, +ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf, z_size_t len)); /* Same as crc32(), but with a size_t length. @@ -1755,6 +1758,20 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); len2. */ +/* +ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2)); + + Return the operator corresponding to length len2, to be used with + crc32_combine_op(). +*/ + +ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op)); +/* + Give the same result as crc32_combine(), using op in place of len2. op is + is generated from len2 by crc32_combine_gen(). This will be faster than + crc32_combine() if the generated op is used more than once. +*/ + /* various hacks, don't look :) */ @@ -1842,6 +1859,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t)); #endif #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) @@ -1852,6 +1870,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define z_gzoffset z_gzoffset64 # define z_adler32_combine z_adler32_combine64 # define z_crc32_combine z_crc32_combine64 +# define z_crc32_combine_gen z_crc32_combine_gen64 # else # define gzopen gzopen64 # define gzseek gzseek64 @@ -1859,6 +1878,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 +# define crc32_combine_gen crc32_combine_gen64 # endif # ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); @@ -1867,6 +1887,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); @@ -1875,12 +1896,14 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t)); #endif #else /* Z_SOLO */ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t)); #endif /* !Z_SOLO */ @@ -1890,10 +1913,10 @@ ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) +#if defined(_WIN32) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); #endif diff --git a/src/dependencies/zlib-1.2.11/zlib.map b/src/dependencies/zlib-1.2.13/zlib.map similarity index 87% rename from src/dependencies/zlib-1.2.11/zlib.map rename to src/dependencies/zlib-1.2.13/zlib.map index 40fa9db..b330b60 100644 --- a/src/dependencies/zlib-1.2.11/zlib.map +++ b/src/dependencies/zlib-1.2.13/zlib.map @@ -92,3 +92,9 @@ ZLIB_1.2.9 { adler32_z; crc32_z; } ZLIB_1.2.7.1; + +ZLIB_1.2.12 { + crc32_combine_gen; + crc32_combine_gen64; + crc32_combine_op; +} ZLIB_1.2.9; diff --git a/src/dependencies/zlib-1.2.11/zlib.pc.cmakein b/src/dependencies/zlib-1.2.13/zlib.pc.cmakein similarity index 100% rename from src/dependencies/zlib-1.2.11/zlib.pc.cmakein rename to src/dependencies/zlib-1.2.13/zlib.pc.cmakein diff --git a/src/dependencies/zlib-1.2.11/zlib.pc.in b/src/dependencies/zlib-1.2.13/zlib.pc.in similarity index 100% rename from src/dependencies/zlib-1.2.11/zlib.pc.in rename to src/dependencies/zlib-1.2.13/zlib.pc.in diff --git a/src/dependencies/zlib-1.2.11/zlib2ansi b/src/dependencies/zlib-1.2.13/zlib2ansi old mode 100644 new mode 100755 similarity index 97% rename from src/dependencies/zlib-1.2.11/zlib2ansi rename to src/dependencies/zlib-1.2.13/zlib2ansi index 15e3e16..23b2a1d --- a/src/dependencies/zlib-1.2.11/zlib2ansi +++ b/src/dependencies/zlib-1.2.13/zlib2ansi @@ -8,7 +8,7 @@ # TODO # -# Asumes no function pointer parameters. unless they are typedefed. +# Assumes no function pointer parameters. unless they are typedefed. # Assumes no literal strings that look like function definitions # Assumes functions start at the beginning of a line @@ -104,7 +104,7 @@ sub StripComments no warnings; - # Strip C & C++ coments + # Strip C & C++ comments # From the perlfaq $_[0] =~ diff --git a/src/dependencies/zlib-1.2.11/zutil.c b/src/dependencies/zlib-1.2.13/zutil.c similarity index 93% rename from src/dependencies/zlib-1.2.11/zutil.c rename to src/dependencies/zlib-1.2.13/zutil.c index a76c6b0..9543ae8 100644 --- a/src/dependencies/zlib-1.2.11/zutil.c +++ b/src/dependencies/zlib-1.2.13/zutil.c @@ -61,9 +61,11 @@ uLong ZEXPORT zlibCompileFlags() #ifdef ZLIB_DEBUG flags += 1 << 8; #endif + /* #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif + */ #ifdef ZLIB_WINAPI flags += 1 << 10; #endif @@ -119,7 +121,7 @@ uLong ZEXPORT zlibCompileFlags() # endif int ZLIB_INTERNAL z_verbose = verbose; -void ZLIB_INTERNAL z_error (m) +void ZLIB_INTERNAL z_error(m) char *m; { fprintf(stderr, "%s\n", m); @@ -136,8 +138,8 @@ const char * ZEXPORT zError(err) return ERR_MSG(err); } -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have +#if defined(_WIN32_WCE) && _WIN32_WCE < 0x800 + /* The older Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. * Its value is always 0 and should not be used. */ @@ -214,7 +216,7 @@ local ptr_table table[MAX_PTR]; * a protected system like OS/2. Use Microsoft C instead. */ -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) { voidpf buf; ulg bsize = (ulg)items*size; @@ -240,7 +242,7 @@ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) return buf; } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { int n; @@ -277,13 +279,13 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) # define _hfree hfree #endif -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) +voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) { (void)opaque; return _halloc((long)items, size); } -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) +void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) { (void)opaque; _hfree(ptr); @@ -302,7 +304,7 @@ extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif -voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) +voidpf ZLIB_INTERNAL zcalloc(opaque, items, size) voidpf opaque; unsigned items; unsigned size; @@ -312,7 +314,7 @@ voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) (voidpf)calloc(items, size); } -void ZLIB_INTERNAL zcfree (opaque, ptr) +void ZLIB_INTERNAL zcfree(opaque, ptr) voidpf opaque; voidpf ptr; { diff --git a/src/dependencies/zlib-1.2.11/zutil.h b/src/dependencies/zlib-1.2.13/zutil.h similarity index 94% rename from src/dependencies/zlib-1.2.11/zutil.h rename to src/dependencies/zlib-1.2.13/zutil.h index b079ea6..0bc7f4e 100644 --- a/src/dependencies/zlib-1.2.11/zutil.h +++ b/src/dependencies/zlib-1.2.13/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -29,10 +29,6 @@ # include #endif -#ifdef Z_SOLO - typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ -#endif - #ifndef local # define local static #endif @@ -46,6 +42,17 @@ typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; +#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC) +# include +# if (ULONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long +# elif (ULLONG_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned long long +# elif (UINT_MAX == 0xffffffffffffffff) +# define Z_U8 unsigned +# endif +#endif + extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ @@ -170,10 +177,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX # if defined(_WIN32_WCE) # define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif # else # define fdopen(fd,type) _fdopen(fd,type) # endif @@ -190,6 +193,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t)); #endif /* common defaults */ diff --git a/src/dependencies/zstd-1.5.0/.github/workflows/generic-dev.yml b/src/dependencies/zstd-1.5.0/.github/workflows/generic-dev.yml deleted file mode 100644 index ae4ee7e..0000000 --- a/src/dependencies/zstd-1.5.0/.github/workflows/generic-dev.yml +++ /dev/null @@ -1,225 +0,0 @@ -name: generic-dev - -on: - pull_request: - branches: [ dev, release, actionsTest ] - -jobs: - -# Dev PR jobs that still have to be migrated from travis -# -# versionTag (only on release tags) -# valgrindTest (keeps failing for some reason. need investigation) -# staticAnalyze (need trusty so need self-hosted) -# pcc-fuzz: (need trusty so need self-hosted) -# min-decomp-macros (flakey) -# -# setting up self-hosted is pretty straightforward, but -# I need admins permissions to the repo for that it looks like -# So I'm tabling that for now -# -# The release branch exclusive jobs will be in a separate -# workflow file (the osx tests and meson build that is) - - benchmarking: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: make benchmarking - run: make benchmarking - - test: - runs-on: ubuntu-latest - env: - DEVNULLRIGHTS: 1 - READFROMBLOCKDEVICE: 1 - steps: - - uses: actions/checkout@v2 - - name: make test - run: make test - - check-32bit: # designed to catch https://github.com/facebook/zstd/issues/2428 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: make check on 32-bit - run: | - sudo apt update - APT_PACKAGES="gcc-multilib" make apt-install - CFLAGS="-m32 -O1 -fstack-protector" make check V=1 - - gcc-7-libzstd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: gcc-7 + libzstdmt compilation - run: | - make gcc7install - CC=gcc-7 CFLAGS=-Werror make -j all - make clean - LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt - - # candidate test (to check) : underlink test - # LDFLAGS=-Wl,--no-undefined : will make the linker fail if dll is underlinked - - gcc-8-asan-ubsan-testzstd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: gcc-8 + ASan + UBSan + Test Zstd - run: | - make gcc8install - CC=gcc-8 CFLAGS="-Werror" make -j all - make clean - CC=gcc-8 make -j uasan-test-zstd zstd-src.tar.zst.sha256.sig && - appveyor PushArtifact zstd-src.tar.zst.sha256.sig && - cd ..\..\bin\ && - 7z a -tzip -mx9 zstd-win-release-%PLATFORM%.zip * && - appveyor PushArtifact zstd-win-release-%PLATFORM%.zip - ) - ) - - if [%HOST%]==[visual] ( - ECHO *** && - ECHO *** Building Visual Studio 2008 %PLATFORM%\%CONFIGURATION% in %APPVEYOR_BUILD_FOLDER% && - ECHO *** && - msbuild "build\VS2008\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v90 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2008\bin\%PLATFORM%\%CONFIGURATION%\*.exe && - MD5sum build/VS2008/bin/%PLATFORM%/%CONFIGURATION%/*.exe && - COPY build\VS2008\bin\%PLATFORM%\%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2008_%PLATFORM%_%CONFIGURATION%.exe && - ECHO *** && - ECHO *** Building Visual Studio 2010 %PLATFORM%\%CONFIGURATION% && - ECHO *** && - msbuild "build\VS2010\zstd.sln" %ADDITIONALPARAM% /m /verbosity:minimal /property:PlatformToolset=v100 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - msbuild "build\VS2010\zstd.sln" %ADDITIONALPARAM% /m /verbosity:minimal /property:PlatformToolset=v100 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2010_%PLATFORM%_%CONFIGURATION%.exe && - ECHO *** && - ECHO *** Building Visual Studio 2012 %PLATFORM%\%CONFIGURATION% && - ECHO *** && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v110 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v110 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2012_%PLATFORM%_%CONFIGURATION%.exe && - ECHO *** && - ECHO *** Building Visual Studio 2013 %PLATFORM%\%CONFIGURATION% && - ECHO *** && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v120 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v120 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2013_%PLATFORM%_%CONFIGURATION%.exe && - ECHO *** && - ECHO *** Building Visual Studio 2015 %PLATFORM%\%CONFIGURATION% && - ECHO *** && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe && - COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\ - ) - - if [%HOST%]==[cmake-visual] ( - ECHO *** && - ECHO *** Building %CMAKE_GENERATOR% ^(%CMAKE_GENERATOR_TOOLSET%^) %PLATFORM%\%CONFIGURATION% && - PUSHD build\cmake && - cmake -DBUILD_TESTING=ON . && - cmake --build . --config %CONFIGURATION% -j4 && - POPD && - ECHO *** - ) - - test_script: - - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% - - SET "CC=gcc" - - SET "CXX=g++" - - if [%TEST%]==[cmake] ( - mkdir build\cmake\build && - cd build\cmake\build && - SET FUZZERTEST=-T2mn && - SET ZSTREAM_TESTTIME=-T2mn && - cmake -G "Visual Studio 14 2015 Win64" .. && - cd ..\..\.. && - make clean - ) - - SET "FUZZERTEST=-T30s" - - if [%HOST%]==[visual] if [%CONFIGURATION%]==[Release] ( - CD tests && - SET ZSTD_BIN=./zstd.exe&& - SET DATAGEN_BIN=./datagen.exe&& - sh -e playTests.sh --test-large-data && - fullbench.exe -i1 && - fullbench.exe -i1 -P0 && - fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% && - fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% && - fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% - ) - - -# The following tests are for regular pushes -# into `dev` or some feature branch -# There run less tests, for shorter feedback loop - -- - version: 1.0.{build} - environment: - matrix: - - COMPILER: "gcc" - HOST: "cygwin" - PLATFORM: "x64" - - COMPILER: "gcc" - HOST: "mingw" - PLATFORM: "x64" - SCRIPT: "CFLAGS=-Werror make -j allzstd DEBUGLEVEL=2" - - COMPILER: "gcc" - HOST: "mingw" - PLATFORM: "x86" - SCRIPT: "CFLAGS=-Werror make -j allzstd" - - COMPILER: "clang" - HOST: "mingw" - PLATFORM: "x64" - SCRIPT: "CFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make -j allzstd V=1" - - - COMPILER: "visual" - HOST: "visual" - PLATFORM: "x64" - CONFIGURATION: "Debug" - - COMPILER: "visual" - HOST: "visual" - PLATFORM: "Win32" - CONFIGURATION: "Debug" - - COMPILER: "visual" - HOST: "visual" - PLATFORM: "x64" - CONFIGURATION: "Release" - - COMPILER: "visual" - HOST: "visual" - PLATFORM: "Win32" - CONFIGURATION: "Release" - - - COMPILER: "clang-cl" - HOST: "cmake-visual" - PLATFORM: "x64" - CONFIGURATION: "Release" - CMAKE_GENERATOR: "Visual Studio 15 2017" - CMAKE_GENERATOR_PLATFORM: "x64" - CMAKE_GENERATOR_TOOLSET: "LLVM" - APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" - - install: - - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% - - SET PATH_ORIGINAL=%PATH% - - if [%HOST%]==[cygwin] ( - ECHO Installing Cygwin Packages && - C:\cygwin64\setup-x86_64.exe -qnNdO -R "C:\cygwin64" -g -P ^ - gcc,^ - cmake,^ - make - ) - - if [%HOST%]==[mingw] ( - SET "PATH_MINGW32=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin" && - SET "PATH_MINGW64=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin" && - COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\make.exe && - COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\make.exe - ) - - IF [%HOST%]==[visual] IF [%PLATFORM%]==[x64] ( - SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;" - ) - - build_script: - - ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION% - - if [%HOST%]==[cygwin] ( - set CHERE_INVOKING=yes && - set CC=%COMPILER% && - C:\cygwin64\bin\bash --login -c " - set -e; - cd build/cmake; - CFLAGS='-Werror' cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_FUZZER_FLAGS=-T20s -DZSTD_ZSTREAM_FLAGS=-T20s -DZSTD_FULLBENCH_FLAGS=-i0 .; - make VERBOSE=1 -j; - ctest -V -L Medium; - " - ) - - if [%HOST%]==[mingw] ( - ( if [%PLATFORM%]==[x64] ( - SET "PATH=%PATH_MINGW64%;%PATH_ORIGINAL%" - ) else if [%PLATFORM%]==[x86] ( - SET "PATH=%PATH_MINGW32%;%PATH_ORIGINAL%" - ) ) && - make -v && - sh -c "%COMPILER% -v" && - set "CC=%COMPILER%" && - sh -c "%SCRIPT%" - ) - - if [%HOST%]==[visual] ( - ECHO *** && - ECHO *** Building Visual Studio 2015 %PLATFORM%\%CONFIGURATION% && - ECHO *** && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && - DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && - MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && - COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe && - COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\ - ) - - if [%HOST%]==[cmake-visual] ( - ECHO *** && - ECHO *** Building %CMAKE_GENERATOR% ^(%CMAKE_GENERATOR_TOOLSET%^) %PLATFORM%\%CONFIGURATION% && - PUSHD build\cmake && - cmake -DBUILD_TESTING=ON . && - cmake --build . --config %CONFIGURATION% -j4 && - POPD && - ECHO *** - ) - - - test_script: - - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% - - if [%HOST%]==[mingw] ( - set "CC=%COMPILER%" && - make clean && - make check - ) diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/create_single_file_decoder.sh b/src/dependencies/zstd-1.5.0/build/single_file_libs/create_single_file_decoder.sh deleted file mode 100755 index b5f5613..0000000 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/create_single_file_decoder.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Where to find the sources -ZSTD_SRC_ROOT="../../lib" - -# Amalgamate the sources -echo "Amalgamating files... this can take a while" -./combine.sh -r "$ZSTD_SRC_ROOT" -o zstddeclib.c zstddeclib-in.c -# Did combining work? -if [ $? -ne 0 ]; then - echo "Combine script: FAILED" - exit 1 -fi -echo "Combine script: PASSED" diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/create_single_file_library.sh b/src/dependencies/zstd-1.5.0/build/single_file_libs/create_single_file_library.sh deleted file mode 100755 index 6f38526..0000000 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/create_single_file_library.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Where to find the sources -ZSTD_SRC_ROOT="../../lib" - -# Amalgamate the sources -echo "Amalgamating files... this can take a while" -./combine.sh -r "$ZSTD_SRC_ROOT" -o zstd.c zstd-in.c -# Did combining work? -if [ $? -ne 0 ]; then - echo "Combine script: FAILED" - exit 1 -fi -echo "Combine script: PASSED" diff --git a/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/README.md b/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/README.md deleted file mode 100644 index f29bcdf..0000000 --- a/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/README.md +++ /dev/null @@ -1,25 +0,0 @@ -largeNbDicts -===================== - -`largeNbDicts` is a benchmark test tool -dedicated to the specific scenario of -dictionary decompression using a very large number of dictionaries. -When dictionaries are constantly changing, they are always "cold", -suffering from increased latency due to cache misses. - -The tool is created in a bid to investigate performance for this scenario, -and experiment mitigation techniques. - -Command line : -``` -largeNbDicts [Options] filename(s) - -Options : --r : recursively load all files in subdirectories (default: off) --B# : split input into blocks of size # (default: no split) --# : use compression level # (default: 3) --D # : use # as a dictionary (default: create one) --i# : nb benchmark rounds (default: 6) ---nbDicts=# : set nb of dictionaries to # (default: one per block) --h : help (this text) -``` diff --git a/src/dependencies/zstd-1.5.0/doc/images/zstd_logo86.png b/src/dependencies/zstd-1.5.0/doc/images/zstd_logo86.png deleted file mode 100644 index 216f228..0000000 Binary files a/src/dependencies/zstd-1.5.0/doc/images/zstd_logo86.png and /dev/null differ diff --git a/src/dependencies/zstd-1.5.0/lib/common/error_private.h b/src/dependencies/zstd-1.5.0/lib/common/error_private.h deleted file mode 100644 index 6d8b9f7..0000000 --- a/src/dependencies/zstd-1.5.0/lib/common/error_private.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* Note : this module is expected to remain private, do not expose it */ - -#ifndef ERROR_H_MODULE -#define ERROR_H_MODULE - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* **************************************** -* Dependencies -******************************************/ -#include "../zstd_errors.h" /* enum list */ -#include "zstd_deps.h" /* size_t */ - - -/* **************************************** -* Compiler-specific -******************************************/ -#if defined(__GNUC__) -# define ERR_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define ERR_STATIC static inline -#elif defined(_MSC_VER) -# define ERR_STATIC static __inline -#else -# define ERR_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif - - -/*-**************************************** -* Customization (error_public.h) -******************************************/ -typedef ZSTD_ErrorCode ERR_enum; -#define PREFIX(name) ZSTD_error_##name - - -/*-**************************************** -* Error codes handling -******************************************/ -#undef ERROR /* already defined on Visual Studio */ -#define ERROR(name) ZSTD_ERROR(name) -#define ZSTD_ERROR(name) ((size_t)-PREFIX(name)) - -ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } - -ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); } - -/* check and forward error code */ -#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e -#define CHECK_F(f) { CHECK_V_F(_var_err__, f); } - - -/*-**************************************** -* Error Strings -******************************************/ - -const char* ERR_getErrorString(ERR_enum code); /* error_private.c */ - -ERR_STATIC const char* ERR_getErrorName(size_t code) -{ - return ERR_getErrorString(ERR_getErrorCode(code)); -} - -#if defined (__cplusplus) -} -#endif - -#endif /* ERROR_H_MODULE */ diff --git a/src/dependencies/zstd-1.5.0/lib/common/huf.h b/src/dependencies/zstd-1.5.0/lib/common/huf.h deleted file mode 100644 index 3d47ced..0000000 --- a/src/dependencies/zstd-1.5.0/lib/common/huf.h +++ /dev/null @@ -1,362 +0,0 @@ -/* ****************************************************************** - * huff0 huffman codec, - * part of Finite State Entropy library - * Copyright (c) Yann Collet, Facebook, Inc. - * - * You can contact the author at : - * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. -****************************************************************** */ - -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef HUF_H_298734234 -#define HUF_H_298734234 - -/* *** Dependencies *** */ -#include "zstd_deps.h" /* size_t */ - - -/* *** library symbols visibility *** */ -/* Note : when linking with -fvisibility=hidden on gcc, or by default on Visual, - * HUF symbols remain "private" (internal symbols for library only). - * Set macro FSE_DLL_EXPORT to 1 if you want HUF symbols visible on DLL interface */ -#if defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) && defined(__GNUC__) && (__GNUC__ >= 4) -# define HUF_PUBLIC_API __attribute__ ((visibility ("default"))) -#elif defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) /* Visual expected */ -# define HUF_PUBLIC_API __declspec(dllexport) -#elif defined(FSE_DLL_IMPORT) && (FSE_DLL_IMPORT==1) -# define HUF_PUBLIC_API __declspec(dllimport) /* not required, just to generate faster code (saves a function pointer load from IAT and an indirect jump) */ -#else -# define HUF_PUBLIC_API -#endif - - -/* ========================== */ -/* *** simple functions *** */ -/* ========================== */ - -/** HUF_compress() : - * Compress content from buffer 'src', of size 'srcSize', into buffer 'dst'. - * 'dst' buffer must be already allocated. - * Compression runs faster if `dstCapacity` >= HUF_compressBound(srcSize). - * `srcSize` must be <= `HUF_BLOCKSIZE_MAX` == 128 KB. - * @return : size of compressed data (<= `dstCapacity`). - * Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!! - * if HUF_isError(return), compression failed (more details using HUF_getErrorName()) - */ -HUF_PUBLIC_API size_t HUF_compress(void* dst, size_t dstCapacity, - const void* src, size_t srcSize); - -/** HUF_decompress() : - * Decompress HUF data from buffer 'cSrc', of size 'cSrcSize', - * into already allocated buffer 'dst', of minimum size 'dstSize'. - * `originalSize` : **must** be the ***exact*** size of original (uncompressed) data. - * Note : in contrast with FSE, HUF_decompress can regenerate - * RLE (cSrcSize==1) and uncompressed (cSrcSize==dstSize) data, - * because it knows size to regenerate (originalSize). - * @return : size of regenerated data (== originalSize), - * or an error code, which can be tested using HUF_isError() - */ -HUF_PUBLIC_API size_t HUF_decompress(void* dst, size_t originalSize, - const void* cSrc, size_t cSrcSize); - - -/* *** Tool functions *** */ -#define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */ -HUF_PUBLIC_API size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */ - -/* Error Management */ -HUF_PUBLIC_API unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */ -HUF_PUBLIC_API const char* HUF_getErrorName(size_t code); /**< provides error code string (useful for debugging) */ - - -/* *** Advanced function *** */ - -/** HUF_compress2() : - * Same as HUF_compress(), but offers control over `maxSymbolValue` and `tableLog`. - * `maxSymbolValue` must be <= HUF_SYMBOLVALUE_MAX . - * `tableLog` must be `<= HUF_TABLELOG_MAX` . */ -HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog); - -/** HUF_compress4X_wksp() : - * Same as HUF_compress2(), but uses externally allocated `workSpace`. - * `workspace` must have minimum alignment of 4, and be at least as large as HUF_WORKSPACE_SIZE */ -#define HUF_WORKSPACE_SIZE ((6 << 10) + 256) -#define HUF_WORKSPACE_SIZE_U32 (HUF_WORKSPACE_SIZE / sizeof(U32)) -HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog, - void* workSpace, size_t wkspSize); - -#endif /* HUF_H_298734234 */ - -/* ****************************************************************** - * WARNING !! - * The following section contains advanced and experimental definitions - * which shall never be used in the context of a dynamic library, - * because they are not guaranteed to remain stable in the future. - * Only consider them in association with static linking. - * *****************************************************************/ -#if defined(HUF_STATIC_LINKING_ONLY) && !defined(HUF_H_HUF_STATIC_LINKING_ONLY) -#define HUF_H_HUF_STATIC_LINKING_ONLY - -/* *** Dependencies *** */ -#include "mem.h" /* U32 */ -#define FSE_STATIC_LINKING_ONLY -#include "fse.h" - - -/* *** Constants *** */ -#define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */ -#define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */ -#define HUF_SYMBOLVALUE_MAX 255 - -#define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ -#if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX) -# error "HUF_TABLELOG_MAX is too large !" -#endif - - -/* **************************************** -* Static allocation -******************************************/ -/* HUF buffer bounds */ -#define HUF_CTABLEBOUND 129 -#define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true when incompressible is pre-filtered with fast heuristic */ -#define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */ - -/* static allocation of HUF's Compression Table */ -/* this is a private definition, just exposed for allocation and strict aliasing purpose. never EVER access its members directly */ -struct HUF_CElt_s { - U16 val; - BYTE nbBits; -}; /* typedef'd to HUF_CElt */ -typedef struct HUF_CElt_s HUF_CElt; /* consider it an incomplete type */ -#define HUF_CTABLE_SIZE_U32(maxSymbolValue) ((maxSymbolValue)+1) /* Use tables of U32, for proper alignment */ -#define HUF_CTABLE_SIZE(maxSymbolValue) (HUF_CTABLE_SIZE_U32(maxSymbolValue) * sizeof(U32)) -#define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \ - HUF_CElt name[HUF_CTABLE_SIZE_U32(maxSymbolValue)] /* no final ; */ - -/* static allocation of HUF's DTable */ -typedef U32 HUF_DTable; -#define HUF_DTABLE_SIZE(maxTableLog) (1 + (1<<(maxTableLog))) -#define HUF_CREATE_STATIC_DTABLEX1(DTable, maxTableLog) \ - HUF_DTable DTable[HUF_DTABLE_SIZE((maxTableLog)-1)] = { ((U32)((maxTableLog)-1) * 0x01000001) } -#define HUF_CREATE_STATIC_DTABLEX2(DTable, maxTableLog) \ - HUF_DTable DTable[HUF_DTABLE_SIZE(maxTableLog)] = { ((U32)(maxTableLog) * 0x01000001) } - - -/* **************************************** -* Advanced decompression functions -******************************************/ -size_t HUF_decompress4X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */ -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */ -#endif - -size_t HUF_decompress4X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< decodes RLE and uncompressed */ -size_t HUF_decompress4X_hufOnly(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< considers RLE and uncompressed as errors */ -size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< considers RLE and uncompressed as errors */ -size_t HUF_decompress4X1_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */ -size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< single-symbol decoder */ -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress4X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */ -size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< double-symbols decoder */ -#endif - - -/* **************************************** - * HUF detailed API - * ****************************************/ - -/*! HUF_compress() does the following: - * 1. count symbol occurrence from source[] into table count[] using FSE_count() (exposed within "fse.h") - * 2. (optional) refine tableLog using HUF_optimalTableLog() - * 3. build Huffman table from count using HUF_buildCTable() - * 4. save Huffman table to memory buffer using HUF_writeCTable() - * 5. encode the data stream using HUF_compress4X_usingCTable() - * - * The following API allows targeting specific sub-functions for advanced tasks. - * For example, it's possible to compress several blocks using the same 'CTable', - * or to save and regenerate 'CTable' using external methods. - */ -unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue); -size_t HUF_buildCTable (HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits); /* @return : maxNbBits; CTable and count can overlap. In which case, CTable will overwrite count content */ -size_t HUF_writeCTable (void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog); -size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog, void* workspace, size_t workspaceSize); -size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable); -size_t HUF_estimateCompressedSize(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue); -int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue); - -typedef enum { - HUF_repeat_none, /**< Cannot use the previous table */ - HUF_repeat_check, /**< Can use the previous table but it must be checked. Note : The previous table must have been constructed by HUF_compress{1, 4}X_repeat */ - HUF_repeat_valid /**< Can use the previous table and it is assumed to be valid */ - } HUF_repeat; -/** HUF_compress4X_repeat() : - * Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none. - * If it uses hufTable it does not modify hufTable or repeat. - * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used. - * If preferRepeat then the old table will always be used if valid. */ -size_t HUF_compress4X_repeat(void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog, - void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */ - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2); - -/** HUF_buildCTable_wksp() : - * Same as HUF_buildCTable(), but using externally allocated scratch buffer. - * `workSpace` must be aligned on 4-bytes boundaries, and its size must be >= HUF_CTABLE_WORKSPACE_SIZE. - */ -#define HUF_CTABLE_WORKSPACE_SIZE_U32 (2*HUF_SYMBOLVALUE_MAX +1 +1) -#define HUF_CTABLE_WORKSPACE_SIZE (HUF_CTABLE_WORKSPACE_SIZE_U32 * sizeof(unsigned)) -size_t HUF_buildCTable_wksp (HUF_CElt* tree, - const unsigned* count, U32 maxSymbolValue, U32 maxNbBits, - void* workSpace, size_t wkspSize); - -/*! HUF_readStats() : - * Read compact Huffman tree, saved by HUF_writeCTable(). - * `huffWeight` is destination buffer. - * @return : size read from `src` , or an error Code . - * Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */ -size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, - U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr, - const void* src, size_t srcSize); - -/*! HUF_readStats_wksp() : - * Same as HUF_readStats() but takes an external workspace which must be - * 4-byte aligned and its size must be >= HUF_READ_STATS_WORKSPACE_SIZE. - * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0. - */ -#define HUF_READ_STATS_WORKSPACE_SIZE_U32 FSE_DECOMPRESS_WKSP_SIZE_U32(6, HUF_TABLELOG_MAX-1) -#define HUF_READ_STATS_WORKSPACE_SIZE (HUF_READ_STATS_WORKSPACE_SIZE_U32 * sizeof(unsigned)) -size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize, - U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr, - const void* src, size_t srcSize, - void* workspace, size_t wkspSize, - int bmi2); - -/** HUF_readCTable() : - * Loading a CTable saved with HUF_writeCTable() */ -size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize, unsigned *hasZeroWeights); - -/** HUF_getNbBits() : - * Read nbBits from CTable symbolTable, for symbol `symbolValue` presumed <= HUF_SYMBOLVALUE_MAX - * Note 1 : is not inlined, as HUF_CElt definition is private - * Note 2 : const void* used, so that it can provide a statically allocated table as argument (which uses type U32) */ -U32 HUF_getNbBits(const void* symbolTable, U32 symbolValue); - -/* - * HUF_decompress() does the following: - * 1. select the decompression algorithm (X1, X2) based on pre-computed heuristics - * 2. build Huffman table from save, using HUF_readDTableX?() - * 3. decode 1 or 4 segments in parallel using HUF_decompress?X?_usingDTable() - */ - -/** HUF_selectDecoder() : - * Tells which decoder is likely to decode faster, - * based on a set of pre-computed metrics. - * @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 . - * Assumption : 0 < dstSize <= 128 KB */ -U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize); - -/** - * The minimum workspace size for the `workSpace` used in - * HUF_readDTableX1_wksp() and HUF_readDTableX2_wksp(). - * - * The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when - * HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15. - * Buffer overflow errors may potentially occur if code modifications result in - * a required workspace size greater than that specified in the following - * macro. - */ -#define HUF_DECOMPRESS_WORKSPACE_SIZE ((2 << 10) + (1 << 9)) -#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32)) - -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_readDTableX1 (HUF_DTable* DTable, const void* src, size_t srcSize); -size_t HUF_readDTableX1_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize); -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_readDTableX2 (HUF_DTable* DTable, const void* src, size_t srcSize); -size_t HUF_readDTableX2_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize); -#endif - -size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress4X1_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress4X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif - - -/* ====================== */ -/* single stream variants */ -/* ====================== */ - -size_t HUF_compress1X (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog); -size_t HUF_compress1X_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */ -size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable); -/** HUF_compress1X_repeat() : - * Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none. - * If it uses hufTable it does not modify hufTable or repeat. - * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used. - * If preferRepeat then the old table will always be used if valid. */ -size_t HUF_compress1X_repeat(void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog, - void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */ - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2); - -size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* single-symbol decoder */ -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* double-symbol decoder */ -#endif - -size_t HUF_decompress1X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); -size_t HUF_decompress1X_DCtx_wksp (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */ -size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< single-symbol decoder */ -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress1X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */ -size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< double-symbols decoder */ -#endif - -size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); /**< automatic selection of sing or double symbol decoder, based on DTable */ -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress1X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif - -/* BMI2 variants. - * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0. - */ -size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2); -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2); -#endif -size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2); -size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2); -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_readDTableX1_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int bmi2); -#endif - -#endif /* HUF_STATIC_LINKING_ONLY */ - -#if defined (__cplusplus) -} -#endif diff --git a/src/dependencies/zstd-1.5.0/lib/common/threading.c b/src/dependencies/zstd-1.5.0/lib/common/threading.c deleted file mode 100644 index 92cf57c..0000000 --- a/src/dependencies/zstd-1.5.0/lib/common/threading.c +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright (c) 2016 Tino Reichardt - * All rights reserved. - * - * You can contact the author at: - * - zstdmt source repository: https://github.com/mcmilk/zstdmt - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/** - * This file will hold wrapper for systems, which do not support pthreads - */ - -#include "threading.h" - -/* create fake symbol to avoid empty translation unit warning */ -int g_ZSTD_threading_useless_symbol; - -#if defined(ZSTD_MULTITHREAD) && defined(_WIN32) - -/** - * Windows minimalist Pthread Wrapper, based on : - * http://www.cse.wustl.edu/~schmidt/win32-cv-1.html - */ - - -/* === Dependencies === */ -#include -#include - - -/* === Implementation === */ - -static unsigned __stdcall worker(void *arg) -{ - ZSTD_pthread_t* const thread = (ZSTD_pthread_t*) arg; - thread->arg = thread->start_routine(thread->arg); - return 0; -} - -int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused, - void* (*start_routine) (void*), void* arg) -{ - (void)unused; - thread->arg = arg; - thread->start_routine = start_routine; - thread->handle = (HANDLE) _beginthreadex(NULL, 0, worker, thread, 0, NULL); - - if (!thread->handle) - return errno; - else - return 0; -} - -int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr) -{ - DWORD result; - - if (!thread.handle) return 0; - - result = WaitForSingleObject(thread.handle, INFINITE); - switch (result) { - case WAIT_OBJECT_0: - if (value_ptr) *value_ptr = thread.arg; - return 0; - case WAIT_ABANDONED: - return EINVAL; - default: - return GetLastError(); - } -} - -#endif /* ZSTD_MULTITHREAD */ - -#if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32) - -#define ZSTD_DEPS_NEED_MALLOC -#include "zstd_deps.h" - -int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr) -{ - *mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t)); - if (!*mutex) - return 1; - return pthread_mutex_init(*mutex, attr); -} - -int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex) -{ - if (!*mutex) - return 0; - { - int const ret = pthread_mutex_destroy(*mutex); - ZSTD_free(*mutex); - return ret; - } -} - -int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr) -{ - *cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t)); - if (!*cond) - return 1; - return pthread_cond_init(*cond, attr); -} - -int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond) -{ - if (!*cond) - return 0; - { - int const ret = pthread_cond_destroy(*cond); - ZSTD_free(*cond); - return ret; - } -} - -#endif diff --git a/src/dependencies/zstd-1.5.0/lib/common/xxhash.c b/src/dependencies/zstd-1.5.0/lib/common/xxhash.c deleted file mode 100644 index 926b336..0000000 --- a/src/dependencies/zstd-1.5.0/lib/common/xxhash.c +++ /dev/null @@ -1,824 +0,0 @@ -/* - * xxHash - Fast Hash algorithm - * Copyright (c) Yann Collet, Facebook, Inc. - * - * You can contact the author at : - * - xxHash homepage: http://www.xxhash.com - * - xxHash source repository : https://github.com/Cyan4973/xxHash - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. -*/ - - -/* ************************************* -* Tuning parameters -***************************************/ -/*!XXH_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method doesn't depend on compiler but violate C standard. - * It can generate buggy code on targets which do not support unaligned memory accesses. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://stackoverflow.com/a/32095106/646947 for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) || \ - defined(__ICCARM__) -# define XXH_FORCE_MEMORY_ACCESS 1 -# endif -#endif - -/*!XXH_ACCEPT_NULL_INPUT_POINTER : - * If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. - * When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. - * By default, this option is disabled. To enable it, uncomment below define : - */ -/* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */ - -/*!XXH_FORCE_NATIVE_FORMAT : - * By default, xxHash library provides endian-independent Hash values, based on little-endian convention. - * Results are therefore identical for little-endian and big-endian CPU. - * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. - * Should endian-independence be of no importance for your application, you may set the #define below to 1, - * to improve speed for Big-endian CPU. - * This option has no impact on Little_Endian CPU. - */ -#ifndef XXH_FORCE_NATIVE_FORMAT /* can be defined externally */ -# define XXH_FORCE_NATIVE_FORMAT 0 -#endif - -/*!XXH_FORCE_ALIGN_CHECK : - * This is a minor performance trick, only useful with lots of very small keys. - * It means : check for aligned/unaligned input. - * The check costs one initial branch per hash; set to 0 when the input data - * is guaranteed to be aligned. - */ -#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ -# if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) -# define XXH_FORCE_ALIGN_CHECK 0 -# else -# define XXH_FORCE_ALIGN_CHECK 1 -# endif -#endif - - -/* ************************************* -* Includes & Memory related functions -***************************************/ -/* Modify the local functions below should you wish to use some other memory routines */ -/* for ZSTD_malloc(), ZSTD_free() */ -#define ZSTD_DEPS_NEED_MALLOC -#include "zstd_deps.h" /* size_t, ZSTD_malloc, ZSTD_free, ZSTD_memcpy */ -static void* XXH_malloc(size_t s) { return ZSTD_malloc(s); } -static void XXH_free (void* p) { ZSTD_free(p); } -static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_memcpy(dest,src,size); } - -#ifndef XXH_STATIC_LINKING_ONLY -# define XXH_STATIC_LINKING_ONLY -#endif -#include "xxhash.h" - - -/* ************************************* -* Compiler Specific Options -***************************************/ -#include "compiler.h" - - -/* ************************************* -* Basic Types -***************************************/ -#include "mem.h" /* BYTE, U32, U64, size_t */ - -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) - -/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ -static U32 XXH_read32(const void* memPtr) { return *(const U32*) memPtr; } -static U64 XXH_read64(const void* memPtr) { return *(const U64*) memPtr; } - -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U32 u32; U64 u64; } __attribute__((packed)) unalign; - -static U32 XXH_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -static U64 XXH_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -#else - -/* portable and safe solution. Generally efficient. - * see : http://stackoverflow.com/a/32095106/646947 - */ - -static U32 XXH_read32(const void* memPtr) -{ - U32 val; - ZSTD_memcpy(&val, memPtr, sizeof(val)); - return val; -} - -static U64 XXH_read64(const void* memPtr) -{ - U64 val; - ZSTD_memcpy(&val, memPtr, sizeof(val)); - return val; -} - -#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ - - -/* **************************************** -* Compiler-specific Functions and Macros -******************************************/ -#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) - -/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */ -#if defined(_MSC_VER) -# define XXH_rotl32(x,r) _rotl(x,r) -# define XXH_rotl64(x,r) _rotl64(x,r) -#else -#if defined(__ICCARM__) -# include -# define XXH_rotl32(x,r) __ROR(x,(32 - r)) -#else -# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r))) -#endif -# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r))) -#endif - -#if defined(_MSC_VER) /* Visual Studio */ -# define XXH_swap32 _byteswap_ulong -# define XXH_swap64 _byteswap_uint64 -#elif GCC_VERSION >= 403 -# define XXH_swap32 __builtin_bswap32 -# define XXH_swap64 __builtin_bswap64 -#else -static U32 XXH_swap32 (U32 x) -{ - return ((x << 24) & 0xff000000 ) | - ((x << 8) & 0x00ff0000 ) | - ((x >> 8) & 0x0000ff00 ) | - ((x >> 24) & 0x000000ff ); -} -static U64 XXH_swap64 (U64 x) -{ - return ((x << 56) & 0xff00000000000000ULL) | - ((x << 40) & 0x00ff000000000000ULL) | - ((x << 24) & 0x0000ff0000000000ULL) | - ((x << 8) & 0x000000ff00000000ULL) | - ((x >> 8) & 0x00000000ff000000ULL) | - ((x >> 24) & 0x0000000000ff0000ULL) | - ((x >> 40) & 0x000000000000ff00ULL) | - ((x >> 56) & 0x00000000000000ffULL); -} -#endif - - -/* ************************************* -* Architecture Macros -***************************************/ -typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; - -/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler command line */ -#ifndef XXH_CPU_LITTLE_ENDIAN - static const int g_one = 1; -# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&g_one)) -#endif - - -/* *************************** -* Memory reads -*****************************/ -typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; - -FORCE_INLINE_TEMPLATE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); - else - return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr); -} - -FORCE_INLINE_TEMPLATE U32 XXH_readLE32(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE32_align(ptr, endian, XXH_unaligned); -} - -static U32 XXH_readBE32(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); -} - -FORCE_INLINE_TEMPLATE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); - else - return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr); -} - -FORCE_INLINE_TEMPLATE U64 XXH_readLE64(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE64_align(ptr, endian, XXH_unaligned); -} - -static U64 XXH_readBE64(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); -} - - -/* ************************************* -* Macros -***************************************/ -#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ - - -/* ************************************* -* Constants -***************************************/ -static const U32 PRIME32_1 = 2654435761U; -static const U32 PRIME32_2 = 2246822519U; -static const U32 PRIME32_3 = 3266489917U; -static const U32 PRIME32_4 = 668265263U; -static const U32 PRIME32_5 = 374761393U; - -static const U64 PRIME64_1 = 11400714785074694791ULL; -static const U64 PRIME64_2 = 14029467366897019727ULL; -static const U64 PRIME64_3 = 1609587929392839161ULL; -static const U64 PRIME64_4 = 9650029242287828579ULL; -static const U64 PRIME64_5 = 2870177450012600261ULL; - -XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } - - -/* ************************** -* Utils -****************************/ -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* restrict dstState, const XXH32_state_t* restrict srcState) -{ - ZSTD_memcpy(dstState, srcState, sizeof(*dstState)); -} - -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* restrict dstState, const XXH64_state_t* restrict srcState) -{ - ZSTD_memcpy(dstState, srcState, sizeof(*dstState)); -} - - -/* *************************** -* Simple Hash Functions -*****************************/ - -static U32 XXH32_round(U32 seed, U32 input) -{ - seed += input * PRIME32_2; - seed = XXH_rotl32(seed, 13); - seed *= PRIME32_1; - return seed; -} - -FORCE_INLINE_TEMPLATE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* bEnd = p + len; - U32 h32; -#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) { - len=0; - bEnd=p=(const BYTE*)(size_t)16; - } -#endif - - if (len>=16) { - const BYTE* const limit = bEnd - 16; - U32 v1 = seed + PRIME32_1 + PRIME32_2; - U32 v2 = seed + PRIME32_2; - U32 v3 = seed + 0; - U32 v4 = seed - PRIME32_1; - - do { - v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4; - v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4; - v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4; - v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4; - } while (p<=limit); - - h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); - } else { - h32 = seed + PRIME32_5; - } - - h32 += (U32) len; - - while (p+4<=bEnd) { - h32 += XXH_get32bits(p) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4 ; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -XXH_PUBLIC_API unsigned int XXH32 (const void* input, size_t len, unsigned int seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH32_CREATESTATE_STATIC(state); - XXH32_reset(state, seed); - XXH32_update(state, input, len); - return XXH32_digest(state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } } - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - - -static U64 XXH64_round(U64 acc, U64 input) -{ - acc += input * PRIME64_2; - acc = XXH_rotl64(acc, 31); - acc *= PRIME64_1; - return acc; -} - -static U64 XXH64_mergeRound(U64 acc, U64 val) -{ - val = XXH64_round(0, val); - acc ^= val; - acc = acc * PRIME64_1 + PRIME64_4; - return acc; -} - -FORCE_INLINE_TEMPLATE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - U64 h64; -#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) { - len=0; - bEnd=p=(const BYTE*)(size_t)32; - } -#endif - - if (len>=32) { - const BYTE* const limit = bEnd - 32; - U64 v1 = seed + PRIME64_1 + PRIME64_2; - U64 v2 = seed + PRIME64_2; - U64 v3 = seed + 0; - U64 v4 = seed - PRIME64_1; - - do { - v1 = XXH64_round(v1, XXH_get64bits(p)); p+=8; - v2 = XXH64_round(v2, XXH_get64bits(p)); p+=8; - v3 = XXH64_round(v3, XXH_get64bits(p)); p+=8; - v4 = XXH64_round(v4, XXH_get64bits(p)); p+=8; - } while (p<=limit); - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - - } else { - h64 = seed + PRIME64_5; - } - - h64 += (U64) len; - - while (p+8<=bEnd) { - U64 const k1 = XXH64_round(0, XXH_get64bits(p)); - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) { - h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - - -XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH64_CREATESTATE_STATIC(state); - XXH64_reset(state, seed); - XXH64_update(state, input, len); - return XXH64_digest(state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */ - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } } - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - - -/* ************************************************** -* Advanced Hash Functions -****************************************************/ - -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) -{ - return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) -{ - return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - - -/*** Hash feed ***/ - -XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, unsigned int seed) -{ - XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - ZSTD_memset(&state, 0, sizeof(state)-4); /* do not write into reserved, for future removal */ - state.v1 = seed + PRIME32_1 + PRIME32_2; - state.v2 = seed + PRIME32_2; - state.v3 = seed + 0; - state.v4 = seed - PRIME32_1; - ZSTD_memcpy(statePtr, &state, sizeof(state)); - return XXH_OK; -} - - -XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, unsigned long long seed) -{ - XXH64_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - ZSTD_memset(&state, 0, sizeof(state)-8); /* do not write into reserved, for future removal */ - state.v1 = seed + PRIME64_1 + PRIME64_2; - state.v2 = seed + PRIME64_2; - state.v3 = seed + 0; - state.v4 = seed - PRIME64_1; - ZSTD_memcpy(statePtr, &state, sizeof(state)); - return XXH_OK; -} - - -FORCE_INLINE_TEMPLATE XXH_errorcode XXH32_update_endian (XXH32_state_t* state, const void* input, size_t len, XXH_endianess endian) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len_32 += (unsigned)len; - state->large_len |= (len>=16) | (state->total_len_32>=16); - - if (state->memsize + len < 16) { /* fill in tmp buffer */ - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len); - state->memsize += (unsigned)len; - return XXH_OK; - } - - if (state->memsize) { /* some data left from previous update */ - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize); - { const U32* p32 = state->mem32; - state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++; - state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++; - state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++; - state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian)); p32++; - } - p += 16-state->memsize; - state->memsize = 0; - } - - if (p <= bEnd-16) { - const BYTE* const limit = bEnd - 16; - U32 v1 = state->v1; - U32 v2 = state->v2; - U32 v3 = state->v3; - U32 v4 = state->v4; - - do { - v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4; - v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4; - v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4; - v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH32_update_endian(state_in, input, len, XXH_bigEndian); -} - - - -FORCE_INLINE_TEMPLATE U32 XXH32_digest_endian (const XXH32_state_t* state, XXH_endianess endian) -{ - const BYTE * p = (const BYTE*)state->mem32; - const BYTE* const bEnd = (const BYTE*)(state->mem32) + state->memsize; - U32 h32; - - if (state->large_len) { - h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18); - } else { - h32 = state->v3 /* == seed */ + PRIME32_5; - } - - h32 += state->total_len_32; - - while (p+4<=bEnd) { - h32 += XXH_readLE32(p, endian) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -XXH_PUBLIC_API unsigned int XXH32_digest (const XXH32_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_digest_endian(state_in, XXH_littleEndian); - else - return XXH32_digest_endian(state_in, XXH_bigEndian); -} - - - -/* **** XXH64 **** */ - -FORCE_INLINE_TEMPLATE XXH_errorcode XXH64_update_endian (XXH64_state_t* state, const void* input, size_t len, XXH_endianess endian) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len += len; - - if (state->memsize + len < 32) { /* fill in tmp buffer */ - if (input != NULL) { - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len); - } - state->memsize += (U32)len; - return XXH_OK; - } - - if (state->memsize) { /* tmp buffer is full */ - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize); - state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0, endian)); - state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1, endian)); - state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2, endian)); - state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3, endian)); - p += 32-state->memsize; - state->memsize = 0; - } - - if (p+32 <= bEnd) { - const BYTE* const limit = bEnd - 32; - U64 v1 = state->v1; - U64 v2 = state->v2; - U64 v3 = state->v3; - U64 v4 = state->v4; - - do { - v1 = XXH64_round(v1, XXH_readLE64(p, endian)); p+=8; - v2 = XXH64_round(v2, XXH_readLE64(p, endian)); p+=8; - v3 = XXH64_round(v3, XXH_readLE64(p, endian)); p+=8; - v4 = XXH64_round(v4, XXH_readLE64(p, endian)); p+=8; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH64_update_endian(state_in, input, len, XXH_bigEndian); -} - - - -FORCE_INLINE_TEMPLATE U64 XXH64_digest_endian (const XXH64_state_t* state, XXH_endianess endian) -{ - const BYTE * p = (const BYTE*)state->mem64; - const BYTE* const bEnd = (const BYTE*)state->mem64 + state->memsize; - U64 h64; - - if (state->total_len >= 32) { - U64 const v1 = state->v1; - U64 const v2 = state->v2; - U64 const v3 = state->v3; - U64 const v4 = state->v4; - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - } else { - h64 = state->v3 + PRIME64_5; - } - - h64 += (U64) state->total_len; - - while (p+8<=bEnd) { - U64 const k1 = XXH64_round(0, XXH_readLE64(p, endian)); - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) { - h64 ^= (U64)(XXH_readLE32(p, endian)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - - -XXH_PUBLIC_API unsigned long long XXH64_digest (const XXH64_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_digest_endian(state_in, XXH_littleEndian); - else - return XXH64_digest_endian(state_in, XXH_bigEndian); -} - - -/* ************************** -* Canonical representation -****************************/ - -/*! Default XXH result types are basic unsigned 32 and 64 bits. -* The canonical representation follows human-readable write convention, aka big-endian (large digits first). -* These functions allow transformation of hash result into and from its canonical format. -* This way, hash values can be written into a file or buffer, and remain comparable across different systems and programs. -*/ - -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); - ZSTD_memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); - ZSTD_memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) -{ - return XXH_readBE32(src); -} - -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) -{ - return XXH_readBE64(src); -} diff --git a/src/dependencies/zstd-1.5.0/lib/common/xxhash.h b/src/dependencies/zstd-1.5.0/lib/common/xxhash.h deleted file mode 100644 index 16c1f16..0000000 --- a/src/dependencies/zstd-1.5.0/lib/common/xxhash.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * xxHash - Extremely Fast Hash algorithm - * Header File - * Copyright (c) Yann Collet, Facebook, Inc. - * - * You can contact the author at : - * - xxHash source repository : https://github.com/Cyan4973/xxHash - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. -*/ - -/* Notice extracted from xxHash homepage : - -xxHash is an extremely fast Hash algorithm, running at RAM speed limits. -It also successfully passes all tests from the SMHasher suite. - -Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) - -Name Speed Q.Score Author -xxHash 5.4 GB/s 10 -CrapWow 3.2 GB/s 2 Andrew -MumurHash 3a 2.7 GB/s 10 Austin Appleby -SpookyHash 2.0 GB/s 10 Bob Jenkins -SBox 1.4 GB/s 9 Bret Mulvey -Lookup3 1.2 GB/s 9 Bob Jenkins -SuperFastHash 1.2 GB/s 1 Paul Hsieh -CityHash64 1.05 GB/s 10 Pike & Alakuijala -FNV 0.55 GB/s 5 Fowler, Noll, Vo -CRC32 0.43 GB/s 9 -MD5-32 0.33 GB/s 10 Ronald L. Rivest -SHA1-32 0.28 GB/s 10 - -Q.Score is a measure of quality of the hash function. -It depends on successfully passing SMHasher test set. -10 is a perfect score. - -A 64-bits version, named XXH64, is available since r35. -It offers much better speed, but for 64-bits applications only. -Name Speed on 64 bits Speed on 32 bits -XXH64 13.8 GB/s 1.9 GB/s -XXH32 6.8 GB/s 6.0 GB/s -*/ - -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef XXHASH_H_5627135585666179 -#define XXHASH_H_5627135585666179 1 - - -/* **************************** -* Definitions -******************************/ -#include "zstd_deps.h" -typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; - - -/* **************************** -* API modifier -******************************/ -/** XXH_PRIVATE_API -* This is useful if you want to include xxhash functions in `static` mode -* in order to inline them, and remove their symbol from the public list. -* Methodology : -* #define XXH_PRIVATE_API -* #include "xxhash.h" -* `xxhash.c` is automatically included. -* It's not useful to compile and link it as a separate module anymore. -*/ -#ifdef XXH_PRIVATE_API -# ifndef XXH_STATIC_LINKING_ONLY -# define XXH_STATIC_LINKING_ONLY -# endif -# if defined(__GNUC__) -# define XXH_PUBLIC_API static __inline __attribute__((unused)) -# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define XXH_PUBLIC_API static inline -# elif defined(_MSC_VER) -# define XXH_PUBLIC_API static __inline -# else -# define XXH_PUBLIC_API static /* this version may generate warnings for unused static functions; disable the relevant warning */ -# endif -#else -# define XXH_PUBLIC_API /* do nothing */ -#endif /* XXH_PRIVATE_API */ - -/*!XXH_NAMESPACE, aka Namespace Emulation : - -If you want to include _and expose_ xxHash functions from within your own library, -but also want to avoid symbol collisions with another library which also includes xxHash, - -you can use XXH_NAMESPACE, to automatically prefix any public symbol from xxhash library -with the value of XXH_NAMESPACE (so avoid to keep it NULL and avoid numeric values). - -Note that no change is required within the calling program as long as it includes `xxhash.h` : -regular symbol name will be automatically translated by this header. -*/ -#ifdef XXH_NAMESPACE -# define XXH_CAT(A,B) A##B -# define XXH_NAME2(A,B) XXH_CAT(A,B) -# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) -# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) -# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) -# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) -# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) -# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) -# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) -# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) -# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) -# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) -# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) -# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) -# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) -# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) -# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) -# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) -# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) -# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) -# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) -#endif - - -/* ************************************* -* Version -***************************************/ -#define XXH_VERSION_MAJOR 0 -#define XXH_VERSION_MINOR 6 -#define XXH_VERSION_RELEASE 2 -#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) -XXH_PUBLIC_API unsigned XXH_versionNumber (void); - - -/* **************************** -* Simple Hash Functions -******************************/ -typedef unsigned int XXH32_hash_t; -typedef unsigned long long XXH64_hash_t; - -XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, unsigned int seed); -XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed); - -/*! -XXH32() : - Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input". - The memory between input & input+length must be valid (allocated and read-accessible). - "seed" can be used to alter the result predictably. - Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s -XXH64() : - Calculate the 64-bits hash of sequence of length "len" stored at memory address "input". - "seed" can be used to alter the result predictably. - This function runs 2x faster on 64-bits systems, but slower on 32-bits systems (see benchmark). -*/ - - -/* **************************** -* Streaming Hash Functions -******************************/ -typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */ -typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ - -/*! State allocation, compatible with dynamic libraries */ - -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); - -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); - - -/* hash streaming */ - -XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned int seed); -XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); - -XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); - -/* -These functions generate the xxHash of an input provided in multiple segments. -Note that, for small input, they are slower than single-call functions, due to state management. -For small input, prefer `XXH32()` and `XXH64()` . - -XXH state must first be allocated, using XXH*_createState() . - -Start a new hash by initializing state with a seed, using XXH*_reset(). - -Then, feed the hash state by calling XXH*_update() as many times as necessary. -Obviously, input must be allocated and read accessible. -The function returns an error code, with 0 meaning OK, and any other value meaning there is an error. - -Finally, a hash value can be produced anytime, by using XXH*_digest(). -This function returns the nn-bits hash as an int or long long. - -It's still possible to continue inserting input into the hash state after a digest, -and generate some new hashes later on, by calling again XXH*_digest(). - -When done, free XXH state space if it was allocated dynamically. -*/ - - -/* ************************** -* Utils -****************************/ -#if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* ! C99 */ -# define restrict /* disable restrict */ -#endif - -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* restrict dst_state, const XXH32_state_t* restrict src_state); -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* restrict dst_state, const XXH64_state_t* restrict src_state); - - -/* ************************** -* Canonical representation -****************************/ -/* Default result type for XXH functions are primitive unsigned 32 and 64 bits. -* The canonical representation uses human-readable write convention, aka big-endian (large digits first). -* These functions allow transformation of hash result into and from its canonical format. -* This way, hash values can be written into a file / memory, and remain comparable on different systems and programs. -*/ -typedef struct { unsigned char digest[4]; } XXH32_canonical_t; -typedef struct { unsigned char digest[8]; } XXH64_canonical_t; - -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); - -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); - -#endif /* XXHASH_H_5627135585666179 */ - - - -/* ================================================================================================ - This section contains definitions which are not guaranteed to remain stable. - They may change in future versions, becoming incompatible with a different version of the library. - They shall only be used with static linking. - Never use these definitions in association with dynamic linking ! -=================================================================================================== */ -#if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXH_STATIC_H_3543687687345) -#define XXH_STATIC_H_3543687687345 - -/* These definitions are only meant to allow allocation of XXH state - statically, on stack, or in a struct for example. - Do not use members directly. */ - - struct XXH32_state_s { - unsigned total_len_32; - unsigned large_len; - unsigned v1; - unsigned v2; - unsigned v3; - unsigned v4; - unsigned mem32[4]; /* buffer defined as U32 for alignment */ - unsigned memsize; - unsigned reserved; /* never read nor write, will be removed in a future version */ - }; /* typedef'd to XXH32_state_t */ - - struct XXH64_state_s { - unsigned long long total_len; - unsigned long long v1; - unsigned long long v2; - unsigned long long v3; - unsigned long long v4; - unsigned long long mem64[4]; /* buffer defined as U64 for alignment */ - unsigned memsize; - unsigned reserved[2]; /* never read nor write, will be removed in a future version */ - }; /* typedef'd to XXH64_state_t */ - - -# ifdef XXH_PRIVATE_API -# include "xxhash.c" /* include xxhash functions as `static`, for inlining */ -# endif - -#endif /* XXH_STATIC_LINKING_ONLY && XXH_STATIC_H_3543687687345 */ - - -#if defined (__cplusplus) -} -#endif diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_literals.c b/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_literals.c deleted file mode 100644 index 008337b..0000000 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_literals.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - /*-************************************* - * Dependencies - ***************************************/ -#include "zstd_compress_literals.h" - -size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - BYTE* const ostart = (BYTE*)dst; - U32 const flSize = 1 + (srcSize>31) + (srcSize>4095); - - RETURN_ERROR_IF(srcSize + flSize > dstCapacity, dstSize_tooSmall, ""); - - switch(flSize) - { - case 1: /* 2 - 1 - 5 */ - ostart[0] = (BYTE)((U32)set_basic + (srcSize<<3)); - break; - case 2: /* 2 - 2 - 12 */ - MEM_writeLE16(ostart, (U16)((U32)set_basic + (1<<2) + (srcSize<<4))); - break; - case 3: /* 2 - 2 - 20 */ - MEM_writeLE32(ostart, (U32)((U32)set_basic + (3<<2) + (srcSize<<4))); - break; - default: /* not necessary : flSize is {1,2,3} */ - assert(0); - } - - ZSTD_memcpy(ostart + flSize, src, srcSize); - DEBUGLOG(5, "Raw literals: %u -> %u", (U32)srcSize, (U32)(srcSize + flSize)); - return srcSize + flSize; -} - -size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - BYTE* const ostart = (BYTE*)dst; - U32 const flSize = 1 + (srcSize>31) + (srcSize>4095); - - (void)dstCapacity; /* dstCapacity already guaranteed to be >=4, hence large enough */ - - switch(flSize) - { - case 1: /* 2 - 1 - 5 */ - ostart[0] = (BYTE)((U32)set_rle + (srcSize<<3)); - break; - case 2: /* 2 - 2 - 12 */ - MEM_writeLE16(ostart, (U16)((U32)set_rle + (1<<2) + (srcSize<<4))); - break; - case 3: /* 2 - 2 - 20 */ - MEM_writeLE32(ostart, (U32)((U32)set_rle + (3<<2) + (srcSize<<4))); - break; - default: /* not necessary : flSize is {1,2,3} */ - assert(0); - } - - ostart[flSize] = *(const BYTE*)src; - DEBUGLOG(5, "RLE literals: %u -> %u", (U32)srcSize, (U32)flSize + 1); - return flSize+1; -} - -size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf, - ZSTD_hufCTables_t* nextHuf, - ZSTD_strategy strategy, int disableLiteralCompression, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - void* entropyWorkspace, size_t entropyWorkspaceSize, - const int bmi2) -{ - size_t const minGain = ZSTD_minGain(srcSize, strategy); - size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB); - BYTE* const ostart = (BYTE*)dst; - U32 singleStream = srcSize < 256; - symbolEncodingType_e hType = set_compressed; - size_t cLitSize; - - DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i srcSize=%u)", - disableLiteralCompression, (U32)srcSize); - - /* Prepare nextEntropy assuming reusing the existing table */ - ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - - if (disableLiteralCompression) - return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); - - /* small ? don't even attempt compression (speed opt) */ -# define COMPRESS_LITERALS_SIZE_MIN 63 - { size_t const minLitSize = (prevHuf->repeatMode == HUF_repeat_valid) ? 6 : COMPRESS_LITERALS_SIZE_MIN; - if (srcSize <= minLitSize) return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); - } - - RETURN_ERROR_IF(dstCapacity < lhSize+1, dstSize_tooSmall, "not enough space for compression"); - { HUF_repeat repeat = prevHuf->repeatMode; - int const preferRepeat = strategy < ZSTD_lazy ? srcSize <= 1024 : 0; - if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1; - cLitSize = singleStream ? - HUF_compress1X_repeat( - ostart+lhSize, dstCapacity-lhSize, src, srcSize, - HUF_SYMBOLVALUE_MAX, HUF_TABLELOG_DEFAULT, entropyWorkspace, entropyWorkspaceSize, - (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2) : - HUF_compress4X_repeat( - ostart+lhSize, dstCapacity-lhSize, src, srcSize, - HUF_SYMBOLVALUE_MAX, HUF_TABLELOG_DEFAULT, entropyWorkspace, entropyWorkspaceSize, - (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2); - if (repeat != HUF_repeat_none) { - /* reused the existing table */ - DEBUGLOG(5, "Reusing previous huffman table"); - hType = set_repeat; - } - } - - if ((cLitSize==0) || (cLitSize >= srcSize - minGain) || ERR_isError(cLitSize)) { - ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); - } - if (cLitSize==1) { - ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - return ZSTD_compressRleLiteralsBlock(dst, dstCapacity, src, srcSize); - } - - if (hType == set_compressed) { - /* using a newly constructed table */ - nextHuf->repeatMode = HUF_repeat_check; - } - - /* Build header */ - switch(lhSize) - { - case 3: /* 2 - 2 - 10 - 10 */ - { U32 const lhc = hType + ((!singleStream) << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<14); - MEM_writeLE24(ostart, lhc); - break; - } - case 4: /* 2 - 2 - 14 - 14 */ - { U32 const lhc = hType + (2 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<18); - MEM_writeLE32(ostart, lhc); - break; - } - case 5: /* 2 - 2 - 18 - 18 */ - { U32 const lhc = hType + (3 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<22); - MEM_writeLE32(ostart, lhc); - ostart[4] = (BYTE)(cLitSize >> 10); - break; - } - default: /* not possible : lhSize is {3,4,5} */ - assert(0); - } - DEBUGLOG(5, "Compressed literals: %u -> %u", (U32)srcSize, (U32)(lhSize+cLitSize)); - return lhSize+cLitSize; -} diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_fast.c b/src/dependencies/zstd-1.5.0/lib/compress/zstd_fast.c deleted file mode 100644 index 4edc04d..0000000 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_fast.c +++ /dev/null @@ -1,496 +0,0 @@ -/* - * Copyright (c) Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#include "zstd_compress_internal.h" /* ZSTD_hashPtr, ZSTD_count, ZSTD_storeSeq */ -#include "zstd_fast.h" - - -void ZSTD_fillHashTable(ZSTD_matchState_t* ms, - const void* const end, - ZSTD_dictTableLoadMethod_e dtlm) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hBits = cParams->hashLog; - U32 const mls = cParams->minMatch; - const BYTE* const base = ms->window.base; - const BYTE* ip = base + ms->nextToUpdate; - const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE; - const U32 fastHashFillStep = 3; - - /* Always insert every fastHashFillStep position into the hash table. - * Insert the other positions if their hash entry is empty. - */ - for ( ; ip + fastHashFillStep < iend + 2; ip += fastHashFillStep) { - U32 const curr = (U32)(ip - base); - size_t const hash0 = ZSTD_hashPtr(ip, hBits, mls); - hashTable[hash0] = curr; - if (dtlm == ZSTD_dtlm_fast) continue; - /* Only load extra positions for ZSTD_dtlm_full */ - { U32 p; - for (p = 1; p < fastHashFillStep; ++p) { - size_t const hash = ZSTD_hashPtr(ip + p, hBits, mls); - if (hashTable[hash] == 0) { /* not yet filled */ - hashTable[hash] = curr + p; - } } } } -} - - -FORCE_INLINE_TEMPLATE size_t -ZSTD_compressBlock_fast_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, - U32 const mls) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hlog = cParams->hashLog; - /* support stepSize of 0 */ - size_t const stepSize = cParams->targetLength + !(cParams->targetLength) + 1; - const BYTE* const base = ms->window.base; - const BYTE* const istart = (const BYTE*)src; - /* We check ip0 (ip + 0) and ip1 (ip + 1) each loop */ - const BYTE* ip0 = istart; - const BYTE* ip1; - const BYTE* anchor = istart; - const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); - const U32 prefixStartIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog); - const BYTE* const prefixStart = base + prefixStartIndex; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - HASH_READ_SIZE; - U32 offset_1=rep[0], offset_2=rep[1]; - U32 offsetSaved = 0; - - /* init */ - DEBUGLOG(5, "ZSTD_compressBlock_fast_generic"); - ip0 += (ip0 == prefixStart); - ip1 = ip0 + 1; - { U32 const curr = (U32)(ip0 - base); - U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, cParams->windowLog); - U32 const maxRep = curr - windowLow; - if (offset_2 > maxRep) offsetSaved = offset_2, offset_2 = 0; - if (offset_1 > maxRep) offsetSaved = offset_1, offset_1 = 0; - } - - /* Main Search Loop */ -#ifdef __INTEL_COMPILER - /* From intel 'The vector pragma indicates that the loop should be - * vectorized if it is legal to do so'. Can be used together with - * #pragma ivdep (but have opted to exclude that because intel - * warns against using it).*/ - #pragma vector always -#endif - while (ip1 < ilimit) { /* < instead of <=, because check at ip0+2 */ - size_t mLength; - BYTE const* ip2 = ip0 + 2; - size_t const h0 = ZSTD_hashPtr(ip0, hlog, mls); - U32 const val0 = MEM_read32(ip0); - size_t const h1 = ZSTD_hashPtr(ip1, hlog, mls); - U32 const val1 = MEM_read32(ip1); - U32 const current0 = (U32)(ip0-base); - U32 const current1 = (U32)(ip1-base); - U32 const matchIndex0 = hashTable[h0]; - U32 const matchIndex1 = hashTable[h1]; - BYTE const* repMatch = ip2 - offset_1; - const BYTE* match0 = base + matchIndex0; - const BYTE* match1 = base + matchIndex1; - U32 offcode; - -#if defined(__aarch64__) - PREFETCH_L1(ip0+256); -#endif - - hashTable[h0] = current0; /* update hash table */ - hashTable[h1] = current1; /* update hash table */ - - assert(ip0 + 1 == ip1); - - if ((offset_1 > 0) & (MEM_read32(repMatch) == MEM_read32(ip2))) { - mLength = (ip2[-1] == repMatch[-1]) ? 1 : 0; - ip0 = ip2 - mLength; - match0 = repMatch - mLength; - mLength += 4; - offcode = 0; - goto _match; - } - if ((matchIndex0 > prefixStartIndex) && MEM_read32(match0) == val0) { - /* found a regular match */ - goto _offset; - } - if ((matchIndex1 > prefixStartIndex) && MEM_read32(match1) == val1) { - /* found a regular match after one literal */ - ip0 = ip1; - match0 = match1; - goto _offset; - } - { size_t const step = ((size_t)(ip0-anchor) >> (kSearchStrength - 1)) + stepSize; - assert(step >= 2); - ip0 += step; - ip1 += step; - continue; - } -_offset: /* Requires: ip0, match0 */ - /* Compute the offset code */ - offset_2 = offset_1; - offset_1 = (U32)(ip0-match0); - offcode = offset_1 + ZSTD_REP_MOVE; - mLength = 4; - /* Count the backwards match length */ - while (((ip0>anchor) & (match0>prefixStart)) - && (ip0[-1] == match0[-1])) { ip0--; match0--; mLength++; } /* catch up */ - -_match: /* Requires: ip0, match0, offcode */ - /* Count the forward length */ - mLength += ZSTD_count(ip0+mLength, match0+mLength, iend); - ZSTD_storeSeq(seqStore, (size_t)(ip0-anchor), anchor, iend, offcode, mLength-MINMATCH); - /* match found */ - ip0 += mLength; - anchor = ip0; - - if (ip0 <= ilimit) { - /* Fill Table */ - assert(base+current0+2 > istart); /* check base overflow */ - hashTable[ZSTD_hashPtr(base+current0+2, hlog, mls)] = current0+2; /* here because current+2 could be > iend-8 */ - hashTable[ZSTD_hashPtr(ip0-2, hlog, mls)] = (U32)(ip0-2-base); - - if (offset_2 > 0) { /* offset_2==0 means offset_2 is invalidated */ - while ( (ip0 <= ilimit) && (MEM_read32(ip0) == MEM_read32(ip0 - offset_2)) ) { - /* store sequence */ - size_t const rLength = ZSTD_count(ip0+4, ip0+4-offset_2, iend) + 4; - { U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; } /* swap offset_2 <=> offset_1 */ - hashTable[ZSTD_hashPtr(ip0, hlog, mls)] = (U32)(ip0-base); - ip0 += rLength; - ZSTD_storeSeq(seqStore, 0 /*litLen*/, anchor, iend, 0 /*offCode*/, rLength-MINMATCH); - anchor = ip0; - continue; /* faster when present (confirmed on gcc-8) ... (?) */ - } } } - ip1 = ip0 + 1; - } - - /* save reps for next block */ - rep[0] = offset_1 ? offset_1 : offsetSaved; - rep[1] = offset_2 ? offset_2 : offsetSaved; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_fast( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - U32 const mls = ms->cParams.minMatch; - assert(ms->dictMatchState == NULL); - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 4); - case 5 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 5); - case 6 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 6); - case 7 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 7); - } -} - -FORCE_INLINE_TEMPLATE -size_t ZSTD_compressBlock_fast_dictMatchState_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, U32 const mls) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hlog = cParams->hashLog; - /* support stepSize of 0 */ - U32 const stepSize = cParams->targetLength + !(cParams->targetLength); - const BYTE* const base = ms->window.base; - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const U32 prefixStartIndex = ms->window.dictLimit; - const BYTE* const prefixStart = base + prefixStartIndex; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - HASH_READ_SIZE; - U32 offset_1=rep[0], offset_2=rep[1]; - U32 offsetSaved = 0; - - const ZSTD_matchState_t* const dms = ms->dictMatchState; - const ZSTD_compressionParameters* const dictCParams = &dms->cParams ; - const U32* const dictHashTable = dms->hashTable; - const U32 dictStartIndex = dms->window.dictLimit; - const BYTE* const dictBase = dms->window.base; - const BYTE* const dictStart = dictBase + dictStartIndex; - const BYTE* const dictEnd = dms->window.nextSrc; - const U32 dictIndexDelta = prefixStartIndex - (U32)(dictEnd - dictBase); - const U32 dictAndPrefixLength = (U32)(ip - prefixStart + dictEnd - dictStart); - const U32 dictHLog = dictCParams->hashLog; - - /* if a dictionary is still attached, it necessarily means that - * it is within window size. So we just check it. */ - const U32 maxDistance = 1U << cParams->windowLog; - const U32 endIndex = (U32)((size_t)(ip - base) + srcSize); - assert(endIndex - prefixStartIndex <= maxDistance); - (void)maxDistance; (void)endIndex; /* these variables are not used when assert() is disabled */ - - /* ensure there will be no underflow - * when translating a dict index into a local index */ - assert(prefixStartIndex >= (U32)(dictEnd - dictBase)); - - /* init */ - DEBUGLOG(5, "ZSTD_compressBlock_fast_dictMatchState_generic"); - ip += (dictAndPrefixLength == 0); - /* dictMatchState repCode checks don't currently handle repCode == 0 - * disabling. */ - assert(offset_1 <= dictAndPrefixLength); - assert(offset_2 <= dictAndPrefixLength); - - /* Main Search Loop */ - while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */ - size_t mLength; - size_t const h = ZSTD_hashPtr(ip, hlog, mls); - U32 const curr = (U32)(ip-base); - U32 const matchIndex = hashTable[h]; - const BYTE* match = base + matchIndex; - const U32 repIndex = curr + 1 - offset_1; - const BYTE* repMatch = (repIndex < prefixStartIndex) ? - dictBase + (repIndex - dictIndexDelta) : - base + repIndex; - hashTable[h] = curr; /* update hash table */ - - if ( ((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow : ensure repIndex isn't overlapping dict + prefix */ - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; - mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixStart) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); - } else if ( (matchIndex <= prefixStartIndex) ) { - size_t const dictHash = ZSTD_hashPtr(ip, dictHLog, mls); - U32 const dictMatchIndex = dictHashTable[dictHash]; - const BYTE* dictMatch = dictBase + dictMatchIndex; - if (dictMatchIndex <= dictStartIndex || - MEM_read32(dictMatch) != MEM_read32(ip)) { - assert(stepSize >= 1); - ip += ((ip-anchor) >> kSearchStrength) + stepSize; - continue; - } else { - /* found a dict match */ - U32 const offset = (U32)(curr-dictMatchIndex-dictIndexDelta); - mLength = ZSTD_count_2segments(ip+4, dictMatch+4, iend, dictEnd, prefixStart) + 4; - while (((ip>anchor) & (dictMatch>dictStart)) - && (ip[-1] == dictMatch[-1])) { - ip--; dictMatch--; mLength++; - } /* catch up */ - offset_2 = offset_1; - offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - } - } else if (MEM_read32(match) != MEM_read32(ip)) { - /* it's not a match, and we're not going to check the dictionary */ - assert(stepSize >= 1); - ip += ((ip-anchor) >> kSearchStrength) + stepSize; - continue; - } else { - /* found a regular match */ - U32 const offset = (U32)(ip-match); - mLength = ZSTD_count(ip+4, match+4, iend) + 4; - while (((ip>anchor) & (match>prefixStart)) - && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - offset_2 = offset_1; - offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - } - - /* match found */ - ip += mLength; - anchor = ip; - - if (ip <= ilimit) { - /* Fill Table */ - assert(base+curr+2 > istart); /* check base overflow */ - hashTable[ZSTD_hashPtr(base+curr+2, hlog, mls)] = curr+2; /* here because curr+2 could be > iend-8 */ - hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base); - - /* check immediate repcode */ - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex2 = current2 - offset_2; - const BYTE* repMatch2 = repIndex2 < prefixStartIndex ? - dictBase - dictIndexDelta + repIndex2 : - base + repIndex2; - if ( ((U32)((prefixStartIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */) - && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; - size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; - U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, repLength2-MINMATCH); - hashTable[ZSTD_hashPtr(ip, hlog, mls)] = current2; - ip += repLength2; - anchor = ip; - continue; - } - break; - } - } - } - - /* save reps for next block */ - rep[0] = offset_1 ? offset_1 : offsetSaved; - rep[1] = offset_2 ? offset_2 : offsetSaved; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - -size_t ZSTD_compressBlock_fast_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - U32 const mls = ms->cParams.minMatch; - assert(ms->dictMatchState != NULL); - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 4); - case 5 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 5); - case 6 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 6); - case 7 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 7); - } -} - - -static size_t ZSTD_compressBlock_fast_extDict_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, U32 const mls) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hlog = cParams->hashLog; - /* support stepSize of 0 */ - U32 const stepSize = cParams->targetLength + !(cParams->targetLength); - const BYTE* const base = ms->window.base; - const BYTE* const dictBase = ms->window.dictBase; - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); - const U32 lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog); - const U32 dictStartIndex = lowLimit; - const BYTE* const dictStart = dictBase + dictStartIndex; - const U32 dictLimit = ms->window.dictLimit; - const U32 prefixStartIndex = dictLimit < lowLimit ? lowLimit : dictLimit; - const BYTE* const prefixStart = base + prefixStartIndex; - const BYTE* const dictEnd = dictBase + prefixStartIndex; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - 8; - U32 offset_1=rep[0], offset_2=rep[1]; - - DEBUGLOG(5, "ZSTD_compressBlock_fast_extDict_generic (offset_1=%u)", offset_1); - - /* switch to "regular" variant if extDict is invalidated due to maxDistance */ - if (prefixStartIndex == dictStartIndex) - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, mls); - - /* Search Loop */ - while (ip < ilimit) { /* < instead of <=, because (ip+1) */ - const size_t h = ZSTD_hashPtr(ip, hlog, mls); - const U32 matchIndex = hashTable[h]; - const BYTE* const matchBase = matchIndex < prefixStartIndex ? dictBase : base; - const BYTE* match = matchBase + matchIndex; - const U32 curr = (U32)(ip-base); - const U32 repIndex = curr + 1 - offset_1; - const BYTE* const repBase = repIndex < prefixStartIndex ? dictBase : base; - const BYTE* const repMatch = repBase + repIndex; - hashTable[h] = curr; /* update hash table */ - DEBUGLOG(7, "offset_1 = %u , curr = %u", offset_1, curr); - - if ( ( ((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow */ - & (offset_1 < curr+1 - dictStartIndex) ) /* note: we are searching at curr+1 */ - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; - size_t const rLength = ZSTD_count_2segments(ip+1 +4, repMatch +4, iend, repMatchEnd, prefixStart) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, rLength-MINMATCH); - ip += rLength; - anchor = ip; - } else { - if ( (matchIndex < dictStartIndex) || - (MEM_read32(match) != MEM_read32(ip)) ) { - assert(stepSize >= 1); - ip += ((ip-anchor) >> kSearchStrength) + stepSize; - continue; - } - { const BYTE* const matchEnd = matchIndex < prefixStartIndex ? dictEnd : iend; - const BYTE* const lowMatchPtr = matchIndex < prefixStartIndex ? dictStart : prefixStart; - U32 const offset = curr - matchIndex; - size_t mLength = ZSTD_count_2segments(ip+4, match+4, iend, matchEnd, prefixStart) + 4; - while (((ip>anchor) & (match>lowMatchPtr)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - offset_2 = offset_1; offset_1 = offset; /* update offset history */ - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - ip += mLength; - anchor = ip; - } } - - if (ip <= ilimit) { - /* Fill Table */ - hashTable[ZSTD_hashPtr(base+curr+2, hlog, mls)] = curr+2; - hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base); - /* check immediate repcode */ - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex2 = current2 - offset_2; - const BYTE* const repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2; - if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) & (offset_2 < curr - dictStartIndex)) /* intentional overflow */ - && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; - size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; - { U32 const tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; } /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0 /*litlen*/, anchor, iend, 0 /*offcode*/, repLength2-MINMATCH); - hashTable[ZSTD_hashPtr(ip, hlog, mls)] = current2; - ip += repLength2; - anchor = ip; - continue; - } - break; - } } } - - /* save reps for next block */ - rep[0] = offset_1; - rep[1] = offset_2; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_fast_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - U32 const mls = ms->cParams.minMatch; - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 4); - case 5 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 5); - case 6 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 6); - case 7 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 7); - } -} diff --git a/src/dependencies/zstd-1.5.0/lib/decompress/huf_decompress.c b/src/dependencies/zstd-1.5.0/lib/decompress/huf_decompress.c deleted file mode 100644 index b93c9a0..0000000 --- a/src/dependencies/zstd-1.5.0/lib/decompress/huf_decompress.c +++ /dev/null @@ -1,1351 +0,0 @@ -/* ****************************************************************** - * huff0 huffman decoder, - * part of Finite State Entropy library - * Copyright (c) Yann Collet, Facebook, Inc. - * - * You can contact the author at : - * - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. -****************************************************************** */ - -/* ************************************************************** -* Dependencies -****************************************************************/ -#include "../common/zstd_deps.h" /* ZSTD_memcpy, ZSTD_memset */ -#include "../common/compiler.h" -#include "../common/bitstream.h" /* BIT_* */ -#include "../common/fse.h" /* to compress headers */ -#define HUF_STATIC_LINKING_ONLY -#include "../common/huf.h" -#include "../common/error_private.h" - -/* ************************************************************** -* Macros -****************************************************************/ - -/* These two optional macros force the use one way or another of the two - * Huffman decompression implementations. You can't force in both directions - * at the same time. - */ -#if defined(HUF_FORCE_DECOMPRESS_X1) && \ - defined(HUF_FORCE_DECOMPRESS_X2) -#error "Cannot force the use of the X1 and X2 decoders at the same time!" -#endif - - -/* ************************************************************** -* Error Management -****************************************************************/ -#define HUF_isError ERR_isError - - -/* ************************************************************** -* Byte alignment for workSpace management -****************************************************************/ -#define HUF_ALIGN(x, a) HUF_ALIGN_MASK((x), (a) - 1) -#define HUF_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) - - -/* ************************************************************** -* BMI2 Variant Wrappers -****************************************************************/ -#if DYNAMIC_BMI2 - -#define HUF_DGEN(fn) \ - \ - static size_t fn##_default( \ - void* dst, size_t dstSize, \ - const void* cSrc, size_t cSrcSize, \ - const HUF_DTable* DTable) \ - { \ - return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ - } \ - \ - static TARGET_ATTRIBUTE("bmi2") size_t fn##_bmi2( \ - void* dst, size_t dstSize, \ - const void* cSrc, size_t cSrcSize, \ - const HUF_DTable* DTable) \ - { \ - return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ - } \ - \ - static size_t fn(void* dst, size_t dstSize, void const* cSrc, \ - size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \ - { \ - if (bmi2) { \ - return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); \ - } \ - return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable); \ - } - -#else - -#define HUF_DGEN(fn) \ - static size_t fn(void* dst, size_t dstSize, void const* cSrc, \ - size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \ - { \ - (void)bmi2; \ - return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ - } - -#endif - - -/*-***************************/ -/* generic DTableDesc */ -/*-***************************/ -typedef struct { BYTE maxTableLog; BYTE tableType; BYTE tableLog; BYTE reserved; } DTableDesc; - -static DTableDesc HUF_getDTableDesc(const HUF_DTable* table) -{ - DTableDesc dtd; - ZSTD_memcpy(&dtd, table, sizeof(dtd)); - return dtd; -} - - -#ifndef HUF_FORCE_DECOMPRESS_X2 - -/*-***************************/ -/* single-symbol decoding */ -/*-***************************/ -typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX1; /* single-symbol decoding */ - -/** - * Packs 4 HUF_DEltX1 structs into a U64. This is used to lay down 4 entries at - * a time. - */ -static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) { - U64 D4; - if (MEM_isLittleEndian()) { - D4 = symbol + (nbBits << 8); - } else { - D4 = (symbol << 8) + nbBits; - } - D4 *= 0x0001000100010001ULL; - return D4; -} - -typedef struct { - U32 rankVal[HUF_TABLELOG_ABSOLUTEMAX + 1]; - U32 rankStart[HUF_TABLELOG_ABSOLUTEMAX + 1]; - U32 statsWksp[HUF_READ_STATS_WORKSPACE_SIZE_U32]; - BYTE symbols[HUF_SYMBOLVALUE_MAX + 1]; - BYTE huffWeight[HUF_SYMBOLVALUE_MAX + 1]; -} HUF_ReadDTableX1_Workspace; - - -size_t HUF_readDTableX1_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize) -{ - return HUF_readDTableX1_wksp_bmi2(DTable, src, srcSize, workSpace, wkspSize, /* bmi2 */ 0); -} - -size_t HUF_readDTableX1_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int bmi2) -{ - U32 tableLog = 0; - U32 nbSymbols = 0; - size_t iSize; - void* const dtPtr = DTable + 1; - HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr; - HUF_ReadDTableX1_Workspace* wksp = (HUF_ReadDTableX1_Workspace*)workSpace; - - DEBUG_STATIC_ASSERT(HUF_DECOMPRESS_WORKSPACE_SIZE >= sizeof(*wksp)); - if (sizeof(*wksp) > wkspSize) return ERROR(tableLog_tooLarge); - - DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable)); - /* ZSTD_memset(huffWeight, 0, sizeof(huffWeight)); */ /* is not necessary, even though some analyzer complain ... */ - - iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), bmi2); - if (HUF_isError(iSize)) return iSize; - - /* Table header */ - { DTableDesc dtd = HUF_getDTableDesc(DTable); - if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge); /* DTable too small, Huffman tree cannot fit in */ - dtd.tableType = 0; - dtd.tableLog = (BYTE)tableLog; - ZSTD_memcpy(DTable, &dtd, sizeof(dtd)); - } - - /* Compute symbols and rankStart given rankVal: - * - * rankVal already contains the number of values of each weight. - * - * symbols contains the symbols ordered by weight. First are the rankVal[0] - * weight 0 symbols, followed by the rankVal[1] weight 1 symbols, and so on. - * symbols[0] is filled (but unused) to avoid a branch. - * - * rankStart contains the offset where each rank belongs in the DTable. - * rankStart[0] is not filled because there are no entries in the table for - * weight 0. - */ - { - int n; - int nextRankStart = 0; - int const unroll = 4; - int const nLimit = (int)nbSymbols - unroll + 1; - for (n=0; n<(int)tableLog+1; n++) { - U32 const curr = nextRankStart; - nextRankStart += wksp->rankVal[n]; - wksp->rankStart[n] = curr; - } - for (n=0; n < nLimit; n += unroll) { - int u; - for (u=0; u < unroll; ++u) { - size_t const w = wksp->huffWeight[n+u]; - wksp->symbols[wksp->rankStart[w]++] = (BYTE)(n+u); - } - } - for (; n < (int)nbSymbols; ++n) { - size_t const w = wksp->huffWeight[n]; - wksp->symbols[wksp->rankStart[w]++] = (BYTE)n; - } - } - - /* fill DTable - * We fill all entries of each weight in order. - * That way length is a constant for each iteration of the outter loop. - * We can switch based on the length to a different inner loop which is - * optimized for that particular case. - */ - { - U32 w; - int symbol=wksp->rankVal[0]; - int rankStart=0; - for (w=1; wrankVal[w]; - int const length = (1 << w) >> 1; - int uStart = rankStart; - BYTE const nbBits = (BYTE)(tableLog + 1 - w); - int s; - int u; - switch (length) { - case 1: - for (s=0; ssymbols[symbol + s]; - D.nbBits = nbBits; - dt[uStart] = D; - uStart += 1; - } - break; - case 2: - for (s=0; ssymbols[symbol + s]; - D.nbBits = nbBits; - dt[uStart+0] = D; - dt[uStart+1] = D; - uStart += 2; - } - break; - case 4: - for (s=0; ssymbols[symbol + s], nbBits); - MEM_write64(dt + uStart, D4); - uStart += 4; - } - break; - case 8: - for (s=0; ssymbols[symbol + s], nbBits); - MEM_write64(dt + uStart, D4); - MEM_write64(dt + uStart + 4, D4); - uStart += 8; - } - break; - default: - for (s=0; ssymbols[symbol + s], nbBits); - for (u=0; u < length; u += 16) { - MEM_write64(dt + uStart + u + 0, D4); - MEM_write64(dt + uStart + u + 4, D4); - MEM_write64(dt + uStart + u + 8, D4); - MEM_write64(dt + uStart + u + 12, D4); - } - assert(u == length); - uStart += length; - } - break; - } - symbol += symbolCount; - rankStart += symbolCount * length; - } - } - return iSize; -} - -FORCE_INLINE_TEMPLATE BYTE -HUF_decodeSymbolX1(BIT_DStream_t* Dstream, const HUF_DEltX1* dt, const U32 dtLog) -{ - size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */ - BYTE const c = dt[val].byte; - BIT_skipBits(Dstream, dt[val].nbBits); - return c; -} - -#define HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) \ - *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX1_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ - HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) - -#define HUF_DECODE_SYMBOLX1_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) - -HINT_INLINE size_t -HUF_decodeStreamX1(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX1* const dt, const U32 dtLog) -{ - BYTE* const pStart = p; - - /* up to 4 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) { - HUF_DECODE_SYMBOLX1_2(p, bitDPtr); - HUF_DECODE_SYMBOLX1_1(p, bitDPtr); - HUF_DECODE_SYMBOLX1_2(p, bitDPtr); - HUF_DECODE_SYMBOLX1_0(p, bitDPtr); - } - - /* [0-3] symbols remaining */ - if (MEM_32bits()) - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd)) - HUF_DECODE_SYMBOLX1_0(p, bitDPtr); - - /* no more data to retrieve from bitstream, no need to reload */ - while (p < pEnd) - HUF_DECODE_SYMBOLX1_0(p, bitDPtr); - - return pEnd-pStart; -} - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress1X1_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - BYTE* op = (BYTE*)dst; - BYTE* const oend = op + dstSize; - const void* dtPtr = DTable + 1; - const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr; - BIT_DStream_t bitD; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - U32 const dtLog = dtd.tableLog; - - CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) ); - - HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog); - - if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected); - - return dstSize; -} - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress4X1_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - /* Check */ - if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ - - { const BYTE* const istart = (const BYTE*) cSrc; - BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - BYTE* const olimit = oend - 3; - const void* const dtPtr = DTable + 1; - const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr; - - /* Init */ - BIT_DStream_t bitD1; - BIT_DStream_t bitD2; - BIT_DStream_t bitD3; - BIT_DStream_t bitD4; - size_t const length1 = MEM_readLE16(istart); - size_t const length2 = MEM_readLE16(istart+2); - size_t const length3 = MEM_readLE16(istart+4); - size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6); - const BYTE* const istart1 = istart + 6; /* jumpTable */ - const BYTE* const istart2 = istart1 + length1; - const BYTE* const istart3 = istart2 + length2; - const BYTE* const istart4 = istart3 + length3; - const size_t segmentSize = (dstSize+3) / 4; - BYTE* const opStart2 = ostart + segmentSize; - BYTE* const opStart3 = opStart2 + segmentSize; - BYTE* const opStart4 = opStart3 + segmentSize; - BYTE* op1 = ostart; - BYTE* op2 = opStart2; - BYTE* op3 = opStart3; - BYTE* op4 = opStart4; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - U32 const dtLog = dtd.tableLog; - U32 endSignal = 1; - - if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ - CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); - CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); - CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); - CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); - - /* up to 16 symbols per loop (4 symbols per stream) in 64-bit mode */ - for ( ; (endSignal) & (op4 < olimit) ; ) { - HUF_DECODE_SYMBOLX1_2(op1, &bitD1); - HUF_DECODE_SYMBOLX1_2(op2, &bitD2); - HUF_DECODE_SYMBOLX1_2(op3, &bitD3); - HUF_DECODE_SYMBOLX1_2(op4, &bitD4); - HUF_DECODE_SYMBOLX1_1(op1, &bitD1); - HUF_DECODE_SYMBOLX1_1(op2, &bitD2); - HUF_DECODE_SYMBOLX1_1(op3, &bitD3); - HUF_DECODE_SYMBOLX1_1(op4, &bitD4); - HUF_DECODE_SYMBOLX1_2(op1, &bitD1); - HUF_DECODE_SYMBOLX1_2(op2, &bitD2); - HUF_DECODE_SYMBOLX1_2(op3, &bitD3); - HUF_DECODE_SYMBOLX1_2(op4, &bitD4); - HUF_DECODE_SYMBOLX1_0(op1, &bitD1); - HUF_DECODE_SYMBOLX1_0(op2, &bitD2); - HUF_DECODE_SYMBOLX1_0(op3, &bitD3); - HUF_DECODE_SYMBOLX1_0(op4, &bitD4); - endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; - } - - /* check corruption */ - /* note : should not be necessary : op# advance in lock step, and we control op4. - * but curiously, binary generated by gcc 7.2 & 7.3 with -mbmi2 runs faster when >=1 test is present */ - if (op1 > opStart2) return ERROR(corruption_detected); - if (op2 > opStart3) return ERROR(corruption_detected); - if (op3 > opStart4) return ERROR(corruption_detected); - /* note : op4 supposed already verified within main loop */ - - /* finish bitStreams one by one */ - HUF_decodeStreamX1(op1, &bitD1, opStart2, dt, dtLog); - HUF_decodeStreamX1(op2, &bitD2, opStart3, dt, dtLog); - HUF_decodeStreamX1(op3, &bitD3, opStart4, dt, dtLog); - HUF_decodeStreamX1(op4, &bitD4, oend, dt, dtLog); - - /* check */ - { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); - if (!endCheck) return ERROR(corruption_detected); } - - /* decoded size */ - return dstSize; - } -} - - -typedef size_t (*HUF_decompress_usingDTable_t)(void *dst, size_t dstSize, - const void *cSrc, - size_t cSrcSize, - const HUF_DTable *DTable); - -HUF_DGEN(HUF_decompress1X1_usingDTable_internal) -HUF_DGEN(HUF_decompress4X1_usingDTable_internal) - - - -size_t HUF_decompress1X1_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 0) return ERROR(GENERIC); - return HUF_decompress1X1_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX1_wksp(DCtx, cSrc, cSrcSize, workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx, /* bmi2 */ 0); -} - - -size_t HUF_decompress4X1_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 0) return ERROR(GENERIC); - return HUF_decompress4X1_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -static size_t HUF_decompress4X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize, int bmi2) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX1_wksp_bmi2(dctx, cSrc, cSrcSize, workSpace, wkspSize, bmi2); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress4X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2); -} - -size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - return HUF_decompress4X1_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, 0); -} - - -#endif /* HUF_FORCE_DECOMPRESS_X2 */ - - -#ifndef HUF_FORCE_DECOMPRESS_X1 - -/* *************************/ -/* double-symbols decoding */ -/* *************************/ - -typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX2; /* double-symbols decoding */ -typedef struct { BYTE symbol; BYTE weight; } sortedSymbol_t; -typedef U32 rankValCol_t[HUF_TABLELOG_MAX + 1]; -typedef rankValCol_t rankVal_t[HUF_TABLELOG_MAX]; - - -/* HUF_fillDTableX2Level2() : - * `rankValOrigin` must be a table of at least (HUF_TABLELOG_MAX + 1) U32 */ -static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed, - const U32* rankValOrigin, const int minWeight, - const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, - U32 nbBitsBaseline, U16 baseSeq, U32* wksp, size_t wkspSize) -{ - HUF_DEltX2 DElt; - U32* rankVal = wksp; - - assert(wkspSize >= HUF_TABLELOG_MAX + 1); - (void)wkspSize; - /* get pre-calculated rankVal */ - ZSTD_memcpy(rankVal, rankValOrigin, sizeof(U32) * (HUF_TABLELOG_MAX + 1)); - - /* fill skipped values */ - if (minWeight>1) { - U32 i, skipSize = rankVal[minWeight]; - MEM_writeLE16(&(DElt.sequence), baseSeq); - DElt.nbBits = (BYTE)(consumed); - DElt.length = 1; - for (i = 0; i < skipSize; i++) - DTable[i] = DElt; - } - - /* fill DTable */ - { U32 s; for (s=0; s= 1 */ - - rankVal[weight] += length; - } } -} - - -static void HUF_fillDTableX2(HUF_DEltX2* DTable, const U32 targetLog, - const sortedSymbol_t* sortedList, const U32 sortedListSize, - const U32* rankStart, rankVal_t rankValOrigin, const U32 maxWeight, - const U32 nbBitsBaseline, U32* wksp, size_t wkspSize) -{ - U32* rankVal = wksp; - const int scaleLog = nbBitsBaseline - targetLog; /* note : targetLog >= srcLog, hence scaleLog <= 1 */ - const U32 minBits = nbBitsBaseline - maxWeight; - U32 s; - - assert(wkspSize >= HUF_TABLELOG_MAX + 1); - wksp += HUF_TABLELOG_MAX + 1; - wkspSize -= HUF_TABLELOG_MAX + 1; - - ZSTD_memcpy(rankVal, rankValOrigin, sizeof(U32) * (HUF_TABLELOG_MAX + 1)); - - /* fill DTable */ - for (s=0; s= minBits) { /* enough room for a second symbol */ - U32 sortedRank; - int minWeight = nbBits + scaleLog; - if (minWeight < 1) minWeight = 1; - sortedRank = rankStart[minWeight]; - HUF_fillDTableX2Level2(DTable+start, targetLog-nbBits, nbBits, - rankValOrigin[nbBits], minWeight, - sortedList+sortedRank, sortedListSize-sortedRank, - nbBitsBaseline, symbol, wksp, wkspSize); - } else { - HUF_DEltX2 DElt; - MEM_writeLE16(&(DElt.sequence), symbol); - DElt.nbBits = (BYTE)(nbBits); - DElt.length = 1; - { U32 const end = start + length; - U32 u; - for (u = start; u < end; u++) DTable[u] = DElt; - } } - rankVal[weight] += length; - } -} - -typedef struct { - rankValCol_t rankVal[HUF_TABLELOG_MAX]; - U32 rankStats[HUF_TABLELOG_MAX + 1]; - U32 rankStart0[HUF_TABLELOG_MAX + 2]; - sortedSymbol_t sortedSymbol[HUF_SYMBOLVALUE_MAX + 1]; - BYTE weightList[HUF_SYMBOLVALUE_MAX + 1]; - U32 calleeWksp[HUF_READ_STATS_WORKSPACE_SIZE_U32]; -} HUF_ReadDTableX2_Workspace; - -size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, - const void* src, size_t srcSize, - void* workSpace, size_t wkspSize) -{ - U32 tableLog, maxW, sizeOfSort, nbSymbols; - DTableDesc dtd = HUF_getDTableDesc(DTable); - U32 const maxTableLog = dtd.maxTableLog; - size_t iSize; - void* dtPtr = DTable+1; /* force compiler to avoid strict-aliasing */ - HUF_DEltX2* const dt = (HUF_DEltX2*)dtPtr; - U32 *rankStart; - - HUF_ReadDTableX2_Workspace* const wksp = (HUF_ReadDTableX2_Workspace*)workSpace; - - if (sizeof(*wksp) > wkspSize) return ERROR(GENERIC); - - rankStart = wksp->rankStart0 + 1; - ZSTD_memset(wksp->rankStats, 0, sizeof(wksp->rankStats)); - ZSTD_memset(wksp->rankStart0, 0, sizeof(wksp->rankStart0)); - - DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(HUF_DTable)); /* if compiler fails here, assertion is wrong */ - if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); - /* ZSTD_memset(weightList, 0, sizeof(weightList)); */ /* is not necessary, even though some analyzer complain ... */ - - iSize = HUF_readStats_wksp(wksp->weightList, HUF_SYMBOLVALUE_MAX + 1, wksp->rankStats, &nbSymbols, &tableLog, src, srcSize, wksp->calleeWksp, sizeof(wksp->calleeWksp), /* bmi2 */ 0); - if (HUF_isError(iSize)) return iSize; - - /* check result */ - if (tableLog > maxTableLog) return ERROR(tableLog_tooLarge); /* DTable can't fit code depth */ - - /* find maxWeight */ - for (maxW = tableLog; wksp->rankStats[maxW]==0; maxW--) {} /* necessarily finds a solution before 0 */ - - /* Get start index of each weight */ - { U32 w, nextRankStart = 0; - for (w=1; wrankStats[w]; - rankStart[w] = curr; - } - rankStart[0] = nextRankStart; /* put all 0w symbols at the end of sorted list*/ - sizeOfSort = nextRankStart; - } - - /* sort symbols by weight */ - { U32 s; - for (s=0; sweightList[s]; - U32 const r = rankStart[w]++; - wksp->sortedSymbol[r].symbol = (BYTE)s; - wksp->sortedSymbol[r].weight = (BYTE)w; - } - rankStart[0] = 0; /* forget 0w symbols; this is beginning of weight(1) */ - } - - /* Build rankVal */ - { U32* const rankVal0 = wksp->rankVal[0]; - { int const rescale = (maxTableLog-tableLog) - 1; /* tableLog <= maxTableLog */ - U32 nextRankVal = 0; - U32 w; - for (w=1; wrankStats[w] << (w+rescale); - rankVal0[w] = curr; - } } - { U32 const minBits = tableLog+1 - maxW; - U32 consumed; - for (consumed = minBits; consumed < maxTableLog - minBits + 1; consumed++) { - U32* const rankValPtr = wksp->rankVal[consumed]; - U32 w; - for (w = 1; w < maxW+1; w++) { - rankValPtr[w] = rankVal0[w] >> consumed; - } } } } - - HUF_fillDTableX2(dt, maxTableLog, - wksp->sortedSymbol, sizeOfSort, - wksp->rankStart0, wksp->rankVal, maxW, - tableLog+1, - wksp->calleeWksp, sizeof(wksp->calleeWksp) / sizeof(U32)); - - dtd.tableLog = (BYTE)maxTableLog; - dtd.tableType = 1; - ZSTD_memcpy(DTable, &dtd, sizeof(dtd)); - return iSize; -} - - -FORCE_INLINE_TEMPLATE U32 -HUF_decodeSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) -{ - size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - ZSTD_memcpy(op, dt+val, 2); - BIT_skipBits(DStream, dt[val].nbBits); - return dt[val].length; -} - -FORCE_INLINE_TEMPLATE U32 -HUF_decodeLastSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) -{ - size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - ZSTD_memcpy(op, dt+val, 1); - if (dt[val].length==1) BIT_skipBits(DStream, dt[val].nbBits); - else { - if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) { - BIT_skipBits(DStream, dt[val].nbBits); - if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8)) - /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */ - DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8); - } } - return 1; -} - -#define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) - -HINT_INLINE size_t -HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, - const HUF_DEltX2* const dt, const U32 dtLog) -{ - BYTE* const pStart = p; - - /* up to 8 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) { - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_1(p, bitDPtr); - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - } - - /* closer to end : up to 2 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2)) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - - while (p <= pEnd-2) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); /* no need to reload : reached the end of DStream */ - - if (p < pEnd) - p += HUF_decodeLastSymbolX2(p, bitDPtr, dt, dtLog); - - return p-pStart; -} - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress1X2_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - BIT_DStream_t bitD; - - /* Init */ - CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) ); - - /* decode */ - { BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - const void* const dtPtr = DTable+1; /* force compiler to not use strict-aliasing */ - const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - HUF_decodeStreamX2(ostart, &bitD, oend, dt, dtd.tableLog); - } - - /* check */ - if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected); - - /* decoded size */ - return dstSize; -} - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress4X2_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ - - { const BYTE* const istart = (const BYTE*) cSrc; - BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - BYTE* const olimit = oend - (sizeof(size_t)-1); - const void* const dtPtr = DTable+1; - const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr; - - /* Init */ - BIT_DStream_t bitD1; - BIT_DStream_t bitD2; - BIT_DStream_t bitD3; - BIT_DStream_t bitD4; - size_t const length1 = MEM_readLE16(istart); - size_t const length2 = MEM_readLE16(istart+2); - size_t const length3 = MEM_readLE16(istart+4); - size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6); - const BYTE* const istart1 = istart + 6; /* jumpTable */ - const BYTE* const istart2 = istart1 + length1; - const BYTE* const istart3 = istart2 + length2; - const BYTE* const istart4 = istart3 + length3; - size_t const segmentSize = (dstSize+3) / 4; - BYTE* const opStart2 = ostart + segmentSize; - BYTE* const opStart3 = opStart2 + segmentSize; - BYTE* const opStart4 = opStart3 + segmentSize; - BYTE* op1 = ostart; - BYTE* op2 = opStart2; - BYTE* op3 = opStart3; - BYTE* op4 = opStart4; - U32 endSignal = 1; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - U32 const dtLog = dtd.tableLog; - - if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ - CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); - CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); - CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); - CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); - - /* 16-32 symbols per loop (4-8 symbols per stream) */ - for ( ; (endSignal) & (op4 < olimit); ) { -#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_1(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_0(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_1(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_0(op2, &bitD2); - endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_1(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_0(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_1(op4, &bitD4); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_0(op4, &bitD4); - endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; -#else - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_1(op1, &bitD1); - HUF_DECODE_SYMBOLX2_1(op2, &bitD2); - HUF_DECODE_SYMBOLX2_1(op3, &bitD3); - HUF_DECODE_SYMBOLX2_1(op4, &bitD4); - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_0(op1, &bitD1); - HUF_DECODE_SYMBOLX2_0(op2, &bitD2); - HUF_DECODE_SYMBOLX2_0(op3, &bitD3); - HUF_DECODE_SYMBOLX2_0(op4, &bitD4); - endSignal = (U32)LIKELY( - (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished) - & (BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished) - & (BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished) - & (BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished)); -#endif - } - - /* check corruption */ - if (op1 > opStart2) return ERROR(corruption_detected); - if (op2 > opStart3) return ERROR(corruption_detected); - if (op3 > opStart4) return ERROR(corruption_detected); - /* note : op4 already verified within main loop */ - - /* finish bitStreams one by one */ - HUF_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog); - HUF_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog); - HUF_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog); - HUF_decodeStreamX2(op4, &bitD4, oend, dt, dtLog); - - /* check */ - { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); - if (!endCheck) return ERROR(corruption_detected); } - - /* decoded size */ - return dstSize; - } -} - -HUF_DGEN(HUF_decompress1X2_usingDTable_internal) -HUF_DGEN(HUF_decompress4X2_usingDTable_internal) - -size_t HUF_decompress1X2_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 1) return ERROR(GENERIC); - return HUF_decompress1X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX2_wksp(DCtx, cSrc, cSrcSize, - workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress1X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx, /* bmi2 */ 0); -} - - -size_t HUF_decompress4X2_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 1) return ERROR(GENERIC); - return HUF_decompress4X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -static size_t HUF_decompress4X2_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize, int bmi2) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t hSize = HUF_readDTableX2_wksp(dctx, cSrc, cSrcSize, - workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress4X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2); -} - -size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - return HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, /* bmi2 */ 0); -} - - -#endif /* HUF_FORCE_DECOMPRESS_X1 */ - - -/* ***********************************/ -/* Universal decompression selectors */ -/* ***********************************/ - -size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#else - return dtd.tableType ? HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0) : - HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#endif -} - -size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#else - return dtd.tableType ? HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0) : - HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#endif -} - - -#if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2) -typedef struct { U32 tableTime; U32 decode256Time; } algo_time_t; -static const algo_time_t algoTime[16 /* Quantization */][3 /* single, double, quad */] = -{ - /* single, double, quad */ - {{0,0}, {1,1}, {2,2}}, /* Q==0 : impossible */ - {{0,0}, {1,1}, {2,2}}, /* Q==1 : impossible */ - {{ 38,130}, {1313, 74}, {2151, 38}}, /* Q == 2 : 12-18% */ - {{ 448,128}, {1353, 74}, {2238, 41}}, /* Q == 3 : 18-25% */ - {{ 556,128}, {1353, 74}, {2238, 47}}, /* Q == 4 : 25-32% */ - {{ 714,128}, {1418, 74}, {2436, 53}}, /* Q == 5 : 32-38% */ - {{ 883,128}, {1437, 74}, {2464, 61}}, /* Q == 6 : 38-44% */ - {{ 897,128}, {1515, 75}, {2622, 68}}, /* Q == 7 : 44-50% */ - {{ 926,128}, {1613, 75}, {2730, 75}}, /* Q == 8 : 50-56% */ - {{ 947,128}, {1729, 77}, {3359, 77}}, /* Q == 9 : 56-62% */ - {{1107,128}, {2083, 81}, {4006, 84}}, /* Q ==10 : 62-69% */ - {{1177,128}, {2379, 87}, {4785, 88}}, /* Q ==11 : 69-75% */ - {{1242,128}, {2415, 93}, {5155, 84}}, /* Q ==12 : 75-81% */ - {{1349,128}, {2644,106}, {5260,106}}, /* Q ==13 : 81-87% */ - {{1455,128}, {2422,124}, {4174,124}}, /* Q ==14 : 87-93% */ - {{ 722,128}, {1891,145}, {1936,146}}, /* Q ==15 : 93-99% */ -}; -#endif - -/** HUF_selectDecoder() : - * Tells which decoder is likely to decode faster, - * based on a set of pre-computed metrics. - * @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 . - * Assumption : 0 < dstSize <= 128 KB */ -U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize) -{ - assert(dstSize > 0); - assert(dstSize <= 128*1024); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dstSize; - (void)cSrcSize; - return 0; -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dstSize; - (void)cSrcSize; - return 1; -#else - /* decoder timing evaluation */ - { U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize); /* Q < 16 */ - U32 const D256 = (U32)(dstSize >> 8); - U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256); - U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256); - DTime1 += DTime1 >> 3; /* advantage to algorithm using less memory, to reduce cache eviction */ - return DTime1 < DTime0; - } -#endif -} - - -size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, - size_t dstSize, const void* cSrc, - size_t cSrcSize, void* workSpace, - size_t wkspSize) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize == 0) return ERROR(corruption_detected); - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize); -#else - return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize): - HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize); -#endif - } -} - -size_t HUF_decompress1X_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize > dstSize) return ERROR(corruption_detected); /* invalid */ - if (cSrcSize == dstSize) { ZSTD_memcpy(dst, cSrc, dstSize); return dstSize; } /* not compressed */ - if (cSrcSize == 1) { ZSTD_memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; } /* RLE */ - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress1X1_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress1X2_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize); -#else - return algoNb ? HUF_decompress1X2_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize): - HUF_decompress1X1_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize); -#endif - } -} - - -size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#else - return dtd.tableType ? HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) : - HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#endif -} - -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX1_wksp_bmi2(dctx, cSrc, cSrcSize, workSpace, wkspSize, bmi2); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2); -} -#endif - -size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#else - return dtd.tableType ? HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) : - HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#endif -} - -size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize == 0) return ERROR(corruption_detected); - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2); -#else - return algoNb ? HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2) : - HUF_decompress4X1_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2); -#endif - } -} - -#ifndef ZSTD_NO_UNUSED_FUNCTIONS -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_readDTableX1(HUF_DTable* DTable, const void* src, size_t srcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_readDTableX1_wksp(DTable, src, srcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress1X1_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress1X1_DCtx_wksp(DCtx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX); - return HUF_decompress1X1_DCtx (DTable, dst, dstSize, cSrc, cSrcSize); -} -#endif - -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_readDTableX2(HUF_DTable* DTable, const void* src, size_t srcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_readDTableX2_wksp(DTable, src, srcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress1X2_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress1X2_DCtx_wksp(DCtx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX); - return HUF_decompress1X2_DCtx(DTable, dst, dstSize, cSrc, cSrcSize); -} -#endif - -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress4X1_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} -size_t HUF_decompress4X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX); - return HUF_decompress4X1_DCtx(DTable, dst, dstSize, cSrc, cSrcSize); -} -#endif - -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress4X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX); - return HUF_decompress4X2_DCtx(DTable, dst, dstSize, cSrc, cSrcSize); -} -#endif - -typedef size_t (*decompressionAlgo)(void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); - -size_t HUF_decompress (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ -#if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2) - static const decompressionAlgo decompress[2] = { HUF_decompress4X1, HUF_decompress4X2 }; -#endif - - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize > dstSize) return ERROR(corruption_detected); /* invalid */ - if (cSrcSize == dstSize) { ZSTD_memcpy(dst, cSrc, dstSize); return dstSize; } /* not compressed */ - if (cSrcSize == 1) { ZSTD_memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; } /* RLE */ - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1(dst, dstSize, cSrc, cSrcSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2(dst, dstSize, cSrc, cSrcSize); -#else - return decompress[algoNb](dst, dstSize, cSrc, cSrcSize); -#endif - } -} - -size_t HUF_decompress4X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize > dstSize) return ERROR(corruption_detected); /* invalid */ - if (cSrcSize == dstSize) { ZSTD_memcpy(dst, cSrc, dstSize); return dstSize; } /* not compressed */ - if (cSrcSize == 1) { ZSTD_memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; } /* RLE */ - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1_DCtx(dctx, dst, dstSize, cSrc, cSrcSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2_DCtx(dctx, dst, dstSize, cSrc, cSrcSize); -#else - return algoNb ? HUF_decompress4X2_DCtx(dctx, dst, dstSize, cSrc, cSrcSize) : - HUF_decompress4X1_DCtx(dctx, dst, dstSize, cSrc, cSrcSize) ; -#endif - } -} - -size_t HUF_decompress4X_hufOnly(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress4X_hufOnly_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress1X_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress1X_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} -#endif diff --git a/src/dependencies/zstd-1.5.0/programs/timefn.c b/src/dependencies/zstd-1.5.0/programs/timefn.c deleted file mode 100644 index 64577b0..0000000 --- a/src/dependencies/zstd-1.5.0/programs/timefn.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -/* === Dependencies === */ - -#include "timefn.h" - - -/*-**************************************** -* Time functions -******************************************/ - -#if defined(_WIN32) /* Windows */ - -#include /* abort */ -#include /* perror */ - -UTIL_time_t UTIL_getTime(void) { UTIL_time_t x; QueryPerformanceCounter(&x); return x; } - -PTime UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd) -{ - static LARGE_INTEGER ticksPerSecond; - static int init = 0; - if (!init) { - if (!QueryPerformanceFrequency(&ticksPerSecond)) { - perror("timefn::QueryPerformanceFrequency"); - abort(); - } - init = 1; - } - return 1000000ULL*(clockEnd.QuadPart - clockStart.QuadPart)/ticksPerSecond.QuadPart; -} - -PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) -{ - static LARGE_INTEGER ticksPerSecond; - static int init = 0; - if (!init) { - if (!QueryPerformanceFrequency(&ticksPerSecond)) { - perror("timefn::QueryPerformanceFrequency"); - abort(); - } - init = 1; - } - return 1000000000ULL*(clockEnd.QuadPart - clockStart.QuadPart)/ticksPerSecond.QuadPart; -} - - - -#elif defined(__APPLE__) && defined(__MACH__) - -UTIL_time_t UTIL_getTime(void) { return mach_absolute_time(); } - -PTime UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd) -{ - static mach_timebase_info_data_t rate; - static int init = 0; - if (!init) { - mach_timebase_info(&rate); - init = 1; - } - return (((clockEnd - clockStart) * (PTime)rate.numer) / ((PTime)rate.denom))/1000ULL; -} - -PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) -{ - static mach_timebase_info_data_t rate; - static int init = 0; - if (!init) { - mach_timebase_info(&rate); - init = 1; - } - return ((clockEnd - clockStart) * (PTime)rate.numer) / ((PTime)rate.denom); -} - - -/* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance. - Android also lacks it but does define TIME_UTC. */ -#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \ - && defined(TIME_UTC) && !defined(__ANDROID__) - -#include /* abort */ -#include /* perror */ - -UTIL_time_t UTIL_getTime(void) -{ - /* time must be initialized, othersize it may fail msan test. - * No good reason, likely a limitation of timespec_get() for some target */ - UTIL_time_t time = UTIL_TIME_INITIALIZER; - if (timespec_get(&time, TIME_UTC) != TIME_UTC) { - perror("timefn::timespec_get"); - abort(); - } - return time; -} - -static UTIL_time_t UTIL_getSpanTime(UTIL_time_t begin, UTIL_time_t end) -{ - UTIL_time_t diff; - if (end.tv_nsec < begin.tv_nsec) { - diff.tv_sec = (end.tv_sec - 1) - begin.tv_sec; - diff.tv_nsec = (end.tv_nsec + 1000000000ULL) - begin.tv_nsec; - } else { - diff.tv_sec = end.tv_sec - begin.tv_sec; - diff.tv_nsec = end.tv_nsec - begin.tv_nsec; - } - return diff; -} - -PTime UTIL_getSpanTimeMicro(UTIL_time_t begin, UTIL_time_t end) -{ - UTIL_time_t const diff = UTIL_getSpanTime(begin, end); - PTime micro = 0; - micro += 1000000ULL * diff.tv_sec; - micro += diff.tv_nsec / 1000ULL; - return micro; -} - -PTime UTIL_getSpanTimeNano(UTIL_time_t begin, UTIL_time_t end) -{ - UTIL_time_t const diff = UTIL_getSpanTime(begin, end); - PTime nano = 0; - nano += 1000000000ULL * diff.tv_sec; - nano += diff.tv_nsec; - return nano; -} - - - -#else /* relies on standard C90 (note : clock_t measurements can be wrong when using multi-threading) */ - -UTIL_time_t UTIL_getTime(void) { return clock(); } -PTime UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd) { return 1000000ULL * (clockEnd - clockStart) / CLOCKS_PER_SEC; } -PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) { return 1000000000ULL * (clockEnd - clockStart) / CLOCKS_PER_SEC; } - -#endif - - - -/* returns time span in microseconds */ -PTime UTIL_clockSpanMicro(UTIL_time_t clockStart ) -{ - UTIL_time_t const clockEnd = UTIL_getTime(); - return UTIL_getSpanTimeMicro(clockStart, clockEnd); -} - -/* returns time span in microseconds */ -PTime UTIL_clockSpanNano(UTIL_time_t clockStart ) -{ - UTIL_time_t const clockEnd = UTIL_getTime(); - return UTIL_getSpanTimeNano(clockStart, clockEnd); -} - -void UTIL_waitForNextTick(void) -{ - UTIL_time_t const clockStart = UTIL_getTime(); - UTIL_time_t clockEnd; - do { - clockEnd = UTIL_getTime(); - } while (UTIL_getSpanTimeNano(clockStart, clockEnd) == 0); -} diff --git a/src/dependencies/zstd-1.5.0/programs/zstdgrep.1 b/src/dependencies/zstd-1.5.0/programs/zstdgrep.1 deleted file mode 100644 index bf96185..0000000 --- a/src/dependencies/zstd-1.5.0/programs/zstdgrep.1 +++ /dev/null @@ -1,23 +0,0 @@ -. -.TH "ZSTDGREP" "1" "May 2021" "zstd 1.5.0" "User Commands" -. -.SH "NAME" -\fBzstdgrep\fR \- print lines matching a pattern in zstandard\-compressed files -. -.SH "SYNOPSIS" -\fBzstdgrep\fR [\fIgrep\-flags\fR] [\-\-] \fIpattern\fR [\fIfiles\fR \.\.\.] -. -.SH "DESCRIPTION" -\fBzstdgrep\fR runs \fBgrep (1)\fR on files or stdin, if no files argument is given, after decompressing them with \fBzstdcat (1)\fR\. -. -.P -The grep\-flags and pattern arguments are passed on to \fBgrep (1)\fR\. If an \fB\-e\fR flag is found in the \fBgrep\-flags\fR, \fBzstdgrep\fR will not look for a pattern argument\. -. -.SH "EXIT STATUS" -In case of missing arguments or missing pattern, 1 will be returned, otherwise 0\. -. -.SH "SEE ALSO" -\fBzstd (1)\fR -. -.SH "AUTHORS" -Thomas Klausner \fIwiz@NetBSD\.org\fR diff --git a/src/dependencies/zstd-1.5.0/programs/zstdgrep.1.md b/src/dependencies/zstd-1.5.0/programs/zstdgrep.1.md deleted file mode 100644 index 363ad4f..0000000 --- a/src/dependencies/zstd-1.5.0/programs/zstdgrep.1.md +++ /dev/null @@ -1,26 +0,0 @@ -zstdgrep(1) -- print lines matching a pattern in zstandard-compressed files -============================================================================ - -SYNOPSIS --------- - -`zstdgrep` [*grep-flags*] [--] _pattern_ [_files_ ...] - - -DESCRIPTION ------------ -`zstdgrep` runs `grep (1)` on files or stdin, if no files argument is given, after decompressing them with `zstdcat (1)`. - -The grep-flags and pattern arguments are passed on to `grep (1)`. If an `-e` flag is found in the `grep-flags`, `zstdgrep` will not look for a pattern argument. - -EXIT STATUS ------------ -In case of missing arguments or missing pattern, 1 will be returned, otherwise 0. - -SEE ALSO --------- -`zstd (1)` - -AUTHORS -------- -Thomas Klausner diff --git a/src/dependencies/zstd-1.5.0/programs/zstdless b/src/dependencies/zstd-1.5.0/programs/zstdless deleted file mode 100755 index 893799e..0000000 --- a/src/dependencies/zstd-1.5.0/programs/zstdless +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -zstdcat "$@" | less diff --git a/src/dependencies/zstd-1.5.0/programs/zstdless.1 b/src/dependencies/zstd-1.5.0/programs/zstdless.1 deleted file mode 100644 index f08bc19..0000000 --- a/src/dependencies/zstd-1.5.0/programs/zstdless.1 +++ /dev/null @@ -1,14 +0,0 @@ -. -.TH "ZSTDLESS" "1" "May 2021" "zstd 1.5.0" "User Commands" -. -.SH "NAME" -\fBzstdless\fR \- view zstandard\-compressed files -. -.SH "SYNOPSIS" -\fBzstdless\fR [\fIflags\fR] [\fIfile\fR \.\.\.] -. -.SH "DESCRIPTION" -\fBzstdless\fR runs \fBless (1)\fR on files or stdin, if no files argument is given, after decompressing them with \fBzstdcat (1)\fR\. -. -.SH "SEE ALSO" -\fBzstd (1)\fR diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/sequence_compression_api.c b/src/dependencies/zstd-1.5.0/tests/fuzz/sequence_compression_api.c deleted file mode 100644 index cc840bf..0000000 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/sequence_compression_api.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/** - * This fuzz target performs a zstd round-trip test by generating an arbitrary - * array of sequences, generating the associated source buffer, calling - * ZSTD_compressSequences(), and then decompresses and compares the result with - * the original generated source buffer. - */ - -#define ZSTD_STATIC_LINKING_ONLY - -#include -#include -#include -#include -#include -#include "fuzz_helpers.h" -#include "zstd_helpers.h" -#include "fuzz_data_producer.h" - -static ZSTD_CCtx *cctx = NULL; -static ZSTD_DCtx *dctx = NULL; -static void* literalsBuffer = NULL; -static void* generatedSrc = NULL; -static ZSTD_Sequence* generatedSequences = NULL; - -#define ZSTD_FUZZ_GENERATED_SRC_MAXSIZE (1 << 20) /* Allow up to 1MB generated data */ -#define ZSTD_FUZZ_MATCHLENGTH_MAXSIZE (1 << 18) /* Allow up to 256KB matches */ -#define ZSTD_FUZZ_GENERATED_DICT_MAXSIZE (1 << 18) /* Allow up to a 256KB dict */ -#define ZSTD_FUZZ_GENERATED_LITERALS_SIZE (1 << 18) /* Fixed size 256KB literals buffer */ -#define ZSTD_FUZZ_MAX_NBSEQ (1 << 17) /* Maximum of 128K sequences */ - -/* Deterministic random number generator */ -#define FUZZ_RDG_rotl32(x,r) ((x << r) | (x >> (32 - r))) -static uint32_t FUZZ_RDG_rand(uint32_t* src) -{ - static const uint32_t prime1 = 2654435761U; - static const uint32_t prime2 = 2246822519U; - uint32_t rand32 = *src; - rand32 *= prime1; - rand32 ^= prime2; - rand32 = FUZZ_RDG_rotl32(rand32, 13); - *src = rand32; - return rand32 >> 5; -} - -/* Make a pseudorandom string - this simple function exists to avoid - * taking a dependency on datagen.h to have RDG_genBuffer(). - */ -static char *generatePseudoRandomString(char *str, size_t size) { - const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567890!@#$^&*()_"; - uint32_t seed = 0; - if (size) { - for (size_t n = 0; n < size; n++) { - int key = FUZZ_RDG_rand(&seed) % (int) (sizeof charset - 1); - str[n] = charset[key]; - } - } - return str; -} - -/* Returns size of source buffer */ -static size_t decodeSequences(void* dst, size_t nbSequences, - size_t literalsSize, const void* dict, size_t dictSize) { - const uint8_t* litPtr = literalsBuffer; - const uint8_t* const litBegin = literalsBuffer; - const uint8_t* const litEnd = literalsBuffer + literalsSize; - const uint8_t* dictPtr = dict; - uint8_t* op = dst; - const uint8_t* const oend = dst + ZSTD_FUZZ_GENERATED_SRC_MAXSIZE; - size_t generatedSrcBufferSize = 0; - size_t bytesWritten = 0; - uint32_t lastLLSize; - - for (size_t i = 0; i < nbSequences; ++i) { - FUZZ_ASSERT(generatedSequences[i].matchLength != 0); - FUZZ_ASSERT(generatedSequences[i].offset != 0); - - if (litPtr + generatedSequences[i].litLength > litEnd) { - litPtr = litBegin; - } - ZSTD_memcpy(op, litPtr, generatedSequences[i].litLength); - bytesWritten += generatedSequences[i].litLength; - op += generatedSequences[i].litLength; - litPtr += generatedSequences[i].litLength; - - FUZZ_ASSERT(generatedSequences[i].offset != 0); - /* Copy over the match */ - { size_t matchLength = generatedSequences[i].matchLength; - size_t j = 0; - size_t k = 0; - if (dictSize != 0) { - if (generatedSequences[i].offset > bytesWritten) { - /* Offset goes into the dictionary */ - size_t offsetFromEndOfDict = generatedSequences[i].offset - bytesWritten; - for (; k < offsetFromEndOfDict && k < matchLength; ++k) { - op[k] = dictPtr[dictSize - offsetFromEndOfDict + k]; - } - matchLength -= k; - op += k; - } - } - for (; j < matchLength; ++j) { - op[j] = op[j-(int)generatedSequences[i].offset]; - } - op += j; - FUZZ_ASSERT(generatedSequences[i].matchLength == j + k); - bytesWritten += generatedSequences[i].matchLength; - } - } - generatedSrcBufferSize = bytesWritten; - FUZZ_ASSERT(litPtr <= litEnd); - lastLLSize = (uint32_t)(litEnd - litPtr); - if (lastLLSize <= oend - op) { - ZSTD_memcpy(op, litPtr, lastLLSize); - generatedSrcBufferSize += lastLLSize; - } - return generatedSrcBufferSize; -} - -/* Returns nb sequences generated - * TODO: Add repcode fuzzing once we support repcode match splits - */ -static size_t generateRandomSequences(FUZZ_dataProducer_t* producer, - size_t literalsSizeLimit, size_t dictSize, - size_t windowLog) { - uint32_t bytesGenerated = 0; - uint32_t nbSeqGenerated = 0; - uint32_t litLength; - uint32_t matchLength; - uint32_t matchBound; - uint32_t offset; - uint32_t offsetBound; - uint32_t repCode = 0; - uint32_t isFirstSequence = 1; - uint32_t windowSize = 1 << windowLog; - - while (nbSeqGenerated < ZSTD_FUZZ_MAX_NBSEQ - && bytesGenerated < ZSTD_FUZZ_GENERATED_SRC_MAXSIZE - && !FUZZ_dataProducer_empty(producer)) { - matchBound = ZSTD_FUZZ_MATCHLENGTH_MAXSIZE; - litLength = isFirstSequence && dictSize == 0 ? FUZZ_dataProducer_uint32Range(producer, 1, literalsSizeLimit) - : FUZZ_dataProducer_uint32Range(producer, 0, literalsSizeLimit); - bytesGenerated += litLength; - if (bytesGenerated > ZSTD_FUZZ_GENERATED_SRC_MAXSIZE) { - break; - } - offsetBound = bytesGenerated > windowSize ? windowSize : bytesGenerated + dictSize; - offset = FUZZ_dataProducer_uint32Range(producer, 1, offsetBound); - if (dictSize > 0 && bytesGenerated <= windowSize) { - /* Prevent match length from being such that it would be associated with an offset too large - * from the decoder's perspective. If not possible (match would be too small), - * then reduce the offset if necessary. - */ - size_t bytesToReachWindowSize = windowSize - bytesGenerated; - if (bytesToReachWindowSize < ZSTD_MINMATCH_MIN) { - uint32_t newOffsetBound = offsetBound > windowSize ? windowSize : offsetBound; - offset = FUZZ_dataProducer_uint32Range(producer, 1, newOffsetBound); - } else { - matchBound = bytesToReachWindowSize > ZSTD_FUZZ_MATCHLENGTH_MAXSIZE ? - ZSTD_FUZZ_MATCHLENGTH_MAXSIZE : bytesToReachWindowSize; - } - } - matchLength = FUZZ_dataProducer_uint32Range(producer, ZSTD_MINMATCH_MIN, matchBound); - bytesGenerated += matchLength; - if (bytesGenerated > ZSTD_FUZZ_GENERATED_SRC_MAXSIZE) { - break; - } - ZSTD_Sequence seq = {offset, litLength, matchLength, repCode}; - generatedSequences[nbSeqGenerated++] = seq; - isFirstSequence = 0; - } - - return nbSeqGenerated; -} - -static size_t roundTripTest(void *result, size_t resultCapacity, - void *compressed, size_t compressedCapacity, - size_t srcSize, - const void *dict, size_t dictSize, - size_t generatedSequencesSize, - size_t wLog, unsigned cLevel, unsigned hasDict) -{ - size_t cSize; - size_t dSize; - ZSTD_CDict* cdict = NULL; - ZSTD_DDict* ddict = NULL; - - ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 0); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, cLevel); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, wLog); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, ZSTD_MINMATCH_MIN); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_validateSequences, 1); - /* TODO: Add block delim mode fuzzing */ - ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_noBlockDelimiters); - if (hasDict) { - FUZZ_ZASSERT(ZSTD_CCtx_loadDictionary(cctx, dict, dictSize)); - FUZZ_ZASSERT(ZSTD_DCtx_loadDictionary(dctx, dict, dictSize)); - } - - cSize = ZSTD_compressSequences(cctx, compressed, compressedCapacity, - generatedSequences, generatedSequencesSize, - generatedSrc, srcSize); - FUZZ_ZASSERT(cSize); - dSize = ZSTD_decompressDCtx(dctx, result, resultCapacity, compressed, cSize); - FUZZ_ZASSERT(dSize); - - if (cdict) { - ZSTD_freeCDict(cdict); - } - if (ddict) { - ZSTD_freeDDict(ddict); - } - return dSize; -} - -int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) -{ - void* rBuf; - size_t rBufSize; - void* cBuf; - size_t cBufSize; - size_t generatedSrcSize; - size_t nbSequences; - void* dictBuffer; - size_t dictSize = 0; - unsigned hasDict; - unsigned wLog; - int cLevel; - - FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(src, size); - if (literalsBuffer == NULL) { - literalsBuffer = FUZZ_malloc(ZSTD_FUZZ_GENERATED_LITERALS_SIZE); - literalsBuffer = generatePseudoRandomString(literalsBuffer, ZSTD_FUZZ_GENERATED_LITERALS_SIZE); - } - - hasDict = FUZZ_dataProducer_uint32Range(producer, 0, 1); - if (hasDict) { - dictSize = FUZZ_dataProducer_uint32Range(producer, 1, ZSTD_FUZZ_GENERATED_DICT_MAXSIZE); - dictBuffer = FUZZ_malloc(dictSize); - dictBuffer = generatePseudoRandomString(dictBuffer, dictSize); - } - /* Generate window log first so we dont generate offsets too large */ - wLog = FUZZ_dataProducer_uint32Range(producer, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX_32); - cLevel = FUZZ_dataProducer_int32Range(producer, -3, 22); - - if (!generatedSequences) { - generatedSequences = FUZZ_malloc(sizeof(ZSTD_Sequence)*ZSTD_FUZZ_MAX_NBSEQ); - } - if (!generatedSrc) { - generatedSrc = FUZZ_malloc(ZSTD_FUZZ_GENERATED_SRC_MAXSIZE); - } - nbSequences = generateRandomSequences(producer, ZSTD_FUZZ_GENERATED_LITERALS_SIZE, dictSize, wLog); - generatedSrcSize = decodeSequences(generatedSrc, nbSequences, ZSTD_FUZZ_GENERATED_LITERALS_SIZE, dictBuffer, dictSize); - cBufSize = ZSTD_compressBound(generatedSrcSize); - cBuf = FUZZ_malloc(cBufSize); - - rBufSize = generatedSrcSize; - rBuf = FUZZ_malloc(rBufSize); - - if (!cctx) { - cctx = ZSTD_createCCtx(); - FUZZ_ASSERT(cctx); - } - if (!dctx) { - dctx = ZSTD_createDCtx(); - FUZZ_ASSERT(dctx); - } - - size_t const result = roundTripTest(rBuf, rBufSize, - cBuf, cBufSize, - generatedSrcSize, - dictBuffer, dictSize, - nbSequences, - wLog, cLevel, hasDict); - FUZZ_ZASSERT(result); - FUZZ_ASSERT_MSG(result == generatedSrcSize, "Incorrect regenerated size"); - FUZZ_ASSERT_MSG(!FUZZ_memcmp(generatedSrc, rBuf, generatedSrcSize), "Corruption!"); - - free(rBuf); - free(cBuf); - FUZZ_dataProducer_free(producer); - if (hasDict) { - free(dictBuffer); - } -#ifndef STATEFUL_FUZZING - ZSTD_freeCCtx(cctx); cctx = NULL; - ZSTD_freeDCtx(dctx); dctx = NULL; - free(generatedSequences); generatedSequences = NULL; - free(generatedSrc); generatedSrc = NULL; - free(literalsBuffer); literalsBuffer = NULL; -#endif - return 0; -} diff --git a/src/dependencies/zstd-1.5.0/.buckconfig b/src/dependencies/zstd-1.5.4/.buckconfig similarity index 100% rename from src/dependencies/zstd-1.5.0/.buckconfig rename to src/dependencies/zstd-1.5.4/.buckconfig diff --git a/src/dependencies/zstd-1.5.0/.buckversion b/src/dependencies/zstd-1.5.4/.buckversion similarity index 100% rename from src/dependencies/zstd-1.5.0/.buckversion rename to src/dependencies/zstd-1.5.4/.buckversion diff --git a/src/dependencies/zstd-1.5.0/.circleci/config.yml b/src/dependencies/zstd-1.5.4/.circleci/config.yml similarity index 80% rename from src/dependencies/zstd-1.5.0/.circleci/config.yml rename to src/dependencies/zstd-1.5.4/.circleci/config.yml index c634737..621ac49 100644 --- a/src/dependencies/zstd-1.5.0/.circleci/config.yml +++ b/src/dependencies/zstd-1.5.4/.circleci/config.yml @@ -13,13 +13,13 @@ jobs: name: Test command: | ./tests/test-license.py - cc -v; CFLAGS="-O0 -Werror -pedantic" make all && make clean - make c99build ; make clean - make c11build ; make clean - make aarch64build ; make clean + cc -v + CFLAGS="-O0 -Werror -pedantic" make allmost; make clean + make c99build; make clean + make c11build; make clean make -j regressiontest; make clean - make shortest ; make clean - make cxxtest ; make clean + make shortest; make clean + make cxxtest; make clean # the second half of the jobs are in this test short-tests-1: docker: @@ -34,6 +34,7 @@ jobs: make ppc64build V=1; make clean make ppcbuild V=1; make clean make armbuild V=1; make clean + make aarch64build V=1; make clean make -C tests test-legacy test-longmatch; make clean make -C lib libzstd-nomt; make clean # This step should only be run in a cron job @@ -84,31 +85,10 @@ workflows: commit: jobs: # Run the tests in parallel - - short-tests-0: - filters: - tags: - only: /.*/ - - short-tests-1: - filters: - tags: - only: /.*/ - # Create a branch called regression and set it to dev to force a - # regression test run - - regression-test: - filters: - branches: - only: - - regression - # Only run on release tags. - - publish-github-release: - requires: - - short-tests-0 - - short-tests-1 - filters: - branches: - ignore: /.*/ - tags: - only: /^v\d+\.\d+\.\d+$/ + - short-tests-0 + - short-tests-1 + - regression-test + nightly: triggers: - schedule: @@ -120,7 +100,7 @@ workflows: - dev - master jobs: - # Run daily long regression tests + # Run daily regression tests - regression-test diff --git a/src/dependencies/zstd-1.5.0/.circleci/images/primary/Dockerfile b/src/dependencies/zstd-1.5.4/.circleci/images/primary/Dockerfile similarity index 89% rename from src/dependencies/zstd-1.5.0/.circleci/images/primary/Dockerfile rename to src/dependencies/zstd-1.5.4/.circleci/images/primary/Dockerfile index dd80041..bfcb6af 100644 --- a/src/dependencies/zstd-1.5.0/.circleci/images/primary/Dockerfile +++ b/src/dependencies/zstd-1.5.4/.circleci/images/primary/Dockerfile @@ -1,4 +1,4 @@ -FROM circleci/buildpack-deps:bionic +FROM circleci/buildpack-deps:focal RUN sudo dpkg --add-architecture i386 RUN sudo apt-get -y -qq update diff --git a/src/dependencies/zstd-1.5.0/.cirrus.yml b/src/dependencies/zstd-1.5.4/.cirrus.yml similarity index 64% rename from src/dependencies/zstd-1.5.0/.cirrus.yml rename to src/dependencies/zstd-1.5.4/.cirrus.yml index fe17aac..27ca65e 100644 --- a/src/dependencies/zstd-1.5.0/.cirrus.yml +++ b/src/dependencies/zstd-1.5.4/.cirrus.yml @@ -2,9 +2,8 @@ task: name: FreeBSD (shortest) freebsd_instance: matrix: + image_family: freebsd-13-0 image_family: freebsd-12-2 - # The stable 11.3 image causes "Agent is not responding" so use a snapshot - image_family: freebsd-11-3-snap install_script: pkg install -y gmake coreutils script: | MOREFLAGS="-Werror" gmake -j all diff --git a/src/dependencies/zstd-1.5.0/.gitattributes b/src/dependencies/zstd-1.5.4/.gitattributes similarity index 100% rename from src/dependencies/zstd-1.5.0/.gitattributes rename to src/dependencies/zstd-1.5.4/.gitattributes diff --git a/src/dependencies/zstd-1.5.0/.github/ISSUE_TEMPLATE/bug_report.md b/src/dependencies/zstd-1.5.4/.github/ISSUE_TEMPLATE/bug_report.md similarity index 94% rename from src/dependencies/zstd-1.5.0/.github/ISSUE_TEMPLATE/bug_report.md rename to src/dependencies/zstd-1.5.4/.github/ISSUE_TEMPLATE/bug_report.md index bacdac2..755a46a 100644 --- a/src/dependencies/zstd-1.5.0/.github/ISSUE_TEMPLATE/bug_report.md +++ b/src/dependencies/zstd-1.5.4/.github/ISSUE_TEMPLATE/bug_report.md @@ -26,8 +26,8 @@ If applicable, add screenshots and charts to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. Mac] - Version [e.g. 22] - - Compiler [e.g gcc] - - Flags [e.g O2] + - Compiler [e.g. gcc] + - Flags [e.g. O2] - Other relevant hardware specs [e.g. Dual-core] - Build system [e.g. Makefile] diff --git a/src/dependencies/zstd-1.5.0/.github/ISSUE_TEMPLATE/feature_request.md b/src/dependencies/zstd-1.5.4/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from src/dependencies/zstd-1.5.0/.github/ISSUE_TEMPLATE/feature_request.md rename to src/dependencies/zstd-1.5.4/.github/ISSUE_TEMPLATE/feature_request.md diff --git a/src/dependencies/zstd-1.5.4/.github/dependabot.yml b/src/dependencies/zstd-1.5.4/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/src/dependencies/zstd-1.5.4/.github/workflows/dev-long-tests.yml b/src/dependencies/zstd-1.5.4/.github/workflows/dev-long-tests.yml new file mode 100644 index 0000000..1c8c9ec --- /dev/null +++ b/src/dependencies/zstd-1.5.4/.github/workflows/dev-long-tests.yml @@ -0,0 +1,271 @@ +name: dev-long-tests +# Tests longer than 10mn + +concurrency: + group: long-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + branches: [ dev, release, actionsTest ] + +jobs: + make-all: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: make all + run: make all + + # lasts ~24mn + make-test: + runs-on: ubuntu-latest + env: + DEVNULLRIGHTS: 1 + READFROMBLOCKDEVICE: 1 + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: make test + run: make test + + # lasts ~26mn + make-test-osx: + runs-on: macos-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: OS-X test + run: make test # make -c lib all doesn't work because of the fact that it's not a tty + + no-intrinsics-fuzztest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: no intrinsics fuzztest + run: MOREFLAGS="-DZSTD_NO_INTRINSICS" make -C tests fuzztest + + tsan-zstreamtest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: thread sanitizer zstreamtest + run: CC=clang ZSTREAM_TESTTIME=-T3mn make tsan-test-zstream + + ubsan-zstreamtest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: undefined behavior sanitizer zstreamtest + run: CC=clang make uasan-test-zstream + + # lasts ~15mn + tsan-fuzztest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: thread sanitizer fuzztest + run: CC=clang make tsan-fuzztest + + + big-tests-zstreamtest32: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: zstream tests in 32bit mode, with big tests + run: | + sudo apt-get -qqq update + make libc6install + CC=clang make -C tests test-zstream32 FUZZER_FLAGS="--big-tests" + + # lasts ~23mn + gcc-8-asan-ubsan-testzstd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: gcc-8 + ASan + UBSan + Test Zstd + # See https://askubuntu.com/a/1428822 + run: | + echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list + sudo apt-get -qqq update + make gcc8install + CC=gcc-8 make -j uasan-test-zstd + msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=${{matrix.toolset}} + /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}} + + # This tests that we don't accidently grow the size too much. + # If the size grows intentionally, you can raise these numbers. + # But we do need to think about binary size, since it is a concern. + libzstd-size: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: libzstd size test + run: | + make clean && make -j -C lib libzstd && ./tests/check_size.py lib/libzstd.so 1100000 + make clean && make -j -C lib libzstd ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 && ./tests/check_size.py lib/libzstd.so 400000 + make clean && make -j -C lib libzstd ZSTD_LIB_MINIFY=1 && ./tests/check_size.py lib/libzstd.so 300000 + make clean && make -j -C lib libzstd ZSTD_LIB_MINIFY=1 ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 && ./tests/check_size.py lib/libzstd.so 80000 + + minimal-decompressor-macros: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: minimal decompressor macros + run: | + make clean && make -j all ZSTD_LIB_MINIFY=1 MOREFLAGS="-Werror" + make clean && make check ZSTD_LIB_MINIFY=1 MOREFLAGS="-Werror" + make clean && make -j all MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X1 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT" + make clean && make check MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X1 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT" + make clean && make -j all MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X2 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG" + make clean && make check MOREFLAGS="-Werror -DHUF_FORCE_DECOMPRESS_X2 -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG" + make clean && make -j all MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" + make clean && make check MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" + + dynamic-bmi2: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: dynamic bmi2 tests + run: | + make clean && make -j check MOREFLAGS="-O0 -Werror -mbmi2" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=1" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=1 -mbmi2" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=0" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=0 -mbmi2" + + test-variants: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: make all variants & validate + run: | + make -j -C programs allVariants MOREFLAGS=-O0 + ./tests/test-variants.sh + + + qemu-consistency: + name: QEMU ${{ matrix.name }} + runs-on: ubuntu-20.04 + strategy: + fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. + matrix: + include: [ + { name: ARM, xcc_pkg: gcc-arm-linux-gnueabi, xcc: arm-linux-gnueabi-gcc, xemu_pkg: qemu-system-arm, xemu: qemu-arm-static }, + { name: ARM64, xcc_pkg: gcc-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc, xemu_pkg: qemu-system-arm, xemu: qemu-aarch64-static }, + { name: PPC, xcc_pkg: gcc-powerpc-linux-gnu, xcc: powerpc-linux-gnu-gcc, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc-static }, + { name: PPC64LE, xcc_pkg: gcc-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc, xemu_pkg: qemu-system-ppc, xemu: qemu-ppc64le-static }, + { name: S390X, xcc_pkg: gcc-s390x-linux-gnu, xcc: s390x-linux-gnu-gcc, xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static }, + { name: MIPS, xcc_pkg: gcc-mips-linux-gnu, xcc: mips-linux-gnu-gcc, xemu_pkg: qemu-system-mips, xemu: qemu-mips-static }, + { name: M68K, xcc_pkg: gcc-m68k-linux-gnu, xcc: m68k-linux-gnu-gcc, xemu_pkg: qemu-system-m68k, xemu: qemu-m68k-static }, + ] + env: # Set environment variables + XCC: ${{ matrix.xcc }} + XEMU: ${{ matrix.xemu }} + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: apt update & install + run: | + sudo apt-get update + sudo apt-get install gcc-multilib g++-multilib qemu-utils qemu-user-static + sudo apt-get install ${{ matrix.xcc_pkg }} ${{ matrix.xemu_pkg }} + - name: Environment info + run: | + echo && which $XCC + echo && $XCC --version + echo && $XCC -v # Show built-in specs + echo && which $XEMU + echo && $XEMU --version + - name: ARM + if: ${{ matrix.name == 'ARM' }} + run: | + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + - name: ARM64 + if: ${{ matrix.name == 'ARM64' }} + run: | + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + - name: PPC + if: ${{ matrix.name == 'PPC' }} + run: | + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + - name: PPC64LE + if: ${{ matrix.name == 'PPC64LE' }} + run: | + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + - name: S390X + if: ${{ matrix.name == 'S390X' }} + run: | + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + - name: MIPS + if: ${{ matrix.name == 'MIPS' }} + run: | + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + - name: M68K + if: ${{ matrix.name == 'M68K' }} + run: | + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + + mingw-short-test: + runs-on: windows-latest + strategy: + fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed. + matrix: + include: [ + { compiler: gcc, msystem: MINGW32, cflags: "-Werror"}, + { compiler: gcc, msystem: MINGW64, cflags: "-Werror"}, + { compiler: clang, msystem: MINGW64, cflags: "--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion -Wno-unused-command-line-argument"}, + ] + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.msystem }} + install: make diffutils + update: true + # Based on https://ariya.io/2020/07/on-github-actions-with-msys2 + - name: install mingw gcc i686 + if: ${{ (matrix.msystem == 'MINGW32') && (matrix.compiler == 'gcc') }} + run: pacman --noconfirm -S mingw-w64-i686-gcc + - name: install mingw gcc x86_64 + if: ${{ (matrix.msystem == 'MINGW64') && (matrix.compiler == 'gcc') }} + run: pacman --noconfirm -S mingw-w64-x86_64-gcc + - name: install mingw clang i686 + if: ${{ (matrix.msystem == 'MINGW32') && (matrix.compiler == 'clang') }} + run: pacman --noconfirm -S mingw-w64-i686-clang + - name: install mingw clang x86_64 + if: ${{ (matrix.msystem == 'MINGW64') && (matrix.compiler == 'clang') }} + run: pacman --noconfirm -S mingw-w64-x86_64-clang + - name: run mingw tests + run: | + make -v + export CC=${{ matrix.compiler }} + $CC --version + CFLAGS="${{ matrix.cflags }}" make -j allzstd + echo "Testing $CC ${{ matrix.msystem }}" + make clean + MSYS="" make check + + visual-runtime-tests: + runs-on: windows-latest + strategy: + matrix: + platform: [x64, Win32] + configuration: [Release] + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.3 + - name: Build and run tests + working-directory: ${{env.GITHUB_WORKSPACE}} + env: + ZSTD_BIN: ./zstd.exe + DATAGEN_BIN: ./datagen.exe + # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference + run: | + msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v142 /t:Clean,Build /p:Platform=${{matrix.platform}} /p:Configuration=${{matrix.configuration}} + COPY build\VS2010\bin\${{matrix.platform}}_${{matrix.configuration}}\*.exe tests\ + CD tests + sh -e playTests.sh + .\fuzzer.exe -T2m + + # Following instructions at: https://github.com/marketplace/actions/install-cygwin-action + cygwin-tests: + runs-on: windows-latest + steps: + - run: git config --global core.autocrlf input + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - uses: cygwin/cygwin-install-action@f5e0f048310c425e84bc789f493a828c6dc80a25 # tag=master + with: + platform: x86_64 + packages: >- + autoconf, + automake, + gcc-g++, + make, + mingw64-x86_64-gcc-g++, + patch, + perl + - name: cygwin tests + shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}' + run: >- + export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 && + export CFLAGS="-Werror -O1" && + ls && + make -j allzstd && + make -C tests fuzzer && + ./tests/fuzzer.exe -v -T1m + + intel-cet-compatibility: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: Build Zstd + run: | + make -j zstd V=1 + readelf -n zstd + - name: Get Intel SDE + run: | + curl -LO https://downloadmirror.intel.com/684899/sde-external-9.0.0-2021-11-07-lin.tar.xz + tar xJvf sde-external-9.0.0-2021-11-07-lin.tar.xz + - name: Configure Permissions + run: | + echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + - name: Run Under SDE + run: | + sde-external-9.0.0-2021-11-07-lin/sde -cet -cet-raise 0 -cet-endbr-exe -cet-stderr -cet-abort -- ./zstd -b3 + + pkg-config: + runs-on: ubuntu-latest + container: + image: debian:testing + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: Install dependencies + run: | + apt -y update + apt -y install --no-install-recommends gcc libc6-dev make pkg-config + - name: Build and install + run: make -C lib install + - name: Test pkg-config + run: | + cc -Wall -Wextra -Wpedantic -Werror -o simple examples/simple_compression.c $(pkg-config --cflags --libs libzstd) + ./simple LICENSE + + versions-compatibility: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: Versions Compatibility Test + run: | + make -C tests versionsTest + + clangbuild: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: make clangbuild + run: | + make clangbuild + + clang-pgo: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: Build PGO Zstd with Clang + env: + CC: clang-14 + LLVM_PROFDATA: llvm-profdata-14 + run: | + make -C programs zstd-pgo + ./programs/zstd -b + + gcc-pgo: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + - name: Build PGO Zstd with GCC + env: + CC: gcc + run: | + make -C programs zstd-pgo + ./programs/zstd -b + + +# For reference : icc tests +# icc tests are currently failing on Github Actions, likely to issues during installation stage +# To be fixed later +# +# icc: +# name: icc-check +# runs-on: ubuntu-latest +# steps: +# - name: install icc +# run: | +# export DEBIAN_FRONTEND=noninteractive +# sudo apt-get -qqq update +# sudo apt-get install -y wget build-essential pkg-config cmake ca-certificates gnupg +# sudo wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB +# sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB +# sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" +# sudo apt-get update +# sudo apt-get install -y intel-basekit intel-hpckit +# - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 +# - name: make check +# run: | +# make CC=/opt/intel/oneapi/compiler/latest/linux/bin/intel64/icc check diff --git a/src/dependencies/zstd-1.5.0/.github/workflows/publish-release-artifacts.yml b/src/dependencies/zstd-1.5.4/.github/workflows/publish-release-artifacts.yml similarity index 86% rename from src/dependencies/zstd-1.5.0/.github/workflows/publish-release-artifacts.yml rename to src/dependencies/zstd-1.5.4/.github/workflows/publish-release-artifacts.yml index 952cb26..2c89a91 100644 --- a/src/dependencies/zstd-1.5.0/.github/workflows/publish-release-artifacts.yml +++ b/src/dependencies/zstd-1.5.4/.github/workflows/publish-release-artifacts.yml @@ -3,16 +3,23 @@ name: publish-release-artifacts on: release: types: - - created + - published + +permissions: + contents: read jobs: publish-release-artifacts: + permissions: + contents: read # to fetch code (actions/checkout) + actions: write # to attach binaries to release artifacts (skx/github-action-publish-binaries) + runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 - name: Archive env: @@ -61,7 +68,7 @@ jobs: fi - name: Publish - uses: skx/github-action-publish-binaries@release-1.3 + uses: skx/github-action-publish-binaries@release-2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/src/dependencies/zstd-1.5.4/.github/workflows/scorecards.yml b/src/dependencies/zstd-1.5.4/.github/workflows/scorecards.yml new file mode 100644 index 0000000..6a9e521 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/.github/workflows/scorecards.yml @@ -0,0 +1,64 @@ +name: Scorecards supply-chain security +on: + # Only the default branch is supported. + branch_protection_rule: + schedule: + - cron: '22 21 * * 2' + push: + # TODO: Add release branch when supported? + branches: [ "dev" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecards analysis + if: github.repository == 'facebook/zstd' + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Used to receive a badge. + id-token: write + # Needs for private repositories. + contents: read + actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # tag=v3 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # tag=v2.1.2 + with: + results_file: results.sarif + results_format: sarif + # (Optional) Read-only PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecards on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_READ_TOKEN }} + + # Publish the results for public repositories to enable scorecard badges. For more details, see + # https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories, `publish_results` will automatically be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # tag=v3.1.2 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@3ebbd71c74ef574dbc558c82f70e52732c8b44fe # tag=v2.2.1 + with: + sarif_file: results.sarif diff --git a/src/dependencies/zstd-1.5.0/.gitignore b/src/dependencies/zstd-1.5.4/.gitignore similarity index 94% rename from src/dependencies/zstd-1.5.0/.gitignore rename to src/dependencies/zstd-1.5.4/.gitignore index ea574d7..a136ea3 100644 --- a/src/dependencies/zstd-1.5.0/.gitignore +++ b/src/dependencies/zstd-1.5.4/.gitignore @@ -29,6 +29,7 @@ dictionary NUL # Build artefacts +contrib/linux-kernel/linux/ projects/ bin/ .buckd/ diff --git a/src/dependencies/zstd-1.5.4/.travis.yml b/src/dependencies/zstd-1.5.4/.travis.yml new file mode 100644 index 0000000..b96bf8b --- /dev/null +++ b/src/dependencies/zstd-1.5.4/.travis.yml @@ -0,0 +1,128 @@ +# Travis CI is used to test platforms that github-actions currently doesn't support +# without either self-hosting or some finnicky work-around. Also, some tests +# are troublesome to migrate since GH Actions runs tests not in a tty. +language: c + +git: + depth: 1 + +branches: + only: + - dev + - release + - master + - travisTest + +addons: + apt: + update: true + +env: + global: + - FUZZERTEST=-T1mn + ZSTREAM_TESTTIME=-T1mn + DECODECORPUS_TESTTIME=-T1mn + +matrix: + fast_finish: true + include: + - name: S390X (big endian) + Fuzz test + dist: trusty + arch: s390x + script: + - FUZZER_FLAGS=--no-big-tests make -C tests fuzztest + + - name: S390X (big endian) + Fuzz test + no intrinsics + dist: trusty + arch: s390x + script: + - MOREFLAGS="-DZSTD_NO_INTRINSICS" FUZZER_FLAGS=--no-big-tests make -C tests fuzztest + + - name: arm64 # ~2.5 mn + os: linux + arch: arm64 + script: + - make check + + - name: arm64fuzz + os: linux + arch: arm64 + script: + - make -C tests fuzztest + + # TODO: migrate to GH Actions once newest clang staticanalyze warnings are fixed + - name: static analyzer scanbuild # ~8mn + dist: trusty # note : it's important to pin down a version of static analyzer, since different versions report different false positives + script: + - make staticAnalyze + + # GH actions can't run this command on OS-X, non-tty issues + - name: OS-X make all lib + os: osx + script: + - make -C lib all + + # Introduced to check compat with old toolchains, to prevent e.g. #1872 + - name: ARM Build Test (on Trusty) + dist: trusty + script: + - make arminstall + - make armbuild + + # check release number (release/new tag only) + - name: Tag-Specific Test + if: tag =~ ^v[0-9]\.[0-9] + script: + - make -C tests checkTag + - tests/checkTag "$TRAVIS_BRANCH" + + - name: PPC64LE + Fuzz test # ~13mn + arch: ppc64le + env: + - FUZZER_FLAGS=--no-big-tests + - MOREFLAGS="-static" + script: + - cat /proc/cpuinfo + - make -C tests fuzztest + + # This test currently fails on GA specifically, for no obvious reason + # (it works fine on travisCI, and on local test platforms). + - name: Versions Compatibility Test # ~6mn + script: + - make -C tests versionsTest + + # meson dedicated test + - name: Focal (Meson + clang) # ~15mn + dist: focal + language: cpp + compiler: clang + install: + - sudo apt-get install -qq liblz4-dev valgrind tree + - | + travis_retry curl -o ~/ninja.zip -L 'https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip' && + unzip ~/ninja.zip -d ~/.local/bin + - | + travis_retry curl -o ~/get-pip.py -L 'https://bootstrap.pypa.io/pip/3.6/get-pip.py' && + python3 ~/get-pip.py --user && + pip3 install --user meson + script: + - | + meson setup \ + --buildtype=debugoptimized \ + -Db_lundef=false \ + -Dauto_features=enabled \ + -Dbin_programs=true \ + -Dbin_tests=true \ + -Dbin_contrib=true \ + -Ddefault_library=both \ + build/meson builddir + - pushd builddir + - ninja + - meson test --verbose --no-rebuild + - DESTDIR=./staging ninja install + - tree ./staging + after_failure: + - cat "$TRAVIS_BUILD_DIR"/builddir/meson-logs/testlog.txt + + allow_failures: + - env: ALLOW_FAILURES=true diff --git a/src/dependencies/zstd-1.5.0/CHANGELOG b/src/dependencies/zstd-1.5.4/CHANGELOG similarity index 86% rename from src/dependencies/zstd-1.5.0/CHANGELOG rename to src/dependencies/zstd-1.5.4/CHANGELOG index 3b15165..4010c1f 100644 --- a/src/dependencies/zstd-1.5.0/CHANGELOG +++ b/src/dependencies/zstd-1.5.4/CHANGELOG @@ -1,3 +1,86 @@ +v1.5.4 (Feb 2023) +perf: +20% faster huffman decompression for targets that can't compile x64 assembly (#3449, @terrelln) +perf: up to +10% faster streaming compression at levels 1-2 (#3114, @embg) +perf: +4-13% for levels 5-12 by optimizing function generation (#3295, @terrelln) +pref: +3-11% compression speed for `arm` target (#3199, #3164, #3145, #3141, #3138, @JunHe77 and #3139, #3160, @danlark1) +perf: +5-30% faster dictionary compression at levels 1-4 (#3086, #3114, #3152, @embg) +perf: +10-20% cold dict compression speed by prefetching CDict tables (#3177, @embg) +perf: +1% faster compression by removing a branch in ZSTD_fast_noDict (#3129, @felixhandte) +perf: Small compression ratio improvements in high compression mode (#2983, #3391, @Cyan4973 and #3285, #3302, @daniellerozenblit) +perf: small speed improvement by better detecting `STATIC_BMI2` for `clang` (#3080, @TocarIP) +perf: Improved streaming performance when `ZSTD_c_stableInBuffer` is set (#2974, @Cyan4973) +cli: Asynchronous I/O for improved cli speed (#2975, #2985, #3021, #3022, @yoniko) +cli: Change `zstdless` behavior to align with `zless` (#2909, @binhdvo) +cli: Keep original file if `-c` or `--stdout` is given (#3052, @dirkmueller) +cli: Keep original files when result is concatenated into a single output with `-o` (#3450, @Cyan4973) +cli: Preserve Permissions and Ownership of regular files (#3432, @felixhandte) +cli: Print zlib/lz4/lzma library versions with `-vv` (#3030, @terrelln) +cli: Print checksum value for single frame files with `-lv` (#3332, @Cyan4973) +cli: Print `dictID` when present with `-lv` (#3184, @htnhan) +cli: when `stderr` is *not* the console, disable status updates, but preserve final summary (#3458, @Cyan4973) +cli: support `--best` and `--no-name` in `gzip` compatibility mode (#3059, @dirkmueller) +cli: support for `posix` high resolution timer `clock_gettime()`, for improved benchmark accuracy (#3423, @Cyan4973) +cli: improved help/usage (`-h`, `-H`) formatting (#3094, @dirkmueller and #3385, @jonpalmisc) +cli: Fix better handling of bogus numeric values (#3268, @ctkhanhly) +cli: Fix input consists of multiple files _and_ `stdin` (#3222, @yoniko) +cli: Fix tiny files passthrough (#3215, @cgbur) +cli: Fix for `-r` on empty directory (#3027, @brailovich) +cli: Fix empty string as argument for `--output-dir-*` (#3220, @embg) +cli: Fix decompression memory usage reported by `-vv --long` (#3042, @u1f35c, and #3232, @zengyijing) +cli: Fix infinite loop when empty input is passed to trainer (#3081, @terrelln) +cli: Fix `--adapt` doesn't work when `--no-progress` is also set (#3354, @terrelln) +api: Support for Block-Level Sequence Producer (#3333, @embg) +api: Support for in-place decompression (#3432, @terrelln) +api: New `ZSTD_CCtx_setCParams()` function, set all parameters defined in a `ZSTD_compressionParameters` structure (#3403, @Cyan4973) +api: Streaming decompression detects incorrect header ID sooner (#3175, @Cyan4973) +api: Window size resizing optimization for edge case (#3345, @daniellerozenblit) +api: More accurate error codes for busy-loop scenarios (#3413, #3455, @Cyan4973) +api: Fix limit overflow in `compressBound` and `decompressBound` (#3362, #3373, Cyan4973) reported by @nigeltao +api: Deprecate several advanced experimental functions: streaming (#3408, @embg), copy (#3196, @mileshu) +bug: Fix corruption that rarely occurs in 32-bit mode with wlog=25 (#3361, @terrelln) +bug: Fix for block-splitter (#3033, @Cyan4973) +bug: Fixes for Sequence Compression API (#3023, #3040, @Cyan4973) +bug: Fix leaking thread handles on Windows (#3147, @animalize) +bug: Fix timing issues with cmake/meson builds (#3166, #3167, #3170, @Cyan4973) +build: Allow user to select legacy level for cmake (#3050, @shadchin) +build: Enable legacy support by default in cmake (#3079, @niamster) +build: Meson build script improvements (#3039, #3120, #3122, #3327, #3357, @eli-schwartz and #3276, @neheb) +build: Add aarch64 to supported architectures for zstd_trace (#3054, @ooosssososos) +build: support AIX architecture (#3219, @qiongsiwu) +build: Fix `ZSTD_LIB_MINIFY` build macro, which now reduces static library size by half (#3366, @terrelln) +build: Fix Windows issues with Multithreading translation layer (#3364, #3380, @yoniko) and ARM64 target (#3320, @cwoffenden) +build: Fix `cmake` script (#3382, #3392, @terrelln and #3252 @Tachi107 and #3167 @Cyan4973) +doc: Updated man page, providing more details for `--train` mode (#3112, @Cyan4973) +doc: Add decompressor errata document (#3092, @terrelln) +misc: Enable Intel CET (#2992, #2994, @hjl-tools) +misc: Fix `contrib/` seekable format (#3058, @yhoogstrate and #3346, @daniellerozenblit) +misc: Improve speed of the one-file library generator (#3241, @wahern and #3005, @cwoffenden) + +v1.5.3 (dev version, unpublished) + +v1.5.2 (Jan, 2022) +perf: Regain Minimal memset()-ing During Reuse of Compression Contexts (@Cyan4973, #2969) +build: Build Zstd with `noexecstack` on All Architectures (@felixhandte, #2964) +doc: Clarify Licensing (@terrelln, #2981) + +v1.5.1 (Dec, 2021) +perf: rebalanced compression levels, to better match the intended speed/level curve, by @senhuang42 +perf: faster huffman decoder, using x64 assembly, by @terrelln +perf: slightly faster high speed modes (strategies fast & dfast), by @felixhandte +perf: improved binary size and faster compilation times, by @terrelln +perf: new row64 mode, used notably in level 12, by @senhuang42 +perf: faster mid-level compression speed in presence of highly repetitive patterns, by @senhuang42 +perf: minor compression ratio improvements for small data at high levels, by @cyan4973 +perf: reduced stack usage (mostly useful for Linux Kernel), by @terrelln +perf: faster compression speed on incompressible data, by @bindhvo +perf: on-demand reduced ZSTD_DCtx state size, using build macro ZSTD_DECODER_INTERNAL_BUFFER, at a small cost of performance, by @bindhvo +build: allows hiding static symbols in the dynamic library, using build macro, by @skitt +build: support for m68k (Motorola 68000's), by @cyan4973 +build: improved AIX support, by @Helflym +build: improved meson unofficial build, by @eli-schwartz +cli : custom memory limit when training dictionary (#2925), by @embg +cli : report advanced parameters information when compressing in very verbose mode (``-vv`), by @Svetlitski-FB + v1.5.0 (May 11, 2021) api: Various functions promoted from experimental to stable API: (#2579-2581, @senhuang42) `ZSTD_defaultCLevel()` diff --git a/src/dependencies/zstd-1.5.0/CODE_OF_CONDUCT.md b/src/dependencies/zstd-1.5.4/CODE_OF_CONDUCT.md similarity index 100% rename from src/dependencies/zstd-1.5.0/CODE_OF_CONDUCT.md rename to src/dependencies/zstd-1.5.4/CODE_OF_CONDUCT.md diff --git a/src/dependencies/zstd-1.5.0/CONTRIBUTING.md b/src/dependencies/zstd-1.5.4/CONTRIBUTING.md similarity index 85% rename from src/dependencies/zstd-1.5.0/CONTRIBUTING.md rename to src/dependencies/zstd-1.5.4/CONTRIBUTING.md index 5effa26..f5e747a 100644 --- a/src/dependencies/zstd-1.5.0/CONTRIBUTING.md +++ b/src/dependencies/zstd-1.5.4/CONTRIBUTING.md @@ -7,7 +7,7 @@ New versions are being developed in the "dev" branch, or in their own feature branch. When they are deemed ready for a release, they are merged into "release". -As a consequences, all contributions must stage first through "dev" +As a consequence, all contributions must stage first through "dev" or their own feature branch. ## Pull Requests @@ -47,7 +47,7 @@ Our contribution process works in three main stages: * Topic and development: * Make a new branch on your fork about the topic you're developing for ``` - # branch names should be consise but sufficiently informative + # branch names should be concise but sufficiently informative git checkout -b git push origin ``` @@ -68,8 +68,8 @@ Our contribution process works in three main stages: ``` 2. Code Review and CI tests * Ensure CI tests pass: - * Before sharing anything to the community, make sure that all CI tests pass on your local fork. - See our section on setting up your CI environment for more information on how to do this. + * Before sharing anything to the community, create a pull request in your own fork against the dev branch + and make sure that all GitHub Actions CI tests pass. See the Continuous Integration section below for more information. * Ensure that static analysis passes on your development machine. See the Static Analysis section below to see how to do this. * Create a pull request: @@ -104,7 +104,7 @@ Our contribution process works in three main stages: issue at hand, then please indicate this by requesting that an issue be closed by commenting. * Just because your changes have been merged does not mean the topic or larger issue is complete. Remember that the change must make it to an official zstd release for it to be meaningful. We recommend - that contributers track the activity on their pull request and corresponding issue(s) page(s) until + that contributors track the activity on their pull request and corresponding issue(s) page(s) until their change makes it to the next release of zstd. Users will often discover bugs in your code or suggest ways to refine and improve your initial changes even after the pull request is merged. @@ -134,11 +134,47 @@ It can be useful to look at additional static analyzers once in a while (and we - Static analyzers are full of false positive. The signal to noise ratio is actually pretty low. - A good CI policy is "zero-warning tolerance". That means that all issues must be solved, including false positives. This quickly becomes a tedious workload. - Multiple static analyzers will feature multiple kind of false positives, sometimes applying to the same code but in different ways leading to : - + torteous code, trying to please multiple constraints, hurting readability and therefore maintenance. Sometimes, such complexity introduce other more subtle bugs, that are just out of scope of the analyzers. + + tortuous code, trying to please multiple constraints, hurting readability and therefore maintenance. Sometimes, such complexity introduce other more subtle bugs, that are just out of scope of the analyzers. + sometimes, these constraints are mutually exclusive : if one try to solve one, the other static analyzer will complain, they can't be both happy at the same time. - As if that was not enough, the list of false positives change with each version. It's hard enough to follow one static analyzer, but multiple ones with their own update agenda, this quickly becomes a massive velocity reducer. -This is different from running a static analyzer once in a while, looking at the output, and __cherry picking__ a few warnings that seem helpful, either because they detected a genuine risk of bug, or because it helps expressing the code in a way which is more readable or more difficult to misuse. These kind of reports can be useful, and are accepted. +This is different from running a static analyzer once in a while, looking at the output, and __cherry picking__ a few warnings that seem helpful, either because they detected a genuine risk of bug, or because it helps expressing the code in a way which is more readable or more difficult to misuse. These kinds of reports can be useful, and are accepted. + +## Continuous Integration +CI tests run every time a pull request (PR) is created or updated. The exact tests +that get run will depend on the destination branch you specify. Some tests take +longer to run than others. Currently, our CI is set up to run a short +series of tests when creating a PR to the dev branch and a longer series of tests +when creating a PR to the release branch. You can look in the configuration files +of the respective CI platform for more information on what gets run when. + +Most people will just want to create a PR with the destination set to their local dev +branch of zstd. You can then find the status of the tests on the PR's page. You can also +re-run tests and cancel running tests from the PR page or from the respective CI's dashboard. + +Almost all of zstd's CI runs on GitHub Actions (configured at `.github/workflows`), which will automatically run on PRs to your +own fork. A small number of tests run on other services (e.g. Travis CI, Circle CI, Appveyor). +These require work to set up on your local fork, and (at least for Travis CI) cost money. +Therefore, if the PR on your local fork passes GitHub Actions, feel free to submit a PR +against the main repo. + +### Third-party CI +A small number of tests cannot run on GitHub Actions, or have yet to be migrated. +For these, we use a variety of third-party services (listed below). It is not necessary to set +these up on your fork in order to contribute to zstd; however, we do link to instructions for those +who want earlier signal. + +| Service | Purpose | Setup Links | Config Path | +|-----------|------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------| +| Travis CI | Used for testing on non-x86 architectures such as PowerPC | https://docs.travis-ci.com/user/tutorial/#to-get-started-with-travis-ci-using-github
    https://github.com/marketplace/travis-ci | `.travis.yml` | +| AppVeyor | Used for some Windows testing (e.g. cygwin, mingw) | https://www.appveyor.com/blog/2018/10/02/github-apps-integration/
    https://github.com/marketplace/appveyor | `appveyor.yml` | +| Cirrus CI | Used for testing on FreeBSD | https://github.com/marketplace/cirrus-ci/ | `.cirrus.yml` | +| Circle CI | Historically was used to provide faster signal,
    but we may be able to migrate these to Github Actions | https://circleci.com/docs/2.0/getting-started/#setting-up-circleci
    https://youtu.be/Js3hMUsSZ2c
    https://circleci.com/docs/2.0/enable-checks/ | `.circleci/config.yml` | + +Note: the instructions linked above mostly cover how to set up a repository with CI from scratch. +The general idea should be the same for setting up CI on your fork of zstd, but you may have to +follow slightly different steps. In particular, please ignore any instructions related to setting up +config files (since zstd already has configs for each of these services). ## Performance Performance is extremely important for zstd and we only merge pull requests whose performance @@ -161,7 +197,7 @@ something subtle merged is extensive benchmarking. You will be doing us a great take the time to run extensive, long-duration, and potentially cross-(os, platform, process, etc) benchmarks on your end before submitting a PR. Of course, you will not be able to benchmark your changes on every single processor and os out there (and neither will we) but do that best -you can:) We've adding some things to think about when benchmarking below in the Benchmarking +you can:) We've added some things to think about when benchmarking below in the Benchmarking Performance section which might be helpful for you. 3. Optimizing performance for a certain OS, processor vendor, compiler, or network system is a perfectly legitimate thing to do as long as it does not harm the overall performance health of Zstd. @@ -237,7 +273,7 @@ for that options you have just provided. If you want to look at the internals of benchmarking script works, you can check out programs/benchzstd.c For example: say you have made a change that you believe improves the speed of zstd level 1. The -very first thing you should use to asses whether you actually achieved any sort of improvement +very first thing you should use to assess whether you actually achieved any sort of improvement is `zstd -b`. You might try to do something like this. Note: you can use the `-i` option to specify a running time for your benchmark in seconds (default is 3 seconds). Usually, the longer the running time, the more stable your results will be. @@ -263,24 +299,24 @@ this method of evaluation will not be sufficient. ### Profiling There are a number of great profilers out there. We're going to briefly mention how you can profile your code using `instruments` on mac, `perf` on linux and `visual studio profiler` -on windows. +on Windows. Say you have an idea for a change that you think will provide some good performance gains for level 1 compression on Zstd. Typically this means, you have identified a section of code that you think can be made to run faster. The first thing you will want to do is make sure that the piece of code is actually taking up -a notable amount of time to run. It is usually not worth optimzing something which accounts for less than +a notable amount of time to run. It is usually not worth optimizing something which accounts for less than 0.0001% of the total running time. Luckily, there are tools to help with this. Profilers will let you see how much time your code spends inside a particular function. -If your target code snippit is only part of a function, it might be worth trying to -isolate that snippit by moving it to its own function (this is usually not necessary but +If your target code snippet is only part of a function, it might be worth trying to +isolate that snippet by moving it to its own function (this is usually not necessary but might be). -Most profilers (including the profilers dicusssed below) will generate a call graph of -functions for you. Your goal will be to find your function of interest in this call grapch -and then inspect the time spent inside of it. You might also want to to look at the -annotated assembly which most profilers will provide you with. +Most profilers (including the profilers discussed below) will generate a call graph of +functions for you. Your goal will be to find your function of interest in this call graph +and then inspect the time spent inside of it. You might also want to look at the annotated +assembly which most profilers will provide you with. #### Instruments We will once again consider the scenario where you think you've identified a piece of code @@ -294,23 +330,23 @@ Instruments. * You will want a benchmark that runs for at least a few seconds (5 seconds will usually be long enough). This way the profiler will have something to work with and you will have ample time to attach your profiler to this process:) - * I will just use benchzstd as my bencharmking script for this example: + * I will just use benchzstd as my benchmarmking script for this example: ``` $ zstd -b1 -i5 # this will run for 5 seconds ``` 5. Once you run your benchmarking script, switch back over to instruments and attach your process to the time profiler. You can do this by: * Clicking on the `All Processes` drop down in the top left of the toolbar. - * Selecting your process from the dropdown. In my case, it is just going to be labled + * Selecting your process from the dropdown. In my case, it is just going to be labeled `zstd` * Hitting the bright red record circle button on the top left of the toolbar -6. You profiler will now start collecting metrics from your bencharking script. Once +6. You profiler will now start collecting metrics from your benchmarking script. Once you think you have collected enough samples (usually this is the case after 3 seconds of recording), stop your profiler. 7. Make sure that in toolbar of the bottom window, `profile` is selected. 8. You should be able to see your call graph. * If you don't see the call graph or an incomplete call graph, make sure you have compiled - zstd and your benchmarking scripg using debug flags. On mac and linux, this just means + zstd and your benchmarking script using debug flags. On mac and linux, this just means you will have to supply the `-g` flag alone with your build script. You might also have to provide the `-fno-omit-frame-pointer` flag 9. Dig down the graph to find your function call and then inspect it by double clicking @@ -329,7 +365,7 @@ Some general notes on perf: counter statistics. Perf uses a high resolution timer and this is likely one of the first things your team will run when assessing your PR. * Perf has a long list of hardware counters that can be viewed with `perf --list`. -When measuring optimizations, something worth trying is to make sure the handware +When measuring optimizations, something worth trying is to make sure the hardware counters you expect to be impacted by your change are in fact being so. For example, if you expect the L1 cache misses to decrease with your change, you can look at the counter `L1-dcache-load-misses` @@ -339,57 +375,6 @@ counter `L1-dcache-load-misses` TODO - -## Setting up continuous integration (CI) on your fork -Zstd uses a number of different continuous integration (CI) tools to ensure that new changes -are well tested before they make it to an official release. Specifically, we use the platforms -travis-ci, circle-ci, and appveyor. - -Changes cannot be merged into the main dev branch unless they pass all of our CI tests. -The easiest way to run these CI tests on your own before submitting a PR to our dev branch -is to configure your personal fork of zstd with each of the CI platforms. Below, you'll find -instructions for doing this. - -### travis-ci -Follow these steps to link travis-ci with your github fork of zstd - -1. Make sure you are logged into your github account -2. Go to https://travis-ci.org/ -3. Click 'Sign in with Github' on the top right -4. Click 'Authorize travis-ci' -5. Click 'Activate all repositories using Github Apps' -6. Select 'Only select repositories' and select your fork of zstd from the drop down -7. Click 'Approve and Install' -8. Click 'Sign in with Github' again. This time, it will be for travis-pro (which will let you view your tests on the web dashboard) -9. Click 'Authorize travis-pro' -10. You should have travis set up on your fork now. - -### circle-ci -TODO - -### appveyor -Follow these steps to link circle-ci with your girhub fork of zstd - -1. Make sure you are logged into your github account -2. Go to https://www.appveyor.com/ -3. Click 'Sign in' on the top right -4. Select 'Github' on the left panel -5. Click 'Authorize appveyor' -6. You might be asked to select which repositories you want to give appveyor permission to. Select your fork of zstd if you're prompted -7. You should have appveyor set up on your fork now. - -### General notes on CI -CI tests run every time a pull request (PR) is created or updated. The exact tests -that get run will depend on the destination branch you specify. Some tests take -longer to run than others. Currently, our CI is set up to run a short -series of tests when creating a PR to the dev branch and a longer series of tests -when creating a PR to the release branch. You can look in the configuration files -of the respective CI platform for more information on what gets run when. - -Most people will just want to create a PR with the destination set to their local dev -branch of zstd. You can then find the status of the tests on the PR's page. You can also -re-run tests and cancel running tests from the PR page or from the respective CI's dashboard. - ## Issues We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue. @@ -470,7 +455,7 @@ This design requirement is fundamental to preserve the portability of the code b Any variable that can be `const` (aka. read-only) **must** be `const`. Any pointer which content will not be modified must be `const`. This property is then controlled at compiler level. - `const` variables are an important signal to readers that this variable isn’t modified. + `const` variables are an important signal to readers that this variable isn't modified. Conversely, non-const variables are a signal to readers to watch out for modifications later on in the function. * If a function must be inlined, mention it explicitly, using project's own portable macros, such as `FORCE_INLINE_ATTR`, diff --git a/src/dependencies/zstd-1.5.0/COPYING b/src/dependencies/zstd-1.5.4/COPYING similarity index 100% rename from src/dependencies/zstd-1.5.0/COPYING rename to src/dependencies/zstd-1.5.4/COPYING diff --git a/src/dependencies/zstd-1.5.0/LICENSE b/src/dependencies/zstd-1.5.4/LICENSE similarity index 82% rename from src/dependencies/zstd-1.5.0/LICENSE rename to src/dependencies/zstd-1.5.4/LICENSE index a793a80..7580028 100644 --- a/src/dependencies/zstd-1.5.0/LICENSE +++ b/src/dependencies/zstd-1.5.4/LICENSE @@ -2,7 +2,7 @@ BSD License For Zstandard software -Copyright (c) 2016-present, Facebook, Inc. All rights reserved. +Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -14,9 +14,9 @@ are permitted provided that the following conditions are met: this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name Facebook nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. + * Neither the name Facebook, nor Meta, nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED diff --git a/src/dependencies/zstd-1.5.0/Makefile b/src/dependencies/zstd-1.5.4/Makefile similarity index 89% rename from src/dependencies/zstd-1.5.0/Makefile rename to src/dependencies/zstd-1.5.4/Makefile index c1908f0..a7890a5 100644 --- a/src/dependencies/zstd-1.5.0/Makefile +++ b/src/dependencies/zstd-1.5.4/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2015-2021, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -29,6 +29,7 @@ VOID = /dev/null # fail on other tested distros (ubuntu, debian) even # without manually specifying the TARGET_SYSTEM. TARGET_SYSTEM ?= $(OS) +CP ?= cp ifneq (,$(filter Windows%,$(TARGET_SYSTEM))) EXT =.exe @@ -69,7 +70,7 @@ zstd zstd-release: .PHONY: zstdmt zstdmt: $(Q)$(MAKE) -C $(PRGDIR) $@ - $(Q)cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT) + $(Q)$(CP) $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT) .PHONY: zlibwrapper zlibwrapper: lib @@ -122,6 +123,7 @@ contrib: lib $(MAKE) -C contrib/seekable_format/examples all $(MAKE) -C contrib/seekable_format/tests test $(MAKE) -C contrib/largeNbDicts all + $(MAKE) -C contrib/externalSequenceProducer all cd build/single_file_libs/ ; ./build_decoder_test.sh cd build/single_file_libs/ ; ./build_library_test.sh @@ -141,6 +143,7 @@ clean: $(Q)$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID) $(Q)$(MAKE) -C contrib/seekable_format/tests $@ > $(VOID) $(Q)$(MAKE) -C contrib/largeNbDicts $@ > $(VOID) + $(Q)$(MAKE) -C contrib/externalSequenceProducer $@ > $(VOID) $(Q)$(RM) zstd$(EXT) zstdmt$(EXT) tmp* $(Q)$(RM) -r lz4 @echo Cleaning completed @@ -148,13 +151,15 @@ clean: #------------------------------------------------------------------------------ # make install is validated only for Linux, macOS, Hurd and some BSD targets #------------------------------------------------------------------------------ -ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku)) +ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku AIX)) HOST_OS = POSIX +MKDIR ?= mkdir -p + HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) EGREP_OPTIONS ?= -ifeq ($HAVE_COLORNEVER, 1) +ifeq ($(HAVE_COLORNEVER), 1) EGREP_OPTIONS += --color=never endif EGREP = egrep $(EGREP_OPTIONS) @@ -217,7 +222,7 @@ armbuild: clean CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd aarch64build: clean - CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd + CC=aarch64-linux-gnu-gcc CFLAGS="-Werror -O0" $(MAKE) allzstd ppcbuild: clean CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) -j allzstd @@ -284,6 +289,22 @@ uasanregressiontest: msanregressiontest: $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory" +update_regressionResults : REGRESS_RESULTS_DIR := /tmp/regress_results_dir/ +update_regressionResults: + $(MAKE) -C programs zstd + $(MAKE) -C tests/regression test + $(RM) -rf $(REGRESS_RESULTS_DIR) + $(MKDIR) $(REGRESS_RESULTS_DIR) + ./tests/regression/test \ + --cache tests/regression/cache \ + --output $(REGRESS_RESULTS_DIR)/results.csv \ + --zstd programs/zstd + echo "Showing results differences" + ! diff tests/regression/results.csv $(REGRESS_RESULTS_DIR)/results.csv + echo "Updating results.csv" + $(CP) $(REGRESS_RESULTS_DIR)/results.csv tests/regression/results.csv + + # run UBsan with -fsanitize-recover=pointer-overflow # this only works with recent compilers such as gcc 8+ usan: clean @@ -315,6 +336,8 @@ tsan-%: clean .PHONY: apt-install apt-install: + # TODO: uncomment once issue 3011 is resolved and remove hack from Github Actions .yml + # sudo apt-get update sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES) .PHONY: apt-add-repo @@ -372,7 +395,7 @@ ifneq (,$(filter $(HOST_OS),MSYS POSIX)) cmakebuild: cmake --version $(RM) -r $(BUILDIR)/cmake/build - mkdir $(BUILDIR)/cmake/build + $(MKDIR) $(BUILDIR)/cmake/build cd $(BUILDIR)/cmake/build; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) .. $(MAKE) -C $(BUILDIR)/cmake/build -j4; $(MAKE) -C $(BUILDIR)/cmake/build install; @@ -381,23 +404,23 @@ cmakebuild: c89build: clean $(CC) -v - CFLAGS="-std=c89 -Werror" $(MAKE) allmost # will fail, due to missing support for `long long` + CFLAGS="-std=c89 -Werror -Wno-attributes -Wpedantic -Wno-long-long -Wno-variadic-macros -O0" $(MAKE) lib zstd gnu90build: clean $(CC) -v - CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost + CFLAGS="-std=gnu90 -Werror -O0" $(MAKE) allmost c99build: clean $(CC) -v - CFLAGS="-std=c99 -Werror" $(MAKE) allmost + CFLAGS="-std=c99 -Werror -O0" $(MAKE) allmost gnu99build: clean $(CC) -v - CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost + CFLAGS="-std=gnu99 -Werror -O0" $(MAKE) allmost c11build: clean $(CC) -v - CFLAGS="-std=c11 -Werror" $(MAKE) allmost + CFLAGS="-std=c11 -Werror -O0" $(MAKE) allmost bmix64build: clean $(CC) -v @@ -416,5 +439,5 @@ bmi32build: clean staticAnalyze: SCANBUILD ?= scan-build staticAnalyze: $(CC) -v - CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) allzstd examples contrib + CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) zstd endif diff --git a/src/dependencies/zstd-1.5.4/Package.swift b/src/dependencies/zstd-1.5.4/Package.swift new file mode 100644 index 0000000..97f2c6a --- /dev/null +++ b/src/dependencies/zstd-1.5.4/Package.swift @@ -0,0 +1,36 @@ +// swift-tools-version:5.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "zstd", + platforms: [ + .macOS(.v10_10), .iOS(.v9), .tvOS(.v9) + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "libzstd", + targets: [ "libzstd" ]) + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "libzstd", + path: "lib", + sources: [ "common", "compress", "decompress", "dictBuilder" ], + publicHeadersPath: ".", + cSettings: [ + .headerSearchPath(".") + ]) + ], + swiftLanguageVersions: [.v5], + cLanguageStandard: .gnu11, + cxxLanguageStandard: .gnucxx14 +) diff --git a/src/dependencies/zstd-1.5.0/README.md b/src/dependencies/zstd-1.5.4/README.md similarity index 73% rename from src/dependencies/zstd-1.5.0/README.md rename to src/dependencies/zstd-1.5.4/README.md index dcca766..6bcf757 100644 --- a/src/dependencies/zstd-1.5.0/README.md +++ b/src/dependencies/zstd-1.5.4/README.md @@ -4,10 +4,11 @@ __Zstandard__, or `zstd` as short version, is a fast lossless compression algori targeting real-time compression scenarios at zlib-level and better compression ratios. It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy). -The project is provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library, +Zstandard's format is stable and documented in [RFC8878](https://datatracker.ietf.org/doc/html/rfc8878). Multiple independent implementations are already available. +This repository represents the reference implementation, provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library, and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files. Should your project require another programming language, -a list of known ports and bindings is provided on [Zstandard homepage](http://www.zstd.net/#other-languages). +a list of known ports and bindings is provided on [Zstandard homepage](https://facebook.github.io/zstd/#other-languages). **Development branch status:** @@ -17,8 +18,8 @@ a list of known ports and bindings is provided on [Zstandard homepage](http://ww [![Build status][CirrusDevBadge]][CirrusLink] [![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink] -[travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite" -[travisLink]: https://travis-ci.org/facebook/zstd +[travisDevBadge]: https://api.travis-ci.com/facebook/zstd.svg?branch=dev "Continuous Integration test suite" +[travisLink]: https://travis-ci.com/facebook/zstd [AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/xt38wbdxjk5mrbem/branch/dev?svg=true "Windows test suite" [AppveyorLink]: https://ci.appveyor.com/project/YannCollet/zstd-p0yf0 [CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite" @@ -31,37 +32,36 @@ a list of known ports and bindings is provided on [Zstandard homepage](http://ww ## Benchmarks For reference, several fast compression algorithms were tested and compared -on a server running Arch Linux (`Linux version 5.5.11-arch1-1`), -with a Core i9-9900K CPU @ 5.0GHz, +on a desktop running Ubuntu 20.04 (`Linux 5.11.0-41-generic`), +with a Core i7-9700K CPU @ 4.9GHz, using [lzbench], an open-source in-memory benchmark by @inikep compiled with [gcc] 9.3.0, on the [Silesia compression corpus]. [lzbench]: https://github.com/inikep/lzbench -[Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia +[Silesia compression corpus]: https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia [gcc]: https://gcc.gnu.org/ | Compressor name | Ratio | Compression| Decompress.| | --------------- | ------| -----------| ---------- | -| **zstd 1.4.5 -1** | 2.884 | 500 MB/s | 1660 MB/s | -| zlib 1.2.11 -1 | 2.743 | 90 MB/s | 400 MB/s | -| brotli 1.0.7 -0 | 2.703 | 400 MB/s | 450 MB/s | -| **zstd 1.4.5 --fast=1** | 2.434 | 570 MB/s | 2200 MB/s | -| **zstd 1.4.5 --fast=3** | 2.312 | 640 MB/s | 2300 MB/s | -| quicklz 1.5.0 -1 | 2.238 | 560 MB/s | 710 MB/s | -| **zstd 1.4.5 --fast=5** | 2.178 | 700 MB/s | 2420 MB/s | -| lzo1x 2.10 -1 | 2.106 | 690 MB/s | 820 MB/s | -| lz4 1.9.2 | 2.101 | 740 MB/s | 4530 MB/s | -| **zstd 1.4.5 --fast=7** | 2.096 | 750 MB/s | 2480 MB/s | -| lzf 3.6 -1 | 2.077 | 410 MB/s | 860 MB/s | -| snappy 1.1.8 | 2.073 | 560 MB/s | 1790 MB/s | +| **zstd 1.5.1 -1** | 2.887 | 530 MB/s | 1700 MB/s | +| [zlib] 1.2.11 -1 | 2.743 | 95 MB/s | 400 MB/s | +| brotli 1.0.9 -0 | 2.702 | 395 MB/s | 450 MB/s | +| **zstd 1.5.1 --fast=1** | 2.437 | 600 MB/s | 2150 MB/s | +| **zstd 1.5.1 --fast=3** | 2.239 | 670 MB/s | 2250 MB/s | +| quicklz 1.5.0 -1 | 2.238 | 540 MB/s | 760 MB/s | +| **zstd 1.5.1 --fast=4** | 2.148 | 710 MB/s | 2300 MB/s | +| lzo1x 2.10 -1 | 2.106 | 660 MB/s | 845 MB/s | +| [lz4] 1.9.3 | 2.101 | 740 MB/s | 4500 MB/s | +| lzf 3.6 -1 | 2.077 | 410 MB/s | 830 MB/s | +| snappy 1.1.9 | 2.073 | 550 MB/s | 1750 MB/s | -[zlib]: http://www.zlib.net/ -[LZ4]: http://www.lz4.org/ +[zlib]: https://www.zlib.net/ +[lz4]: https://lz4.github.io/lz4/ The negative compression levels, specified with `--fast=#`, -offer faster compression and decompression speed in exchange for some loss in -compression ratio compared to level 1, as seen in the table above. +offer faster compression and decompression speed +at the cost of compression ratio (compared to level 1). Zstd can also offer stronger compression ratios at the cost of compression speed. Speed vs Compression trade-off is configurable by small increments. @@ -124,14 +124,27 @@ Dictionary gains are mostly effective in the first few KB. Then, the compression ## Build instructions +`make` is the officially maintained build system of this project. +All other build systems are "compatible" and 3rd-party maintained, +they may feature small differences in advanced options. +When your system allows it, prefer using `make` to build `zstd` and `libzstd`. + ### Makefile If your system is compatible with standard `make` (or `gmake`), invoking `make` in root directory will generate `zstd` cli in root directory. +It will also create `libzstd` into `lib/`. Other available options include: - `make install` : create and install zstd cli, library and man pages -- `make check` : create and run `zstd`, tests its behavior on local platform +- `make check` : create and run `zstd`, test its behavior on local platform + +The `Makefile` follows the [GNU Standard Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html), +allowing staged install, standard flags, directory variables and command variables. + +For advanced use cases, specialized compilation flags which control binary generation +are documented in [`lib/README.md`](lib/README.md#modular-build) for the `libzstd` library +and in [`programs/README.md`](programs/README.md#compilation-variables) for the `zstd` CLI. ### cmake @@ -178,13 +191,15 @@ The output binary will be in `buck-out/gen/programs/`. ## Testing -You can run quick local smoke tests by executing the `playTest.sh` script from the `src/tests` directory. -Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the zstd and datagen binary. -For information on CI testing, please refer to TESTING.md +You can run quick local smoke tests by running `make check`. +If you can't use `make`, execute the `playTest.sh` script from the `src/tests` directory. +Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the `zstd` and `datagen` binary. +For information on CI testing, please refer to `TESTING.md`. ## Status -Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases. +Zstandard is currently deployed within Facebook and many other large cloud infrastructures. +It is run continuously to compress large amounts of data in multiple formats and use cases. Zstandard is considered safe for production environments. ## License diff --git a/src/dependencies/zstd-1.5.0/TESTING.md b/src/dependencies/zstd-1.5.4/TESTING.md similarity index 95% rename from src/dependencies/zstd-1.5.0/TESTING.md rename to src/dependencies/zstd-1.5.4/TESTING.md index 32b133b..df842cc 100644 --- a/src/dependencies/zstd-1.5.0/TESTING.md +++ b/src/dependencies/zstd-1.5.4/TESTING.md @@ -22,7 +22,7 @@ They consist of the following tests: - `tests/playTests.sh --test-large-data` - Fuzzer tests: `tests/fuzzer.c`, `tests/zstreamtest.c`, and `tests/decodecorpus.c` - `tests/zstreamtest.c` under Tsan (streaming mode, including multithreaded mode) -- Valgrind Test (`make -C tests valgrindTest`) (testing CLI and fuzzer under valgrind) +- Valgrind Test (`make -C tests test-valgrind`) (testing CLI and fuzzer under `valgrind`) - Fuzzer tests (see above) on ARM, AArch64, PowerPC, and PowerPC64 Long Tests diff --git a/src/dependencies/zstd-1.5.4/appveyor.yml b/src/dependencies/zstd-1.5.4/appveyor.yml new file mode 100644 index 0000000..c58ef91 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/appveyor.yml @@ -0,0 +1,205 @@ +# Following tests are run _only_ on `release` branch +# and on selected feature branch named `appveyorTest` or `visual*` + +- + version: 1.0.{build} + branches: + only: + - release + - master + - /appveyor*/ + - /visual*/ + environment: + matrix: + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x64" + SCRIPT: "make allzstd MOREFLAGS=-static" + ARTIFACT: "true" + BUILD: "true" + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x86" + SCRIPT: "make allzstd MOREFLAGS=-static" + ARTIFACT: "true" + BUILD: "true" + + - COMPILER: "clang-cl" + HOST: "cmake-visual" + PLATFORM: "x64" + CONFIGURATION: "Release" + CMAKE_GENERATOR: "Visual Studio 15 2017" + CMAKE_GENERATOR_PLATFORM: "x64" + CMAKE_GENERATOR_TOOLSET: "LLVM" + APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + + install: + - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% + - SET PATH_ORIGINAL=%PATH% + - if [%HOST%]==[mingw] ( + SET "PATH_MINGW32=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin" && + SET "PATH_MINGW64=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin" && + COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\make.exe && + COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\make.exe + ) + - IF [%HOST%]==[visual] IF [%PLATFORM%]==[x64] ( + SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;" + ) + + build_script: + - if [%HOST%]==[mingw] ( + ( if [%PLATFORM%]==[x64] ( + SET "PATH=%PATH_MINGW64%;%PATH_ORIGINAL%" + ) else if [%PLATFORM%]==[x86] ( + SET "PATH=%PATH_MINGW32%;%PATH_ORIGINAL%" + ) ) + ) + - if [%HOST%]==[mingw] if [%BUILD%]==[true] ( + make -v && + sh -c "%COMPILER% -v" && + ECHO Building zlib to static link && + SET "CC=%COMPILER%" && + sh -c "cd .. && git clone --depth 1 --branch v1.2.11 https://github.com/madler/zlib" && + sh -c "cd ../zlib && make -f win32/Makefile.gcc libz.a" + ECHO Building zstd && + SET "CPPFLAGS=-I../../zlib" && + SET "LDFLAGS=../../zlib/libz.a" && + sh -c "%SCRIPT%" && + ( if [%COMPILER%]==[gcc] if [%ARTIFACT%]==[true] + ECHO Creating artifacts && + ECHO %cd% && + lib\dll\example\build_package.bat && + make -C programs DEBUGFLAGS= clean zstd && + cd programs\ && 7z a -tzip -mx9 zstd-win-binary-%PLATFORM%.zip zstd.exe && + appveyor PushArtifact zstd-win-binary-%PLATFORM%.zip && + cp zstd.exe ..\bin\zstd.exe && + git clone --depth 1 --branch release https://github.com/facebook/zstd && + cd zstd && + git archive --format=tar release -o zstd-src.tar && + ..\zstd -19 zstd-src.tar && + appveyor PushArtifact zstd-src.tar.zst && + certUtil -hashfile zstd-src.tar.zst SHA256 > zstd-src.tar.zst.sha256.sig && + appveyor PushArtifact zstd-src.tar.zst.sha256.sig && + cd ..\..\bin\ && + 7z a -tzip -mx9 zstd-win-release-%PLATFORM%.zip * && + appveyor PushArtifact zstd-win-release-%PLATFORM%.zip + ) + ) + - if [%HOST%]==[cmake-visual] ( + ECHO *** && + ECHO *** Building %CMAKE_GENERATOR% ^(%CMAKE_GENERATOR_TOOLSET%^) %PLATFORM%\%CONFIGURATION% && + PUSHD build\cmake && + cmake -DBUILD_TESTING=ON . && + cmake --build . --config %CONFIGURATION% -j4 && + POPD && + ECHO *** + ) + + test_script: + - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% + - SET "CC=gcc" + - SET "CXX=g++" + - if [%TEST%]==[cmake] ( + mkdir build\cmake\build && + cd build\cmake\build && + SET FUZZERTEST=-T2mn && + SET ZSTREAM_TESTTIME=-T2mn && + cmake -G "Visual Studio 14 2015 Win64" .. && + cd ..\..\.. && + make clean + ) + + +# The following tests are for regular pushes +# into `dev` or some feature branch +# There run less tests, for shorter feedback loop + +- + version: 1.0.{build} + environment: + matrix: + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "x64" + CONFIGURATION: "Debug" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "Win32" + CONFIGURATION: "Debug" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "x64" + CONFIGURATION: "Release" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "Win32" + CONFIGURATION: "Release" + + - COMPILER: "gcc" + HOST: "cygwin" + PLATFORM: "x64" + + - COMPILER: "clang-cl" + HOST: "cmake-visual" + PLATFORM: "x64" + CONFIGURATION: "Release" + CMAKE_GENERATOR: "Visual Studio 15 2017" + CMAKE_GENERATOR_PLATFORM: "x64" + CMAKE_GENERATOR_TOOLSET: "LLVM" + APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017" + + install: + - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% + - SET PATH_ORIGINAL=%PATH% + - if [%HOST%]==[cygwin] ( + ECHO Installing Cygwin Packages && + C:\cygwin64\setup-x86_64.exe -qnNdO -R "C:\cygwin64" -g -P ^ + gcc,^ + cmake,^ + make + ) + - IF [%HOST%]==[visual] IF [%PLATFORM%]==[x64] ( + SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;" + ) + + build_script: + - ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION% + - if [%HOST%]==[cygwin] ( + set CHERE_INVOKING=yes && + set CC=%COMPILER% && + C:\cygwin64\bin\bash --login -c " + set -e; + cd build/cmake; + CFLAGS='-Werror' cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_FUZZER_FLAGS=-T20s -DZSTD_ZSTREAM_FLAGS=-T20s -DZSTD_FULLBENCH_FLAGS=-i0 .; + make VERBOSE=1 -j; + ctest -V -L Medium; + " + ) + - if [%HOST%]==[cmake-visual] ( + ECHO *** && + ECHO *** Building %CMAKE_GENERATOR% ^(%CMAKE_GENERATOR_TOOLSET%^) %PLATFORM%\%CONFIGURATION% && + PUSHD build\cmake && + cmake -DBUILD_TESTING=ON . && + cmake --build . --config %CONFIGURATION% -j4 && + POPD && + ECHO *** + ) + - if [%HOST%]==[visual] ( + ECHO *** && + ECHO *** Building Visual Studio 2012 %PLATFORM%\%CONFIGURATION% && + ECHO *** && + msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v110 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && + DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && + msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v110 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && + DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe + ) + + + test_script: + - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% + - SET "FUZZERTEST=-T10s" + - if [%HOST%]==[mingw] ( + set "CC=%COMPILER%" && + make clean && + make check + ) \ No newline at end of file diff --git a/src/dependencies/zstd-1.5.0/build/.gitignore b/src/dependencies/zstd-1.5.4/build/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/build/.gitignore rename to src/dependencies/zstd-1.5.4/build/.gitignore diff --git a/src/dependencies/zstd-1.5.0/build/LICENSE b/src/dependencies/zstd-1.5.4/build/LICENSE similarity index 100% rename from src/dependencies/zstd-1.5.0/build/LICENSE rename to src/dependencies/zstd-1.5.4/build/LICENSE diff --git a/src/dependencies/zstd-1.5.0/build/README.md b/src/dependencies/zstd-1.5.4/build/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/build/README.md rename to src/dependencies/zstd-1.5.4/build/README.md diff --git a/src/dependencies/zstd-1.5.0/build/VS2008/fullbench/fullbench.vcproj b/src/dependencies/zstd-1.5.4/build/VS2008/fullbench/fullbench.vcproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2008/fullbench/fullbench.vcproj rename to src/dependencies/zstd-1.5.4/build/VS2008/fullbench/fullbench.vcproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2008/fuzzer/fuzzer.vcproj b/src/dependencies/zstd-1.5.4/build/VS2008/fuzzer/fuzzer.vcproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2008/fuzzer/fuzzer.vcproj rename to src/dependencies/zstd-1.5.4/build/VS2008/fuzzer/fuzzer.vcproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2008/zstd.sln b/src/dependencies/zstd-1.5.4/build/VS2008/zstd.sln similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2008/zstd.sln rename to src/dependencies/zstd-1.5.4/build/VS2008/zstd.sln diff --git a/src/dependencies/zstd-1.5.0/build/VS2008/zstd/zstd.vcproj b/src/dependencies/zstd-1.5.4/build/VS2008/zstd/zstd.vcproj similarity index 99% rename from src/dependencies/zstd-1.5.0/build/VS2008/zstd/zstd.vcproj rename to src/dependencies/zstd-1.5.4/build/VS2008/zstd/zstd.vcproj index c7eec57..91f2bda 100644 --- a/src/dependencies/zstd-1.5.0/build/VS2008/zstd/zstd.vcproj +++ b/src/dependencies/zstd-1.5.4/build/VS2008/zstd/zstd.vcproj @@ -384,6 +384,10 @@ RelativePath="..\..\..\programs\fileio.c" >
    + + diff --git a/src/dependencies/zstd-1.5.0/build/VS2008/zstdlib/zstdlib.vcproj b/src/dependencies/zstd-1.5.4/build/VS2008/zstdlib/zstdlib.vcproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2008/zstdlib/zstdlib.vcproj rename to src/dependencies/zstd-1.5.4/build/VS2008/zstdlib/zstdlib.vcproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/CompileAsCpp.props b/src/dependencies/zstd-1.5.4/build/VS2010/CompileAsCpp.props similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/CompileAsCpp.props rename to src/dependencies/zstd-1.5.4/build/VS2010/CompileAsCpp.props diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/datagen/datagen.vcxproj b/src/dependencies/zstd-1.5.4/build/VS2010/datagen/datagen.vcxproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/datagen/datagen.vcxproj rename to src/dependencies/zstd-1.5.4/build/VS2010/datagen/datagen.vcxproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/fullbench-dll/fullbench-dll.vcxproj b/src/dependencies/zstd-1.5.4/build/VS2010/fullbench-dll/fullbench-dll.vcxproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/fullbench-dll/fullbench-dll.vcxproj rename to src/dependencies/zstd-1.5.4/build/VS2010/fullbench-dll/fullbench-dll.vcxproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/fullbench/fullbench.vcxproj b/src/dependencies/zstd-1.5.4/build/VS2010/fullbench/fullbench.vcxproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/fullbench/fullbench.vcxproj rename to src/dependencies/zstd-1.5.4/build/VS2010/fullbench/fullbench.vcxproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/fuzzer/fuzzer.vcxproj b/src/dependencies/zstd-1.5.4/build/VS2010/fuzzer/fuzzer.vcxproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/fuzzer/fuzzer.vcxproj rename to src/dependencies/zstd-1.5.4/build/VS2010/fuzzer/fuzzer.vcxproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/libzstd-dll/libzstd-dll.rc b/src/dependencies/zstd-1.5.4/build/VS2010/libzstd-dll/libzstd-dll.rc similarity index 88% rename from src/dependencies/zstd-1.5.0/build/VS2010/libzstd-dll/libzstd-dll.rc rename to src/dependencies/zstd-1.5.4/build/VS2010/libzstd-dll/libzstd-dll.rc index ee9f562..13e8746 100644 --- a/src/dependencies/zstd-1.5.0/build/VS2010/libzstd-dll/libzstd-dll.rc +++ b/src/dependencies/zstd-1.5.4/build/VS2010/libzstd-dll/libzstd-dll.rc @@ -32,11 +32,11 @@ BEGIN BEGIN BLOCK "040904B0" BEGIN - VALUE "CompanyName", "Yann Collet, Facebook, Inc." + VALUE "CompanyName", "Meta Platforms, Inc." VALUE "FileDescription", "Zstandard - Fast and efficient compression algorithm" VALUE "FileVersion", ZSTD_VERSION_STRING VALUE "InternalName", "libzstd.dll" - VALUE "LegalCopyright", "Copyright (c) 2013-present, Yann Collet, Facebook, Inc." + VALUE "LegalCopyright", "Copyright (c) Meta Platforms, Inc. and affiliates." VALUE "OriginalFilename", "libzstd.dll" VALUE "ProductName", "Zstandard" VALUE "ProductVersion", ZSTD_VERSION_STRING diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/libzstd-dll/libzstd-dll.vcxproj b/src/dependencies/zstd-1.5.4/build/VS2010/libzstd-dll/libzstd-dll.vcxproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/libzstd-dll/libzstd-dll.vcxproj rename to src/dependencies/zstd-1.5.4/build/VS2010/libzstd-dll/libzstd-dll.vcxproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/libzstd/libzstd.vcxproj b/src/dependencies/zstd-1.5.4/build/VS2010/libzstd/libzstd.vcxproj similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/libzstd/libzstd.vcxproj rename to src/dependencies/zstd-1.5.4/build/VS2010/libzstd/libzstd.vcxproj diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/zstd.sln b/src/dependencies/zstd-1.5.4/build/VS2010/zstd.sln similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS2010/zstd.sln rename to src/dependencies/zstd-1.5.4/build/VS2010/zstd.sln diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/zstd/zstd.rc b/src/dependencies/zstd-1.5.4/build/VS2010/zstd/zstd.rc similarity index 88% rename from src/dependencies/zstd-1.5.0/build/VS2010/zstd/zstd.rc rename to src/dependencies/zstd-1.5.4/build/VS2010/zstd/zstd.rc index f5e4047..a2118c2 100644 --- a/src/dependencies/zstd-1.5.0/build/VS2010/zstd/zstd.rc +++ b/src/dependencies/zstd-1.5.4/build/VS2010/zstd/zstd.rc @@ -32,11 +32,11 @@ BEGIN BEGIN BLOCK "040904B0" BEGIN - VALUE "CompanyName", "Yann Collet, Facebook, Inc." + VALUE "CompanyName", "Meta Platforms, Inc." VALUE "FileDescription", "Zstandard - Fast and efficient compression algorithm" VALUE "FileVersion", ZSTD_VERSION_STRING VALUE "InternalName", "zstd.exe" - VALUE "LegalCopyright", "Copyright (c) 2013-present, Yann Collet, Facebook, Inc." + VALUE "LegalCopyright", "Copyright (c) Meta Platforms, Inc. and affiliates." VALUE "OriginalFilename", "zstd.exe" VALUE "ProductName", "Zstandard" VALUE "ProductVersion", ZSTD_VERSION_STRING diff --git a/src/dependencies/zstd-1.5.0/build/VS2010/zstd/zstd.vcxproj b/src/dependencies/zstd-1.5.4/build/VS2010/zstd/zstd.vcxproj similarity index 99% rename from src/dependencies/zstd-1.5.0/build/VS2010/zstd/zstd.vcxproj rename to src/dependencies/zstd-1.5.4/build/VS2010/zstd/zstd.vcxproj index 46e22f4..8ab239d 100644 --- a/src/dependencies/zstd-1.5.0/build/VS2010/zstd/zstd.vcxproj +++ b/src/dependencies/zstd-1.5.4/build/VS2010/zstd/zstd.vcxproj @@ -62,6 +62,7 @@ +
    diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/README.md b/src/dependencies/zstd-1.5.4/build/VS_scripts/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/README.md rename to src/dependencies/zstd-1.5.4/build/VS_scripts/README.md diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2010.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2010.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2010.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2010.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2012.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2012.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2012.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2012.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2013.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2013.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2013.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2013.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2015.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2015.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2015.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2015.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017Community.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017Community.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017Community.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017Community.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017Enterprise.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017Enterprise.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017Enterprise.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017Enterprise.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017Professional.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017Professional.cmd similarity index 100% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.VS2017Professional.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.VS2017Professional.cmd diff --git a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.generic.cmd b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.generic.cmd similarity index 77% rename from src/dependencies/zstd-1.5.0/build/VS_scripts/build.generic.cmd rename to src/dependencies/zstd-1.5.4/build/VS_scripts/build.generic.cmd index a7ca4d0..b24e6ed 100644 --- a/src/dependencies/zstd-1.5.0/build/VS_scripts/build.generic.cmd +++ b/src/dependencies/zstd-1.5.4/build/VS_scripts/build.generic.cmd @@ -19,10 +19,10 @@ GOTO build :display_help echo Syntax: build.generic.cmd msbuild_version msbuild_platform msbuild_configuration msbuild_toolset -echo msbuild_version: VS installed version (VS2012, VS2013, VS2015, VS2017, ...) +echo msbuild_version: VS installed version (VS2012, VS2013, VS2015, VS2017, VS2019, ...) echo msbuild_platform: Platform (x64 or Win32) echo msbuild_configuration: VS configuration (Release or Debug) -echo msbuild_toolset: Platform Toolset (v100, v110, v120, v140, v141) +echo msbuild_toolset: Platform Toolset (v100, v110, v120, v140, v141, v142, ...) EXIT /B 1 @@ -43,6 +43,16 @@ IF %msbuild_version% == VS2017 ( IF EXIST %msbuild_vs2017enterprise% SET msbuild=%msbuild_vs2017enterprise% ) +:: VS2019 +SET msbuild_vs2019community="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" +SET msbuild_vs2019professional="%programfiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" +SET msbuild_vs2019enterprise="%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" +IF %msbuild_version% == VS2019 ( + IF EXIST %msbuild_vs2019community% SET msbuild=%msbuild_vs2019community% + IF EXIST %msbuild_vs2019professional% SET msbuild=%msbuild_vs2019professional% + IF EXIST %msbuild_vs2019enterprise% SET msbuild=%msbuild_vs2019enterprise% +) + SET project="%~p0\..\VS2010\zstd.sln" SET msbuild_params=/verbosity:minimal /nologo /t:Clean,Build /p:Platform=%msbuild_platform% /p:Configuration=%msbuild_configuration% diff --git a/src/dependencies/zstd-1.5.0/build/cmake/.gitignore b/src/dependencies/zstd-1.5.4/build/cmake/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/.gitignore rename to src/dependencies/zstd-1.5.4/build/cmake/.gitignore diff --git a/src/dependencies/zstd-1.5.0/build/cmake/CMakeLists.txt b/src/dependencies/zstd-1.5.4/build/cmake/CMakeLists.txt similarity index 89% rename from src/dependencies/zstd-1.5.0/build/cmake/CMakeLists.txt rename to src/dependencies/zstd-1.5.4/build/cmake/CMakeLists.txt index a050577..0bffc87 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/CMakeLists.txt +++ b/src/dependencies/zstd-1.5.4/build/cmake/CMakeLists.txt @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -8,18 +8,18 @@ # ################################################################ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) - -# As of 2018-12-26 ZSTD has been validated to build with cmake version 3.13.2 new policies. -# Set and use the newest cmake policies that are validated to work -set(ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION "3") + +# As of 2018-12-26 ZSTD has been validated to build with cmake version 3.13.2 new policies. +# Set and use the newest cmake policies that are validated to work +set(ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION "3") set(ZSTD_MAX_VALIDATED_CMAKE_MINOR_VERSION "13") #Policies never changed at PATCH level if("${CMAKE_MAJOR_VERSION}" LESS 3) - set(ZSTD_CMAKE_POLICY_VERSION "${CMAKE_VERSION}") -elseif( "${ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION}" EQUAL "${CMAKE_MAJOR_VERSION}" AND + set(ZSTD_CMAKE_POLICY_VERSION "${CMAKE_VERSION}") +elseif( "${ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION}" EQUAL "${CMAKE_MAJOR_VERSION}" AND "${ZSTD_MAX_VALIDATED_CMAKE_MINOR_VERSION}" GREATER "${CMAKE_MINOR_VERSION}") - set(ZSTD_CMAKE_POLICY_VERSION "${CMAKE_VERSION}") -else() - set(ZSTD_CMAKE_POLICY_VERSION "${ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION}.${ZSTD_MAX_VALIDATED_CMAKE_MINOR_VERSION}.0") + set(ZSTD_CMAKE_POLICY_VERSION "${CMAKE_VERSION}") +else() + set(ZSTD_CMAKE_POLICY_VERSION "${ZSTD_MAX_VALIDATED_CMAKE_MAJOR_VERSION}.${ZSTD_MAX_VALIDATED_CMAKE_MINOR_VERSION}.0") endif() cmake_policy(VERSION ${ZSTD_CMAKE_POLICY_VERSION}) @@ -40,16 +40,18 @@ if( CMAKE_MAJOR_VERSION LESS 3 ) set(PROJECT_VERSION_PATCH ${zstd_VERSION_PATCH}) set(PROJECT_VERSION "${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}") enable_language(C) # Main library is in C + enable_language(ASM) # And ASM enable_language(CXX) # Testing contributed code also utilizes CXX else() project(zstd VERSION "${zstd_VERSION_MAJOR}.${zstd_VERSION_MINOR}.${zstd_VERSION_PATCH}" LANGUAGES C # Main library is in C + ASM # And ASM CXX # Testing contributed code also utilizes CXX ) endif() message(STATUS "ZSTD VERSION: ${zstd_VERSION}") -set(zstd_HOMEPAGE_URL "http://www.zstd.net") +set(zstd_HOMEPAGE_URL "https://facebook.github.io/zstd") set(zstd_DESCRIPTION "Zstandard is a real-time compression algorithm, providing high compression ratios.") # Set a default build type if none was specified @@ -82,18 +84,25 @@ message(STATUS "CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}") #----------------------------------------------------------------------------- # Legacy support -option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" OFF) +option(ZSTD_LEGACY_SUPPORT "LEGACY SUPPORT" ON) if (ZSTD_LEGACY_SUPPORT) message(STATUS "ZSTD_LEGACY_SUPPORT defined!") - add_definitions(-DZSTD_LEGACY_SUPPORT=5) + set(ZSTD_LEGACY_LEVEL 5 CACHE STRING "") + add_definitions(-DZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_LEVEL}) else () message(STATUS "ZSTD_LEGACY_SUPPORT not defined!") add_definitions(-DZSTD_LEGACY_SUPPORT=0) endif () +if (ANDROID) + set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT OFF) +else() + set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT ON) +endif() + # Multi-threading support -option(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ON) +option(ZSTD_MULTITHREAD_SUPPORT "MULTITHREADING SUPPORT" ${ZSTD_MULTITHREAD_SUPPORT_DEFAULT}) if (ZSTD_MULTITHREAD_SUPPORT) message(STATUS "ZSTD_MULTITHREAD_SUPPORT is enabled") diff --git a/src/dependencies/zstd-1.5.0/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake b/src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake similarity index 57% rename from src/dependencies/zstd-1.5.0/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake rename to src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake index e23b9d6..0265349 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +++ b/src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake @@ -1,7 +1,8 @@ include(CheckCXXCompilerFlag) include(CheckCCompilerFlag) +include(CheckLinkerFlag) -function(EnableCompilerFlag _flag _C _CXX) +function(EnableCompilerFlag _flag _C _CXX _LD) string(REGEX REPLACE "\\+" "PLUS" varname "${_flag}") string(REGEX REPLACE "[^A-Za-z0-9]+" "_" varname "${varname}") string(REGEX REPLACE "^_+" "" varname "${varname}") @@ -18,43 +19,58 @@ function(EnableCompilerFlag _flag _C _CXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}" PARENT_SCOPE) endif () endif () + if (_LD) + CHECK_LINKER_FLAG(C ${_flag} LD_FLAG_${varname}) + if (LD_FLAG_${varname}) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_flag}" PARENT_SCOPE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_flag}" PARENT_SCOPE) + endif () + endif () endfunction() macro(ADD_ZSTD_COMPILATION_FLAGS) if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" OR MINGW) #Not only UNIX but also WIN32 for MinGW - #Set c++11 by default - EnableCompilerFlag("-std=c++11" false true) - #Set c99 by default - EnableCompilerFlag("-std=c99" true false) + # It's possible to select the exact standard used for compilation. + # It's not necessary, but can be employed for specific purposes. + # Note that zstd source code is compatible with both C++98 and above + # and C-gnu90 (c90 + long long + variadic macros ) and above + # EnableCompilerFlag("-std=c++11" false true) # Set C++ compilation to c++11 standard + # EnableCompilerFlag("-std=c99" true false) # Set C compiation to c99 standard if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND MSVC) # clang-cl normally maps -Wall to -Weverything. - EnableCompilerFlag("/clang:-Wall" true true) + EnableCompilerFlag("/clang:-Wall" true true false) else () - EnableCompilerFlag("-Wall" true true) + EnableCompilerFlag("-Wall" true true false) endif () - EnableCompilerFlag("-Wextra" true true) - EnableCompilerFlag("-Wundef" true true) - EnableCompilerFlag("-Wshadow" true true) - EnableCompilerFlag("-Wcast-align" true true) - EnableCompilerFlag("-Wcast-qual" true true) - EnableCompilerFlag("-Wstrict-prototypes" true false) + EnableCompilerFlag("-Wextra" true true false) + EnableCompilerFlag("-Wundef" true true false) + EnableCompilerFlag("-Wshadow" true true false) + EnableCompilerFlag("-Wcast-align" true true false) + EnableCompilerFlag("-Wcast-qual" true true false) + EnableCompilerFlag("-Wstrict-prototypes" true false false) # Enable asserts in Debug mode if (CMAKE_BUILD_TYPE MATCHES "Debug") - EnableCompilerFlag("-DDEBUGLEVEL=1" true true) + EnableCompilerFlag("-DDEBUGLEVEL=1" true true false) endif () + # Add noexecstack flags + # LDFLAGS + EnableCompilerFlag("-z noexecstack" false false true) + # CFLAGS & CXXFLAGS + EnableCompilerFlag("-Qunused-arguments" true true false) + EnableCompilerFlag("-Wa,--noexecstack" true true false) elseif (MSVC) # Add specific compilation flags for Windows Visual set(ACTIVATE_MULTITHREADED_COMPILATION "ON" CACHE BOOL "activate multi-threaded compilation (/MP flag)") if (CMAKE_GENERATOR MATCHES "Visual Studio" AND ACTIVATE_MULTITHREADED_COMPILATION) - EnableCompilerFlag("/MP" true true) + EnableCompilerFlag("/MP" true true false) endif () - + # UNICODE SUPPORT - EnableCompilerFlag("/D_UNICODE" true true) - EnableCompilerFlag("/DUNICODE" true true) + EnableCompilerFlag("/D_UNICODE" true true false) + EnableCompilerFlag("/DUNICODE" true true false) # Enable asserts in Debug mode if (CMAKE_BUILD_TYPE MATCHES "Debug") - EnableCompilerFlag("/DDEBUGLEVEL=1" true true) + EnableCompilerFlag("/DDEBUGLEVEL=1" true true false) endif () endif () diff --git a/src/dependencies/zstd-1.5.0/build/cmake/CMakeModules/FindLibLZ4.cmake b/src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/FindLibLZ4.cmake similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/CMakeModules/FindLibLZ4.cmake rename to src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/FindLibLZ4.cmake diff --git a/src/dependencies/zstd-1.5.0/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake b/src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake rename to src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/GetZstdLibraryVersion.cmake diff --git a/src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/JoinPaths.cmake b/src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/JoinPaths.cmake new file mode 100644 index 0000000..c68d91b --- /dev/null +++ b/src/dependencies/zstd-1.5.4/build/cmake/CMakeModules/JoinPaths.cmake @@ -0,0 +1,23 @@ +# This module provides function for joining paths +# known from most languages +# +# SPDX-License-Identifier: (MIT OR CC0-1.0) +# Copyright 2020 Jan Tojnar +# https://github.com/jtojnar/cmake-snips +# +# Modelled after Python’s os.path.join +# https://docs.python.org/3.7/library/os.path.html#os.path.join +# Windows not supported +function(join_paths joined_path first_path_segment) + set(temp_path "${first_path_segment}") + foreach(current_segment IN LISTS ARGN) + if(NOT ("${current_segment}" STREQUAL "")) + if(IS_ABSOLUTE "${current_segment}") + set(temp_path "${current_segment}") + else() + set(temp_path "${temp_path}/${current_segment}") + endif() + endif() + endforeach() + set(${joined_path} "${temp_path}" PARENT_SCOPE) +endfunction() diff --git a/src/dependencies/zstd-1.5.0/build/cmake/README.md b/src/dependencies/zstd-1.5.4/build/cmake/README.md similarity index 92% rename from src/dependencies/zstd-1.5.0/build/cmake/README.md rename to src/dependencies/zstd-1.5.4/build/cmake/README.md index 73b30dc..a460dd1 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/README.md +++ b/src/dependencies/zstd-1.5.4/build/cmake/README.md @@ -1,13 +1,13 @@ # Cmake contributions Contributions to the cmake build configurations are welcome. Please -use case sensitivity that matches modern (ie. cmake version 2.6 and above) +use case sensitivity that matches modern (i.e. cmake version 2.6 and above) conventions of using lower-case for commands, and upper-case for variables. ## How to build -As cmake doesn't support command like `cmake clean`, it's recommended to perform a "out of source build". +As cmake doesn't support command like `cmake clean`, it's recommended to perform an "out of source build". To do this, you can create a new directory and build in it: ```sh cd build/cmake @@ -37,7 +37,7 @@ cmake -LH .. Bool options can be set to `ON/OFF` with `-D[option]=[ON/OFF]`. You can configure cmake options like this: ```sh cd build/cmake/builddir -cmake -DZSTD_BUILD_TESTS=ON -DZSTD_LEGACY_SUPPORT=ON .. +cmake -DZSTD_BUILD_TESTS=ON -DZSTD_LEGACY_SUPPORT=OFF .. make ``` diff --git a/src/dependencies/zstd-1.5.0/build/cmake/contrib/CMakeLists.txt b/src/dependencies/zstd-1.5.4/build/cmake/contrib/CMakeLists.txt similarity index 88% rename from src/dependencies/zstd-1.5.0/build/cmake/contrib/CMakeLists.txt rename to src/dependencies/zstd-1.5.4/build/cmake/contrib/CMakeLists.txt index f7631d0..8df2a17 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/contrib/CMakeLists.txt +++ b/src/dependencies/zstd-1.5.4/build/cmake/contrib/CMakeLists.txt @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2016-present, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/build/cmake/contrib/gen_html/CMakeLists.txt b/src/dependencies/zstd-1.5.4/build/cmake/contrib/gen_html/CMakeLists.txt similarity index 95% rename from src/dependencies/zstd-1.5.0/build/cmake/contrib/gen_html/CMakeLists.txt rename to src/dependencies/zstd-1.5.4/build/cmake/contrib/gen_html/CMakeLists.txt index 8fdd611..d1ff6c6 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/contrib/gen_html/CMakeLists.txt +++ b/src/dependencies/zstd-1.5.4/build/cmake/contrib/gen_html/CMakeLists.txt @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2015-present, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/build/cmake/contrib/pzstd/CMakeLists.txt b/src/dependencies/zstd-1.5.4/build/cmake/contrib/pzstd/CMakeLists.txt similarity index 84% rename from src/dependencies/zstd-1.5.0/build/cmake/contrib/pzstd/CMakeLists.txt rename to src/dependencies/zstd-1.5.4/build/cmake/contrib/pzstd/CMakeLists.txt index 5c30a91..f7098fa 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/contrib/pzstd/CMakeLists.txt +++ b/src/dependencies/zstd-1.5.4/build/cmake/contrib/pzstd/CMakeLists.txt @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2016-present, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -21,10 +21,16 @@ add_executable(pzstd ${PROGRAMS_DIR}/util.c ${PZSTD_DIR}/main.cpp ${PZSTD_DIR}/O set_property(TARGET pzstd APPEND PROPERTY COMPILE_DEFINITIONS "NDEBUG") set_property(TARGET pzstd APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow") +if (ZSTD_BUILD_SHARED) + set(ZSTD_LIB libzstd_shared) +else() + set(ZSTD_LIB libzstd_static) +endif() + set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) if (CMAKE_USE_PTHREADS_INIT) - target_link_libraries(pzstd libzstd_shared ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(pzstd ${ZSTD_LIB} ${CMAKE_THREAD_LIBS_INIT}) else() message(SEND_ERROR "ZSTD currently does not support thread libraries other than pthreads") endif() diff --git a/src/dependencies/zstd-1.5.0/build/cmake/lib/.gitignore b/src/dependencies/zstd-1.5.4/build/cmake/lib/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/lib/.gitignore rename to src/dependencies/zstd-1.5.4/build/cmake/lib/.gitignore diff --git a/src/dependencies/zstd-1.5.0/build/cmake/lib/CMakeLists.txt b/src/dependencies/zstd-1.5.4/build/cmake/lib/CMakeLists.txt similarity index 80% rename from src/dependencies/zstd-1.5.0/build/cmake/lib/CMakeLists.txt rename to src/dependencies/zstd-1.5.4/build/cmake/lib/CMakeLists.txt index 5f75665..3034958 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/lib/CMakeLists.txt +++ b/src/dependencies/zstd-1.5.4/build/cmake/lib/CMakeLists.txt @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2015-present, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -7,7 +7,7 @@ # in the COPYING file in the root directory of this source tree). # ################################################################ -project(libzstd C) +project(libzstd C ASM) set(CMAKE_INCLUDE_CURRENT_DIR TRUE) option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON) @@ -22,7 +22,12 @@ include_directories(${LIBRARY_DIR} ${LIBRARY_DIR}/common) file(GLOB CommonSources ${LIBRARY_DIR}/common/*.c) file(GLOB CompressSources ${LIBRARY_DIR}/compress/*.c) -file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c) +if (MSVC) + file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c) + add_compile_options(-DZSTD_DISABLE_ASM) +else () + file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S) +endif () file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c) set(Sources @@ -72,6 +77,12 @@ if (MSVC) set(PlatformDependResources ${MSVC_RESOURCE_DIR}/libzstd-dll.rc) endif () +# Explicitly set the language to C for all files, including ASM files. +# Our assembly expects to be compiled by a C compiler, and is only enabled for +# __GNUC__ compatible compilers. Otherwise all the ASM code is disabled by +# macros. +set_source_files_properties(${Sources} PROPERTIES LANGUAGE C) + # Split project to static and shared libraries build set(library_targets) if (ZSTD_BUILD_SHARED) @@ -106,7 +117,7 @@ if (MSVC) endif () # With MSVC static library needs to be renamed to avoid conflict with import library -if (MSVC) +if (MSVC OR (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT MINGW)) set(STATIC_LIBRARY_BASE_NAME zstd_static) else () set(STATIC_LIBRARY_BASE_NAME zstd) @@ -130,30 +141,17 @@ if (ZSTD_BUILD_STATIC) OUTPUT_NAME ${STATIC_LIBRARY_BASE_NAME}) endif () -if (UNIX OR MINGW) - # pkg-config - set(PREFIX "${CMAKE_INSTALL_PREFIX}") - set(EXEC_PREFIX "\${prefix}") - set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") - set(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}") - set(VERSION "${zstd_VERSION}") +# pkg-config +include(JoinPaths) # can be replaced by cmake_path(APPEND) in CMake 3.20 +set(PREFIX "${CMAKE_INSTALL_PREFIX}") +set(EXEC_PREFIX "\${prefix}") +join_paths(LIBDIR "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}") +join_paths(INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") +set(LIBS_PRIVATE "${THREADS_LIBS}") +set(VERSION "${zstd_VERSION}") - string(LENGTH "${PREFIX}" PREFIX_LENGTH) - string(SUBSTRING "${LIBDIR}" 0 ${PREFIX_LENGTH} LIBDIR_PREFIX) - string(SUBSTRING "${LIBDIR}" ${PREFIX_LENGTH} -1 LIBDIR_SUFFIX) - string(SUBSTRING "${INCLUDEDIR}" 0 ${PREFIX_LENGTH} INCLUDEDIR_PREFIX) - string(SUBSTRING "${INCLUDEDIR}" ${PREFIX_LENGTH} -1 INCLUDEDIR_SUFFIX) - - if ("${INCLUDEDIR_PREFIX}" STREQUAL "${PREFIX}") - set(INCLUDEDIR "\${prefix}${INCLUDEDIR_SUFFIX}") - endif() - if ("${LIBDIR_PREFIX}" STREQUAL "${PREFIX}") - set(LIBDIR "\${exec_prefix}${LIBDIR_SUFFIX}") - endif() - - configure_file("${LIBRARY_DIR}/libzstd.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" @ONLY) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") -endif () +configure_file("${LIBRARY_DIR}/libzstd.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libzstd.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # install target install(FILES @@ -168,6 +166,7 @@ install(TARGETS ${library_targets} ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" ) # uninstall target diff --git a/src/dependencies/zstd-1.5.0/build/cmake/lib/cmake_uninstall.cmake.in b/src/dependencies/zstd-1.5.4/build/cmake/lib/cmake_uninstall.cmake.in similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/lib/cmake_uninstall.cmake.in rename to src/dependencies/zstd-1.5.4/build/cmake/lib/cmake_uninstall.cmake.in diff --git a/src/dependencies/zstd-1.5.0/build/cmake/programs/.gitignore b/src/dependencies/zstd-1.5.4/build/cmake/programs/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/programs/.gitignore rename to src/dependencies/zstd-1.5.4/build/cmake/programs/.gitignore diff --git a/src/dependencies/zstd-1.5.0/build/cmake/programs/CMakeLists.txt b/src/dependencies/zstd-1.5.4/build/cmake/programs/CMakeLists.txt similarity index 93% rename from src/dependencies/zstd-1.5.0/build/cmake/programs/CMakeLists.txt rename to src/dependencies/zstd-1.5.4/build/cmake/programs/CMakeLists.txt index f1d1277..58d998e 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/programs/CMakeLists.txt +++ b/src/dependencies/zstd-1.5.4/build/cmake/programs/CMakeLists.txt @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2015-present, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -32,12 +32,14 @@ if (MSVC) set(PlatformDependResources ${MSVC_RESOURCE_DIR}/zstd.rc) endif () -add_executable(zstd ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/dibio.c ${PROGRAMS_DIR}/zstdcli_trace.c ${PlatformDependResources}) +add_executable(zstd ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/fileio_asyncio.c ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/dibio.c ${PROGRAMS_DIR}/zstdcli_trace.c ${PlatformDependResources}) target_link_libraries(zstd ${PROGRAMS_ZSTD_LINK_TARGET}) if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") target_link_libraries(zstd rt) endif () -install(TARGETS zstd RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(TARGETS zstd + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}") if (UNIX) add_custom_target(zstdcat ALL ${CMAKE_COMMAND} -E create_symlink zstd zstdcat DEPENDS zstd COMMENT "Creating zstdcat symlink") @@ -73,7 +75,7 @@ if (UNIX) ${CMAKE_CURRENT_BINARY_DIR}/zstdless.1 DESTINATION "${MAN_INSTALL_DIR}") - add_executable(zstd-frugal ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/fileio.c) + add_executable(zstd-frugal ${PROGRAMS_DIR}/zstdcli.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/fileio.c ${PROGRAMS_DIR}/fileio_asyncio.c) target_link_libraries(zstd-frugal ${PROGRAMS_ZSTD_LINK_TARGET}) set_property(TARGET zstd-frugal APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_NOBENCH;ZSTD_NODICT;ZSTD_NOTRACE") endif () diff --git a/src/dependencies/zstd-1.5.0/build/cmake/tests/.gitignore b/src/dependencies/zstd-1.5.4/build/cmake/tests/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/tests/.gitignore rename to src/dependencies/zstd-1.5.4/build/cmake/tests/.gitignore diff --git a/src/dependencies/zstd-1.5.0/build/cmake/tests/CMakeLists.txt b/src/dependencies/zstd-1.5.4/build/cmake/tests/CMakeLists.txt similarity index 88% rename from src/dependencies/zstd-1.5.0/build/cmake/tests/CMakeLists.txt rename to src/dependencies/zstd-1.5.4/build/cmake/tests/CMakeLists.txt index 8bba6ea..250f050 100644 --- a/src/dependencies/zstd-1.5.0/build/cmake/tests/CMakeLists.txt +++ b/src/dependencies/zstd-1.5.4/build/cmake/tests/CMakeLists.txt @@ -1,6 +1,6 @@ # ################################################################ # zstd - Makefile -# Copyright (C) Yann Collet 2014-present +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # BSD license @@ -27,7 +27,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # You can contact the author at : -# - zstd homepage : http://www.zstd.net/ +# - zstd homepage : https://facebook.github.io/zstd/ # ################################################################ project(tests) @@ -57,7 +57,9 @@ target_link_libraries(datagen libzstd_static) # fullbench # add_executable(fullbench ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${TESTS_DIR}/fullbench.c) -set_property(TARGET fullbench APPEND PROPERTY COMPILE_OPTIONS "-Wno-deprecated-declarations") +if (NOT MSVC) + target_compile_options(fullbench PRIVATE "-Wno-deprecated-declarations") +endif() target_link_libraries(fullbench libzstd_static) add_test(NAME fullbench COMMAND fullbench ${ZSTD_FULLBENCH_FLAGS}) @@ -65,7 +67,9 @@ add_test(NAME fullbench COMMAND fullbench ${ZSTD_FULLBENCH_FLAGS}) # fuzzer # add_executable(fuzzer ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/fuzzer.c) -set_property(TARGET fuzzer APPEND PROPERTY COMPILE_OPTIONS "-Wno-deprecated-declarations") +if (NOT MSVC) + target_compile_options(fuzzer PRIVATE "-Wno-deprecated-declarations") +endif() target_link_libraries(fuzzer libzstd_static) AddTestFlagsOption(ZSTD_FUZZER_FLAGS "$ENV{FUZZERTEST} $ENV{FUZZER_FLAGS}" "Semicolon-separated list of flags to pass to the fuzzer test (see `fuzzer -h` for usage)") @@ -77,8 +81,10 @@ add_test(NAME fuzzer COMMAND fuzzer ${ZSTD_FUZZER_FLAGS}) # # zstreamtest # -add_executable(zstreamtest ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/seqgen.c ${TESTS_DIR}/zstreamtest.c) -set_property(TARGET zstreamtest APPEND PROPERTY COMPILE_OPTIONS "-Wno-deprecated-declarations") +add_executable(zstreamtest ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/seqgen.c ${TESTS_DIR}/zstreamtest.c ${TESTS_DIR}/external_matchfinder.c) +if (NOT MSVC) + target_compile_options(zstreamtest PRIVATE "-Wno-deprecated-declarations") +endif() target_link_libraries(zstreamtest libzstd_static) AddTestFlagsOption(ZSTD_ZSTREAM_FLAGS "$ENV{ZSTREAM_TESTTIME} $ENV{FUZZER_FLAGS}" "Semicolon-separated list of flags to pass to the zstreamtest test (see `zstreamtest -h` for usage)") @@ -90,13 +96,14 @@ add_test(NAME zstreamtest COMMAND zstreamtest ${ZSTD_ZSTREAM_FLAGS}) AddTestFlagsOption(ZSTD_PLAYTESTS_FLAGS "$ENV{PLAYTESTS_FLAGS}" "Semicolon-separated list of flags to pass to the playTests.sh test") add_test(NAME playTests COMMAND sh -c "\"${TESTS_DIR}/playTests.sh\" ${ZSTD_PLAYTESTS_FLAGS}") -if (ZSTD_BUILD_PROGRAMS) +find_program(UNAME uname) # Run script only in unix shell environments +if (ZSTD_BUILD_PROGRAMS AND UNAME) set_property(TEST playTests APPEND PROPERTY ENVIRONMENT "ZSTD_BIN=$" "DATAGEN_BIN=$" ) else() - message(STATUS "Disabling playTests.sh test because ZSTD_BUILD_PROGRAMS is not enabled") + message(STATUS "Disabling playTests.sh test because requirements not met") set_tests_properties(playTests PROPERTIES DISABLED YES) endif() diff --git a/src/dependencies/zstd-1.5.0/build/cmake/zstdConfig.cmake b/src/dependencies/zstd-1.5.4/build/cmake/zstdConfig.cmake similarity index 100% rename from src/dependencies/zstd-1.5.0/build/cmake/zstdConfig.cmake rename to src/dependencies/zstd-1.5.4/build/cmake/zstdConfig.cmake diff --git a/src/dependencies/zstd-1.5.0/build/meson/GetZstdLibraryVersion.py b/src/dependencies/zstd-1.5.4/build/meson/GetZstdLibraryVersion.py similarity index 100% rename from src/dependencies/zstd-1.5.0/build/meson/GetZstdLibraryVersion.py rename to src/dependencies/zstd-1.5.4/build/meson/GetZstdLibraryVersion.py diff --git a/src/dependencies/zstd-1.5.0/build/meson/InstallSymlink.py b/src/dependencies/zstd-1.5.4/build/meson/InstallSymlink.py similarity index 100% rename from src/dependencies/zstd-1.5.0/build/meson/InstallSymlink.py rename to src/dependencies/zstd-1.5.4/build/meson/InstallSymlink.py diff --git a/src/dependencies/zstd-1.5.0/build/meson/README.md b/src/dependencies/zstd-1.5.4/build/meson/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/build/meson/README.md rename to src/dependencies/zstd-1.5.4/build/meson/README.md diff --git a/src/dependencies/zstd-1.5.0/build/meson/contrib/gen_html/meson.build b/src/dependencies/zstd-1.5.4/build/meson/contrib/gen_html/meson.build similarity index 100% rename from src/dependencies/zstd-1.5.0/build/meson/contrib/gen_html/meson.build rename to src/dependencies/zstd-1.5.4/build/meson/contrib/gen_html/meson.build diff --git a/src/dependencies/zstd-1.5.0/build/meson/contrib/meson.build b/src/dependencies/zstd-1.5.4/build/meson/contrib/meson.build similarity index 100% rename from src/dependencies/zstd-1.5.0/build/meson/contrib/meson.build rename to src/dependencies/zstd-1.5.4/build/meson/contrib/meson.build diff --git a/src/dependencies/zstd-1.5.0/build/meson/contrib/pzstd/meson.build b/src/dependencies/zstd-1.5.4/build/meson/contrib/pzstd/meson.build similarity index 92% rename from src/dependencies/zstd-1.5.0/build/meson/contrib/pzstd/meson.build rename to src/dependencies/zstd-1.5.4/build/meson/contrib/pzstd/meson.build index dcf2136..b95dc79 100644 --- a/src/dependencies/zstd-1.5.0/build/meson/contrib/pzstd/meson.build +++ b/src/dependencies/zstd-1.5.4/build/meson/contrib/pzstd/meson.build @@ -18,7 +18,8 @@ pzstd_sources = [join_paths(zstd_rootdir, 'programs/util.c'), join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')] pzstd = executable('pzstd', pzstd_sources, - cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-pedantic', '-Wno-deprecated-declarations' ], + cpp_args: pzstd_warning_flags, include_directories: pzstd_includes, dependencies: [ libzstd_dep, thread_dep ], + override_options: ['b_ndebug=true'], install: true) diff --git a/src/dependencies/zstd-1.5.0/build/meson/lib/meson.build b/src/dependencies/zstd-1.5.4/build/meson/lib/meson.build similarity index 75% rename from src/dependencies/zstd-1.5.0/build/meson/lib/meson.build rename to src/dependencies/zstd-1.5.4/build/meson/lib/meson.build index 5cc9fee..68db2ca 100644 --- a/src/dependencies/zstd-1.5.0/build/meson/lib/meson.build +++ b/src/dependencies/zstd-1.5.4/build/meson/lib/meson.build @@ -45,6 +45,15 @@ libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'), join_paths(zstd_rootdir, 'lib/dictBuilder/divsufsort.c'), join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.c')] +# really we need anything that defines __GNUC__ as that is what ZSTD_ASM_SUPPORTED is gated on +# but these are the two compilers that are supported in tree and actually handle this correctly +# Otherwise, explicitly disable assembly. +if [compiler_gcc, compiler_clang].contains(cc_id) + libzstd_sources += join_paths(zstd_rootdir, 'lib/decompress/huf_decompress_amd64.S') +else + add_project_arguments('-DZSTD_DISABLE_ASM', language: 'c') +endif + # Explicit define legacy support add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_level), language: 'c') @@ -74,7 +83,8 @@ libzstd_c_args = [] if cc_id == compiler_msvc if default_library_type != 'static' libzstd_sources += [windows_mod.compile_resources( - join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'))] + join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'), + include_directories: libzstd_includes)] libzstd_c_args += ['-DZSTD_DLL_EXPORT=1', '-DZSTD_HEAPMODE=0', '-D_CONSOLE', @@ -108,6 +118,7 @@ libzstd = library('zstd', libzstd_sources, include_directories: libzstd_includes, c_args: libzstd_c_args, + gnu_symbol_visibility: 'hidden', dependencies: libzstd_deps, install: true, version: zstd_libversion) @@ -115,12 +126,41 @@ libzstd = library('zstd', libzstd_dep = declare_dependency(link_with: libzstd, include_directories: libzstd_includes) +# we link to both: +# - the shared library (for public symbols) +# - the static library (for private symbols) +# +# this is needed because internally private symbols are used all the time, and +# -fvisibility=hidden means those cannot be found +if get_option('default_library') == 'static' + libzstd_static = libzstd + libzstd_internal_dep = libzstd_dep +else + if get_option('default_library') == 'shared' + libzstd_static = static_library('zstd_objlib', + objects: libzstd.extract_all_objects(recursive: true), + build_by_default: false) + else + libzstd_static = libzstd.get_static_lib() + endif + + if cc_id == compiler_msvc + # msvc does not actually support linking to both, but errors out with: + # error LNK2005: ZSTD_ already defined in zstd.lib(zstd-1.dll) + libzstd_internal_dep = declare_dependency(link_with: libzstd_static) + else + libzstd_internal_dep = declare_dependency(link_with: libzstd, + # the static library must be linked after the shared one + dependencies: declare_dependency(link_with: libzstd_static)) + endif +endif + pkgconfig.generate(libzstd, name: 'libzstd', filebase: 'libzstd', description: 'fast lossless compression algorithm library', version: zstd_libversion, - url: 'http://www.zstd.net/') + url: 'https://facebook.github.io/zstd/') install_headers(join_paths(zstd_rootdir, 'lib/zstd.h'), join_paths(zstd_rootdir, 'lib/zdict.h'), diff --git a/src/dependencies/zstd-1.5.0/build/meson/meson.build b/src/dependencies/zstd-1.5.4/build/meson/meson.build similarity index 84% rename from src/dependencies/zstd-1.5.0/build/meson/meson.build rename to src/dependencies/zstd-1.5.4/build/meson/meson.build index 2a425b2..576dc44 100644 --- a/src/dependencies/zstd-1.5.0/build/meson/meson.build +++ b/src/dependencies/zstd-1.5.4/build/meson/meson.build @@ -12,12 +12,21 @@ project('zstd', ['c', 'cpp'], license: ['BSD', 'GPLv2'], default_options : [ - 'c_std=gnu99', + # There shouldn't be any need to force a C standard convention for zstd + # but in case one would want that anyway, this can be done here. + # 'c_std=gnu99', + # c++11 standard is useful for pzstd 'cpp_std=c++11', - 'buildtype=release' + 'buildtype=release', + 'warning_level=3', + # -Wdocumentation does not actually pass, nor do the test binaries, + # so this isn't safe + #'werror=true' ], - version: 'DUMMY', - meson_version: '>=0.47.0') + version: run_command( + find_program('GetZstdLibraryVersion.py'), '../../lib/zstd.h', + check: true).stdout().strip(), + meson_version: '>=0.50.0') cc = meson.get_compiler('c') cxx = meson.get_compiler('cpp') @@ -38,16 +47,6 @@ compiler_msvc = 'msvc' zstd_version = meson.project_version() -zstd_h_file = join_paths(meson.current_source_dir(), '../../lib/zstd.h') -GetZstdLibraryVersion_py = find_program('GetZstdLibraryVersion.py', native : true) -r = run_command(GetZstdLibraryVersion_py, zstd_h_file) -if r.returncode() == 0 - zstd_version = r.stdout().strip() - message('Project version is now: @0@'.format(zstd_version)) -else - error('Cannot find project version in @0@'.format(zstd_h_file)) -endif - zstd_libversion = zstd_version # ============================================================================= @@ -88,7 +87,7 @@ feature_lz4 = get_option('lz4') # Dependencies # ============================================================================= -libm_dep = cc.find_library('m', required: bin_tests) +libm_dep = cc.find_library('m', required: false) thread_dep = dependency('threads', required: feature_multi_thread) use_multi_thread = thread_dep.found() # Arguments in dependency should be equivalent to those passed to pkg-config @@ -105,11 +104,11 @@ use_lz4 = lz4_dep.found() add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c']) +pzstd_warning_flags = [] if [compiler_gcc, compiler_clang].contains(cc_id) - common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] + common_warning_flags = [ '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] + pzstd_warning_flags = ['-Wno-shadow', '-Wno-deprecated-declarations'] if cc_id == compiler_clang - # Should use Meson's own --werror build option - #common_warning_flags += '-Werror' common_warning_flags += ['-Wconversion', '-Wno-sign-conversion', '-Wdocumentation'] endif cc_compile_flags = cc.get_supported_arguments(common_warning_flags + ['-Wstrict-prototypes']) diff --git a/src/dependencies/zstd-1.5.0/build/meson/meson_options.txt b/src/dependencies/zstd-1.5.4/build/meson/meson_options.txt similarity index 93% rename from src/dependencies/zstd-1.5.0/build/meson/meson_options.txt rename to src/dependencies/zstd-1.5.4/build/meson/meson_options.txt index 90a81c5..f35cd5f 100644 --- a/src/dependencies/zstd-1.5.0/build/meson/meson_options.txt +++ b/src/dependencies/zstd-1.5.4/build/meson/meson_options.txt @@ -10,11 +10,11 @@ # Read guidelines from https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting -option('legacy_level', type: 'integer', min: 0, max: 7, value: '5', +option('legacy_level', type: 'integer', min: 0, max: 7, value: 5, description: 'Support any legacy format: 7 to 1 for v0.7+ to v0.1+') option('debug_level', type: 'integer', min: 0, max: 9, value: 1, description: 'Enable run-time debug. See lib/common/debug.h') -option('backtrace', type: 'boolean', value: false, +option('backtrace', type: 'feature', value: 'disabled', description: 'Display a stack backtrace when execution generates a runtime exception') option('static_runtime', type: 'boolean', value: false, description: 'Link to static run-time libraries on MSVC') diff --git a/src/dependencies/zstd-1.5.0/build/meson/programs/meson.build b/src/dependencies/zstd-1.5.4/build/meson/programs/meson.build similarity index 83% rename from src/dependencies/zstd-1.5.0/build/meson/programs/meson.build rename to src/dependencies/zstd-1.5.4/build/meson/programs/meson.build index d255627..e611dc3 100644 --- a/src/dependencies/zstd-1.5.0/build/meson/programs/meson.build +++ b/src/dependencies/zstd-1.5.4/build/meson/programs/meson.build @@ -14,18 +14,26 @@ zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), join_paths(zstd_rootdir, 'programs/util.c'), join_paths(zstd_rootdir, 'programs/timefn.c'), join_paths(zstd_rootdir, 'programs/fileio.c'), + join_paths(zstd_rootdir, 'programs/fileio_asyncio.c'), join_paths(zstd_rootdir, 'programs/benchfn.c'), join_paths(zstd_rootdir, 'programs/benchzstd.c'), join_paths(zstd_rootdir, 'programs/datagen.c'), join_paths(zstd_rootdir, 'programs/dibio.c'), join_paths(zstd_rootdir, 'programs/zstdcli_trace.c')] +zstd_deps = [ libzstd_internal_dep ] zstd_c_args = libzstd_debug_cflags + +zstd_frugal_deps = [ libzstd_internal_dep ] +zstd_frugal_c_args = [ '-DZSTD_NOBENCH', '-DZSTD_NODICT', '-DZSTD_NOTRACE' ] + if use_multi_thread + zstd_deps += [ thread_dep ] zstd_c_args += [ '-DZSTD_MULTITHREAD' ] + zstd_frugal_deps += [ thread_dep ] + zstd_frugal_c_args += [ '-DZSTD_MULTITHREAD' ] endif -zstd_deps = [ libzstd_dep ] if use_zlib zstd_deps += [ zlib_dep ] zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ] @@ -43,7 +51,8 @@ endif export_dynamic_on_windows = false # explicit backtrace enable/disable for Linux & Darwin -if not use_backtrace +have_execinfo = cc.has_header('execinfo.h', required: use_backtrace) +if not have_execinfo zstd_c_args += '-DBACKTRACE_ENABLE=0' elif use_debug and host_machine_os == os_windows # MinGW target zstd_c_args += '-DBACKTRACE_ENABLE=1' @@ -53,7 +62,8 @@ endif if cc_id == compiler_msvc if default_library_type != 'static' zstd_programs_sources += [windows_mod.compile_resources( - join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'))] + join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'), + include_directories: libzstd_includes)] endif endif @@ -67,14 +77,15 @@ zstd = executable('zstd', zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), join_paths(zstd_rootdir, 'programs/timefn.c'), join_paths(zstd_rootdir, 'programs/util.c'), - join_paths(zstd_rootdir, 'programs/fileio.c')] + join_paths(zstd_rootdir, 'programs/fileio.c'), + join_paths(zstd_rootdir, 'programs/fileio_asyncio.c')] # Minimal target, with only zstd compression and decompression. # No bench. No legacy. executable('zstd-frugal', zstd_frugal_sources, - dependencies: libzstd_dep, - c_args: [ '-DZSTD_NOBENCH', '-DZSTD_NODICT', '-DZSTD_NOTRACE' ], + dependencies: zstd_frugal_deps, + c_args: zstd_frugal_c_args, install: true) install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'), diff --git a/src/dependencies/zstd-1.5.0/build/meson/tests/meson.build b/src/dependencies/zstd-1.5.4/build/meson/tests/meson.build similarity index 65% rename from src/dependencies/zstd-1.5.0/build/meson/tests/meson.build rename to src/dependencies/zstd-1.5.4/build/meson/tests/meson.build index 1b23363..e70b734 100644 --- a/src/dependencies/zstd-1.5.0/build/meson/tests/meson.build +++ b/src/dependencies/zstd-1.5.4/build/meson/tests/meson.build @@ -21,7 +21,6 @@ FUZZER_FLAGS = ['--no-big-tests'] FUZZERTEST = '-T200s' ZSTREAM_TESTTIME = '-T90s' DECODECORPUS_TESTTIME = '-T30' -ZSTDRTTEST = ['--test-large-data'] # ============================================================================= # Executables @@ -29,64 +28,64 @@ ZSTDRTTEST = ['--test-large-data'] test_includes = [ include_directories(join_paths(zstd_rootdir, 'programs')) ] -datagen_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), - join_paths(zstd_rootdir, 'tests/datagencli.c')] +testcommon_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), + join_paths(zstd_rootdir, 'programs/util.c'), + join_paths(zstd_rootdir, 'programs/timefn.c'), + join_paths(zstd_rootdir, 'programs/benchfn.c'), + join_paths(zstd_rootdir, 'programs/benchzstd.c')] + +testcommon = static_library('testcommon', + testcommon_sources, + # needed due to use of private symbol + -fvisibility=hidden + link_with: libzstd_static) + +testcommon_dep = declare_dependency(link_with: testcommon, + dependencies: libzstd_deps, + include_directories: libzstd_includes) + +datagen_sources = [join_paths(zstd_rootdir, 'tests/datagencli.c')] datagen = executable('datagen', datagen_sources, c_args: [ '-DNDEBUG' ], include_directories: test_includes, - dependencies: libzstd_dep, + dependencies: testcommon_dep, install: false) -fullbench_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), - join_paths(zstd_rootdir, 'programs/util.c'), - join_paths(zstd_rootdir, 'programs/timefn.c'), - join_paths(zstd_rootdir, 'programs/benchfn.c'), - join_paths(zstd_rootdir, 'programs/benchzstd.c'), - join_paths(zstd_rootdir, 'tests/fullbench.c')] +fullbench_sources = [join_paths(zstd_rootdir, 'tests/fullbench.c')] fullbench = executable('fullbench', fullbench_sources, include_directories: test_includes, - dependencies: libzstd_dep, + dependencies: testcommon_dep, install: false) -fuzzer_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), - join_paths(zstd_rootdir, 'programs/util.c'), - join_paths(zstd_rootdir, 'programs/timefn.c'), - join_paths(zstd_rootdir, 'tests/fuzzer.c')] +fuzzer_sources = [join_paths(zstd_rootdir, 'tests/fuzzer.c')] fuzzer = executable('fuzzer', fuzzer_sources, include_directories: test_includes, - dependencies: [ libzstd_dep, thread_dep ], + dependencies: [ testcommon_dep, thread_dep ], install: false) -zstreamtest_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), - join_paths(zstd_rootdir, 'programs/util.c'), - join_paths(zstd_rootdir, 'programs/timefn.c'), +zstreamtest_sources = [ join_paths(zstd_rootdir, 'tests/seqgen.c'), - join_paths(zstd_rootdir, 'tests/zstreamtest.c')] + join_paths(zstd_rootdir, 'tests/zstreamtest.c'), + join_paths(zstd_rootdir, 'tests/external_matchfinder.c')] zstreamtest = executable('zstreamtest', zstreamtest_sources, include_directories: test_includes, - dependencies: libzstd_dep, + dependencies: testcommon_dep, install: false) -paramgrill_sources = [join_paths(zstd_rootdir, 'programs/benchfn.c'), - join_paths(zstd_rootdir, 'programs/timefn.c'), - join_paths(zstd_rootdir, 'programs/benchzstd.c'), - join_paths(zstd_rootdir, 'programs/datagen.c'), - join_paths(zstd_rootdir, 'programs/util.c'), - join_paths(zstd_rootdir, 'tests/paramgrill.c')] +paramgrill_sources = [join_paths(zstd_rootdir, 'tests/paramgrill.c')] paramgrill = executable('paramgrill', paramgrill_sources, include_directories: test_includes, - dependencies: [ libzstd_dep, libm_dep ], + dependencies: [ testcommon_dep, libm_dep ], install: false) roundTripCrash_sources = [join_paths(zstd_rootdir, 'tests/roundTripCrash.c')] roundTripCrash = executable('roundTripCrash', roundTripCrash_sources, - dependencies: [ libzstd_dep ], + dependencies: [ testcommon_dep ], install: false) longmatch_sources = [join_paths(zstd_rootdir, 'tests/longmatch.c')] @@ -111,26 +110,18 @@ if 0 < legacy_level and legacy_level <= 4 install: false) endif -decodecorpus_sources = [join_paths(zstd_rootdir, 'programs/util.c'), - join_paths(zstd_rootdir, 'programs/timefn.c'), - join_paths(zstd_rootdir, 'tests/decodecorpus.c')] +decodecorpus_sources = [join_paths(zstd_rootdir, 'tests/decodecorpus.c')] decodecorpus = executable('decodecorpus', decodecorpus_sources, include_directories: test_includes, - dependencies: [ libzstd_dep, libm_dep ], + dependencies: [ testcommon_dep, libm_dep ], install: false) -poolTests_sources = [join_paths(zstd_rootdir, 'programs/util.c'), - join_paths(zstd_rootdir, 'programs/timefn.c'), - join_paths(zstd_rootdir, 'tests/poolTests.c'), - join_paths(zstd_rootdir, 'lib/common/pool.c'), - join_paths(zstd_rootdir, 'lib/common/threading.c'), - join_paths(zstd_rootdir, 'lib/common/zstd_common.c'), - join_paths(zstd_rootdir, 'lib/common/error_private.c')] +poolTests_sources = [join_paths(zstd_rootdir, 'tests/poolTests.c')] poolTests = executable('poolTests', poolTests_sources, include_directories: test_includes, - dependencies: [ libzstd_dep, thread_dep ], + dependencies: [ testcommon_dep, thread_dep ], install: false) checkTag_sources = [join_paths(zstd_rootdir, 'tests/checkTag.c')] @@ -144,24 +135,38 @@ checkTag = executable('checkTag', # ============================================================================= if tests_supported_oses.contains(host_machine_os) - valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: true) + valgrind_prog = find_program('valgrind', ['/usr/bin/valgrind'], required: false) valgrindTest_py = files('valgrindTest.py') - test('valgrindTest', - valgrindTest_py, - args: [valgrind_prog.path(), zstd, datagen, fuzzer, fullbench], - depends: [zstd, datagen, fuzzer, fullbench], - timeout: 600) # Timeout should work on HDD drive + if valgrind_prog.found() + test('valgrindTest', + valgrindTest_py, + args: [valgrind_prog.path(), zstd, datagen, fuzzer, fullbench], + depends: [zstd, datagen, fuzzer, fullbench], + timeout: 600) # Timeout should work on HDD drive + endif endif if host_machine_os != os_windows playTests_sh = find_program(join_paths(zstd_rootdir, 'tests/playTests.sh'), required: true) - test('test-zstd', - playTests_sh, - args: ZSTDRTTEST, - env: ['ZSTD_BIN=' + zstd.full_path(), 'DATAGEN_BIN=./datagen'], - depends: [datagen], - workdir: meson.current_build_dir(), - timeout: 2800) # Timeout should work on HDD drive + + # add slow tests only if the meson version is new enough to support + # test setups with default-excluded suites + if meson.version().version_compare('>=0.57.0') + matrix = {'fast': [], 'slow': ['--test-large-data']} + else + matrix = {'fast': []} + endif + + foreach suite, opt: matrix + test('test-zstd-'+suite, + playTests_sh, + args: opt, + env: ['ZSTD_BIN=' + zstd.full_path(), 'DATAGEN_BIN=./datagen'], + depends: [datagen], + suite: suite, + workdir: meson.current_build_dir(), + timeout: 2800) # Timeout should work on HDD drive + endforeach endif test('test-fullbench-1', @@ -186,10 +191,6 @@ test('test-zstream-1', zstreamtest, args: ['-v', ZSTREAM_TESTTIME] + FUZZER_FLAGS, timeout: 240) -test('test-zstream-2', - zstreamtest, - args: ['-mt', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS, - timeout: 120) test('test-zstream-3', zstreamtest, args: ['--newapi', '-t1', ZSTREAM_TESTTIME] + FUZZER_FLAGS, @@ -204,3 +205,11 @@ test('test-decodecorpus', args: ['-t', DECODECORPUS_TESTTIME], timeout: 60) test('test-poolTests', poolTests) # should be fast + +if meson.version().version_compare('>=0.57.0') + add_test_setup('fast', + is_default: true, + exclude_suites: ['slow']) + add_test_setup('slow', + exclude_suites: ['fast']) +endif diff --git a/src/dependencies/zstd-1.5.0/build/meson/tests/valgrindTest.py b/src/dependencies/zstd-1.5.4/build/meson/tests/valgrindTest.py similarity index 92% rename from src/dependencies/zstd-1.5.0/build/meson/tests/valgrindTest.py rename to src/dependencies/zstd-1.5.4/build/meson/tests/valgrindTest.py index 218f745..05d8487 100644 --- a/src/dependencies/zstd-1.5.0/build/meson/tests/valgrindTest.py +++ b/src/dependencies/zstd-1.5.4/build/meson/tests/valgrindTest.py @@ -21,7 +21,7 @@ def valgrindTest(valgrind, datagen, fuzzer, zstd, fullbench): if subprocess.call([*VALGRIND_ARGS, zstd], stdout=subprocess.DEVNULL) == 0: - raise subprocess.CalledProcessError('zstd without argument should have failed') + raise subprocess.SubprocessError('zstd without argument should have failed') with subprocess.Popen([datagen, '-g80'], stdout=subprocess.PIPE) as p1, \ subprocess.Popen([*VALGRIND_ARGS, zstd, '-', '-c'], @@ -30,7 +30,7 @@ def valgrindTest(valgrind, datagen, fuzzer, zstd, fullbench): p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. p2.communicate() if p2.returncode != 0: - raise subprocess.CalledProcessError() + raise subprocess.SubprocessError() with subprocess.Popen([datagen, '-g16KB'], stdout=subprocess.PIPE) as p1, \ subprocess.Popen([*VALGRIND_ARGS, zstd, '-vf', '-', '-c'], @@ -39,7 +39,7 @@ def valgrindTest(valgrind, datagen, fuzzer, zstd, fullbench): p1.stdout.close() p2.communicate() if p2.returncode != 0: - raise subprocess.CalledProcessError() + raise subprocess.SubprocessError() with tempfile.NamedTemporaryFile() as tmp_fd: with subprocess.Popen([datagen, '-g2930KB'], stdout=subprocess.PIPE) as p1, \ @@ -48,7 +48,7 @@ def valgrindTest(valgrind, datagen, fuzzer, zstd, fullbench): p1.stdout.close() p2.communicate() if p2.returncode != 0: - raise subprocess.CalledProcessError() + raise subprocess.SubprocessError() subprocess.check_call([*VALGRIND_ARGS, zstd, '-vdf', tmp_fd.name, '-c'], stdout=subprocess.DEVNULL) @@ -60,7 +60,7 @@ def valgrindTest(valgrind, datagen, fuzzer, zstd, fullbench): p1.stdout.close() p2.communicate() if p2.returncode != 0: - raise subprocess.CalledProcessError() + raise subprocess.SubprocessError() subprocess.check_call([*VALGRIND_ARGS, fuzzer, '-T1mn', '-t1']) subprocess.check_call([*VALGRIND_ARGS, fullbench, '-i1']) diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/.gitignore b/src/dependencies/zstd-1.5.4/build/single_file_libs/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/.gitignore rename to src/dependencies/zstd-1.5.4/build/single_file_libs/.gitignore diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/README.md b/src/dependencies/zstd-1.5.4/build/single_file_libs/README.md similarity index 91% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/README.md rename to src/dependencies/zstd-1.5.4/build/single_file_libs/README.md index 1705b76..64c973a 100644 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/README.md +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/README.md @@ -12,7 +12,7 @@ This is the most common use case. The decompression library is small, adding, fo Create `zstddeclib.c` from the Zstd source using: ``` cd zstd/build/single_file_libs -./combine.sh -r ../../lib -o zstddeclib.c zstddeclib-in.c +python3 combine.py -r ../../lib -x legacy/zstd_legacy.h -o zstddeclib.c zstddeclib-in.c ``` Then add the resulting file to your project (see the [example files](examples)). @@ -26,7 +26,7 @@ The same tool can amalgamate the entire Zstd library for ease of adding both com Create `zstd.c` from the Zstd source using: ``` cd zstd/build/single_file_libs -./combine.sh -r ../../lib -o zstd.c zstd-in.c +python3 combine.py -r ../../lib -x legacy/zstd_legacy.h -k zstd.h -o zstd.c zstd-in.c ``` It's possible to create a compressor-only library but since the decompressor is so small in comparison this doesn't bring much of a gain (but for the curious, simply remove the files in the _decompress_ section at the end of `zstd-in.c`). diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/build_decoder_test.sh b/src/dependencies/zstd-1.5.4/build/single_file_libs/build_decoder_test.sh similarity index 97% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/build_decoder_test.sh rename to src/dependencies/zstd-1.5.4/build/single_file_libs/build_decoder_test.sh index 48d017f..c4ca55f 100755 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/build_decoder_test.sh +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/build_decoder_test.sh @@ -11,7 +11,7 @@ IN_FILES="examples/emscripten.c" # Emscripten build using emcc. emscripten_emcc_build() { - # Compile the the same example as above + # Compile the same example as above CC_FLAGS="-Wall -Wextra -Wshadow -Werror -Os -g0 -flto" emcc $CC_FLAGS -s WASM=1 -I. -o $OUT_WASM $IN_FILES # Did compilation work? diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/build_library_test.sh b/src/dependencies/zstd-1.5.4/build/single_file_libs/build_library_test.sh similarity index 96% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/build_library_test.sh rename to src/dependencies/zstd-1.5.4/build/single_file_libs/build_library_test.sh index 7fb9965..f4ba109 100755 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/build_library_test.sh +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/build_library_test.sh @@ -14,7 +14,7 @@ IN_FILES="zstd.c examples/roundtrip.c" # Emscripten build using emcc. emscripten_emcc_build() { - # Compile the the same example as above + # Compile the same example as above CC_FLAGS="-Wall -Wextra -Wshadow -Werror -Os -g0 -flto" emcc $CC_FLAGS -s WASM=1 -I. -o $OUT_WASM $IN_FILES # Did compilation work? @@ -69,7 +69,7 @@ fi echo "Single file library creation script: PASSED" # Copy the header to here (for the tests) -cp "$ZSTD_SRC_ROOT/zstd.h" zstd.h +cp "$ZSTD_SRC_ROOT/zstd.h" examples/zstd.h # Compile the generated output cc -Wall -Wextra -Werror -Wshadow -pthread -I. -Os -g0 -o $OUT_FILE zstd.c examples/roundtrip.c diff --git a/src/dependencies/zstd-1.5.4/build/single_file_libs/combine.py b/src/dependencies/zstd-1.5.4/build/single_file_libs/combine.py new file mode 100755 index 0000000..771dd20 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/combine.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 + +# Tool to bundle multiple C/C++ source files, inlining any includes. +# +# Note: there are two types of exclusion options: the '-x' flag, which besides +# excluding a file also adds an #error directive in place of the #include, and +# the '-k' flag, which keeps the #include and doesn't inline the file. The +# intended use cases are: '-x' for files that would normally be #if'd out, so +# features that 100% won't be used in the amalgamated file, for which every +# occurrence adds the error, and '-k' for headers that we wish to manually +# include, such as a project's public API, for which occurrences after the first +# are removed. +# +# Todo: the error handling could be better, which currently throws and halts +# (which is functional just not very friendly). +# +# Author: Carl Woffenden, Numfum GmbH (this script is released under a CC0 license/Public Domain) + +import argparse, re, sys + +from pathlib import Path +from typing import Any, List, Optional, Pattern, Set, TextIO + +# Set of file roots when searching (equivalent to -I paths for the compiler). +roots: Set[Path] = set() + +# Set of (canonical) file Path objects to exclude from inlining (and not only +# exclude but to add a compiler error directive when they're encountered). +excludes: Set[Path] = set() + +# Set of (canonical) file Path objects to keep as include directives. +keeps: Set[Path] = set() + +# Whether to keep the #pragma once directives (unlikely, since this will result +# in a warning, but the option is there). +keep_pragma: bool = False + +# Destination file object (or stdout if no output file was supplied). +destn: TextIO = sys.stdout + +# Set of file Path objects previously inlined (and to ignore if reencountering). +found: Set[Path] = set() + +# Compiled regex Pattern to handle "#pragma once" in various formats: +# +# #pragma once +# #pragma once +# # pragma once +# #pragma once +# #pragma once // comment +# +# Ignoring commented versions, same as include_regex. +# +pragma_regex: Pattern = re.compile(r'^\s*#\s*pragma\s*once\s*') + +# Compiled regex Pattern to handle the following type of file includes: +# +# #include "file" +# #include "file" +# # include "file" +# #include "file" +# #include "file" // comment +# #include "file" // comment with quote " +# +# And all combinations of, as well as ignoring the following: +# +# #include +# //#include "file" +# /*#include "file"*/ +# +# We don't try to catch errors since the compiler will do this (and the code is +# expected to be valid before processing) and we don't care what follows the +# file (whether it's a valid comment or not, since anything after the quoted +# string is ignored) +# +include_regex: Pattern = re.compile(r'^\s*#\s*include\s*"(.+?)"') + +# Simple tests to prove include_regex's cases. +# +def test_match_include() -> bool: + if (include_regex.match('#include "file"') and + include_regex.match(' #include "file"') and + include_regex.match('# include "file"') and + include_regex.match('#include "file"') and + include_regex.match('#include "file" // comment')): + if (not include_regex.match('#include ') and + not include_regex.match('//#include "file"') and + not include_regex.match('/*#include "file"*/')): + found = include_regex.match('#include "file" // "') + if (found and found.group(1) == 'file'): + print('#include match valid') + return True + return False + +# Simple tests to prove pragma_regex's cases. +# +def test_match_pragma() -> bool: + if (pragma_regex.match('#pragma once') and + pragma_regex.match(' #pragma once') and + pragma_regex.match('# pragma once') and + pragma_regex.match('#pragma once') and + pragma_regex.match('#pragma once // comment')): + if (not pragma_regex.match('//#pragma once') and + not pragma_regex.match('/*#pragma once*/')): + print('#pragma once match valid') + return True + return False + +# Finds 'file'. First the list of 'root' paths are searched, followed by the +# currently processing file's 'parent' path, returning a valid Path in +# canonical form. If no match is found None is returned. +# +def resolve_include(file: str, parent: Optional[Path] = None) -> Optional[Path]: + for root in roots: + found = root.joinpath(file).resolve() + if (found.is_file()): + return found + if (parent): + found = parent.joinpath(file).resolve(); + else: + found = Path(file) + if (found.is_file()): + return found + return None + +# Helper to resolve lists of files. 'file_list' is passed in from the arguments +# and each entry resolved to its canonical path (like any include entry, either +# from the list of root paths or the owning file's 'parent', which in this case +# is case is the input file). The results are stored in 'resolved'. +# +def resolve_excluded_files(file_list: Optional[List[str]], resolved: Set[Path], parent: Optional[Path] = None) -> None: + if (file_list): + for filename in file_list: + found = resolve_include(filename, parent) + if (found): + resolved.add(found) + else: + error_line(f'Warning: excluded file not found: {filename}') + +# Writes 'line' to the open 'destn' (or stdout). +# +def write_line(line: str) -> None: + print(line, file=destn) + +# Logs 'line' to stderr. This is also used for general notifications that we +# don't want to go to stdout (so the source can be piped). +# +def error_line(line: Any) -> None: + print(line, file=sys.stderr) + +# Inline the contents of 'file' (with any of its includes also inlined, etc.). +# +# Note: text encoding errors are ignored and replaced with ? when reading the +# input files. This isn't ideal, but it's more than likely in the comments than +# code and a) the text editor has probably also failed to read the same content, +# and b) the compiler probably did too. +# +def add_file(file: Path, file_name: str = None) -> None: + if (file.is_file()): + if (not file_name): + file_name = file.name + error_line(f'Processing: {file_name}') + with file.open('r', errors='replace') as opened: + for line in opened: + line = line.rstrip('\n') + match_include = include_regex.match(line); + if (match_include): + # We have a quoted include directive so grab the file + inc_name = match_include.group(1) + resolved = resolve_include(inc_name, file.parent) + if (resolved): + if (resolved in excludes): + # The file was excluded so error if the compiler uses it + write_line(f'#error Using excluded file: {inc_name} (re-amalgamate source to fix)') + error_line(f'Excluding: {inc_name}') + else: + if (resolved not in found): + # The file was not previously encountered + found.add(resolved) + if (resolved in keeps): + # But the include was flagged to keep as included + write_line(f'/**** *NOT* inlining {inc_name} ****/') + write_line(line) + error_line(f'Not inlining: {inc_name}') + else: + # The file was neither excluded nor seen before so inline it + write_line(f'/**** start inlining {inc_name} ****/') + add_file(resolved, inc_name) + write_line(f'/**** ended inlining {inc_name} ****/') + else: + write_line(f'/**** skipping file: {inc_name} ****/') + else: + # The include file didn't resolve to a file + write_line(f'#error Unable to find: {inc_name}') + error_line(f'Error: Unable to find: {inc_name}') + else: + # Skip any 'pragma once' directives, otherwise write the source line + if (keep_pragma or not pragma_regex.match(line)): + write_line(line) + else: + error_line(f'Error: Invalid file: {file}') + +# Start here +parser = argparse.ArgumentParser(description='Amalgamate Tool', epilog=f'example: {sys.argv[0]} -r ../my/path -r ../other/path -o out.c in.c') +parser.add_argument('-r', '--root', action='append', type=Path, help='file root search path') +parser.add_argument('-x', '--exclude', action='append', help='file to completely exclude from inlining') +parser.add_argument('-k', '--keep', action='append', help='file to exclude from inlining but keep the include directive') +parser.add_argument('-p', '--pragma', action='store_true', default=False, help='keep any "#pragma once" directives (removed by default)') +parser.add_argument('-o', '--output', type=argparse.FileType('w'), help='output file (otherwise stdout)') +parser.add_argument('input', type=Path, help='input file') +args = parser.parse_args() + +# Fail early on an invalid input (and store it so we don't recurse) +args.input = args.input.resolve(strict=True) +found.add(args.input) + +# Resolve all of the root paths upfront (we'll halt here on invalid roots) +if (args.root): + for path in args.root: + roots.add(path.resolve(strict=True)) + +# The remaining params: so resolve the excluded files and #pragma once directive +resolve_excluded_files(args.exclude, excludes, args.input.parent) +resolve_excluded_files(args.keep, keeps, args.input.parent) +keep_pragma = args.pragma; + +# Then recursively process the input file +try: + if (args.output): + destn = args.output + add_file(args.input) +finally: + if (destn): + destn.close() diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/combine.sh b/src/dependencies/zstd-1.5.4/build/single_file_libs/combine.sh similarity index 76% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/combine.sh rename to src/dependencies/zstd-1.5.4/build/single_file_libs/combine.sh index 8eac4f9..222c2c3 100755 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/combine.sh +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/combine.sh @@ -2,11 +2,7 @@ # Tool to bundle multiple C/C++ source files, inlining any includes. # -# Note: this POSIX-compliant script is many times slower than the original bash -# implementation (due to the grep calls) but it runs and works everywhere. -# # TODO: ROOTS, FOUND, etc., as arrays (since they fail on paths with spaces) -# TODO: revert to Bash-only regex (the grep ones being too slow) # # Author: Carl Woffenden, Numfum GmbH (this script is released under a CC0 license/Public Domain) @@ -52,13 +48,54 @@ test_deps() { fi } -# Tests if list $1 has item $2 (returning zero on a match) -list_has_item() { - if echo "$1" | grep -Eq "(^|\s*)$2(\$|\s*)"; then +# Test if glob pattern $1 matches subject $2 (see fnmatch(3)) +fnmatch() { + case "$2" in + $1) return 0 - else - return 1 + ;; + esac + return 1 +} + +# Test if line $1 is local include directive +is_include_line() { + fnmatch "*#*include*" "$1" || return 1 + printf "%s\n" "$1" | grep -Eq '^\s*#\s*include\s*".+"' +} + +# Test if line $1 is pragma once directive +is_pragma_once_line() { + fnmatch "*#*pragma*once*" "$1" || return 1 + printf "%s\n" "$1" | grep -Eq '^\s*#\s*pragma\s*once\s*' +} + +# Tests if list $1 has item $2 (returning zero on a match) +# (originally used grep -Eq "(^|\s*)$2(\$|\s*)) +readonly list_FS="$IFS" +list_has_item() { + # Re: escaping glob pattern special characters in item string: + # + # bash (tested 3.2.57, 5.1.4), dash (tested 0.5.10.2), NetBSD /bin/sh + # (tested 8.2), and Solaris /bin/sh (tested 11.4) require escaping + # backslashes in a bracket expression despite POSIX specifying that + # backslash loses significance in a bracket expression. + # + # Conversely, neither FreeBSD /bin/sh (tested 12.2) nor OpenBSD /bin/sh + # (tested 7.1) obey backslash-escaping in case statement patterns even + # outside bracket expressions, so escape special characters using bracket + # expressions. + # + # Solaris /bin/sh (tested 11.4) requires vertical bar (|) to be escaped. + # + # All accommodations should behave as expected under strict POSIX semantics. + if fnmatch "*[\\*?[|]*" "$2"; then + set -- "$1" "$(printf '%s\n' "$2" | sed -e 's/[*?[|]/[&]/g; s/[\]/[\\&]/g')" fi + for item_P in "*[$list_FS]$2[$list_FS]*" "*[$list_FS]$2" "$2[$list_FS]*" "$2"; do + fnmatch "${item_P}" "$1" && return 0 + done + return 1 } # Adds a new line with the supplied arguments to $DESTN (or stdout) @@ -124,13 +161,13 @@ add_file() { # Read the file local line= while IFS= read -r line; do - if echo "$line" | grep -Eq '^\s*#\s*include\s*".+"'; then + if is_include_line "$line"; then # We have an include directive so strip the (first) file local inc=$(echo "$line" | grep -Eo '".*"' | sed -E 's/"([^"]+)"/\1/' | head -1) local res_inc="$(resolve_include "$srcdir" "$inc")" if list_has_item "$XINCS" "$inc"; then # The file was excluded so error if the source attempts to use it - write_line "#error Using excluded file: $inc" + write_line "#error Using excluded file: $inc (re-amalgamate source to fix)" log_line "Excluding: $inc" else if ! list_has_item "$FOUND" "$res_inc"; then @@ -155,7 +192,7 @@ add_file() { # Skip any 'pragma once' directives, otherwise write the source line local write=$PONCE if [ $write -eq 0 ]; then - if echo "$line" | grep -Eqv '^\s*#\s*pragma\s*once\s*'; then + if ! is_pragma_once_line "$line"; then write=1 fi fi @@ -200,6 +237,7 @@ if [ -n "$1" ]; then printf "" > "$DESTN" fi test_deps + log_line "Processing using the slower shell script; this might take a while" add_file "$1" else echo "Input file not found: \"$1\"" diff --git a/src/dependencies/zstd-1.5.4/build/single_file_libs/create_single_file_decoder.sh b/src/dependencies/zstd-1.5.4/build/single_file_libs/create_single_file_decoder.sh new file mode 100755 index 0000000..3c0c577 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/create_single_file_decoder.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# Where to find the sources +ZSTD_SRC_ROOT="../../lib" + +# Amalgamate the sources +echo "Amalgamating files..." +# Using the faster Python script if we have 3.8 or higher +if python3 -c 'import sys; assert sys.version_info >= (3,8)' 2>/dev/null; then + ./combine.py -r "$ZSTD_SRC_ROOT" -x legacy/zstd_legacy.h -o zstddeclib.c zstddeclib-in.c +else + ./combine.sh -r "$ZSTD_SRC_ROOT" -x legacy/zstd_legacy.h -o zstddeclib.c zstddeclib-in.c +fi +# Did combining work? +if [ $? -ne 0 ]; then + echo "Combine script: FAILED" + exit 1 +fi +echo "Combine script: PASSED" diff --git a/src/dependencies/zstd-1.5.4/build/single_file_libs/create_single_file_library.sh b/src/dependencies/zstd-1.5.4/build/single_file_libs/create_single_file_library.sh new file mode 100755 index 0000000..a6f71f0 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/create_single_file_library.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# Where to find the sources +ZSTD_SRC_ROOT="../../lib" + +# Amalgamate the sources +echo "Amalgamating files..." +# Using the faster Python script if we have 3.8 or higher +if python3 -c 'import sys; assert sys.version_info >= (3,8)' 2>/dev/null; then + ./combine.py -r "$ZSTD_SRC_ROOT" -x legacy/zstd_legacy.h -o zstd.c zstd-in.c +else + ./combine.sh -r "$ZSTD_SRC_ROOT" -x legacy/zstd_legacy.h -o zstd.c zstd-in.c +fi +# Did combining work? +if [ $? -ne 0 ]; then + echo "Combine script: FAILED" + exit 1 +fi +echo "Combine script: PASSED" diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/README.md b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/README.md rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/README.md diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/emscripten.c b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/emscripten.c similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/emscripten.c rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/emscripten.c diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/roundtrip.c b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/roundtrip.c similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/roundtrip.c rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/roundtrip.c diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/shell.html b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/shell.html similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/shell.html rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/shell.html diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/simple.c b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/simple.c similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/simple.c rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/simple.c diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/testcard-dxt1.inl b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/testcard-dxt1.inl similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/testcard-dxt1.inl rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/testcard-dxt1.inl diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/testcard-zstd.inl b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/testcard-zstd.inl similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/testcard-zstd.inl rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/testcard-zstd.inl diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/examples/testcard.png b/src/dependencies/zstd-1.5.4/build/single_file_libs/examples/testcard.png similarity index 100% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/examples/testcard.png rename to src/dependencies/zstd-1.5.4/build/single_file_libs/examples/testcard.png diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/zstd-in.c b/src/dependencies/zstd-1.5.4/build/single_file_libs/zstd-in.c similarity index 85% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/zstd-in.c rename to src/dependencies/zstd-1.5.4/build/single_file_libs/zstd-in.c index 1b27953..e6fca9e 100644 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/zstd-in.c +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/zstd-in.c @@ -4,11 +4,11 @@ * * Generate using: * \code - * combine.sh -r ../../lib -o zstd.c zstd-in.c + * python combine.py -r ../../lib -x legacy/zstd_legacy.h -o zstd.c zstd-in.c * \endcode */ /* - * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -25,9 +25,13 @@ * Note: MEM_MODULE stops xxhash redefining BYTE, U16, etc., which are also * defined in mem.h (breaking C99 compatibility). * - * Note: the undefs for xxHash allow Zstd's implementation to coinside with with + * Note: the undefs for xxHash allow Zstd's implementation to coincide with * standalone xxHash usage (with global defines). * + * Note: if you enable ZSTD_LEGACY_SUPPORT the combine.py script will need + * re-running without the "-x legacy/zstd_legacy.h" option (it excludes the + * legacy support at the source level). + * * Note: multithreading is enabled for all platforms apart from Emscripten. */ #define DEBUGLEVEL 0 @@ -43,6 +47,8 @@ #define ZSTD_MULTITHREAD #endif #define ZSTD_TRACE 0 +/* TODO: Can't amalgamate ASM function */ +#define ZSTD_DISABLE_ASM 1 /* Include zstd_deps.h first with all the options we need enabled. */ #define ZSTD_DEPS_NEED_MALLOC diff --git a/src/dependencies/zstd-1.5.0/build/single_file_libs/zstddeclib-in.c b/src/dependencies/zstd-1.5.4/build/single_file_libs/zstddeclib-in.c similarity index 79% rename from src/dependencies/zstd-1.5.0/build/single_file_libs/zstddeclib-in.c rename to src/dependencies/zstd-1.5.4/build/single_file_libs/zstddeclib-in.c index 019d9c2..8d9c1f5 100644 --- a/src/dependencies/zstd-1.5.0/build/single_file_libs/zstddeclib-in.c +++ b/src/dependencies/zstd-1.5.4/build/single_file_libs/zstddeclib-in.c @@ -4,11 +4,11 @@ * * Generate using: * \code - * combine.sh -r ../../lib -o zstddeclib.c zstddeclib-in.c + * python combine.py -r ../../lib -x legacy/zstd_legacy.h -o zstddeclib.c zstddeclib-in.c * \endcode */ /* - * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -25,8 +25,12 @@ * Note: MEM_MODULE stops xxhash redefining BYTE, U16, etc., which are also * defined in mem.h (breaking C99 compatibility). * - * Note: the undefs for xxHash allow Zstd's implementation to coinside with with + * Note: the undefs for xxHash allow Zstd's implementation to coincide with * standalone xxHash usage (with global defines). + * + * Note: if you enable ZSTD_LEGACY_SUPPORT the combine.py script will need + * re-running without the "-x legacy/zstd_legacy.h" option (it excludes the + * legacy support at the source level). */ #define DEBUGLEVEL 0 #define MEM_MODULE @@ -39,6 +43,8 @@ #define ZSTD_LEGACY_SUPPORT 0 #define ZSTD_STRIP_ERROR_STRINGS #define ZSTD_TRACE 0 +/* TODO: Can't amalgamate ASM function */ +#define ZSTD_DISABLE_ASM 1 /* Include zstd_deps.h first with all the options we need enabled. */ #define ZSTD_DEPS_NEED_MALLOC diff --git a/src/dependencies/zstd-1.5.0/contrib/VS2005/README.md b/src/dependencies/zstd-1.5.4/contrib/VS2005/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/VS2005/README.md rename to src/dependencies/zstd-1.5.4/contrib/VS2005/README.md diff --git a/src/dependencies/zstd-1.5.0/contrib/VS2005/fullbench/fullbench.vcproj b/src/dependencies/zstd-1.5.4/contrib/VS2005/fullbench/fullbench.vcproj similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/VS2005/fullbench/fullbench.vcproj rename to src/dependencies/zstd-1.5.4/contrib/VS2005/fullbench/fullbench.vcproj diff --git a/src/dependencies/zstd-1.5.0/contrib/VS2005/fuzzer/fuzzer.vcproj b/src/dependencies/zstd-1.5.4/contrib/VS2005/fuzzer/fuzzer.vcproj similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/VS2005/fuzzer/fuzzer.vcproj rename to src/dependencies/zstd-1.5.4/contrib/VS2005/fuzzer/fuzzer.vcproj diff --git a/src/dependencies/zstd-1.5.0/contrib/VS2005/zstd.sln b/src/dependencies/zstd-1.5.4/contrib/VS2005/zstd.sln similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/VS2005/zstd.sln rename to src/dependencies/zstd-1.5.4/contrib/VS2005/zstd.sln diff --git a/src/dependencies/zstd-1.5.0/contrib/VS2005/zstd/zstd.vcproj b/src/dependencies/zstd-1.5.4/contrib/VS2005/zstd/zstd.vcproj similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/VS2005/zstd/zstd.vcproj rename to src/dependencies/zstd-1.5.4/contrib/VS2005/zstd/zstd.vcproj index 78645d1..e37ebee 100644 --- a/src/dependencies/zstd-1.5.0/contrib/VS2005/zstd/zstd.vcproj +++ b/src/dependencies/zstd-1.5.4/contrib/VS2005/zstd/zstd.vcproj @@ -363,6 +363,10 @@ RelativePath="..\..\..\programs\fileio.c" > + + diff --git a/src/dependencies/zstd-1.5.0/contrib/VS2005/zstdlib/zstdlib.vcproj b/src/dependencies/zstd-1.5.4/contrib/VS2005/zstdlib/zstdlib.vcproj similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/VS2005/zstdlib/zstdlib.vcproj rename to src/dependencies/zstd-1.5.4/contrib/VS2005/zstdlib/zstdlib.vcproj diff --git a/src/dependencies/zstd-1.5.0/contrib/cleanTabs b/src/dependencies/zstd-1.5.4/contrib/cleanTabs similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/cleanTabs rename to src/dependencies/zstd-1.5.4/contrib/cleanTabs diff --git a/src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/.gitignore b/src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/.gitignore rename to src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/.gitignore diff --git a/src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/Makefile b/src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/Makefile similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/Makefile rename to src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/Makefile index a21a002..ecc9e63 100644 --- a/src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2019-present, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/check_flipped_bits.c b/src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/check_flipped_bits.c similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/check_flipped_bits.c rename to src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/check_flipped_bits.c index cc40ab8..09ddd46 100644 --- a/src/dependencies/zstd-1.5.0/contrib/diagnose_corruption/check_flipped_bits.c +++ b/src/dependencies/zstd-1.5.4/contrib/diagnose_corruption/check_flipped_bits.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/docker/Dockerfile b/src/dependencies/zstd-1.5.4/contrib/docker/Dockerfile similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/docker/Dockerfile rename to src/dependencies/zstd-1.5.4/contrib/docker/Dockerfile diff --git a/src/dependencies/zstd-1.5.0/contrib/docker/README.md b/src/dependencies/zstd-1.5.4/contrib/docker/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/docker/README.md rename to src/dependencies/zstd-1.5.4/contrib/docker/README.md diff --git a/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/.gitignore b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/.gitignore new file mode 100644 index 0000000..147710a --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/.gitignore @@ -0,0 +1,2 @@ +# build artifacts +externalSequenceProducer diff --git a/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/Makefile b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/Makefile new file mode 100644 index 0000000..0591ae0 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/Makefile @@ -0,0 +1,40 @@ +# ################################################################ +# Copyright (c) Yann Collet, Meta Platforms, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +PROGDIR = ../../programs +LIBDIR = ../../lib + +LIBZSTD = $(LIBDIR)/libzstd.a + +CPPFLAGS+= -I$(LIBDIR) -I$(LIBDIR)/compress -I$(LIBDIR)/common + +CFLAGS ?= -O3 +CFLAGS += -std=gnu99 +DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ + -Wstrict-aliasing=1 -Wswitch-enum \ + -Wstrict-prototypes -Wundef -Wpointer-arith \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls +CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) + +default: externalSequenceProducer + +all: externalSequenceProducer + +externalSequenceProducer: sequence_producer.c main.c $(LIBZSTD) + $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ + +.PHONY: $(LIBZSTD) +$(LIBZSTD): + $(MAKE) -C $(LIBDIR) libzstd.a CFLAGS="$(CFLAGS)" + +clean: + $(RM) *.o + $(MAKE) -C $(LIBDIR) clean > /dev/null + $(RM) externalSequenceProducer diff --git a/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/README.md b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/README.md new file mode 100644 index 0000000..c16a170 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/README.md @@ -0,0 +1,14 @@ +externalSequenceProducer +===================== + +`externalSequenceProducer` is a test tool for the Block-Level Sequence Producer API. +It demonstrates how to use the API to perform a simple round-trip test. + +A sample sequence producer is provided in sequence_producer.c, but the user can swap +this out with a different one if desired. The sample sequence producer implements +LZ parsing with a 1KB hashtable. Dictionary-based parsing is not currently supported. + +Command line : +``` +externalSequenceProducer filename +``` diff --git a/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/main.c b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/main.c new file mode 100644 index 0000000..e67e295 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/main.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) Yann Collet, Meta Platforms, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#include +#include +#include +#include + +#define ZSTD_STATIC_LINKING_ONLY +#include "zstd.h" +#include "zstd_errors.h" +#include "sequence_producer.h" // simpleSequenceProducer + +#define CHECK(res) \ +do { \ + if (ZSTD_isError(res)) { \ + printf("ERROR: %s\n", ZSTD_getErrorName(res)); \ + return 1; \ + } \ +} while (0) \ + +int main(int argc, char *argv[]) { + if (argc != 2) { + printf("Usage: externalSequenceProducer \n"); + return 1; + } + + ZSTD_CCtx* const zc = ZSTD_createCCtx(); + + int simpleSequenceProducerState = 0xdeadbeef; + + // Here is the crucial bit of code! + ZSTD_registerSequenceProducer( + zc, + &simpleSequenceProducerState, + simpleSequenceProducer + ); + + { + size_t const res = ZSTD_CCtx_setParameter(zc, ZSTD_c_enableSeqProducerFallback, 1); + CHECK(res); + } + + FILE *f = fopen(argv[1], "rb"); + assert(f); + { + int const ret = fseek(f, 0, SEEK_END); + assert(ret == 0); + } + size_t const srcSize = ftell(f); + { + int const ret = fseek(f, 0, SEEK_SET); + assert(ret == 0); + } + + char* const src = malloc(srcSize + 1); + assert(src); + { + size_t const ret = fread(src, srcSize, 1, f); + assert(ret == 1); + int const ret2 = fclose(f); + assert(ret2 == 0); + } + + size_t const dstSize = ZSTD_compressBound(srcSize); + char* const dst = malloc(dstSize); + assert(dst); + + size_t const cSize = ZSTD_compress2(zc, dst, dstSize, src, srcSize); + CHECK(cSize); + + char* const val = malloc(srcSize); + assert(val); + + { + size_t const res = ZSTD_decompress(val, srcSize, dst, cSize); + CHECK(res); + } + + if (memcmp(src, val, srcSize) == 0) { + printf("Compression and decompression were successful!\n"); + printf("Original size: %lu\n", srcSize); + printf("Compressed size: %lu\n", cSize); + } else { + printf("ERROR: input and validation buffers don't match!\n"); + for (size_t i = 0; i < srcSize; i++) { + if (src[i] != val[i]) { + printf("First bad index: %zu\n", i); + break; + } + } + return 1; + } + + ZSTD_freeCCtx(zc); + free(src); + free(dst); + free(val); + return 0; +} diff --git a/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/sequence_producer.c b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/sequence_producer.c new file mode 100644 index 0000000..60a2f95 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/sequence_producer.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) Yann Collet, Meta Platforms, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#include "zstd_compress_internal.h" +#include "sequence_producer.h" + +#define HSIZE 1024 +static U32 const HLOG = 10; +static U32 const MLS = 4; +static U32 const BADIDX = 0xffffffff; + +size_t simpleSequenceProducer( + void* sequenceProducerState, + ZSTD_Sequence* outSeqs, size_t outSeqsCapacity, + const void* src, size_t srcSize, + const void* dict, size_t dictSize, + int compressionLevel, + size_t windowSize +) { + const BYTE* const istart = (const BYTE*)src; + const BYTE* const iend = istart + srcSize; + const BYTE* ip = istart; + const BYTE* anchor = istart; + size_t seqCount = 0; + U32 hashTable[HSIZE]; + + (void)sequenceProducerState; + (void)dict; + (void)dictSize; + (void)outSeqsCapacity; + (void)compressionLevel; + + { int i; + for (i=0; i < HSIZE; i++) { + hashTable[i] = BADIDX; + } } + + while (ip + MLS < iend) { + size_t const hash = ZSTD_hashPtr(ip, HLOG, MLS); + U32 const matchIndex = hashTable[hash]; + hashTable[hash] = (U32)(ip - istart); + + if (matchIndex != BADIDX) { + const BYTE* const match = istart + matchIndex; + U32 const matchLen = (U32)ZSTD_count(ip, match, iend); + if (matchLen >= ZSTD_MINMATCH_MIN) { + U32 const litLen = (U32)(ip - anchor); + U32 const offset = (U32)(ip - match); + ZSTD_Sequence const seq = { + offset, litLen, matchLen, 0 + }; + + /* Note: it's crucial to stay within the window size! */ + if (offset <= windowSize) { + outSeqs[seqCount++] = seq; + ip += matchLen; + anchor = ip; + continue; + } + } + } + + ip++; + } + + { ZSTD_Sequence const finalSeq = { + 0, (U32)(iend - anchor), 0, 0 + }; + outSeqs[seqCount++] = finalSeq; + } + + return seqCount; +} diff --git a/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/sequence_producer.h b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/sequence_producer.h new file mode 100644 index 0000000..19f9982 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/externalSequenceProducer/sequence_producer.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) Yann Collet, Meta Platforms, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef MATCHFINDER_H +#define MATCHFINDER_H + +#define ZSTD_STATIC_LINKING_ONLY +#include "zstd.h" + +size_t simpleSequenceProducer( + void* sequenceProducerState, + ZSTD_Sequence* outSeqs, size_t outSeqsCapacity, + const void* src, size_t srcSize, + const void* dict, size_t dictSize, + int compressionLevel, + size_t windowSize +); + +#endif diff --git a/src/dependencies/zstd-1.5.0/contrib/freestanding_lib/freestanding.py b/src/dependencies/zstd-1.5.4/contrib/freestanding_lib/freestanding.py similarity index 94% rename from src/dependencies/zstd-1.5.0/contrib/freestanding_lib/freestanding.py rename to src/dependencies/zstd-1.5.4/contrib/freestanding_lib/freestanding.py index 1971687..df69832 100755 --- a/src/dependencies/zstd-1.5.0/contrib/freestanding_lib/freestanding.py +++ b/src/dependencies/zstd-1.5.4/contrib/freestanding_lib/freestanding.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # ################################################################ -# Copyright (c) 2021-2021, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -27,7 +27,6 @@ SKIPPED_FILES = [ "common/pool.h", "common/threading.c", "common/threading.h", - "common/zstd_trace.c", "common/zstd_trace.h", "compress/zstdmt_compress.h", "compress/zstdmt_compress.c", @@ -341,7 +340,7 @@ class PartialPreprocessor(object): if macro2 is not None and not resolved: assert ifdef and defined and op == '&&' and cmp is not None - # If the statment is true, but we have a single value check, then + # If the statement is true, but we have a single value check, then # check the value. defined_value = self._defs[macro] are_ints = True @@ -432,7 +431,7 @@ class Freestanding(object): external_xxhash: bool, xxh64_state: Optional[str], xxh64_prefix: Optional[str], rewritten_includes: [(str, str)], defs: [(str, Optional[str])], replaces: [(str, str)], - undefs: [str], excludes: [str], seds: [str], + undefs: [str], excludes: [str], seds: [str], spdx: bool, ): self._zstd_deps = zstd_deps self._mem = mem @@ -447,6 +446,7 @@ class Freestanding(object): self._undefs = undefs self._excludes = excludes self._seds = seds + self._spdx = spdx def _dst_lib_file_paths(self): """ @@ -461,7 +461,8 @@ class Freestanding(object): print(*args, **kwargs) def _copy_file(self, lib_path): - if not (lib_path.endswith(".c") or lib_path.endswith(".h")): + suffixes = [".c", ".h", ".S"] + if not any((lib_path.endswith(suffix) for suffix in suffixes)): return if lib_path in SKIPPED_FILES: self._log(f"\tSkipping file: {lib_path}") @@ -640,6 +641,27 @@ class Freestanding(object): for sed in self._seds: self._process_sed(sed) + def _process_spdx(self): + if not self._spdx: + return + self._log("Processing spdx") + SPDX_C = "// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause\n" + SPDX_H_S = "/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */\n" + for filepath in self._dst_lib_file_paths(): + file = FileLines(filepath) + if file.lines[0] == SPDX_C or file.lines[0] == SPDX_H_S: + continue + for line in file.lines: + if "SPDX-License-Identifier" in line: + raise RuntimeError(f"Unexpected SPDX license identifier: {file.filename} {repr(line)}") + if file.filename.endswith(".c"): + file.lines.insert(0, SPDX_C) + elif file.filename.endswith(".h") or file.filename.endswith(".S"): + file.lines.insert(0, SPDX_H_S) + else: + raise RuntimeError(f"Unexpected file extension: {file.filename}") + file.write() + def go(self): @@ -651,6 +673,7 @@ class Freestanding(object): self._rewrite_includes() self._replace_xxh64_prefix() self._process_seds() + self._process_spdx() def parse_optional_pair(defines: [str]) -> [(str, Optional[str])]: @@ -689,8 +712,9 @@ def main(name, args): parser.add_argument("--xxh64-prefix", default=None, help="Alternate XXH64 function prefix (excluding _) e.g. --xxh64-prefix=xxh64") parser.add_argument("--rewrite-include", default=[], dest="rewritten_includes", action="append", help="Rewrite an include REGEX=NEW (e.g. '=')") parser.add_argument("--sed", default=[], dest="seds", action="append", help="Apply a sed replacement. Format: `s/REGEX/FORMAT/[g]`. REGEX is a Python regex. FORMAT is a Python format string formatted by the regex dict.") + parser.add_argument("--spdx", action="store_true", help="Add SPDX License Identifiers") parser.add_argument("-D", "--define", default=[], dest="defs", action="append", help="Pre-define this macro (can be passed multiple times)") - parser.add_argument("-U", "--undefine", default=[], dest="undefs", action="append", help="Pre-undefine this macro (can be passed mutliple times)") + parser.add_argument("-U", "--undefine", default=[], dest="undefs", action="append", help="Pre-undefine this macro (can be passed multiple times)") parser.add_argument("-R", "--replace", default=[], dest="replaces", action="append", help="Pre-define this macro and replace the first ifndef block with its definition") parser.add_argument("-E", "--exclude", default=[], dest="excludes", action="append", help="Exclude all lines between 'BEGIN ' and 'END '") args = parser.parse_args(args) @@ -743,6 +767,7 @@ def main(name, args): args.undefs, args.excludes, args.seds, + args.spdx, ).go() if __name__ == "__main__": diff --git a/src/dependencies/zstd-1.5.0/contrib/gen_html/.gitignore b/src/dependencies/zstd-1.5.4/contrib/gen_html/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/gen_html/.gitignore rename to src/dependencies/zstd-1.5.4/contrib/gen_html/.gitignore diff --git a/src/dependencies/zstd-1.5.0/contrib/gen_html/Makefile b/src/dependencies/zstd-1.5.4/contrib/gen_html/Makefile similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/gen_html/Makefile rename to src/dependencies/zstd-1.5.4/contrib/gen_html/Makefile index 425f266..26e8703 100644 --- a/src/dependencies/zstd-1.5.0/contrib/gen_html/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/gen_html/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2016-present, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/gen_html/README.md b/src/dependencies/zstd-1.5.4/contrib/gen_html/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/gen_html/README.md rename to src/dependencies/zstd-1.5.4/contrib/gen_html/README.md diff --git a/src/dependencies/zstd-1.5.0/contrib/gen_html/gen-zstd-manual.sh b/src/dependencies/zstd-1.5.4/contrib/gen_html/gen-zstd-manual.sh similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/gen_html/gen-zstd-manual.sh rename to src/dependencies/zstd-1.5.4/contrib/gen_html/gen-zstd-manual.sh diff --git a/src/dependencies/zstd-1.5.0/contrib/gen_html/gen_html.cpp b/src/dependencies/zstd-1.5.4/contrib/gen_html/gen_html.cpp similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/gen_html/gen_html.cpp rename to src/dependencies/zstd-1.5.4/contrib/gen_html/gen_html.cpp index 90d5b21..1da5879 100644 --- a/src/dependencies/zstd-1.5.0/contrib/gen_html/gen_html.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/gen_html/gen_html.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Przemyslaw Skibinski, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/.gitignore b/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/largeNbDicts/.gitignore rename to src/dependencies/zstd-1.5.4/contrib/largeNbDicts/.gitignore diff --git a/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/Makefile b/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/Makefile similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/largeNbDicts/Makefile rename to src/dependencies/zstd-1.5.4/contrib/largeNbDicts/Makefile index 4c055b0..40734e6 100644 --- a/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2018-present, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/README.md b/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/README.md new file mode 100644 index 0000000..010102c --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/README.md @@ -0,0 +1,33 @@ +largeNbDicts +===================== + +`largeNbDicts` is a benchmark test tool +dedicated to the specific scenario of +dictionary decompression using a very large number of dictionaries. +When dictionaries are constantly changing, they are always "cold", +suffering from increased latency due to cache misses. + +The tool is created in a bid to investigate performance for this scenario, +and experiment mitigation techniques. + +Command line : +``` +largeNbDicts [Options] filename(s) + +Options : +-z : benchmark compression (default) +-d : benchmark decompression +-r : recursively load all files in subdirectories (default: off) +-B# : split input into blocks of size # (default: no split) +-# : use compression level # (default: 3) +-D # : use # as a dictionary (default: create one) +-i# : nb benchmark rounds (default: 6) +--nbBlocks=#: use # blocks for bench (default: one per file) +--nbDicts=# : create # dictionaries for bench (default: one per block) +-h : help (this text) + +Advanced Options (see zstd.h for documentation) : +--dedicated-dict-search +--dict-content-type=# +--dict-attach-pref=# +``` diff --git a/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/largeNbDicts.c b/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/largeNbDicts.c similarity index 82% rename from src/dependencies/zstd-1.5.0/contrib/largeNbDicts/largeNbDicts.c rename to src/dependencies/zstd-1.5.4/contrib/largeNbDicts/largeNbDicts.c index ddbb3e0..eeaaf71 100644 --- a/src/dependencies/zstd-1.5.0/contrib/largeNbDicts/largeNbDicts.c +++ b/src/dependencies/zstd-1.5.4/contrib/largeNbDicts/largeNbDicts.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-present, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -19,7 +19,7 @@ /*--- Dependencies ---*/ #include /* size_t */ -#include /* malloc, free, abort */ +#include /* malloc, free, abort, qsort*/ #include /* fprintf */ #include /* UINT_MAX */ #include /* assert */ @@ -39,6 +39,7 @@ #define BLOCKSIZE_DEFAULT 0 /* no slicing into blocks */ #define DICTSIZE (4 KB) #define CLEVEL_DEFAULT 3 +#define DICT_LOAD_METHOD ZSTD_dlm_byCopy #define BENCH_TIME_DEFAULT_S 6 #define RUN_TIME_DEFAULT_MS 1000 @@ -156,19 +157,6 @@ createDictionaryBuffer(const char* dictionaryName, } } -static ZSTD_CDict* createCDictForDedicatedDictSearch(const void* dict, size_t dictSize, int compressionLevel) -{ - ZSTD_CCtx_params* params = ZSTD_createCCtxParams(); - ZSTD_CCtxParams_init(params, compressionLevel); - ZSTD_CCtxParams_setParameter(params, ZSTD_c_enableDedicatedDictSearch, 1); - ZSTD_CCtxParams_setParameter(params, ZSTD_c_compressionLevel, compressionLevel); - - ZSTD_CDict* cdict = ZSTD_createCDict_advanced2(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, params, ZSTD_defaultCMem); - - ZSTD_freeCCtxParams(params); - return cdict; -} - /*! BMK_loadFiles() : * Loads `buffer`, with content from files listed within `fileNamesTable`. * Fills `buffer` entirely. @@ -461,14 +449,12 @@ static void freeCDictCollection(cdict_collection_t cdictc) } /* returns .buffers=NULL if operation fails */ -static cdict_collection_t createCDictCollection(const void* dictBuffer, size_t dictSize, size_t nbCDict, int cLevel, int dedicatedDictSearch) +static cdict_collection_t createCDictCollection(const void* dictBuffer, size_t dictSize, size_t nbCDict, ZSTD_dictContentType_e dictContentType, ZSTD_CCtx_params* cctxParams) { ZSTD_CDict** const cdicts = malloc(nbCDict * sizeof(ZSTD_CDict*)); if (cdicts==NULL) return kNullCDictCollection; for (size_t dictNb=0; dictNb < nbCDict; dictNb++) { - cdicts[dictNb] = dedicatedDictSearch ? - createCDictForDedicatedDictSearch(dictBuffer, dictSize, cLevel) : - ZSTD_createCDict(dictBuffer, dictSize, cLevel); + cdicts[dictNb] = ZSTD_createCDict_advanced2(dictBuffer, dictSize, DICT_LOAD_METHOD, dictContentType, cctxParams, ZSTD_defaultCMem); CONTROL(cdicts[dictNb] != NULL); } cdict_collection_t cdictc; @@ -591,11 +577,13 @@ typedef struct { cdict_collection_t dictionaries; } compressInstructions; -compressInstructions createCompressInstructions(cdict_collection_t dictionaries) +compressInstructions createCompressInstructions(cdict_collection_t dictionaries, ZSTD_CCtx_params* cctxParams) { compressInstructions ci; ci.cctx = ZSTD_createCCtx(); CONTROL(ci.cctx != NULL); + if (cctxParams) + ZSTD_CCtx_setParametersUsingCCtxParams(ci.cctx, cctxParams); ci.nbDicts = dictionaries.nbCDict; ci.dictNb = 0; ci.dictionaries = dictionaries; @@ -636,10 +624,10 @@ size_t compress(const void* src, size_t srcSize, void* dst, size_t dstCapacity, compressInstructions* const ci = (compressInstructions*) payload; (void)dstCapacity; - ZSTD_compress_usingCDict(ci->cctx, - dst, srcSize, - src, srcSize, - ci->dictionaries.cdicts[ci->dictNb]); + ZSTD_CCtx_refCDict(ci->cctx, ci->dictionaries.cdicts[ci->dictNb]); + ZSTD_compress2(ci->cctx, + dst, srcSize, + src, srcSize); ci->dictNb = ci->dictNb + 1; if (ci->dictNb >= ci->nbDicts) ci->dictNb = 0; @@ -663,25 +651,55 @@ size_t decompress(const void* src, size_t srcSize, void* dst, size_t dstCapacity return result; } +typedef enum { + fastest = 0, + median = 1, +} metricAggregatePref_e; -static int benchMem(slice_collection_t dstBlocks, - slice_collection_t srcBlocks, +/* compareFunction() : + * Sort input in decreasing order when used with qsort() */ +int compareFunction(const void *a, const void *b) +{ + double x = *(const double *)a; + double y = *(const double *)b; + if (x < y) + return 1; + else if (x > y) + return -1; + return 0; +} + +double aggregateData(double *data, size_t size, + metricAggregatePref_e metricAggregatePref) +{ + qsort(data, size, sizeof(*data), compareFunction); + if (metricAggregatePref == fastest) + return data[0]; + else /* median */ + return (data[(size - 1) / 2] + data[size / 2]) / 2; +} + +static int benchMem(slice_collection_t dstBlocks, slice_collection_t srcBlocks, ddict_collection_t ddictionaries, - cdict_collection_t cdictionaries, - unsigned nbRounds, int benchCompression) + cdict_collection_t cdictionaries, unsigned nbRounds, + int benchCompression, const char *exeName, + ZSTD_CCtx_params *cctxParams, + metricAggregatePref_e metricAggregatePref) { assert(dstBlocks.nbSlices == srcBlocks.nbSlices); + if (benchCompression) assert(cctxParams); unsigned const ms_per_round = RUN_TIME_DEFAULT_MS; unsigned const total_time_ms = nbRounds * ms_per_round; - double bestSpeed = 0.; + double *const speedPerRound = (double *)malloc(nbRounds * sizeof(double)); BMK_timedFnState_t* const benchState = BMK_createTimedFnState(total_time_ms, ms_per_round); decompressInstructions di = createDecompressInstructions(ddictionaries); - compressInstructions ci = createCompressInstructions(cdictionaries); + compressInstructions ci = + createCompressInstructions(cdictionaries, cctxParams); void* payload = benchCompression ? (void*)&ci : (void*)&di; BMK_benchParams_t const bp = { .benchFn = benchCompression ? compress : decompress, @@ -697,6 +715,7 @@ static int benchMem(slice_collection_t dstBlocks, .blockResults = NULL }; + size_t roundNb = 0; for (;;) { BMK_runOutcome_t const outcome = BMK_benchTimedFn(benchState, bp); CONTROL(BMK_isSuccessful_runOutcome(outcome)); @@ -706,16 +725,57 @@ static int benchMem(slice_collection_t dstBlocks, double const dTime_sec = (double)dTime_ns / 1000000000; size_t const srcSize = result.sumOfReturn; double const speed_MBps = (double)srcSize / dTime_sec / (1 MB); - if (speed_MBps > bestSpeed) bestSpeed = speed_MBps; + speedPerRound[roundNb] = speed_MBps; if (benchCompression) - DISPLAY("Compression Speed : %.1f MB/s \r", bestSpeed); + DISPLAY("Compression Speed : %.1f MB/s \r", speed_MBps); else - DISPLAY("Decompression Speed : %.1f MB/s \r", bestSpeed); + DISPLAY("Decompression Speed : %.1f MB/s \r", speed_MBps); fflush(stdout); if (BMK_isCompleted_TimedFn(benchState)) break; + roundNb++; } DISPLAY("\n"); + /* BMK_benchTimedFn may not run exactly nbRounds iterations */ + double speedAggregated = + aggregateData(speedPerRound, roundNb + 1, metricAggregatePref); + if (metricAggregatePref == fastest) + DISPLAY("Fastest Speed : %.1f MB/s \n", speedAggregated); + else + DISPLAY("Median Speed : %.1f MB/s \n", speedAggregated); + + char* csvFileName = malloc(strlen(exeName) + 5); + strcpy(csvFileName, exeName); + strcat(csvFileName, ".csv"); + FILE* csvFile = fopen(csvFileName, "r"); + if (!csvFile) { + csvFile = fopen(csvFileName, "wt"); + assert(csvFile); + fprintf(csvFile, "%s\n", exeName); + /* Print table headers */ + fprintf( + csvFile, + "Compression/Decompression,Level,nbDicts,dictAttachPref,metricAggregatePref,Speed\n"); + } else { + fclose(csvFile); + csvFile = fopen(csvFileName, "at"); + assert(csvFile); + } + + int cLevel = -1; + int dictAttachPref = -1; + if (benchCompression) { + ZSTD_CCtxParams_getParameter(cctxParams, ZSTD_c_compressionLevel, + &cLevel); + ZSTD_CCtxParams_getParameter(cctxParams, ZSTD_c_forceAttachDict, + &dictAttachPref); + } + fprintf(csvFile, "%s,%d,%ld,%d,%d,%.1f\n", + benchCompression ? "Compression" : "Decompression", cLevel, + benchCompression ? ci.nbDicts : di.nbDicts, dictAttachPref, + metricAggregatePref, speedAggregated); + fclose(csvFile); + free(csvFileName); freeDecompressInstructions(di); freeCompressInstructions(ci); @@ -730,12 +790,11 @@ static int benchMem(slice_collection_t dstBlocks, * dictionary : optional (can be NULL), file to load as dictionary, * if none provided : will be calculated on the fly by the program. * @return : 0 is success, 1+ otherwise */ -int bench(const char** fileNameTable, unsigned nbFiles, - const char* dictionary, - size_t blockSize, int clevel, - unsigned nbDictMax, unsigned nbBlocks, +int bench(const char **fileNameTable, unsigned nbFiles, const char *dictionary, + size_t blockSize, int clevel, unsigned nbDictMax, unsigned nbBlocks, unsigned nbRounds, int benchCompression, - int dedicatedDictSearch) + ZSTD_dictContentType_e dictContentType, ZSTD_CCtx_params *cctxParams, + const char *exeName, metricAggregatePref_e metricAggregatePref) { int result = 0; @@ -786,20 +845,18 @@ int bench(const char** fileNameTable, unsigned nbFiles, /* dictionary determination */ buffer_t const dictBuffer = createDictionaryBuffer(dictionary, srcs.buffer.ptr, - srcs.slices.capacities, srcs.slices.nbSlices, + srcSlices.capacities, srcSlices.nbSlices, DICTSIZE); CONTROL(dictBuffer.ptr != NULL); - ZSTD_CDict* const cdict = dedicatedDictSearch ? - createCDictForDedicatedDictSearch(dictBuffer.ptr, dictBuffer.size, clevel) : - ZSTD_createCDict(dictBuffer.ptr, dictBuffer.size, clevel); + ZSTD_CDict* const cdict = ZSTD_createCDict_advanced2(dictBuffer.ptr, dictBuffer.size, DICT_LOAD_METHOD, dictContentType, cctxParams, ZSTD_defaultCMem); CONTROL(cdict != NULL); size_t const cTotalSizeNoDict = compressBlocks(NULL, dstSlices, srcSlices, NULL, clevel); CONTROL(cTotalSizeNoDict != 0); DISPLAYLEVEL(3, "compressing at level %u without dictionary : Ratio=%.2f (%u bytes) \n", clevel, - (double)totalSrcSlicesSize / cTotalSizeNoDict, (unsigned)cTotalSizeNoDict); + (double)totalSrcSlicesSize / (double)cTotalSizeNoDict, (unsigned)cTotalSizeNoDict); size_t* const cSizes = malloc(nbBlocks * sizeof(size_t)); CONTROL(cSizes != NULL); @@ -808,21 +865,21 @@ int bench(const char** fileNameTable, unsigned nbFiles, CONTROL(cTotalSize != 0); DISPLAYLEVEL(3, "compressed using a %u bytes dictionary : Ratio=%.2f (%u bytes) \n", (unsigned)dictBuffer.size, - (double)totalSrcSlicesSize / cTotalSize, (unsigned)cTotalSize); + (double)totalSrcSlicesSize / (double)cTotalSize, (unsigned)cTotalSize); /* now dstSlices contain the real compressed size of each block, instead of the maximum capacity */ shrinkSizes(dstSlices, cSizes); unsigned const nbDicts = nbDictMax ? nbDictMax : nbBlocks; - cdict_collection_t const cdictionaries = createCDictCollection(dictBuffer.ptr, dictBuffer.size, nbDicts, clevel, dedicatedDictSearch); + cdict_collection_t const cdictionaries = createCDictCollection(dictBuffer.ptr, dictBuffer.size, nbDicts, dictContentType, cctxParams); CONTROL(cdictionaries.cdicts != NULL); ddict_collection_t const ddictionaries = createDDictCollection(dictBuffer.ptr, dictBuffer.size, nbDicts); CONTROL(ddictionaries.ddicts != NULL); if (benchCompression) { - size_t const dictMem = ZSTD_estimateCDictSize(dictBuffer.size, ZSTD_dlm_byCopy); + size_t const dictMem = ZSTD_sizeof_CDict(cdictionaries.cdicts[0]); size_t const allDictMem = dictMem * nbDicts; DISPLAYLEVEL(3, "generating %u dictionaries, using %.1f MB of memory \n", nbDicts, (double)allDictMem / (1 MB)); @@ -832,11 +889,13 @@ int bench(const char** fileNameTable, unsigned nbFiles, buffer_collection_t resultCollection = createBufferCollection_fromSliceCollection(srcSlices); CONTROL(resultCollection.buffer.ptr != NULL); - result = benchMem(dstSlices, resultCollection.slices, ddictionaries, cdictionaries, nbRounds, benchCompression); + result = benchMem(dstSlices, resultCollection.slices, ddictionaries, + cdictionaries, nbRounds, benchCompression, exeName, + cctxParams, metricAggregatePref); freeBufferCollection(resultCollection); } else { - size_t const dictMem = ZSTD_estimateDDictSize(dictBuffer.size, ZSTD_dlm_byCopy); + size_t const dictMem = ZSTD_estimateDDictSize(dictBuffer.size, DICT_LOAD_METHOD); size_t const allDictMem = dictMem * nbDicts; DISPLAYLEVEL(3, "generating %u dictionaries, using %.1f MB of memory \n", nbDicts, (double)allDictMem / (1 MB)); @@ -846,7 +905,9 @@ int bench(const char** fileNameTable, unsigned nbFiles, buffer_collection_t resultCollection = createBufferCollection_fromSliceCollectionSizes(srcSlices); CONTROL(resultCollection.buffer.ptr != NULL); - result = benchMem(resultCollection.slices, dstSlices, ddictionaries, cdictionaries, nbRounds, benchCompression); + result = benchMem(resultCollection.slices, dstSlices, ddictionaries, + cdictionaries, nbRounds, benchCompression, exeName, + NULL, metricAggregatePref); freeBufferCollection(resultCollection); } @@ -924,9 +985,15 @@ int usage(const char* exeName) DISPLAY ("-# : use compression level # (default: %u) \n", CLEVEL_DEFAULT); DISPLAY ("-D # : use # as a dictionary (default: create one) \n"); DISPLAY ("-i# : nb benchmark rounds (default: %u) \n", BENCH_TIME_DEFAULT_S); + DISPLAY ("-p# : print speed for all rounds 0=fastest 1=median (default: 0) \n"); DISPLAY ("--nbBlocks=#: use # blocks for bench (default: one per file) \n"); DISPLAY ("--nbDicts=# : create # dictionaries for bench (default: one per block) \n"); DISPLAY ("-h : help (this text) \n"); + DISPLAY (" \n"); + DISPLAY ("Advanced Options (see zstd.h for documentation) : \n"); + DISPLAY ("--dedicated-dict-search\n"); + DISPLAY ("--dict-content-type=#\n"); + DISPLAY ("--dict-attach-pref=#\n"); return 0; } @@ -956,6 +1023,10 @@ int main (int argc, const char** argv) size_t blockSize = BLOCKSIZE_DEFAULT; unsigned nbDicts = 0; /* determine nbDicts automatically: 1 dictionary per block */ unsigned nbBlocks = 0; /* determine nbBlocks automatically, from source and blockSize */ + ZSTD_dictContentType_e dictContentType = ZSTD_dct_auto; + ZSTD_dictAttachPref_e dictAttachPref = ZSTD_dictDefaultAttach; + ZSTD_paramSwitch_e prefetchCDictTables = ZSTD_ps_auto; + metricAggregatePref_e metricAggregatePref = fastest; for (int argNb = 1; argNb < argc ; argNb++) { const char* argument = argv[argNb]; @@ -965,6 +1036,7 @@ int main (int argc, const char** argv) if (!strcmp(argument, "-r")) { recursiveMode = 1; continue; } if (!strcmp(argument, "-D")) { argNb++; assert(argNb < argc); dictionary = argv[argNb]; continue; } if (longCommandWArg(&argument, "-i")) { nbRounds = readU32FromChar(&argument); continue; } + if (longCommandWArg(&argument, "-p")) { metricAggregatePref = (int)readU32FromChar(&argument); continue;} if (longCommandWArg(&argument, "--dictionary=")) { dictionary = argument; continue; } if (longCommandWArg(&argument, "-B")) { blockSize = readU32FromChar(&argument); continue; } if (longCommandWArg(&argument, "--blockSize=")) { blockSize = readU32FromChar(&argument); continue; } @@ -972,6 +1044,9 @@ int main (int argc, const char** argv) if (longCommandWArg(&argument, "--nbBlocks=")) { nbBlocks = readU32FromChar(&argument); continue; } if (longCommandWArg(&argument, "--clevel=")) { cLevel = (int)readU32FromChar(&argument); continue; } if (longCommandWArg(&argument, "--dedicated-dict-search")) { dedicatedDictSearch = 1; continue; } + if (longCommandWArg(&argument, "--dict-content-type=")) { dictContentType = (int)readU32FromChar(&argument); continue; } + if (longCommandWArg(&argument, "--dict-attach-pref=")) { dictAttachPref = (int)readU32FromChar(&argument); continue; } + if (longCommandWArg(&argument, "--prefetch-cdict-tables=")) { prefetchCDictTables = (int)readU32FromChar(&argument); continue; } if (longCommandWArg(&argument, "-")) { cLevel = (int)readU32FromChar(&argument); continue; } /* anything that's not a command is a filename */ nameTable[nameIdx++] = argument; @@ -989,10 +1064,22 @@ int main (int argc, const char** argv) nameTable = NULL; /* UTIL_createFileNamesTable() takes ownership of nameTable */ } - int result = bench(filenameTable->fileNames, (unsigned)filenameTable->tableSize, dictionary, blockSize, cLevel, nbDicts, nbBlocks, nbRounds, benchCompression, dedicatedDictSearch); + ZSTD_CCtx_params* cctxParams = ZSTD_createCCtxParams(); + ZSTD_CCtxParams_init(cctxParams, cLevel); + ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_enableDedicatedDictSearch, dedicatedDictSearch); + ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_nbWorkers, 0); + ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_forceAttachDict, dictAttachPref); + ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_prefetchCDictTables, prefetchCDictTables); + + int result = + bench(filenameTable->fileNames, (unsigned)filenameTable->tableSize, + dictionary, blockSize, cLevel, nbDicts, nbBlocks, nbRounds, + benchCompression, dictContentType, cctxParams, exeName, + metricAggregatePref); UTIL_freeFileNamesTable(filenameTable); free(nameTable); + ZSTD_freeCCtxParams(cctxParams); return result; } diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/.gitignore b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/.gitignore rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/.gitignore diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/Makefile b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/Makefile similarity index 77% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/Makefile rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/Makefile index c391df7..63dd15d 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -26,20 +26,20 @@ libzstd: --rewrite-include '"(\.\./)?zstd_errors.h"=' \ --sed 's,/\*\*\*,/* *,g' \ --sed 's,/\*\*,/*,g' \ + --spdx \ -DZSTD_NO_INTRINSICS \ -DZSTD_NO_UNUSED_FUNCTIONS \ -DZSTD_LEGACY_SUPPORT=0 \ -DZSTD_STATIC_LINKING_ONLY \ -DFSE_STATIC_LINKING_ONLY \ - -DHUF_STATIC_LINKING_ONLY \ -DXXH_STATIC_LINKING_ONLY \ - -DMEM_FORCE_MEMORY_ACCESS=0 \ -D__GNUC__ \ + -D__linux__=1 \ -DSTATIC_BMI2=0 \ -DZSTD_ADDRESS_SANITIZER=0 \ -DZSTD_MEMORY_SANITIZER=0 \ + -DZSTD_DATAFLOW_SANITIZER=0 \ -DZSTD_COMPRESS_HEAPMODE=1 \ - -UZSTD_NO_INLINE \ -UNO_PREFETCH \ -U__cplusplus \ -UZSTD_DLL_EXPORT \ @@ -48,14 +48,19 @@ libzstd: -UZSTD_MULTITHREAD \ -U_MSC_VER \ -U_WIN32 \ - -RZSTDLIB_VISIBILITY= \ - -RZSTDERRORLIB_VISIBILITY= \ + -RZSTDLIB_VISIBLE= \ + -RZSTDERRORLIB_VISIBLE= \ + -RZSTD_FALLTHROUGH=fallthrough \ -DZSTD_HAVE_WEAK_SYMBOLS=0 \ -DZSTD_TRACE=0 \ - -DZSTD_NO_TRACE + -DZSTD_NO_TRACE \ + -DZSTD_DISABLE_ASM \ + -DZSTD_LINUX_KERNEL + rm linux/lib/zstd/decompress/huf_decompress_amd64.S mv linux/lib/zstd/zstd.h linux/include/linux/zstd_lib.h mv linux/lib/zstd/zstd_errors.h linux/include/linux/ cp linux_zstd.h linux/include/linux/zstd.h + cp zstd_common_module.c linux/lib/zstd cp zstd_compress_module.c linux/lib/zstd cp zstd_decompress_module.c linux/lib/zstd cp decompress_sources.h linux/lib/zstd @@ -86,10 +91,18 @@ import-upstream: rm $(LINUX)/lib/zstd/common/xxhash.* rm $(LINUX)/lib/zstd/compress/zstdmt_* +DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ + -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ + -Wstrict-prototypes -Wundef -Wpointer-arith \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls -Wmissing-prototypes -Wc++-compat \ + -Wimplicit-fallthrough + .PHONY: test test: libzstd - $(MAKE) -C test run-test CFLAGS="-O3 $(CFLAGS)" -j + $(MAKE) -C test run-test CFLAGS="-O3 $(CFLAGS) $(DEBUGFLAGS) -Werror" -j .PHONY: clean clean: $(RM) -rf linux + $(MAKE) -C test clean diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/README.md b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/README.md rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/README.md diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/btrfs-benchmark.sh b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/btrfs-benchmark.sh similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/btrfs-benchmark.sh rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/btrfs-benchmark.sh diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/btrfs-extract-benchmark.sh b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/btrfs-extract-benchmark.sh similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/btrfs-extract-benchmark.sh rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/btrfs-extract-benchmark.sh diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/decompress_sources.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/decompress_sources.h similarity index 79% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/decompress_sources.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/decompress_sources.h index f35bef0..8a47eb2 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/decompress_sources.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/decompress_sources.h @@ -1,6 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -16,6 +16,12 @@ * decompression. */ +/* + * Disable the ASM Huffman implementation because we need to + * include all the sources. + */ +#define ZSTD_DISABLE_ASM 1 + #include "common/debug.c" #include "common/entropy_common.c" #include "common/error_private.c" diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/linux.mk b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/linux.mk similarity index 85% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/linux.mk rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/linux.mk index 19485e3..464c410 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/linux.mk +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/linux.mk @@ -1,6 +1,6 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -10,16 +10,10 @@ # ################################################################ obj-$(CONFIG_ZSTD_COMPRESS) += zstd_compress.o obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o - -ccflags-y += -O3 +obj-$(CONFIG_ZSTD_COMMON) += zstd_common.o zstd_compress-y := \ zstd_compress_module.o \ - common/debug.o \ - common/entropy_common.o \ - common/error_private.o \ - common/fse_decompress.o \ - common/zstd_common.o \ compress/fse_compress.o \ compress/hist.o \ compress/huf_compress.o \ @@ -35,12 +29,15 @@ zstd_compress-y := \ zstd_decompress-y := \ zstd_decompress_module.o \ + decompress/huf_decompress.o \ + decompress/zstd_ddict.o \ + decompress/zstd_decompress.o \ + decompress/zstd_decompress_block.o \ + +zstd_common-y := \ + zstd_common_module.o \ common/debug.o \ common/entropy_common.o \ common/error_private.o \ common/fse_decompress.o \ common/zstd_common.o \ - decompress/huf_decompress.o \ - decompress/zstd_ddict.o \ - decompress/zstd_decompress.o \ - decompress/zstd_decompress_block.o \ diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/linux_zstd.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/linux_zstd.h similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/linux_zstd.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/linux_zstd.h index 446ecab..f109d49 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/linux_zstd.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/linux_zstd.h @@ -1,6 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/mem.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/mem.h similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/mem.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/mem.h index 4b5db57..a723182 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/mem.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/mem.h @@ -1,6 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -30,6 +30,8 @@ * Basic Types *****************************************************************/ typedef uint8_t BYTE; +typedef uint8_t U8; +typedef int8_t S8; typedef uint16_t U16; typedef int16_t S16; typedef uint32_t U32; diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/squashfs-benchmark.sh b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/squashfs-benchmark.sh similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/squashfs-benchmark.sh rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/squashfs-benchmark.sh diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/Makefile b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/Makefile similarity index 85% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/Makefile rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/Makefile index 2908839..67b55e6 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -18,9 +18,13 @@ CPPFLAGS += -DZSTD_ASAN_DONT_POISON_WORKSPACE LINUX_ZSTD_MODULE := $(wildcard $(LINUX_ZSTDLIB)/*.c) LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c) LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c) -LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c) +LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c $(LINUX_ZSTDLIB)/decompress/*.S) LINUX_ZSTD_FILES := $(LINUX_ZSTD_MODULE) $(LINUX_ZSTD_COMMON) $(LINUX_ZSTD_COMPRESS) $(LINUX_ZSTD_DECOMPRESS) -LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_FILES:.c=.o) +LINUX_ZSTD_OBJECTS0 := $(LINUX_ZSTD_FILES:.c=.o) +LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_OBJECTS0:.S=.o) + +%.o: %.S + $(COMPILE.S) $(OUTPUT_OPTION) $< liblinuxzstd.a: $(LINUX_ZSTD_OBJECTS) $(AR) $(ARFLAGS) $@ $^ @@ -41,4 +45,5 @@ clean: $(RM) -f $(LINUX_ZSTDLIB)/*.o $(RM) -f $(LINUX_ZSTDLIB)/**/*.o $(RM) -f *.o *.a + $(RM) -f static_test $(RM) -f test diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/asm/unaligned.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/asm/unaligned.h similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/asm/unaligned.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/asm/unaligned.h index 02c2d74..86ec4ca 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/asm/unaligned.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/asm/unaligned.h @@ -20,6 +20,7 @@ static unsigned _isLittleEndian(void) { const union { uint32_t u; uint8_t c[4]; } one = { 1 }; assert(_IS_LITTLE_ENDIAN == one.c[0]); + (void)one; return _IS_LITTLE_ENDIAN; } diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/compiler.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/compiler.h similarity index 82% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/compiler.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/compiler.h index ea3422e..988ce4a 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/compiler.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/compiler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -18,4 +18,6 @@ #define noinline __attribute__((noinline)) #endif +#define fallthrough __attribute__((__fallthrough__)) + #endif diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/errno.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/errno.h similarity index 88% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/errno.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/errno.h index b247522..b4bdcba 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/errno.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/errno.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/kernel.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/kernel.h similarity index 91% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/kernel.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/kernel.h index 1f702ab..a4d791c 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/kernel.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/kernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/limits.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/limits.h similarity index 88% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/limits.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/limits.h index db9c099..574aa7b 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/limits.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/limits.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/math64.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/math64.h similarity index 89% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/math64.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/math64.h index 8eefa2d..7f6713e 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/math64.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/math64.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/module.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/module.h similarity index 77% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/module.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/module.h index be6d20d..06ef56f 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/module.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/module.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -12,6 +12,8 @@ #define EXPORT_SYMBOL(symbol) \ void* __##symbol = symbol +#define EXPORT_SYMBOL_GPL(symbol) \ + void* __##symbol = symbol #define MODULE_LICENSE(license) #define MODULE_DESCRIPTION(description) diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/printk.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/printk.h similarity index 88% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/printk.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/printk.h index eab08e0..92a2527 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/printk.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/printk.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/stddef.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/stddef.h similarity index 88% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/stddef.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/stddef.h index 8538eb3..15c7408 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/stddef.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/stddef.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/swab.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/swab.h similarity index 89% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/swab.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/swab.h index 783046b..2b48b43 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/swab.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/swab.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/types.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/types.h similarity index 88% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/types.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/types.h index 459a457..b413db6 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/types.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/xxhash.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/xxhash.h similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/xxhash.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/xxhash.h index 0a43bb2..d41cbd9 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/include/linux/xxhash.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/include/linux/xxhash.h @@ -2,7 +2,7 @@ * xxHash - Extremely Fast Hash algorithm * Copyright (C) 2012-2016, Yann Collet. * - * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -124,11 +124,10 @@ XXH_API uint64_t xxh64(const void *input, size_t length, uint64_t seed); static inline unsigned long xxhash(const void *input, size_t length, uint64_t seed) { -#if BITS_PER_LONG == 64 - return xxh64(input, length, seed); -#else - return xxh32(input, length, seed); -#endif + if (sizeof(size_t) == 8) + return xxh64(input, length, seed); + else + return xxh32(input, length, seed); } /*-**************************** @@ -261,7 +260,7 @@ XXH_API void xxh64_copy_state(struct xxh64_state *dst, const struct xxh64_state * xxHash - Extremely Fast Hash algorithm * Copyright (C) 2012-2016, Yann Collet. * - * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + * BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/macro-test.sh b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/macro-test.sh similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/macro-test.sh rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/macro-test.sh index c688ac0..9ea84aa 100755 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/macro-test.sh +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/macro-test.sh @@ -36,9 +36,9 @@ test_not_present "ZSTD_NO_INTRINSICS" test_not_present "ZSTD_NO_UNUSED_FUNCTIONS" test_not_present "ZSTD_LEGACY_SUPPORT" test_not_present "STATIC_BMI2" -test_not_present "ZSTD_NO_INLINE" test_not_present "ZSTD_DLL_EXPORT" test_not_present "ZSTD_DLL_IMPORT" test_not_present "__ICCARM__" test_not_present "_MSC_VER" test_not_present "_WIN32" +test_not_present "__linux__" diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/static_test.c b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/static_test.c similarity index 83% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/static_test.c rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/static_test.c index 50c594c..ba4a420 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/static_test.c +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/static_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -28,17 +28,19 @@ static const char kEmptyZstdFrame[] = { 0x28, 0xb5, 0x2f, 0xfd, 0x24, 0x00, 0x01, 0x00, 0x00, 0x99, 0xe9, 0xd8, 0x51 }; -static void test_decompress_unzstd() { +static void test_decompress_unzstd(void) { fprintf(stderr, "Testing decompress unzstd... "); { size_t const wkspSize = zstd_dctx_workspace_bound(); void* wksp = malloc(wkspSize); - CONTROL(wksp != NULL); ZSTD_DCtx* dctx = zstd_init_dctx(wksp, wkspSize); + CONTROL(wksp != NULL); CONTROL(dctx != NULL); - size_t const dSize = zstd_decompress_dctx(dctx, NULL, 0, kEmptyZstdFrame, sizeof(kEmptyZstdFrame)); - CONTROL(!zstd_is_error(dSize)); - CONTROL(dSize == 0); + { + size_t const dSize = zstd_decompress_dctx(dctx, NULL, 0, kEmptyZstdFrame, sizeof(kEmptyZstdFrame)); + CONTROL(!zstd_is_error(dSize)); + CONTROL(dSize == 0); + } free(wksp); } fprintf(stderr, "Ok\n"); diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/test.c b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/test.c similarity index 84% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/test.c rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/test.c index 9064be7..0f4ba3f 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/test/test.c +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/test/test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -30,15 +30,15 @@ typedef struct { size_t compSize; } test_data_t; -test_data_t create_test_data(void) { +static test_data_t create_test_data(void) { test_data_t data; data.dataSize = 128 * 1024; - data.data = malloc(data.dataSize); + data.data = (char*)malloc(data.dataSize); CONTROL(data.data != NULL); - data.data2 = malloc(data.dataSize); + data.data2 = (char*)malloc(data.dataSize); CONTROL(data.data2 != NULL); data.compSize = zstd_compress_bound(data.dataSize); - data.comp = malloc(data.compSize); + data.comp = (char*)malloc(data.compSize); CONTROL(data.comp != NULL); memset(data.data, 0, data.dataSize); return data; @@ -54,26 +54,27 @@ static void free_test_data(test_data_t const *data) { #define MAX(a, b) ((a) > (b) ? (a) : (b)) static void test_btrfs(test_data_t const *data) { - fprintf(stderr, "testing btrfs use cases... "); size_t const size = MIN(data->dataSize, 128 * 1024); + fprintf(stderr, "testing btrfs use cases... "); for (int level = -1; level < 16; ++level) { zstd_parameters params = zstd_get_params(level, size); - CONTROL(params.cParams.windowLog <= 17); size_t const workspaceSize = MAX(zstd_cstream_workspace_bound(¶ms.cParams), zstd_dstream_workspace_bound(size)); void *workspace = malloc(workspaceSize); - CONTROL(workspace != NULL); char const *ip = data->data; char const *iend = ip + size; char *op = data->comp; char *oend = op + data->compSize; + + CONTROL(params.cParams.windowLog <= 17); + CONTROL(workspace != NULL); { zstd_cstream *cctx = zstd_init_cstream(¶ms, size, workspace, workspaceSize); - CONTROL(cctx != NULL); zstd_out_buffer out = {NULL, 0, 0}; zstd_in_buffer in = {NULL, 0, 0}; + CONTROL(cctx != NULL); for (;;) { if (in.pos == in.size) { in.src = ip; @@ -108,9 +109,9 @@ static void test_btrfs(test_data_t const *data) { oend = op + size; { zstd_dstream *dctx = zstd_init_dstream(1ULL << params.cParams.windowLog, workspace, workspaceSize); - CONTROL(dctx != NULL); zstd_out_buffer out = {NULL, 0, 0}; zstd_in_buffer in = {NULL, 0, 0}; + CONTROL(dctx != NULL); for (;;) { if (in.pos == in.size) { in.src = ip; @@ -125,15 +126,16 @@ static void test_btrfs(test_data_t const *data) { out.pos = 0; op += out.size; } - - size_t const ret = zstd_decompress_stream(dctx, &out, &in); - CONTROL(!zstd_is_error(ret)); - if (ret == 0) { - break; + { + size_t const ret = zstd_decompress_stream(dctx, &out, &in); + CONTROL(!zstd_is_error(ret)); + if (ret == 0) { + break; + } } } } - CONTROL(op - data->data2 == data->dataSize); + CONTROL((size_t)(op - data->data2) == data->dataSize); CONTROL(!memcmp(data->data, data->data2, data->dataSize)); free(workspace); } @@ -141,14 +143,14 @@ static void test_btrfs(test_data_t const *data) { } static void test_decompress_unzstd(test_data_t const *data) { - fprintf(stderr, "Testing decompress unzstd... "); size_t cSize; + fprintf(stderr, "Testing decompress unzstd... "); { zstd_parameters params = zstd_get_params(19, 0); size_t const wkspSize = zstd_cctx_workspace_bound(¶ms.cParams); void* wksp = malloc(wkspSize); - CONTROL(wksp != NULL); zstd_cctx* cctx = zstd_init_cctx(wksp, wkspSize); + CONTROL(wksp != NULL); CONTROL(cctx != NULL); cSize = zstd_compress_cctx(cctx, data->comp, data->compSize, data->data, data->dataSize, ¶ms); CONTROL(!zstd_is_error(cSize)); @@ -157,19 +159,21 @@ static void test_decompress_unzstd(test_data_t const *data) { { size_t const wkspSize = zstd_dctx_workspace_bound(); void* wksp = malloc(wkspSize); - CONTROL(wksp != NULL); zstd_dctx* dctx = zstd_init_dctx(wksp, wkspSize); + CONTROL(wksp != NULL); CONTROL(dctx != NULL); - size_t const dSize = zstd_decompress_dctx(dctx, data->data2, data->dataSize, data->comp, cSize); - CONTROL(!zstd_is_error(dSize)); - CONTROL(dSize == data->dataSize); + { + size_t const dSize = zstd_decompress_dctx(dctx, data->data2, data->dataSize, data->comp, cSize); + CONTROL(!zstd_is_error(dSize)); + CONTROL(dSize == data->dataSize); + } CONTROL(!memcmp(data->data, data->data2, data->dataSize)); free(wksp); } fprintf(stderr, "Ok\n"); } -static void test_f2fs() { +static void test_f2fs(void) { fprintf(stderr, "testing f2fs uses... "); CONTROL(zstd_min_clevel() < 0); CONTROL(zstd_max_clevel() == 22); @@ -182,26 +186,32 @@ static void __attribute__((noinline)) use(void *x) { asm volatile("" : "+r"(x)); } -static void __attribute__((noinline)) set_stack() { +static void __attribute__((noinline)) fill_stack(void) { + memset(g_stack, 0x33, 8192); +} + +static void __attribute__((noinline)) set_stack(void) { char stack[8192]; g_stack = stack; - memset(g_stack, 0x33, 8192); use(g_stack); } -static void __attribute__((noinline)) check_stack() { +static void __attribute__((noinline)) check_stack(void) { size_t cleanStack = 0; while (cleanStack < 8192 && g_stack[cleanStack] == 0x33) { ++cleanStack; } - size_t const stackSize = 8192 - cleanStack; - fprintf(stderr, "Maximum stack size: %zu\n", stackSize); - CONTROL(stackSize <= 2048 + 512); + { + size_t const stackSize = 8192 - cleanStack; + fprintf(stderr, "Maximum stack size: %zu\n", stackSize); + CONTROL(stackSize <= 2048 + 512); + } } static void test_stack_usage(test_data_t const *data) { set_stack(); + fill_stack(); test_f2fs(); test_btrfs(data); test_decompress_unzstd(data); diff --git a/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_common_module.c b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_common_module.c new file mode 100644 index 0000000..2fead39 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_common_module.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#include + +#include "common/huf.h" +#include "common/fse.h" +#include "common/zstd_internal.h" + +// Export symbols shared by compress and decompress into a common module + +#undef ZSTD_isError /* defined within zstd_internal.h */ +EXPORT_SYMBOL_GPL(FSE_readNCount); +EXPORT_SYMBOL_GPL(HUF_readStats); +EXPORT_SYMBOL_GPL(HUF_readStats_wksp); +EXPORT_SYMBOL_GPL(ZSTD_isError); +EXPORT_SYMBOL_GPL(ZSTD_getErrorName); +EXPORT_SYMBOL_GPL(ZSTD_getErrorCode); +EXPORT_SYMBOL_GPL(ZSTD_customMalloc); +EXPORT_SYMBOL_GPL(ZSTD_customCalloc); +EXPORT_SYMBOL_GPL(ZSTD_customFree); + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_DESCRIPTION("Zstd Common"); diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_compress_module.c b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_compress_module.c similarity index 58% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_compress_module.c rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_compress_module.c index 37d08ff..8ecf432 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_compress_module.c +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_compress_module.c @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -17,6 +17,43 @@ #include "common/zstd_deps.h" #include "common/zstd_internal.h" +#define ZSTD_FORWARD_IF_ERR(ret) \ + do { \ + size_t const __ret = (ret); \ + if (ZSTD_isError(__ret)) \ + return __ret; \ + } while (0) + +static size_t zstd_cctx_init(zstd_cctx *cctx, const zstd_parameters *parameters, + unsigned long long pledged_src_size) +{ + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_reset( + cctx, ZSTD_reset_session_and_parameters)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setPledgedSrcSize( + cctx, pledged_src_size)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_windowLog, parameters->cParams.windowLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_hashLog, parameters->cParams.hashLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_chainLog, parameters->cParams.chainLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_searchLog, parameters->cParams.searchLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_minMatch, parameters->cParams.minMatch)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_targetLength, parameters->cParams.targetLength)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_strategy, parameters->cParams.strategy)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_contentSizeFlag, parameters->fParams.contentSizeFlag)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_checksumFlag, parameters->fParams.checksumFlag)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_dictIDFlag, !parameters->fParams.noDictIDFlag)); + return 0; +} + int zstd_min_clevel(void) { return ZSTD_minCLevel(); @@ -59,7 +96,8 @@ EXPORT_SYMBOL(zstd_init_cctx); size_t zstd_compress_cctx(zstd_cctx *cctx, void *dst, size_t dst_capacity, const void *src, size_t src_size, const zstd_parameters *parameters) { - return ZSTD_compress_advanced(cctx, dst, dst_capacity, src, src_size, NULL, 0, *parameters); + ZSTD_FORWARD_IF_ERR(zstd_cctx_init(cctx, parameters, src_size)); + return ZSTD_compress2(cctx, dst, dst_capacity, src, src_size); } EXPORT_SYMBOL(zstd_compress_cctx); @@ -73,7 +111,6 @@ zstd_cstream *zstd_init_cstream(const zstd_parameters *parameters, unsigned long long pledged_src_size, void *workspace, size_t workspace_size) { zstd_cstream *cstream; - size_t ret; if (workspace == NULL) return NULL; @@ -86,8 +123,7 @@ zstd_cstream *zstd_init_cstream(const zstd_parameters *parameters, if (pledged_src_size == 0) pledged_src_size = ZSTD_CONTENTSIZE_UNKNOWN; - ret = ZSTD_initCStream_advanced(cstream, NULL, 0, *parameters, pledged_src_size); - if (ZSTD_isError(ret)) + if (ZSTD_isError(zstd_cctx_init(cstream, parameters, pledged_src_size))) return NULL; return cstream; @@ -97,7 +133,11 @@ EXPORT_SYMBOL(zstd_init_cstream); size_t zstd_reset_cstream(zstd_cstream *cstream, unsigned long long pledged_src_size) { - return ZSTD_resetCStream(cstream, pledged_src_size); + if (pledged_src_size == 0) + pledged_src_size = ZSTD_CONTENTSIZE_UNKNOWN; + ZSTD_FORWARD_IF_ERR( ZSTD_CCtx_reset(cstream, ZSTD_reset_session_only) ); + ZSTD_FORWARD_IF_ERR( ZSTD_CCtx_setPledgedSrcSize(cstream, pledged_src_size) ); + return 0; } EXPORT_SYMBOL(zstd_reset_cstream); diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_decompress_module.c b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_decompress_module.c similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_decompress_module.c rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_decompress_module.c index 15005cd..eb1c49e 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_decompress_module.c +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_decompress_module.c @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_deps.h b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_deps.h similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_deps.h rename to src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_deps.h index 853b724..9251614 100644 --- a/src/dependencies/zstd-1.5.0/contrib/linux-kernel/zstd_deps.h +++ b/src/dependencies/zstd-1.5.4/contrib/linux-kernel/zstd_deps.h @@ -1,6 +1,6 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/match_finders/README.md b/src/dependencies/zstd-1.5.4/contrib/match_finders/README.md similarity index 86% rename from src/dependencies/zstd-1.5.0/contrib/match_finders/README.md rename to src/dependencies/zstd-1.5.4/contrib/match_finders/README.md index 0f4a3b1..54055c3 100644 --- a/src/dependencies/zstd-1.5.0/contrib/match_finders/README.md +++ b/src/dependencies/zstd-1.5.4/contrib/match_finders/README.md @@ -14,7 +14,7 @@ * files would be small relative to the size of the file. * * Various 'diffing' algorithms utilize this notion of edit distance and - * the corrensponding concept of a minimal edit script between two + * the corresponding concept of a minimal edit script between two * sequences to identify the regions within two files where they differ. * The core algorithm used in this match finder is described in: * @@ -28,12 +28,12 @@ * * Note: after some experimentation, this approach proved to not provide enough * utility to justify the additional CPU used in finding matches. The one area - * where this approach consistenly outperforms Zstandard even on level 19 is - * when compressing small files (<10 KB) using a equally small dictionary that + * where this approach consistently outperforms Zstandard even on level 19 is + * when compressing small files (<10 KB) using an equally small dictionary that * is very similar to the source file. For the use case that this was intended, * (large similar files) this approach by itself took 5-10X longer than zstd-19 and * generally resulted in 2-3X larger files. The core advantage that zstd-19 has - * over this appraoch for match finding is the overlapping matches. This approach + * over this approach for match finding is the overlapping matches. This approach * cannot find any. * * I'm leaving this in the contrib section in case this ever becomes interesting diff --git a/src/dependencies/zstd-1.5.0/contrib/match_finders/zstd_edist.c b/src/dependencies/zstd-1.5.4/contrib/match_finders/zstd_edist.c similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/match_finders/zstd_edist.c rename to src/dependencies/zstd-1.5.4/contrib/match_finders/zstd_edist.c index aab545f..d685cdd 100644 --- a/src/dependencies/zstd-1.5.0/contrib/match_finders/zstd_edist.c +++ b/src/dependencies/zstd-1.5.4/contrib/match_finders/zstd_edist.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -12,7 +12,7 @@ * Dependencies ***************************************/ -/* Currently relies on qsort when combining contiguous matches. This can probabily +/* Currently relies on qsort when combining contiguous matches. This can probably * be avoided but would require changes to the algorithm. The qsort is far from * the bottleneck in this algorithm even for medium sized files so it's probably * not worth trying to address */ @@ -26,7 +26,7 @@ * Constants ***************************************/ -/* Just a sential for the entires of the diagnomal matrix */ +/* Just a sential for the entries of the diagonal matrix */ #define ZSTD_EDIST_DIAG_MAX (S32)(1 << 30) /* How large should a snake be to be considered a 'big' snake. @@ -39,7 +39,7 @@ #define ZSTD_EDIST_SNAKE_ITER_THRESH 200 /* After how many iterations should be just give up and take - * the best availabe edit script for this round */ + * the best available edit script for this round */ #define ZSTD_EDIST_EXPENSIVE_THRESH 1024 /*-************************************* @@ -57,10 +57,10 @@ typedef struct { const BYTE* src; size_t dictSize; size_t srcSize; - S32* forwardDiag; /* Entires of the forward diagonal stored here */ - S32* backwardDiag; /* Entires of the backward diagonal stored here. + S32* forwardDiag; /* Entries of the forward diagonal stored here */ + S32* backwardDiag; /* Entries of the backward diagonal stored here. * Note: this buffer and the 'forwardDiag' buffer - * are contiguous. See the ZSTD_eDist_genSequences */ + * are contiguous. See the ZSTD_eDist_genSequences */ ZSTD_eDist_match* matches; /* Accumulate matches of length 1 in this buffer. * In a subsequence post-processing step, we combine * contiguous matches. */ @@ -192,7 +192,7 @@ static void ZSTD_eDist_diag(ZSTD_eDist_state* state, if (!useHeuristics) continue; - /* Everything under this point is a heuritic. Using these will + /* Everything under this point is a heuristic. Using these will * substantially speed up the match finding. In some cases, taking * the total match finding time from several minutes to seconds. * Of course, the caveat is that the edit script found may no longer @@ -366,8 +366,8 @@ static int ZSTD_eDist_compare(ZSTD_eDist_state* state, } } else if (srcLow == srcHigh) { while (dictLow < dictHigh) { - /* Reaching this point means deleteing dict[dictLow] from - * the current positino of dict */ + /* Reaching this point means deleting dict[dictLow] from + * the current position of dict */ dictLow++; } } else { @@ -395,7 +395,7 @@ static int ZSTD_eDist_matchComp(const void* p, const void* q) } /* The matches from the approach above will all be of the form - * (dictIdx, srcIdx, 1). this method combines contiguous matches + * (dictIdx, srcIdx, 1). This method combines contiguous matches * of length MINMATCH or greater. Matches less than MINMATCH * are discarded */ static void ZSTD_eDist_combineMatches(ZSTD_eDist_state* state) @@ -460,7 +460,7 @@ static size_t ZSTD_eDist_convertMatchesToSequences(ZSTD_Sequence* sequences, } /*-************************************* -* Interal utils +* Internal utils ***************************************/ static size_t ZSTD_eDist_hamingDist(const BYTE* const a, diff --git a/src/dependencies/zstd-1.5.0/contrib/match_finders/zstd_edist.h b/src/dependencies/zstd-1.5.4/contrib/match_finders/zstd_edist.h similarity index 89% rename from src/dependencies/zstd-1.5.0/contrib/match_finders/zstd_edist.h rename to src/dependencies/zstd-1.5.4/contrib/match_finders/zstd_edist.h index c775a49..c739e2a 100644 --- a/src/dependencies/zstd-1.5.0/contrib/match_finders/zstd_edist.h +++ b/src/dependencies/zstd-1.5.4/contrib/match_finders/zstd_edist.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -21,7 +21,7 @@ * files would be small relative to the size of the file. * * Various 'diffing' algorithms utilize this notion of edit distance and - * the corrensponding concept of a minimal edit script between two + * the corresponding concept of a minimal edit script between two * sequences to identify the regions within two files where they differ. * The core algorithm used in this match finder is described in: * @@ -35,12 +35,12 @@ * * Note: after some experimentation, this approach proved to not provide enough * utility to justify the additional CPU used in finding matches. The one area - * where this approach consistenly outperforms Zstandard even on level 19 is - * when compressing small files (<10 KB) using a equally small dictionary that + * where this approach consistently outperforms Zstandard even on level 19 is + * when compressing small files (<10 KB) using an equally small dictionary that * is very similar to the source file. For the use case that this was intended, * (large similar files) this approach by itself took 5-10X longer than zstd-19 and * generally resulted in 2-3X larger files. The core advantage that zstd-19 has - * over this appraoch for match finding is the overlapping matches. This approach + * over this approach for match finding is the overlapping matches. This approach * cannot find any. * * I'm leaving this in the contrib section in case this ever becomes interesting diff --git a/src/dependencies/zstd-1.5.0/contrib/premake/premake4.lua b/src/dependencies/zstd-1.5.4/contrib/premake/premake4.lua similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/premake/premake4.lua rename to src/dependencies/zstd-1.5.4/contrib/premake/premake4.lua diff --git a/src/dependencies/zstd-1.5.0/contrib/premake/zstd.lua b/src/dependencies/zstd-1.5.4/contrib/premake/zstd.lua similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/premake/zstd.lua rename to src/dependencies/zstd-1.5.4/contrib/premake/zstd.lua diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/.gitignore b/src/dependencies/zstd-1.5.4/contrib/pzstd/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/.gitignore rename to src/dependencies/zstd-1.5.4/contrib/pzstd/.gitignore diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/BUCK b/src/dependencies/zstd-1.5.4/contrib/pzstd/BUCK similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/BUCK rename to src/dependencies/zstd-1.5.4/contrib/pzstd/BUCK diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/ErrorHolder.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/ErrorHolder.h similarity index 95% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/ErrorHolder.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/ErrorHolder.h index 829651c..2c2797e 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/ErrorHolder.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/ErrorHolder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/Logging.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/Logging.h similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/Logging.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/Logging.h index beb160b..84a08d2 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/Logging.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/Logging.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/Makefile b/src/dependencies/zstd-1.5.4/contrib/pzstd/Makefile similarity index 90% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/Makefile rename to src/dependencies/zstd-1.5.4/contrib/pzstd/Makefile index 25265e7..830053c 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2016-present, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -57,19 +57,6 @@ LD_COMMAND = $(CXX) $^ $(ALL_LDFLAGS) $(LIBS) -pthread -o $@ CC_COMMAND = $(CC) $(DEPFLAGS) $(ALL_CFLAGS) -c $< -o $@ CXX_COMMAND = $(CXX) $(DEPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@ -# Get a list of all zstd files so we rebuild the static library when we need to -ZSTDCOMMON_FILES := $(wildcard $(ZSTDDIR)/common/*.c) \ - $(wildcard $(ZSTDDIR)/common/*.h) -ZSTDCOMP_FILES := $(wildcard $(ZSTDDIR)/compress/*.c) \ - $(wildcard $(ZSTDDIR)/compress/*.h) -ZSTDDECOMP_FILES := $(wildcard $(ZSTDDIR)/decompress/*.c) \ - $(wildcard $(ZSTDDIR)/decompress/*.h) -ZSTDPROG_FILES := $(wildcard $(PROGDIR)/*.c) \ - $(wildcard $(PROGDIR)/*.h) -ZSTD_FILES := $(wildcard $(ZSTDDIR)/*.h) \ - $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) \ - $(ZSTDPROG_FILES) - # List all the pzstd source files so we can determine their dependencies PZSTD_SRCS := $(wildcard *.cpp) PZSTD_TESTS := $(wildcard test/*.cpp) @@ -189,7 +176,8 @@ roundtrip: test/RoundTripTest$(EXT) # Use the static library that zstd builds for simplicity and # so we get the compiler options correct -$(ZSTDDIR)/libzstd.a: $(ZSTD_FILES) +.PHONY: $(ZSTDDIR)/libzstd.a +$(ZSTDDIR)/libzstd.a: CFLAGS="$(ALL_CFLAGS)" LDFLAGS="$(ALL_LDFLAGS)" $(MAKE) -C $(ZSTDDIR) libzstd.a # Rules to build the tests diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/Options.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/Options.cpp similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/Options.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/Options.cpp index 3729222..a77824e 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/Options.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/Options.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -87,7 +87,7 @@ void usage() { std::fprintf(stderr, " -V, --version : display version number and exit\n"); std::fprintf(stderr, " -v, --verbose : verbose mode; specify multiple times to increase log level (default:2)\n"); std::fprintf(stderr, " -q, --quiet : suppress warnings; specify twice to suppress errors too\n"); - std::fprintf(stderr, " -c, --stdout : force write to standard output, even if it is the console\n"); + std::fprintf(stderr, " -c, --stdout : write to standard output (even if it is the console)\n"); #ifdef UTIL_HAS_CREATEFILELIST std::fprintf(stderr, " -r : operate recursively on directories\n"); #endif diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/Options.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/Options.h similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/Options.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/Options.h index 924543a..92c18a3 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/Options.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/Options.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/Pzstd.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/Pzstd.cpp similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/Pzstd.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/Pzstd.cpp index 2c09bda..67b9419 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/Pzstd.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/Pzstd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -10,11 +10,13 @@ #include "Pzstd.h" #include "SkippableFrame.h" #include "utils/FileSystem.h" +#include "utils/Portability.h" #include "utils/Range.h" #include "utils/ScopeGuard.h" #include "utils/ThreadPool.h" #include "utils/WorkQueue.h" +#include #include #include #include @@ -336,6 +338,10 @@ static size_t calculateStep( const ZSTD_parameters ¶ms) { (void)size; (void)numThreads; + // Not validated to work correctly for window logs > 23. + // It will definitely fail if windowLog + 2 is >= 4GB because + // the skippable frame can only store sizes up to 4GB. + assert(params.cParams.windowLog <= 23); return size_t{1} << (params.cParams.windowLog + 2); } @@ -587,7 +593,8 @@ std::uint64_t writeFile( // start writing before compression is done because we need to know the // compressed size. // Wait for the compressed size to be available and write skippable frame - SkippableFrame frame(out->size()); + assert(uint64_t(out->size()) < uint64_t(1) << 32); + SkippableFrame frame(uint32_t(out->size())); if (!writeData(frame.data(), outputFd)) { errorHolder.setError("Failed to write output"); return bytesWritten; diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/Pzstd.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/Pzstd.h similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/Pzstd.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/Pzstd.h index c667c88..3645e59 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/Pzstd.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/Pzstd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/README.md b/src/dependencies/zstd-1.5.4/contrib/pzstd/README.md similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/README.md rename to src/dependencies/zstd-1.5.4/contrib/pzstd/README.md index 84d9458..bc8f831 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/README.md +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/README.md @@ -31,7 +31,7 @@ If this number is not suitable, during compilation you can define `PZSTD_NUM_THR ## Benchmarks -As a reference, PZstandard and Pigz were compared on an Intel Core i7 @ 3.1 GHz, each using 4 threads, with the [Silesia compression corpus](http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia). +As a reference, PZstandard and Pigz were compared on an Intel Core i7 @ 3.1 GHz, each using 4 threads, with the [Silesia compression corpus](https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia). Compression Speed vs Ratio with 4 Threads | Decompression Speed with 4 Threads ------------------------------------------|----------------------------------- diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/SkippableFrame.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/SkippableFrame.cpp similarity index 94% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/SkippableFrame.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/SkippableFrame.cpp index 769866d..3bea4eb 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/SkippableFrame.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/SkippableFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/SkippableFrame.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/SkippableFrame.h similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/SkippableFrame.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/SkippableFrame.h index 60deed0..817415e 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/SkippableFrame.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/SkippableFrame.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/images/Cspeed.png b/src/dependencies/zstd-1.5.4/contrib/pzstd/images/Cspeed.png similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/images/Cspeed.png rename to src/dependencies/zstd-1.5.4/contrib/pzstd/images/Cspeed.png diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/images/Dspeed.png b/src/dependencies/zstd-1.5.4/contrib/pzstd/images/Dspeed.png similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/images/Dspeed.png rename to src/dependencies/zstd-1.5.4/contrib/pzstd/images/Dspeed.png diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/main.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/main.cpp similarity index 91% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/main.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/main.cpp index b93f043..422b4a5 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/main.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/BUCK b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/BUCK similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/test/BUCK rename to src/dependencies/zstd-1.5.4/contrib/pzstd/test/BUCK diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/OptionsTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/OptionsTest.cpp similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/test/OptionsTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/test/OptionsTest.cpp index e601148..91e3975 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/OptionsTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/OptionsTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/PzstdTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/PzstdTest.cpp similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/test/PzstdTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/test/PzstdTest.cpp index 5c7d663..75453f5 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/PzstdTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/PzstdTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/RoundTrip.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/RoundTrip.h similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/test/RoundTrip.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/test/RoundTrip.h index c6364ec..f777622 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/RoundTrip.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/RoundTrip.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/RoundTripTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/RoundTripTest.cpp similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/test/RoundTripTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/test/RoundTripTest.cpp index 36af067..c37646d 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/test/RoundTripTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/test/RoundTripTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/BUCK b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/BUCK similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/BUCK rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/BUCK diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Buffer.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Buffer.h similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Buffer.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Buffer.h index f69c3b4..a85f770 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Buffer.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -45,7 +45,7 @@ class Buffer { : buffer_(buffer), range_(data) {} Buffer(Buffer&&) = default; - Buffer& operator=(Buffer&&) & = default; + Buffer& operator=(Buffer&&) = default; /** * Splits the data into two pieces: [begin, begin + n), [begin + n, end). diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/FileSystem.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/FileSystem.h similarity index 76% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/FileSystem.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/FileSystem.h index 3cfbe86..8d57d05 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/FileSystem.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/FileSystem.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -8,16 +8,18 @@ */ #pragma once +#include "utils/Portability.h" #include "utils/Range.h" #include #include #include +#include #include // A small subset of `std::filesystem`. // `std::filesystem` should be a drop in replacement. -// See http://en.cppreference.com/w/cpp/filesystem for documentation. +// See https://en.cppreference.com/w/cpp/filesystem for documentation. namespace pzstd { @@ -28,7 +30,7 @@ typedef struct ::_stat64 file_status; typedef struct ::stat file_status; #endif -/// http://en.cppreference.com/w/cpp/filesystem/status +/// https://en.cppreference.com/w/cpp/filesystem/status inline file_status status(StringPiece path, std::error_code& ec) noexcept { file_status status; #if defined(_MSC_VER) @@ -44,7 +46,7 @@ inline file_status status(StringPiece path, std::error_code& ec) noexcept { return status; } -/// http://en.cppreference.com/w/cpp/filesystem/is_regular_file +/// https://en.cppreference.com/w/cpp/filesystem/is_regular_file inline bool is_regular_file(file_status status) noexcept { #if defined(S_ISREG) return S_ISREG(status.st_mode); @@ -55,12 +57,12 @@ inline bool is_regular_file(file_status status) noexcept { #endif } -/// http://en.cppreference.com/w/cpp/filesystem/is_regular_file +/// https://en.cppreference.com/w/cpp/filesystem/is_regular_file inline bool is_regular_file(StringPiece path, std::error_code& ec) noexcept { return is_regular_file(status(path, ec)); } -/// http://en.cppreference.com/w/cpp/filesystem/is_directory +/// https://en.cppreference.com/w/cpp/filesystem/is_directory inline bool is_directory(file_status status) noexcept { #if defined(S_ISDIR) return S_ISDIR(status.st_mode); @@ -71,22 +73,22 @@ inline bool is_directory(file_status status) noexcept { #endif } -/// http://en.cppreference.com/w/cpp/filesystem/is_directory +/// https://en.cppreference.com/w/cpp/filesystem/is_directory inline bool is_directory(StringPiece path, std::error_code& ec) noexcept { return is_directory(status(path, ec)); } -/// http://en.cppreference.com/w/cpp/filesystem/file_size +/// https://en.cppreference.com/w/cpp/filesystem/file_size inline std::uintmax_t file_size( StringPiece path, std::error_code& ec) noexcept { auto stat = status(path, ec); if (ec) { - return -1; + return std::numeric_limits::max(); } if (!is_regular_file(stat)) { ec.assign(ENOTSUP, std::generic_category()); - return -1; + return std::numeric_limits::max(); } ec.clear(); return stat.st_size; diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Likely.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Likely.h similarity index 92% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Likely.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Likely.h index 7cea8da..52243a6 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Likely.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Likely.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Portability.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Portability.h new file mode 100644 index 0000000..ef1f86e --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Portability.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + */ + +#pragma once + +#include + +// Required for windows, which defines min/max, but we want the std:: version. +#undef min +#undef max diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Range.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Range.h similarity index 94% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Range.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Range.h index fedb5d7..0fd8f9f 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/Range.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/Range.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). */ - + /** * A subset of `folly/Range.h`. * All code copied verbatim modulo formatting @@ -14,7 +14,9 @@ #pragma once #include "utils/Likely.h" +#include "utils/Portability.h" +#include #include #include #include @@ -83,8 +85,8 @@ class Range { Range(const Range&) = default; Range(Range&&) = default; - Range& operator=(const Range&) & = default; - Range& operator=(Range&&) & = default; + Range& operator=(const Range&) = default; + Range& operator=(Range&&) = default; constexpr size_type size() const { return e_ - b_; diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ResourcePool.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ResourcePool.h similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ResourcePool.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ResourcePool.h index 8dfcdd7..7c4bb62 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ResourcePool.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ResourcePool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ScopeGuard.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ScopeGuard.h similarity index 88% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ScopeGuard.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ScopeGuard.h index 31768f4..911fd98 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ScopeGuard.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ScopeGuard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -15,7 +15,7 @@ namespace pzstd { /** * Dismissable scope guard. * `Function` must be callable and take no parameters. - * Unless `dissmiss()` is called, the callable is executed upon destruction of + * Unless `dismiss()` is called, the callable is executed upon destruction of * `ScopeGuard`. * * Example: diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ThreadPool.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ThreadPool.h similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ThreadPool.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ThreadPool.h index 8ece8e0..a087d7c 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/ThreadPool.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/ThreadPool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/WorkQueue.h b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/WorkQueue.h similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/WorkQueue.h rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/WorkQueue.h index 1d14d92..d7947b8 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/WorkQueue.h +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/WorkQueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/BUCK b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/BUCK similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/BUCK rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/BUCK diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/BufferTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/BufferTest.cpp similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/BufferTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/BufferTest.cpp index fbba74e..58bf08d 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/BufferTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/BufferTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/RangeTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/RangeTest.cpp similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/RangeTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/RangeTest.cpp index 755b50f..8b7dee2 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/RangeTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/RangeTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ResourcePoolTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ResourcePoolTest.cpp similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ResourcePoolTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ResourcePoolTest.cpp index 6fe1451..750ee08 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ResourcePoolTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ResourcePoolTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ScopeGuardTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ScopeGuardTest.cpp similarity index 91% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ScopeGuardTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ScopeGuardTest.cpp index 7bc624d..0f77cdf 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ScopeGuardTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ScopeGuardTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ThreadPoolTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ThreadPoolTest.cpp similarity index 96% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ThreadPoolTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ThreadPoolTest.cpp index 703fd4c..a01052e 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/ThreadPoolTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/ThreadPoolTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/WorkQueueTest.cpp b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/WorkQueueTest.cpp similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/WorkQueueTest.cpp rename to src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/WorkQueueTest.cpp index 14cf773..16600bb 100644 --- a/src/dependencies/zstd-1.5.0/contrib/pzstd/utils/test/WorkQueueTest.cpp +++ b/src/dependencies/zstd-1.5.4/contrib/pzstd/utils/test/WorkQueueTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/recovery/Makefile b/src/dependencies/zstd-1.5.4/contrib/recovery/Makefile similarity index 95% rename from src/dependencies/zstd-1.5.0/contrib/recovery/Makefile rename to src/dependencies/zstd-1.5.4/contrib/recovery/Makefile index 9a9f4f2..be6ea4b 100644 --- a/src/dependencies/zstd-1.5.0/contrib/recovery/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/recovery/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2019-present, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/recovery/recover_directory.c b/src/dependencies/zstd-1.5.4/contrib/recovery/recover_directory.c similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/recovery/recover_directory.c rename to src/dependencies/zstd-1.5.4/contrib/recovery/recover_directory.c index 13f83fd..b9bd7ab 100644 --- a/src/dependencies/zstd-1.5.0/contrib/recovery/recover_directory.c +++ b/src/dependencies/zstd-1.5.4/contrib/recovery/recover_directory.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/.gitignore b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/.gitignore rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/.gitignore diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/Makefile b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/Makefile similarity index 97% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/Makefile rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/Makefile index 9df6b75..fcc0458 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2017-present, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/parallel_compression.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/parallel_compression.c similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/parallel_compression.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/parallel_compression.c index 4118b0a..0ec9fbd 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/parallel_compression.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/parallel_compression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/parallel_processing.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/parallel_processing.c similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/parallel_processing.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/parallel_processing.c index 36226b4..b1709db 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/parallel_processing.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/parallel_processing.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_compression.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_compression.c similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_compression.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_compression.c index 9a331a8..182b46f 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_compression.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_compression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_decompression.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_decompression.c similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_decompression.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_decompression.c index e9e2013..2c4f3ba 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_decompression.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_decompression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_decompression_mem.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_decompression_mem.c similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_decompression_mem.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_decompression_mem.c index e7b1c65..44a06fb 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/examples/seekable_decompression_mem.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/examples/seekable_decompression_mem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/.gitignore b/src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/.gitignore rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/.gitignore diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/Makefile b/src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/Makefile similarity index 95% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/Makefile rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/Makefile index d51deb3..a81f222 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/Makefile +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) 2017-present, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/seekable_tests.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/seekable_tests.c similarity index 82% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/seekable_tests.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/seekable_tests.c index a482638..1bb2d0e 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/tests/seekable_tests.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/tests/seekable_tests.c @@ -186,6 +186,40 @@ int main(int argc, const char** argv) } printf("Success!\n"); + + printf("Test %u - check ZSTD magic in compressing empty string: ", testNb++); + { // compressing empty string should return a zstd header + size_t const capacity = 255; + char* inBuffer = malloc(capacity); + assert(inBuffer != NULL); + inBuffer[0] = '\0'; + void* const outBuffer = malloc(capacity); + assert(outBuffer != NULL); + + ZSTD_seekable_CStream *s = ZSTD_seekable_createCStream(); + ZSTD_seekable_initCStream(s, 1, 1, 255); + + ZSTD_inBuffer input = { .src=inBuffer, .pos=0, .size=0 }; + ZSTD_outBuffer output = { .dst=outBuffer, .pos=0, .size=capacity }; + + ZSTD_seekable_compressStream(s, &output, &input); + ZSTD_seekable_endStream(s, &output); + + if((((char*)output.dst)[0] != '\x28') | (((char*)output.dst)[1] != '\xb5') | (((char*)output.dst)[2] != '\x2f') | (((char*)output.dst)[3] != '\xfd')) { + printf("%#02x %#02x %#02x %#02x\n", ((char*)output.dst)[0], ((char*)output.dst)[1] , ((char*)output.dst)[2] , ((char*)output.dst)[3] ); + + free(inBuffer); + free(outBuffer); + ZSTD_seekable_freeCStream(s); + goto _test_error; + } + + free(inBuffer); + free(outBuffer); + ZSTD_seekable_freeCStream(s); + } + printf("Success!\n"); + /* TODO: Add more tests */ printf("Finished tests\n"); return 0; diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/zstd_seekable.h b/src/dependencies/zstd-1.5.4/contrib/seekable_format/zstd_seekable.h similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/zstd_seekable.h rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/zstd_seekable.h diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/zstd_seekable_compression_format.md b/src/dependencies/zstd-1.5.4/contrib/seekable_format/zstd_seekable_compression_format.md similarity index 98% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/zstd_seekable_compression_format.md rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/zstd_seekable_compression_format.md index 55aebfd..7bd0790 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/zstd_seekable_compression_format.md +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/zstd_seekable_compression_format.md @@ -2,7 +2,7 @@ ### Notices -Copyright (c) 2017-present Facebook, Inc. +Copyright (c) Meta Platforms, Inc. and affiliates. Permission is granted to copy and distribute this document for any purpose and without charge, diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/zstdseek_compress.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/zstdseek_compress.c similarity index 99% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/zstdseek_compress.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/zstdseek_compress.c index 242bd2a..113f6f9 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/zstdseek_compress.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/zstdseek_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -350,7 +350,7 @@ size_t ZSTD_seekable_writeSeekTable(ZSTD_frameLog* fl, ZSTD_outBuffer* output) size_t ZSTD_seekable_endStream(ZSTD_seekable_CStream* zcs, ZSTD_outBuffer* output) { - if (!zcs->writingSeekTable && zcs->frameDSize) { + if (!zcs->writingSeekTable) { const size_t endFrame = ZSTD_seekable_endFrame(zcs, output); if (ZSTD_isError(endFrame)) return endFrame; /* return an accurate size hint */ diff --git a/src/dependencies/zstd-1.5.0/contrib/seekable_format/zstdseek_decompress.c b/src/dependencies/zstd-1.5.4/contrib/seekable_format/zstdseek_decompress.c similarity index 87% rename from src/dependencies/zstd-1.5.0/contrib/seekable_format/zstdseek_decompress.c rename to src/dependencies/zstd-1.5.4/contrib/seekable_format/zstdseek_decompress.c index 5eed024..fbb2d4f 100644 --- a/src/dependencies/zstd-1.5.0/contrib/seekable_format/zstdseek_decompress.c +++ b/src/dependencies/zstd-1.5.4/contrib/seekable_format/zstdseek_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-present, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -23,13 +23,64 @@ # endif #endif +/* ************************************************************ +* Detect POSIX version +* PLATFORM_POSIX_VERSION = 0 for non-Unix e.g. Windows +* PLATFORM_POSIX_VERSION = 1 for Unix-like but non-POSIX +* PLATFORM_POSIX_VERSION > 1 is equal to found _POSIX_VERSION +* Value of PLATFORM_POSIX_VERSION can be forced on command line +***************************************************************/ +#ifndef PLATFORM_POSIX_VERSION + +# if (defined(__APPLE__) && defined(__MACH__)) || defined(__SVR4) || defined(_AIX) || defined(__hpux) /* POSIX.1-2001 (SUSv3) conformant */ \ + || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) /* BSD distros */ + /* exception rule : force posix version to 200112L, + * note: it's better to use unistd.h's _POSIX_VERSION whenever possible */ +# define PLATFORM_POSIX_VERSION 200112L + +/* try to determine posix version through official unistd.h's _POSIX_VERSION (https://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html). + * note : there is no simple way to know in advance if is present or not on target system, + * Posix specification mandates its presence and its content, but target system must respect this spec. + * It's necessary to _not_ #include whenever target OS is not unix-like + * otherwise it will block preprocessing stage. + * The following list of build macros tries to "guess" if target OS is likely unix-like, and therefore can #include + */ +# elif !defined(_WIN32) \ + && ( defined(__unix__) || defined(__unix) \ + || defined(__midipix__) || defined(__VMS) || defined(__HAIKU__) ) + +# if defined(__linux__) || defined(__linux) || defined(__CYGWIN__) +# ifndef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 200809L /* feature test macro : https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html */ +# endif +# endif +# include /* declares _POSIX_VERSION */ +# if defined(_POSIX_VERSION) /* POSIX compliant */ +# define PLATFORM_POSIX_VERSION _POSIX_VERSION +# else +# define PLATFORM_POSIX_VERSION 1 +# endif + +# ifdef __UCLIBC__ +# ifndef __USE_MISC +# define __USE_MISC /* enable st_mtim on uclibc */ +# endif +# endif + +# else /* non-unix target platform (like Windows) */ +# define PLATFORM_POSIX_VERSION 0 +# endif + +#endif /* PLATFORM_POSIX_VERSION */ + + /* ************************************************************ * Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW ***************************************************************/ #if defined(_MSC_VER) && _MSC_VER >= 1400 # define LONG_SEEK _fseeki64 #elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */ -# define LONG_SEEK fseeko +# define LONG_SEEK fseeko #elif defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__) # define LONG_SEEK fseeko64 #elif defined(_WIN32) && !defined(__DJGPP__) @@ -466,9 +517,9 @@ size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, unsign size_t forwardProgress; if (zs->decompressedOffset < offset) { /* dummy decompressions until we get to the target offset */ - outTmp = (ZSTD_outBuffer){zs->outBuff, MIN(SEEKABLE_BUFF_SIZE, offset - zs->decompressedOffset), 0}; + outTmp = (ZSTD_outBuffer){zs->outBuff, (size_t) (MIN(SEEKABLE_BUFF_SIZE, offset - zs->decompressedOffset)), 0}; } else { - outTmp = (ZSTD_outBuffer){dst, len, zs->decompressedOffset - offset}; + outTmp = (ZSTD_outBuffer){dst, len, (size_t) (zs->decompressedOffset - offset)}; } prevOutPos = outTmp.pos; diff --git a/src/dependencies/zstd-1.5.4/contrib/seqBench/Makefile b/src/dependencies/zstd-1.5.4/contrib/seqBench/Makefile new file mode 100644 index 0000000..e7f08a4 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/seqBench/Makefile @@ -0,0 +1,58 @@ +# ################################################################ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# ################################################################ + +PROGDIR = ../../programs +LIBDIR = ../../lib + +LIBZSTD = $(LIBDIR)/libzstd.a + +CPPFLAGS+= -I$(LIBDIR) -I$(LIBDIR)/common -I$(LIBDIR)/dictBuilder -I$(PROGDIR) + +CFLAGS ?= -O3 -g +CFLAGS += -std=gnu99 +DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ + -Wstrict-aliasing=1 -Wswitch-enum \ + -Wstrict-prototypes -Wundef -Wpointer-arith \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls +CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) + + +default: seqBench + +all : seqBench + +seqBench: util.o timefn.o benchfn.o datagen.o xxhash.o seqBench.c $(LIBZSTD) + $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ + +.PHONY: $(LIBZSTD) +$(LIBZSTD): + $(MAKE) -C $(LIBDIR) libzstd.a CFLAGS="$(CFLAGS)" + +benchfn.o: $(PROGDIR)/benchfn.c + $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c + +timefn.o: $(PROGDIR)/timefn.c + $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c + +datagen.o: $(PROGDIR)/datagen.c + $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c + +util.o: $(PROGDIR)/util.c + $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c + + +xxhash.o : $(LIBDIR)/common/xxhash.c + $(CC) $(CPPFLAGS) $(CFLAGS) $^ -c + + +clean: + $(RM) *.o + $(MAKE) -C $(LIBDIR) clean > /dev/null + $(RM) seqBench diff --git a/src/dependencies/zstd-1.5.4/contrib/seqBench/seqBench.c b/src/dependencies/zstd-1.5.4/contrib/seqBench/seqBench.c new file mode 100644 index 0000000..7efebec --- /dev/null +++ b/src/dependencies/zstd-1.5.4/contrib/seqBench/seqBench.c @@ -0,0 +1,53 @@ +#define ZSTD_STATIC_LINKING_ONLY +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + ZSTD_CCtx* zc = ZSTD_createCCtx(); + + if (argc != 2) { + printf("Usage: seqBench \n"); // TODO provide the block delim option here + return 1; + } + + FILE *f = fopen(argv[1], "rb"); + fseek(f, 0, SEEK_END); + long inBufSize = ftell(f); + fseek(f, 0, SEEK_SET); + + char *inBuf = malloc(inBufSize + 1); + fread(inBuf, inBufSize, 1, f); + fclose(f); + + size_t seqsSize = ZSTD_sequenceBound(inBufSize); + ZSTD_Sequence *seqs = (ZSTD_Sequence*)malloc(seqsSize * sizeof(ZSTD_Sequence)); + char *outBuf = malloc(ZSTD_compressBound(inBufSize)); + + ZSTD_generateSequences(zc, seqs, seqsSize, inBuf, inBufSize); + ZSTD_CCtx_setParameter(zc, ZSTD_c_blockDelimiters, ZSTD_sf_explicitBlockDelimiters); + size_t outBufSize = ZSTD_compressSequences(zc, outBuf, inBufSize, seqs, seqsSize, inBuf, inBufSize); + if (ZSTD_isError(outBufSize)) { + printf("ERROR: %lu\n", outBufSize); + return 1; + } + + char *validationBuf = malloc(inBufSize); + ZSTD_decompress(validationBuf, inBufSize, outBuf, outBufSize); + + if (memcmp(inBuf, validationBuf, inBufSize) == 0) { + printf("Compression and decompression were successful!\n"); + } else { + printf("ERROR: input and validation buffers don't match!\n"); + for (int i = 0; i < inBufSize; i++) { + if (inBuf[i] != validationBuf[i]) { + printf("First bad index: %d\n", i); + break; + } + } + } + + return 0; +} diff --git a/src/dependencies/zstd-1.5.0/contrib/snap/snapcraft.yaml b/src/dependencies/zstd-1.5.4/contrib/snap/snapcraft.yaml similarity index 100% rename from src/dependencies/zstd-1.5.0/contrib/snap/snapcraft.yaml rename to src/dependencies/zstd-1.5.4/contrib/snap/snapcraft.yaml diff --git a/src/dependencies/zstd-1.5.0/doc/README.md b/src/dependencies/zstd-1.5.4/doc/README.md similarity index 78% rename from src/dependencies/zstd-1.5.0/doc/README.md rename to src/dependencies/zstd-1.5.4/doc/README.md index bb7a3e4..8f3babc 100644 --- a/src/dependencies/zstd-1.5.0/doc/README.md +++ b/src/dependencies/zstd-1.5.4/doc/README.md @@ -5,8 +5,9 @@ This directory contains material defining the Zstandard format, as well as detailed instructions to use `zstd` library. __`zstd_manual.html`__ : Documentation of `zstd.h` API, in html format. -Click on this link: [http://zstd.net/zstd_manual.html](http://zstd.net/zstd_manual.html) -to display documentation of latest release in readable format within a browser. +Unfortunately, Github doesn't display `html` files in parsed format, just as source code. +For a readable display of html API documentation of latest release, +use this link: [https://raw.githack.com/facebook/zstd/release/doc/zstd_manual.html](https://raw.githack.com/facebook/zstd/release/doc/zstd_manual.html) . __`zstd_compression_format.md`__ : This document defines the Zstandard compression format. Compliant decoders must adhere to this document, diff --git a/src/dependencies/zstd-1.5.4/doc/decompressor_errata.md b/src/dependencies/zstd-1.5.4/doc/decompressor_errata.md new file mode 100644 index 0000000..b162e7f --- /dev/null +++ b/src/dependencies/zstd-1.5.4/doc/decompressor_errata.md @@ -0,0 +1,84 @@ +Decompressor Errata +=================== + +This document captures known decompressor bugs, where the decompressor rejects a valid zstd frame. +Each entry will contain: +1. The last affected decompressor versions. +2. The decompressor components affected. +2. Whether the compressed frame could ever be produced by the reference compressor. +3. An example frame. +4. A description of the bug. + +The document is in reverse chronological order, with the bugs that affect the most recent zstd decompressor versions listed first. + + +Compressed block with 0 literals and 0 sequences +------------------------------------------------ + +**Last affected version**: v1.5.2 + +**Affected decompressor component(s)**: Library & CLI + +**Produced by the reference compressor**: No + +**Example Frame**: `28b5 2ffd 2000 1500 0000 00` + +The zstd decoder incorrectly rejected blocks of type `Compressed_Block` that encodes literals as `Raw_Literals_Block` with no literals, and has no sequences. + +This type of block was never generated by the reference compressor. + +Additionally, these blocks were disallowed by the spec up until spec version 0.3.2 when the restriction was lifted by [PR#1689](https://github.com/facebook/zstd/pull/1689). + +> A Compressed_Block has the extra restriction that Block_Size is always strictly less than the decompressed size. If this condition cannot be respected, the block must be sent uncompressed instead (Raw_Block). + +First block is RLE block +------------------------ + +**Last affected version**: v1.4.3 + +**Affected decompressor component(s)**: CLI only + +**Produced by the reference compressor**: No + +**Example Frame**: `28b5 2ffd a001 0002 0002 0010 000b 0000 00` + +The zstd CLI decompressor rejected cases where the first block was an RLE block whose `Block_Size` is 131072, and the frame contains more than one block. +This only affected the zstd CLI, and not the library. + +The example is an RLE block with 131072 bytes, followed by a second RLE block with 1 byte. + +The compressor currently works around this limitation by explicitly avoiding producing RLE blocks as the first +block. + +https://github.com/facebook/zstd/blob/8814aa5bfa74f05a86e55e9d508da177a893ceeb/lib/compress/zstd_compress.c#L3527-L3535 + +Tiny FSE Table & Block +---------------------- + +**Last affected version**: v1.3.4 + +**Affected decompressor component(s)**: Library & CLI + +**Produced by the reference compressor**: Possibly until version v1.3.4, but probably never + +**Example Frame**: `28b5 2ffd 2027 c500 0080 f3f1 f0ec ebc6 c5c7 f09d 4300 0000 e0e0 0658 0100 603e 52` + +The zstd library rejected blocks of type `Compressed_Block` whose offset of the last table with type `FSE_Compressed_Mode` was less than 4 bytes from the end of the block. + +In more depth, let `Last_Table_Offset` be the offset in the compressed block (excluding the header) that +the last table with type `FSE_Compressed_Mode` started. If `Block_Content - Last_Table_Offset < 4` then +the buggy zstd decompressor would reject the block. This occurs when the last serialized table is 2 bytes +and the bitstream size is 1 byte. + +For example: +* There is 1 sequence in the block +* `Literals_Lengths_Mode` is `FSE_Compressed_Mode` & the serialized table size is 2 bytes +* `Offsets_Mode` is `Predefined_Mode` +* `Match_Lengths_Mode` is `Predefined_Mode` +* The bitstream is 1 byte. E.g. there is only one sequence and it fits in 1 byte. + +The total `Block_Content` is `5` bytes, and `Last_Table_Offset` is `2`. + +See the compressor workaround code: + +https://github.com/facebook/zstd/blob/8814aa5bfa74f05a86e55e9d508da177a893ceeb/lib/compress/zstd_compress.c#L2667-L2682 diff --git a/src/dependencies/zstd-1.5.0/doc/educational_decoder/.gitignore b/src/dependencies/zstd-1.5.4/doc/educational_decoder/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/educational_decoder/.gitignore rename to src/dependencies/zstd-1.5.4/doc/educational_decoder/.gitignore diff --git a/src/dependencies/zstd-1.5.0/doc/educational_decoder/Makefile b/src/dependencies/zstd-1.5.4/doc/educational_decoder/Makefile similarity index 97% rename from src/dependencies/zstd-1.5.0/doc/educational_decoder/Makefile rename to src/dependencies/zstd-1.5.4/doc/educational_decoder/Makefile index a9c601e..f6deeb1 100644 --- a/src/dependencies/zstd-1.5.0/doc/educational_decoder/Makefile +++ b/src/dependencies/zstd-1.5.4/doc/educational_decoder/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/doc/educational_decoder/README.md b/src/dependencies/zstd-1.5.4/doc/educational_decoder/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/educational_decoder/README.md rename to src/dependencies/zstd-1.5.4/doc/educational_decoder/README.md diff --git a/src/dependencies/zstd-1.5.0/doc/educational_decoder/harness.c b/src/dependencies/zstd-1.5.4/doc/educational_decoder/harness.c similarity index 98% rename from src/dependencies/zstd-1.5.0/doc/educational_decoder/harness.c rename to src/dependencies/zstd-1.5.4/doc/educational_decoder/harness.c index 935f60d..12c5a80 100644 --- a/src/dependencies/zstd-1.5.0/doc/educational_decoder/harness.c +++ b/src/dependencies/zstd-1.5.4/doc/educational_decoder/harness.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/doc/educational_decoder/zstd_decompress.c b/src/dependencies/zstd-1.5.4/doc/educational_decoder/zstd_decompress.c similarity index 99% rename from src/dependencies/zstd-1.5.0/doc/educational_decoder/zstd_decompress.c rename to src/dependencies/zstd-1.5.4/doc/educational_decoder/zstd_decompress.c index 62e6f0d..9ade765 100644 --- a/src/dependencies/zstd-1.5.0/doc/educational_decoder/zstd_decompress.c +++ b/src/dependencies/zstd-1.5.4/doc/educational_decoder/zstd_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -1890,7 +1890,7 @@ static size_t HUF_decompress_4stream(const HUF_dtable *const dtable, /// Initializes a Huffman table using canonical Huffman codes /// For more explanation on canonical Huffman codes see -/// http://www.cs.uofs.edu/~mccloske/courses/cmps340/huff_canonical_dec2015.html +/// https://www.cs.scranton.edu/~mccloske/courses/cmps340/huff_canonical_dec2015.html /// Codes within a level are allocated in symbol order (i.e. smaller symbols get /// earlier codes) static void HUF_init_dtable(HUF_dtable *const table, const u8 *const bits, @@ -2145,7 +2145,7 @@ static void FSE_init_dtable(FSE_dtable *const dtable, // "All remaining symbols are sorted in their natural order. Starting from // symbol 0 and table position 0, each symbol gets attributed as many cells - // as its probability. Cell allocation is spreaded, not linear." + // as its probability. Cell allocation is spread, not linear." // Place the rest in the table const u16 step = (size >> 1) + (size >> 3) + 3; const u16 mask = size - 1; diff --git a/src/dependencies/zstd-1.5.0/doc/educational_decoder/zstd_decompress.h b/src/dependencies/zstd-1.5.4/doc/educational_decoder/zstd_decompress.h similarity index 97% rename from src/dependencies/zstd-1.5.0/doc/educational_decoder/zstd_decompress.h rename to src/dependencies/zstd-1.5.4/doc/educational_decoder/zstd_decompress.h index d89c835..c13c813 100644 --- a/src/dependencies/zstd-1.5.0/doc/educational_decoder/zstd_decompress.h +++ b/src/dependencies/zstd-1.5.4/doc/educational_decoder/zstd_decompress.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/doc/images/CSpeed2.png b/src/dependencies/zstd-1.5.4/doc/images/CSpeed2.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/CSpeed2.png rename to src/dependencies/zstd-1.5.4/doc/images/CSpeed2.png diff --git a/src/dependencies/zstd-1.5.0/doc/images/DCspeed5.png b/src/dependencies/zstd-1.5.4/doc/images/DCspeed5.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/DCspeed5.png rename to src/dependencies/zstd-1.5.4/doc/images/DCspeed5.png diff --git a/src/dependencies/zstd-1.5.0/doc/images/DSpeed3.png b/src/dependencies/zstd-1.5.4/doc/images/DSpeed3.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/DSpeed3.png rename to src/dependencies/zstd-1.5.4/doc/images/DSpeed3.png diff --git a/src/dependencies/zstd-1.5.0/doc/images/cdict_v136.png b/src/dependencies/zstd-1.5.4/doc/images/cdict_v136.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/cdict_v136.png rename to src/dependencies/zstd-1.5.4/doc/images/cdict_v136.png diff --git a/src/dependencies/zstd-1.5.0/doc/images/dict-cr.png b/src/dependencies/zstd-1.5.4/doc/images/dict-cr.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/dict-cr.png rename to src/dependencies/zstd-1.5.4/doc/images/dict-cr.png diff --git a/src/dependencies/zstd-1.5.0/doc/images/dict-cs.png b/src/dependencies/zstd-1.5.4/doc/images/dict-cs.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/dict-cs.png rename to src/dependencies/zstd-1.5.4/doc/images/dict-cs.png diff --git a/src/dependencies/zstd-1.5.0/doc/images/dict-ds.png b/src/dependencies/zstd-1.5.4/doc/images/dict-ds.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/dict-ds.png rename to src/dependencies/zstd-1.5.4/doc/images/dict-ds.png diff --git a/src/dependencies/zstd-1.5.0/doc/images/zstd_cdict_v1_3_5.png b/src/dependencies/zstd-1.5.4/doc/images/zstd_cdict_v1_3_5.png similarity index 100% rename from src/dependencies/zstd-1.5.0/doc/images/zstd_cdict_v1_3_5.png rename to src/dependencies/zstd-1.5.4/doc/images/zstd_cdict_v1_3_5.png diff --git a/src/dependencies/zstd-1.5.4/doc/images/zstd_logo86.png b/src/dependencies/zstd-1.5.4/doc/images/zstd_logo86.png new file mode 100644 index 0000000..8abefe2 Binary files /dev/null and b/src/dependencies/zstd-1.5.4/doc/images/zstd_logo86.png differ diff --git a/src/dependencies/zstd-1.5.0/doc/zstd_compression_format.md b/src/dependencies/zstd-1.5.4/doc/zstd_compression_format.md similarity index 97% rename from src/dependencies/zstd-1.5.0/doc/zstd_compression_format.md rename to src/dependencies/zstd-1.5.4/doc/zstd_compression_format.md index 5c7deb9..e40677a 100644 --- a/src/dependencies/zstd-1.5.0/doc/zstd_compression_format.md +++ b/src/dependencies/zstd-1.5.4/doc/zstd_compression_format.md @@ -3,7 +3,7 @@ Zstandard Compression Format ### Notices -Copyright (c) 2016-2021 Yann Collet, Facebook, Inc. +Copyright (c) Meta Platforms, Inc. and affiliates. Permission is granted to copy and distribute this document for any purpose and without charge, @@ -26,7 +26,7 @@ The purpose of this document is to define a lossless compressed data format, that is independent of CPU type, operating system, file system and character set, suitable for file compression, pipe and streaming compression, -using the [Zstandard algorithm](http://www.zstandard.org). +using the [Zstandard algorithm](https://facebook.github.io/zstd/). The text of the specification assumes a basic background in programming at the level of bits and other primitive data representations. @@ -35,7 +35,7 @@ even for an arbitrarily long sequentially presented input data stream, using only an a priori bounded amount of intermediate storage, and hence can be used in data communications. The format uses the Zstandard compression method, -and optional [xxHash-64 checksum method](http://www.xxhash.org), +and optional [xxHash-64 checksum method](https://cyan4973.github.io/xxHash/), for detection of data corruption. The data format defined by this specification @@ -134,7 +134,7 @@ __`Content_Checksum`__ An optional 32-bit checksum, only present if `Content_Checksum_flag` is set. The content checksum is the result -of [xxh64() hash function](http://www.xxhash.org) +of [xxh64() hash function](https://cyan4973.github.io/xxHash/) digesting the original (decoded) data as input, and a seed of zero. The low 4 bytes of the checksum are stored in __little-endian__ format. @@ -435,7 +435,7 @@ They can be decoded first, and then copied during [Sequence Execution], or they can be decoded on the flow during [Sequence Execution]. Literals can be stored uncompressed or compressed using Huffman prefix codes. -When compressed, an optional tree description can be present, +When compressed, a tree description may optionally be present, followed by 1 or 4 streams. | `Literals_Section_Header` | [`Huffman_Tree_Description`] | [jumpTable] | Stream1 | [Stream2] | [Stream3] | [Stream4] | @@ -510,7 +510,7 @@ Its value is : `Size_Format = (Literals_Section_Header[0]>>2) & 3` `Regenerated_Size = (Literals_Section_Header[0]>>4) + (Literals_Section_Header[1]<<4) + (Literals_Section_Header[2]<<12)` Only Stream1 is present for these cases. -Note : it's allowed to represent a short value (for example `13`) +Note : it's allowed to represent a short value (for example `27`) using a long format, even if it's less efficient. __`Size_Format` for `Compressed_Literals_Block` and `Treeless_Literals_Block`__ : @@ -521,19 +521,33 @@ __`Size_Format` for `Compressed_Literals_Block` and `Treeless_Literals_Block`__ Both `Regenerated_Size` and `Compressed_Size` use 10 bits (0-1023). `Literals_Section_Header` uses 3 bytes. - `Size_Format` == 01 : 4 streams. - Both `Regenerated_Size` and `Compressed_Size` use 10 bits (0-1023). + Both `Regenerated_Size` and `Compressed_Size` use 10 bits (6-1023). `Literals_Section_Header` uses 3 bytes. - `Size_Format` == 10 : 4 streams. - Both `Regenerated_Size` and `Compressed_Size` use 14 bits (0-16383). + Both `Regenerated_Size` and `Compressed_Size` use 14 bits (6-16383). `Literals_Section_Header` uses 4 bytes. - `Size_Format` == 11 : 4 streams. - Both `Regenerated_Size` and `Compressed_Size` use 18 bits (0-262143). + Both `Regenerated_Size` and `Compressed_Size` use 18 bits (6-262143). `Literals_Section_Header` uses 5 bytes. Both `Compressed_Size` and `Regenerated_Size` fields follow __little-endian__ convention. Note: `Compressed_Size` __includes__ the size of the Huffman Tree description _when_ it is present. +4 streams is superior to 1 stream in decompression speed, +by exploiting instruction level parallelism. +But it's also more expensive, +costing on average ~7.3 bytes more than the 1 stream mode, mostly from the jump table. + +In general, use the 4 streams mode when there are more literals to decode, +to favor higher decompression speeds. +Beyond 1KB, the 4 streams mode is compulsory anyway. + +Note that a minimum of 6 bytes is required for the 4 streams mode. +That's a technical minimum, but it's not recommended to employ the 4 streams mode +for such a small quantity, that would be wasteful. +A more practical lower bound would be around ~256 bytes. + #### Raw Literals Block The data in Stream1 is `Regenerated_Size` bytes long, it contains the raw literals data to be used during [Sequence Execution]. @@ -945,14 +959,14 @@ sequences are applied to them: |:--------------:|:-----------------:|:------------------:|:------------------:|:------------------:|:-----------------------:| | | | 1 | 4 | 8 | starting values | | 1114 | 11 | 1111 | 1 | 4 | non-repeat | -| 1 | 22 | 1111 | 1 | 4 | repeat 1; no change | +| 1 | 22 | 1111 | 1 | 4 | repeat 1: no change | | 2225 | 22 | 2222 | 1111 | 1 | non-repeat | | 1114 | 111 | 1111 | 2222 | 1111 | non-repeat | | 3336 | 33 | 3333 | 1111 | 2222 | non-repeat | -| 2 | 22 | 1111 | 3333 | 2222 | repeat 2; swap 1 & 2 | -| 3 | 33 | 2222 | 1111 | 3333 | repeat 3; rotate 3 to 1 | -| 3 | 0 | 2221 | 2222 | 1111 | insert resolved offset | -| 1 | 0 | 2222 | 2221 | 3333 | repeat 2 | +| 2 | 22 | 1111 | 3333 | 2222 | repeat 2: swap 1 & 2 | +| 3 | 33 | 2222 | 1111 | 3333 | repeat 3: rotate 3 to 1 | +| 3 | 0 | 2221 | 2222 | 1111 | special case : insert `repeat1 - 1` | +| 1 | 0 | 2222 | 2221 | 1111 | == repeat 2 | Skippable Frames @@ -967,14 +981,14 @@ into a flow of concatenated frames. Skippable frames defined in this specification are compatible with [LZ4] ones. -[LZ4]:http://www.lz4.org +[LZ4]:https://lz4.github.io/lz4/ From a compliant decoder perspective, skippable frames need just be skipped, and their content ignored, resuming decoding after the skippable frame. It can be noted that a skippable frame can be used to watermark a stream of concatenated frames -embedding any kind of tracking information (even just an UUID). +embedding any kind of tracking information (even just a UUID). Users wary of such possibility should scan the stream of concatenated frames in an attempt to detect such frame for analysis or removal. @@ -1124,7 +1138,7 @@ These symbols define a full state reset, reading `Accuracy_Log` bits. Then, all remaining symbols, sorted in natural order, are allocated cells. Starting from symbol `0` (if it exists), and table position `0`, each symbol gets allocated as many cells as its probability. -Cell allocation is spreaded, not linear : +Cell allocation is spread, not linear : each successor position follows this rule : ``` @@ -1669,7 +1683,7 @@ or at least provide a meaningful error code explaining for which reason it canno Version changes --------------- -- 0.3.7 : clarifications for Repeat_Offsets +- 0.3.7 : clarifications for Repeat_Offsets, matching RFC8878 - 0.3.6 : clarifications for Dictionary_ID - 0.3.5 : clarifications for Block_Maximum_Size - 0.3.4 : clarifications for FSE decoding table diff --git a/src/dependencies/zstd-1.5.0/doc/zstd_manual.html b/src/dependencies/zstd-1.5.4/doc/zstd_manual.html similarity index 83% rename from src/dependencies/zstd-1.5.0/doc/zstd_manual.html rename to src/dependencies/zstd-1.5.4/doc/zstd_manual.html index 010f10a..c33f0e2 100644 --- a/src/dependencies/zstd-1.5.0/doc/zstd_manual.html +++ b/src/dependencies/zstd-1.5.4/doc/zstd_manual.html @@ -1,10 +1,10 @@ -zstd 1.5.0 Manual +zstd 1.5.4 Manual -

    zstd 1.5.0 Manual

    +

    zstd 1.5.4 Manual


    Contents

      @@ -121,7 +121,9 @@ unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize); note 6 : This function replaces ZSTD_getDecompressedSize()


      -
      unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
      +
      ZSTD_DEPRECATED("Replaced by ZSTD_getFrameContentSize")
      +ZSTDLIB_API
      +unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
       

      NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize(). Both functions work the same way, but ZSTD_getDecompressedSize() blends "empty", "unknown" and "error" results to the same return value (0), @@ -137,8 +139,30 @@ unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize); or an error code if input is invalid


      -

      Helper functions

      #define ZSTD_COMPRESSBOUND(srcSize)   ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0))  /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
      -size_t      ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
      +

      Helper functions

      /* ZSTD_compressBound() :
      + * maximum compressed size in worst case single-pass scenario.
      + * When invoking `ZSTD_compress()` or any other one-pass compression function,
      + * it's recommended to provide @dstCapacity >= ZSTD_compressBound(srcSize)
      + * as it eliminates one potential failure scenario,
      + * aka not enough room in dst buffer to write the compressed frame.
      + * Note : ZSTD_compressBound() itself can fail, if @srcSize > ZSTD_MAX_INPUT_SIZE .
      + *        In which case, ZSTD_compressBound() will return an error code
      + *        which can be tested using ZSTD_isError().
      + *
      + * ZSTD_COMPRESSBOUND() :
      + * same as ZSTD_compressBound(), but as a macro.
      + * It can be used to produce constants, which can be useful for static allocation,
      + * for example to size a static array on stack.
      + * Will produce constant value 0 if srcSize too large.
      + */
      +#define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00LLU : 0xFF00FF00U)
      +#define ZSTD_COMPRESSBOUND(srcSize)   (((size_t)(srcSize) >= ZSTD_MAX_INPUT_SIZE) ? 0 : (srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0))  /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
      +size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */
      +/* ZSTD_isError() :
      + * Most ZSTD_* functions returning a size_t value can be tested for error,
      + * using ZSTD_isError().
      + * @return 1 if error, 0 otherwise
      + */
       unsigned    ZSTD_isError(size_t code);          /*!< tells if a `size_t` function result is an error code */
       const char* ZSTD_getErrorName(size_t code);     /*!< provides readable string from an error code */
       int         ZSTD_minCLevel(void);               /*!< minimum negative compression level allowed, requires v1.4.0+ */
      @@ -357,8 +381,11 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);  /* accept NULL pointer */
            * ZSTD_c_stableOutBuffer
            * ZSTD_c_blockDelimiters
            * ZSTD_c_validateSequences
      -     * ZSTD_c_splitBlocks
      +     * ZSTD_c_useBlockSplitter
            * ZSTD_c_useRowMatchFinder
      +     * ZSTD_c_prefetchCDictTables
      +     * ZSTD_c_enableSeqProducerFallback
      +     * ZSTD_c_maxBlockSize
            * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
            * note : never ever use experimentalParam? names directly;
            *        also, the enums values themselves are unstable and can still change.
      @@ -377,7 +404,11 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);  /* accept NULL pointer */
            ZSTD_c_experimentalParam12=1009,
            ZSTD_c_experimentalParam13=1010,
            ZSTD_c_experimentalParam14=1011,
      -     ZSTD_c_experimentalParam15=1012
      +     ZSTD_c_experimentalParam15=1012,
      +     ZSTD_c_experimentalParam16=1013,
      +     ZSTD_c_experimentalParam17=1014,
      +     ZSTD_c_experimentalParam18=1015,
      +     ZSTD_c_experimentalParam19=1016
       } ZSTD_cParameter;
       

      typedef struct {
      @@ -440,7 +471,7 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);  /* accept NULL pointer */
                         They will be used to compress next frame.
                         Resetting session never fails.
         - The parameters : changes all parameters back to "default".
      -                  This removes any reference to any dictionary too.
      +                  This also removes any reference to any dictionary or external sequence producer.
                         Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing)
                         otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError())
         - Both : similar to resetting the session, followed by resetting parameters.
      @@ -479,13 +510,15 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);  /* accept NULL pointer */
            * ZSTD_d_stableOutBuffer
            * ZSTD_d_forceIgnoreChecksum
            * ZSTD_d_refMultipleDDicts
      +     * ZSTD_d_disableHuffmanAssembly
            * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
            * note : never ever use experimentalParam? names directly
            */
            ZSTD_d_experimentalParam1=1000,
            ZSTD_d_experimentalParam2=1001,
            ZSTD_d_experimentalParam3=1002,
      -     ZSTD_d_experimentalParam4=1003
      +     ZSTD_d_experimentalParam4=1003,
      +     ZSTD_d_experimentalParam5=1004
       
       } ZSTD_dParameter;
       

      @@ -654,6 +687,9 @@ size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any) ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); + + Note that ZSTD_initCStream() clears any previously set dictionary. Use the new API + to compress with a dictionary.


      @@ -689,6 +725,33 @@ size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); size_t ZSTD_freeDStream(ZSTD_DStream* zds);
      /* accept NULL pointer */

      Streaming decompression functions


      +
      size_t ZSTD_initDStream(ZSTD_DStream* zds);
      +

      Initialize/reset DStream state for new decompression operation. + Call before new decompression operation using same DStream. + + Note : This function is redundant with the advanced API and equivalent to: + ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); + ZSTD_DCtx_refDDict(zds, NULL); + +


      + +
      size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input);
      +

      Streaming decompression function. + Call repetitively to consume full input updating it as necessary. + Function will update both input and output `pos` fields exposing current state via these fields: + - `input.pos < input.size`, some input remaining and caller should provide remaining input + on the next call. + - `output.pos < output.size`, decoder finished and flushed all remaining buffers. + - `output.pos == output.size`, potentially uncflushed data present in the internal buffers, + call ZSTD_decompressStream() again to flush remaining data to output. + Note : with no additional input, amount of data flushed <= ZSTD_BLOCKSIZE_MAX. + + @return : 0 when a frame is completely decoded and fully flushed, + or an error code, which can be tested using ZSTD_isError(), + or any other value > 0, which means there is some decoding or flushing to do to complete current frame. + +


      +
      size_t ZSTD_DStreamInSize(void);    /*!< recommended size for input buffer */
       

      size_t ZSTD_DStreamOutSize(void);   /*!< recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances. */
      @@ -794,7 +857,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);  /* accept NULL pointer */
         If @return == 0, the dictID could not be decoded.
         This could for one of the following reasons :
         - The frame does not require a dictionary to be decoded (most common case).
      -  - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information.
      +  - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden piece of information.
           Note : this use case also happens when using a non-conformant dictionary.
         - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`).
         - This is not a Zstandard frame.
      @@ -803,7 +866,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);  /* accept NULL pointer */
       
       

      Advanced dictionary and prefix API (Requires v1.4.0+)

        This API allows dictionaries to be used with ZSTD_compress2(),
      - ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and
      + ZSTD_compressStream2(), and ZSTD_decompressDCtx(). Dictionaries are sticky, and
        only reset with the context is reset with ZSTD_reset_parameters or
        ZSTD_reset_session_and_parameters. Prefixes are single-use.
       
      @@ -814,8 +877,9 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
      /* accept NULL pointer */ @result : 0, or an error code (which can be tested with ZSTD_isError()). Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary, meaning "return to no-dictionary mode". - Note 1 : Dictionary is sticky, it will be used for all future compressed frames. - To return to "no-dictionary" situation, load a NULL dictionary (or reset parameters). + Note 1 : Dictionary is sticky, it will be used for all future compressed frames, + until parameters are reset, a new dictionary is loaded, or the dictionary + is explicitly invalidated by loading a NULL dictionary. Note 2 : Loading a dictionary involves building tables. It's also a CPU consuming operation, with non-negligible impact on latency. Tables are dependent on compression parameters, and for this reason, @@ -828,7 +892,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds); /* accept NULL pointer */


      size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
      -

      Reference a prepared dictionary, to be used for all next compressed frames. +

      Reference a prepared dictionary, to be used for all future compressed frames. Note that compression parameters are enforced from within CDict, and supersede any compression parameter previously set within CCtx. The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs. @@ -863,9 +927,9 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds); /* accept NULL pointer */


      size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
      -

      Create an internal DDict from dict buffer, - to be used to decompress next frames. - The dictionary remains valid for all future frames, until explicitly invalidated. +

      Create an internal DDict from dict buffer, to be used to decompress all future frames. + The dictionary remains valid for all future frames, until explicitly invalidated, or + a new dictionary is loaded. @result : 0, or an error code (which can be tested with ZSTD_isError()). Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, meaning "return to no-dictionary mode". @@ -889,9 +953,10 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds); /* accept NULL pointer */ The memory for the table is allocated on the first call to refDDict, and can be freed with ZSTD_freeDCtx(). + If called with ZSTD_d_refMultipleDDicts disabled (the default), only one dictionary + will be managed, and referencing a dictionary effectively "discards" any previous one. + @result : 0, or an error code (which can be tested with ZSTD_isError()). - Note 1 : Currently, only one dictionary can be managed. - Referencing a new dictionary effectively "discards" any previous one. Special: referencing a NULL DDict means "return to no-dictionary mode". Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx. @@ -1072,14 +1137,18 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); } ZSTD_literalCompressionMode_e;


      typedef enum {
      -  ZSTD_urm_auto = 0,                   /* Automatically determine whether or not we use row matchfinder */
      -  ZSTD_urm_disableRowMatchFinder = 1,  /* Never use row matchfinder */
      -  ZSTD_urm_enableRowMatchFinder = 2    /* Always use row matchfinder when applicable */
      -} ZSTD_useRowMatchFinderMode_e;
      +  /* Note: This enum controls features which are conditionally beneficial. Zstd typically will make a final
      +   * decision on whether or not to enable the feature (ZSTD_ps_auto), but setting the switch to ZSTD_ps_enable
      +   * or ZSTD_ps_disable allow for a force enable/disable the feature.
      +   */
      +  ZSTD_ps_auto = 0,         /* Let the library automatically determine whether the feature shall be enabled */
      +  ZSTD_ps_enable = 1,       /* Force-enable the feature */
      +  ZSTD_ps_disable = 2       /* Do not use the feature */
      +} ZSTD_paramSwitch_e;
       

      Frame size functions

      
       
      -
      unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
      +
      ZSTDLIB_STATIC_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
       

      `src` should point to the start of a series of ZSTD encoded and/or skippable frames `srcSize` must be the _exact_ size of this series (i.e. there should be a frame boundary at `src + srcSize`) @@ -1102,7 +1171,7 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); however it does mean that all frame data must be present and valid.


      -
      unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize);
      +
      ZSTDLIB_STATIC_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize);
       

      `src` should point to the start of a series of ZSTD encoded and/or skippable frames `srcSize` must be the _exact_ size of this series (i.e. there should be a frame boundary at `src + srcSize`) @@ -1117,26 +1186,80 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);


      -
      size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
       

      srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX. @return : size of the Frame Header, or an error code (if srcSize is too small)


      +
      ZSTDLIB_STATIC_API size_t ZSTD_decompressionMargin(const void* src, size_t srcSize);
      +

      Zstd supports in-place decompression, where the input and output buffers overlap. + In this case, the output buffer must be at least (Margin + Output_Size) bytes large, + and the input buffer must be at the end of the output buffer. + + _______________________ Output Buffer ________________________ + | | + | ____ Input Buffer ____| + | | | + v v v + |---------------------------------------|-----------|----------| + ^ ^ ^ + |___________________ Output_Size ___________________|_ Margin _| + + NOTE: See also ZSTD_DECOMPRESSION_MARGIN(). + NOTE: This applies only to single-pass decompression through ZSTD_decompress() or + ZSTD_decompressDCtx(). + NOTE: This function supports multi-frame input. + + @param src The compressed frame(s) + @param srcSize The size of the compressed frame(s) + @returns The decompression margin or an error that can be checked with ZSTD_isError(). + +


      + +
      #define ZSTD_DECOMPRESSION_MARGIN(originalSize, blockSize) ((size_t)(                                              \
      +        ZSTD_FRAMEHEADERSIZE_MAX                                                              /* Frame header */ + \
      +        4                                                                                         /* checksum */ + \
      +        ((originalSize) == 0 ? 0 : 3 * (((originalSize) + (blockSize) - 1) / blockSize)) /* 3 bytes per block */ + \
      +        (blockSize)                                                                    /* One block of margin */   \
      +    ))
      +

      Similar to ZSTD_decompressionMargin(), but instead of computing the margin from + the compressed frame, compute it from the original size and the blockSizeLog. + See ZSTD_decompressionMargin() for details. + + WARNING: This macro does not support multi-frame input, the input must be a single + zstd frame. If you need that support use the function, or implement it yourself. + + @param originalSize The original uncompressed size of the data. + @param blockSize The block size == MIN(windowSize, ZSTD_BLOCKSIZE_MAX). + Unless you explicitly set the windowLog smaller than + ZSTD_BLOCKSIZELOG_MAX you can just use ZSTD_BLOCKSIZE_MAX. + +


      +
      typedef enum {
         ZSTD_sf_noBlockDelimiters = 0,         /* Representation of ZSTD_Sequence has no block delimiters, sequences only */
         ZSTD_sf_explicitBlockDelimiters = 1    /* Representation of ZSTD_Sequence contains explicit block delimiters */
       } ZSTD_sequenceFormat_e;
       

      -

      Generate sequences using ZSTD_compress2, given a source buffer. +

      ZSTDLIB_STATIC_API size_t ZSTD_sequenceBound(size_t srcSize);
      +

      `srcSize` : size of the input buffer + @return : upper-bound for the number of sequences that can be generated + from a buffer of srcSize bytes + + note : returns number of sequences - to get bytes, multiply by sizeof(ZSTD_Sequence). + +


      + +

      Generate sequences using ZSTD_compress2(), given a source buffer. Each block will end with a dummy sequence with offset == 0, matchLength == 0, and litLength == length of last literals. litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0) simply acts as a block delimiter. - zc can be used to insert custom compression params. - This function invokes ZSTD_compress2 + @zc can be used to insert custom compression params. + This function invokes ZSTD_compress2(). The output of this function can be fed into ZSTD_compressSequences() with CCtx setting of ZSTD_c_blockDelimiters as ZSTD_sf_explicitBlockDelimiters @@ -1144,9 +1267,9 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);


      -
      size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize);
       

      Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals - by merging them into into the literals of the next sequence. + by merging them into the literals of the next sequence. As such, the final generated result has no explicit representation of block boundaries, and the final last literals segment is not represented in the sequences. @@ -1157,10 +1280,13 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);


      -
      size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size_t dstSize,
      -                      const ZSTD_Sequence* inSeqs, size_t inSeqsSize,
      -                      const void* src, size_t srcSize);
      -

      Compress an array of ZSTD_Sequence, generated from the original source buffer, into dst. +

      ZSTDLIB_STATIC_API size_t
      +ZSTD_compressSequences( ZSTD_CCtx* cctx, void* dst, size_t dstSize,
      +            const ZSTD_Sequence* inSeqs, size_t inSeqsSize,
      +            const void* src, size_t srcSize);
      +

      Compress an array of ZSTD_Sequence, associated with @src buffer, into dst. + @src contains the entire input (not just the literals). + If @srcSize > sum(sequence.length), the remaining bytes are considered all literals If a dictionary is included, then the cctx should reference the dict. (see: ZSTD_CCtx_refCDict(), ZSTD_CCtx_loadDictionary(), etc.) The entire source is compressed into a single frame. @@ -1185,15 +1311,15 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); Note: Repcodes are, as of now, always re-calculated within this function, so ZSTD_Sequence::rep is unused. Note 2: Once we integrate ability to ingest repcodes, the explicit block delims mode must respect those repcodes exactly, and cannot emit an RLE block that disagrees with the repcode history - @return : final compressed size or a ZSTD error. + @return : final compressed size, or a ZSTD error code.


      -
      size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
      +
      ZSTDLIB_STATIC_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
                                       const void* src, size_t srcSize, unsigned magicVariant);
       

      Generates a zstd skippable frame containing data given by src, and writes it to dst buffer. - Skippable frames begin with a a 4-byte magic number. There are 16 possible choices of magic number, + Skippable frames begin with a 4-byte magic number. There are 16 possible choices of magic number, ranging from ZSTD_MAGIC_SKIPPABLE_START to ZSTD_MAGIC_SKIPPABLE_START+15. As such, the parameter magicVariant controls the exact skippable frame magic number variant used, so the magic number used will be ZSTD_MAGIC_SKIPPABLE_START + magicVariant. @@ -1205,12 +1331,31 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);


      +
      size_t ZSTD_readSkippableFrame(void* dst, size_t dstCapacity, unsigned* magicVariant,
      +                                const void* src, size_t srcSize);
      +

      Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer. + + The parameter magicVariant will receive the magicVariant that was supplied when the frame was written, + i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested + in the magicVariant. + + Returns an error if destination buffer is not large enough, or if the frame is not skippable. + + @return : number of bytes written or a ZSTD error. + +


      + +
      unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size);
      +

      Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame. + +


      +

      Memory management

      
       
      -
      size_t ZSTD_estimateCCtxSize(int compressionLevel);
      -size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
      -size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
      -size_t ZSTD_estimateDCtxSize(void);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateDCtxSize(void);
       

      These functions make it possible to estimate memory usage of a future {D,C}Ctx, before its creation. @@ -1230,16 +1375,19 @@ size_t ZSTD_estimateDCtxSize(void); and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter(). Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits. - Note 2 : only single-threaded compression is supported. + Note : only single-threaded compression is supported. ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1. + + Note 2 : ZSTD_estimateCCtxSize* functions are not compatible with the Block-Level Sequence Producer API at this time. + Size estimates assume that no external sequence producer is registered.


      -
      size_t ZSTD_estimateCStreamSize(int compressionLevel);
      -size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams);
      -size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params);
      -size_t ZSTD_estimateDStreamSize(size_t windowSize);
      -size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int compressionLevel);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t windowSize);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
       

      ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one. It will also consider src size to be arbitrarily "large", which is worst case. If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation. @@ -1251,20 +1399,25 @@ size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize); or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame(); Note : if streaming is init with function ZSTD_init?Stream_usingDict(), an internal ?Dict will be created, which additional size is not estimated here. - In this case, get total size by adding ZSTD_estimate?DictSize + In this case, get total size by adding ZSTD_estimate?DictSize + Note 2 : only single-threaded compression is supported. + ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1. + Note 3 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time. + Size estimates assume that no external sequence producer is registered. +


      -
      size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel);
      -size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod);
      -size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod);
      +ZSTDLIB_STATIC_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod);
       

      ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict(). ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced(). Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller.


      -
      ZSTD_CCtx*    ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
      -ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize);    /**< same as ZSTD_initStaticCCtx() */
      +
      ZSTDLIB_STATIC_API ZSTD_CCtx*    ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
      +ZSTDLIB_STATIC_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize);    /**< same as ZSTD_initStaticCCtx() */
       

      Initialize an object using a pre-allocated fixed-size buffer. workspace: The memory area to emplace the object into. Provided pointer *must be 8-bytes aligned*. @@ -1287,7 +1440,7 @@ ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize);


      -
      ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize);    /**< same as ZSTD_initStaticDCtx() */
      +
      ZSTDLIB_STATIC_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize);    /**< same as ZSTD_initStaticDCtx() */
       

      typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
       typedef void  (*ZSTD_freeFunction) (void* opaque, void* address);
      @@ -1303,9 +1456,24 @@ ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL };  /**< this con
        
       


      +
      typedef struct POOL_ctx_s ZSTD_threadPool;
      +ZSTDLIB_STATIC_API ZSTD_threadPool* ZSTD_createThreadPool(size_t numThreads);
      +ZSTDLIB_STATIC_API void ZSTD_freeThreadPool (ZSTD_threadPool* pool);  /* accept NULL pointer */
      +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refThreadPool(ZSTD_CCtx* cctx, ZSTD_threadPool* pool);
      +

      These prototypes make it possible to share a thread pool among multiple compression contexts. + This can limit resources for applications with multiple threads where each one uses + a threaded compression mode (via ZSTD_c_nbWorkers parameter). + ZSTD_createThreadPool creates a new thread pool with a given number of threads. + Note that the lifetime of such pool must exist while being used. + ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value + to use an internal thread pool). + ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer. + +


      +

      Advanced compression functions

      
       
      -
      ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
      +
      ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
       

      Create a digested dictionary for compression Dictionary content is just referenced, not duplicated. As a consequence, `dictBuffer` **must** outlive CDict, @@ -1313,22 +1481,22 @@ ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this con note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef


      -
      ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
      +
      ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
       

      @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize. `estimatedSrcSize` value is optional, select 0 if not known


      -
      ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
      +
      ZSTDLIB_STATIC_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
       

      same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`. All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0


      -
      size_t ZSTD_checkCParams(ZSTD_compressionParameters params);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params);
       

      Ensure param values remain within authorized range. @return 0 on success, or an error code (can be checked with ZSTD_isError())


      -
      ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize);
      +
      ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize);
       

      optimize params for a given `srcSize` and `dictSize`. `srcSize` can be unknown, in which case use ZSTD_CONTENTSIZE_UNKNOWN. `dictSize` must be `0` when there is no dictionary. @@ -1336,18 +1504,27 @@ ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this con This function never fails (wide contract)


      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setCParams(ZSTD_CCtx* cctx, ZSTD_compressionParameters cparams);
      +

      Set all parameters provided within @cparams into the working @cctx. + Note : if modifying parameters during compression (MT mode only), + note that changes to the .windowLog parameter will be ignored. + @return 0 on success, or an error code (can be checked with ZSTD_isError()) +


      +
      ZSTD_DEPRECATED("use ZSTD_compress2")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx,
      -                              void* dst, size_t dstCapacity,
      -                        const void* src, size_t srcSize,
      -                        const void* dict,size_t dictSize,
      -                              ZSTD_parameters params);
      +                  void* dst, size_t dstCapacity,
      +            const void* src, size_t srcSize,
      +            const void* dict,size_t dictSize,
      +                  ZSTD_parameters params);
       

      Note : this function is now DEPRECATED. It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters. This prototype will generate compilation warnings.


      ZSTD_DEPRECATED("use ZSTD_compress2 with ZSTD_CCtx_loadDictionary")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
                                         void* dst, size_t dstCapacity,
                                   const void* src, size_t srcSize,
      @@ -1358,31 +1535,31 @@ size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
         This prototype will generate compilation warnings. 
       


      -
      size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
       

      Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx. It saves some memory, but also requires that `dict` outlives its usage within `cctx`


      -
      size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
       

      Same as ZSTD_CCtx_loadDictionary(), but gives finer control over how to load the dictionary (by copy ? by reference ?) and how to interpret it (automatic ? force raw mode ? full mode only ?)


      -
      size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
       

      Same as ZSTD_CCtx_refPrefix(), but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?)


      -
      size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value);
       

      Get the requested compression parameter value, selected by enum ZSTD_cParameter, and store it into int* value. @return : 0, or an error code (which can be tested with ZSTD_isError()).


      -
      ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
      -size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);  /* accept NULL pointer */
      +
      ZSTDLIB_STATIC_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
      +ZSTDLIB_STATIC_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);  /* accept NULL pointer */
       

      Quick howto : - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure - ZSTD_CCtxParams_setParameter() : Push parameters one by one into @@ -1401,24 +1578,24 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointe


      -
      size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params);
       

      Reset params to default values.


      -
      size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel);
       

      Initializes the compression parameters of cctxParams according to compression level. All other parameters are reset to their default values.


      -
      size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
       

      Initializes the compression and frame parameters of cctxParams according to params. All other parameters are reset to their default values.


      -
      size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value);
       

      Similar to ZSTD_CCtx_setParameter. Set one compression parameter, selected by enum ZSTD_cParameter. Parameters must be applied to a ZSTD_CCtx using @@ -1428,14 +1605,14 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointe


      -
      size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
       

      Similar to ZSTD_CCtx_getParameter. Get the requested value of one compression parameter, selected by enum ZSTD_cParameter. @result : 0, or an error code (which can be tested with ZSTD_isError()).


      -
      size_t ZSTD_CCtx_setParametersUsingCCtxParams(
      +
      ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setParametersUsingCCtxParams(
               ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
       

      Apply a set of ZSTD_CCtx_params to the compression context. This can be done even after compression is started, @@ -1445,7 +1622,7 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointe


      -
      size_t ZSTD_compressStream2_simpleArgs (
      +
      ZSTDLIB_STATIC_API size_t ZSTD_compressStream2_simpleArgs (
                       ZSTD_CCtx* cctx,
                       void* dst, size_t dstCapacity, size_t* dstPos,
                 const void* src, size_t srcSize, size_t* srcPos,
      @@ -1459,40 +1636,40 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);  /* accept NULL pointe
       
       

      Advanced decompression functions

      
       
      -
      unsigned ZSTD_isFrame(const void* buffer, size_t size);
      +
      ZSTDLIB_STATIC_API unsigned ZSTD_isFrame(const void* buffer, size_t size);
       

      Tells if the content of `buffer` starts with a valid Frame Identifier. Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0. Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled. Note 3 : Skippable Frame Identifiers are considered valid.


      -
      ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize);
      +
      ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize);
       

      Create a digested dictionary, ready to start decompression operation without startup delay. Dictionary content is referenced, and therefore stays in dictBuffer. It is important that dictBuffer outlives DDict, it must remain read accessible throughout the lifetime of DDict


      -
      size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
       

      Same as ZSTD_DCtx_loadDictionary(), but references `dict` content instead of copying it into `dctx`. This saves memory if `dict` remains around., However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression.


      -
      size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
       

      Same as ZSTD_DCtx_loadDictionary(), but gives direct control over how to load the dictionary (by copy ? by reference ?) and how to interpret it (automatic ? force raw mode ? full mode only ?).


      -
      size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
       

      Same as ZSTD_DCtx_refPrefix(), but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?)


      -
      size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize);
       

      Refuses allocating internal buffers for frames requiring a window size larger than provided limit. This protects a decoder context from reserving too much memory for itself (potential attack scenario). This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode. @@ -1501,7 +1678,7 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointe


      -
      size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value);
       

      Get the requested decompression parameter value, selected by enum ZSTD_dParameter, and store it into int* value. @return : 0, or an error code (which can be tested with ZSTD_isError()). @@ -1509,6 +1686,7 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointe


      ZSTD_DEPRECATED("use ZSTD_DCtx_setParameter() instead")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
       

      This function is REDUNDANT. Prefer ZSTD_DCtx_setParameter(). Instruct the decoder context about what kind of data to decode next. @@ -1517,7 +1695,7 @@ size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format); @return : 0, or an error code (which can be tested using ZSTD_isError()).


      -
      size_t ZSTD_decompressStream_simpleArgs (
      +
      ZSTDLIB_STATIC_API size_t ZSTD_decompressStream_simpleArgs (
                       ZSTD_DCtx* dctx,
                       void* dst, size_t dstCapacity, size_t* dstPos,
                 const void* src, size_t srcSize, size_t* srcPos);
      @@ -1535,6 +1713,7 @@ size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
       
       

      Advanced Streaming compression functions


      ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs,
                    int compressionLevel,
                    unsigned long long pledgedSrcSize);
      @@ -1552,6 +1731,7 @@ size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs,
       


      ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs,
                const void* dict, size_t dictSize,
                      int compressionLevel);
      @@ -1569,6 +1749,7 @@ size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs,
       


      ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
               const void* dict, size_t dictSize,
                     ZSTD_parameters params,
      @@ -1590,17 +1771,19 @@ size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
       


      ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict);
       

      This function is DEPRECATED, and equivalent to: ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); ZSTD_CCtx_refCDict(zcs, cdict); - + note : cdict will just be referenced, and must outlive compression session This prototype will generate compilation warnings.


      ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
                          const ZSTD_CDict* cdict,
                                ZSTD_frameParameters fParams,
      @@ -1622,6 +1805,7 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
       


      ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API
       size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
       

      This function is DEPRECATED, and is equivalent to: ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); @@ -1651,7 +1835,7 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); unsigned nbActiveWorkers; /* MT only : nb of workers actively compressing at probe time */ } ZSTD_frameProgression;


      -
      size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);
      +
      ZSTDLIB_STATIC_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);
       

      Tell how many bytes are ready to be flushed immediately. Useful for multithreading scenarios (nbWorkers >= 1). Probe the oldest active job, defined as oldest job not yet entirely flushed, @@ -1667,32 +1851,32 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);


      Advanced Streaming decompression functions


      -
      size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize);
      +
      ZSTD_DEPRECATED("use ZSTD_DCtx_reset + ZSTD_DCtx_loadDictionary, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize);
       

      ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); ZSTD_DCtx_loadDictionary(zds, dict, dictSize); note: no dictionary will be used if dict == NULL or dictSize < 8 - Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x


      -
      size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict);
      +
      ZSTD_DEPRECATED("use ZSTD_DCtx_reset + ZSTD_DCtx_refDDict, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict);
       

      ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); ZSTD_DCtx_refDDict(zds, ddict); note : ddict is referenced, it must outlive decompression session - Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x


      -
      size_t ZSTD_resetDStream(ZSTD_DStream* zds);
      +
      ZSTD_DEPRECATED("use ZSTD_DCtx_reset, see zstd.h for detailed instructions")
      +ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds);
       

      ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); re-use decompression parameters from previous init; saves dictionary loading - Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x


      @@ -1710,7 +1894,6 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); Start by initializing a context. Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression. - It's also possible to duplicate a reference context which has already been initialized, using ZSTD_copyCCtx() Then, consume your input using ZSTD_compressContinue(). There are some important considerations to keep in mind when using this advanced function : @@ -1731,11 +1914,12 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again.
      -

      Buffer-less streaming compression functions

      size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel);
      -size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel);
      -size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */
      -size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**<  note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */
      +

      Buffer-less streaming compression functions

      ZSTDLIB_STATIC_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel);
      +ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel);
      +ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */
       

      +
      size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**<  note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */
      +

      size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); /**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */
       

      Buffer-less streaming decompression (synchronous mode)

      @@ -1747,8 +1931,8 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned lo
         Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough.
         Data fragment must be large enough to ensure successful decoding.
        `ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough.
      -  @result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled.
      -           >0 : `srcSize` is too small, please provide at least @result bytes on next attempt.
      +  result  : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled.
      +           >0 : `srcSize` is too small, please provide at least result bytes on next attempt.
                  errorCode, which can be tested using ZSTD_isError().
       
         It fills a ZSTD_frameHeader structure with important information to correctly decode the frame,
      @@ -1767,7 +1951,7 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned lo
       
         The most memory efficient way is to use a round buffer of sufficient size.
         Sufficient size is determined by invoking ZSTD_decodingBufferSize_min(),
      -  which can @return an error code if required value is too large for current system (in 32-bits mode).
      +  which can return an error code if required value is too large for current system (in 32-bits mode).
         In a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one,
         up to the moment there is not enough room left in the buffer to guarantee decoding another full block,
         which maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`.
      @@ -1787,7 +1971,7 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned lo
         ZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue().
         ZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail.
       
      - @result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity).
      +  result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity).
         It can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item.
         It can also be an error code, which can be tested with ZSTD_isError().
       
      @@ -1818,14 +2002,16 @@ typedef struct {
           unsigned headerSize;
           unsigned dictID;
           unsigned checksumFlag;
      +    unsigned _reserved1;
      +    unsigned _reserved2;
       } ZSTD_frameHeader;
       

      -
      size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize);   /**< doesn't consume input */
      +
      ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize);   /**< doesn't consume input */
       /*! ZSTD_getFrameHeader_advanced() :
        *  same as ZSTD_getFrameHeader(),
        *  with added capability to select a format (like ZSTD_f_zstd1_magicless) */
      -size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format);
      -size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize);  /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */
      +ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format);
      +ZSTDLIB_STATIC_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize);  /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */
       

      decode Frame Header, or requires larger `srcSize`. @return : 0, `zfhPtr` is correctly filled, >0, `srcSize` is too small, value is wanted `srcSize` amount, @@ -1845,7 +2031,6 @@ size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long - It is necessary to init context before starting + compression : any ZSTD_compressBegin*() variant, including with dictionary + decompression : any ZSTD_decompressBegin*() variant, including with dictionary - + copyCCtx() and copyDCtx() can be used too - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB + If input is larger than a block size, it's necessary to split input data into multiple blocks + For inputs larger than a single block, consider using regular ZSTD_compress() instead. @@ -1861,10 +2046,36 @@ size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long Use ZSTD_insertBlock() for such a case.


      -

      Raw zstd block functions

      size_t ZSTD_getBlockSize   (const ZSTD_CCtx* cctx);
      -size_t ZSTD_compressBlock  (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
      -size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
      -size_t ZSTD_insertBlock    (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize);  /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */
      +

      Raw zstd block functions

      ZSTDLIB_STATIC_API size_t ZSTD_getBlockSize   (const ZSTD_CCtx* cctx);
      +ZSTDLIB_STATIC_API size_t ZSTD_compressBlock  (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
      +ZSTDLIB_STATIC_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
      +ZSTDLIB_STATIC_API size_t ZSTD_insertBlock    (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize);  /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */
       

      +
      ZSTDLIB_STATIC_API void
      +ZSTD_registerSequenceProducer(
      +  ZSTD_CCtx* cctx,
      +  void* sequenceProducerState,
      +  ZSTD_sequenceProducer_F* sequenceProducer
      +);
      +

      Instruct zstd to use a block-level external sequence producer function. + + The sequenceProducerState must be initialized by the caller, and the caller is + responsible for managing its lifetime. This parameter is sticky across + compressions. It will remain set until the user explicitly resets compression + parameters. + + Sequence producer registration is considered to be an "advanced parameter", + part of the "advanced API". This means it will only have an effect on compression + APIs which respect advanced parameters, such as compress2() and compressStream2(). + Older compression APIs such as compressCCtx(), which predate the introduction of + "advanced parameters", will ignore any external sequence producer setting. + + The sequence producer can be "cleared" by registering a NULL function pointer. This + removes all limitations described above in the "LIMITATIONS" section of the API docs. + + The user is strongly encouraged to read the full API documentation (above) before + calling this function. +


      + diff --git a/src/dependencies/zstd-1.5.0/examples/.gitignore b/src/dependencies/zstd-1.5.4/examples/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/examples/.gitignore rename to src/dependencies/zstd-1.5.4/examples/.gitignore diff --git a/src/dependencies/zstd-1.5.0/examples/Makefile b/src/dependencies/zstd-1.5.4/examples/Makefile similarity index 98% rename from src/dependencies/zstd-1.5.0/examples/Makefile rename to src/dependencies/zstd-1.5.4/examples/Makefile index 8d7361d..31f52d3 100644 --- a/src/dependencies/zstd-1.5.0/examples/Makefile +++ b/src/dependencies/zstd-1.5.4/examples/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/examples/README.md b/src/dependencies/zstd-1.5.4/examples/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/examples/README.md rename to src/dependencies/zstd-1.5.4/examples/README.md diff --git a/src/dependencies/zstd-1.5.0/examples/common.h b/src/dependencies/zstd-1.5.4/examples/common.h similarity index 86% rename from src/dependencies/zstd-1.5.0/examples/common.h rename to src/dependencies/zstd-1.5.4/examples/common.h index 181f6b3..4873e87 100644 --- a/src/dependencies/zstd-1.5.0/examples/common.h +++ b/src/dependencies/zstd-1.5.4/examples/common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -21,6 +21,17 @@ #include // stat #include + +/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */ +#if defined(__GNUC__) +# define UNUSED_ATTR __attribute__((unused)) +#else +# define UNUSED_ATTR +#endif + +#define HEADER_FUNCTION static UNUSED_ATTR + + /* * Define the returned error code from utility functions. */ @@ -57,7 +68,7 @@ typedef enum { * Check the zstd error code and die if an error occurred after printing a * message. */ -#define CHECK_ZSTD(fn, ...) \ +#define CHECK_ZSTD(fn) \ do { \ size_t const err = (fn); \ CHECK(!ZSTD_isError(err), "%s", ZSTD_getErrorName(err)); \ @@ -68,7 +79,7 @@ typedef enum { * * @return The size of a given file path. */ -static size_t fsize_orDie(const char *filename) +HEADER_FUNCTION size_t fsize_orDie(const char *filename) { struct stat st; if (stat(filename, &st) != 0) { @@ -96,7 +107,7 @@ static size_t fsize_orDie(const char *filename) * @return If successful this function will return a FILE pointer to an * opened file otherwise it sends an error to stderr and exits. */ -static FILE* fopen_orDie(const char *filename, const char *instruction) +HEADER_FUNCTION FILE* fopen_orDie(const char *filename, const char *instruction) { FILE* const inFile = fopen(filename, instruction); if (inFile) return inFile; @@ -108,7 +119,7 @@ static FILE* fopen_orDie(const char *filename, const char *instruction) /*! fclose_orDie() : * Close an opened file using given FILE pointer. */ -static void fclose_orDie(FILE* file) +HEADER_FUNCTION void fclose_orDie(FILE* file) { if (!fclose(file)) { return; }; /* error */ @@ -123,7 +134,7 @@ static void fclose_orDie(FILE* file) * * @return The number of bytes read. */ -static size_t fread_orDie(void* buffer, size_t sizeToRead, FILE* file) +HEADER_FUNCTION size_t fread_orDie(void* buffer, size_t sizeToRead, FILE* file) { size_t const readSize = fread(buffer, 1, sizeToRead, file); if (readSize == sizeToRead) return readSize; /* good */ @@ -143,7 +154,7 @@ static size_t fread_orDie(void* buffer, size_t sizeToRead, FILE* file) * * @return The number of bytes written. */ -static size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file) +HEADER_FUNCTION size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file) { size_t const writtenSize = fwrite(buffer, 1, sizeToWrite, file); if (writtenSize == sizeToWrite) return sizeToWrite; /* good */ @@ -159,7 +170,7 @@ static size_t fwrite_orDie(const void* buffer, size_t sizeToWrite, FILE* file) * cated memory. If there is an error, this function will send that * error to stderr and exit. */ -static void* malloc_orDie(size_t size) +HEADER_FUNCTION void* malloc_orDie(size_t size) { void* const buff = malloc(size); if (buff) return buff; @@ -177,7 +188,7 @@ static void* malloc_orDie(size_t size) * @return If successful this function will load file into buffer and * return file size, otherwise it will printout an error to stderr and exit. */ -static size_t loadFile_orDie(const char* fileName, void* buffer, size_t bufferSize) +HEADER_FUNCTION size_t loadFile_orDie(const char* fileName, void* buffer, size_t bufferSize) { size_t const fileSize = fsize_orDie(fileName); CHECK(fileSize <= bufferSize, "File too large!"); @@ -201,7 +212,8 @@ static size_t loadFile_orDie(const char* fileName, void* buffer, size_t bufferSi * @return If successful this function will return buffer and bufferSize(=fileSize), * otherwise it will printout an error to stderr and exit. */ -static void* mallocAndLoadFile_orDie(const char* fileName, size_t* bufferSize) { +HEADER_FUNCTION void* mallocAndLoadFile_orDie(const char* fileName, size_t* bufferSize) +{ size_t const fileSize = fsize_orDie(fileName); *bufferSize = fileSize; void* const buffer = malloc_orDie(*bufferSize); @@ -217,7 +229,7 @@ static void* mallocAndLoadFile_orDie(const char* fileName, size_t* bufferSize) { * Note: This function will send an error to stderr and exit if it * cannot write to a given file. */ -static void saveFile_orDie(const char* fileName, const void* buff, size_t buffSize) +HEADER_FUNCTION void saveFile_orDie(const char* fileName, const void* buff, size_t buffSize) { FILE* const oFile = fopen_orDie(fileName, "wb"); size_t const wSize = fwrite(buff, 1, buffSize, oFile); diff --git a/src/dependencies/zstd-1.5.0/examples/dictionary_compression.c b/src/dependencies/zstd-1.5.4/examples/dictionary_compression.c similarity index 85% rename from src/dependencies/zstd-1.5.0/examples/dictionary_compression.c rename to src/dependencies/zstd-1.5.4/examples/dictionary_compression.c index 0eee650..83edc1c 100644 --- a/src/dependencies/zstd-1.5.0/examples/dictionary_compression.c +++ b/src/dependencies/zstd-1.5.4/examples/dictionary_compression.c @@ -1,12 +1,22 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. - */ +**/ + +/* This example deals with Dictionary compression, + * its counterpart is `examples/dictionary_decompression.c` . + * These examples presume that a dictionary already exists. + * The main method to create a dictionary is `zstd --train`, + * look at the CLI documentation for details. + * Another possible method is to employ dictionary training API, + * published in `lib/zdict.h` . +**/ + #include // printf #include // free #include // memset, strcat @@ -14,7 +24,7 @@ #include "common.h" // Helper functions, CHECK(), and CHECK_ZSTD() /* createDict() : - `dictFileName` is supposed to have been created using `zstd --train` */ +** `dictFileName` is supposed already created using `zstd --train` */ static ZSTD_CDict* createCDict_orDie(const char* dictFileName, int cLevel) { size_t dictSize; diff --git a/src/dependencies/zstd-1.5.0/examples/dictionary_decompression.c b/src/dependencies/zstd-1.5.4/examples/dictionary_decompression.c similarity index 98% rename from src/dependencies/zstd-1.5.0/examples/dictionary_decompression.c rename to src/dependencies/zstd-1.5.4/examples/dictionary_decompression.c index 107cfc1..e6c9999 100644 --- a/src/dependencies/zstd-1.5.0/examples/dictionary_decompression.c +++ b/src/dependencies/zstd-1.5.4/examples/dictionary_decompression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/examples/multiple_simple_compression.c b/src/dependencies/zstd-1.5.4/examples/multiple_simple_compression.c similarity index 98% rename from src/dependencies/zstd-1.5.0/examples/multiple_simple_compression.c rename to src/dependencies/zstd-1.5.4/examples/multiple_simple_compression.c index 5d2a28f..bf77ca1 100644 --- a/src/dependencies/zstd-1.5.0/examples/multiple_simple_compression.c +++ b/src/dependencies/zstd-1.5.4/examples/multiple_simple_compression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/examples/multiple_streaming_compression.c b/src/dependencies/zstd-1.5.4/examples/multiple_streaming_compression.c similarity index 98% rename from src/dependencies/zstd-1.5.0/examples/multiple_streaming_compression.c rename to src/dependencies/zstd-1.5.4/examples/multiple_streaming_compression.c index d4efc8e..b12ad03 100644 --- a/src/dependencies/zstd-1.5.0/examples/multiple_streaming_compression.c +++ b/src/dependencies/zstd-1.5.4/examples/multiple_streaming_compression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/examples/simple_compression.c b/src/dependencies/zstd-1.5.4/examples/simple_compression.c similarity index 97% rename from src/dependencies/zstd-1.5.0/examples/simple_compression.c rename to src/dependencies/zstd-1.5.4/examples/simple_compression.c index 27a65b1..7c88072 100644 --- a/src/dependencies/zstd-1.5.0/examples/simple_compression.c +++ b/src/dependencies/zstd-1.5.4/examples/simple_compression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/examples/simple_decompression.c b/src/dependencies/zstd-1.5.4/examples/simple_decompression.c similarity index 97% rename from src/dependencies/zstd-1.5.0/examples/simple_decompression.c rename to src/dependencies/zstd-1.5.4/examples/simple_decompression.c index 59c1fd4..f499156 100644 --- a/src/dependencies/zstd-1.5.0/examples/simple_decompression.c +++ b/src/dependencies/zstd-1.5.4/examples/simple_decompression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/examples/streaming_compression.c b/src/dependencies/zstd-1.5.4/examples/streaming_compression.c similarity index 84% rename from src/dependencies/zstd-1.5.0/examples/streaming_compression.c rename to src/dependencies/zstd-1.5.4/examples/streaming_compression.c index e20bcde..ed0a3a6 100644 --- a/src/dependencies/zstd-1.5.0/examples/streaming_compression.c +++ b/src/dependencies/zstd-1.5.4/examples/streaming_compression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -15,9 +15,12 @@ #include // presumes zstd library is installed #include "common.h" // Helper functions, CHECK(), and CHECK_ZSTD() - -static void compressFile_orDie(const char* fname, const char* outName, int cLevel) +static void compressFile_orDie(const char* fname, const char* outName, int cLevel, + int nbThreads) { + fprintf (stderr, "Starting compression of %s with level %d, using %d threads\n", + fname, cLevel, nbThreads); + /* Open the input and output files. */ FILE* const fin = fopen_orDie(fname, "rb"); FILE* const fout = fopen_orDie(outName, "wb"); @@ -39,7 +42,7 @@ static void compressFile_orDie(const char* fname, const char* outName, int cLeve */ CHECK_ZSTD( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, cLevel) ); CHECK_ZSTD( ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1) ); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 4); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, nbThreads); /* This loop read from the input file, compresses that entire chunk, * and writes all output produced to the output file. @@ -106,19 +109,32 @@ int main(int argc, const char** argv) { const char* const exeName = argv[0]; - if (argc!=2) { + if (argc < 2) { printf("wrong arguments\n"); printf("usage:\n"); - printf("%s FILE\n", exeName); + printf("%s FILE [LEVEL] [THREADS]\n", exeName); return 1; } + int cLevel = 1; + int nbThreads = 4; + + if (argc >= 3) { + cLevel = atoi (argv[2]); + CHECK(cLevel != 0, "can't parse LEVEL!"); + } + + if (argc >= 4) { + nbThreads = atoi (argv[3]); + CHECK(nbThreads != 0, "can't parse THREADS!"); + } + const char* const inFilename = argv[1]; char* const outFilename = createOutFilename_orDie(inFilename); - compressFile_orDie(inFilename, outFilename, 1); + compressFile_orDie(inFilename, outFilename, cLevel, nbThreads); free(outFilename); /* not strictly required, since program execution stops there, - * but some static analyzer main complain otherwise */ + * but some static analyzer may complain otherwise */ return 0; } diff --git a/src/dependencies/zstd-1.5.0/examples/streaming_compression_thread_pool.c b/src/dependencies/zstd-1.5.4/examples/streaming_compression_thread_pool.c similarity index 94% rename from src/dependencies/zstd-1.5.0/examples/streaming_compression_thread_pool.c rename to src/dependencies/zstd-1.5.4/examples/streaming_compression_thread_pool.c index 5a6551b..a1a0241 100644 --- a/src/dependencies/zstd-1.5.0/examples/streaming_compression_thread_pool.c +++ b/src/dependencies/zstd-1.5.4/examples/streaming_compression_thread_pool.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Martin Liska, SUSE, Facebook, Inc. + * Copyright (c) Martin Liska, SUSE, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -28,8 +28,10 @@ typedef struct compress_args static void *compressFile_orDie(void *data) { + const int nbThreads = 16; + compress_args_t *args = (compress_args_t *)data; - fprintf (stderr, "Starting compression of %s with level %d\n", args->fname, args->cLevel); + fprintf (stderr, "Starting compression of %s with level %d, using %d threads\n", args->fname, args->cLevel, nbThreads); /* Open the input and output files. */ FILE* const fin = fopen_orDie(args->fname, "rb"); FILE* const fout = fopen_orDie(args->outName, "wb"); @@ -56,9 +58,9 @@ static void *compressFile_orDie(void *data) */ CHECK_ZSTD( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, args->cLevel) ); CHECK_ZSTD( ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1) ); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 16); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, nbThreads); - /* This loop read from the input file, compresses that entire chunk, + /* This loop reads from the input file, compresses that entire chunk, * and writes all output produced to the output file. */ size_t const toRead = buffInSize; diff --git a/src/dependencies/zstd-1.5.0/examples/streaming_decompression.c b/src/dependencies/zstd-1.5.4/examples/streaming_decompression.c similarity index 98% rename from src/dependencies/zstd-1.5.0/examples/streaming_decompression.c rename to src/dependencies/zstd-1.5.4/examples/streaming_decompression.c index 6dc4c22..95fa112 100644 --- a/src/dependencies/zstd-1.5.0/examples/streaming_decompression.c +++ b/src/dependencies/zstd-1.5.4/examples/streaming_decompression.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/examples/streaming_memory_usage.c b/src/dependencies/zstd-1.5.4/examples/streaming_memory_usage.c similarity index 99% rename from src/dependencies/zstd-1.5.0/examples/streaming_memory_usage.c rename to src/dependencies/zstd-1.5.4/examples/streaming_memory_usage.c index a5219ef..957acb6 100644 --- a/src/dependencies/zstd-1.5.0/examples/streaming_memory_usage.c +++ b/src/dependencies/zstd-1.5.4/examples/streaming_memory_usage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/.gitignore b/src/dependencies/zstd-1.5.4/lib/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/lib/.gitignore rename to src/dependencies/zstd-1.5.4/lib/.gitignore diff --git a/src/dependencies/zstd-1.5.0/lib/BUCK b/src/dependencies/zstd-1.5.4/lib/BUCK similarity index 100% rename from src/dependencies/zstd-1.5.0/lib/BUCK rename to src/dependencies/zstd-1.5.4/lib/BUCK diff --git a/src/dependencies/zstd-1.5.0/lib/Makefile b/src/dependencies/zstd-1.5.4/lib/Makefile similarity index 63% rename from src/dependencies/zstd-1.5.0/lib/Makefile rename to src/dependencies/zstd-1.5.4/lib/Makefile index 9109476..a4cf61a 100644 --- a/src/dependencies/zstd-1.5.0/lib/Makefile +++ b/src/dependencies/zstd-1.5.4/lib/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -8,110 +8,13 @@ # You may select, at your option, one of the above-listed licenses. # ################################################################ -# Note: by default, the static library is built single-threaded and dynamic library is built -# multi-threaded. It is possible to force multi or single threaded builds by appending -# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded). -.PHONY: default -default: lib-release - -# define silent mode as default (verbose mode with V=1 or VERBOSE=1) -$(V)$(VERBOSE).SILENT: - -# When cross-compiling from linux to windows, -# one might need to specify TARGET_SYSTEM as "Windows." -# Building from Fedora fails without it. -# (but Ubuntu and Debian don't need to set anything) -TARGET_SYSTEM ?= $(OS) - -# Version numbers -LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` -LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` -LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` -LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) -LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) -LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) -LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) -LIBVER := $(shell echo $(LIBVER_SCRIPT)) -VERSION?= $(LIBVER) -CCVER := $(shell $(CC) --version) - -# ZSTD_LIB_MINIFY is a helper variable that -# configures a bunch of other variables to space-optimized defaults. -ZSTD_LIB_MINIFY ?= 0 -ifneq ($(ZSTD_LIB_MINIFY), 0) - HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0) - ZSTD_LEGACY_SUPPORT ?= 0 - ZSTD_LIB_DEPRECATED ?= 0 - HUF_FORCE_DECOMPRESS_X1 ?= 1 - ZSTD_FORCE_DECOMPRESS_SHORT ?= 1 - ZSTD_NO_INLINE ?= 1 - ZSTD_STRIP_ERROR_STRINGS ?= 1 -ifneq ($(HAVE_CC_OZ), 0) - # Some compilers (clang) support an even more space-optimized setting. - CFLAGS += -Oz -else - CFLAGS += -Os -endif - CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \ - -DDYNAMIC_BMI2=0 -DNDEBUG -else - CFLAGS += -O3 -endif - -DEBUGLEVEL ?= 0 -CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL) -ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed - CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting -endif -DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef -Wpointer-arith \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls -Wmissing-prototypes -Wc++-compat -CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) -FLAGS = $(CPPFLAGS) $(CFLAGS) - -CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded -LDFLAGS_DYNLIB = -pthread -CPPFLAGS_STATLIB = # static library build defaults to single-threaded - -HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) -GREP_OPTIONS ?= -ifeq ($HAVE_COLORNEVER, 1) - GREP_OPTIONS += --color=never -endif -GREP = grep $(GREP_OPTIONS) -SED_ERE_OPT ?= -E - -ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c)) -ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c)) -ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c)) -ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c)) -ZDEPR_FILES := $(sort $(wildcard deprecated/*.c)) -ZSTD_FILES := $(ZSTDCOMMON_FILES) - -ifeq ($(findstring GCC,$(CCVER)),GCC) -decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize -endif - # Modules ZSTD_LIB_COMPRESSION ?= 1 ZSTD_LIB_DECOMPRESSION ?= 1 ZSTD_LIB_DICTBUILDER ?= 1 ZSTD_LIB_DEPRECATED ?= 0 -# Legacy support -ZSTD_LEGACY_SUPPORT ?= 5 -ZSTD_LEGACY_MULTITHREADED_API ?= 0 - -# Build size optimizations -HUF_FORCE_DECOMPRESS_X1 ?= 0 -HUF_FORCE_DECOMPRESS_X2 ?= 0 -ZSTD_FORCE_DECOMPRESS_SHORT ?= 0 -ZSTD_FORCE_DECOMPRESS_LONG ?= 0 -ZSTD_NO_INLINE ?= 0 -ZSTD_STRIP_ERROR_STRINGS ?= 0 - +# Input variables for libzstd.mk ifeq ($(ZSTD_LIB_COMPRESSION), 0) ZSTD_LIB_DICTBUILDER = 0 ZSTD_LIB_DEPRECATED = 0 @@ -122,86 +25,46 @@ ifeq ($(ZSTD_LIB_DECOMPRESSION), 0) ZSTD_LIB_DEPRECATED = 0 endif +include libzstd.mk + +ZSTD_FILES := $(ZSTD_COMMON_FILES) $(ZSTD_LEGACY_FILES) + ifneq ($(ZSTD_LIB_COMPRESSION), 0) - ZSTD_FILES += $(ZSTDCOMP_FILES) + ZSTD_FILES += $(ZSTD_COMPRESS_FILES) endif ifneq ($(ZSTD_LIB_DECOMPRESSION), 0) - ZSTD_FILES += $(ZSTDDECOMP_FILES) + ZSTD_FILES += $(ZSTD_DECOMPRESS_FILES) endif ifneq ($(ZSTD_LIB_DEPRECATED), 0) - ZSTD_FILES += $(ZDEPR_FILES) + ZSTD_FILES += $(ZSTD_DEPRECATED_FILES) endif ifneq ($(ZSTD_LIB_DICTBUILDER), 0) - ZSTD_FILES += $(ZDICT_FILES) + ZSTD_FILES += $(ZSTD_DICTBUILDER_FILES) endif -ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0) - CFLAGS += -DHUF_FORCE_DECOMPRESS_X1 -endif - -ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0) - CFLAGS += -DHUF_FORCE_DECOMPRESS_X2 -endif - -ifneq ($(ZSTD_FORCE_DECOMPRESS_SHORT), 0) - CFLAGS += -DZSTD_FORCE_DECOMPRESS_SHORT -endif - -ifneq ($(ZSTD_FORCE_DECOMPRESS_LONG), 0) - CFLAGS += -DZSTD_FORCE_DECOMPRESS_LONG -endif - -ifneq ($(ZSTD_NO_INLINE), 0) - CFLAGS += -DZSTD_NO_INLINE -endif - -ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0) - CFLAGS += -DZSTD_STRIP_ERROR_STRINGS -endif - -ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0) - CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API -endif - -ifneq ($(ZSTD_LEGACY_SUPPORT), 0) -ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0) - ZSTD_FILES += $(shell ls legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]') -endif -endif -CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) - ZSTD_LOCAL_SRC := $(notdir $(ZSTD_FILES)) -ZSTD_LOCAL_OBJ := $(ZSTD_LOCAL_SRC:.c=.o) +ZSTD_LOCAL_OBJ0 := $(ZSTD_LOCAL_SRC:.c=.o) +ZSTD_LOCAL_OBJ := $(ZSTD_LOCAL_OBJ0:.S=.o) -ZSTD_SUBDIR := common compress decompress dictBuilder legacy deprecated -vpath %.c $(ZSTD_SUBDIR) +VERSION := $(ZSTD_VERSION) -UNAME := $(shell uname) +# Note: by default, the static library is built single-threaded and dynamic library is built +# multi-threaded. It is possible to force multi or single threaded builds by appending +# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded). +.PHONY: default +default: lib-release -ifndef BUILD_DIR -ifeq ($(UNAME), Darwin) - ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0) - HASH ?= md5 - endif -else ifeq ($(UNAME), FreeBSD) - HASH ?= gmd5sum -else ifeq ($(UNAME), NetBSD) - HASH ?= md5 -n -else ifeq ($(UNAME), OpenBSD) - HASH ?= md5 +CPPFLAGS_DYNLIB += -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded +LDFLAGS_DYNLIB += -pthread +CPPFLAGS_STATLIB += # static library build defaults to single-threaded + + +ifeq ($(findstring GCC,$(CCVER)),GCC) +decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize endif -HASH ?= md5sum - -HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " ) -HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0) -ifeq ($(HAVE_HASH),0) - $(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags) - BUILD_DIR := obj/generic_noconf -endif -endif # BUILD_DIR # macOS linker doesn't support -soname, and use different extension @@ -212,19 +75,16 @@ ifeq ($(UNAME), Darwin) SHARED_EXT_VER = $(LIBVER).$(SHARED_EXT) SONAME_FLAGS = -install_name $(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR) -compatibility_version $(LIBVER_MAJOR) -current_version $(LIBVER) else - SONAME_FLAGS = -Wl,-soname=libzstd.$(SHARED_EXT).$(LIBVER_MAJOR) + ifeq ($(UNAME), AIX) + SONAME_FLAGS = + else + SONAME_FLAGS = -Wl,-soname=libzstd.$(SHARED_EXT).$(LIBVER_MAJOR) + endif SHARED_EXT = so SHARED_EXT_MAJOR = $(SHARED_EXT).$(LIBVER_MAJOR) SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) endif -SET_CACHE_DIRECTORY = \ - +$(MAKE) --no-print-directory $@ \ - BUILD_DIR=obj/$(HASH_DIR) \ - CPPFLAGS="$(CPPFLAGS)" \ - CFLAGS="$(CFLAGS)" \ - LDFLAGS="$(LDFLAGS)" - .PHONY: all all: lib @@ -233,6 +93,13 @@ all: lib .PHONY: libzstd.a # must be run every time libzstd.a: CPPFLAGS += $(CPPFLAGS_STATLIB) +SET_CACHE_DIRECTORY = \ + +$(MAKE) --no-print-directory $@ \ + BUILD_DIR=obj/$(HASH_DIR) \ + CPPFLAGS="$(CPPFLAGS)" \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" + ifndef BUILD_DIR # determine BUILD_DIR from compilation flags @@ -343,6 +210,14 @@ $(ZSTD_STATLIB_DIR)/%.o : %.c $(ZSTD_STATLIB_DIR)/%.d | $(ZSTD_STATLIB_DIR) @echo CC $@ $(COMPILE.c) $(DEPFLAGS) $(ZSTD_STATLIB_DIR)/$*.d $(OUTPUT_OPTION) $< +$(ZSTD_DYNLIB_DIR)/%.o : %.S | $(ZSTD_DYNLIB_DIR) + @echo AS $@ + $(COMPILE.S) $(OUTPUT_OPTION) $< + +$(ZSTD_STATLIB_DIR)/%.o : %.S | $(ZSTD_STATLIB_DIR) + @echo AS $@ + $(COMPILE.S) $(OUTPUT_OPTION) $< + MKDIR ?= mkdir $(BUILD_DIR) $(ZSTD_DYNLIB_DIR) $(ZSTD_STATLIB_DIR): $(MKDIR) -p $@ @@ -374,9 +249,9 @@ clean: #----------------------------------------------------------------------------- # make install is validated only for below listed environments #----------------------------------------------------------------------------- -ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku)) +ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX)) -all: libzstd.pc +lib: libzstd.pc HAS_EXPLICIT_EXEC_PREFIX := $(if $(or $(EXEC_PREFIX),$(exec_prefix)),1,) @@ -421,16 +296,16 @@ INSTALL_PROGRAM ?= $(INSTALL) INSTALL_DATA ?= $(INSTALL) -m 644 -libzstd.pc: libzstd.pc: libzstd.pc.in @echo creating pkgconfig - @sed $(SED_ERE_OPT) \ + @sed \ -e 's|@PREFIX@|$(PREFIX)|' \ -e 's|@EXEC_PREFIX@|$(PCEXEC_PREFIX)|' \ - -e 's|@INCLUDEDIR@|$(PCINCPREFIX)$(PCINCDIR)|' \ - -e 's|@LIBDIR@|$(PCLIBPREFIX)$(PCLIBDIR)|' \ - -e 's|@VERSION@|$(VERSION)|' \ - $< >$@ + -e 's|@INCLUDEDIR@|$(PCINCPREFIX)$(PCINCDIR)|' \ + -e 's|@LIBDIR@|$(PCLIBPREFIX)$(PCLIBDIR)|' \ + -e 's|@VERSION@|$(VERSION)|' \ + -e 's|@LIBS_PRIVATE@|$(LDFLAGS_DYNLIB)|' \ + $< >$@ .PHONY: install install: install-pc install-static install-shared install-includes diff --git a/src/dependencies/zstd-1.5.0/lib/README.md b/src/dependencies/zstd-1.5.4/lib/README.md similarity index 91% rename from src/dependencies/zstd-1.5.0/lib/README.md rename to src/dependencies/zstd-1.5.4/lib/README.md index f781ac5..c3b5d18 100644 --- a/src/dependencies/zstd-1.5.0/lib/README.md +++ b/src/dependencies/zstd-1.5.4/lib/README.md @@ -91,7 +91,7 @@ The file structure is designed to make this selection manually achievable for an `ZSTD_LIB_COMPRESSION, ZSTD_LIB_DECOMPRESSION`, `ZSTD_LIB_DICTBUILDER`, and `ZSTD_LIB_DEPRECATED` as `0` to forgo compilation of the corresponding features. This will also disable compilation of all - dependencies (eg. `ZSTD_LIB_COMPRESSION=0` will also disable + dependencies (e.g. `ZSTD_LIB_COMPRESSION=0` will also disable dictBuilder). - There are a number of options that can help minimize the binary size of @@ -125,7 +125,7 @@ The file structure is designed to make this selection manually achievable for an `ZSTD_getErrorName` (implied by `ZSTD_LIB_MINIFY`). Finally, when integrating into your application, make sure you're doing link- - time optimation and unused symbol garbage collection (via some combination of, + time optimization and unused symbol garbage collection (via some combination of, e.g., `-flto`, `-ffat-lto-objects`, `-fuse-linker-plugin`, `-ffunction-sections`, `-fdata-sections`, `-fmerge-all-constants`, `-Wl,--gc-sections`, `-Wl,-z,norelro`, and an archiver that understands @@ -155,6 +155,19 @@ The file structure is designed to make this selection manually achievable for an - The build macro `ZSTD_NO_INTRINSICS` can be defined to disable all explicit intrinsics. Compiler builtins are still used. +- The build macro `ZSTD_DECODER_INTERNAL_BUFFER` can be set to control + the amount of extra memory used during decompression to store literals. + This defaults to 64kB. Reducing this value reduces the memory footprint of + `ZSTD_DCtx` decompression contexts, + but might also result in a small decompression speed cost. + +- The C compiler macros `ZSTDLIB_VISIBLE`, `ZSTDERRORLIB_VISIBLE` and `ZDICTLIB_VISIBLE` + can be overridden to control the visibility of zstd's API. Additionally, + `ZSTDLIB_STATIC_API` and `ZDICTLIB_STATIC_API` can be overridden to control the visibility + of zstd's static API. Specifically, it can be set to `ZSTDLIB_HIDDEN` to hide the symbols + from the shared library. These macros default to `ZSTDLIB_VISIBILITY`, + `ZSTDERRORLIB_VSIBILITY`, and `ZDICTLIB_VISIBILITY` if unset, for backwards compatibility + with the old macro names. #### Windows : using MinGW+MSYS to create DLL diff --git a/src/dependencies/zstd-1.5.4/lib/common/bits.h b/src/dependencies/zstd-1.5.4/lib/common/bits.h new file mode 100644 index 0000000..7939f3d --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/common/bits.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_BITS_H +#define ZSTD_BITS_H + +#include "mem.h" + +MEM_STATIC unsigned ZSTD_countTrailingZeros32_fallback(U32 val) +{ + assert(val != 0); + { + static const int DeBruijnBytePos[32] = {0, 1, 28, 2, 29, 14, 24, 3, + 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, + 26, 12, 18, 6, 11, 5, 10, 9}; + return DeBruijnBytePos[((U32) ((val & -(S32) val) * 0x077CB531U)) >> 27]; + } +} + +MEM_STATIC unsigned ZSTD_countTrailingZeros32(U32 val) +{ + assert(val != 0); +# if defined(_MSC_VER) +# if STATIC_BMI2 == 1 + return _tzcnt_u32(val); +# else + if (val != 0) { + unsigned long r; + _BitScanForward(&r, val); + return (unsigned)r; + } else { + /* Should not reach this code path */ + __assume(0); + } +# endif +# elif defined(__GNUC__) && (__GNUC__ >= 4) + return (unsigned)__builtin_ctz(val); +# else + return ZSTD_countTrailingZeros32_fallback(val); +# endif +} + +MEM_STATIC unsigned ZSTD_countLeadingZeros32_fallback(U32 val) { + assert(val != 0); + { + static const U32 DeBruijnClz[32] = {0, 9, 1, 10, 13, 21, 2, 29, + 11, 14, 16, 18, 22, 25, 3, 30, + 8, 12, 20, 28, 15, 17, 24, 7, + 19, 27, 23, 6, 26, 5, 4, 31}; + val |= val >> 1; + val |= val >> 2; + val |= val >> 4; + val |= val >> 8; + val |= val >> 16; + return 31 - DeBruijnClz[(val * 0x07C4ACDDU) >> 27]; + } +} + +MEM_STATIC unsigned ZSTD_countLeadingZeros32(U32 val) +{ + assert(val != 0); +# if defined(_MSC_VER) +# if STATIC_BMI2 == 1 + return _lzcnt_u32(val); +# else + if (val != 0) { + unsigned long r; + _BitScanReverse(&r, val); + return (unsigned)(31 - r); + } else { + /* Should not reach this code path */ + __assume(0); + } +# endif +# elif defined(__GNUC__) && (__GNUC__ >= 4) + return (unsigned)__builtin_clz(val); +# else + return ZSTD_countLeadingZeros32_fallback(val); +# endif +} + +MEM_STATIC unsigned ZSTD_countTrailingZeros64(U64 val) +{ + assert(val != 0); +# if defined(_MSC_VER) && defined(_WIN64) +# if STATIC_BMI2 == 1 + return _tzcnt_u64(val); +# else + if (val != 0) { + unsigned long r; + _BitScanForward64(&r, val); + return (unsigned)r; + } else { + /* Should not reach this code path */ + __assume(0); + } +# endif +# elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__) + return (unsigned)__builtin_ctzll(val); +# else + { + U32 mostSignificantWord = (U32)(val >> 32); + U32 leastSignificantWord = (U32)val; + if (leastSignificantWord == 0) { + return 32 + ZSTD_countTrailingZeros32(mostSignificantWord); + } else { + return ZSTD_countTrailingZeros32(leastSignificantWord); + } + } +# endif +} + +MEM_STATIC unsigned ZSTD_countLeadingZeros64(U64 val) +{ + assert(val != 0); +# if defined(_MSC_VER) && defined(_WIN64) +# if STATIC_BMI2 == 1 + return _lzcnt_u64(val); +# else + if (val != 0) { + unsigned long r; + _BitScanReverse64(&r, val); + return (unsigned)(63 - r); + } else { + /* Should not reach this code path */ + __assume(0); + } +# endif +# elif defined(__GNUC__) && (__GNUC__ >= 4) + return (unsigned)(__builtin_clzll(val)); +# else + { + U32 mostSignificantWord = (U32)(val >> 32); + U32 leastSignificantWord = (U32)val; + if (mostSignificantWord == 0) { + return 32 + ZSTD_countLeadingZeros32(leastSignificantWord); + } else { + return ZSTD_countLeadingZeros32(mostSignificantWord); + } + } +# endif +} + +MEM_STATIC unsigned ZSTD_NbCommonBytes(size_t val) +{ + if (MEM_isLittleEndian()) { + if (MEM_64bits()) { + return ZSTD_countTrailingZeros64((U64)val) >> 3; + } else { + return ZSTD_countTrailingZeros32((U32)val) >> 3; + } + } else { /* Big Endian CPU */ + if (MEM_64bits()) { + return ZSTD_countLeadingZeros64((U64)val) >> 3; + } else { + return ZSTD_countLeadingZeros32((U32)val) >> 3; + } + } +} + +MEM_STATIC unsigned ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus */ +{ + assert(val != 0); + return 31 - ZSTD_countLeadingZeros32(val); +} + +#endif /* ZSTD_BITS_H */ diff --git a/src/dependencies/zstd-1.5.0/lib/common/bitstream.h b/src/dependencies/zstd-1.5.4/lib/common/bitstream.h similarity index 89% rename from src/dependencies/zstd-1.5.0/lib/common/bitstream.h rename to src/dependencies/zstd-1.5.4/lib/common/bitstream.h index 2e5a933..db1b4cf 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/bitstream.h +++ b/src/dependencies/zstd-1.5.4/lib/common/bitstream.h @@ -1,7 +1,7 @@ /* ****************************************************************** * bitstream * Part of FSE library - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy @@ -30,14 +30,15 @@ extern "C" { #include "compiler.h" /* UNLIKELY() */ #include "debug.h" /* assert(), DEBUGLOG(), RAWLOG() */ #include "error_private.h" /* error codes and messages */ +#include "bits.h" /* ZSTD_highbit32 */ /*========================================= * Target specific =========================================*/ #ifndef ZSTD_NO_INTRINSICS -# if defined(__BMI__) && defined(__GNUC__) -# include /* support for bextr (experimental) */ +# if (defined(__BMI__) || defined(__BMI2__)) && defined(__GNUC__) +# include /* support for bextr (experimental)/bzhi */ # elif defined(__ICCARM__) # include # endif @@ -132,42 +133,6 @@ MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC); MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits); /* faster, but works only if nbBits >= 1 */ - - -/*-************************************************************** -* Internal functions -****************************************************************/ -MEM_STATIC unsigned BIT_highbit32 (U32 val) -{ - assert(val != 0); - { -# if defined(_MSC_VER) /* Visual */ -# if STATIC_BMI2 == 1 - return _lzcnt_u32(val) ^ 31; -# else - unsigned long r = 0; - return _BitScanReverse(&r, val) ? (unsigned)r : 0; -# endif -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ - return __builtin_clz (val) ^ 31; -# elif defined(__ICCARM__) /* IAR Intrinsic */ - return 31 - __CLZ(val); -# else /* Software version */ - static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, - 11, 14, 16, 18, 22, 25, 3, 30, - 8, 12, 20, 28, 15, 17, 24, 7, - 19, 27, 23, 6, 26, 5, 4, 31 }; - U32 v = val; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - return DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27]; -# endif - } -} - /*===== Local Constants =====*/ static const unsigned BIT_mask[] = { 0, 1, 3, 7, 0xF, 0x1F, @@ -197,6 +162,16 @@ MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC, return 0; } +MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits) +{ +#if defined(STATIC_BMI2) && STATIC_BMI2 == 1 && !defined(ZSTD_NO_INTRINSICS) + return _bzhi_u64(bitContainer, nbBits); +#else + assert(nbBits < BIT_MASK_SIZE); + return bitContainer & BIT_mask[nbBits]; +#endif +} + /*! BIT_addBits() : * can add up to 31 bits into `bitC`. * Note : does not check for register overflow ! */ @@ -206,7 +181,7 @@ MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC, DEBUG_STATIC_ASSERT(BIT_MASK_SIZE == 32); assert(nbBits < BIT_MASK_SIZE); assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8); - bitC->bitContainer |= (value & BIT_mask[nbBits]) << bitC->bitPos; + bitC->bitContainer |= BIT_getLowerBits(value, nbBits) << bitC->bitPos; bitC->bitPos += nbBits; } @@ -285,7 +260,7 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si bitD->ptr = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer); bitD->bitContainer = MEM_readLEST(bitD->ptr); { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1]; - bitD->bitsConsumed = lastByte ? 8 - BIT_highbit32(lastByte) : 0; /* ensures bitsConsumed is always set */ + bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0; /* ensures bitsConsumed is always set */ if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ } } else { bitD->ptr = bitD->start; @@ -293,27 +268,27 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si switch(srcSize) { case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16); - /* fall-through */ + ZSTD_FALLTHROUGH; case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24); - /* fall-through */ + ZSTD_FALLTHROUGH; case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32); - /* fall-through */ + ZSTD_FALLTHROUGH; case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24; - /* fall-through */ + ZSTD_FALLTHROUGH; case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16; - /* fall-through */ + ZSTD_FALLTHROUGH; case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) << 8; - /* fall-through */ + ZSTD_FALLTHROUGH; default: break; } { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1]; - bitD->bitsConsumed = lastByte ? 8 - BIT_highbit32(lastByte) : 0; + bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0; if (lastByte == 0) return ERROR(corruption_detected); /* endMark not present */ } bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8; @@ -332,16 +307,15 @@ MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getMiddleBits(size_t bitContainer, U32 c U32 const regMask = sizeof(bitContainer)*8 - 1; /* if start > regMask, bitstream is corrupted, and result is undefined */ assert(nbBits < BIT_MASK_SIZE); - return (bitContainer >> (start & regMask)) & BIT_mask[nbBits]; -} - -MEM_STATIC FORCE_INLINE_ATTR size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits) -{ -#if defined(STATIC_BMI2) && STATIC_BMI2 == 1 - return _bzhi_u64(bitContainer, nbBits); + /* x86 transform & ((1 << nbBits) - 1) to bzhi instruction, it is better + * than accessing memory. When bmi2 instruction is not present, we consider + * such cpus old (pre-Haswell, 2013) and their performance is not of that + * importance. + */ +#if defined(__x86_64__) || defined(_M_X86) + return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1); #else - assert(nbBits < BIT_MASK_SIZE); - return bitContainer & BIT_mask[nbBits]; + return (bitContainer >> (start & regMask)) & BIT_mask[nbBits]; #endif } @@ -391,7 +365,7 @@ MEM_STATIC FORCE_INLINE_ATTR size_t BIT_readBits(BIT_DStream_t* bitD, unsigned n } /*! BIT_readBitsFast() : - * unsafe version; only works only if nbBits >= 1 */ + * unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits) { size_t const value = BIT_lookBitsFast(bitD, nbBits); diff --git a/src/dependencies/zstd-1.5.0/lib/common/compiler.h b/src/dependencies/zstd-1.5.4/lib/common/compiler.h similarity index 67% rename from src/dependencies/zstd-1.5.0/lib/common/compiler.h rename to src/dependencies/zstd-1.5.4/lib/common/compiler.h index a951d0a..d4f2f28 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/compiler.h +++ b/src/dependencies/zstd-1.5.4/lib/common/compiler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -11,6 +11,8 @@ #ifndef ZSTD_COMPILER_H #define ZSTD_COMPILER_H +#include "portability_macros.h" + /*-******************************************************* * Compiler specifics *********************************************************/ @@ -40,7 +42,7 @@ /** On MSVC qsort requires that functions passed into it use the __cdecl calling conversion(CC). - This explictly marks such functions as __cdecl so that the code will still compile + This explicitly marks such functions as __cdecl so that the code will still compile if a CC other than __cdecl has been made the default. */ #if defined(_MSC_VER) @@ -92,29 +94,17 @@ /* target attribute */ -#ifndef __has_attribute - #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ -#endif #if defined(__GNUC__) || defined(__ICCARM__) # define TARGET_ATTRIBUTE(target) __attribute__((__target__(target))) #else # define TARGET_ATTRIBUTE(target) #endif -/* Enable runtime BMI2 dispatch based on the CPU. - * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default. +/* Target attribute for BMI2 dynamic dispatch. + * Enable lzcnt, bmi, and bmi2. + * We test for bmi1 & bmi2. lzcnt is included in bmi1. */ -#ifndef DYNAMIC_BMI2 - #if ((defined(__clang__) && __has_attribute(__target__)) \ - || (defined(__GNUC__) \ - && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \ - && (defined(__x86_64__) || defined(_M_X86)) \ - && !defined(__BMI2__) - # define DYNAMIC_BMI2 1 - #else - # define DYNAMIC_BMI2 0 - #endif -#endif +#define BMI2_TARGET_ATTRIBUTE TARGET_ATTRIBUTE("lzcnt,bmi,bmi2") /* prefetch * can be disabled, by declaring NO_PREFETCH build macro */ @@ -150,8 +140,9 @@ } /* vectorization - * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */ -#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) + * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax, + * and some compilers, like Intel ICC and MCST LCC, do not support it at all. */ +#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__LCC__) # if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5) # define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) # else @@ -174,6 +165,12 @@ #define UNLIKELY(x) (x) #endif +#if __has_builtin(__builtin_unreachable) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))) +# define ZSTD_UNREACHABLE { assert(0), __builtin_unreachable(); } +#else +# define ZSTD_UNREACHABLE { assert(0); } +#endif + /* disable warnings */ #ifdef _MSC_VER /* Visual Studio */ # include /* For Visual 2005 */ @@ -190,6 +187,8 @@ # ifdef __AVX2__ //MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2 # define STATIC_BMI2 1 # endif +# elif defined(__BMI2__) && defined(__x86_64__) && defined(__GNUC__) +# define STATIC_BMI2 1 # endif #endif @@ -197,26 +196,103 @@ #define STATIC_BMI2 0 #endif -/* compat. with non-clang compilers */ -#ifndef __has_builtin -# define __has_builtin(x) 0 -#endif - -/* compat. with non-clang compilers */ -#ifndef __has_feature -# define __has_feature(x) 0 -#endif - -/* detects whether we are being compiled under msan */ -#ifndef ZSTD_MEMORY_SANITIZER -# if __has_feature(memory_sanitizer) -# define ZSTD_MEMORY_SANITIZER 1 -# else -# define ZSTD_MEMORY_SANITIZER 0 +/* compile time determination of SIMD support */ +#if !defined(ZSTD_NO_INTRINSICS) +# if defined(__SSE2__) || defined(_M_AMD64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) +# define ZSTD_ARCH_X86_SSE2 +# endif +# if defined(__ARM_NEON) || defined(_M_ARM64) +# define ZSTD_ARCH_ARM_NEON +# endif +# +# if defined(ZSTD_ARCH_X86_SSE2) +# include +# elif defined(ZSTD_ARCH_ARM_NEON) +# include # endif #endif -#if ZSTD_MEMORY_SANITIZER +/* C-language Attributes are added in C23. */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute) +# define ZSTD_HAS_C_ATTRIBUTE(x) __has_c_attribute(x) +#else +# define ZSTD_HAS_C_ATTRIBUTE(x) 0 +#endif + +/* Only use C++ attributes in C++. Some compilers report support for C++ + * attributes when compiling with C. + */ +#if defined(__cplusplus) && defined(__has_cpp_attribute) +# define ZSTD_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define ZSTD_HAS_CPP_ATTRIBUTE(x) 0 +#endif + +/* Define ZSTD_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute. + * - C23: https://en.cppreference.com/w/c/language/attributes/fallthrough + * - CPP17: https://en.cppreference.com/w/cpp/language/attributes/fallthrough + * - Else: __attribute__((__fallthrough__)) + */ +#ifndef ZSTD_FALLTHROUGH +# if ZSTD_HAS_C_ATTRIBUTE(fallthrough) +# define ZSTD_FALLTHROUGH [[fallthrough]] +# elif ZSTD_HAS_CPP_ATTRIBUTE(fallthrough) +# define ZSTD_FALLTHROUGH [[fallthrough]] +# elif __has_attribute(__fallthrough__) +/* Leading semicolon is to satisfy gcc-11 with -pedantic. Without the semicolon + * gcc complains about: a label can only be part of a statement and a declaration is not a statement. + */ +# define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__)) +# else +# define ZSTD_FALLTHROUGH +# endif +#endif + +/*-************************************************************** +* Alignment check +*****************************************************************/ + +/* this test was initially positioned in mem.h, + * but this file is removed (or replaced) for linux kernel + * so it's now hosted in compiler.h, + * which remains valid for both user & kernel spaces. + */ + +#ifndef ZSTD_ALIGNOF +# if defined(__GNUC__) || defined(_MSC_VER) +/* covers gcc, clang & MSVC */ +/* note : this section must come first, before C11, + * due to a limitation in the kernel source generator */ +# define ZSTD_ALIGNOF(T) __alignof(T) + +# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +/* C11 support */ +# include +# define ZSTD_ALIGNOF(T) alignof(T) + +# else +/* No known support for alignof() - imperfect backup */ +# define ZSTD_ALIGNOF(T) (sizeof(void*) < sizeof(T) ? sizeof(void*) : sizeof(T)) + +# endif +#endif /* ZSTD_ALIGNOF */ + +/*-************************************************************** +* Sanitizer +*****************************************************************/ + +/* Issue #3240 reports an ASAN failure on an llvm-mingw build. Out of an + * abundance of caution, disable our custom poisoning on mingw. */ +#ifdef __MINGW32__ +#ifndef ZSTD_ASAN_DONT_POISON_WORKSPACE +#define ZSTD_ASAN_DONT_POISON_WORKSPACE 1 +#endif +#ifndef ZSTD_MSAN_DONT_POISON_WORKSPACE +#define ZSTD_MSAN_DONT_POISON_WORKSPACE 1 +#endif +#endif + +#if ZSTD_MEMORY_SANITIZER && !defined(ZSTD_MSAN_DONT_POISON_WORKSPACE) /* Not all platforms that support msan provide sanitizers/msan_interface.h. * We therefore declare the functions we need ourselves, rather than trying to * include the header file... */ @@ -237,18 +313,7 @@ void __msan_poison(const volatile void *a, size_t size); intptr_t __msan_test_shadow(const volatile void *x, size_t size); #endif -/* detects whether we are being compiled under asan */ -#ifndef ZSTD_ADDRESS_SANITIZER -# if __has_feature(address_sanitizer) -# define ZSTD_ADDRESS_SANITIZER 1 -# elif defined(__SANITIZE_ADDRESS__) -# define ZSTD_ADDRESS_SANITIZER 1 -# else -# define ZSTD_ADDRESS_SANITIZER 0 -# endif -#endif - -#if ZSTD_ADDRESS_SANITIZER +#if ZSTD_ADDRESS_SANITIZER && !defined(ZSTD_ASAN_DONT_POISON_WORKSPACE) /* Not all platforms that support asan provide sanitizers/asan_interface.h. * We therefore declare the functions we need ourselves, rather than trying to * include the header file... */ diff --git a/src/dependencies/zstd-1.5.0/lib/common/cpu.h b/src/dependencies/zstd-1.5.4/lib/common/cpu.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/common/cpu.h rename to src/dependencies/zstd-1.5.4/lib/common/cpu.h index 8acd33b..8bc34a3 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/cpu.h +++ b/src/dependencies/zstd-1.5.4/lib/common/cpu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/common/debug.c b/src/dependencies/zstd-1.5.4/lib/common/debug.c similarity index 93% rename from src/dependencies/zstd-1.5.0/lib/common/debug.c rename to src/dependencies/zstd-1.5.4/lib/common/debug.c index bb863c9..ebf7bfc 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/debug.c +++ b/src/dependencies/zstd-1.5.4/lib/common/debug.c @@ -1,7 +1,7 @@ /* ****************************************************************** * debug * Part of FSE library - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy diff --git a/src/dependencies/zstd-1.5.0/lib/common/debug.h b/src/dependencies/zstd-1.5.4/lib/common/debug.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/common/debug.h rename to src/dependencies/zstd-1.5.4/lib/common/debug.h index 3b2a320..0e9817e 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/debug.h +++ b/src/dependencies/zstd-1.5.4/lib/common/debug.h @@ -1,7 +1,7 @@ /* ****************************************************************** * debug * Part of FSE library - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy diff --git a/src/dependencies/zstd-1.5.0/lib/common/entropy_common.c b/src/dependencies/zstd-1.5.4/lib/common/entropy_common.c similarity index 89% rename from src/dependencies/zstd-1.5.0/lib/common/entropy_common.c rename to src/dependencies/zstd-1.5.4/lib/common/entropy_common.c index 41cd695..e2173af 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/entropy_common.c +++ b/src/dependencies/zstd-1.5.4/lib/common/entropy_common.c @@ -1,6 +1,6 @@ /* ****************************************************************** * Common functions of New Generation Entropy library - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy @@ -19,8 +19,8 @@ #include "error_private.h" /* ERR_*, ERROR */ #define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */ #include "fse.h" -#define HUF_STATIC_LINKING_ONLY /* HUF_TABLELOG_ABSOLUTEMAX */ #include "huf.h" +#include "bits.h" /* ZSDT_highbit32, ZSTD_countTrailingZeros32 */ /*=== Version ===*/ @@ -38,28 +38,6 @@ const char* HUF_getErrorName(size_t code) { return ERR_getErrorName(code); } /*-************************************************************** * FSE NCount encoding-decoding ****************************************************************/ -static U32 FSE_ctz(U32 val) -{ - assert(val != 0); - { -# if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - return _BitScanForward(&r, val) ? (unsigned)r : 0; -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* GCC Intrinsic */ - return __builtin_ctz(val); -# elif defined(__ICCARM__) /* IAR Intrinsic */ - return __CTZ(val); -# else /* Software version */ - U32 count = 0; - while ((val & 1) == 0) { - val >>= 1; - ++count; - } - return count; -# endif - } -} - FORCE_INLINE_TEMPLATE size_t FSE_readNCount_body(short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, const void* headerBuffer, size_t hbSize) @@ -107,7 +85,7 @@ size_t FSE_readNCount_body(short* normalizedCounter, unsigned* maxSVPtr, unsigne * repeat. * Avoid UB by setting the high bit to 1. */ - int repeats = FSE_ctz(~bitStream | 0x80000000) >> 1; + int repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1; while (repeats >= 12) { charnum += 3 * 12; if (LIKELY(ip <= iend-7)) { @@ -118,7 +96,7 @@ size_t FSE_readNCount_body(short* normalizedCounter, unsigned* maxSVPtr, unsigne ip = iend - 4; } bitStream = MEM_readLE32(ip) >> bitCount; - repeats = FSE_ctz(~bitStream | 0x80000000) >> 1; + repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1; } charnum += 3 * repeats; bitStream >>= 2 * repeats; @@ -183,7 +161,7 @@ size_t FSE_readNCount_body(short* normalizedCounter, unsigned* maxSVPtr, unsigne * know that threshold > 1. */ if (remaining <= 1) break; - nbBits = BIT_highbit32(remaining) + 1; + nbBits = ZSTD_highbit32(remaining) + 1; threshold = 1 << (nbBits - 1); } if (charnum >= maxSV1) break; @@ -217,7 +195,7 @@ static size_t FSE_readNCount_body_default( } #if DYNAMIC_BMI2 -TARGET_ATTRIBUTE("bmi2") static size_t FSE_readNCount_body_bmi2( +BMI2_TARGET_ATTRIBUTE static size_t FSE_readNCount_body_bmi2( short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, const void* headerBuffer, size_t hbSize) { @@ -258,7 +236,7 @@ size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats, const void* src, size_t srcSize) { U32 wksp[HUF_READ_STATS_WORKSPACE_SIZE_U32]; - return HUF_readStats_wksp(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, wksp, sizeof(wksp), /* bmi2 */ 0); + return HUF_readStats_wksp(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, wksp, sizeof(wksp), /* flags */ 0); } FORCE_INLINE_TEMPLATE size_t @@ -299,21 +277,21 @@ HUF_readStats_body(BYTE* huffWeight, size_t hwSize, U32* rankStats, ZSTD_memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32)); weightTotal = 0; { U32 n; for (n=0; n= HUF_TABLELOG_MAX) return ERROR(corruption_detected); + if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected); rankStats[huffWeight[n]]++; weightTotal += (1 << huffWeight[n]) >> 1; } } if (weightTotal == 0) return ERROR(corruption_detected); /* get last non-null symbol weight (implied, total must be 2^n) */ - { U32 const tableLog = BIT_highbit32(weightTotal) + 1; + { U32 const tableLog = ZSTD_highbit32(weightTotal) + 1; if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected); *tableLogPtr = tableLog; /* determine last weight */ { U32 const total = 1 << tableLog; U32 const rest = total - weightTotal; - U32 const verif = 1 << BIT_highbit32(rest); - U32 const lastWeight = BIT_highbit32(rest) + 1; + U32 const verif = 1 << ZSTD_highbit32(rest); + U32 const lastWeight = ZSTD_highbit32(rest) + 1; if (verif != rest) return ERROR(corruption_detected); /* last value must be a clean power of 2 */ huffWeight[oSize] = (BYTE)lastWeight; rankStats[lastWeight]++; @@ -337,7 +315,7 @@ static size_t HUF_readStats_body_default(BYTE* huffWeight, size_t hwSize, U32* r } #if DYNAMIC_BMI2 -static TARGET_ATTRIBUTE("bmi2") size_t HUF_readStats_body_bmi2(BYTE* huffWeight, size_t hwSize, U32* rankStats, +static BMI2_TARGET_ATTRIBUTE size_t HUF_readStats_body_bmi2(BYTE* huffWeight, size_t hwSize, U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr, const void* src, size_t srcSize, void* workSpace, size_t wkspSize) @@ -350,13 +328,13 @@ size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize, U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, - int bmi2) + int flags) { #if DYNAMIC_BMI2 - if (bmi2) { + if (flags & HUF_flags_bmi2) { return HUF_readStats_body_bmi2(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize); } #endif - (void)bmi2; + (void)flags; return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize); } diff --git a/src/dependencies/zstd-1.5.0/lib/common/error_private.c b/src/dependencies/zstd-1.5.4/lib/common/error_private.c similarity index 76% rename from src/dependencies/zstd-1.5.0/lib/common/error_private.c rename to src/dependencies/zstd-1.5.4/lib/common/error_private.c index 6d1135f..075fc5e 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/error_private.c +++ b/src/dependencies/zstd-1.5.4/lib/common/error_private.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -27,9 +27,11 @@ const char* ERR_getErrorString(ERR_enum code) case PREFIX(version_unsupported): return "Version not supported"; case PREFIX(frameParameter_unsupported): return "Unsupported frame parameter"; case PREFIX(frameParameter_windowTooLarge): return "Frame requires too much memory for decoding"; - case PREFIX(corruption_detected): return "Corrupted block detected"; + case PREFIX(corruption_detected): return "Data corruption detected"; case PREFIX(checksum_wrong): return "Restored data doesn't match checksum"; + case PREFIX(literals_headerWrong): return "Header of Literals' block doesn't respect format specification"; case PREFIX(parameter_unsupported): return "Unsupported parameter"; + case PREFIX(parameter_combination_unsupported): return "Unsupported combination of parameters"; case PREFIX(parameter_outOfBound): return "Parameter is out of bound"; case PREFIX(init_missing): return "Context should be init first"; case PREFIX(memory_allocation): return "Allocation error : not enough memory"; @@ -38,17 +40,22 @@ const char* ERR_getErrorString(ERR_enum code) case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported"; case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large"; case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small"; + case PREFIX(stabilityCondition_notRespected): return "pledged buffer stability condition is not respected"; case PREFIX(dictionary_corrupted): return "Dictionary is corrupted"; case PREFIX(dictionary_wrong): return "Dictionary mismatch"; case PREFIX(dictionaryCreation_failed): return "Cannot create Dictionary from provided samples"; case PREFIX(dstSize_tooSmall): return "Destination buffer is too small"; case PREFIX(srcSize_wrong): return "Src size is incorrect"; case PREFIX(dstBuffer_null): return "Operation on NULL destination buffer"; + case PREFIX(noForwardProgress_destFull): return "Operation made no progress over multiple calls, due to output buffer being full"; + case PREFIX(noForwardProgress_inputEmpty): return "Operation made no progress over multiple calls, due to input being empty"; /* following error codes are not stable and may be removed or changed in a future version */ case PREFIX(frameIndex_tooLarge): return "Frame index is too large"; case PREFIX(seekableIO): return "An I/O error occurred when reading/seeking"; case PREFIX(dstBuffer_wrong): return "Destination buffer is wrong"; case PREFIX(srcBuffer_wrong): return "Source buffer is wrong"; + case PREFIX(sequenceProducer_failed): return "Block-level external sequence producer returned an error code"; + case PREFIX(externalSequences_invalid): return "External sequences are not valid"; case PREFIX(maxCode): default: return notErrorCode; } diff --git a/src/dependencies/zstd-1.5.4/lib/common/error_private.h b/src/dependencies/zstd-1.5.4/lib/common/error_private.h new file mode 100644 index 0000000..325daad --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/common/error_private.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +/* Note : this module is expected to remain private, do not expose it */ + +#ifndef ERROR_H_MODULE +#define ERROR_H_MODULE + +#if defined (__cplusplus) +extern "C" { +#endif + + +/* **************************************** +* Dependencies +******************************************/ +#include "../zstd_errors.h" /* enum list */ +#include "compiler.h" +#include "debug.h" +#include "zstd_deps.h" /* size_t */ + + +/* **************************************** +* Compiler-specific +******************************************/ +#if defined(__GNUC__) +# define ERR_STATIC static __attribute__((unused)) +#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# define ERR_STATIC static inline +#elif defined(_MSC_VER) +# define ERR_STATIC static __inline +#else +# define ERR_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ +#endif + + +/*-**************************************** +* Customization (error_public.h) +******************************************/ +typedef ZSTD_ErrorCode ERR_enum; +#define PREFIX(name) ZSTD_error_##name + + +/*-**************************************** +* Error codes handling +******************************************/ +#undef ERROR /* already defined on Visual Studio */ +#define ERROR(name) ZSTD_ERROR(name) +#define ZSTD_ERROR(name) ((size_t)-PREFIX(name)) + +ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } + +ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); } + +/* check and forward error code */ +#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e +#define CHECK_F(f) { CHECK_V_F(_var_err__, f); } + + +/*-**************************************** +* Error Strings +******************************************/ + +const char* ERR_getErrorString(ERR_enum code); /* error_private.c */ + +ERR_STATIC const char* ERR_getErrorName(size_t code) +{ + return ERR_getErrorString(ERR_getErrorCode(code)); +} + +/** + * Ignore: this is an internal helper. + * + * This is a helper function to help force C99-correctness during compilation. + * Under strict compilation modes, variadic macro arguments can't be empty. + * However, variadic function arguments can be. Using a function therefore lets + * us statically check that at least one (string) argument was passed, + * independent of the compilation flags. + */ +static INLINE_KEYWORD UNUSED_ATTR +void _force_has_format_string(const char *format, ...) { + (void)format; +} + +/** + * Ignore: this is an internal helper. + * + * We want to force this function invocation to be syntactically correct, but + * we don't want to force runtime evaluation of its arguments. + */ +#define _FORCE_HAS_FORMAT_STRING(...) \ + if (0) { \ + _force_has_format_string(__VA_ARGS__); \ + } + +#define ERR_QUOTE(str) #str + +/** + * Return the specified error if the condition evaluates to true. + * + * In debug modes, prints additional information. + * In order to do that (particularly, printing the conditional that failed), + * this can't just wrap RETURN_ERROR(). + */ +#define RETURN_ERROR_IF(cond, err, ...) \ + if (cond) { \ + RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \ + __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return ERROR(err); \ + } + +/** + * Unconditionally return the specified error. + * + * In debug modes, prints additional information. + */ +#define RETURN_ERROR(err, ...) \ + do { \ + RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \ + __FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return ERROR(err); \ + } while(0); + +/** + * If the provided expression evaluates to an error code, returns that error code. + * + * In debug modes, prints additional information. + */ +#define FORWARD_IF_ERROR(err, ...) \ + do { \ + size_t const err_code = (err); \ + if (ERR_isError(err_code)) { \ + RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \ + __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return err_code; \ + } \ + } while(0); + +#if defined (__cplusplus) +} +#endif + +#endif /* ERROR_H_MODULE */ diff --git a/src/dependencies/zstd-1.5.0/lib/common/fse.h b/src/dependencies/zstd-1.5.4/lib/common/fse.h similarity index 85% rename from src/dependencies/zstd-1.5.0/lib/common/fse.h rename to src/dependencies/zstd-1.5.4/lib/common/fse.h index 19dd4fe..02a1f0b 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/fse.h +++ b/src/dependencies/zstd-1.5.4/lib/common/fse.h @@ -1,7 +1,7 @@ /* ****************************************************************** * FSE : Finite State Entropy codec * Public Prototypes declaration - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy @@ -53,34 +53,6 @@ extern "C" { FSE_PUBLIC_API unsigned FSE_versionNumber(void); /**< library version number; to be used when checking dll version */ -/*-**************************************** -* FSE simple functions -******************************************/ -/*! FSE_compress() : - Compress content of buffer 'src', of size 'srcSize', into destination buffer 'dst'. - 'dst' buffer must be already allocated. Compression runs faster is dstCapacity >= FSE_compressBound(srcSize). - @return : size of compressed data (<= dstCapacity). - Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!! - if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression instead. - if FSE_isError(return), compression failed (more details using FSE_getErrorName()) -*/ -FSE_PUBLIC_API size_t FSE_compress(void* dst, size_t dstCapacity, - const void* src, size_t srcSize); - -/*! FSE_decompress(): - Decompress FSE data from buffer 'cSrc', of size 'cSrcSize', - into already allocated destination buffer 'dst', of size 'dstCapacity'. - @return : size of regenerated data (<= maxDstSize), - or an error code, which can be tested using FSE_isError() . - - ** Important ** : FSE_decompress() does not decompress non-compressible nor RLE data !!! - Why ? : making this distinction requires a header. - Header management is intentionally delegated to the user layer, which can better manage special cases. -*/ -FSE_PUBLIC_API size_t FSE_decompress(void* dst, size_t dstCapacity, - const void* cSrc, size_t cSrcSize); - - /*-***************************************** * Tool functions ******************************************/ @@ -91,20 +63,6 @@ FSE_PUBLIC_API unsigned FSE_isError(size_t code); /* tells if a return FSE_PUBLIC_API const char* FSE_getErrorName(size_t code); /* provides error code string (useful for debugging) */ -/*-***************************************** -* FSE advanced functions -******************************************/ -/*! FSE_compress2() : - Same as FSE_compress(), but allows the selection of 'maxSymbolValue' and 'tableLog' - Both parameters can be defined as '0' to mean : use default value - @return : size of compressed data - Special values : if return == 0, srcData is not compressible => Nothing is stored within cSrc !!! - if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression. - if FSE_isError(return), it's an error code. -*/ -FSE_PUBLIC_API size_t FSE_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog); - - /*-***************************************** * FSE detailed API ******************************************/ @@ -164,8 +122,6 @@ FSE_PUBLIC_API size_t FSE_writeNCount (void* buffer, size_t bufferSize, /*! Constructor and Destructor of FSE_CTable. Note that FSE_CTable size depends on 'tableLog' and 'maxSymbolValue' */ typedef unsigned FSE_CTable; /* don't allocate that. It's only meant to be more restrictive than void* */ -FSE_PUBLIC_API FSE_CTable* FSE_createCTable (unsigned maxSymbolValue, unsigned tableLog); -FSE_PUBLIC_API void FSE_freeCTable (FSE_CTable* ct); /*! FSE_buildCTable(): Builds `ct`, which must be already allocated, using FSE_createCTable(). @@ -241,23 +197,7 @@ FSE_PUBLIC_API size_t FSE_readNCount_bmi2(short* normalizedCounter, unsigned* maxSymbolValuePtr, unsigned* tableLogPtr, const void* rBuffer, size_t rBuffSize, int bmi2); -/*! Constructor and Destructor of FSE_DTable. - Note that its size depends on 'tableLog' */ typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be more restrictive than void* */ -FSE_PUBLIC_API FSE_DTable* FSE_createDTable(unsigned tableLog); -FSE_PUBLIC_API void FSE_freeDTable(FSE_DTable* dt); - -/*! FSE_buildDTable(): - Builds 'dt', which must be already allocated, using FSE_createDTable(). - return : 0, or an errorCode, which can be tested using FSE_isError() */ -FSE_PUBLIC_API size_t FSE_buildDTable (FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog); - -/*! FSE_decompress_usingDTable(): - Decompress compressed source `cSrc` of size `cSrcSize` using `dt` - into `dst` which must be already allocated. - @return : size of regenerated data (necessarily <= `dstCapacity`), - or an errorCode, which can be tested using FSE_isError() */ -FSE_PUBLIC_API size_t FSE_decompress_usingDTable(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, const FSE_DTable* dt); /*! Tutorial : @@ -320,24 +260,15 @@ If there is an error, the function will return an error code, which can be teste unsigned FSE_optimalTableLog_internal(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, unsigned minus); /**< same as FSE_optimalTableLog(), which used `minus==2` */ -/* FSE_compress_wksp() : - * Same as FSE_compress2(), but using an externally allocated scratch buffer (`workSpace`). - * FSE_COMPRESS_WKSP_SIZE_U32() provides the minimum size required for `workSpace` as a table of FSE_CTable. - */ -#define FSE_COMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ( FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) + ((maxTableLog > 12) ? (1 << (maxTableLog - 2)) : 1024) ) -size_t FSE_compress_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); - -size_t FSE_buildCTable_raw (FSE_CTable* ct, unsigned nbBits); -/**< build a fake FSE_CTable, designed for a flat distribution, where each symbol uses nbBits */ - size_t FSE_buildCTable_rle (FSE_CTable* ct, unsigned char symbolValue); /**< build a fake FSE_CTable, designed to compress always the same symbolValue */ /* FSE_buildCTable_wksp() : * Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`). * `wkspSize` must be >= `FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog)` of `unsigned`. + * See FSE_buildCTable_wksp() for breakdown of workspace usage. */ -#define FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog) (maxSymbolValue + 2 + (1ull << (tableLog - 2))) +#define FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog) (((maxSymbolValue + 2) + (1ull << (tableLog)))/2 + sizeof(U64)/sizeof(U32) /* additional 8 bytes for potential table overwrite */) #define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog)) size_t FSE_buildCTable_wksp(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); @@ -346,19 +277,11 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, const short* normalizedCounter, unsi FSE_PUBLIC_API size_t FSE_buildDTable_wksp(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); /**< Same as FSE_buildDTable(), using an externally allocated `workspace` produced with `FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxSymbolValue)` */ -size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits); -/**< build a fake FSE_DTable, designed to read a flat distribution where each symbol uses nbBits */ - -size_t FSE_buildDTable_rle (FSE_DTable* dt, unsigned char symbolValue); -/**< build a fake FSE_DTable, designed to always generate the same symbolValue */ - -#define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1) +#define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + 1 + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1) #define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned)) -size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize); -/**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)` */ - size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize, int bmi2); -/**< Same as FSE_decompress_wksp() but with dynamic BMI2 support. Pass 1 if your CPU supports BMI2 or 0 if it doesn't. */ +/**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)`. + * Set bmi2 to 1 if your CPU supports BMI2 or 0 if it doesn't */ typedef enum { FSE_repeat_none, /**< Cannot use the previous table */ @@ -554,7 +477,7 @@ MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePt /* FSE_getMaxNbBits() : * Approximate maximum cost of a symbol, in bits. - * Fractional get rounded up (i.e : a symbol with a normalized frequency of 3 gives the same result as a frequency of 2) + * Fractional get rounded up (i.e. a symbol with a normalized frequency of 3 gives the same result as a frequency of 2) * note 1 : assume symbolValue is valid (<= maxSymbolValue) * note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */ MEM_STATIC U32 FSE_getMaxNbBits(const void* symbolTTPtr, U32 symbolValue) diff --git a/src/dependencies/zstd-1.5.0/lib/common/fse_decompress.c b/src/dependencies/zstd-1.5.4/lib/common/fse_decompress.c similarity index 76% rename from src/dependencies/zstd-1.5.0/lib/common/fse_decompress.c rename to src/dependencies/zstd-1.5.4/lib/common/fse_decompress.c index f4ff58f..1e1c9f9 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/fse_decompress.c +++ b/src/dependencies/zstd-1.5.4/lib/common/fse_decompress.c @@ -1,6 +1,6 @@ /* ****************************************************************** * FSE : Finite State Entropy decoder - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy @@ -24,6 +24,7 @@ #include "error_private.h" #define ZSTD_DEPS_NEED_MALLOC #include "zstd_deps.h" +#include "bits.h" /* ZSTD_highbit32 */ /* ************************************************************** @@ -55,19 +56,6 @@ #define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y) #define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y) - -/* Function templates */ -FSE_DTable* FSE_createDTable (unsigned tableLog) -{ - if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX; - return (FSE_DTable*)ZSTD_malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32) ); -} - -void FSE_freeDTable (FSE_DTable* dt) -{ - ZSTD_free(dt); -} - static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize) { void* const tdPtr = dt+1; /* because *dt is unsigned, 32-bits aligned on 32-bits */ @@ -127,10 +115,10 @@ static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCo } } /* Now we spread those positions across the table. - * The benefit of doing it in two stages is that we avoid the the + * The benefit of doing it in two stages is that we avoid the * variable size inner loop, which caused lots of branch misses. * Now we can run through all the positions without any branch misses. - * We unroll the loop twice, since that is what emperically worked best. + * We unroll the loop twice, since that is what empirically worked best. */ { size_t position = 0; @@ -166,7 +154,7 @@ static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCo for (u=0; utableLog = 0; - DTableH->fastMode = 0; - - cell->newState = 0; - cell->symbol = symbolValue; - cell->nbBits = 0; - - return 0; -} - - -size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits) -{ - void* ptr = dt; - FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr; - void* dPtr = dt + 1; - FSE_decode_t* const dinfo = (FSE_decode_t*)dPtr; - const unsigned tableSize = 1 << nbBits; - const unsigned tableMask = tableSize - 1; - const unsigned maxSV1 = tableMask+1; - unsigned s; - - /* Sanity checks */ - if (nbBits < 1) return ERROR(GENERIC); /* min size */ - - /* Build Decoding Table */ - DTableH->tableLog = (U16)nbBits; - DTableH->fastMode = 1; - for (s=0; sfastMode; - - /* select fast mode (static) */ - if (fastMode) return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1); - return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0); -} - - -size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize) -{ - return FSE_decompress_wksp_bmi2(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, /* bmi2 */ 0); -} - typedef struct { short ncount[FSE_MAX_SYMBOL_VALUE + 1]; FSE_DTable dtable[1]; /* Dynamically sized */ @@ -342,7 +267,8 @@ FORCE_INLINE_TEMPLATE size_t FSE_decompress_wksp_body( } if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge); - workSpace = wksp->dtable + FSE_DTABLE_SIZE_U32(tableLog); + assert(sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog) <= wkspSize); + workSpace = (BYTE*)workSpace + sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); CHECK_F( FSE_buildDTable_internal(wksp->dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) ); @@ -365,7 +291,7 @@ static size_t FSE_decompress_wksp_body_default(void* dst, size_t dstCapacity, co } #if DYNAMIC_BMI2 -TARGET_ATTRIBUTE("bmi2") static size_t FSE_decompress_wksp_body_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize) +BMI2_TARGET_ATTRIBUTE static size_t FSE_decompress_wksp_body_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize) { return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 1); } @@ -382,22 +308,4 @@ size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, const void* cSrc, return FSE_decompress_wksp_body_default(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize); } - -typedef FSE_DTable DTable_max_t[FSE_DTABLE_SIZE_U32(FSE_MAX_TABLELOG)]; - -#ifndef ZSTD_NO_UNUSED_FUNCTIONS -size_t FSE_buildDTable(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) { - U32 wksp[FSE_BUILD_DTABLE_WKSP_SIZE_U32(FSE_TABLELOG_ABSOLUTE_MAX, FSE_MAX_SYMBOL_VALUE)]; - return FSE_buildDTable_wksp(dt, normalizedCounter, maxSymbolValue, tableLog, wksp, sizeof(wksp)); -} - -size_t FSE_decompress(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize) -{ - /* Static analyzer seems unable to understand this table will be properly initialized later */ - U32 wksp[FSE_DECOMPRESS_WKSP_SIZE_U32(FSE_MAX_TABLELOG, FSE_MAX_SYMBOL_VALUE)]; - return FSE_decompress_wksp(dst, dstCapacity, cSrc, cSrcSize, FSE_MAX_TABLELOG, wksp, sizeof(wksp)); -} -#endif - - #endif /* FSE_COMMONDEFS_ONLY */ diff --git a/src/dependencies/zstd-1.5.4/lib/common/huf.h b/src/dependencies/zstd-1.5.4/lib/common/huf.h new file mode 100644 index 0000000..73d1ee5 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/common/huf.h @@ -0,0 +1,273 @@ +/* ****************************************************************** + * huff0 huffman codec, + * part of Finite State Entropy library + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * You can contact the author at : + * - Source repository : https://github.com/Cyan4973/FiniteStateEntropy + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. +****************************************************************** */ + +#if defined (__cplusplus) +extern "C" { +#endif + +#ifndef HUF_H_298734234 +#define HUF_H_298734234 + +/* *** Dependencies *** */ +#include "zstd_deps.h" /* size_t */ +#include "mem.h" /* U32 */ +#define FSE_STATIC_LINKING_ONLY +#include "fse.h" + + +/* *** Tool functions *** */ +#define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */ +size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */ + +/* Error Management */ +unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */ +const char* HUF_getErrorName(size_t code); /**< provides error code string (useful for debugging) */ + + +#define HUF_WORKSPACE_SIZE ((8 << 10) + 512 /* sorting scratch space */) +#define HUF_WORKSPACE_SIZE_U64 (HUF_WORKSPACE_SIZE / sizeof(U64)) + +/* *** Constants *** */ +#define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */ +#define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */ +#define HUF_SYMBOLVALUE_MAX 255 + +#define HUF_TABLELOG_ABSOLUTEMAX 12 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ +#if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX) +# error "HUF_TABLELOG_MAX is too large !" +#endif + + +/* **************************************** +* Static allocation +******************************************/ +/* HUF buffer bounds */ +#define HUF_CTABLEBOUND 129 +#define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true when incompressible is pre-filtered with fast heuristic */ +#define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */ + +/* static allocation of HUF's Compression Table */ +/* this is a private definition, just exposed for allocation and strict aliasing purpose. never EVER access its members directly */ +typedef size_t HUF_CElt; /* consider it an incomplete type */ +#define HUF_CTABLE_SIZE_ST(maxSymbolValue) ((maxSymbolValue)+2) /* Use tables of size_t, for proper alignment */ +#define HUF_CTABLE_SIZE(maxSymbolValue) (HUF_CTABLE_SIZE_ST(maxSymbolValue) * sizeof(size_t)) +#define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \ + HUF_CElt name[HUF_CTABLE_SIZE_ST(maxSymbolValue)] /* no final ; */ + +/* static allocation of HUF's DTable */ +typedef U32 HUF_DTable; +#define HUF_DTABLE_SIZE(maxTableLog) (1 + (1<<(maxTableLog))) +#define HUF_CREATE_STATIC_DTABLEX1(DTable, maxTableLog) \ + HUF_DTable DTable[HUF_DTABLE_SIZE((maxTableLog)-1)] = { ((U32)((maxTableLog)-1) * 0x01000001) } +#define HUF_CREATE_STATIC_DTABLEX2(DTable, maxTableLog) \ + HUF_DTable DTable[HUF_DTABLE_SIZE(maxTableLog)] = { ((U32)(maxTableLog) * 0x01000001) } + + +/* **************************************** +* Advanced decompression functions +******************************************/ + +/** + * Huffman flags bitset. + * For all flags, 0 is the default value. + */ +typedef enum { + /** + * If compiled with DYNAMIC_BMI2: Set flag only if the CPU supports BMI2 at runtime. + * Otherwise: Ignored. + */ + HUF_flags_bmi2 = (1 << 0), + /** + * If set: Test possible table depths to find the one that produces the smallest header + encoded size. + * If unset: Use heuristic to find the table depth. + */ + HUF_flags_optimalDepth = (1 << 1), + /** + * If set: If the previous table can encode the input, always reuse the previous table. + * If unset: If the previous table can encode the input, reuse the previous table if it results in a smaller output. + */ + HUF_flags_preferRepeat = (1 << 2), + /** + * If set: Sample the input and check if the sample is uncompressible, if it is then don't attempt to compress. + * If unset: Always histogram the entire input. + */ + HUF_flags_suspectUncompressible = (1 << 3), + /** + * If set: Don't use assembly implementations + * If unset: Allow using assembly implementations + */ + HUF_flags_disableAsm = (1 << 4), + /** + * If set: Don't use the fast decoding loop, always use the fallback decoding loop. + * If unset: Use the fast decoding loop when possible. + */ + HUF_flags_disableFast = (1 << 5) +} HUF_flags_e; + + +/* **************************************** + * HUF detailed API + * ****************************************/ +#define HUF_OPTIMAL_DEPTH_THRESHOLD ZSTD_btultra + +/*! HUF_compress() does the following: + * 1. count symbol occurrence from source[] into table count[] using FSE_count() (exposed within "fse.h") + * 2. (optional) refine tableLog using HUF_optimalTableLog() + * 3. build Huffman table from count using HUF_buildCTable() + * 4. save Huffman table to memory buffer using HUF_writeCTable() + * 5. encode the data stream using HUF_compress4X_usingCTable() + * + * The following API allows targeting specific sub-functions for advanced tasks. + * For example, it's possible to compress several blocks using the same 'CTable', + * or to save and regenerate 'CTable' using external methods. + */ +unsigned HUF_minTableLog(unsigned symbolCardinality); +unsigned HUF_cardinality(const unsigned* count, unsigned maxSymbolValue); +unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, void* workSpace, + size_t wkspSize, HUF_CElt* table, const unsigned* count, int flags); /* table is used as scratch space for building and testing tables, not a return value */ +size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog, void* workspace, size_t workspaceSize); +size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags); +size_t HUF_estimateCompressedSize(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue); +int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue); + +typedef enum { + HUF_repeat_none, /**< Cannot use the previous table */ + HUF_repeat_check, /**< Can use the previous table but it must be checked. Note : The previous table must have been constructed by HUF_compress{1, 4}X_repeat */ + HUF_repeat_valid /**< Can use the previous table and it is assumed to be valid */ + } HUF_repeat; + +/** HUF_compress4X_repeat() : + * Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none. + * If it uses hufTable it does not modify hufTable or repeat. + * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used. + * If preferRepeat then the old table will always be used if valid. + * If suspectUncompressible then some sampling checks will be run to potentially skip huffman coding */ +size_t HUF_compress4X_repeat(void* dst, size_t dstSize, + const void* src, size_t srcSize, + unsigned maxSymbolValue, unsigned tableLog, + void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */ + HUF_CElt* hufTable, HUF_repeat* repeat, int flags); + +/** HUF_buildCTable_wksp() : + * Same as HUF_buildCTable(), but using externally allocated scratch buffer. + * `workSpace` must be aligned on 4-bytes boundaries, and its size must be >= HUF_CTABLE_WORKSPACE_SIZE. + */ +#define HUF_CTABLE_WORKSPACE_SIZE_U32 ((4 * (HUF_SYMBOLVALUE_MAX + 1)) + 192) +#define HUF_CTABLE_WORKSPACE_SIZE (HUF_CTABLE_WORKSPACE_SIZE_U32 * sizeof(unsigned)) +size_t HUF_buildCTable_wksp (HUF_CElt* tree, + const unsigned* count, U32 maxSymbolValue, U32 maxNbBits, + void* workSpace, size_t wkspSize); + +/*! HUF_readStats() : + * Read compact Huffman tree, saved by HUF_writeCTable(). + * `huffWeight` is destination buffer. + * @return : size read from `src` , or an error Code . + * Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */ +size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, + U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr, + const void* src, size_t srcSize); + +/*! HUF_readStats_wksp() : + * Same as HUF_readStats() but takes an external workspace which must be + * 4-byte aligned and its size must be >= HUF_READ_STATS_WORKSPACE_SIZE. + * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0. + */ +#define HUF_READ_STATS_WORKSPACE_SIZE_U32 FSE_DECOMPRESS_WKSP_SIZE_U32(6, HUF_TABLELOG_MAX-1) +#define HUF_READ_STATS_WORKSPACE_SIZE (HUF_READ_STATS_WORKSPACE_SIZE_U32 * sizeof(unsigned)) +size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize, + U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr, + const void* src, size_t srcSize, + void* workspace, size_t wkspSize, + int flags); + +/** HUF_readCTable() : + * Loading a CTable saved with HUF_writeCTable() */ +size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize, unsigned *hasZeroWeights); + +/** HUF_getNbBitsFromCTable() : + * Read nbBits from CTable symbolTable, for symbol `symbolValue` presumed <= HUF_SYMBOLVALUE_MAX + * Note 1 : is not inlined, as HUF_CElt definition is private */ +U32 HUF_getNbBitsFromCTable(const HUF_CElt* symbolTable, U32 symbolValue); + +/* + * HUF_decompress() does the following: + * 1. select the decompression algorithm (X1, X2) based on pre-computed heuristics + * 2. build Huffman table from save, using HUF_readDTableX?() + * 3. decode 1 or 4 segments in parallel using HUF_decompress?X?_usingDTable() + */ + +/** HUF_selectDecoder() : + * Tells which decoder is likely to decode faster, + * based on a set of pre-computed metrics. + * @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 . + * Assumption : 0 < dstSize <= 128 KB */ +U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize); + +/** + * The minimum workspace size for the `workSpace` used in + * HUF_readDTableX1_wksp() and HUF_readDTableX2_wksp(). + * + * The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when + * HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15. + * Buffer overflow errors may potentially occur if code modifications result in + * a required workspace size greater than that specified in the following + * macro. + */ +#define HUF_DECOMPRESS_WORKSPACE_SIZE ((2 << 10) + (1 << 9)) +#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32)) + + +/* ====================== */ +/* single stream variants */ +/* ====================== */ + +size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags); +/** HUF_compress1X_repeat() : + * Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none. + * If it uses hufTable it does not modify hufTable or repeat. + * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used. + * If preferRepeat then the old table will always be used if valid. + * If suspectUncompressible then some sampling checks will be run to potentially skip huffman coding */ +size_t HUF_compress1X_repeat(void* dst, size_t dstSize, + const void* src, size_t srcSize, + unsigned maxSymbolValue, unsigned tableLog, + void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */ + HUF_CElt* hufTable, HUF_repeat* repeat, int flags); + +size_t HUF_decompress1X_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags); +#ifndef HUF_FORCE_DECOMPRESS_X1 +size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags); /**< double-symbols decoder */ +#endif + +/* BMI2 variants. + * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0. + */ +size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags); +#ifndef HUF_FORCE_DECOMPRESS_X2 +size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags); +#endif +size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags); +size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags); +#ifndef HUF_FORCE_DECOMPRESS_X2 +size_t HUF_readDTableX1_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int flags); +#endif +#ifndef HUF_FORCE_DECOMPRESS_X1 +size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int flags); +#endif + +#endif /* HUF_H_298734234 */ + +#if defined (__cplusplus) +} +#endif diff --git a/src/dependencies/zstd-1.5.0/lib/common/mem.h b/src/dependencies/zstd-1.5.4/lib/common/mem.h similarity index 83% rename from src/dependencies/zstd-1.5.0/lib/common/mem.h rename to src/dependencies/zstd-1.5.4/lib/common/mem.h index 9f3b81a..98dd47a 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/mem.h +++ b/src/dependencies/zstd-1.5.4/lib/common/mem.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -51,6 +51,8 @@ extern "C" { # include /* intptr_t */ # endif typedef uint8_t BYTE; + typedef uint8_t U8; + typedef int8_t S8; typedef uint16_t U16; typedef int16_t S16; typedef uint32_t U32; @@ -63,6 +65,8 @@ extern "C" { # error "this implementation requires char to be exactly 8-bit type" #endif typedef unsigned char BYTE; + typedef unsigned char U8; + typedef signed char S8; #if USHRT_MAX != 65535 # error "this implementation requires short to be exactly 16-bit type" #endif @@ -129,21 +133,15 @@ MEM_STATIC size_t MEM_swapST(size_t in); /*-************************************************************** * Memory I/O Implementation *****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (i.e., not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. +/* MEM_FORCE_MEMORY_ACCESS : For accessing unaligned memory: + * Method 0 : always use `memcpy()`. Safe and portable. + * Method 1 : Use compiler extension to set unaligned access. * Method 2 : direct access. This method is portable but violate C standard. * It can generate buggy code on targets depending on alignment. - * In some circumstances, it's the only known way to get the most performance (i.e. GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) + * Default : method 1 if supported, else method 0 */ #ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__) +# ifdef __GNUC__ # define MEM_FORCE_MEMORY_ACCESS 1 # endif #endif @@ -153,8 +151,22 @@ MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; } MEM_STATIC unsigned MEM_isLittleEndian(void) { +#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) + return 1; +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + return 0; +#elif defined(__clang__) && __LITTLE_ENDIAN__ + return 1; +#elif defined(__clang__) && __BIG_ENDIAN__ + return 0; +#elif defined(_MSC_VER) && (_M_AMD64 || _M_IX86) + return 1; +#elif defined(__DMC__) && defined(_M_IX86) + return 1; +#else const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ return one.c[0]; +#endif } #if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) @@ -172,30 +184,19 @@ MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(U64*)memPtr = value; } #elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -#if defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(WIN32)) - __pragma( pack(push, 1) ) - typedef struct { U16 v; } unalign16; - typedef struct { U32 v; } unalign32; - typedef struct { U64 v; } unalign64; - typedef struct { size_t v; } unalignArch; - __pragma( pack(pop) ) -#else - typedef struct { U16 v; } __attribute__((packed)) unalign16; - typedef struct { U32 v; } __attribute__((packed)) unalign32; - typedef struct { U64 v; } __attribute__((packed)) unalign64; - typedef struct { size_t v; } __attribute__((packed)) unalignArch; -#endif +typedef __attribute__((aligned(1))) U16 unalign16; +typedef __attribute__((aligned(1))) U32 unalign32; +typedef __attribute__((aligned(1))) U64 unalign64; +typedef __attribute__((aligned(1))) size_t unalignArch; -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign16*)ptr)->v; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign32*)ptr)->v; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign64*)ptr)->v; } -MEM_STATIC size_t MEM_readST(const void* ptr) { return ((const unalignArch*)ptr)->v; } +MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; } +MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; } +MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; } +MEM_STATIC size_t MEM_readST(const void* ptr) { return *(const unalignArch*)ptr; } -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign16*)memPtr)->v = value; } -MEM_STATIC void MEM_write32(void* memPtr, U32 value) { ((unalign32*)memPtr)->v = value; } -MEM_STATIC void MEM_write64(void* memPtr, U64 value) { ((unalign64*)memPtr)->v = value; } +MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; } +MEM_STATIC void MEM_write32(void* memPtr, U32 value) { *(unalign32*)memPtr = value; } +MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; } #else @@ -239,6 +240,14 @@ MEM_STATIC void MEM_write64(void* memPtr, U64 value) #endif /* MEM_FORCE_MEMORY_ACCESS */ +MEM_STATIC U32 MEM_swap32_fallback(U32 in) +{ + return ((in << 24) & 0xff000000 ) | + ((in << 8) & 0x00ff0000 ) | + ((in >> 8) & 0x0000ff00 ) | + ((in >> 24) & 0x000000ff ); +} + MEM_STATIC U32 MEM_swap32(U32 in) { #if defined(_MSC_VER) /* Visual Studio */ @@ -247,13 +256,22 @@ MEM_STATIC U32 MEM_swap32(U32 in) || (defined(__clang__) && __has_builtin(__builtin_bswap32)) return __builtin_bswap32(in); #else - return ((in << 24) & 0xff000000 ) | - ((in << 8) & 0x00ff0000 ) | - ((in >> 8) & 0x0000ff00 ) | - ((in >> 24) & 0x000000ff ); + return MEM_swap32_fallback(in); #endif } +MEM_STATIC U64 MEM_swap64_fallback(U64 in) +{ + return ((in << 56) & 0xff00000000000000ULL) | + ((in << 40) & 0x00ff000000000000ULL) | + ((in << 24) & 0x0000ff0000000000ULL) | + ((in << 8) & 0x000000ff00000000ULL) | + ((in >> 8) & 0x00000000ff000000ULL) | + ((in >> 24) & 0x0000000000ff0000ULL) | + ((in >> 40) & 0x000000000000ff00ULL) | + ((in >> 56) & 0x00000000000000ffULL); +} + MEM_STATIC U64 MEM_swap64(U64 in) { #if defined(_MSC_VER) /* Visual Studio */ @@ -262,14 +280,7 @@ MEM_STATIC U64 MEM_swap64(U64 in) || (defined(__clang__) && __has_builtin(__builtin_bswap64)) return __builtin_bswap64(in); #else - return ((in << 56) & 0xff00000000000000ULL) | - ((in << 40) & 0x00ff000000000000ULL) | - ((in << 24) & 0x0000ff0000000000ULL) | - ((in << 8) & 0x000000ff00000000ULL) | - ((in >> 8) & 0x00000000ff000000ULL) | - ((in >> 24) & 0x0000000000ff0000ULL) | - ((in >> 40) & 0x000000000000ff00ULL) | - ((in >> 56) & 0x00000000000000ffULL); + return MEM_swap64_fallback(in); #endif } diff --git a/src/dependencies/zstd-1.5.0/lib/common/pool.c b/src/dependencies/zstd-1.5.4/lib/common/pool.c similarity index 88% rename from src/dependencies/zstd-1.5.0/lib/common/pool.c rename to src/dependencies/zstd-1.5.4/lib/common/pool.c index ea70b8b..f3d9d08 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/pool.c +++ b/src/dependencies/zstd-1.5.4/lib/common/pool.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -12,7 +12,7 @@ /* ====== Dependencies ======= */ #include "zstd_deps.h" /* size_t */ #include "debug.h" /* assert */ -#include "zstd_internal.h" /* ZSTD_customMalloc, ZSTD_customFree */ +#include "zstd_internal.h" /* ZSTD_customCalloc, ZSTD_customFree */ #include "pool.h" /* ====== Compiler specifics ====== */ @@ -86,7 +86,7 @@ static void* POOL_thread(void* opaque) { { POOL_job const job = ctx->queue[ctx->queueHead]; ctx->queueHead = (ctx->queueHead + 1) % ctx->queueSize; ctx->numThreadsBusy++; - ctx->queueEmpty = ctx->queueHead == ctx->queueTail; + ctx->queueEmpty = (ctx->queueHead == ctx->queueTail); /* Unlock the mutex, signal a pusher, and run the job */ ZSTD_pthread_cond_signal(&ctx->queuePushCond); ZSTD_pthread_mutex_unlock(&ctx->queueMutex); @@ -96,15 +96,14 @@ static void* POOL_thread(void* opaque) { /* If the intended queue size was 0, signal after finishing job */ ZSTD_pthread_mutex_lock(&ctx->queueMutex); ctx->numThreadsBusy--; - if (ctx->queueSize == 1) { - ZSTD_pthread_cond_signal(&ctx->queuePushCond); - } + ZSTD_pthread_cond_signal(&ctx->queuePushCond); ZSTD_pthread_mutex_unlock(&ctx->queueMutex); } } /* for (;;) */ assert(0); /* Unreachable */ } +/* ZSTD_createThreadPool() : public access point */ POOL_ctx* ZSTD_createThreadPool(size_t numThreads) { return POOL_create (numThreads, 0); } @@ -114,7 +113,8 @@ POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) { } POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, - ZSTD_customMem customMem) { + ZSTD_customMem customMem) +{ POOL_ctx* ctx; /* Check parameters */ if (!numThreads) { return NULL; } @@ -126,7 +126,7 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, * empty and full queues. */ ctx->queueSize = queueSize + 1; - ctx->queue = (POOL_job*)ZSTD_customMalloc(ctx->queueSize * sizeof(POOL_job), customMem); + ctx->queue = (POOL_job*)ZSTD_customCalloc(ctx->queueSize * sizeof(POOL_job), customMem); ctx->queueHead = 0; ctx->queueTail = 0; ctx->numThreadsBusy = 0; @@ -140,7 +140,7 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, } ctx->shutdown = 0; /* Allocate space for the thread handles */ - ctx->threads = (ZSTD_pthread_t*)ZSTD_customMalloc(numThreads * sizeof(ZSTD_pthread_t), customMem); + ctx->threads = (ZSTD_pthread_t*)ZSTD_customCalloc(numThreads * sizeof(ZSTD_pthread_t), customMem); ctx->threadCapacity = 0; ctx->customMem = customMem; /* Check for errors */ @@ -173,7 +173,7 @@ static void POOL_join(POOL_ctx* ctx) { /* Join all of the threads */ { size_t i; for (i = 0; i < ctx->threadCapacity; ++i) { - ZSTD_pthread_join(ctx->threads[i], NULL); /* note : could fail */ + ZSTD_pthread_join(ctx->threads[i]); /* note : could fail */ } } } @@ -188,11 +188,22 @@ void POOL_free(POOL_ctx *ctx) { ZSTD_customFree(ctx, ctx->customMem); } +/*! POOL_joinJobs() : + * Waits for all queued jobs to finish executing. + */ +void POOL_joinJobs(POOL_ctx* ctx) { + ZSTD_pthread_mutex_lock(&ctx->queueMutex); + while(!ctx->queueEmpty || ctx->numThreadsBusy > 0) { + ZSTD_pthread_cond_wait(&ctx->queuePushCond, &ctx->queueMutex); + } + ZSTD_pthread_mutex_unlock(&ctx->queueMutex); +} + void ZSTD_freeThreadPool (ZSTD_threadPool* pool) { POOL_free (pool); } -size_t POOL_sizeof(POOL_ctx *ctx) { +size_t POOL_sizeof(const POOL_ctx* ctx) { if (ctx==NULL) return 0; /* supports sizeof NULL */ return sizeof(*ctx) + ctx->queueSize * sizeof(POOL_job) @@ -209,7 +220,7 @@ static int POOL_resize_internal(POOL_ctx* ctx, size_t numThreads) return 0; } /* numThreads > threadCapacity */ - { ZSTD_pthread_t* const threadPool = (ZSTD_pthread_t*)ZSTD_customMalloc(numThreads * sizeof(ZSTD_pthread_t), ctx->customMem); + { ZSTD_pthread_t* const threadPool = (ZSTD_pthread_t*)ZSTD_customCalloc(numThreads * sizeof(ZSTD_pthread_t), ctx->customMem); if (!threadPool) return 1; /* replace existing thread pool */ ZSTD_memcpy(threadPool, ctx->threads, ctx->threadCapacity * sizeof(*threadPool)); @@ -257,9 +268,12 @@ static int isQueueFull(POOL_ctx const* ctx) { } -static void POOL_add_internal(POOL_ctx* ctx, POOL_function function, void *opaque) +static void +POOL_add_internal(POOL_ctx* ctx, POOL_function function, void *opaque) { - POOL_job const job = {function, opaque}; + POOL_job job; + job.function = function; + job.opaque = opaque; assert(ctx != NULL); if (ctx->shutdown) return; @@ -313,7 +327,9 @@ POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) { return POOL_create_advanced(numThreads, queueSize, ZSTD_defaultCMem); } -POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, ZSTD_customMem customMem) { +POOL_ctx* +POOL_create_advanced(size_t numThreads, size_t queueSize, ZSTD_customMem customMem) +{ (void)numThreads; (void)queueSize; (void)customMem; @@ -325,6 +341,11 @@ void POOL_free(POOL_ctx* ctx) { (void)ctx; } +void POOL_joinJobs(POOL_ctx* ctx){ + assert(!ctx || ctx == &g_poolCtx); + (void)ctx; +} + int POOL_resize(POOL_ctx* ctx, size_t numThreads) { (void)ctx; (void)numThreads; return 0; @@ -341,7 +362,7 @@ int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque) { return 1; } -size_t POOL_sizeof(POOL_ctx* ctx) { +size_t POOL_sizeof(const POOL_ctx* ctx) { if (ctx==NULL) return 0; /* supports sizeof NULL */ assert(ctx == &g_poolCtx); return sizeof(*ctx); diff --git a/src/dependencies/zstd-1.5.0/lib/common/pool.h b/src/dependencies/zstd-1.5.4/lib/common/pool.h similarity index 89% rename from src/dependencies/zstd-1.5.0/lib/common/pool.h rename to src/dependencies/zstd-1.5.4/lib/common/pool.h index e18aa07..eb22ff5 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/pool.h +++ b/src/dependencies/zstd-1.5.4/lib/common/pool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -38,6 +38,12 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, */ void POOL_free(POOL_ctx* ctx); + +/*! POOL_joinJobs() : + * Waits for all queued jobs to finish executing. + */ +void POOL_joinJobs(POOL_ctx* ctx); + /*! POOL_resize() : * Expands or shrinks pool's number of threads. * This is more efficient than releasing + creating a new context, @@ -53,7 +59,7 @@ int POOL_resize(POOL_ctx* ctx, size_t numThreads); * @return threadpool memory usage * note : compatible with NULL (returns 0 in this case) */ -size_t POOL_sizeof(POOL_ctx* ctx); +size_t POOL_sizeof(const POOL_ctx* ctx); /*! POOL_function : * The function type that can be added to a thread pool. @@ -70,7 +76,7 @@ void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque); /*! POOL_tryAdd() : - * Add the job `function(opaque)` to thread pool _if_ a worker is available. + * Add the job `function(opaque)` to thread pool _if_ a queue slot is available. * Returns immediately even if not (does not block). * @return : 1 if successful, 0 if not. */ diff --git a/src/dependencies/zstd-1.5.4/lib/common/portability_macros.h b/src/dependencies/zstd-1.5.4/lib/common/portability_macros.h new file mode 100644 index 0000000..8fd6ea8 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/common/portability_macros.h @@ -0,0 +1,156 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_PORTABILITY_MACROS_H +#define ZSTD_PORTABILITY_MACROS_H + +/** + * This header file contains macro definitions to support portability. + * This header is shared between C and ASM code, so it MUST only + * contain macro definitions. It MUST not contain any C code. + * + * This header ONLY defines macros to detect platforms/feature support. + * + */ + + +/* compat. with non-clang compilers */ +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif + +/* compat. with non-clang compilers */ +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/* compat. with non-clang compilers */ +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + +/* detects whether we are being compiled under msan */ +#ifndef ZSTD_MEMORY_SANITIZER +# if __has_feature(memory_sanitizer) +# define ZSTD_MEMORY_SANITIZER 1 +# else +# define ZSTD_MEMORY_SANITIZER 0 +# endif +#endif + +/* detects whether we are being compiled under asan */ +#ifndef ZSTD_ADDRESS_SANITIZER +# if __has_feature(address_sanitizer) +# define ZSTD_ADDRESS_SANITIZER 1 +# elif defined(__SANITIZE_ADDRESS__) +# define ZSTD_ADDRESS_SANITIZER 1 +# else +# define ZSTD_ADDRESS_SANITIZER 0 +# endif +#endif + +/* detects whether we are being compiled under dfsan */ +#ifndef ZSTD_DATAFLOW_SANITIZER +# if __has_feature(dataflow_sanitizer) +# define ZSTD_DATAFLOW_SANITIZER 1 +# else +# define ZSTD_DATAFLOW_SANITIZER 0 +# endif +#endif + +/* Mark the internal assembly functions as hidden */ +#ifdef __ELF__ +# define ZSTD_HIDE_ASM_FUNCTION(func) .hidden func +#else +# define ZSTD_HIDE_ASM_FUNCTION(func) +#endif + +/* Enable runtime BMI2 dispatch based on the CPU. + * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default. + */ +#ifndef DYNAMIC_BMI2 + #if ((defined(__clang__) && __has_attribute(__target__)) \ + || (defined(__GNUC__) \ + && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \ + && (defined(__x86_64__) || defined(_M_X64)) \ + && !defined(__BMI2__) + # define DYNAMIC_BMI2 1 + #else + # define DYNAMIC_BMI2 0 + #endif +#endif + +/** + * Only enable assembly for GNUC compatible compilers, + * because other platforms may not support GAS assembly syntax. + * + * Only enable assembly for Linux / MacOS, other platforms may + * work, but they haven't been tested. This could likely be + * extended to BSD systems. + * + * Disable assembly when MSAN is enabled, because MSAN requires + * 100% of code to be instrumented to work. + */ +#if defined(__GNUC__) +# if defined(__linux__) || defined(__linux) || defined(__APPLE__) +# if ZSTD_MEMORY_SANITIZER +# define ZSTD_ASM_SUPPORTED 0 +# elif ZSTD_DATAFLOW_SANITIZER +# define ZSTD_ASM_SUPPORTED 0 +# else +# define ZSTD_ASM_SUPPORTED 1 +# endif +# else +# define ZSTD_ASM_SUPPORTED 0 +# endif +#else +# define ZSTD_ASM_SUPPORTED 0 +#endif + +/** + * Determines whether we should enable assembly for x86-64 + * with BMI2. + * + * Enable if all of the following conditions hold: + * - ASM hasn't been explicitly disabled by defining ZSTD_DISABLE_ASM + * - Assembly is supported + * - We are compiling for x86-64 and either: + * - DYNAMIC_BMI2 is enabled + * - BMI2 is supported at compile time + */ +#if !defined(ZSTD_DISABLE_ASM) && \ + ZSTD_ASM_SUPPORTED && \ + defined(__x86_64__) && \ + (DYNAMIC_BMI2 || defined(__BMI2__)) +# define ZSTD_ENABLE_ASM_X86_64_BMI2 1 +#else +# define ZSTD_ENABLE_ASM_X86_64_BMI2 0 +#endif + +/* + * For x86 ELF targets, add .note.gnu.property section for Intel CET in + * assembly sources when CET is enabled. + * + * Additionally, any function that may be called indirectly must begin + * with ZSTD_CET_ENDBRANCH. + */ +#if defined(__ELF__) && (defined(__x86_64__) || defined(__i386__)) \ + && defined(__has_include) +# if __has_include() +# include +# define ZSTD_CET_ENDBRANCH _CET_ENDBR +# endif +#endif + +#ifndef ZSTD_CET_ENDBRANCH +# define ZSTD_CET_ENDBRANCH +#endif + +#endif /* ZSTD_PORTABILITY_MACROS_H */ diff --git a/src/dependencies/zstd-1.5.4/lib/common/threading.c b/src/dependencies/zstd-1.5.4/lib/common/threading.c new file mode 100644 index 0000000..f234110 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/common/threading.c @@ -0,0 +1,176 @@ +/** + * Copyright (c) 2016 Tino Reichardt + * All rights reserved. + * + * You can contact the author at: + * - zstdmt source repository: https://github.com/mcmilk/zstdmt + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +/** + * This file will hold wrapper for systems, which do not support pthreads + */ + +#include "threading.h" + +/* create fake symbol to avoid empty translation unit warning */ +int g_ZSTD_threading_useless_symbol; + +#if defined(ZSTD_MULTITHREAD) && defined(_WIN32) + +/** + * Windows minimalist Pthread Wrapper + */ + + +/* === Dependencies === */ +#include +#include + + +/* === Implementation === */ + +typedef struct { + void* (*start_routine)(void*); + void* arg; + int initialized; + ZSTD_pthread_cond_t initialized_cond; + ZSTD_pthread_mutex_t initialized_mutex; +} ZSTD_thread_params_t; + +static unsigned __stdcall worker(void *arg) +{ + void* (*start_routine)(void*); + void* thread_arg; + + /* Inialized thread_arg and start_routine and signal main thread that we don't need it + * to wait any longer. + */ + { + ZSTD_thread_params_t* thread_param = (ZSTD_thread_params_t*)arg; + thread_arg = thread_param->arg; + start_routine = thread_param->start_routine; + + /* Signal main thread that we are running and do not depend on its memory anymore */ + ZSTD_pthread_mutex_lock(&thread_param->initialized_mutex); + thread_param->initialized = 1; + ZSTD_pthread_cond_signal(&thread_param->initialized_cond); + ZSTD_pthread_mutex_unlock(&thread_param->initialized_mutex); + } + + start_routine(thread_arg); + + return 0; +} + +int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused, + void* (*start_routine) (void*), void* arg) +{ + ZSTD_thread_params_t thread_param; + (void)unused; + + thread_param.start_routine = start_routine; + thread_param.arg = arg; + thread_param.initialized = 0; + *thread = NULL; + + /* Setup thread initialization synchronization */ + if(ZSTD_pthread_cond_init(&thread_param.initialized_cond, NULL)) { + /* Should never happen on Windows */ + return -1; + } + if(ZSTD_pthread_mutex_init(&thread_param.initialized_mutex, NULL)) { + /* Should never happen on Windows */ + ZSTD_pthread_cond_destroy(&thread_param.initialized_cond); + return -1; + } + + /* Spawn thread */ + *thread = (HANDLE)_beginthreadex(NULL, 0, worker, &thread_param, 0, NULL); + if (!thread) { + ZSTD_pthread_mutex_destroy(&thread_param.initialized_mutex); + ZSTD_pthread_cond_destroy(&thread_param.initialized_cond); + return errno; + } + + /* Wait for thread to be initialized */ + ZSTD_pthread_mutex_lock(&thread_param.initialized_mutex); + while(!thread_param.initialized) { + ZSTD_pthread_cond_wait(&thread_param.initialized_cond, &thread_param.initialized_mutex); + } + ZSTD_pthread_mutex_unlock(&thread_param.initialized_mutex); + ZSTD_pthread_mutex_destroy(&thread_param.initialized_mutex); + ZSTD_pthread_cond_destroy(&thread_param.initialized_cond); + + return 0; +} + +int ZSTD_pthread_join(ZSTD_pthread_t thread) +{ + DWORD result; + + if (!thread) return 0; + + result = WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + + switch (result) { + case WAIT_OBJECT_0: + return 0; + case WAIT_ABANDONED: + return EINVAL; + default: + return GetLastError(); + } +} + +#endif /* ZSTD_MULTITHREAD */ + +#if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32) + +#define ZSTD_DEPS_NEED_MALLOC +#include "zstd_deps.h" + +int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr) +{ + *mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t)); + if (!*mutex) + return 1; + return pthread_mutex_init(*mutex, attr); +} + +int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex) +{ + if (!*mutex) + return 0; + { + int const ret = pthread_mutex_destroy(*mutex); + ZSTD_free(*mutex); + return ret; + } +} + +int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr) +{ + *cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t)); + if (!*cond) + return 1; + return pthread_cond_init(*cond, attr); +} + +int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond) +{ + if (!*cond) + return 0; + { + int const ret = pthread_cond_destroy(*cond); + ZSTD_free(*cond); + return ret; + } +} + +#endif diff --git a/src/dependencies/zstd-1.5.0/lib/common/threading.h b/src/dependencies/zstd-1.5.4/lib/common/threading.h similarity index 92% rename from src/dependencies/zstd-1.5.0/lib/common/threading.h rename to src/dependencies/zstd-1.5.4/lib/common/threading.h index fd0060d..fb5c1c8 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/threading.h +++ b/src/dependencies/zstd-1.5.4/lib/common/threading.h @@ -23,8 +23,7 @@ extern "C" { #if defined(ZSTD_MULTITHREAD) && defined(_WIN32) /** - * Windows minimalist Pthread Wrapper, based on : - * http://www.cse.wustl.edu/~schmidt/win32-cv-1.html + * Windows minimalist Pthread Wrapper */ #ifdef WINVER # undef WINVER @@ -62,16 +61,12 @@ extern "C" { #define ZSTD_pthread_cond_broadcast(a) WakeAllConditionVariable((a)) /* ZSTD_pthread_create() and ZSTD_pthread_join() */ -typedef struct { - HANDLE handle; - void* (*start_routine)(void*); - void* arg; -} ZSTD_pthread_t; +typedef HANDLE ZSTD_pthread_t; int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused, void* (*start_routine) (void*), void* arg); -int ZSTD_pthread_join(ZSTD_pthread_t thread, void** value_ptr); +int ZSTD_pthread_join(ZSTD_pthread_t thread); /** * add here more wrappers as required @@ -99,7 +94,7 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void** value_ptr); #define ZSTD_pthread_t pthread_t #define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d)) -#define ZSTD_pthread_join(a, b) pthread_join((a),(b)) +#define ZSTD_pthread_join(a) pthread_join((a),NULL) #else /* DEBUGLEVEL >= 1 */ @@ -124,7 +119,7 @@ int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond); #define ZSTD_pthread_t pthread_t #define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d)) -#define ZSTD_pthread_join(a, b) pthread_join((a),(b)) +#define ZSTD_pthread_join(a) pthread_join((a),NULL) #endif diff --git a/src/dependencies/zstd-1.5.4/lib/common/xxhash.c b/src/dependencies/zstd-1.5.4/lib/common/xxhash.c new file mode 100644 index 0000000..fd237c9 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/common/xxhash.c @@ -0,0 +1,24 @@ +/* + * xxHash - Fast Hash algorithm + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * You can contact the author at : + * - xxHash homepage: https://cyan4973.github.io/xxHash/ + * - xxHash source repository : https://github.com/Cyan4973/xxHash + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. +*/ + + + +/* + * xxhash.c instantiates functions defined in xxhash.h + */ + +#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */ +#define XXH_IMPLEMENTATION /* access definitions */ + +#include "xxhash.h" diff --git a/src/dependencies/zstd-1.5.4/lib/common/xxhash.h b/src/dependencies/zstd-1.5.4/lib/common/xxhash.h new file mode 100644 index 0000000..b8b7329 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/common/xxhash.h @@ -0,0 +1,5686 @@ +/* + * xxHash - Fast Hash algorithm + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * You can contact the author at : + * - xxHash homepage: https://cyan4973.github.io/xxHash/ + * - xxHash source repository : https://github.com/Cyan4973/xxHash + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. +*/ + + +#ifndef XXH_NO_XXH3 +# define XXH_NO_XXH3 +#endif + +#ifndef XXH_NAMESPACE +# define XXH_NAMESPACE ZSTD_ +#endif + +/*! + * @mainpage xxHash + * + * @file xxhash.h + * xxHash prototypes and implementation + */ +/* TODO: update */ +/* Notice extracted from xxHash homepage: + +xxHash is an extremely fast hash algorithm, running at RAM speed limits. +It also successfully passes all tests from the SMHasher suite. + +Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) + +Name Speed Q.Score Author +xxHash 5.4 GB/s 10 +CrapWow 3.2 GB/s 2 Andrew +MurmurHash 3a 2.7 GB/s 10 Austin Appleby +SpookyHash 2.0 GB/s 10 Bob Jenkins +SBox 1.4 GB/s 9 Bret Mulvey +Lookup3 1.2 GB/s 9 Bob Jenkins +SuperFastHash 1.2 GB/s 1 Paul Hsieh +CityHash64 1.05 GB/s 10 Pike & Alakuijala +FNV 0.55 GB/s 5 Fowler, Noll, Vo +CRC32 0.43 GB/s 9 +MD5-32 0.33 GB/s 10 Ronald L. Rivest +SHA1-32 0.28 GB/s 10 + +Q.Score is a measure of quality of the hash function. +It depends on successfully passing SMHasher test set. +10 is a perfect score. + +Note: SMHasher's CRC32 implementation is not the fastest one. +Other speed-oriented implementations can be faster, +especially in combination with PCLMUL instruction: +https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html?showComment=1552696407071#c3490092340461170735 + +A 64-bit version, named XXH64, is available since r35. +It offers much better speed, but for 64-bit applications only. +Name Speed on 64 bits Speed on 32 bits +XXH64 13.8 GB/s 1.9 GB/s +XXH32 6.8 GB/s 6.0 GB/s +*/ + +#if defined (__cplusplus) +extern "C" { +#endif + +/* **************************** + * INLINE mode + ******************************/ +/*! + * XXH_INLINE_ALL (and XXH_PRIVATE_API) + * Use these build macros to inline xxhash into the target unit. + * Inlining improves performance on small inputs, especially when the length is + * expressed as a compile-time constant: + * + * https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html + * + * It also keeps xxHash symbols private to the unit, so they are not exported. + * + * Usage: + * #define XXH_INLINE_ALL + * #include "xxhash.h" + * + * Do not compile and link xxhash.o as a separate object, as it is not useful. + */ +#if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API)) \ + && !defined(XXH_INLINE_ALL_31684351384) + /* this section should be traversed only once */ +# define XXH_INLINE_ALL_31684351384 + /* give access to the advanced API, required to compile implementations */ +# undef XXH_STATIC_LINKING_ONLY /* avoid macro redef */ +# define XXH_STATIC_LINKING_ONLY + /* make all functions private */ +# undef XXH_PUBLIC_API +# if defined(__GNUC__) +# define XXH_PUBLIC_API static __inline __attribute__((unused)) +# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) +# define XXH_PUBLIC_API static inline +# elif defined(_MSC_VER) +# define XXH_PUBLIC_API static __inline +# else + /* note: this version may generate warnings for unused static functions */ +# define XXH_PUBLIC_API static +# endif + + /* + * This part deals with the special case where a unit wants to inline xxHash, + * but "xxhash.h" has previously been included without XXH_INLINE_ALL, + * such as part of some previously included *.h header file. + * Without further action, the new include would just be ignored, + * and functions would effectively _not_ be inlined (silent failure). + * The following macros solve this situation by prefixing all inlined names, + * avoiding naming collision with previous inclusions. + */ + /* Before that, we unconditionally #undef all symbols, + * in case they were already defined with XXH_NAMESPACE. + * They will then be redefined for XXH_INLINE_ALL + */ +# undef XXH_versionNumber + /* XXH32 */ +# undef XXH32 +# undef XXH32_createState +# undef XXH32_freeState +# undef XXH32_reset +# undef XXH32_update +# undef XXH32_digest +# undef XXH32_copyState +# undef XXH32_canonicalFromHash +# undef XXH32_hashFromCanonical + /* XXH64 */ +# undef XXH64 +# undef XXH64_createState +# undef XXH64_freeState +# undef XXH64_reset +# undef XXH64_update +# undef XXH64_digest +# undef XXH64_copyState +# undef XXH64_canonicalFromHash +# undef XXH64_hashFromCanonical + /* XXH3_64bits */ +# undef XXH3_64bits +# undef XXH3_64bits_withSecret +# undef XXH3_64bits_withSeed +# undef XXH3_64bits_withSecretandSeed +# undef XXH3_createState +# undef XXH3_freeState +# undef XXH3_copyState +# undef XXH3_64bits_reset +# undef XXH3_64bits_reset_withSeed +# undef XXH3_64bits_reset_withSecret +# undef XXH3_64bits_update +# undef XXH3_64bits_digest +# undef XXH3_generateSecret + /* XXH3_128bits */ +# undef XXH128 +# undef XXH3_128bits +# undef XXH3_128bits_withSeed +# undef XXH3_128bits_withSecret +# undef XXH3_128bits_reset +# undef XXH3_128bits_reset_withSeed +# undef XXH3_128bits_reset_withSecret +# undef XXH3_128bits_reset_withSecretandSeed +# undef XXH3_128bits_update +# undef XXH3_128bits_digest +# undef XXH128_isEqual +# undef XXH128_cmp +# undef XXH128_canonicalFromHash +# undef XXH128_hashFromCanonical + /* Finally, free the namespace itself */ +# undef XXH_NAMESPACE + + /* employ the namespace for XXH_INLINE_ALL */ +# define XXH_NAMESPACE XXH_INLINE_ + /* + * Some identifiers (enums, type names) are not symbols, + * but they must nonetheless be renamed to avoid redeclaration. + * Alternative solution: do not redeclare them. + * However, this requires some #ifdefs, and has a more dispersed impact. + * Meanwhile, renaming can be achieved in a single place. + */ +# define XXH_IPREF(Id) XXH_NAMESPACE ## Id +# define XXH_OK XXH_IPREF(XXH_OK) +# define XXH_ERROR XXH_IPREF(XXH_ERROR) +# define XXH_errorcode XXH_IPREF(XXH_errorcode) +# define XXH32_canonical_t XXH_IPREF(XXH32_canonical_t) +# define XXH64_canonical_t XXH_IPREF(XXH64_canonical_t) +# define XXH128_canonical_t XXH_IPREF(XXH128_canonical_t) +# define XXH32_state_s XXH_IPREF(XXH32_state_s) +# define XXH32_state_t XXH_IPREF(XXH32_state_t) +# define XXH64_state_s XXH_IPREF(XXH64_state_s) +# define XXH64_state_t XXH_IPREF(XXH64_state_t) +# define XXH3_state_s XXH_IPREF(XXH3_state_s) +# define XXH3_state_t XXH_IPREF(XXH3_state_t) +# define XXH128_hash_t XXH_IPREF(XXH128_hash_t) + /* Ensure the header is parsed again, even if it was previously included */ +# undef XXHASH_H_5627135585666179 +# undef XXHASH_H_STATIC_13879238742 +#endif /* XXH_INLINE_ALL || XXH_PRIVATE_API */ + + + +/* **************************************************************** + * Stable API + *****************************************************************/ +#ifndef XXHASH_H_5627135585666179 +#define XXHASH_H_5627135585666179 1 + + +/*! + * @defgroup public Public API + * Contains details on the public xxHash functions. + * @{ + */ +/* specific declaration modes for Windows */ +#if !defined(XXH_INLINE_ALL) && !defined(XXH_PRIVATE_API) +# if defined(WIN32) && defined(_MSC_VER) && (defined(XXH_IMPORT) || defined(XXH_EXPORT)) +# ifdef XXH_EXPORT +# define XXH_PUBLIC_API __declspec(dllexport) +# elif XXH_IMPORT +# define XXH_PUBLIC_API __declspec(dllimport) +# endif +# else +# define XXH_PUBLIC_API /* do nothing */ +# endif +#endif + +#ifdef XXH_DOXYGEN +/*! + * @brief Emulate a namespace by transparently prefixing all symbols. + * + * If you want to include _and expose_ xxHash functions from within your own + * library, but also want to avoid symbol collisions with other libraries which + * may also include xxHash, you can use XXH_NAMESPACE to automatically prefix + * any public symbol from xxhash library with the value of XXH_NAMESPACE + * (therefore, avoid empty or numeric values). + * + * Note that no change is required within the calling program as long as it + * includes `xxhash.h`: Regular symbol names will be automatically translated + * by this header. + */ +# define XXH_NAMESPACE /* YOUR NAME HERE */ +# undef XXH_NAMESPACE +#endif + +#ifdef XXH_NAMESPACE +# define XXH_CAT(A,B) A##B +# define XXH_NAME2(A,B) XXH_CAT(A,B) +# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) +/* XXH32 */ +# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) +# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) +# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) +# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) +# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) +# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) +# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) +# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) +# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) +/* XXH64 */ +# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) +# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) +# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) +# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) +# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) +# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) +# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) +# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) +# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) +/* XXH3_64bits */ +# define XXH3_64bits XXH_NAME2(XXH_NAMESPACE, XXH3_64bits) +# define XXH3_64bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSecret) +# define XXH3_64bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSeed) +# define XXH3_64bits_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_withSecretandSeed) +# define XXH3_createState XXH_NAME2(XXH_NAMESPACE, XXH3_createState) +# define XXH3_freeState XXH_NAME2(XXH_NAMESPACE, XXH3_freeState) +# define XXH3_copyState XXH_NAME2(XXH_NAMESPACE, XXH3_copyState) +# define XXH3_64bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset) +# define XXH3_64bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSeed) +# define XXH3_64bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSecret) +# define XXH3_64bits_reset_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_reset_withSecretandSeed) +# define XXH3_64bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_update) +# define XXH3_64bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_64bits_digest) +# define XXH3_generateSecret XXH_NAME2(XXH_NAMESPACE, XXH3_generateSecret) +# define XXH3_generateSecret_fromSeed XXH_NAME2(XXH_NAMESPACE, XXH3_generateSecret_fromSeed) +/* XXH3_128bits */ +# define XXH128 XXH_NAME2(XXH_NAMESPACE, XXH128) +# define XXH3_128bits XXH_NAME2(XXH_NAMESPACE, XXH3_128bits) +# define XXH3_128bits_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSeed) +# define XXH3_128bits_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSecret) +# define XXH3_128bits_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_withSecretandSeed) +# define XXH3_128bits_reset XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset) +# define XXH3_128bits_reset_withSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSeed) +# define XXH3_128bits_reset_withSecret XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSecret) +# define XXH3_128bits_reset_withSecretandSeed XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_reset_withSecretandSeed) +# define XXH3_128bits_update XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_update) +# define XXH3_128bits_digest XXH_NAME2(XXH_NAMESPACE, XXH3_128bits_digest) +# define XXH128_isEqual XXH_NAME2(XXH_NAMESPACE, XXH128_isEqual) +# define XXH128_cmp XXH_NAME2(XXH_NAMESPACE, XXH128_cmp) +# define XXH128_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH128_canonicalFromHash) +# define XXH128_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH128_hashFromCanonical) +#endif + + +/* ************************************* +* Version +***************************************/ +#define XXH_VERSION_MAJOR 0 +#define XXH_VERSION_MINOR 8 +#define XXH_VERSION_RELEASE 1 +#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) + +/*! + * @brief Obtains the xxHash version. + * + * This is mostly useful when xxHash is compiled as a shared library, + * since the returned value comes from the library, as opposed to header file. + * + * @return `XXH_VERSION_NUMBER` of the invoked library. + */ +XXH_PUBLIC_API unsigned XXH_versionNumber (void); + + +/* **************************** +* Common basic types +******************************/ +#include /* size_t */ +typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; + + +/*-********************************************************************** +* 32-bit hash +************************************************************************/ +#if defined(XXH_DOXYGEN) /* Don't show include */ +/*! + * @brief An unsigned 32-bit integer. + * + * Not necessarily defined to `uint32_t` but functionally equivalent. + */ +typedef uint32_t XXH32_hash_t; + +#elif !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include + typedef uint32_t XXH32_hash_t; + +#else +# include +# if UINT_MAX == 0xFFFFFFFFUL + typedef unsigned int XXH32_hash_t; +# else +# if ULONG_MAX == 0xFFFFFFFFUL + typedef unsigned long XXH32_hash_t; +# else +# error "unsupported platform: need a 32-bit type" +# endif +# endif +#endif + +/*! + * @} + * + * @defgroup xxh32_family XXH32 family + * @ingroup public + * Contains functions used in the classic 32-bit xxHash algorithm. + * + * @note + * XXH32 is useful for older platforms, with no or poor 64-bit performance. + * Note that @ref xxh3_family provides competitive speed + * for both 32-bit and 64-bit systems, and offers true 64/128 bit hash results. + * + * @see @ref xxh64_family, @ref xxh3_family : Other xxHash families + * @see @ref xxh32_impl for implementation details + * @{ + */ + +/*! + * @brief Calculates the 32-bit hash of @p input using xxHash32. + * + * Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark): 5.4 GB/s + * + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * @param seed The 32-bit seed to alter the hash's output predictably. + * + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 32-bit hash value. + * + * @see + * XXH64(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): + * Direct equivalents for the other variants of xxHash. + * @see + * XXH32_createState(), XXH32_update(), XXH32_digest(): Streaming version. + */ +XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed); + +/*! + * Streaming functions generate the xxHash value from an incremental input. + * This method is slower than single-call functions, due to state management. + * For small inputs, prefer `XXH32()` and `XXH64()`, which are better optimized. + * + * An XXH state must first be allocated using `XXH*_createState()`. + * + * Start a new hash by initializing the state with a seed using `XXH*_reset()`. + * + * Then, feed the hash state by calling `XXH*_update()` as many times as necessary. + * + * The function returns an error code, with 0 meaning OK, and any other value + * meaning there is an error. + * + * Finally, a hash value can be produced anytime, by using `XXH*_digest()`. + * This function returns the nn-bits hash as an int or long long. + * + * It's still possible to continue inserting input into the hash state after a + * digest, and generate new hash values later on by invoking `XXH*_digest()`. + * + * When done, release the state using `XXH*_freeState()`. + * + * Example code for incrementally hashing a file: + * @code{.c} + * #include + * #include + * #define BUFFER_SIZE 256 + * + * // Note: XXH64 and XXH3 use the same interface. + * XXH32_hash_t + * hashFile(FILE* stream) + * { + * XXH32_state_t* state; + * unsigned char buf[BUFFER_SIZE]; + * size_t amt; + * XXH32_hash_t hash; + * + * state = XXH32_createState(); // Create a state + * assert(state != NULL); // Error check here + * XXH32_reset(state, 0xbaad5eed); // Reset state with our seed + * while ((amt = fread(buf, 1, sizeof(buf), stream)) != 0) { + * XXH32_update(state, buf, amt); // Hash the file in chunks + * } + * hash = XXH32_digest(state); // Finalize the hash + * XXH32_freeState(state); // Clean up + * return hash; + * } + * @endcode + */ + +/*! + * @typedef struct XXH32_state_s XXH32_state_t + * @brief The opaque state struct for the XXH32 streaming API. + * + * @see XXH32_state_s for details. + */ +typedef struct XXH32_state_s XXH32_state_t; + +/*! + * @brief Allocates an @ref XXH32_state_t. + * + * Must be freed with XXH32_freeState(). + * @return An allocated XXH32_state_t on success, `NULL` on failure. + */ +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); +/*! + * @brief Frees an @ref XXH32_state_t. + * + * Must be allocated with XXH32_createState(). + * @param statePtr A pointer to an @ref XXH32_state_t allocated with @ref XXH32_createState(). + * @return XXH_OK. + */ +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); +/*! + * @brief Copies one @ref XXH32_state_t to another. + * + * @param dst_state The state to copy to. + * @param src_state The state to copy from. + * @pre + * @p dst_state and @p src_state must not be `NULL` and must not overlap. + */ +XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_t* src_state); + +/*! + * @brief Resets an @ref XXH32_state_t to begin a new hash. + * + * This function resets and seeds a state. Call it before @ref XXH32_update(). + * + * @param statePtr The state struct to reset. + * @param seed The 32-bit seed to alter the hash result predictably. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return @ref XXH_OK on success, @ref XXH_ERROR on failure. + */ +XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, XXH32_hash_t seed); + +/*! + * @brief Consumes a block of @p input to an @ref XXH32_state_t. + * + * Call this to incrementally consume blocks of data. + * + * @param statePtr The state struct to update. + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * + * @pre + * @p statePtr must not be `NULL`. + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return @ref XXH_OK on success, @ref XXH_ERROR on failure. + */ +XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); + +/*! + * @brief Returns the calculated hash value from an @ref XXH32_state_t. + * + * @note + * Calling XXH32_digest() will not affect @p statePtr, so you can update, + * digest, and update again. + * + * @param statePtr The state struct to calculate the hash from. + * + * @pre + * @p statePtr must not be `NULL`. + * + * @return The calculated xxHash32 value from that state. + */ +XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); + +/******* Canonical representation *******/ + +/* + * The default return values from XXH functions are unsigned 32 and 64 bit + * integers. + * This the simplest and fastest format for further post-processing. + * + * However, this leaves open the question of what is the order on the byte level, + * since little and big endian conventions will store the same number differently. + * + * The canonical representation settles this issue by mandating big-endian + * convention, the same convention as human-readable numbers (large digits first). + * + * When writing hash values to storage, sending them over a network, or printing + * them, it's highly recommended to use the canonical representation to ensure + * portability across a wider range of systems, present and future. + * + * The following functions allow transformation of hash values to and from + * canonical format. + */ + +/*! + * @brief Canonical (big endian) representation of @ref XXH32_hash_t. + */ +typedef struct { + unsigned char digest[4]; /*!< Hash bytes, big endian */ +} XXH32_canonical_t; + +/*! + * @brief Converts an @ref XXH32_hash_t to a big endian @ref XXH32_canonical_t. + * + * @param dst The @ref XXH32_canonical_t pointer to be stored to. + * @param hash The @ref XXH32_hash_t to be converted. + * + * @pre + * @p dst must not be `NULL`. + */ +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); + +/*! + * @brief Converts an @ref XXH32_canonical_t to a native @ref XXH32_hash_t. + * + * @param src The @ref XXH32_canonical_t to convert. + * + * @pre + * @p src must not be `NULL`. + * + * @return The converted hash. + */ +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); + + +#ifdef __has_attribute +# define XXH_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define XXH_HAS_ATTRIBUTE(x) 0 +#endif + +/* C-language Attributes are added in C23. */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute) +# define XXH_HAS_C_ATTRIBUTE(x) __has_c_attribute(x) +#else +# define XXH_HAS_C_ATTRIBUTE(x) 0 +#endif + +#if defined(__cplusplus) && defined(__has_cpp_attribute) +# define XXH_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define XXH_HAS_CPP_ATTRIBUTE(x) 0 +#endif + +/* +Define XXH_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute +introduced in CPP17 and C23. +CPP17 : https://en.cppreference.com/w/cpp/language/attributes/fallthrough +C23 : https://en.cppreference.com/w/c/language/attributes/fallthrough +*/ +#if XXH_HAS_C_ATTRIBUTE(x) +# define XXH_FALLTHROUGH [[fallthrough]] +#elif XXH_HAS_CPP_ATTRIBUTE(x) +# define XXH_FALLTHROUGH [[fallthrough]] +#elif XXH_HAS_ATTRIBUTE(__fallthrough__) +# define XXH_FALLTHROUGH __attribute__ ((fallthrough)) +#else +# define XXH_FALLTHROUGH +#endif + +/*! + * @} + * @ingroup public + * @{ + */ + +#ifndef XXH_NO_LONG_LONG +/*-********************************************************************** +* 64-bit hash +************************************************************************/ +#if defined(XXH_DOXYGEN) /* don't include */ +/*! + * @brief An unsigned 64-bit integer. + * + * Not necessarily defined to `uint64_t` but functionally equivalent. + */ +typedef uint64_t XXH64_hash_t; +#elif !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include + typedef uint64_t XXH64_hash_t; +#else +# include +# if defined(__LP64__) && ULONG_MAX == 0xFFFFFFFFFFFFFFFFULL + /* LP64 ABI says uint64_t is unsigned long */ + typedef unsigned long XXH64_hash_t; +# else + /* the following type must have a width of 64-bit */ + typedef unsigned long long XXH64_hash_t; +# endif +#endif + +/*! + * @} + * + * @defgroup xxh64_family XXH64 family + * @ingroup public + * @{ + * Contains functions used in the classic 64-bit xxHash algorithm. + * + * @note + * XXH3 provides competitive speed for both 32-bit and 64-bit systems, + * and offers true 64/128 bit hash results. + * It provides better speed for systems with vector processing capabilities. + */ + + +/*! + * @brief Calculates the 64-bit hash of @p input using xxHash64. + * + * This function usually runs faster on 64-bit systems, but slower on 32-bit + * systems (see benchmark). + * + * @param input The block of data to be hashed, at least @p length bytes in size. + * @param length The length of @p input, in bytes. + * @param seed The 64-bit seed to alter the hash's output predictably. + * + * @pre + * The memory between @p input and @p input + @p length must be valid, + * readable, contiguous memory. However, if @p length is `0`, @p input may be + * `NULL`. In C++, this also must be *TriviallyCopyable*. + * + * @return The calculated 64-bit hash. + * + * @see + * XXH32(), XXH3_64bits_withSeed(), XXH3_128bits_withSeed(), XXH128(): + * Direct equivalents for the other variants of xxHash. + * @see + * XXH64_createState(), XXH64_update(), XXH64_digest(): Streaming version. + */ +XXH_PUBLIC_API XXH64_hash_t XXH64(const void* input, size_t length, XXH64_hash_t seed); + +/******* Streaming *******/ +/*! + * @brief The opaque state struct for the XXH64 streaming API. + * + * @see XXH64_state_s for details. + */ +typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ +XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); +XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state); + +XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); + +/******* Canonical representation *******/ +typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t; +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); + +#ifndef XXH_NO_XXH3 +/*! + * @} + * ************************************************************************ + * @defgroup xxh3_family XXH3 family + * @ingroup public + * @{ + * + * XXH3 is a more recent hash algorithm featuring: + * - Improved speed for both small and large inputs + * - True 64-bit and 128-bit outputs + * - SIMD acceleration + * - Improved 32-bit viability + * + * Speed analysis methodology is explained here: + * + * https://fastcompression.blogspot.com/2019/03/presenting-xxh3.html + * + * Compared to XXH64, expect XXH3 to run approximately + * ~2x faster on large inputs and >3x faster on small ones, + * exact differences vary depending on platform. + * + * XXH3's speed benefits greatly from SIMD and 64-bit arithmetic, + * but does not require it. + * Any 32-bit and 64-bit targets that can run XXH32 smoothly + * can run XXH3 at competitive speeds, even without vector support. + * Further details are explained in the implementation. + * + * Optimized implementations are provided for AVX512, AVX2, SSE2, NEON, POWER8, + * ZVector and scalar targets. This can be controlled via the XXH_VECTOR macro. + * + * XXH3 implementation is portable: + * it has a generic C90 formulation that can be compiled on any platform, + * all implementations generage exactly the same hash value on all platforms. + * Starting from v0.8.0, it's also labelled "stable", meaning that + * any future version will also generate the same hash value. + * + * XXH3 offers 2 variants, _64bits and _128bits. + * + * When only 64 bits are needed, prefer invoking the _64bits variant, as it + * reduces the amount of mixing, resulting in faster speed on small inputs. + * It's also generally simpler to manipulate a scalar return type than a struct. + * + * The API supports one-shot hashing, streaming mode, and custom secrets. + */ + +/*-********************************************************************** +* XXH3 64-bit variant +************************************************************************/ + +/* XXH3_64bits(): + * default 64-bit variant, using default secret and default seed of 0. + * It's the fastest variant. */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* data, size_t len); + +/* + * XXH3_64bits_withSeed(): + * This variant generates a custom secret on the fly + * based on default secret altered using the `seed` value. + * While this operation is decently fast, note that it's not completely free. + * Note: seed==0 produces the same results as XXH3_64bits(). + */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); + +/*! + * The bare minimum size for a custom secret. + * + * @see + * XXH3_64bits_withSecret(), XXH3_64bits_reset_withSecret(), + * XXH3_128bits_withSecret(), XXH3_128bits_reset_withSecret(). + */ +#define XXH3_SECRET_SIZE_MIN 136 + +/* + * XXH3_64bits_withSecret(): + * It's possible to provide any blob of bytes as a "secret" to generate the hash. + * This makes it more difficult for an external actor to prepare an intentional collision. + * The main condition is that secretSize *must* be large enough (>= XXH3_SECRET_SIZE_MIN). + * However, the quality of the secret impacts the dispersion of the hash algorithm. + * Therefore, the secret _must_ look like a bunch of random bytes. + * Avoid "trivial" or structured data such as repeated sequences or a text document. + * Whenever in doubt about the "randomness" of the blob of bytes, + * consider employing "XXH3_generateSecret()" instead (see below). + * It will generate a proper high entropy secret derived from the blob of bytes. + * Another advantage of using XXH3_generateSecret() is that + * it guarantees that all bits within the initial blob of bytes + * will impact every bit of the output. + * This is not necessarily the case when using the blob of bytes directly + * because, when hashing _small_ inputs, only a portion of the secret is employed. + */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); + + +/******* Streaming *******/ +/* + * Streaming requires state maintenance. + * This operation costs memory and CPU. + * As a consequence, streaming is slower than one-shot hashing. + * For better performance, prefer one-shot functions whenever applicable. + */ + +/*! + * @brief The state struct for the XXH3 streaming API. + * + * @see XXH3_state_s for details. + */ +typedef struct XXH3_state_s XXH3_state_t; +XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void); +XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr); +XXH_PUBLIC_API void XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state); + +/* + * XXH3_64bits_reset(): + * Initialize with default parameters. + * digest will be equivalent to `XXH3_64bits()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset(XXH3_state_t* statePtr); +/* + * XXH3_64bits_reset_withSeed(): + * Generate a custom secret from `seed`, and store it into `statePtr`. + * digest will be equivalent to `XXH3_64bits_withSeed()`. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); +/* + * XXH3_64bits_reset_withSecret(): + * `secret` is referenced, it _must outlive_ the hash streaming session. + * Similar to one-shot API, `secretSize` must be >= `XXH3_SECRET_SIZE_MIN`, + * and the quality of produced hash values depends on secret's entropy + * (secret's content should look like a bunch of random bytes). + * When in doubt about the randomness of a candidate `secret`, + * consider employing `XXH3_generateSecret()` instead (see below). + */ +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); + +XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update (XXH3_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* statePtr); + +/* note : canonical representation of XXH3 is the same as XXH64 + * since they both produce XXH64_hash_t values */ + + +/*-********************************************************************** +* XXH3 128-bit variant +************************************************************************/ + +/*! + * @brief The return value from 128-bit hashes. + * + * Stored in little endian order, although the fields themselves are in native + * endianness. + */ +typedef struct { + XXH64_hash_t low64; /*!< `value & 0xFFFFFFFFFFFFFFFF` */ + XXH64_hash_t high64; /*!< `value >> 64` */ +} XXH128_hash_t; + +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* data, size_t len); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed(const void* data, size_t len, XXH64_hash_t seed); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret(const void* data, size_t len, const void* secret, size_t secretSize); + +/******* Streaming *******/ +/* + * Streaming requires state maintenance. + * This operation costs memory and CPU. + * As a consequence, streaming is slower than one-shot hashing. + * For better performance, prefer one-shot functions whenever applicable. + * + * XXH3_128bits uses the same XXH3_state_t as XXH3_64bits(). + * Use already declared XXH3_createState() and XXH3_freeState(). + * + * All reset and streaming functions have same meaning as their 64-bit counterpart. + */ + +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset(XXH3_state_t* statePtr); +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed); +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize); + +XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update (XXH3_state_t* statePtr, const void* input, size_t length); +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* statePtr); + +/* Following helper functions make it possible to compare XXH128_hast_t values. + * Since XXH128_hash_t is a structure, this capability is not offered by the language. + * Note: For better performance, these functions can be inlined using XXH_INLINE_ALL */ + +/*! + * XXH128_isEqual(): + * Return: 1 if `h1` and `h2` are equal, 0 if they are not. + */ +XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2); + +/*! + * XXH128_cmp(): + * + * This comparator is compatible with stdlib's `qsort()`/`bsearch()`. + * + * return: >0 if *h128_1 > *h128_2 + * =0 if *h128_1 == *h128_2 + * <0 if *h128_1 < *h128_2 + */ +XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2); + + +/******* Canonical representation *******/ +typedef struct { unsigned char digest[sizeof(XXH128_hash_t)]; } XXH128_canonical_t; +XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash); +XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* src); + + +#endif /* !XXH_NO_XXH3 */ +#endif /* XXH_NO_LONG_LONG */ + +/*! + * @} + */ +#endif /* XXHASH_H_5627135585666179 */ + + + +#if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) +#define XXHASH_H_STATIC_13879238742 +/* **************************************************************************** + * This section contains declarations which are not guaranteed to remain stable. + * They may change in future versions, becoming incompatible with a different + * version of the library. + * These declarations should only be used with static linking. + * Never use them in association with dynamic linking! + ***************************************************************************** */ + +/* + * These definitions are only present to allow static allocation + * of XXH states, on stack or in a struct, for example. + * Never **ever** access their members directly. + */ + +/*! + * @internal + * @brief Structure for XXH32 streaming API. + * + * @note This is only defined when @ref XXH_STATIC_LINKING_ONLY, + * @ref XXH_INLINE_ALL, or @ref XXH_IMPLEMENTATION is defined. Otherwise it is + * an opaque type. This allows fields to safely be changed. + * + * Typedef'd to @ref XXH32_state_t. + * Do not access the members of this struct directly. + * @see XXH64_state_s, XXH3_state_s + */ +struct XXH32_state_s { + XXH32_hash_t total_len_32; /*!< Total length hashed, modulo 2^32 */ + XXH32_hash_t large_len; /*!< Whether the hash is >= 16 (handles @ref total_len_32 overflow) */ + XXH32_hash_t v[4]; /*!< Accumulator lanes */ + XXH32_hash_t mem32[4]; /*!< Internal buffer for partial reads. Treated as unsigned char[16]. */ + XXH32_hash_t memsize; /*!< Amount of data in @ref mem32 */ + XXH32_hash_t reserved; /*!< Reserved field. Do not read nor write to it. */ +}; /* typedef'd to XXH32_state_t */ + + +#ifndef XXH_NO_LONG_LONG /* defined when there is no 64-bit support */ + +/*! + * @internal + * @brief Structure for XXH64 streaming API. + * + * @note This is only defined when @ref XXH_STATIC_LINKING_ONLY, + * @ref XXH_INLINE_ALL, or @ref XXH_IMPLEMENTATION is defined. Otherwise it is + * an opaque type. This allows fields to safely be changed. + * + * Typedef'd to @ref XXH64_state_t. + * Do not access the members of this struct directly. + * @see XXH32_state_s, XXH3_state_s + */ +struct XXH64_state_s { + XXH64_hash_t total_len; /*!< Total length hashed. This is always 64-bit. */ + XXH64_hash_t v[4]; /*!< Accumulator lanes */ + XXH64_hash_t mem64[4]; /*!< Internal buffer for partial reads. Treated as unsigned char[32]. */ + XXH32_hash_t memsize; /*!< Amount of data in @ref mem64 */ + XXH32_hash_t reserved32; /*!< Reserved field, needed for padding anyways*/ + XXH64_hash_t reserved64; /*!< Reserved field. Do not read or write to it. */ +}; /* typedef'd to XXH64_state_t */ + + +#ifndef XXH_NO_XXH3 + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* >= C11 */ +# include +# define XXH_ALIGN(n) alignas(n) +#elif defined(__cplusplus) && (__cplusplus >= 201103L) /* >= C++11 */ +/* In C++ alignas() is a keyword */ +# define XXH_ALIGN(n) alignas(n) +#elif defined(__GNUC__) +# define XXH_ALIGN(n) __attribute__ ((aligned(n))) +#elif defined(_MSC_VER) +# define XXH_ALIGN(n) __declspec(align(n)) +#else +# define XXH_ALIGN(n) /* disabled */ +#endif + +/* Old GCC versions only accept the attribute after the type in structures. */ +#if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) /* C11+ */ \ + && ! (defined(__cplusplus) && (__cplusplus >= 201103L)) /* >= C++11 */ \ + && defined(__GNUC__) +# define XXH_ALIGN_MEMBER(align, type) type XXH_ALIGN(align) +#else +# define XXH_ALIGN_MEMBER(align, type) XXH_ALIGN(align) type +#endif + +/*! + * @brief The size of the internal XXH3 buffer. + * + * This is the optimal update size for incremental hashing. + * + * @see XXH3_64b_update(), XXH3_128b_update(). + */ +#define XXH3_INTERNALBUFFER_SIZE 256 + +/*! + * @brief Default size of the secret buffer (and @ref XXH3_kSecret). + * + * This is the size used in @ref XXH3_kSecret and the seeded functions. + * + * Not to be confused with @ref XXH3_SECRET_SIZE_MIN. + */ +#define XXH3_SECRET_DEFAULT_SIZE 192 + +/*! + * @internal + * @brief Structure for XXH3 streaming API. + * + * @note This is only defined when @ref XXH_STATIC_LINKING_ONLY, + * @ref XXH_INLINE_ALL, or @ref XXH_IMPLEMENTATION is defined. + * Otherwise it is an opaque type. + * Never use this definition in combination with dynamic library. + * This allows fields to safely be changed in the future. + * + * @note ** This structure has a strict alignment requirement of 64 bytes!! ** + * Do not allocate this with `malloc()` or `new`, + * it will not be sufficiently aligned. + * Use @ref XXH3_createState() and @ref XXH3_freeState(), or stack allocation. + * + * Typedef'd to @ref XXH3_state_t. + * Do never access the members of this struct directly. + * + * @see XXH3_INITSTATE() for stack initialization. + * @see XXH3_createState(), XXH3_freeState(). + * @see XXH32_state_s, XXH64_state_s + */ +struct XXH3_state_s { + XXH_ALIGN_MEMBER(64, XXH64_hash_t acc[8]); + /*!< The 8 accumulators. Similar to `vN` in @ref XXH32_state_s::v1 and @ref XXH64_state_s */ + XXH_ALIGN_MEMBER(64, unsigned char customSecret[XXH3_SECRET_DEFAULT_SIZE]); + /*!< Used to store a custom secret generated from a seed. */ + XXH_ALIGN_MEMBER(64, unsigned char buffer[XXH3_INTERNALBUFFER_SIZE]); + /*!< The internal buffer. @see XXH32_state_s::mem32 */ + XXH32_hash_t bufferedSize; + /*!< The amount of memory in @ref buffer, @see XXH32_state_s::memsize */ + XXH32_hash_t useSeed; + /*!< Reserved field. Needed for padding on 64-bit. */ + size_t nbStripesSoFar; + /*!< Number or stripes processed. */ + XXH64_hash_t totalLen; + /*!< Total length hashed. 64-bit even on 32-bit targets. */ + size_t nbStripesPerBlock; + /*!< Number of stripes per block. */ + size_t secretLimit; + /*!< Size of @ref customSecret or @ref extSecret */ + XXH64_hash_t seed; + /*!< Seed for _withSeed variants. Must be zero otherwise, @see XXH3_INITSTATE() */ + XXH64_hash_t reserved64; + /*!< Reserved field. */ + const unsigned char* extSecret; + /*!< Reference to an external secret for the _withSecret variants, NULL + * for other variants. */ + /* note: there may be some padding at the end due to alignment on 64 bytes */ +}; /* typedef'd to XXH3_state_t */ + +#undef XXH_ALIGN_MEMBER + +/*! + * @brief Initializes a stack-allocated `XXH3_state_s`. + * + * When the @ref XXH3_state_t structure is merely emplaced on stack, + * it should be initialized with XXH3_INITSTATE() or a memset() + * in case its first reset uses XXH3_NNbits_reset_withSeed(). + * This init can be omitted if the first reset uses default or _withSecret mode. + * This operation isn't necessary when the state is created with XXH3_createState(). + * Note that this doesn't prepare the state for a streaming operation, + * it's still necessary to use XXH3_NNbits_reset*() afterwards. + */ +#define XXH3_INITSTATE(XXH3_state_ptr) { (XXH3_state_ptr)->seed = 0; } + + +/* XXH128() : + * simple alias to pre-selected XXH3_128bits variant + */ +XXH_PUBLIC_API XXH128_hash_t XXH128(const void* data, size_t len, XXH64_hash_t seed); + + +/* === Experimental API === */ +/* Symbols defined below must be considered tied to a specific library version. */ + +/* + * XXH3_generateSecret(): + * + * Derive a high-entropy secret from any user-defined content, named customSeed. + * The generated secret can be used in combination with `*_withSecret()` functions. + * The `_withSecret()` variants are useful to provide a higher level of protection than 64-bit seed, + * as it becomes much more difficult for an external actor to guess how to impact the calculation logic. + * + * The function accepts as input a custom seed of any length and any content, + * and derives from it a high-entropy secret of length @secretSize + * into an already allocated buffer @secretBuffer. + * @secretSize must be >= XXH3_SECRET_SIZE_MIN + * + * The generated secret can then be used with any `*_withSecret()` variant. + * Functions `XXH3_128bits_withSecret()`, `XXH3_64bits_withSecret()`, + * `XXH3_128bits_reset_withSecret()` and `XXH3_64bits_reset_withSecret()` + * are part of this list. They all accept a `secret` parameter + * which must be large enough for implementation reasons (>= XXH3_SECRET_SIZE_MIN) + * _and_ feature very high entropy (consist of random-looking bytes). + * These conditions can be a high bar to meet, so + * XXH3_generateSecret() can be employed to ensure proper quality. + * + * customSeed can be anything. It can have any size, even small ones, + * and its content can be anything, even "poor entropy" sources such as a bunch of zeroes. + * The resulting `secret` will nonetheless provide all required qualities. + * + * When customSeedSize > 0, supplying NULL as customSeed is undefined behavior. + */ +XXH_PUBLIC_API XXH_errorcode XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSeed, size_t customSeedSize); + + +/* + * XXH3_generateSecret_fromSeed(): + * + * Generate the same secret as the _withSeed() variants. + * + * The resulting secret has a length of XXH3_SECRET_DEFAULT_SIZE (necessarily). + * @secretBuffer must be already allocated, of size at least XXH3_SECRET_DEFAULT_SIZE bytes. + * + * The generated secret can be used in combination with + *`*_withSecret()` and `_withSecretandSeed()` variants. + * This generator is notably useful in combination with `_withSecretandSeed()`, + * as a way to emulate a faster `_withSeed()` variant. + */ +XXH_PUBLIC_API void XXH3_generateSecret_fromSeed(void* secretBuffer, XXH64_hash_t seed); + +/* + * *_withSecretandSeed() : + * These variants generate hash values using either + * @seed for "short" keys (< XXH3_MIDSIZE_MAX = 240 bytes) + * or @secret for "large" keys (>= XXH3_MIDSIZE_MAX). + * + * This generally benefits speed, compared to `_withSeed()` or `_withSecret()`. + * `_withSeed()` has to generate the secret on the fly for "large" keys. + * It's fast, but can be perceptible for "not so large" keys (< 1 KB). + * `_withSecret()` has to generate the masks on the fly for "small" keys, + * which requires more instructions than _withSeed() variants. + * Therefore, _withSecretandSeed variant combines the best of both worlds. + * + * When @secret has been generated by XXH3_generateSecret_fromSeed(), + * this variant produces *exactly* the same results as `_withSeed()` variant, + * hence offering only a pure speed benefit on "large" input, + * by skipping the need to regenerate the secret for every large input. + * + * Another usage scenario is to hash the secret to a 64-bit hash value, + * for example with XXH3_64bits(), which then becomes the seed, + * and then employ both the seed and the secret in _withSecretandSeed(). + * On top of speed, an added benefit is that each bit in the secret + * has a 50% chance to swap each bit in the output, + * via its impact to the seed. + * This is not guaranteed when using the secret directly in "small data" scenarios, + * because only portions of the secret are employed for small data. + */ +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSecretandSeed(const void* data, size_t len, + const void* secret, size_t secretSize, + XXH64_hash_t seed); + +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSecretandSeed(const void* data, size_t len, + const void* secret, size_t secretSize, + XXH64_hash_t seed64); + +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, + const void* secret, size_t secretSize, + XXH64_hash_t seed64); + +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, + const void* secret, size_t secretSize, + XXH64_hash_t seed64); + + +#endif /* XXH_NO_XXH3 */ +#endif /* XXH_NO_LONG_LONG */ +#if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) +# define XXH_IMPLEMENTATION +#endif + +#endif /* defined(XXH_STATIC_LINKING_ONLY) && !defined(XXHASH_H_STATIC_13879238742) */ + + +/* ======================================================================== */ +/* ======================================================================== */ +/* ======================================================================== */ + + +/*-********************************************************************** + * xxHash implementation + *-********************************************************************** + * xxHash's implementation used to be hosted inside xxhash.c. + * + * However, inlining requires implementation to be visible to the compiler, + * hence be included alongside the header. + * Previously, implementation was hosted inside xxhash.c, + * which was then #included when inlining was activated. + * This construction created issues with a few build and install systems, + * as it required xxhash.c to be stored in /include directory. + * + * xxHash implementation is now directly integrated within xxhash.h. + * As a consequence, xxhash.c is no longer needed in /include. + * + * xxhash.c is still available and is still useful. + * In a "normal" setup, when xxhash is not inlined, + * xxhash.h only exposes the prototypes and public symbols, + * while xxhash.c can be built into an object file xxhash.o + * which can then be linked into the final binary. + ************************************************************************/ + +#if ( defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) \ + || defined(XXH_IMPLEMENTATION) ) && !defined(XXH_IMPLEM_13a8737387) +# define XXH_IMPLEM_13a8737387 + +/* ************************************* +* Tuning parameters +***************************************/ + +/*! + * @defgroup tuning Tuning parameters + * @{ + * + * Various macros to control xxHash's behavior. + */ +#ifdef XXH_DOXYGEN +/*! + * @brief Define this to disable 64-bit code. + * + * Useful if only using the @ref xxh32_family and you have a strict C90 compiler. + */ +# define XXH_NO_LONG_LONG +# undef XXH_NO_LONG_LONG /* don't actually */ +/*! + * @brief Controls how unaligned memory is accessed. + * + * By default, access to unaligned memory is controlled by `memcpy()`, which is + * safe and portable. + * + * Unfortunately, on some target/compiler combinations, the generated assembly + * is sub-optimal. + * + * The below switch allow selection of a different access method + * in the search for improved performance. + * + * @par Possible options: + * + * - `XXH_FORCE_MEMORY_ACCESS=0` (default): `memcpy` + * @par + * Use `memcpy()`. Safe and portable. Note that most modern compilers will + * eliminate the function call and treat it as an unaligned access. + * + * - `XXH_FORCE_MEMORY_ACCESS=1`: `__attribute__((packed))` + * @par + * Depends on compiler extensions and is therefore not portable. + * This method is safe _if_ your compiler supports it, + * and *generally* as fast or faster than `memcpy`. + * + * - `XXH_FORCE_MEMORY_ACCESS=2`: Direct cast + * @par + * Casts directly and dereferences. This method doesn't depend on the + * compiler, but it violates the C standard as it directly dereferences an + * unaligned pointer. It can generate buggy code on targets which do not + * support unaligned memory accesses, but in some circumstances, it's the + * only known way to get the most performance. + * + * - `XXH_FORCE_MEMORY_ACCESS=3`: Byteshift + * @par + * Also portable. This can generate the best code on old compilers which don't + * inline small `memcpy()` calls, and it might also be faster on big-endian + * systems which lack a native byteswap instruction. However, some compilers + * will emit literal byteshifts even if the target supports unaligned access. + * . + * + * @warning + * Methods 1 and 2 rely on implementation-defined behavior. Use these with + * care, as what works on one compiler/platform/optimization level may cause + * another to read garbage data or even crash. + * + * See https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html for details. + * + * Prefer these methods in priority order (0 > 3 > 1 > 2) + */ +# define XXH_FORCE_MEMORY_ACCESS 0 + +/*! + * @def XXH_FORCE_ALIGN_CHECK + * @brief If defined to non-zero, adds a special path for aligned inputs (XXH32() + * and XXH64() only). + * + * This is an important performance trick for architectures without decent + * unaligned memory access performance. + * + * It checks for input alignment, and when conditions are met, uses a "fast + * path" employing direct 32-bit/64-bit reads, resulting in _dramatically + * faster_ read speed. + * + * The check costs one initial branch per hash, which is generally negligible, + * but not zero. + * + * Moreover, it's not useful to generate an additional code path if memory + * access uses the same instruction for both aligned and unaligned + * addresses (e.g. x86 and aarch64). + * + * In these cases, the alignment check can be removed by setting this macro to 0. + * Then the code will always use unaligned memory access. + * Align check is automatically disabled on x86, x64 & arm64, + * which are platforms known to offer good unaligned memory accesses performance. + * + * This option does not affect XXH3 (only XXH32 and XXH64). + */ +# define XXH_FORCE_ALIGN_CHECK 0 + +/*! + * @def XXH_NO_INLINE_HINTS + * @brief When non-zero, sets all functions to `static`. + * + * By default, xxHash tries to force the compiler to inline almost all internal + * functions. + * + * This can usually improve performance due to reduced jumping and improved + * constant folding, but significantly increases the size of the binary which + * might not be favorable. + * + * Additionally, sometimes the forced inlining can be detrimental to performance, + * depending on the architecture. + * + * XXH_NO_INLINE_HINTS marks all internal functions as static, giving the + * compiler full control on whether to inline or not. + * + * When not optimizing (-O0), optimizing for size (-Os, -Oz), or using + * -fno-inline with GCC or Clang, this will automatically be defined. + */ +# define XXH_NO_INLINE_HINTS 0 + +/*! + * @def XXH32_ENDJMP + * @brief Whether to use a jump for `XXH32_finalize`. + * + * For performance, `XXH32_finalize` uses multiple branches in the finalizer. + * This is generally preferable for performance, + * but depending on exact architecture, a jmp may be preferable. + * + * This setting is only possibly making a difference for very small inputs. + */ +# define XXH32_ENDJMP 0 + +/*! + * @internal + * @brief Redefines old internal names. + * + * For compatibility with code that uses xxHash's internals before the names + * were changed to improve namespacing. There is no other reason to use this. + */ +# define XXH_OLD_NAMES +# undef XXH_OLD_NAMES /* don't actually use, it is ugly. */ +#endif /* XXH_DOXYGEN */ +/*! + * @} + */ + +#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ + /* prefer __packed__ structures (method 1) for gcc on armv7+ and mips */ +# if !defined(__clang__) && \ +( \ + (defined(__INTEL_COMPILER) && !defined(_WIN32)) || \ + ( \ + defined(__GNUC__) && ( \ + (defined(__ARM_ARCH) && __ARM_ARCH >= 7) || \ + ( \ + defined(__mips__) && \ + (__mips <= 5 || __mips_isa_rev < 6) && \ + (!defined(__mips16) || defined(__mips_mips16e2)) \ + ) \ + ) \ + ) \ +) +# define XXH_FORCE_MEMORY_ACCESS 1 +# endif +#endif + +#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ +# if defined(__i386) || defined(__x86_64__) || defined(__aarch64__) \ + || defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64) /* visual */ +# define XXH_FORCE_ALIGN_CHECK 0 +# else +# define XXH_FORCE_ALIGN_CHECK 1 +# endif +#endif + +#ifndef XXH_NO_INLINE_HINTS +# if defined(__OPTIMIZE_SIZE__) /* -Os, -Oz */ \ + || defined(__NO_INLINE__) /* -O0, -fno-inline */ +# define XXH_NO_INLINE_HINTS 1 +# else +# define XXH_NO_INLINE_HINTS 0 +# endif +#endif + +#ifndef XXH32_ENDJMP +/* generally preferable for performance */ +# define XXH32_ENDJMP 0 +#endif + +/*! + * @defgroup impl Implementation + * @{ + */ + + +/* ************************************* +* Includes & Memory related functions +***************************************/ +/* Modify the local functions below should you wish to use some other memory routines */ +/* for ZSTD_malloc(), ZSTD_free() */ +#define ZSTD_DEPS_NEED_MALLOC +#include "zstd_deps.h" /* size_t, ZSTD_malloc, ZSTD_free, ZSTD_memcpy */ +static void* XXH_malloc(size_t s) { return ZSTD_malloc(s); } +static void XXH_free (void* p) { ZSTD_free(p); } +static void* XXH_memcpy(void* dest, const void* src, size_t size) { return ZSTD_memcpy(dest,src,size); } + + +/* ************************************* +* Compiler Specific Options +***************************************/ +#ifdef _MSC_VER /* Visual Studio warning fix */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +#endif + +#if XXH_NO_INLINE_HINTS /* disable inlining hints */ +# if defined(__GNUC__) || defined(__clang__) +# define XXH_FORCE_INLINE static __attribute__((unused)) +# else +# define XXH_FORCE_INLINE static +# endif +# define XXH_NO_INLINE static +/* enable inlining hints */ +#elif defined(__GNUC__) || defined(__clang__) +# define XXH_FORCE_INLINE static __inline__ __attribute__((always_inline, unused)) +# define XXH_NO_INLINE static __attribute__((noinline)) +#elif defined(_MSC_VER) /* Visual Studio */ +# define XXH_FORCE_INLINE static __forceinline +# define XXH_NO_INLINE static __declspec(noinline) +#elif defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* C99 */ +# define XXH_FORCE_INLINE static inline +# define XXH_NO_INLINE static +#else +# define XXH_FORCE_INLINE static +# define XXH_NO_INLINE static +#endif + + + +/* ************************************* +* Debug +***************************************/ +/*! + * @ingroup tuning + * @def XXH_DEBUGLEVEL + * @brief Sets the debugging level. + * + * XXH_DEBUGLEVEL is expected to be defined externally, typically via the + * compiler's command line options. The value must be a number. + */ +#ifndef XXH_DEBUGLEVEL +# ifdef DEBUGLEVEL /* backwards compat */ +# define XXH_DEBUGLEVEL DEBUGLEVEL +# else +# define XXH_DEBUGLEVEL 0 +# endif +#endif + +#if (XXH_DEBUGLEVEL>=1) +# include /* note: can still be disabled with NDEBUG */ +# define XXH_ASSERT(c) assert(c) +#else +# define XXH_ASSERT(c) ((void)0) +#endif + +/* note: use after variable declarations */ +#ifndef XXH_STATIC_ASSERT +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ +# include +# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) +# elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ +# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) +# else +# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa { char x[(c) ? 1 : -1]; }; } while(0) +# endif +# define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c) +#endif + +/*! + * @internal + * @def XXH_COMPILER_GUARD(var) + * @brief Used to prevent unwanted optimizations for @p var. + * + * It uses an empty GCC inline assembly statement with a register constraint + * which forces @p var into a general purpose register (e.g. eax, ebx, ecx + * on x86) and marks it as modified. + * + * This is used in a few places to avoid unwanted autovectorization (e.g. + * XXH32_round()). All vectorization we want is explicit via intrinsics, + * and _usually_ isn't wanted elsewhere. + * + * We also use it to prevent unwanted constant folding for AArch64 in + * XXH3_initCustomSecret_scalar(). + */ +#if defined(__GNUC__) || defined(__clang__) +# define XXH_COMPILER_GUARD(var) __asm__ __volatile__("" : "+r" (var)) +#else +# define XXH_COMPILER_GUARD(var) ((void)0) +#endif + +/* ************************************* +* Basic Types +***************************************/ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) +# include + typedef uint8_t xxh_u8; +#else + typedef unsigned char xxh_u8; +#endif +typedef XXH32_hash_t xxh_u32; + +#ifdef XXH_OLD_NAMES +# define BYTE xxh_u8 +# define U8 xxh_u8 +# define U32 xxh_u32 +#endif + +/* *** Memory access *** */ + +/*! + * @internal + * @fn xxh_u32 XXH_read32(const void* ptr) + * @brief Reads an unaligned 32-bit integer from @p ptr in native endianness. + * + * Affected by @ref XXH_FORCE_MEMORY_ACCESS. + * + * @param ptr The pointer to read from. + * @return The 32-bit native endian integer from the bytes at @p ptr. + */ + +/*! + * @internal + * @fn xxh_u32 XXH_readLE32(const void* ptr) + * @brief Reads an unaligned 32-bit little endian integer from @p ptr. + * + * Affected by @ref XXH_FORCE_MEMORY_ACCESS. + * + * @param ptr The pointer to read from. + * @return The 32-bit little endian integer from the bytes at @p ptr. + */ + +/*! + * @internal + * @fn xxh_u32 XXH_readBE32(const void* ptr) + * @brief Reads an unaligned 32-bit big endian integer from @p ptr. + * + * Affected by @ref XXH_FORCE_MEMORY_ACCESS. + * + * @param ptr The pointer to read from. + * @return The 32-bit big endian integer from the bytes at @p ptr. + */ + +/*! + * @internal + * @fn xxh_u32 XXH_readLE32_align(const void* ptr, XXH_alignment align) + * @brief Like @ref XXH_readLE32(), but has an option for aligned reads. + * + * Affected by @ref XXH_FORCE_MEMORY_ACCESS. + * Note that when @ref XXH_FORCE_ALIGN_CHECK == 0, the @p align parameter is + * always @ref XXH_alignment::XXH_unaligned. + * + * @param ptr The pointer to read from. + * @param align Whether @p ptr is aligned. + * @pre + * If @p align == @ref XXH_alignment::XXH_aligned, @p ptr must be 4 byte + * aligned. + * @return The 32-bit little endian integer from the bytes at @p ptr. + */ + +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) +/* + * Manual byteshift. Best for old compilers which don't inline memcpy. + * We actually directly use XXH_readLE32 and XXH_readBE32. + */ +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) + +/* + * Force direct memory access. Only works on CPU which support unaligned memory + * access in hardware. + */ +static xxh_u32 XXH_read32(const void* memPtr) { return *(const xxh_u32*) memPtr; } + +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) + +/* + * __pack instructions are safer but compiler specific, hence potentially + * problematic for some compilers. + * + * Currently only defined for GCC and ICC. + */ +#ifdef XXH_OLD_NAMES +typedef union { xxh_u32 u32; } __attribute__((packed)) unalign; +#endif +static xxh_u32 XXH_read32(const void* ptr) +{ + typedef union { xxh_u32 u32; } __attribute__((packed)) xxh_unalign; + return ((const xxh_unalign*)ptr)->u32; +} + +#else + +/* + * Portable and safe solution. Generally efficient. + * see: https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html + */ +static xxh_u32 XXH_read32(const void* memPtr) +{ + xxh_u32 val; + XXH_memcpy(&val, memPtr, sizeof(val)); + return val; +} + +#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ + + +/* *** Endianness *** */ + +/*! + * @ingroup tuning + * @def XXH_CPU_LITTLE_ENDIAN + * @brief Whether the target is little endian. + * + * Defined to 1 if the target is little endian, or 0 if it is big endian. + * It can be defined externally, for example on the compiler command line. + * + * If it is not defined, + * a runtime check (which is usually constant folded) is used instead. + * + * @note + * This is not necessarily defined to an integer constant. + * + * @see XXH_isLittleEndian() for the runtime check. + */ +#ifndef XXH_CPU_LITTLE_ENDIAN +/* + * Try to detect endianness automatically, to avoid the nonstandard behavior + * in `XXH_isLittleEndian()` + */ +# if defined(_WIN32) /* Windows is always little endian */ \ + || defined(__LITTLE_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +# define XXH_CPU_LITTLE_ENDIAN 1 +# elif defined(__BIG_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +# define XXH_CPU_LITTLE_ENDIAN 0 +# else +/*! + * @internal + * @brief Runtime check for @ref XXH_CPU_LITTLE_ENDIAN. + * + * Most compilers will constant fold this. + */ +static int XXH_isLittleEndian(void) +{ + /* + * Portable and well-defined behavior. + * Don't use static: it is detrimental to performance. + */ + const union { xxh_u32 u; xxh_u8 c[4]; } one = { 1 }; + return one.c[0]; +} +# define XXH_CPU_LITTLE_ENDIAN XXH_isLittleEndian() +# endif +#endif + + + + +/* **************************************** +* Compiler-specific Functions and Macros +******************************************/ +#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + +#ifdef __has_builtin +# define XXH_HAS_BUILTIN(x) __has_builtin(x) +#else +# define XXH_HAS_BUILTIN(x) 0 +#endif + +/*! + * @internal + * @def XXH_rotl32(x,r) + * @brief 32-bit rotate left. + * + * @param x The 32-bit integer to be rotated. + * @param r The number of bits to rotate. + * @pre + * @p r > 0 && @p r < 32 + * @note + * @p x and @p r may be evaluated multiple times. + * @return The rotated result. + */ +#if !defined(NO_CLANG_BUILTIN) && XXH_HAS_BUILTIN(__builtin_rotateleft32) \ + && XXH_HAS_BUILTIN(__builtin_rotateleft64) +# define XXH_rotl32 __builtin_rotateleft32 +# define XXH_rotl64 __builtin_rotateleft64 +/* Note: although _rotl exists for minGW (GCC under windows), performance seems poor */ +#elif defined(_MSC_VER) +# define XXH_rotl32(x,r) _rotl(x,r) +# define XXH_rotl64(x,r) _rotl64(x,r) +#else +# define XXH_rotl32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) +# define XXH_rotl64(x,r) (((x) << (r)) | ((x) >> (64 - (r)))) +#endif + +/*! + * @internal + * @fn xxh_u32 XXH_swap32(xxh_u32 x) + * @brief A 32-bit byteswap. + * + * @param x The 32-bit integer to byteswap. + * @return @p x, byteswapped. + */ +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap32 _byteswap_ulong +#elif XXH_GCC_VERSION >= 403 +# define XXH_swap32 __builtin_bswap32 +#else +static xxh_u32 XXH_swap32 (xxh_u32 x) +{ + return ((x << 24) & 0xff000000 ) | + ((x << 8) & 0x00ff0000 ) | + ((x >> 8) & 0x0000ff00 ) | + ((x >> 24) & 0x000000ff ); +} +#endif + + +/* *************************** +* Memory reads +*****************************/ + +/*! + * @internal + * @brief Enum to indicate whether a pointer is aligned. + */ +typedef enum { + XXH_aligned, /*!< Aligned */ + XXH_unaligned /*!< Possibly unaligned */ +} XXH_alignment; + +/* + * XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. + * + * This is ideal for older compilers which don't inline memcpy. + */ +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) + +XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[0] + | ((xxh_u32)bytePtr[1] << 8) + | ((xxh_u32)bytePtr[2] << 16) + | ((xxh_u32)bytePtr[3] << 24); +} + +XXH_FORCE_INLINE xxh_u32 XXH_readBE32(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[3] + | ((xxh_u32)bytePtr[2] << 8) + | ((xxh_u32)bytePtr[1] << 16) + | ((xxh_u32)bytePtr[0] << 24); +} + +#else +XXH_FORCE_INLINE xxh_u32 XXH_readLE32(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); +} + +static xxh_u32 XXH_readBE32(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); +} +#endif + +XXH_FORCE_INLINE xxh_u32 +XXH_readLE32_align(const void* ptr, XXH_alignment align) +{ + if (align==XXH_unaligned) { + return XXH_readLE32(ptr); + } else { + return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u32*)ptr : XXH_swap32(*(const xxh_u32*)ptr); + } +} + + +/* ************************************* +* Misc +***************************************/ +/*! @ingroup public */ +XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } + + +/* ******************************************************************* +* 32-bit hash functions +*********************************************************************/ +/*! + * @} + * @defgroup xxh32_impl XXH32 implementation + * @ingroup impl + * @{ + */ + /* #define instead of static const, to be used as initializers */ +#define XXH_PRIME32_1 0x9E3779B1U /*!< 0b10011110001101110111100110110001 */ +#define XXH_PRIME32_2 0x85EBCA77U /*!< 0b10000101111010111100101001110111 */ +#define XXH_PRIME32_3 0xC2B2AE3DU /*!< 0b11000010101100101010111000111101 */ +#define XXH_PRIME32_4 0x27D4EB2FU /*!< 0b00100111110101001110101100101111 */ +#define XXH_PRIME32_5 0x165667B1U /*!< 0b00010110010101100110011110110001 */ + +#ifdef XXH_OLD_NAMES +# define PRIME32_1 XXH_PRIME32_1 +# define PRIME32_2 XXH_PRIME32_2 +# define PRIME32_3 XXH_PRIME32_3 +# define PRIME32_4 XXH_PRIME32_4 +# define PRIME32_5 XXH_PRIME32_5 +#endif + +/*! + * @internal + * @brief Normal stripe processing routine. + * + * This shuffles the bits so that any bit from @p input impacts several bits in + * @p acc. + * + * @param acc The accumulator lane. + * @param input The stripe of input to mix. + * @return The mixed accumulator lane. + */ +static xxh_u32 XXH32_round(xxh_u32 acc, xxh_u32 input) +{ + acc += input * XXH_PRIME32_2; + acc = XXH_rotl32(acc, 13); + acc *= XXH_PRIME32_1; +#if (defined(__SSE4_1__) || defined(__aarch64__)) && !defined(XXH_ENABLE_AUTOVECTORIZE) + /* + * UGLY HACK: + * A compiler fence is the only thing that prevents GCC and Clang from + * autovectorizing the XXH32 loop (pragmas and attributes don't work for some + * reason) without globally disabling SSE4.1. + * + * The reason we want to avoid vectorization is because despite working on + * 4 integers at a time, there are multiple factors slowing XXH32 down on + * SSE4: + * - There's a ridiculous amount of lag from pmulld (10 cycles of latency on + * newer chips!) making it slightly slower to multiply four integers at + * once compared to four integers independently. Even when pmulld was + * fastest, Sandy/Ivy Bridge, it is still not worth it to go into SSE + * just to multiply unless doing a long operation. + * + * - Four instructions are required to rotate, + * movqda tmp, v // not required with VEX encoding + * pslld tmp, 13 // tmp <<= 13 + * psrld v, 19 // x >>= 19 + * por v, tmp // x |= tmp + * compared to one for scalar: + * roll v, 13 // reliably fast across the board + * shldl v, v, 13 // Sandy Bridge and later prefer this for some reason + * + * - Instruction level parallelism is actually more beneficial here because + * the SIMD actually serializes this operation: While v1 is rotating, v2 + * can load data, while v3 can multiply. SSE forces them to operate + * together. + * + * This is also enabled on AArch64, as Clang autovectorizes it incorrectly + * and it is pointless writing a NEON implementation that is basically the + * same speed as scalar for XXH32. + */ + XXH_COMPILER_GUARD(acc); +#endif + return acc; +} + +/*! + * @internal + * @brief Mixes all bits to finalize the hash. + * + * The final mix ensures that all input bits have a chance to impact any bit in + * the output digest, resulting in an unbiased distribution. + * + * @param h32 The hash to avalanche. + * @return The avalanched hash. + */ +static xxh_u32 XXH32_avalanche(xxh_u32 h32) +{ + h32 ^= h32 >> 15; + h32 *= XXH_PRIME32_2; + h32 ^= h32 >> 13; + h32 *= XXH_PRIME32_3; + h32 ^= h32 >> 16; + return(h32); +} + +#define XXH_get32bits(p) XXH_readLE32_align(p, align) + +/*! + * @internal + * @brief Processes the last 0-15 bytes of @p ptr. + * + * There may be up to 15 bytes remaining to consume from the input. + * This final stage will digest them to ensure that all input bytes are present + * in the final mix. + * + * @param h32 The hash to finalize. + * @param ptr The pointer to the remaining input. + * @param len The remaining length, modulo 16. + * @param align Whether @p ptr is aligned. + * @return The finalized hash. + */ +static xxh_u32 +XXH32_finalize(xxh_u32 h32, const xxh_u8* ptr, size_t len, XXH_alignment align) +{ +#define XXH_PROCESS1 do { \ + h32 += (*ptr++) * XXH_PRIME32_5; \ + h32 = XXH_rotl32(h32, 11) * XXH_PRIME32_1; \ +} while (0) + +#define XXH_PROCESS4 do { \ + h32 += XXH_get32bits(ptr) * XXH_PRIME32_3; \ + ptr += 4; \ + h32 = XXH_rotl32(h32, 17) * XXH_PRIME32_4; \ +} while (0) + + if (ptr==NULL) XXH_ASSERT(len == 0); + + /* Compact rerolled version; generally faster */ + if (!XXH32_ENDJMP) { + len &= 15; + while (len >= 4) { + XXH_PROCESS4; + len -= 4; + } + while (len > 0) { + XXH_PROCESS1; + --len; + } + return XXH32_avalanche(h32); + } else { + switch(len&15) /* or switch(bEnd - p) */ { + case 12: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 8: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 4: XXH_PROCESS4; + return XXH32_avalanche(h32); + + case 13: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 9: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 5: XXH_PROCESS4; + XXH_PROCESS1; + return XXH32_avalanche(h32); + + case 14: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 10: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 6: XXH_PROCESS4; + XXH_PROCESS1; + XXH_PROCESS1; + return XXH32_avalanche(h32); + + case 15: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 11: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 7: XXH_PROCESS4; + XXH_FALLTHROUGH; + case 3: XXH_PROCESS1; + XXH_FALLTHROUGH; + case 2: XXH_PROCESS1; + XXH_FALLTHROUGH; + case 1: XXH_PROCESS1; + XXH_FALLTHROUGH; + case 0: return XXH32_avalanche(h32); + } + XXH_ASSERT(0); + return h32; /* reaching this point is deemed impossible */ + } +} + +#ifdef XXH_OLD_NAMES +# define PROCESS1 XXH_PROCESS1 +# define PROCESS4 XXH_PROCESS4 +#else +# undef XXH_PROCESS1 +# undef XXH_PROCESS4 +#endif + +/*! + * @internal + * @brief The implementation for @ref XXH32(). + * + * @param input , len , seed Directly passed from @ref XXH32(). + * @param align Whether @p input is aligned. + * @return The calculated hash. + */ +XXH_FORCE_INLINE xxh_u32 +XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment align) +{ + xxh_u32 h32; + + if (input==NULL) XXH_ASSERT(len == 0); + + if (len>=16) { + const xxh_u8* const bEnd = input + len; + const xxh_u8* const limit = bEnd - 15; + xxh_u32 v1 = seed + XXH_PRIME32_1 + XXH_PRIME32_2; + xxh_u32 v2 = seed + XXH_PRIME32_2; + xxh_u32 v3 = seed + 0; + xxh_u32 v4 = seed - XXH_PRIME32_1; + + do { + v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; + v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; + v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4; + v4 = XXH32_round(v4, XXH_get32bits(input)); input += 4; + } while (input < limit); + + h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); + } else { + h32 = seed + XXH_PRIME32_5; + } + + h32 += (xxh_u32)len; + + return XXH32_finalize(h32, input, len&15, align); +} + +/*! @ingroup xxh32_family */ +XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed) +{ +#if 0 + /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ + XXH32_state_t state; + XXH32_reset(&state, seed); + XXH32_update(&state, (const xxh_u8*)input, len); + return XXH32_digest(&state); +#else + if (XXH_FORCE_ALIGN_CHECK) { + if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ + return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_aligned); + } } + + return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned); +#endif +} + + + +/******* Hash streaming *******/ +/*! + * @ingroup xxh32_family + */ +XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) +{ + return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); +} +/*! @ingroup xxh32_family */ +XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) +{ + XXH_free(statePtr); + return XXH_OK; +} + +/*! @ingroup xxh32_family */ +XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* dstState, const XXH32_state_t* srcState) +{ + XXH_memcpy(dstState, srcState, sizeof(*dstState)); +} + +/*! @ingroup xxh32_family */ +XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t seed) +{ + XXH_ASSERT(statePtr != NULL); + memset(statePtr, 0, sizeof(*statePtr)); + statePtr->v[0] = seed + XXH_PRIME32_1 + XXH_PRIME32_2; + statePtr->v[1] = seed + XXH_PRIME32_2; + statePtr->v[2] = seed + 0; + statePtr->v[3] = seed - XXH_PRIME32_1; + return XXH_OK; +} + + +/*! @ingroup xxh32_family */ +XXH_PUBLIC_API XXH_errorcode +XXH32_update(XXH32_state_t* state, const void* input, size_t len) +{ + if (input==NULL) { + XXH_ASSERT(len == 0); + return XXH_OK; + } + + { const xxh_u8* p = (const xxh_u8*)input; + const xxh_u8* const bEnd = p + len; + + state->total_len_32 += (XXH32_hash_t)len; + state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16)); + + if (state->memsize + len < 16) { /* fill in tmp buffer */ + XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, len); + state->memsize += (XXH32_hash_t)len; + return XXH_OK; + } + + if (state->memsize) { /* some data left from previous update */ + XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, 16-state->memsize); + { const xxh_u32* p32 = state->mem32; + state->v[0] = XXH32_round(state->v[0], XXH_readLE32(p32)); p32++; + state->v[1] = XXH32_round(state->v[1], XXH_readLE32(p32)); p32++; + state->v[2] = XXH32_round(state->v[2], XXH_readLE32(p32)); p32++; + state->v[3] = XXH32_round(state->v[3], XXH_readLE32(p32)); + } + p += 16-state->memsize; + state->memsize = 0; + } + + if (p <= bEnd-16) { + const xxh_u8* const limit = bEnd - 16; + + do { + state->v[0] = XXH32_round(state->v[0], XXH_readLE32(p)); p+=4; + state->v[1] = XXH32_round(state->v[1], XXH_readLE32(p)); p+=4; + state->v[2] = XXH32_round(state->v[2], XXH_readLE32(p)); p+=4; + state->v[3] = XXH32_round(state->v[3], XXH_readLE32(p)); p+=4; + } while (p<=limit); + + } + + if (p < bEnd) { + XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); + state->memsize = (unsigned)(bEnd-p); + } + } + + return XXH_OK; +} + + +/*! @ingroup xxh32_family */ +XXH_PUBLIC_API XXH32_hash_t XXH32_digest(const XXH32_state_t* state) +{ + xxh_u32 h32; + + if (state->large_len) { + h32 = XXH_rotl32(state->v[0], 1) + + XXH_rotl32(state->v[1], 7) + + XXH_rotl32(state->v[2], 12) + + XXH_rotl32(state->v[3], 18); + } else { + h32 = state->v[2] /* == seed */ + XXH_PRIME32_5; + } + + h32 += state->total_len_32; + + return XXH32_finalize(h32, (const xxh_u8*)state->mem32, state->memsize, XXH_aligned); +} + + +/******* Canonical representation *******/ + +/*! + * @ingroup xxh32_family + * The default return values from XXH functions are unsigned 32 and 64 bit + * integers. + * + * The canonical representation uses big endian convention, the same convention + * as human-readable numbers (large digits first). + * + * This way, hash values can be written into a file or buffer, remaining + * comparable across different systems. + * + * The following functions allow transformation of hash values to and from their + * canonical format. + */ +XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) +{ + /* XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); */ + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); + XXH_memcpy(dst, &hash, sizeof(*dst)); +} +/*! @ingroup xxh32_family */ +XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) +{ + return XXH_readBE32(src); +} + + +#ifndef XXH_NO_LONG_LONG + +/* ******************************************************************* +* 64-bit hash functions +*********************************************************************/ +/*! + * @} + * @ingroup impl + * @{ + */ +/******* Memory access *******/ + +typedef XXH64_hash_t xxh_u64; + +#ifdef XXH_OLD_NAMES +# define U64 xxh_u64 +#endif + +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) +/* + * Manual byteshift. Best for old compilers which don't inline memcpy. + * We actually directly use XXH_readLE64 and XXH_readBE64. + */ +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) + +/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ +static xxh_u64 XXH_read64(const void* memPtr) +{ + return *(const xxh_u64*) memPtr; +} + +#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) + +/* + * __pack instructions are safer, but compiler specific, hence potentially + * problematic for some compilers. + * + * Currently only defined for GCC and ICC. + */ +#ifdef XXH_OLD_NAMES +typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) unalign64; +#endif +static xxh_u64 XXH_read64(const void* ptr) +{ + typedef union { xxh_u32 u32; xxh_u64 u64; } __attribute__((packed)) xxh_unalign64; + return ((const xxh_unalign64*)ptr)->u64; +} + +#else + +/* + * Portable and safe solution. Generally efficient. + * see: https://fastcompression.blogspot.com/2015/08/accessing-unaligned-memory.html + */ +static xxh_u64 XXH_read64(const void* memPtr) +{ + xxh_u64 val; + XXH_memcpy(&val, memPtr, sizeof(val)); + return val; +} + +#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ + +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap64 _byteswap_uint64 +#elif XXH_GCC_VERSION >= 403 +# define XXH_swap64 __builtin_bswap64 +#else +static xxh_u64 XXH_swap64(xxh_u64 x) +{ + return ((x << 56) & 0xff00000000000000ULL) | + ((x << 40) & 0x00ff000000000000ULL) | + ((x << 24) & 0x0000ff0000000000ULL) | + ((x << 8) & 0x000000ff00000000ULL) | + ((x >> 8) & 0x00000000ff000000ULL) | + ((x >> 24) & 0x0000000000ff0000ULL) | + ((x >> 40) & 0x000000000000ff00ULL) | + ((x >> 56) & 0x00000000000000ffULL); +} +#endif + + +/* XXH_FORCE_MEMORY_ACCESS==3 is an endian-independent byteshift load. */ +#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==3)) + +XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[0] + | ((xxh_u64)bytePtr[1] << 8) + | ((xxh_u64)bytePtr[2] << 16) + | ((xxh_u64)bytePtr[3] << 24) + | ((xxh_u64)bytePtr[4] << 32) + | ((xxh_u64)bytePtr[5] << 40) + | ((xxh_u64)bytePtr[6] << 48) + | ((xxh_u64)bytePtr[7] << 56); +} + +XXH_FORCE_INLINE xxh_u64 XXH_readBE64(const void* memPtr) +{ + const xxh_u8* bytePtr = (const xxh_u8 *)memPtr; + return bytePtr[7] + | ((xxh_u64)bytePtr[6] << 8) + | ((xxh_u64)bytePtr[5] << 16) + | ((xxh_u64)bytePtr[4] << 24) + | ((xxh_u64)bytePtr[3] << 32) + | ((xxh_u64)bytePtr[2] << 40) + | ((xxh_u64)bytePtr[1] << 48) + | ((xxh_u64)bytePtr[0] << 56); +} + +#else +XXH_FORCE_INLINE xxh_u64 XXH_readLE64(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); +} + +static xxh_u64 XXH_readBE64(const void* ptr) +{ + return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); +} +#endif + +XXH_FORCE_INLINE xxh_u64 +XXH_readLE64_align(const void* ptr, XXH_alignment align) +{ + if (align==XXH_unaligned) + return XXH_readLE64(ptr); + else + return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u64*)ptr : XXH_swap64(*(const xxh_u64*)ptr); +} + + +/******* xxh64 *******/ +/*! + * @} + * @defgroup xxh64_impl XXH64 implementation + * @ingroup impl + * @{ + */ +/* #define rather that static const, to be used as initializers */ +#define XXH_PRIME64_1 0x9E3779B185EBCA87ULL /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */ +#define XXH_PRIME64_2 0xC2B2AE3D27D4EB4FULL /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */ +#define XXH_PRIME64_3 0x165667B19E3779F9ULL /*!< 0b0001011001010110011001111011000110011110001101110111100111111001 */ +#define XXH_PRIME64_4 0x85EBCA77C2B2AE63ULL /*!< 0b1000010111101011110010100111011111000010101100101010111001100011 */ +#define XXH_PRIME64_5 0x27D4EB2F165667C5ULL /*!< 0b0010011111010100111010110010111100010110010101100110011111000101 */ + +#ifdef XXH_OLD_NAMES +# define PRIME64_1 XXH_PRIME64_1 +# define PRIME64_2 XXH_PRIME64_2 +# define PRIME64_3 XXH_PRIME64_3 +# define PRIME64_4 XXH_PRIME64_4 +# define PRIME64_5 XXH_PRIME64_5 +#endif + +static xxh_u64 XXH64_round(xxh_u64 acc, xxh_u64 input) +{ + acc += input * XXH_PRIME64_2; + acc = XXH_rotl64(acc, 31); + acc *= XXH_PRIME64_1; + return acc; +} + +static xxh_u64 XXH64_mergeRound(xxh_u64 acc, xxh_u64 val) +{ + val = XXH64_round(0, val); + acc ^= val; + acc = acc * XXH_PRIME64_1 + XXH_PRIME64_4; + return acc; +} + +static xxh_u64 XXH64_avalanche(xxh_u64 h64) +{ + h64 ^= h64 >> 33; + h64 *= XXH_PRIME64_2; + h64 ^= h64 >> 29; + h64 *= XXH_PRIME64_3; + h64 ^= h64 >> 32; + return h64; +} + + +#define XXH_get64bits(p) XXH_readLE64_align(p, align) + +static xxh_u64 +XXH64_finalize(xxh_u64 h64, const xxh_u8* ptr, size_t len, XXH_alignment align) +{ + if (ptr==NULL) XXH_ASSERT(len == 0); + len &= 31; + while (len >= 8) { + xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr)); + ptr += 8; + h64 ^= k1; + h64 = XXH_rotl64(h64,27) * XXH_PRIME64_1 + XXH_PRIME64_4; + len -= 8; + } + if (len >= 4) { + h64 ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1; + ptr += 4; + h64 = XXH_rotl64(h64, 23) * XXH_PRIME64_2 + XXH_PRIME64_3; + len -= 4; + } + while (len > 0) { + h64 ^= (*ptr++) * XXH_PRIME64_5; + h64 = XXH_rotl64(h64, 11) * XXH_PRIME64_1; + --len; + } + return XXH64_avalanche(h64); +} + +#ifdef XXH_OLD_NAMES +# define PROCESS1_64 XXH_PROCESS1_64 +# define PROCESS4_64 XXH_PROCESS4_64 +# define PROCESS8_64 XXH_PROCESS8_64 +#else +# undef XXH_PROCESS1_64 +# undef XXH_PROCESS4_64 +# undef XXH_PROCESS8_64 +#endif + +XXH_FORCE_INLINE xxh_u64 +XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align) +{ + xxh_u64 h64; + if (input==NULL) XXH_ASSERT(len == 0); + + if (len>=32) { + const xxh_u8* const bEnd = input + len; + const xxh_u8* const limit = bEnd - 31; + xxh_u64 v1 = seed + XXH_PRIME64_1 + XXH_PRIME64_2; + xxh_u64 v2 = seed + XXH_PRIME64_2; + xxh_u64 v3 = seed + 0; + xxh_u64 v4 = seed - XXH_PRIME64_1; + + do { + v1 = XXH64_round(v1, XXH_get64bits(input)); input+=8; + v2 = XXH64_round(v2, XXH_get64bits(input)); input+=8; + v3 = XXH64_round(v3, XXH_get64bits(input)); input+=8; + v4 = XXH64_round(v4, XXH_get64bits(input)); input+=8; + } while (inputv[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2; + statePtr->v[1] = seed + XXH_PRIME64_2; + statePtr->v[2] = seed + 0; + statePtr->v[3] = seed - XXH_PRIME64_1; + return XXH_OK; +} + +/*! @ingroup xxh64_family */ +XXH_PUBLIC_API XXH_errorcode +XXH64_update (XXH64_state_t* state, const void* input, size_t len) +{ + if (input==NULL) { + XXH_ASSERT(len == 0); + return XXH_OK; + } + + { const xxh_u8* p = (const xxh_u8*)input; + const xxh_u8* const bEnd = p + len; + + state->total_len += len; + + if (state->memsize + len < 32) { /* fill in tmp buffer */ + XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len); + state->memsize += (xxh_u32)len; + return XXH_OK; + } + + if (state->memsize) { /* tmp buffer is full */ + XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize); + state->v[0] = XXH64_round(state->v[0], XXH_readLE64(state->mem64+0)); + state->v[1] = XXH64_round(state->v[1], XXH_readLE64(state->mem64+1)); + state->v[2] = XXH64_round(state->v[2], XXH_readLE64(state->mem64+2)); + state->v[3] = XXH64_round(state->v[3], XXH_readLE64(state->mem64+3)); + p += 32 - state->memsize; + state->memsize = 0; + } + + if (p+32 <= bEnd) { + const xxh_u8* const limit = bEnd - 32; + + do { + state->v[0] = XXH64_round(state->v[0], XXH_readLE64(p)); p+=8; + state->v[1] = XXH64_round(state->v[1], XXH_readLE64(p)); p+=8; + state->v[2] = XXH64_round(state->v[2], XXH_readLE64(p)); p+=8; + state->v[3] = XXH64_round(state->v[3], XXH_readLE64(p)); p+=8; + } while (p<=limit); + + } + + if (p < bEnd) { + XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); + state->memsize = (unsigned)(bEnd-p); + } + } + + return XXH_OK; +} + + +/*! @ingroup xxh64_family */ +XXH_PUBLIC_API XXH64_hash_t XXH64_digest(const XXH64_state_t* state) +{ + xxh_u64 h64; + + if (state->total_len >= 32) { + h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18); + h64 = XXH64_mergeRound(h64, state->v[0]); + h64 = XXH64_mergeRound(h64, state->v[1]); + h64 = XXH64_mergeRound(h64, state->v[2]); + h64 = XXH64_mergeRound(h64, state->v[3]); + } else { + h64 = state->v[2] /*seed*/ + XXH_PRIME64_5; + } + + h64 += (xxh_u64) state->total_len; + + return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned); +} + + +/******* Canonical representation *******/ + +/*! @ingroup xxh64_family */ +XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) +{ + /* XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); */ + if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); + XXH_memcpy(dst, &hash, sizeof(*dst)); +} + +/*! @ingroup xxh64_family */ +XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) +{ + return XXH_readBE64(src); +} + +#ifndef XXH_NO_XXH3 + +/* ********************************************************************* +* XXH3 +* New generation hash designed for speed on small keys and vectorization +************************************************************************ */ +/*! + * @} + * @defgroup xxh3_impl XXH3 implementation + * @ingroup impl + * @{ + */ + +/* === Compiler specifics === */ + +#if ((defined(sun) || defined(__sun)) && __cplusplus) /* Solaris includes __STDC_VERSION__ with C++. Tested with GCC 5.5 */ +# define XXH_RESTRICT /* disable */ +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* >= C99 */ +# define XXH_RESTRICT restrict +#else +/* Note: it might be useful to define __restrict or __restrict__ for some C++ compilers */ +# define XXH_RESTRICT /* disable */ +#endif + +#if (defined(__GNUC__) && (__GNUC__ >= 3)) \ + || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) \ + || defined(__clang__) +# define XXH_likely(x) __builtin_expect(x, 1) +# define XXH_unlikely(x) __builtin_expect(x, 0) +#else +# define XXH_likely(x) (x) +# define XXH_unlikely(x) (x) +#endif + +#if defined(__GNUC__) || defined(__clang__) +# if defined(__ARM_NEON__) || defined(__ARM_NEON) \ + || defined(__aarch64__) || defined(_M_ARM) \ + || defined(_M_ARM64) || defined(_M_ARM64EC) +# define inline __inline__ /* circumvent a clang bug */ +# include +# undef inline +# elif defined(__AVX2__) +# include +# elif defined(__SSE2__) +# include +# endif +#endif + +#if defined(_MSC_VER) +# include +#endif + +/* + * One goal of XXH3 is to make it fast on both 32-bit and 64-bit, while + * remaining a true 64-bit/128-bit hash function. + * + * This is done by prioritizing a subset of 64-bit operations that can be + * emulated without too many steps on the average 32-bit machine. + * + * For example, these two lines seem similar, and run equally fast on 64-bit: + * + * xxh_u64 x; + * x ^= (x >> 47); // good + * x ^= (x >> 13); // bad + * + * However, to a 32-bit machine, there is a major difference. + * + * x ^= (x >> 47) looks like this: + * + * x.lo ^= (x.hi >> (47 - 32)); + * + * while x ^= (x >> 13) looks like this: + * + * // note: funnel shifts are not usually cheap. + * x.lo ^= (x.lo >> 13) | (x.hi << (32 - 13)); + * x.hi ^= (x.hi >> 13); + * + * The first one is significantly faster than the second, simply because the + * shift is larger than 32. This means: + * - All the bits we need are in the upper 32 bits, so we can ignore the lower + * 32 bits in the shift. + * - The shift result will always fit in the lower 32 bits, and therefore, + * we can ignore the upper 32 bits in the xor. + * + * Thanks to this optimization, XXH3 only requires these features to be efficient: + * + * - Usable unaligned access + * - A 32-bit or 64-bit ALU + * - If 32-bit, a decent ADC instruction + * - A 32 or 64-bit multiply with a 64-bit result + * - For the 128-bit variant, a decent byteswap helps short inputs. + * + * The first two are already required by XXH32, and almost all 32-bit and 64-bit + * platforms which can run XXH32 can run XXH3 efficiently. + * + * Thumb-1, the classic 16-bit only subset of ARM's instruction set, is one + * notable exception. + * + * First of all, Thumb-1 lacks support for the UMULL instruction which + * performs the important long multiply. This means numerous __aeabi_lmul + * calls. + * + * Second of all, the 8 functional registers are just not enough. + * Setup for __aeabi_lmul, byteshift loads, pointers, and all arithmetic need + * Lo registers, and this shuffling results in thousands more MOVs than A32. + * + * A32 and T32 don't have this limitation. They can access all 14 registers, + * do a 32->64 multiply with UMULL, and the flexible operand allowing free + * shifts is helpful, too. + * + * Therefore, we do a quick sanity check. + * + * If compiling Thumb-1 for a target which supports ARM instructions, we will + * emit a warning, as it is not a "sane" platform to compile for. + * + * Usually, if this happens, it is because of an accident and you probably need + * to specify -march, as you likely meant to compile for a newer architecture. + * + * Credit: large sections of the vectorial and asm source code paths + * have been contributed by @easyaspi314 + */ +#if defined(__thumb__) && !defined(__thumb2__) && defined(__ARM_ARCH_ISA_ARM) +# warning "XXH3 is highly inefficient without ARM or Thumb-2." +#endif + +/* ========================================== + * Vectorization detection + * ========================================== */ + +#ifdef XXH_DOXYGEN +/*! + * @ingroup tuning + * @brief Overrides the vectorization implementation chosen for XXH3. + * + * Can be defined to 0 to disable SIMD or any of the values mentioned in + * @ref XXH_VECTOR_TYPE. + * + * If this is not defined, it uses predefined macros to determine the best + * implementation. + */ +# define XXH_VECTOR XXH_SCALAR +/*! + * @ingroup tuning + * @brief Possible values for @ref XXH_VECTOR. + * + * Note that these are actually implemented as macros. + * + * If this is not defined, it is detected automatically. + * @ref XXH_X86DISPATCH overrides this. + */ +enum XXH_VECTOR_TYPE /* fake enum */ { + XXH_SCALAR = 0, /*!< Portable scalar version */ + XXH_SSE2 = 1, /*!< + * SSE2 for Pentium 4, Opteron, all x86_64. + * + * @note SSE2 is also guaranteed on Windows 10, macOS, and + * Android x86. + */ + XXH_AVX2 = 2, /*!< AVX2 for Haswell and Bulldozer */ + XXH_AVX512 = 3, /*!< AVX512 for Skylake and Icelake */ + XXH_NEON = 4, /*!< NEON for most ARMv7-A and all AArch64 */ + XXH_VSX = 5, /*!< VSX and ZVector for POWER8/z13 (64-bit) */ +}; +/*! + * @ingroup tuning + * @brief Selects the minimum alignment for XXH3's accumulators. + * + * When using SIMD, this should match the alignment required for said vector + * type, so, for example, 32 for AVX2. + * + * Default: Auto detected. + */ +# define XXH_ACC_ALIGN 8 +#endif + +/* Actual definition */ +#ifndef XXH_DOXYGEN +# define XXH_SCALAR 0 +# define XXH_SSE2 1 +# define XXH_AVX2 2 +# define XXH_AVX512 3 +# define XXH_NEON 4 +# define XXH_VSX 5 +#endif + +#ifndef XXH_VECTOR /* can be defined on command line */ +# if ( \ + defined(__ARM_NEON__) || defined(__ARM_NEON) /* gcc */ \ + || defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) /* msvc */ \ + ) && ( \ + defined(_WIN32) || defined(__LITTLE_ENDIAN__) /* little endian only */ \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \ + ) +# define XXH_VECTOR XXH_NEON +# elif defined(__AVX512F__) +# define XXH_VECTOR XXH_AVX512 +# elif defined(__AVX2__) +# define XXH_VECTOR XXH_AVX2 +# elif defined(__SSE2__) || defined(_M_AMD64) || defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP == 2)) +# define XXH_VECTOR XXH_SSE2 +# elif (defined(__PPC64__) && defined(__POWER8_VECTOR__)) \ + || (defined(__s390x__) && defined(__VEC__)) \ + && defined(__GNUC__) /* TODO: IBM XL */ +# define XXH_VECTOR XXH_VSX +# else +# define XXH_VECTOR XXH_SCALAR +# endif +#endif + +/* + * Controls the alignment of the accumulator, + * for compatibility with aligned vector loads, which are usually faster. + */ +#ifndef XXH_ACC_ALIGN +# if defined(XXH_X86DISPATCH) +# define XXH_ACC_ALIGN 64 /* for compatibility with avx512 */ +# elif XXH_VECTOR == XXH_SCALAR /* scalar */ +# define XXH_ACC_ALIGN 8 +# elif XXH_VECTOR == XXH_SSE2 /* sse2 */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_AVX2 /* avx2 */ +# define XXH_ACC_ALIGN 32 +# elif XXH_VECTOR == XXH_NEON /* neon */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_VSX /* vsx */ +# define XXH_ACC_ALIGN 16 +# elif XXH_VECTOR == XXH_AVX512 /* avx512 */ +# define XXH_ACC_ALIGN 64 +# endif +#endif + +#if defined(XXH_X86DISPATCH) || XXH_VECTOR == XXH_SSE2 \ + || XXH_VECTOR == XXH_AVX2 || XXH_VECTOR == XXH_AVX512 +# define XXH_SEC_ALIGN XXH_ACC_ALIGN +#else +# define XXH_SEC_ALIGN 8 +#endif + +/* + * UGLY HACK: + * GCC usually generates the best code with -O3 for xxHash. + * + * However, when targeting AVX2, it is overzealous in its unrolling resulting + * in code roughly 3/4 the speed of Clang. + * + * There are other issues, such as GCC splitting _mm256_loadu_si256 into + * _mm_loadu_si128 + _mm256_inserti128_si256. This is an optimization which + * only applies to Sandy and Ivy Bridge... which don't even support AVX2. + * + * That is why when compiling the AVX2 version, it is recommended to use either + * -O2 -mavx2 -march=haswell + * or + * -O2 -mavx2 -mno-avx256-split-unaligned-load + * for decent performance, or to use Clang instead. + * + * Fortunately, we can control the first one with a pragma that forces GCC into + * -O2, but the other one we can't control without "failed to inline always + * inline function due to target mismatch" warnings. + */ +#if XXH_VECTOR == XXH_AVX2 /* AVX2 */ \ + && defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */ +# pragma GCC push_options +# pragma GCC optimize("-O2") +#endif + + +#if XXH_VECTOR == XXH_NEON +/* + * NEON's setup for vmlal_u32 is a little more complicated than it is on + * SSE2, AVX2, and VSX. + * + * While PMULUDQ and VMULEUW both perform a mask, VMLAL.U32 performs an upcast. + * + * To do the same operation, the 128-bit 'Q' register needs to be split into + * two 64-bit 'D' registers, performing this operation:: + * + * [ a | b ] + * | '---------. .--------' | + * | x | + * | .---------' '--------. | + * [ a & 0xFFFFFFFF | b & 0xFFFFFFFF ],[ a >> 32 | b >> 32 ] + * + * Due to significant changes in aarch64, the fastest method for aarch64 is + * completely different than the fastest method for ARMv7-A. + * + * ARMv7-A treats D registers as unions overlaying Q registers, so modifying + * D11 will modify the high half of Q5. This is similar to how modifying AH + * will only affect bits 8-15 of AX on x86. + * + * VZIP takes two registers, and puts even lanes in one register and odd lanes + * in the other. + * + * On ARMv7-A, this strangely modifies both parameters in place instead of + * taking the usual 3-operand form. + * + * Therefore, if we want to do this, we can simply use a D-form VZIP.32 on the + * lower and upper halves of the Q register to end up with the high and low + * halves where we want - all in one instruction. + * + * vzip.32 d10, d11 @ d10 = { d10[0], d11[0] }; d11 = { d10[1], d11[1] } + * + * Unfortunately we need inline assembly for this: Instructions modifying two + * registers at once is not possible in GCC or Clang's IR, and they have to + * create a copy. + * + * aarch64 requires a different approach. + * + * In order to make it easier to write a decent compiler for aarch64, many + * quirks were removed, such as conditional execution. + * + * NEON was also affected by this. + * + * aarch64 cannot access the high bits of a Q-form register, and writes to a + * D-form register zero the high bits, similar to how writes to W-form scalar + * registers (or DWORD registers on x86_64) work. + * + * The formerly free vget_high intrinsics now require a vext (with a few + * exceptions) + * + * Additionally, VZIP was replaced by ZIP1 and ZIP2, which are the equivalent + * of PUNPCKL* and PUNPCKH* in SSE, respectively, in order to only modify one + * operand. + * + * The equivalent of the VZIP.32 on the lower and upper halves would be this + * mess: + * + * ext v2.4s, v0.4s, v0.4s, #2 // v2 = { v0[2], v0[3], v0[0], v0[1] } + * zip1 v1.2s, v0.2s, v2.2s // v1 = { v0[0], v2[0] } + * zip2 v0.2s, v0.2s, v1.2s // v0 = { v0[1], v2[1] } + * + * Instead, we use a literal downcast, vmovn_u64 (XTN), and vshrn_n_u64 (SHRN): + * + * shrn v1.2s, v0.2d, #32 // v1 = (uint32x2_t)(v0 >> 32); + * xtn v0.2s, v0.2d // v0 = (uint32x2_t)(v0 & 0xFFFFFFFF); + * + * This is available on ARMv7-A, but is less efficient than a single VZIP.32. + */ + +/*! + * Function-like macro: + * void XXH_SPLIT_IN_PLACE(uint64x2_t &in, uint32x2_t &outLo, uint32x2_t &outHi) + * { + * outLo = (uint32x2_t)(in & 0xFFFFFFFF); + * outHi = (uint32x2_t)(in >> 32); + * in = UNDEFINED; + * } + */ +# if !defined(XXH_NO_VZIP_HACK) /* define to disable */ \ + && (defined(__GNUC__) || defined(__clang__)) \ + && (defined(__arm__) || defined(__thumb__) || defined(_M_ARM)) +# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ + do { \ + /* Undocumented GCC/Clang operand modifier: %e0 = lower D half, %f0 = upper D half */ \ + /* https://github.com/gcc-mirror/gcc/blob/38cf91e5/gcc/config/arm/arm.c#L22486 */ \ + /* https://github.com/llvm-mirror/llvm/blob/2c4ca683/lib/Target/ARM/ARMAsmPrinter.cpp#L399 */ \ + __asm__("vzip.32 %e0, %f0" : "+w" (in)); \ + (outLo) = vget_low_u32 (vreinterpretq_u32_u64(in)); \ + (outHi) = vget_high_u32(vreinterpretq_u32_u64(in)); \ + } while (0) +# else +# define XXH_SPLIT_IN_PLACE(in, outLo, outHi) \ + do { \ + (outLo) = vmovn_u64 (in); \ + (outHi) = vshrn_n_u64 ((in), 32); \ + } while (0) +# endif + +/*! + * @ingroup tuning + * @brief Controls the NEON to scalar ratio for XXH3 + * + * On AArch64 when not optimizing for size, XXH3 will run 6 lanes using NEON and + * 2 lanes on scalar by default. + * + * This can be set to 2, 4, 6, or 8. ARMv7 will default to all 8 NEON lanes, as the + * emulated 64-bit arithmetic is too slow. + * + * Modern ARM CPUs are _very_ sensitive to how their pipelines are used. + * + * For example, the Cortex-A73 can dispatch 3 micro-ops per cycle, but it can't + * have more than 2 NEON (F0/F1) micro-ops. If you are only using NEON instructions, + * you are only using 2/3 of the CPU bandwidth. + * + * This is even more noticeable on the more advanced cores like the A76 which + * can dispatch 8 micro-ops per cycle, but still only 2 NEON micro-ops at once. + * + * Therefore, @ref XXH3_NEON_LANES lanes will be processed using NEON, and the + * remaining lanes will use scalar instructions. This improves the bandwidth + * and also gives the integer pipelines something to do besides twiddling loop + * counters and pointers. + * + * This change benefits CPUs with large micro-op buffers without negatively affecting + * other CPUs: + * + * | Chipset | Dispatch type | NEON only | 6:2 hybrid | Diff. | + * |:----------------------|:--------------------|----------:|-----------:|------:| + * | Snapdragon 730 (A76) | 2 NEON/8 micro-ops | 8.8 GB/s | 10.1 GB/s | ~16% | + * | Snapdragon 835 (A73) | 2 NEON/3 micro-ops | 5.1 GB/s | 5.3 GB/s | ~5% | + * | Marvell PXA1928 (A53) | In-order dual-issue | 1.9 GB/s | 1.9 GB/s | 0% | + * + * It also seems to fix some bad codegen on GCC, making it almost as fast as clang. + * + * @see XXH3_accumulate_512_neon() + */ +# ifndef XXH3_NEON_LANES +# if (defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || defined(_M_ARM64EC)) \ + && !defined(__OPTIMIZE_SIZE__) +# define XXH3_NEON_LANES 6 +# else +# define XXH3_NEON_LANES XXH_ACC_NB +# endif +# endif +#endif /* XXH_VECTOR == XXH_NEON */ + +/* + * VSX and Z Vector helpers. + * + * This is very messy, and any pull requests to clean this up are welcome. + * + * There are a lot of problems with supporting VSX and s390x, due to + * inconsistent intrinsics, spotty coverage, and multiple endiannesses. + */ +#if XXH_VECTOR == XXH_VSX +# if defined(__s390x__) +# include +# else +/* gcc's altivec.h can have the unwanted consequence to unconditionally + * #define bool, vector, and pixel keywords, + * with bad consequences for programs already using these keywords for other purposes. + * The paragraph defining these macros is skipped when __APPLE_ALTIVEC__ is defined. + * __APPLE_ALTIVEC__ is _generally_ defined automatically by the compiler, + * but it seems that, in some cases, it isn't. + * Force the build macro to be defined, so that keywords are not altered. + */ +# if defined(__GNUC__) && !defined(__APPLE_ALTIVEC__) +# define __APPLE_ALTIVEC__ +# endif +# include +# endif + +typedef __vector unsigned long long xxh_u64x2; +typedef __vector unsigned char xxh_u8x16; +typedef __vector unsigned xxh_u32x4; + +# ifndef XXH_VSX_BE +# if defined(__BIG_ENDIAN__) \ + || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +# define XXH_VSX_BE 1 +# elif defined(__VEC_ELEMENT_REG_ORDER__) && __VEC_ELEMENT_REG_ORDER__ == __ORDER_BIG_ENDIAN__ +# warning "-maltivec=be is not recommended. Please use native endianness." +# define XXH_VSX_BE 1 +# else +# define XXH_VSX_BE 0 +# endif +# endif /* !defined(XXH_VSX_BE) */ + +# if XXH_VSX_BE +# if defined(__POWER9_VECTOR__) || (defined(__clang__) && defined(__s390x__)) +# define XXH_vec_revb vec_revb +# else +/*! + * A polyfill for POWER9's vec_revb(). + */ +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_revb(xxh_u64x2 val) +{ + xxh_u8x16 const vByteSwap = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, + 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }; + return vec_perm(val, val, vByteSwap); +} +# endif +# endif /* XXH_VSX_BE */ + +/*! + * Performs an unaligned vector load and byte swaps it on big endian. + */ +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_loadu(const void *ptr) +{ + xxh_u64x2 ret; + XXH_memcpy(&ret, ptr, sizeof(xxh_u64x2)); +# if XXH_VSX_BE + ret = XXH_vec_revb(ret); +# endif + return ret; +} + +/* + * vec_mulo and vec_mule are very problematic intrinsics on PowerPC + * + * These intrinsics weren't added until GCC 8, despite existing for a while, + * and they are endian dependent. Also, their meaning swap depending on version. + * */ +# if defined(__s390x__) + /* s390x is always big endian, no issue on this platform */ +# define XXH_vec_mulo vec_mulo +# define XXH_vec_mule vec_mule +# elif defined(__clang__) && XXH_HAS_BUILTIN(__builtin_altivec_vmuleuw) +/* Clang has a better way to control this, we can just use the builtin which doesn't swap. */ +# define XXH_vec_mulo __builtin_altivec_vmulouw +# define XXH_vec_mule __builtin_altivec_vmuleuw +# else +/* gcc needs inline assembly */ +/* Adapted from https://github.com/google/highwayhash/blob/master/highwayhash/hh_vsx.h. */ +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mulo(xxh_u32x4 a, xxh_u32x4 b) +{ + xxh_u64x2 result; + __asm__("vmulouw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); + return result; +} +XXH_FORCE_INLINE xxh_u64x2 XXH_vec_mule(xxh_u32x4 a, xxh_u32x4 b) +{ + xxh_u64x2 result; + __asm__("vmuleuw %0, %1, %2" : "=v" (result) : "v" (a), "v" (b)); + return result; +} +# endif /* XXH_vec_mulo, XXH_vec_mule */ +#endif /* XXH_VECTOR == XXH_VSX */ + + +/* prefetch + * can be disabled, by declaring XXH_NO_PREFETCH build macro */ +#if defined(XXH_NO_PREFETCH) +# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ +#else +# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) /* _mm_prefetch() not defined outside of x86/x64 */ +# include /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ +# define XXH_PREFETCH(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) +# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) +# define XXH_PREFETCH(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) +# else +# define XXH_PREFETCH(ptr) (void)(ptr) /* disabled */ +# endif +#endif /* XXH_NO_PREFETCH */ + + +/* ========================================== + * XXH3 default settings + * ========================================== */ + +#define XXH_SECRET_DEFAULT_SIZE 192 /* minimum XXH3_SECRET_SIZE_MIN */ + +#if (XXH_SECRET_DEFAULT_SIZE < XXH3_SECRET_SIZE_MIN) +# error "default keyset is not large enough" +#endif + +/*! Pseudorandom secret taken directly from FARSH. */ +XXH_ALIGN(64) static const xxh_u8 XXH3_kSecret[XXH_SECRET_DEFAULT_SIZE] = { + 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, + 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, + 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, + 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, + 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, + 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, + 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, + 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, + 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, + 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, + 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, + 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, +}; + + +#ifdef XXH_OLD_NAMES +# define kSecret XXH3_kSecret +#endif + +#ifdef XXH_DOXYGEN +/*! + * @brief Calculates a 32-bit to 64-bit long multiply. + * + * Implemented as a macro. + * + * Wraps `__emulu` on MSVC x86 because it tends to call `__allmul` when it doesn't + * need to (but it shouldn't need to anyways, it is about 7 instructions to do + * a 64x64 multiply...). Since we know that this will _always_ emit `MULL`, we + * use that instead of the normal method. + * + * If you are compiling for platforms like Thumb-1 and don't have a better option, + * you may also want to write your own long multiply routine here. + * + * @param x, y Numbers to be multiplied + * @return 64-bit product of the low 32 bits of @p x and @p y. + */ +XXH_FORCE_INLINE xxh_u64 +XXH_mult32to64(xxh_u64 x, xxh_u64 y) +{ + return (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF); +} +#elif defined(_MSC_VER) && defined(_M_IX86) +# define XXH_mult32to64(x, y) __emulu((unsigned)(x), (unsigned)(y)) +#else +/* + * Downcast + upcast is usually better than masking on older compilers like + * GCC 4.2 (especially 32-bit ones), all without affecting newer compilers. + * + * The other method, (x & 0xFFFFFFFF) * (y & 0xFFFFFFFF), will AND both operands + * and perform a full 64x64 multiply -- entirely redundant on 32-bit. + */ +# define XXH_mult32to64(x, y) ((xxh_u64)(xxh_u32)(x) * (xxh_u64)(xxh_u32)(y)) +#endif + +/*! + * @brief Calculates a 64->128-bit long multiply. + * + * Uses `__uint128_t` and `_umul128` if available, otherwise uses a scalar + * version. + * + * @param lhs , rhs The 64-bit integers to be multiplied + * @return The 128-bit result represented in an @ref XXH128_hash_t. + */ +static XXH128_hash_t +XXH_mult64to128(xxh_u64 lhs, xxh_u64 rhs) +{ + /* + * GCC/Clang __uint128_t method. + * + * On most 64-bit targets, GCC and Clang define a __uint128_t type. + * This is usually the best way as it usually uses a native long 64-bit + * multiply, such as MULQ on x86_64 or MUL + UMULH on aarch64. + * + * Usually. + * + * Despite being a 32-bit platform, Clang (and emscripten) define this type + * despite not having the arithmetic for it. This results in a laggy + * compiler builtin call which calculates a full 128-bit multiply. + * In that case it is best to use the portable one. + * https://github.com/Cyan4973/xxHash/issues/211#issuecomment-515575677 + */ +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__wasm__) \ + && defined(__SIZEOF_INT128__) \ + || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128) + + __uint128_t const product = (__uint128_t)lhs * (__uint128_t)rhs; + XXH128_hash_t r128; + r128.low64 = (xxh_u64)(product); + r128.high64 = (xxh_u64)(product >> 64); + return r128; + + /* + * MSVC for x64's _umul128 method. + * + * xxh_u64 _umul128(xxh_u64 Multiplier, xxh_u64 Multiplicand, xxh_u64 *HighProduct); + * + * This compiles to single operand MUL on x64. + */ +#elif (defined(_M_X64) || defined(_M_IA64)) && !defined(_M_ARM64EC) + +#ifndef _MSC_VER +# pragma intrinsic(_umul128) +#endif + xxh_u64 product_high; + xxh_u64 const product_low = _umul128(lhs, rhs, &product_high); + XXH128_hash_t r128; + r128.low64 = product_low; + r128.high64 = product_high; + return r128; + + /* + * MSVC for ARM64's __umulh method. + * + * This compiles to the same MUL + UMULH as GCC/Clang's __uint128_t method. + */ +#elif defined(_M_ARM64) || defined(_M_ARM64EC) + +#ifndef _MSC_VER +# pragma intrinsic(__umulh) +#endif + XXH128_hash_t r128; + r128.low64 = lhs * rhs; + r128.high64 = __umulh(lhs, rhs); + return r128; + +#else + /* + * Portable scalar method. Optimized for 32-bit and 64-bit ALUs. + * + * This is a fast and simple grade school multiply, which is shown below + * with base 10 arithmetic instead of base 0x100000000. + * + * 9 3 // D2 lhs = 93 + * x 7 5 // D2 rhs = 75 + * ---------- + * 1 5 // D2 lo_lo = (93 % 10) * (75 % 10) = 15 + * 4 5 | // D2 hi_lo = (93 / 10) * (75 % 10) = 45 + * 2 1 | // D2 lo_hi = (93 % 10) * (75 / 10) = 21 + * + 6 3 | | // D2 hi_hi = (93 / 10) * (75 / 10) = 63 + * --------- + * 2 7 | // D2 cross = (15 / 10) + (45 % 10) + 21 = 27 + * + 6 7 | | // D2 upper = (27 / 10) + (45 / 10) + 63 = 67 + * --------- + * 6 9 7 5 // D4 res = (27 * 10) + (15 % 10) + (67 * 100) = 6975 + * + * The reasons for adding the products like this are: + * 1. It avoids manual carry tracking. Just like how + * (9 * 9) + 9 + 9 = 99, the same applies with this for UINT64_MAX. + * This avoids a lot of complexity. + * + * 2. It hints for, and on Clang, compiles to, the powerful UMAAL + * instruction available in ARM's Digital Signal Processing extension + * in 32-bit ARMv6 and later, which is shown below: + * + * void UMAAL(xxh_u32 *RdLo, xxh_u32 *RdHi, xxh_u32 Rn, xxh_u32 Rm) + * { + * xxh_u64 product = (xxh_u64)*RdLo * (xxh_u64)*RdHi + Rn + Rm; + * *RdLo = (xxh_u32)(product & 0xFFFFFFFF); + * *RdHi = (xxh_u32)(product >> 32); + * } + * + * This instruction was designed for efficient long multiplication, and + * allows this to be calculated in only 4 instructions at speeds + * comparable to some 64-bit ALUs. + * + * 3. It isn't terrible on other platforms. Usually this will be a couple + * of 32-bit ADD/ADCs. + */ + + /* First calculate all of the cross products. */ + xxh_u64 const lo_lo = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs & 0xFFFFFFFF); + xxh_u64 const hi_lo = XXH_mult32to64(lhs >> 32, rhs & 0xFFFFFFFF); + xxh_u64 const lo_hi = XXH_mult32to64(lhs & 0xFFFFFFFF, rhs >> 32); + xxh_u64 const hi_hi = XXH_mult32to64(lhs >> 32, rhs >> 32); + + /* Now add the products together. These will never overflow. */ + xxh_u64 const cross = (lo_lo >> 32) + (hi_lo & 0xFFFFFFFF) + lo_hi; + xxh_u64 const upper = (hi_lo >> 32) + (cross >> 32) + hi_hi; + xxh_u64 const lower = (cross << 32) | (lo_lo & 0xFFFFFFFF); + + XXH128_hash_t r128; + r128.low64 = lower; + r128.high64 = upper; + return r128; +#endif +} + +/*! + * @brief Calculates a 64-bit to 128-bit multiply, then XOR folds it. + * + * The reason for the separate function is to prevent passing too many structs + * around by value. This will hopefully inline the multiply, but we don't force it. + * + * @param lhs , rhs The 64-bit integers to multiply + * @return The low 64 bits of the product XOR'd by the high 64 bits. + * @see XXH_mult64to128() + */ +static xxh_u64 +XXH3_mul128_fold64(xxh_u64 lhs, xxh_u64 rhs) +{ + XXH128_hash_t product = XXH_mult64to128(lhs, rhs); + return product.low64 ^ product.high64; +} + +/*! Seems to produce slightly better code on GCC for some reason. */ +XXH_FORCE_INLINE xxh_u64 XXH_xorshift64(xxh_u64 v64, int shift) +{ + XXH_ASSERT(0 <= shift && shift < 64); + return v64 ^ (v64 >> shift); +} + +/* + * This is a fast avalanche stage, + * suitable when input bits are already partially mixed + */ +static XXH64_hash_t XXH3_avalanche(xxh_u64 h64) +{ + h64 = XXH_xorshift64(h64, 37); + h64 *= 0x165667919E3779F9ULL; + h64 = XXH_xorshift64(h64, 32); + return h64; +} + +/* + * This is a stronger avalanche, + * inspired by Pelle Evensen's rrmxmx + * preferable when input has not been previously mixed + */ +static XXH64_hash_t XXH3_rrmxmx(xxh_u64 h64, xxh_u64 len) +{ + /* this mix is inspired by Pelle Evensen's rrmxmx */ + h64 ^= XXH_rotl64(h64, 49) ^ XXH_rotl64(h64, 24); + h64 *= 0x9FB21C651E98DF25ULL; + h64 ^= (h64 >> 35) + len ; + h64 *= 0x9FB21C651E98DF25ULL; + return XXH_xorshift64(h64, 28); +} + + +/* ========================================== + * Short keys + * ========================================== + * One of the shortcomings of XXH32 and XXH64 was that their performance was + * sub-optimal on short lengths. It used an iterative algorithm which strongly + * favored lengths that were a multiple of 4 or 8. + * + * Instead of iterating over individual inputs, we use a set of single shot + * functions which piece together a range of lengths and operate in constant time. + * + * Additionally, the number of multiplies has been significantly reduced. This + * reduces latency, especially when emulating 64-bit multiplies on 32-bit. + * + * Depending on the platform, this may or may not be faster than XXH32, but it + * is almost guaranteed to be faster than XXH64. + */ + +/* + * At very short lengths, there isn't enough input to fully hide secrets, or use + * the entire secret. + * + * There is also only a limited amount of mixing we can do before significantly + * impacting performance. + * + * Therefore, we use different sections of the secret and always mix two secret + * samples with an XOR. This should have no effect on performance on the + * seedless or withSeed variants because everything _should_ be constant folded + * by modern compilers. + * + * The XOR mixing hides individual parts of the secret and increases entropy. + * + * This adds an extra layer of strength for custom secrets. + */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_1to3_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(1 <= len && len <= 3); + XXH_ASSERT(secret != NULL); + /* + * len = 1: combined = { input[0], 0x01, input[0], input[0] } + * len = 2: combined = { input[1], 0x02, input[0], input[1] } + * len = 3: combined = { input[2], 0x03, input[0], input[1] } + */ + { xxh_u8 const c1 = input[0]; + xxh_u8 const c2 = input[len >> 1]; + xxh_u8 const c3 = input[len - 1]; + xxh_u32 const combined = ((xxh_u32)c1 << 16) | ((xxh_u32)c2 << 24) + | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); + xxh_u64 const bitflip = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; + xxh_u64 const keyed = (xxh_u64)combined ^ bitflip; + return XXH64_avalanche(keyed); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_4to8_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(4 <= len && len <= 8); + seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; + { xxh_u32 const input1 = XXH_readLE32(input); + xxh_u32 const input2 = XXH_readLE32(input + len - 4); + xxh_u64 const bitflip = (XXH_readLE64(secret+8) ^ XXH_readLE64(secret+16)) - seed; + xxh_u64 const input64 = input2 + (((xxh_u64)input1) << 32); + xxh_u64 const keyed = input64 ^ bitflip; + return XXH3_rrmxmx(keyed, len); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_9to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(9 <= len && len <= 16); + { xxh_u64 const bitflip1 = (XXH_readLE64(secret+24) ^ XXH_readLE64(secret+32)) + seed; + xxh_u64 const bitflip2 = (XXH_readLE64(secret+40) ^ XXH_readLE64(secret+48)) - seed; + xxh_u64 const input_lo = XXH_readLE64(input) ^ bitflip1; + xxh_u64 const input_hi = XXH_readLE64(input + len - 8) ^ bitflip2; + xxh_u64 const acc = len + + XXH_swap64(input_lo) + input_hi + + XXH3_mul128_fold64(input_lo, input_hi); + return XXH3_avalanche(acc); + } +} + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_0to16_64b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(len <= 16); + { if (XXH_likely(len > 8)) return XXH3_len_9to16_64b(input, len, secret, seed); + if (XXH_likely(len >= 4)) return XXH3_len_4to8_64b(input, len, secret, seed); + if (len) return XXH3_len_1to3_64b(input, len, secret, seed); + return XXH64_avalanche(seed ^ (XXH_readLE64(secret+56) ^ XXH_readLE64(secret+64))); + } +} + +/* + * DISCLAIMER: There are known *seed-dependent* multicollisions here due to + * multiplication by zero, affecting hashes of lengths 17 to 240. + * + * However, they are very unlikely. + * + * Keep this in mind when using the unseeded XXH3_64bits() variant: As with all + * unseeded non-cryptographic hashes, it does not attempt to defend itself + * against specially crafted inputs, only random inputs. + * + * Compared to classic UMAC where a 1 in 2^31 chance of 4 consecutive bytes + * cancelling out the secret is taken an arbitrary number of times (addressed + * in XXH3_accumulate_512), this collision is very unlikely with random inputs + * and/or proper seeding: + * + * This only has a 1 in 2^63 chance of 8 consecutive bytes cancelling out, in a + * function that is only called up to 16 times per hash with up to 240 bytes of + * input. + * + * This is not too bad for a non-cryptographic hash function, especially with + * only 64 bit outputs. + * + * The 128-bit variant (which trades some speed for strength) is NOT affected + * by this, although it is always a good idea to use a proper seed if you care + * about strength. + */ +XXH_FORCE_INLINE xxh_u64 XXH3_mix16B(const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, xxh_u64 seed64) +{ +#if defined(__GNUC__) && !defined(__clang__) /* GCC, not Clang */ \ + && defined(__i386__) && defined(__SSE2__) /* x86 + SSE2 */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable like XXH32 hack */ + /* + * UGLY HACK: + * GCC for x86 tends to autovectorize the 128-bit multiply, resulting in + * slower code. + * + * By forcing seed64 into a register, we disrupt the cost model and + * cause it to scalarize. See `XXH32_round()` + * + * FIXME: Clang's output is still _much_ faster -- On an AMD Ryzen 3600, + * XXH3_64bits @ len=240 runs at 4.6 GB/s with Clang 9, but 3.3 GB/s on + * GCC 9.2, despite both emitting scalar code. + * + * GCC generates much better scalar code than Clang for the rest of XXH3, + * which is why finding a more optimal codepath is an interest. + */ + XXH_COMPILER_GUARD(seed64); +#endif + { xxh_u64 const input_lo = XXH_readLE64(input); + xxh_u64 const input_hi = XXH_readLE64(input+8); + return XXH3_mul128_fold64( + input_lo ^ (XXH_readLE64(secret) + seed64), + input_hi ^ (XXH_readLE64(secret+8) - seed64) + ); + } +} + +/* For mid range keys, XXH3 uses a Mum-hash variant. */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_len_17to128_64b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(16 < len && len <= 128); + + { xxh_u64 acc = len * XXH_PRIME64_1; + if (len > 32) { + if (len > 64) { + if (len > 96) { + acc += XXH3_mix16B(input+48, secret+96, seed); + acc += XXH3_mix16B(input+len-64, secret+112, seed); + } + acc += XXH3_mix16B(input+32, secret+64, seed); + acc += XXH3_mix16B(input+len-48, secret+80, seed); + } + acc += XXH3_mix16B(input+16, secret+32, seed); + acc += XXH3_mix16B(input+len-32, secret+48, seed); + } + acc += XXH3_mix16B(input+0, secret+0, seed); + acc += XXH3_mix16B(input+len-16, secret+16, seed); + + return XXH3_avalanche(acc); + } +} + +#define XXH3_MIDSIZE_MAX 240 + +XXH_NO_INLINE XXH64_hash_t +XXH3_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); + + #define XXH3_MIDSIZE_STARTOFFSET 3 + #define XXH3_MIDSIZE_LASTOFFSET 17 + + { xxh_u64 acc = len * XXH_PRIME64_1; + int const nbRounds = (int)len / 16; + int i; + for (i=0; i<8; i++) { + acc += XXH3_mix16B(input+(16*i), secret+(16*i), seed); + } + acc = XXH3_avalanche(acc); + XXH_ASSERT(nbRounds >= 8); +#if defined(__clang__) /* Clang */ \ + && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ + /* + * UGLY HACK: + * Clang for ARMv7-A tries to vectorize this loop, similar to GCC x86. + * In everywhere else, it uses scalar code. + * + * For 64->128-bit multiplies, even if the NEON was 100% optimal, it + * would still be slower than UMAAL (see XXH_mult64to128). + * + * Unfortunately, Clang doesn't handle the long multiplies properly and + * converts them to the nonexistent "vmulq_u64" intrinsic, which is then + * scalarized into an ugly mess of VMOV.32 instructions. + * + * This mess is difficult to avoid without turning autovectorization + * off completely, but they are usually relatively minor and/or not + * worth it to fix. + * + * This loop is the easiest to fix, as unlike XXH32, this pragma + * _actually works_ because it is a loop vectorization instead of an + * SLP vectorization. + */ + #pragma clang loop vectorize(disable) +#endif + for (i=8 ; i < nbRounds; i++) { + acc += XXH3_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3_MIDSIZE_STARTOFFSET, seed); + } + /* last bytes */ + acc += XXH3_mix16B(input + len - 16, secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET, seed); + return XXH3_avalanche(acc); + } +} + + +/* ======= Long Keys ======= */ + +#define XXH_STRIPE_LEN 64 +#define XXH_SECRET_CONSUME_RATE 8 /* nb of secret bytes consumed at each accumulation */ +#define XXH_ACC_NB (XXH_STRIPE_LEN / sizeof(xxh_u64)) + +#ifdef XXH_OLD_NAMES +# define STRIPE_LEN XXH_STRIPE_LEN +# define ACC_NB XXH_ACC_NB +#endif + +XXH_FORCE_INLINE void XXH_writeLE64(void* dst, xxh_u64 v64) +{ + if (!XXH_CPU_LITTLE_ENDIAN) v64 = XXH_swap64(v64); + XXH_memcpy(dst, &v64, sizeof(v64)); +} + +/* Several intrinsic functions below are supposed to accept __int64 as argument, + * as documented in https://software.intel.com/sites/landingpage/IntrinsicsGuide/ . + * However, several environments do not define __int64 type, + * requiring a workaround. + */ +#if !defined (__VMS) \ + && (defined (__cplusplus) \ + || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) + typedef int64_t xxh_i64; +#else + /* the following type must have a width of 64-bit */ + typedef long long xxh_i64; +#endif + + +/* + * XXH3_accumulate_512 is the tightest loop for long inputs, and it is the most optimized. + * + * It is a hardened version of UMAC, based off of FARSH's implementation. + * + * This was chosen because it adapts quite well to 32-bit, 64-bit, and SIMD + * implementations, and it is ridiculously fast. + * + * We harden it by mixing the original input to the accumulators as well as the product. + * + * This means that in the (relatively likely) case of a multiply by zero, the + * original input is preserved. + * + * On 128-bit inputs, we swap 64-bit pairs when we add the input to improve + * cross-pollination, as otherwise the upper and lower halves would be + * essentially independent. + * + * This doesn't matter on 64-bit hashes since they all get merged together in + * the end, so we skip the extra step. + * + * Both XXH3_64bits and XXH3_128bits use this subroutine. + */ + +#if (XXH_VECTOR == XXH_AVX512) \ + || (defined(XXH_DISPATCH_AVX512) && XXH_DISPATCH_AVX512 != 0) + +#ifndef XXH_TARGET_AVX512 +# define XXH_TARGET_AVX512 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_accumulate_512_avx512(void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + __m512i* const xacc = (__m512i *) acc; + XXH_ASSERT((((size_t)acc) & 63) == 0); + XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); + + { + /* data_vec = input[0]; */ + __m512i const data_vec = _mm512_loadu_si512 (input); + /* key_vec = secret[0]; */ + __m512i const key_vec = _mm512_loadu_si512 (secret); + /* data_key = data_vec ^ key_vec; */ + __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m512i const data_key_lo = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m512i const product = _mm512_mul_epu32 (data_key, data_key_lo); + /* xacc[0] += swap(data_vec); */ + __m512i const data_swap = _mm512_shuffle_epi32(data_vec, (_MM_PERM_ENUM)_MM_SHUFFLE(1, 0, 3, 2)); + __m512i const sum = _mm512_add_epi64(*xacc, data_swap); + /* xacc[0] += product; */ + *xacc = _mm512_add_epi64(product, sum); + } +} + +/* + * XXH3_scrambleAcc: Scrambles the accumulators to improve mixing. + * + * Multiplication isn't perfect, as explained by Google in HighwayHash: + * + * // Multiplication mixes/scrambles bytes 0-7 of the 64-bit result to + * // varying degrees. In descending order of goodness, bytes + * // 3 4 2 5 1 6 0 7 have quality 228 224 164 160 100 96 36 32. + * // As expected, the upper and lower bytes are much worse. + * + * Source: https://github.com/google/highwayhash/blob/0aaf66b/highwayhash/hh_avx2.h#L291 + * + * Since our algorithm uses a pseudorandom secret to add some variance into the + * mix, we don't need to (or want to) mix as often or as much as HighwayHash does. + * + * This isn't as tight as XXH3_accumulate, but still written in SIMD to avoid + * extraction. + * + * Both XXH3_64bits and XXH3_128bits use this subroutine. + */ + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_scrambleAcc_avx512(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 63) == 0); + XXH_STATIC_ASSERT(XXH_STRIPE_LEN == sizeof(__m512i)); + { __m512i* const xacc = (__m512i*) acc; + const __m512i prime32 = _mm512_set1_epi32((int)XXH_PRIME32_1); + + /* xacc[0] ^= (xacc[0] >> 47) */ + __m512i const acc_vec = *xacc; + __m512i const shifted = _mm512_srli_epi64 (acc_vec, 47); + __m512i const data_vec = _mm512_xor_si512 (acc_vec, shifted); + /* xacc[0] ^= secret; */ + __m512i const key_vec = _mm512_loadu_si512 (secret); + __m512i const data_key = _mm512_xor_si512 (data_vec, key_vec); + + /* xacc[0] *= XXH_PRIME32_1; */ + __m512i const data_key_hi = _mm512_shuffle_epi32 (data_key, (_MM_PERM_ENUM)_MM_SHUFFLE(0, 3, 0, 1)); + __m512i const prod_lo = _mm512_mul_epu32 (data_key, prime32); + __m512i const prod_hi = _mm512_mul_epu32 (data_key_hi, prime32); + *xacc = _mm512_add_epi64(prod_lo, _mm512_slli_epi64(prod_hi, 32)); + } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX512 void +XXH3_initCustomSecret_avx512(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 63) == 0); + XXH_STATIC_ASSERT(XXH_SEC_ALIGN == 64); + XXH_ASSERT(((size_t)customSecret & 63) == 0); + (void)(&XXH_writeLE64); + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m512i); + __m512i const seed = _mm512_mask_set1_epi64(_mm512_set1_epi64((xxh_i64)seed64), 0xAA, (xxh_i64)(0U - seed64)); + + const __m512i* const src = (const __m512i*) ((const void*) XXH3_kSecret); + __m512i* const dest = ( __m512i*) customSecret; + int i; + XXH_ASSERT(((size_t)src & 63) == 0); /* control alignment */ + XXH_ASSERT(((size_t)dest & 63) == 0); + for (i=0; i < nbRounds; ++i) { + /* GCC has a bug, _mm512_stream_load_si512 accepts 'void*', not 'void const*', + * this will warn "discards 'const' qualifier". */ + union { + const __m512i* cp; + void* p; + } remote_const_void; + remote_const_void.cp = src + i; + dest[i] = _mm512_add_epi64(_mm512_stream_load_si512(remote_const_void.p), seed); + } } +} + +#endif + +#if (XXH_VECTOR == XXH_AVX2) \ + || (defined(XXH_DISPATCH_AVX2) && XXH_DISPATCH_AVX2 != 0) + +#ifndef XXH_TARGET_AVX2 +# define XXH_TARGET_AVX2 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void +XXH3_accumulate_512_avx2( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 31) == 0); + { __m256i* const xacc = (__m256i *) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xinput = (const __m256i *) input; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xsecret = (const __m256i *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { + /* data_vec = xinput[i]; */ + __m256i const data_vec = _mm256_loadu_si256 (xinput+i); + /* key_vec = xsecret[i]; */ + __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); + /* data_key = data_vec ^ key_vec; */ + __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m256i const data_key_lo = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m256i const product = _mm256_mul_epu32 (data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m256i const data_swap = _mm256_shuffle_epi32(data_vec, _MM_SHUFFLE(1, 0, 3, 2)); + __m256i const sum = _mm256_add_epi64(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = _mm256_add_epi64(product, sum); + } } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void +XXH3_scrambleAcc_avx2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 31) == 0); + { __m256i* const xacc = (__m256i*) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm256_loadu_si256 requires a const __m256i * pointer for some reason. */ + const __m256i* const xsecret = (const __m256i *) secret; + const __m256i prime32 = _mm256_set1_epi32((int)XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m256i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m256i const acc_vec = xacc[i]; + __m256i const shifted = _mm256_srli_epi64 (acc_vec, 47); + __m256i const data_vec = _mm256_xor_si256 (acc_vec, shifted); + /* xacc[i] ^= xsecret; */ + __m256i const key_vec = _mm256_loadu_si256 (xsecret+i); + __m256i const data_key = _mm256_xor_si256 (data_vec, key_vec); + + /* xacc[i] *= XXH_PRIME32_1; */ + __m256i const data_key_hi = _mm256_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m256i const prod_lo = _mm256_mul_epu32 (data_key, prime32); + __m256i const prod_hi = _mm256_mul_epu32 (data_key_hi, prime32); + xacc[i] = _mm256_add_epi64(prod_lo, _mm256_slli_epi64(prod_hi, 32)); + } + } +} + +XXH_FORCE_INLINE XXH_TARGET_AVX2 void XXH3_initCustomSecret_avx2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 31) == 0); + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE / sizeof(__m256i)) == 6); + XXH_STATIC_ASSERT(XXH_SEC_ALIGN <= 64); + (void)(&XXH_writeLE64); + XXH_PREFETCH(customSecret); + { __m256i const seed = _mm256_set_epi64x((xxh_i64)(0U - seed64), (xxh_i64)seed64, (xxh_i64)(0U - seed64), (xxh_i64)seed64); + + const __m256i* const src = (const __m256i*) ((const void*) XXH3_kSecret); + __m256i* dest = ( __m256i*) customSecret; + +# if defined(__GNUC__) || defined(__clang__) + /* + * On GCC & Clang, marking 'dest' as modified will cause the compiler: + * - do not extract the secret from sse registers in the internal loop + * - use less common registers, and avoid pushing these reg into stack + */ + XXH_COMPILER_GUARD(dest); +# endif + XXH_ASSERT(((size_t)src & 31) == 0); /* control alignment */ + XXH_ASSERT(((size_t)dest & 31) == 0); + + /* GCC -O2 need unroll loop manually */ + dest[0] = _mm256_add_epi64(_mm256_stream_load_si256(src+0), seed); + dest[1] = _mm256_add_epi64(_mm256_stream_load_si256(src+1), seed); + dest[2] = _mm256_add_epi64(_mm256_stream_load_si256(src+2), seed); + dest[3] = _mm256_add_epi64(_mm256_stream_load_si256(src+3), seed); + dest[4] = _mm256_add_epi64(_mm256_stream_load_si256(src+4), seed); + dest[5] = _mm256_add_epi64(_mm256_stream_load_si256(src+5), seed); + } +} + +#endif + +/* x86dispatch always generates SSE2 */ +#if (XXH_VECTOR == XXH_SSE2) || defined(XXH_X86DISPATCH) + +#ifndef XXH_TARGET_SSE2 +# define XXH_TARGET_SSE2 /* disable attribute target */ +#endif + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void +XXH3_accumulate_512_sse2( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + /* SSE2 is just a half-scale version of the AVX2 version. */ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { __m128i* const xacc = (__m128i *) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xinput = (const __m128i *) input; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xsecret = (const __m128i *) secret; + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { + /* data_vec = xinput[i]; */ + __m128i const data_vec = _mm_loadu_si128 (xinput+i); + /* key_vec = xsecret[i]; */ + __m128i const key_vec = _mm_loadu_si128 (xsecret+i); + /* data_key = data_vec ^ key_vec; */ + __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); + /* data_key_lo = data_key >> 32; */ + __m128i const data_key_lo = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + /* product = (data_key & 0xffffffff) * (data_key_lo & 0xffffffff); */ + __m128i const product = _mm_mul_epu32 (data_key, data_key_lo); + /* xacc[i] += swap(data_vec); */ + __m128i const data_swap = _mm_shuffle_epi32(data_vec, _MM_SHUFFLE(1,0,3,2)); + __m128i const sum = _mm_add_epi64(xacc[i], data_swap); + /* xacc[i] += product; */ + xacc[i] = _mm_add_epi64(product, sum); + } } +} + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void +XXH3_scrambleAcc_sse2(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + { __m128i* const xacc = (__m128i*) acc; + /* Unaligned. This is mainly for pointer arithmetic, and because + * _mm_loadu_si128 requires a const __m128i * pointer for some reason. */ + const __m128i* const xsecret = (const __m128i *) secret; + const __m128i prime32 = _mm_set1_epi32((int)XXH_PRIME32_1); + + size_t i; + for (i=0; i < XXH_STRIPE_LEN/sizeof(__m128i); i++) { + /* xacc[i] ^= (xacc[i] >> 47) */ + __m128i const acc_vec = xacc[i]; + __m128i const shifted = _mm_srli_epi64 (acc_vec, 47); + __m128i const data_vec = _mm_xor_si128 (acc_vec, shifted); + /* xacc[i] ^= xsecret[i]; */ + __m128i const key_vec = _mm_loadu_si128 (xsecret+i); + __m128i const data_key = _mm_xor_si128 (data_vec, key_vec); + + /* xacc[i] *= XXH_PRIME32_1; */ + __m128i const data_key_hi = _mm_shuffle_epi32 (data_key, _MM_SHUFFLE(0, 3, 0, 1)); + __m128i const prod_lo = _mm_mul_epu32 (data_key, prime32); + __m128i const prod_hi = _mm_mul_epu32 (data_key_hi, prime32); + xacc[i] = _mm_add_epi64(prod_lo, _mm_slli_epi64(prod_hi, 32)); + } + } +} + +XXH_FORCE_INLINE XXH_TARGET_SSE2 void XXH3_initCustomSecret_sse2(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); + (void)(&XXH_writeLE64); + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / sizeof(__m128i); + +# if defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER < 1900 + /* MSVC 32bit mode does not support _mm_set_epi64x before 2015 */ + XXH_ALIGN(16) const xxh_i64 seed64x2[2] = { (xxh_i64)seed64, (xxh_i64)(0U - seed64) }; + __m128i const seed = _mm_load_si128((__m128i const*)seed64x2); +# else + __m128i const seed = _mm_set_epi64x((xxh_i64)(0U - seed64), (xxh_i64)seed64); +# endif + int i; + + const void* const src16 = XXH3_kSecret; + __m128i* dst16 = (__m128i*) customSecret; +# if defined(__GNUC__) || defined(__clang__) + /* + * On GCC & Clang, marking 'dest' as modified will cause the compiler: + * - do not extract the secret from sse registers in the internal loop + * - use less common registers, and avoid pushing these reg into stack + */ + XXH_COMPILER_GUARD(dst16); +# endif + XXH_ASSERT(((size_t)src16 & 15) == 0); /* control alignment */ + XXH_ASSERT(((size_t)dst16 & 15) == 0); + + for (i=0; i < nbRounds; ++i) { + dst16[i] = _mm_add_epi64(_mm_load_si128((const __m128i *)src16+i), seed); + } } +} + +#endif + +#if (XXH_VECTOR == XXH_NEON) + +/* forward declarations for the scalar routines */ +XXH_FORCE_INLINE void +XXH3_scalarRound(void* XXH_RESTRICT acc, void const* XXH_RESTRICT input, + void const* XXH_RESTRICT secret, size_t lane); + +XXH_FORCE_INLINE void +XXH3_scalarScrambleRound(void* XXH_RESTRICT acc, + void const* XXH_RESTRICT secret, size_t lane); + +/*! + * @internal + * @brief The bulk processing loop for NEON. + * + * The NEON code path is actually partially scalar when running on AArch64. This + * is to optimize the pipelining and can have up to 15% speedup depending on the + * CPU, and it also mitigates some GCC codegen issues. + * + * @see XXH3_NEON_LANES for configuring this and details about this optimization. + */ +XXH_FORCE_INLINE void +XXH3_accumulate_512_neon( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + XXH_STATIC_ASSERT(XXH3_NEON_LANES > 0 && XXH3_NEON_LANES <= XXH_ACC_NB && XXH3_NEON_LANES % 2 == 0); + { + uint64x2_t* const xacc = (uint64x2_t *) acc; + /* We don't use a uint32x4_t pointer because it causes bus errors on ARMv7. */ + uint8_t const* const xinput = (const uint8_t *) input; + uint8_t const* const xsecret = (const uint8_t *) secret; + + size_t i; + /* NEON for the first few lanes (these loops are normally interleaved) */ + for (i=0; i < XXH3_NEON_LANES / 2; i++) { + /* data_vec = xinput[i]; */ + uint8x16_t data_vec = vld1q_u8(xinput + (i * 16)); + /* key_vec = xsecret[i]; */ + uint8x16_t key_vec = vld1q_u8(xsecret + (i * 16)); + uint64x2_t data_key; + uint32x2_t data_key_lo, data_key_hi; + /* xacc[i] += swap(data_vec); */ + uint64x2_t const data64 = vreinterpretq_u64_u8(data_vec); + uint64x2_t const swapped = vextq_u64(data64, data64, 1); + xacc[i] = vaddq_u64 (xacc[i], swapped); + /* data_key = data_vec ^ key_vec; */ + data_key = vreinterpretq_u64_u8(veorq_u8(data_vec, key_vec)); + /* data_key_lo = (uint32x2_t) (data_key & 0xFFFFFFFF); + * data_key_hi = (uint32x2_t) (data_key >> 32); + * data_key = UNDEFINED; */ + XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); + /* xacc[i] += (uint64x2_t) data_key_lo * (uint64x2_t) data_key_hi; */ + xacc[i] = vmlal_u32 (xacc[i], data_key_lo, data_key_hi); + + } + /* Scalar for the remainder. This may be a zero iteration loop. */ + for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { + XXH3_scalarRound(acc, input, secret, i); + } + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_neon(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { uint64x2_t* xacc = (uint64x2_t*) acc; + uint8_t const* xsecret = (uint8_t const*) secret; + uint32x2_t prime = vdup_n_u32 (XXH_PRIME32_1); + + size_t i; + /* NEON for the first few lanes (these loops are normally interleaved) */ + for (i=0; i < XXH3_NEON_LANES / 2; i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + uint64x2_t acc_vec = xacc[i]; + uint64x2_t shifted = vshrq_n_u64 (acc_vec, 47); + uint64x2_t data_vec = veorq_u64 (acc_vec, shifted); + + /* xacc[i] ^= xsecret[i]; */ + uint8x16_t key_vec = vld1q_u8 (xsecret + (i * 16)); + uint64x2_t data_key = veorq_u64 (data_vec, vreinterpretq_u64_u8(key_vec)); + + /* xacc[i] *= XXH_PRIME32_1 */ + uint32x2_t data_key_lo, data_key_hi; + /* data_key_lo = (uint32x2_t) (xacc[i] & 0xFFFFFFFF); + * data_key_hi = (uint32x2_t) (xacc[i] >> 32); + * xacc[i] = UNDEFINED; */ + XXH_SPLIT_IN_PLACE(data_key, data_key_lo, data_key_hi); + { /* + * prod_hi = (data_key >> 32) * XXH_PRIME32_1; + * + * Avoid vmul_u32 + vshll_n_u32 since Clang 6 and 7 will + * incorrectly "optimize" this: + * tmp = vmul_u32(vmovn_u64(a), vmovn_u64(b)); + * shifted = vshll_n_u32(tmp, 32); + * to this: + * tmp = "vmulq_u64"(a, b); // no such thing! + * shifted = vshlq_n_u64(tmp, 32); + * + * However, unlike SSE, Clang lacks a 64-bit multiply routine + * for NEON, and it scalarizes two 64-bit multiplies instead. + * + * vmull_u32 has the same timing as vmul_u32, and it avoids + * this bug completely. + * See https://bugs.llvm.org/show_bug.cgi?id=39967 + */ + uint64x2_t prod_hi = vmull_u32 (data_key_hi, prime); + /* xacc[i] = prod_hi << 32; */ + xacc[i] = vshlq_n_u64(prod_hi, 32); + /* xacc[i] += (prod_hi & 0xFFFFFFFF) * XXH_PRIME32_1; */ + xacc[i] = vmlal_u32(xacc[i], data_key_lo, prime); + } + } + /* Scalar for the remainder. This may be a zero iteration loop. */ + for (i = XXH3_NEON_LANES; i < XXH_ACC_NB; i++) { + XXH3_scalarScrambleRound(acc, secret, i); + } + } +} + +#endif + +#if (XXH_VECTOR == XXH_VSX) + +XXH_FORCE_INLINE void +XXH3_accumulate_512_vsx( void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + /* presumed aligned */ + unsigned int* const xacc = (unsigned int*) acc; + xxh_u64x2 const* const xinput = (xxh_u64x2 const*) input; /* no alignment restriction */ + xxh_u64x2 const* const xsecret = (xxh_u64x2 const*) secret; /* no alignment restriction */ + xxh_u64x2 const v32 = { 32, 32 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* data_vec = xinput[i]; */ + xxh_u64x2 const data_vec = XXH_vec_loadu(xinput + i); + /* key_vec = xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + /* shuffled = (data_key << 32) | (data_key >> 32); */ + xxh_u32x4 const shuffled = (xxh_u32x4)vec_rl(data_key, v32); + /* product = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)shuffled & 0xFFFFFFFF); */ + xxh_u64x2 const product = XXH_vec_mulo((xxh_u32x4)data_key, shuffled); + /* acc_vec = xacc[i]; */ + xxh_u64x2 acc_vec = (xxh_u64x2)vec_xl(0, xacc + 4 * i); + acc_vec += product; + + /* swap high and low halves */ +#ifdef __s390x__ + acc_vec += vec_permi(data_vec, data_vec, 2); +#else + acc_vec += vec_xxpermdi(data_vec, data_vec, 2); +#endif + /* xacc[i] = acc_vec; */ + vec_xst((xxh_u32x4)acc_vec, 0, xacc + 4 * i); + } +} + +XXH_FORCE_INLINE void +XXH3_scrambleAcc_vsx(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + XXH_ASSERT((((size_t)acc) & 15) == 0); + + { xxh_u64x2* const xacc = (xxh_u64x2*) acc; + const xxh_u64x2* const xsecret = (const xxh_u64x2*) secret; + /* constants */ + xxh_u64x2 const v32 = { 32, 32 }; + xxh_u64x2 const v47 = { 47, 47 }; + xxh_u32x4 const prime = { XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1, XXH_PRIME32_1 }; + size_t i; + for (i = 0; i < XXH_STRIPE_LEN / sizeof(xxh_u64x2); i++) { + /* xacc[i] ^= (xacc[i] >> 47); */ + xxh_u64x2 const acc_vec = xacc[i]; + xxh_u64x2 const data_vec = acc_vec ^ (acc_vec >> v47); + + /* xacc[i] ^= xsecret[i]; */ + xxh_u64x2 const key_vec = XXH_vec_loadu(xsecret + i); + xxh_u64x2 const data_key = data_vec ^ key_vec; + + /* xacc[i] *= XXH_PRIME32_1 */ + /* prod_lo = ((xxh_u64x2)data_key & 0xFFFFFFFF) * ((xxh_u64x2)prime & 0xFFFFFFFF); */ + xxh_u64x2 const prod_even = XXH_vec_mule((xxh_u32x4)data_key, prime); + /* prod_hi = ((xxh_u64x2)data_key >> 32) * ((xxh_u64x2)prime >> 32); */ + xxh_u64x2 const prod_odd = XXH_vec_mulo((xxh_u32x4)data_key, prime); + xacc[i] = prod_odd + (prod_even << v32); + } } +} + +#endif + +/* scalar variants - universal */ + +/*! + * @internal + * @brief Scalar round for @ref XXH3_accumulate_512_scalar(). + * + * This is extracted to its own function because the NEON path uses a combination + * of NEON and scalar. + */ +XXH_FORCE_INLINE void +XXH3_scalarRound(void* XXH_RESTRICT acc, + void const* XXH_RESTRICT input, + void const* XXH_RESTRICT secret, + size_t lane) +{ + xxh_u64* xacc = (xxh_u64*) acc; + xxh_u8 const* xinput = (xxh_u8 const*) input; + xxh_u8 const* xsecret = (xxh_u8 const*) secret; + XXH_ASSERT(lane < XXH_ACC_NB); + XXH_ASSERT(((size_t)acc & (XXH_ACC_ALIGN-1)) == 0); + { + xxh_u64 const data_val = XXH_readLE64(xinput + lane * 8); + xxh_u64 const data_key = data_val ^ XXH_readLE64(xsecret + lane * 8); + xacc[lane ^ 1] += data_val; /* swap adjacent lanes */ + xacc[lane] += XXH_mult32to64(data_key & 0xFFFFFFFF, data_key >> 32); + } +} + +/*! + * @internal + * @brief Processes a 64 byte block of data using the scalar path. + */ +XXH_FORCE_INLINE void +XXH3_accumulate_512_scalar(void* XXH_RESTRICT acc, + const void* XXH_RESTRICT input, + const void* XXH_RESTRICT secret) +{ + size_t i; + for (i=0; i < XXH_ACC_NB; i++) { + XXH3_scalarRound(acc, input, secret, i); + } +} + +/*! + * @internal + * @brief Scalar scramble step for @ref XXH3_scrambleAcc_scalar(). + * + * This is extracted to its own function because the NEON path uses a combination + * of NEON and scalar. + */ +XXH_FORCE_INLINE void +XXH3_scalarScrambleRound(void* XXH_RESTRICT acc, + void const* XXH_RESTRICT secret, + size_t lane) +{ + xxh_u64* const xacc = (xxh_u64*) acc; /* presumed aligned */ + const xxh_u8* const xsecret = (const xxh_u8*) secret; /* no alignment restriction */ + XXH_ASSERT((((size_t)acc) & (XXH_ACC_ALIGN-1)) == 0); + XXH_ASSERT(lane < XXH_ACC_NB); + { + xxh_u64 const key64 = XXH_readLE64(xsecret + lane * 8); + xxh_u64 acc64 = xacc[lane]; + acc64 = XXH_xorshift64(acc64, 47); + acc64 ^= key64; + acc64 *= XXH_PRIME32_1; + xacc[lane] = acc64; + } +} + +/*! + * @internal + * @brief Scrambles the accumulators after a large chunk has been read + */ +XXH_FORCE_INLINE void +XXH3_scrambleAcc_scalar(void* XXH_RESTRICT acc, const void* XXH_RESTRICT secret) +{ + size_t i; + for (i=0; i < XXH_ACC_NB; i++) { + XXH3_scalarScrambleRound(acc, secret, i); + } +} + +XXH_FORCE_INLINE void +XXH3_initCustomSecret_scalar(void* XXH_RESTRICT customSecret, xxh_u64 seed64) +{ + /* + * We need a separate pointer for the hack below, + * which requires a non-const pointer. + * Any decent compiler will optimize this out otherwise. + */ + const xxh_u8* kSecretPtr = XXH3_kSecret; + XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0); + +#if defined(__clang__) && defined(__aarch64__) + /* + * UGLY HACK: + * Clang generates a bunch of MOV/MOVK pairs for aarch64, and they are + * placed sequentially, in order, at the top of the unrolled loop. + * + * While MOVK is great for generating constants (2 cycles for a 64-bit + * constant compared to 4 cycles for LDR), it fights for bandwidth with + * the arithmetic instructions. + * + * I L S + * MOVK + * MOVK + * MOVK + * MOVK + * ADD + * SUB STR + * STR + * By forcing loads from memory (as the asm line causes Clang to assume + * that XXH3_kSecretPtr has been changed), the pipelines are used more + * efficiently: + * I L S + * LDR + * ADD LDR + * SUB STR + * STR + * + * See XXH3_NEON_LANES for details on the pipsline. + * + * XXH3_64bits_withSeed, len == 256, Snapdragon 835 + * without hack: 2654.4 MB/s + * with hack: 3202.9 MB/s + */ + XXH_COMPILER_GUARD(kSecretPtr); +#endif + /* + * Note: in debug mode, this overrides the asm optimization + * and Clang will emit MOVK chains again. + */ + XXH_ASSERT(kSecretPtr == XXH3_kSecret); + + { int const nbRounds = XXH_SECRET_DEFAULT_SIZE / 16; + int i; + for (i=0; i < nbRounds; i++) { + /* + * The asm hack causes Clang to assume that kSecretPtr aliases with + * customSecret, and on aarch64, this prevented LDP from merging two + * loads together for free. Putting the loads together before the stores + * properly generates LDP. + */ + xxh_u64 lo = XXH_readLE64(kSecretPtr + 16*i) + seed64; + xxh_u64 hi = XXH_readLE64(kSecretPtr + 16*i + 8) - seed64; + XXH_writeLE64((xxh_u8*)customSecret + 16*i, lo); + XXH_writeLE64((xxh_u8*)customSecret + 16*i + 8, hi); + } } +} + + +typedef void (*XXH3_f_accumulate_512)(void* XXH_RESTRICT, const void*, const void*); +typedef void (*XXH3_f_scrambleAcc)(void* XXH_RESTRICT, const void*); +typedef void (*XXH3_f_initCustomSecret)(void* XXH_RESTRICT, xxh_u64); + + +#if (XXH_VECTOR == XXH_AVX512) + +#define XXH3_accumulate_512 XXH3_accumulate_512_avx512 +#define XXH3_scrambleAcc XXH3_scrambleAcc_avx512 +#define XXH3_initCustomSecret XXH3_initCustomSecret_avx512 + +#elif (XXH_VECTOR == XXH_AVX2) + +#define XXH3_accumulate_512 XXH3_accumulate_512_avx2 +#define XXH3_scrambleAcc XXH3_scrambleAcc_avx2 +#define XXH3_initCustomSecret XXH3_initCustomSecret_avx2 + +#elif (XXH_VECTOR == XXH_SSE2) + +#define XXH3_accumulate_512 XXH3_accumulate_512_sse2 +#define XXH3_scrambleAcc XXH3_scrambleAcc_sse2 +#define XXH3_initCustomSecret XXH3_initCustomSecret_sse2 + +#elif (XXH_VECTOR == XXH_NEON) + +#define XXH3_accumulate_512 XXH3_accumulate_512_neon +#define XXH3_scrambleAcc XXH3_scrambleAcc_neon +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#elif (XXH_VECTOR == XXH_VSX) + +#define XXH3_accumulate_512 XXH3_accumulate_512_vsx +#define XXH3_scrambleAcc XXH3_scrambleAcc_vsx +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#else /* scalar */ + +#define XXH3_accumulate_512 XXH3_accumulate_512_scalar +#define XXH3_scrambleAcc XXH3_scrambleAcc_scalar +#define XXH3_initCustomSecret XXH3_initCustomSecret_scalar + +#endif + + + +#ifndef XXH_PREFETCH_DIST +# ifdef __clang__ +# define XXH_PREFETCH_DIST 320 +# else +# if (XXH_VECTOR == XXH_AVX512) +# define XXH_PREFETCH_DIST 512 +# else +# define XXH_PREFETCH_DIST 384 +# endif +# endif /* __clang__ */ +#endif /* XXH_PREFETCH_DIST */ + +/* + * XXH3_accumulate() + * Loops over XXH3_accumulate_512(). + * Assumption: nbStripes will not overflow the secret size + */ +XXH_FORCE_INLINE void +XXH3_accumulate( xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, + const xxh_u8* XXH_RESTRICT secret, + size_t nbStripes, + XXH3_f_accumulate_512 f_acc512) +{ + size_t n; + for (n = 0; n < nbStripes; n++ ) { + const xxh_u8* const in = input + n*XXH_STRIPE_LEN; + XXH_PREFETCH(in + XXH_PREFETCH_DIST); + f_acc512(acc, + in, + secret + n*XXH_SECRET_CONSUME_RATE); + } +} + +XXH_FORCE_INLINE void +XXH3_hashLong_internal_loop(xxh_u64* XXH_RESTRICT acc, + const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + size_t const nbStripesPerBlock = (secretSize - XXH_STRIPE_LEN) / XXH_SECRET_CONSUME_RATE; + size_t const block_len = XXH_STRIPE_LEN * nbStripesPerBlock; + size_t const nb_blocks = (len - 1) / block_len; + + size_t n; + + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); + + for (n = 0; n < nb_blocks; n++) { + XXH3_accumulate(acc, input + n*block_len, secret, nbStripesPerBlock, f_acc512); + f_scramble(acc, secret + secretSize - XXH_STRIPE_LEN); + } + + /* last partial block */ + XXH_ASSERT(len > XXH_STRIPE_LEN); + { size_t const nbStripes = ((len - 1) - (block_len * nb_blocks)) / XXH_STRIPE_LEN; + XXH_ASSERT(nbStripes <= (secretSize / XXH_SECRET_CONSUME_RATE)); + XXH3_accumulate(acc, input + nb_blocks*block_len, secret, nbStripes, f_acc512); + + /* last stripe */ + { const xxh_u8* const p = input + len - XXH_STRIPE_LEN; +#define XXH_SECRET_LASTACC_START 7 /* not aligned on 8, last secret is different from acc & scrambler */ + f_acc512(acc, p, secret + secretSize - XXH_STRIPE_LEN - XXH_SECRET_LASTACC_START); + } } +} + +XXH_FORCE_INLINE xxh_u64 +XXH3_mix2Accs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret) +{ + return XXH3_mul128_fold64( + acc[0] ^ XXH_readLE64(secret), + acc[1] ^ XXH_readLE64(secret+8) ); +} + +static XXH64_hash_t +XXH3_mergeAccs(const xxh_u64* XXH_RESTRICT acc, const xxh_u8* XXH_RESTRICT secret, xxh_u64 start) +{ + xxh_u64 result64 = start; + size_t i = 0; + + for (i = 0; i < 4; i++) { + result64 += XXH3_mix2Accs(acc+2*i, secret + 16*i); +#if defined(__clang__) /* Clang */ \ + && (defined(__arm__) || defined(__thumb__)) /* ARMv7 */ \ + && (defined(__ARM_NEON) || defined(__ARM_NEON__)) /* NEON */ \ + && !defined(XXH_ENABLE_AUTOVECTORIZE) /* Define to disable */ + /* + * UGLY HACK: + * Prevent autovectorization on Clang ARMv7-a. Exact same problem as + * the one in XXH3_len_129to240_64b. Speeds up shorter keys > 240b. + * XXH3_64bits, len == 256, Snapdragon 835: + * without hack: 2063.7 MB/s + * with hack: 2560.7 MB/s + */ + XXH_COMPILER_GUARD(result64); +#endif + } + + return XXH3_avalanche(result64); +} + +#define XXH3_INIT_ACC { XXH_PRIME32_3, XXH_PRIME64_1, XXH_PRIME64_2, XXH_PRIME64_3, \ + XXH_PRIME64_4, XXH_PRIME32_2, XXH_PRIME64_5, XXH_PRIME32_1 } + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_hashLong_64b_internal(const void* XXH_RESTRICT input, size_t len, + const void* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; + + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, (const xxh_u8*)secret, secretSize, f_acc512, f_scramble); + + /* converge into final hash */ + XXH_STATIC_ASSERT(sizeof(acc) == 64); + /* do not align on 8, so that the secret is different from the accumulator */ +#define XXH_SECRET_MERGEACCS_START 11 + XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + return XXH3_mergeAccs(acc, (const xxh_u8*)secret + XXH_SECRET_MERGEACCS_START, (xxh_u64)len * XXH_PRIME64_1); +} + +/* + * It's important for performance to transmit secret's size (when it's static) + * so that the compiler can properly optimize the vectorized loop. + * This makes a big performance difference for "medium" keys (<1 KB) when using AVX instruction set. + */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSecret(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; + return XXH3_hashLong_64b_internal(input, len, secret, secretLen, XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * It's preferable for performance that XXH3_hashLong is not inlined, + * as it results in a smaller function for small data, easier to the instruction cache. + * Note that inside this no_inline function, we do inline the internal loop, + * and provide a statically defined secret size to allow optimization of vector loop. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_default(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const xxh_u8* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; (void)secret; (void)secretLen; + return XXH3_hashLong_64b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * XXH3_hashLong_64b_withSeed(): + * Generate a custom key based on alteration of default XXH3_kSecret with the seed, + * and then use this key for long mode hashing. + * + * This operation is decently fast but nonetheless costs a little bit of time. + * Try to avoid it whenever possible (typically when seed==0). + * + * It's important for performance that XXH3_hashLong is not inlined. Not sure + * why (uop cache maybe?), but the difference is large and easily measurable. + */ +XXH_FORCE_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSeed_internal(const void* input, size_t len, + XXH64_hash_t seed, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble, + XXH3_f_initCustomSecret f_initSec) +{ + if (seed == 0) + return XXH3_hashLong_64b_internal(input, len, + XXH3_kSecret, sizeof(XXH3_kSecret), + f_acc512, f_scramble); + { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; + f_initSec(secret, seed); + return XXH3_hashLong_64b_internal(input, len, secret, sizeof(secret), + f_acc512, f_scramble); + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH64_hash_t +XXH3_hashLong_64b_withSeed(const void* input, size_t len, + XXH64_hash_t seed, const xxh_u8* secret, size_t secretLen) +{ + (void)secret; (void)secretLen; + return XXH3_hashLong_64b_withSeed_internal(input, len, seed, + XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); +} + + +typedef XXH64_hash_t (*XXH3_hashLong64_f)(const void* XXH_RESTRICT, size_t, + XXH64_hash_t, const xxh_u8* XXH_RESTRICT, size_t); + +XXH_FORCE_INLINE XXH64_hash_t +XXH3_64bits_internal(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, + XXH3_hashLong64_f f_hashLong) +{ + XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); + /* + * If an action is to be taken if `secretLen` condition is not respected, + * it should be done here. + * For now, it's a contract pre-condition. + * Adding a check and a branch here would cost performance at every hash. + * Also, note that function signature doesn't offer room to return an error. + */ + if (len <= 16) + return XXH3_len_0to16_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); + if (len <= 128) + return XXH3_len_17to128_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_len_129to240_64b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + return f_hashLong(input, len, seed64, (const xxh_u8*)secret, secretLen); +} + + +/* === Public entry point === */ + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits(const void* input, size_t len) +{ + return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_default); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +{ + return XXH3_64bits_internal(input, len, 0, secret, secretSize, XXH3_hashLong_64b_withSecret); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed); +} + +XXH_PUBLIC_API XXH64_hash_t +XXH3_64bits_withSecretandSeed(const void* input, size_t len, const void* secret, size_t secretSize, XXH64_hash_t seed) +{ + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); + return XXH3_hashLong_64b_withSecret(input, len, seed, (const xxh_u8*)secret, secretSize); +} + + +/* === XXH3 streaming === */ + +/* + * Malloc's a pointer that is always aligned to align. + * + * This must be freed with `XXH_alignedFree()`. + * + * malloc typically guarantees 16 byte alignment on 64-bit systems and 8 byte + * alignment on 32-bit. This isn't enough for the 32 byte aligned loads in AVX2 + * or on 32-bit, the 16 byte aligned loads in SSE2 and NEON. + * + * This underalignment previously caused a rather obvious crash which went + * completely unnoticed due to XXH3_createState() not actually being tested. + * Credit to RedSpah for noticing this bug. + * + * The alignment is done manually: Functions like posix_memalign or _mm_malloc + * are avoided: To maintain portability, we would have to write a fallback + * like this anyways, and besides, testing for the existence of library + * functions without relying on external build tools is impossible. + * + * The method is simple: Overallocate, manually align, and store the offset + * to the original behind the returned pointer. + * + * Align must be a power of 2 and 8 <= align <= 128. + */ +static void* XXH_alignedMalloc(size_t s, size_t align) +{ + XXH_ASSERT(align <= 128 && align >= 8); /* range check */ + XXH_ASSERT((align & (align-1)) == 0); /* power of 2 */ + XXH_ASSERT(s != 0 && s < (s + align)); /* empty/overflow */ + { /* Overallocate to make room for manual realignment and an offset byte */ + xxh_u8* base = (xxh_u8*)XXH_malloc(s + align); + if (base != NULL) { + /* + * Get the offset needed to align this pointer. + * + * Even if the returned pointer is aligned, there will always be + * at least one byte to store the offset to the original pointer. + */ + size_t offset = align - ((size_t)base & (align - 1)); /* base % align */ + /* Add the offset for the now-aligned pointer */ + xxh_u8* ptr = base + offset; + + XXH_ASSERT((size_t)ptr % align == 0); + + /* Store the offset immediately before the returned pointer. */ + ptr[-1] = (xxh_u8)offset; + return ptr; + } + return NULL; + } +} +/* + * Frees an aligned pointer allocated by XXH_alignedMalloc(). Don't pass + * normal malloc'd pointers, XXH_alignedMalloc has a specific data layout. + */ +static void XXH_alignedFree(void* p) +{ + if (p != NULL) { + xxh_u8* ptr = (xxh_u8*)p; + /* Get the offset byte we added in XXH_malloc. */ + xxh_u8 offset = ptr[-1]; + /* Free the original malloc'd pointer */ + xxh_u8* base = ptr - offset; + XXH_free(base); + } +} +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void) +{ + XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64); + if (state==NULL) return NULL; + XXH3_INITSTATE(state); + return state; +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode XXH3_freeState(XXH3_state_t* statePtr) +{ + XXH_alignedFree(statePtr); + return XXH_OK; +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API void +XXH3_copyState(XXH3_state_t* dst_state, const XXH3_state_t* src_state) +{ + XXH_memcpy(dst_state, src_state, sizeof(*dst_state)); +} + +static void +XXH3_reset_internal(XXH3_state_t* statePtr, + XXH64_hash_t seed, + const void* secret, size_t secretSize) +{ + size_t const initStart = offsetof(XXH3_state_t, bufferedSize); + size_t const initLength = offsetof(XXH3_state_t, nbStripesPerBlock) - initStart; + XXH_ASSERT(offsetof(XXH3_state_t, nbStripesPerBlock) > initStart); + XXH_ASSERT(statePtr != NULL); + /* set members from bufferedSize to nbStripesPerBlock (excluded) to 0 */ + memset((char*)statePtr + initStart, 0, initLength); + statePtr->acc[0] = XXH_PRIME32_3; + statePtr->acc[1] = XXH_PRIME64_1; + statePtr->acc[2] = XXH_PRIME64_2; + statePtr->acc[3] = XXH_PRIME64_3; + statePtr->acc[4] = XXH_PRIME64_4; + statePtr->acc[5] = XXH_PRIME32_2; + statePtr->acc[6] = XXH_PRIME64_5; + statePtr->acc[7] = XXH_PRIME32_1; + statePtr->seed = seed; + statePtr->useSeed = (seed != 0); + statePtr->extSecret = (const unsigned char*)secret; + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); + statePtr->secretLimit = secretSize - XXH_STRIPE_LEN; + statePtr->nbStripesPerBlock = statePtr->secretLimit / XXH_SECRET_CONSUME_RATE; +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset(XXH3_state_t* statePtr) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +{ + if (statePtr == NULL) return XXH_ERROR; + XXH3_reset_internal(statePtr, 0, secret, secretSize); + if (secret == NULL) return XXH_ERROR; + if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; + return XXH_OK; +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +{ + if (statePtr == NULL) return XXH_ERROR; + if (seed==0) return XXH3_64bits_reset(statePtr); + if ((seed != statePtr->seed) || (statePtr->extSecret != NULL)) + XXH3_initCustomSecret(statePtr->customSecret, seed); + XXH3_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE); + return XXH_OK; +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, size_t secretSize, XXH64_hash_t seed64) +{ + if (statePtr == NULL) return XXH_ERROR; + if (secret == NULL) return XXH_ERROR; + if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; + XXH3_reset_internal(statePtr, seed64, secret, secretSize); + statePtr->useSeed = 1; /* always, even if seed64==0 */ + return XXH_OK; +} + +/* Note : when XXH3_consumeStripes() is invoked, + * there must be a guarantee that at least one more byte must be consumed from input + * so that the function can blindly consume all stripes using the "normal" secret segment */ +XXH_FORCE_INLINE void +XXH3_consumeStripes(xxh_u64* XXH_RESTRICT acc, + size_t* XXH_RESTRICT nbStripesSoFarPtr, size_t nbStripesPerBlock, + const xxh_u8* XXH_RESTRICT input, size_t nbStripes, + const xxh_u8* XXH_RESTRICT secret, size_t secretLimit, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ASSERT(nbStripes <= nbStripesPerBlock); /* can handle max 1 scramble per invocation */ + XXH_ASSERT(*nbStripesSoFarPtr < nbStripesPerBlock); + if (nbStripesPerBlock - *nbStripesSoFarPtr <= nbStripes) { + /* need a scrambling operation */ + size_t const nbStripesToEndofBlock = nbStripesPerBlock - *nbStripesSoFarPtr; + size_t const nbStripesAfterBlock = nbStripes - nbStripesToEndofBlock; + XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripesToEndofBlock, f_acc512); + f_scramble(acc, secret + secretLimit); + XXH3_accumulate(acc, input + nbStripesToEndofBlock * XXH_STRIPE_LEN, secret, nbStripesAfterBlock, f_acc512); + *nbStripesSoFarPtr = nbStripesAfterBlock; + } else { + XXH3_accumulate(acc, input, secret + nbStripesSoFarPtr[0] * XXH_SECRET_CONSUME_RATE, nbStripes, f_acc512); + *nbStripesSoFarPtr += nbStripes; + } +} + +#ifndef XXH3_STREAM_USE_STACK +# ifndef __clang__ /* clang doesn't need additional stack space */ +# define XXH3_STREAM_USE_STACK 1 +# endif +#endif +/* + * Both XXH3_64bits_update and XXH3_128bits_update use this routine. + */ +XXH_FORCE_INLINE XXH_errorcode +XXH3_update(XXH3_state_t* XXH_RESTRICT const state, + const xxh_u8* XXH_RESTRICT input, size_t len, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + if (input==NULL) { + XXH_ASSERT(len == 0); + return XXH_OK; + } + + XXH_ASSERT(state != NULL); + { const xxh_u8* const bEnd = input + len; + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; +#if defined(XXH3_STREAM_USE_STACK) && XXH3_STREAM_USE_STACK >= 1 + /* For some reason, gcc and MSVC seem to suffer greatly + * when operating accumulators directly into state. + * Operating into stack space seems to enable proper optimization. + * clang, on the other hand, doesn't seem to need this trick */ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[8]; memcpy(acc, state->acc, sizeof(acc)); +#else + xxh_u64* XXH_RESTRICT const acc = state->acc; +#endif + state->totalLen += len; + XXH_ASSERT(state->bufferedSize <= XXH3_INTERNALBUFFER_SIZE); + + /* small input : just fill in tmp buffer */ + if (state->bufferedSize + len <= XXH3_INTERNALBUFFER_SIZE) { + XXH_memcpy(state->buffer + state->bufferedSize, input, len); + state->bufferedSize += (XXH32_hash_t)len; + return XXH_OK; + } + + /* total input is now > XXH3_INTERNALBUFFER_SIZE */ + #define XXH3_INTERNALBUFFER_STRIPES (XXH3_INTERNALBUFFER_SIZE / XXH_STRIPE_LEN) + XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE % XXH_STRIPE_LEN == 0); /* clean multiple */ + + /* + * Internal buffer is partially filled (always, except at beginning) + * Complete it, then consume it. + */ + if (state->bufferedSize) { + size_t const loadSize = XXH3_INTERNALBUFFER_SIZE - state->bufferedSize; + XXH_memcpy(state->buffer + state->bufferedSize, input, loadSize); + input += loadSize; + XXH3_consumeStripes(acc, + &state->nbStripesSoFar, state->nbStripesPerBlock, + state->buffer, XXH3_INTERNALBUFFER_STRIPES, + secret, state->secretLimit, + f_acc512, f_scramble); + state->bufferedSize = 0; + } + XXH_ASSERT(input < bEnd); + + /* large input to consume : ingest per full block */ + if ((size_t)(bEnd - input) > state->nbStripesPerBlock * XXH_STRIPE_LEN) { + size_t nbStripes = (size_t)(bEnd - 1 - input) / XXH_STRIPE_LEN; + XXH_ASSERT(state->nbStripesPerBlock >= state->nbStripesSoFar); + /* join to current block's end */ + { size_t const nbStripesToEnd = state->nbStripesPerBlock - state->nbStripesSoFar; + XXH_ASSERT(nbStripesToEnd <= nbStripes); + XXH3_accumulate(acc, input, secret + state->nbStripesSoFar * XXH_SECRET_CONSUME_RATE, nbStripesToEnd, f_acc512); + f_scramble(acc, secret + state->secretLimit); + state->nbStripesSoFar = 0; + input += nbStripesToEnd * XXH_STRIPE_LEN; + nbStripes -= nbStripesToEnd; + } + /* consume per entire blocks */ + while(nbStripes >= state->nbStripesPerBlock) { + XXH3_accumulate(acc, input, secret, state->nbStripesPerBlock, f_acc512); + f_scramble(acc, secret + state->secretLimit); + input += state->nbStripesPerBlock * XXH_STRIPE_LEN; + nbStripes -= state->nbStripesPerBlock; + } + /* consume last partial block */ + XXH3_accumulate(acc, input, secret, nbStripes, f_acc512); + input += nbStripes * XXH_STRIPE_LEN; + XXH_ASSERT(input < bEnd); /* at least some bytes left */ + state->nbStripesSoFar = nbStripes; + /* buffer predecessor of last partial stripe */ + XXH_memcpy(state->buffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); + XXH_ASSERT(bEnd - input <= XXH_STRIPE_LEN); + } else { + /* content to consume <= block size */ + /* Consume input by a multiple of internal buffer size */ + if (bEnd - input > XXH3_INTERNALBUFFER_SIZE) { + const xxh_u8* const limit = bEnd - XXH3_INTERNALBUFFER_SIZE; + do { + XXH3_consumeStripes(acc, + &state->nbStripesSoFar, state->nbStripesPerBlock, + input, XXH3_INTERNALBUFFER_STRIPES, + secret, state->secretLimit, + f_acc512, f_scramble); + input += XXH3_INTERNALBUFFER_SIZE; + } while (inputbuffer + sizeof(state->buffer) - XXH_STRIPE_LEN, input - XXH_STRIPE_LEN, XXH_STRIPE_LEN); + } + } + + /* Some remaining input (always) : buffer it */ + XXH_ASSERT(input < bEnd); + XXH_ASSERT(bEnd - input <= XXH3_INTERNALBUFFER_SIZE); + XXH_ASSERT(state->bufferedSize == 0); + XXH_memcpy(state->buffer, input, (size_t)(bEnd-input)); + state->bufferedSize = (XXH32_hash_t)(bEnd-input); +#if defined(XXH3_STREAM_USE_STACK) && XXH3_STREAM_USE_STACK >= 1 + /* save stack accumulators into state */ + memcpy(state->acc, acc, sizeof(acc)); +#endif + } + + return XXH_OK; +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_64bits_update(XXH3_state_t* state, const void* input, size_t len) +{ + return XXH3_update(state, (const xxh_u8*)input, len, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + + +XXH_FORCE_INLINE void +XXH3_digest_long (XXH64_hash_t* acc, + const XXH3_state_t* state, + const unsigned char* secret) +{ + /* + * Digest on a local copy. This way, the state remains unaltered, and it can + * continue ingesting more input afterwards. + */ + XXH_memcpy(acc, state->acc, sizeof(state->acc)); + if (state->bufferedSize >= XXH_STRIPE_LEN) { + size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN; + size_t nbStripesSoFar = state->nbStripesSoFar; + XXH3_consumeStripes(acc, + &nbStripesSoFar, state->nbStripesPerBlock, + state->buffer, nbStripes, + secret, state->secretLimit, + XXH3_accumulate_512, XXH3_scrambleAcc); + /* last stripe */ + XXH3_accumulate_512(acc, + state->buffer + state->bufferedSize - XXH_STRIPE_LEN, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); + } else { /* bufferedSize < XXH_STRIPE_LEN */ + xxh_u8 lastStripe[XXH_STRIPE_LEN]; + size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize; + XXH_ASSERT(state->bufferedSize > 0); /* there is always some input buffered */ + XXH_memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize); + XXH_memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize); + XXH3_accumulate_512(acc, + lastStripe, + secret + state->secretLimit - XXH_SECRET_LASTACC_START); + } +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (const XXH3_state_t* state) +{ + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + if (state->totalLen > XXH3_MIDSIZE_MAX) { + XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; + XXH3_digest_long(acc, state, secret); + return XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)state->totalLen * XXH_PRIME64_1); + } + /* totalLen <= XXH3_MIDSIZE_MAX: digesting a short input */ + if (state->useSeed) + return XXH3_64bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); + return XXH3_64bits_withSecret(state->buffer, (size_t)(state->totalLen), + secret, state->secretLimit + XXH_STRIPE_LEN); +} + + + +/* ========================================== + * XXH3 128 bits (a.k.a XXH128) + * ========================================== + * XXH3's 128-bit variant has better mixing and strength than the 64-bit variant, + * even without counting the significantly larger output size. + * + * For example, extra steps are taken to avoid the seed-dependent collisions + * in 17-240 byte inputs (See XXH3_mix16B and XXH128_mix32B). + * + * This strength naturally comes at the cost of some speed, especially on short + * lengths. Note that longer hashes are about as fast as the 64-bit version + * due to it using only a slight modification of the 64-bit loop. + * + * XXH128 is also more oriented towards 64-bit machines. It is still extremely + * fast for a _128-bit_ hash on 32-bit (it usually clears XXH64). + */ + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_1to3_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + /* A doubled version of 1to3_64b with different constants. */ + XXH_ASSERT(input != NULL); + XXH_ASSERT(1 <= len && len <= 3); + XXH_ASSERT(secret != NULL); + /* + * len = 1: combinedl = { input[0], 0x01, input[0], input[0] } + * len = 2: combinedl = { input[1], 0x02, input[0], input[1] } + * len = 3: combinedl = { input[2], 0x03, input[0], input[1] } + */ + { xxh_u8 const c1 = input[0]; + xxh_u8 const c2 = input[len >> 1]; + xxh_u8 const c3 = input[len - 1]; + xxh_u32 const combinedl = ((xxh_u32)c1 <<16) | ((xxh_u32)c2 << 24) + | ((xxh_u32)c3 << 0) | ((xxh_u32)len << 8); + xxh_u32 const combinedh = XXH_rotl32(XXH_swap32(combinedl), 13); + xxh_u64 const bitflipl = (XXH_readLE32(secret) ^ XXH_readLE32(secret+4)) + seed; + xxh_u64 const bitfliph = (XXH_readLE32(secret+8) ^ XXH_readLE32(secret+12)) - seed; + xxh_u64 const keyed_lo = (xxh_u64)combinedl ^ bitflipl; + xxh_u64 const keyed_hi = (xxh_u64)combinedh ^ bitfliph; + XXH128_hash_t h128; + h128.low64 = XXH64_avalanche(keyed_lo); + h128.high64 = XXH64_avalanche(keyed_hi); + return h128; + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_4to8_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(4 <= len && len <= 8); + seed ^= (xxh_u64)XXH_swap32((xxh_u32)seed) << 32; + { xxh_u32 const input_lo = XXH_readLE32(input); + xxh_u32 const input_hi = XXH_readLE32(input + len - 4); + xxh_u64 const input_64 = input_lo + ((xxh_u64)input_hi << 32); + xxh_u64 const bitflip = (XXH_readLE64(secret+16) ^ XXH_readLE64(secret+24)) + seed; + xxh_u64 const keyed = input_64 ^ bitflip; + + /* Shift len to the left to ensure it is even, this avoids even multiplies. */ + XXH128_hash_t m128 = XXH_mult64to128(keyed, XXH_PRIME64_1 + (len << 2)); + + m128.high64 += (m128.low64 << 1); + m128.low64 ^= (m128.high64 >> 3); + + m128.low64 = XXH_xorshift64(m128.low64, 35); + m128.low64 *= 0x9FB21C651E98DF25ULL; + m128.low64 = XXH_xorshift64(m128.low64, 28); + m128.high64 = XXH3_avalanche(m128.high64); + return m128; + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_9to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(input != NULL); + XXH_ASSERT(secret != NULL); + XXH_ASSERT(9 <= len && len <= 16); + { xxh_u64 const bitflipl = (XXH_readLE64(secret+32) ^ XXH_readLE64(secret+40)) - seed; + xxh_u64 const bitfliph = (XXH_readLE64(secret+48) ^ XXH_readLE64(secret+56)) + seed; + xxh_u64 const input_lo = XXH_readLE64(input); + xxh_u64 input_hi = XXH_readLE64(input + len - 8); + XXH128_hash_t m128 = XXH_mult64to128(input_lo ^ input_hi ^ bitflipl, XXH_PRIME64_1); + /* + * Put len in the middle of m128 to ensure that the length gets mixed to + * both the low and high bits in the 128x64 multiply below. + */ + m128.low64 += (xxh_u64)(len - 1) << 54; + input_hi ^= bitfliph; + /* + * Add the high 32 bits of input_hi to the high 32 bits of m128, then + * add the long product of the low 32 bits of input_hi and XXH_PRIME32_2 to + * the high 64 bits of m128. + * + * The best approach to this operation is different on 32-bit and 64-bit. + */ + if (sizeof(void *) < sizeof(xxh_u64)) { /* 32-bit */ + /* + * 32-bit optimized version, which is more readable. + * + * On 32-bit, it removes an ADC and delays a dependency between the two + * halves of m128.high64, but it generates an extra mask on 64-bit. + */ + m128.high64 += (input_hi & 0xFFFFFFFF00000000ULL) + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2); + } else { + /* + * 64-bit optimized (albeit more confusing) version. + * + * Uses some properties of addition and multiplication to remove the mask: + * + * Let: + * a = input_hi.lo = (input_hi & 0x00000000FFFFFFFF) + * b = input_hi.hi = (input_hi & 0xFFFFFFFF00000000) + * c = XXH_PRIME32_2 + * + * a + (b * c) + * Inverse Property: x + y - x == y + * a + (b * (1 + c - 1)) + * Distributive Property: x * (y + z) == (x * y) + (x * z) + * a + (b * 1) + (b * (c - 1)) + * Identity Property: x * 1 == x + * a + b + (b * (c - 1)) + * + * Substitute a, b, and c: + * input_hi.hi + input_hi.lo + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) + * + * Since input_hi.hi + input_hi.lo == input_hi, we get this: + * input_hi + ((xxh_u64)input_hi.lo * (XXH_PRIME32_2 - 1)) + */ + m128.high64 += input_hi + XXH_mult32to64((xxh_u32)input_hi, XXH_PRIME32_2 - 1); + } + /* m128 ^= XXH_swap64(m128 >> 64); */ + m128.low64 ^= XXH_swap64(m128.high64); + + { /* 128x64 multiply: h128 = m128 * XXH_PRIME64_2; */ + XXH128_hash_t h128 = XXH_mult64to128(m128.low64, XXH_PRIME64_2); + h128.high64 += m128.high64 * XXH_PRIME64_2; + + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = XXH3_avalanche(h128.high64); + return h128; + } } +} + +/* + * Assumption: `secret` size is >= XXH3_SECRET_SIZE_MIN + */ +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_0to16_128b(const xxh_u8* input, size_t len, const xxh_u8* secret, XXH64_hash_t seed) +{ + XXH_ASSERT(len <= 16); + { if (len > 8) return XXH3_len_9to16_128b(input, len, secret, seed); + if (len >= 4) return XXH3_len_4to8_128b(input, len, secret, seed); + if (len) return XXH3_len_1to3_128b(input, len, secret, seed); + { XXH128_hash_t h128; + xxh_u64 const bitflipl = XXH_readLE64(secret+64) ^ XXH_readLE64(secret+72); + xxh_u64 const bitfliph = XXH_readLE64(secret+80) ^ XXH_readLE64(secret+88); + h128.low64 = XXH64_avalanche(seed ^ bitflipl); + h128.high64 = XXH64_avalanche( seed ^ bitfliph); + return h128; + } } +} + +/* + * A bit slower than XXH3_mix16B, but handles multiply by zero better. + */ +XXH_FORCE_INLINE XXH128_hash_t +XXH128_mix32B(XXH128_hash_t acc, const xxh_u8* input_1, const xxh_u8* input_2, + const xxh_u8* secret, XXH64_hash_t seed) +{ + acc.low64 += XXH3_mix16B (input_1, secret+0, seed); + acc.low64 ^= XXH_readLE64(input_2) + XXH_readLE64(input_2 + 8); + acc.high64 += XXH3_mix16B (input_2, secret+16, seed); + acc.high64 ^= XXH_readLE64(input_1) + XXH_readLE64(input_1 + 8); + return acc; +} + + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_len_17to128_128b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(16 < len && len <= 128); + + { XXH128_hash_t acc; + acc.low64 = len * XXH_PRIME64_1; + acc.high64 = 0; + if (len > 32) { + if (len > 64) { + if (len > 96) { + acc = XXH128_mix32B(acc, input+48, input+len-64, secret+96, seed); + } + acc = XXH128_mix32B(acc, input+32, input+len-48, secret+64, seed); + } + acc = XXH128_mix32B(acc, input+16, input+len-32, secret+32, seed); + } + acc = XXH128_mix32B(acc, input, input+len-16, secret, seed); + { XXH128_hash_t h128; + h128.low64 = acc.low64 + acc.high64; + h128.high64 = (acc.low64 * XXH_PRIME64_1) + + (acc.high64 * XXH_PRIME64_4) + + ((len - seed) * XXH_PRIME64_2); + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); + return h128; + } + } +} + +XXH_NO_INLINE XXH128_hash_t +XXH3_len_129to240_128b(const xxh_u8* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH64_hash_t seed) +{ + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); (void)secretSize; + XXH_ASSERT(128 < len && len <= XXH3_MIDSIZE_MAX); + + { XXH128_hash_t acc; + int const nbRounds = (int)len / 32; + int i; + acc.low64 = len * XXH_PRIME64_1; + acc.high64 = 0; + for (i=0; i<4; i++) { + acc = XXH128_mix32B(acc, + input + (32 * i), + input + (32 * i) + 16, + secret + (32 * i), + seed); + } + acc.low64 = XXH3_avalanche(acc.low64); + acc.high64 = XXH3_avalanche(acc.high64); + XXH_ASSERT(nbRounds >= 4); + for (i=4 ; i < nbRounds; i++) { + acc = XXH128_mix32B(acc, + input + (32 * i), + input + (32 * i) + 16, + secret + XXH3_MIDSIZE_STARTOFFSET + (32 * (i - 4)), + seed); + } + /* last bytes */ + acc = XXH128_mix32B(acc, + input + len - 16, + input + len - 32, + secret + XXH3_SECRET_SIZE_MIN - XXH3_MIDSIZE_LASTOFFSET - 16, + 0ULL - seed); + + { XXH128_hash_t h128; + h128.low64 = acc.low64 + acc.high64; + h128.high64 = (acc.low64 * XXH_PRIME64_1) + + (acc.high64 * XXH_PRIME64_4) + + ((len - seed) * XXH_PRIME64_2); + h128.low64 = XXH3_avalanche(h128.low64); + h128.high64 = (XXH64_hash_t)0 - XXH3_avalanche(h128.high64); + return h128; + } + } +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_hashLong_128b_internal(const void* XXH_RESTRICT input, size_t len, + const xxh_u8* XXH_RESTRICT secret, size_t secretSize, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble) +{ + XXH_ALIGN(XXH_ACC_ALIGN) xxh_u64 acc[XXH_ACC_NB] = XXH3_INIT_ACC; + + XXH3_hashLong_internal_loop(acc, (const xxh_u8*)input, len, secret, secretSize, f_acc512, f_scramble); + + /* converge into final hash */ + XXH_STATIC_ASSERT(sizeof(acc) == 64); + XXH_ASSERT(secretSize >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + { XXH128_hash_t h128; + h128.low64 = XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)len * XXH_PRIME64_1); + h128.high64 = XXH3_mergeAccs(acc, + secret + secretSize + - sizeof(acc) - XXH_SECRET_MERGEACCS_START, + ~((xxh_u64)len * XXH_PRIME64_2)); + return h128; + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_default(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; (void)secret; (void)secretLen; + return XXH3_hashLong_128b_internal(input, len, XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/* + * It's important for performance to pass @secretLen (when it's static) + * to the compiler, so that it can properly optimize the vectorized loop. + */ +XXH_FORCE_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSecret(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)seed64; + return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, secretLen, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSeed_internal(const void* XXH_RESTRICT input, size_t len, + XXH64_hash_t seed64, + XXH3_f_accumulate_512 f_acc512, + XXH3_f_scrambleAcc f_scramble, + XXH3_f_initCustomSecret f_initSec) +{ + if (seed64 == 0) + return XXH3_hashLong_128b_internal(input, len, + XXH3_kSecret, sizeof(XXH3_kSecret), + f_acc512, f_scramble); + { XXH_ALIGN(XXH_SEC_ALIGN) xxh_u8 secret[XXH_SECRET_DEFAULT_SIZE]; + f_initSec(secret, seed64); + return XXH3_hashLong_128b_internal(input, len, (const xxh_u8*)secret, sizeof(secret), + f_acc512, f_scramble); + } +} + +/* + * It's important for performance that XXH3_hashLong is not inlined. + */ +XXH_NO_INLINE XXH128_hash_t +XXH3_hashLong_128b_withSeed(const void* input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen) +{ + (void)secret; (void)secretLen; + return XXH3_hashLong_128b_withSeed_internal(input, len, seed64, + XXH3_accumulate_512, XXH3_scrambleAcc, XXH3_initCustomSecret); +} + +typedef XXH128_hash_t (*XXH3_hashLong128_f)(const void* XXH_RESTRICT, size_t, + XXH64_hash_t, const void* XXH_RESTRICT, size_t); + +XXH_FORCE_INLINE XXH128_hash_t +XXH3_128bits_internal(const void* input, size_t len, + XXH64_hash_t seed64, const void* XXH_RESTRICT secret, size_t secretLen, + XXH3_hashLong128_f f_hl128) +{ + XXH_ASSERT(secretLen >= XXH3_SECRET_SIZE_MIN); + /* + * If an action is to be taken if `secret` conditions are not respected, + * it should be done here. + * For now, it's a contract pre-condition. + * Adding a check and a branch here would cost performance at every hash. + */ + if (len <= 16) + return XXH3_len_0to16_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, seed64); + if (len <= 128) + return XXH3_len_17to128_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_len_129to240_128b((const xxh_u8*)input, len, (const xxh_u8*)secret, secretLen, seed64); + return f_hl128(input, len, seed64, secret, secretLen); +} + + +/* === Public XXH128 API === */ + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits(const void* input, size_t len) +{ + return XXH3_128bits_internal(input, len, 0, + XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_hashLong_128b_default); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSecret(const void* input, size_t len, const void* secret, size_t secretSize) +{ + return XXH3_128bits_internal(input, len, 0, + (const xxh_u8*)secret, secretSize, + XXH3_hashLong_128b_withSecret); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSeed(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_128bits_internal(input, len, seed, + XXH3_kSecret, sizeof(XXH3_kSecret), + XXH3_hashLong_128b_withSeed); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH128_hash_t +XXH3_128bits_withSecretandSeed(const void* input, size_t len, const void* secret, size_t secretSize, XXH64_hash_t seed) +{ + if (len <= XXH3_MIDSIZE_MAX) + return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL); + return XXH3_hashLong_128b_withSecret(input, len, seed, secret, secretSize); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH128_hash_t +XXH128(const void* input, size_t len, XXH64_hash_t seed) +{ + return XXH3_128bits_withSeed(input, len, seed); +} + + +/* === XXH3 128-bit streaming === */ + +/* + * All initialization and update functions are identical to 64-bit streaming variant. + * The only difference is the finalization routine. + */ + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset(XXH3_state_t* statePtr) +{ + return XXH3_64bits_reset(statePtr); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSecret(XXH3_state_t* statePtr, const void* secret, size_t secretSize) +{ + return XXH3_64bits_reset_withSecret(statePtr, secret, secretSize); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSeed(XXH3_state_t* statePtr, XXH64_hash_t seed) +{ + return XXH3_64bits_reset_withSeed(statePtr, seed); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, const void* secret, size_t secretSize, XXH64_hash_t seed) +{ + return XXH3_64bits_reset_withSecretandSeed(statePtr, secret, secretSize, seed); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_128bits_update(XXH3_state_t* state, const void* input, size_t len) +{ + return XXH3_update(state, (const xxh_u8*)input, len, + XXH3_accumulate_512, XXH3_scrambleAcc); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (const XXH3_state_t* state) +{ + const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret; + if (state->totalLen > XXH3_MIDSIZE_MAX) { + XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB]; + XXH3_digest_long(acc, state, secret); + XXH_ASSERT(state->secretLimit + XXH_STRIPE_LEN >= sizeof(acc) + XXH_SECRET_MERGEACCS_START); + { XXH128_hash_t h128; + h128.low64 = XXH3_mergeAccs(acc, + secret + XXH_SECRET_MERGEACCS_START, + (xxh_u64)state->totalLen * XXH_PRIME64_1); + h128.high64 = XXH3_mergeAccs(acc, + secret + state->secretLimit + XXH_STRIPE_LEN + - sizeof(acc) - XXH_SECRET_MERGEACCS_START, + ~((xxh_u64)state->totalLen * XXH_PRIME64_2)); + return h128; + } + } + /* len <= XXH3_MIDSIZE_MAX : short code */ + if (state->seed) + return XXH3_128bits_withSeed(state->buffer, (size_t)state->totalLen, state->seed); + return XXH3_128bits_withSecret(state->buffer, (size_t)(state->totalLen), + secret, state->secretLimit + XXH_STRIPE_LEN); +} + +/* 128-bit utility functions */ + +#include /* memcmp, memcpy */ + +/* return : 1 is equal, 0 if different */ +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API int XXH128_isEqual(XXH128_hash_t h1, XXH128_hash_t h2) +{ + /* note : XXH128_hash_t is compact, it has no padding byte */ + return !(memcmp(&h1, &h2, sizeof(h1))); +} + +/* This prototype is compatible with stdlib's qsort(). + * return : >0 if *h128_1 > *h128_2 + * <0 if *h128_1 < *h128_2 + * =0 if *h128_1 == *h128_2 */ +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API int XXH128_cmp(const void* h128_1, const void* h128_2) +{ + XXH128_hash_t const h1 = *(const XXH128_hash_t*)h128_1; + XXH128_hash_t const h2 = *(const XXH128_hash_t*)h128_2; + int const hcmp = (h1.high64 > h2.high64) - (h2.high64 > h1.high64); + /* note : bets that, in most cases, hash values are different */ + if (hcmp) return hcmp; + return (h1.low64 > h2.low64) - (h2.low64 > h1.low64); +} + + +/*====== Canonical representation ======*/ +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API void +XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_hash_t hash) +{ + XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) == sizeof(XXH128_hash_t)); + if (XXH_CPU_LITTLE_ENDIAN) { + hash.high64 = XXH_swap64(hash.high64); + hash.low64 = XXH_swap64(hash.low64); + } + XXH_memcpy(dst, &hash.high64, sizeof(hash.high64)); + XXH_memcpy((char*)dst + sizeof(hash.high64), &hash.low64, sizeof(hash.low64)); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH128_hash_t +XXH128_hashFromCanonical(const XXH128_canonical_t* src) +{ + XXH128_hash_t h; + h.high64 = XXH_readBE64(src); + h.low64 = XXH_readBE64(src->digest + 8); + return h; +} + + + +/* ========================================== + * Secret generators + * ========================================== + */ +#define XXH_MIN(x, y) (((x) > (y)) ? (y) : (x)) + +XXH_FORCE_INLINE void XXH3_combine16(void* dst, XXH128_hash_t h128) +{ + XXH_writeLE64( dst, XXH_readLE64(dst) ^ h128.low64 ); + XXH_writeLE64( (char*)dst+8, XXH_readLE64((char*)dst+8) ^ h128.high64 ); +} + +/*! @ingroup xxh3_family */ +XXH_PUBLIC_API XXH_errorcode +XXH3_generateSecret(void* secretBuffer, size_t secretSize, const void* customSeed, size_t customSeedSize) +{ +#if (XXH_DEBUGLEVEL >= 1) + XXH_ASSERT(secretBuffer != NULL); + XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN); +#else + /* production mode, assert() are disabled */ + if (secretBuffer == NULL) return XXH_ERROR; + if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR; +#endif + + if (customSeedSize == 0) { + customSeed = XXH3_kSecret; + customSeedSize = XXH_SECRET_DEFAULT_SIZE; + } +#if (XXH_DEBUGLEVEL >= 1) + XXH_ASSERT(customSeed != NULL); +#else + if (customSeed == NULL) return XXH_ERROR; +#endif + + /* Fill secretBuffer with a copy of customSeed - repeat as needed */ + { size_t pos = 0; + while (pos < secretSize) { + size_t const toCopy = XXH_MIN((secretSize - pos), customSeedSize); + memcpy((char*)secretBuffer + pos, customSeed, toCopy); + pos += toCopy; + } } + + { size_t const nbSeg16 = secretSize / 16; + size_t n; + XXH128_canonical_t scrambler; + XXH128_canonicalFromHash(&scrambler, XXH128(customSeed, customSeedSize, 0)); + for (n=0; n -#endif #include "compiler.h" +#include "cpu.h" #include "mem.h" #include "debug.h" /* assert, DEBUGLOG, RAWLOG, g_debuglevel */ #include "error_private.h" @@ -30,7 +28,6 @@ #include "../zstd.h" #define FSE_STATIC_LINKING_ONLY #include "fse.h" -#define HUF_STATIC_LINKING_ONLY #include "huf.h" #ifndef XXH_STATIC_LINKING_ONLY # define XXH_STATIC_LINKING_ONLY /* XXH64_state_t */ @@ -60,81 +57,7 @@ extern "C" { #undef MAX #define MIN(a,b) ((a)<(b) ? (a) : (b)) #define MAX(a,b) ((a)>(b) ? (a) : (b)) - -/** - * Ignore: this is an internal helper. - * - * This is a helper function to help force C99-correctness during compilation. - * Under strict compilation modes, variadic macro arguments can't be empty. - * However, variadic function arguments can be. Using a function therefore lets - * us statically check that at least one (string) argument was passed, - * independent of the compilation flags. - */ -static INLINE_KEYWORD UNUSED_ATTR -void _force_has_format_string(const char *format, ...) { - (void)format; -} - -/** - * Ignore: this is an internal helper. - * - * We want to force this function invocation to be syntactically correct, but - * we don't want to force runtime evaluation of its arguments. - */ -#define _FORCE_HAS_FORMAT_STRING(...) \ - if (0) { \ - _force_has_format_string(__VA_ARGS__); \ - } - -/** - * Return the specified error if the condition evaluates to true. - * - * In debug modes, prints additional information. - * In order to do that (particularly, printing the conditional that failed), - * this can't just wrap RETURN_ERROR(). - */ -#define RETURN_ERROR_IF(cond, err, ...) \ - if (cond) { \ - RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \ - __FILE__, __LINE__, ZSTD_QUOTE(cond), ZSTD_QUOTE(ERROR(err))); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } - -/** - * Unconditionally return the specified error. - * - * In debug modes, prints additional information. - */ -#define RETURN_ERROR(err, ...) \ - do { \ - RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \ - __FILE__, __LINE__, ZSTD_QUOTE(ERROR(err))); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } while(0); - -/** - * If the provided expression evaluates to an error code, returns that error code. - * - * In debug modes, prints additional information. - */ -#define FORWARD_IF_ERROR(err, ...) \ - do { \ - size_t const err_code = (err); \ - if (ERR_isError(err_code)) { \ - RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \ - __FILE__, __LINE__, ZSTD_QUOTE(err), ERR_getErrorName(err_code)); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return err_code; \ - } \ - } while(0); +#define BOUNDED(min,val,max) (MAX(min,MIN(val,max))) /*-************************************* @@ -143,7 +66,6 @@ void _force_has_format_string(const char *format, ...) { #define ZSTD_OPT_NUM (1<<12) #define ZSTD_REP_NUM 3 /* number of repcodes */ -#define ZSTD_REP_MOVE (ZSTD_REP_NUM-1) static UNUSED_ATTR const U32 repStartValue[ZSTD_REP_NUM] = { 1, 4, 8 }; #define KB *(1 <<10) @@ -170,9 +92,9 @@ typedef enum { bt_raw, bt_rle, bt_compressed, bt_reserved } blockType_e; #define ZSTD_FRAMECHECKSUMSIZE 4 #define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */ -#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */) /* for a non-null block */ +#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */) /* for a non-null block */ +#define MIN_LITERALS_FOR_4_STREAMS 6 -#define HufLog 12 typedef enum { set_basic, set_rle, set_compressed, set_repeat } symbolEncodingType_e; #define LONGNBSEQ 0x7F00 @@ -180,6 +102,7 @@ typedef enum { set_basic, set_rle, set_compressed, set_repeat } symbolEncodingTy #define MINMATCH 3 #define Litbits 8 +#define LitHufLog 11 #define MaxLit ((1<= 8 || (ovtype == ZSTD_no_overlap && diff <= -WILDCOPY_VECLEN)); - if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) { /* Handle short offset copies. */ do { @@ -303,12 +237,6 @@ void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e * one COPY16() in the first call. Then, do two calls per loop since * at that point it is more likely to have a high trip count. */ -#ifdef __aarch64__ - do { - COPY16(op, ip); - } - while (op < oend); -#else ZSTD_copy16(op, ip); if (16 >= length) return; op += 16; @@ -318,7 +246,6 @@ void ZSTD_wildcopy(void* dst, const void* src, ptrdiff_t length, ZSTD_overlap_e COPY16(op, ip); } while (op < oend); -#endif } } @@ -352,9 +279,9 @@ typedef enum { * Private declarations *********************************************/ typedef struct seqDef_s { - U32 offset; /* offset == rawOffset + ZSTD_REP_NUM, or equivalently, offCode + 1 */ + U32 offBase; /* offBase == Offset + ZSTD_REP_NUM, or repcode 1,2,3 */ U16 litLength; - U16 matchLength; + U16 mlBase; /* mlBase == matchLength - MINMATCH */ } seqDef; /* Controls whether seqStore has a single "long" litLength or matchLength. See seqStore_t. */ @@ -367,11 +294,11 @@ typedef enum { typedef struct { seqDef* sequencesStart; seqDef* sequences; /* ptr to end of sequences */ - BYTE* litStart; - BYTE* lit; /* ptr to end of literals */ - BYTE* llCode; - BYTE* mlCode; - BYTE* ofCode; + BYTE* litStart; + BYTE* lit; /* ptr to end of literals */ + BYTE* llCode; + BYTE* mlCode; + BYTE* ofCode; size_t maxNbSeq; size_t maxNbLit; @@ -379,8 +306,8 @@ typedef struct { * in the seqStore that has a value larger than U16 (if it exists). To do so, we increment * the existing value of the litLength or matchLength by 0x10000. */ - ZSTD_longLengthType_e longLengthType; - U32 longLengthPos; /* Index of the sequence to apply long length modification to */ + ZSTD_longLengthType_e longLengthType; + U32 longLengthPos; /* Index of the sequence to apply long length modification to */ } seqStore_t; typedef struct { @@ -396,13 +323,13 @@ MEM_STATIC ZSTD_sequenceLength ZSTD_getSequenceLength(seqStore_t const* seqStore { ZSTD_sequenceLength seqLen; seqLen.litLength = seq->litLength; - seqLen.matchLength = seq->matchLength + MINMATCH; + seqLen.matchLength = seq->mlBase + MINMATCH; if (seqStore->longLengthPos == (U32)(seq - seqStore->sequencesStart)) { if (seqStore->longLengthType == ZSTD_llt_literalLength) { - seqLen.litLength += 0xFFFF; + seqLen.litLength += 0x10000; } if (seqStore->longLengthType == ZSTD_llt_matchLength) { - seqLen.matchLength += 0xFFFF; + seqLen.matchLength += 0x10000; } } return seqLen; @@ -415,12 +342,13 @@ MEM_STATIC ZSTD_sequenceLength ZSTD_getSequenceLength(seqStore_t const* seqStore * `decompressedBound != ZSTD_CONTENTSIZE_ERROR` */ typedef struct { + size_t nbBlocks; size_t compressedSize; unsigned long long decompressedBound; } ZSTD_frameSizeInfo; /* decompress & legacy */ const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */ -void ZSTD_seqToCodes(const seqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */ +int ZSTD_seqToCodes(const seqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */ /* custom memory allocation functions */ void* ZSTD_customMalloc(size_t size, ZSTD_customMem customMem); @@ -428,35 +356,6 @@ void* ZSTD_customCalloc(size_t size, ZSTD_customMem customMem); void ZSTD_customFree(void* ptr, ZSTD_customMem customMem); -MEM_STATIC U32 ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus */ -{ - assert(val != 0); - { -# if defined(_MSC_VER) /* Visual */ -# if STATIC_BMI2 == 1 - return _lzcnt_u32(val)^31; -# else - unsigned long r=0; - return _BitScanReverse(&r, val) ? (unsigned)r : 0; -# endif -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* GCC Intrinsic */ - return __builtin_clz (val) ^ 31; -# elif defined(__ICCARM__) /* IAR Intrinsic */ - return 31 - __CLZ(val); -# else /* Software version */ - static const U32 DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; - U32 v = val; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - return DeBruijnClz[(v * 0x07C4ACDDU) >> 27]; -# endif - } -} - - /* ZSTD_invalidateRepCodes() : * ensures next compression will not use repcodes from previous block. * Note : only works with regular variant; @@ -482,6 +381,14 @@ size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, const void* src, size_t srcSize); +/** + * @returns true iff the CPU supports dynamic BMI2 dispatch. + */ +MEM_STATIC int ZSTD_cpuSupportsBmi2(void) +{ + ZSTD_cpuid_t cpuid = ZSTD_cpuid(); + return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid); +} #if defined (__cplusplus) } diff --git a/src/dependencies/zstd-1.5.0/lib/common/zstd_trace.h b/src/dependencies/zstd-1.5.4/lib/common/zstd_trace.h similarity index 88% rename from src/dependencies/zstd-1.5.0/lib/common/zstd_trace.h rename to src/dependencies/zstd-1.5.4/lib/common/zstd_trace.h index 2da5640..da20534 100644 --- a/src/dependencies/zstd-1.5.0/lib/common/zstd_trace.h +++ b/src/dependencies/zstd-1.5.4/lib/common/zstd_trace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -17,10 +17,19 @@ extern "C" { #include -/* weak symbol support */ -#if !defined(ZSTD_HAVE_WEAK_SYMBOLS) && defined(__GNUC__) && \ +/* weak symbol support + * For now, enable conservatively: + * - Only GNUC + * - Only ELF + * - Only x86-64, i386 and aarch64 + * Also, explicitly disable on platforms known not to work so they aren't + * forgotten in the future. + */ +#if !defined(ZSTD_HAVE_WEAK_SYMBOLS) && \ + defined(__GNUC__) && defined(__ELF__) && \ + (defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86) || defined(__aarch64__)) && \ !defined(__APPLE__) && !defined(_WIN32) && !defined(__MINGW32__) && \ - !defined(__CYGWIN__) + !defined(__CYGWIN__) && !defined(_AIX) # define ZSTD_HAVE_WEAK_SYMBOLS 1 #else # define ZSTD_HAVE_WEAK_SYMBOLS 0 diff --git a/src/dependencies/zstd-1.5.4/lib/compress/clevels.h b/src/dependencies/zstd-1.5.4/lib/compress/clevels.h new file mode 100644 index 0000000..c18da46 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/compress/clevels.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_CLEVELS_H +#define ZSTD_CLEVELS_H + +#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */ +#include "../zstd.h" + +/*-===== Pre-defined compression levels =====-*/ + +#define ZSTD_MAX_CLEVEL 22 + +#ifdef __GNUC__ +__attribute__((__unused__)) +#endif + +static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = { +{ /* "default" - for any srcSize > 256 KB */ + /* W, C, H, S, L, TL, strat */ + { 19, 12, 13, 1, 6, 1, ZSTD_fast }, /* base for negative levels */ + { 19, 13, 14, 1, 7, 0, ZSTD_fast }, /* level 1 */ + { 20, 15, 16, 1, 6, 0, ZSTD_fast }, /* level 2 */ + { 21, 16, 17, 1, 5, 0, ZSTD_dfast }, /* level 3 */ + { 21, 18, 18, 1, 5, 0, ZSTD_dfast }, /* level 4 */ + { 21, 18, 19, 3, 5, 2, ZSTD_greedy }, /* level 5 */ + { 21, 18, 19, 3, 5, 4, ZSTD_lazy }, /* level 6 */ + { 21, 19, 20, 4, 5, 8, ZSTD_lazy }, /* level 7 */ + { 21, 19, 20, 4, 5, 16, ZSTD_lazy2 }, /* level 8 */ + { 22, 20, 21, 4, 5, 16, ZSTD_lazy2 }, /* level 9 */ + { 22, 21, 22, 5, 5, 16, ZSTD_lazy2 }, /* level 10 */ + { 22, 21, 22, 6, 5, 16, ZSTD_lazy2 }, /* level 11 */ + { 22, 22, 23, 6, 5, 32, ZSTD_lazy2 }, /* level 12 */ + { 22, 22, 22, 4, 5, 32, ZSTD_btlazy2 }, /* level 13 */ + { 22, 22, 23, 5, 5, 32, ZSTD_btlazy2 }, /* level 14 */ + { 22, 23, 23, 6, 5, 32, ZSTD_btlazy2 }, /* level 15 */ + { 22, 22, 22, 5, 5, 48, ZSTD_btopt }, /* level 16 */ + { 23, 23, 22, 5, 4, 64, ZSTD_btopt }, /* level 17 */ + { 23, 23, 22, 6, 3, 64, ZSTD_btultra }, /* level 18 */ + { 23, 24, 22, 7, 3,256, ZSTD_btultra2}, /* level 19 */ + { 25, 25, 23, 7, 3,256, ZSTD_btultra2}, /* level 20 */ + { 26, 26, 24, 7, 3,512, ZSTD_btultra2}, /* level 21 */ + { 27, 27, 25, 9, 3,999, ZSTD_btultra2}, /* level 22 */ +}, +{ /* for srcSize <= 256 KB */ + /* W, C, H, S, L, T, strat */ + { 18, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ + { 18, 13, 14, 1, 6, 0, ZSTD_fast }, /* level 1 */ + { 18, 14, 14, 1, 5, 0, ZSTD_dfast }, /* level 2 */ + { 18, 16, 16, 1, 4, 0, ZSTD_dfast }, /* level 3 */ + { 18, 16, 17, 3, 5, 2, ZSTD_greedy }, /* level 4.*/ + { 18, 17, 18, 5, 5, 2, ZSTD_greedy }, /* level 5.*/ + { 18, 18, 19, 3, 5, 4, ZSTD_lazy }, /* level 6.*/ + { 18, 18, 19, 4, 4, 4, ZSTD_lazy }, /* level 7 */ + { 18, 18, 19, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ + { 18, 18, 19, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ + { 18, 18, 19, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ + { 18, 18, 19, 5, 4, 12, ZSTD_btlazy2 }, /* level 11.*/ + { 18, 19, 19, 7, 4, 12, ZSTD_btlazy2 }, /* level 12.*/ + { 18, 18, 19, 4, 4, 16, ZSTD_btopt }, /* level 13 */ + { 18, 18, 19, 4, 3, 32, ZSTD_btopt }, /* level 14.*/ + { 18, 18, 19, 6, 3,128, ZSTD_btopt }, /* level 15.*/ + { 18, 19, 19, 6, 3,128, ZSTD_btultra }, /* level 16.*/ + { 18, 19, 19, 8, 3,256, ZSTD_btultra }, /* level 17.*/ + { 18, 19, 19, 6, 3,128, ZSTD_btultra2}, /* level 18.*/ + { 18, 19, 19, 8, 3,256, ZSTD_btultra2}, /* level 19.*/ + { 18, 19, 19, 10, 3,512, ZSTD_btultra2}, /* level 20.*/ + { 18, 19, 19, 12, 3,512, ZSTD_btultra2}, /* level 21.*/ + { 18, 19, 19, 13, 3,999, ZSTD_btultra2}, /* level 22.*/ +}, +{ /* for srcSize <= 128 KB */ + /* W, C, H, S, L, T, strat */ + { 17, 12, 12, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ + { 17, 12, 13, 1, 6, 0, ZSTD_fast }, /* level 1 */ + { 17, 13, 15, 1, 5, 0, ZSTD_fast }, /* level 2 */ + { 17, 15, 16, 2, 5, 0, ZSTD_dfast }, /* level 3 */ + { 17, 17, 17, 2, 4, 0, ZSTD_dfast }, /* level 4 */ + { 17, 16, 17, 3, 4, 2, ZSTD_greedy }, /* level 5 */ + { 17, 16, 17, 3, 4, 4, ZSTD_lazy }, /* level 6 */ + { 17, 16, 17, 3, 4, 8, ZSTD_lazy2 }, /* level 7 */ + { 17, 16, 17, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ + { 17, 16, 17, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ + { 17, 16, 17, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ + { 17, 17, 17, 5, 4, 8, ZSTD_btlazy2 }, /* level 11 */ + { 17, 18, 17, 7, 4, 12, ZSTD_btlazy2 }, /* level 12 */ + { 17, 18, 17, 3, 4, 12, ZSTD_btopt }, /* level 13.*/ + { 17, 18, 17, 4, 3, 32, ZSTD_btopt }, /* level 14.*/ + { 17, 18, 17, 6, 3,256, ZSTD_btopt }, /* level 15.*/ + { 17, 18, 17, 6, 3,128, ZSTD_btultra }, /* level 16.*/ + { 17, 18, 17, 8, 3,256, ZSTD_btultra }, /* level 17.*/ + { 17, 18, 17, 10, 3,512, ZSTD_btultra }, /* level 18.*/ + { 17, 18, 17, 5, 3,256, ZSTD_btultra2}, /* level 19.*/ + { 17, 18, 17, 7, 3,512, ZSTD_btultra2}, /* level 20.*/ + { 17, 18, 17, 9, 3,512, ZSTD_btultra2}, /* level 21.*/ + { 17, 18, 17, 11, 3,999, ZSTD_btultra2}, /* level 22.*/ +}, +{ /* for srcSize <= 16 KB */ + /* W, C, H, S, L, T, strat */ + { 14, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ + { 14, 14, 15, 1, 5, 0, ZSTD_fast }, /* level 1 */ + { 14, 14, 15, 1, 4, 0, ZSTD_fast }, /* level 2 */ + { 14, 14, 15, 2, 4, 0, ZSTD_dfast }, /* level 3 */ + { 14, 14, 14, 4, 4, 2, ZSTD_greedy }, /* level 4 */ + { 14, 14, 14, 3, 4, 4, ZSTD_lazy }, /* level 5.*/ + { 14, 14, 14, 4, 4, 8, ZSTD_lazy2 }, /* level 6 */ + { 14, 14, 14, 6, 4, 8, ZSTD_lazy2 }, /* level 7 */ + { 14, 14, 14, 8, 4, 8, ZSTD_lazy2 }, /* level 8.*/ + { 14, 15, 14, 5, 4, 8, ZSTD_btlazy2 }, /* level 9.*/ + { 14, 15, 14, 9, 4, 8, ZSTD_btlazy2 }, /* level 10.*/ + { 14, 15, 14, 3, 4, 12, ZSTD_btopt }, /* level 11.*/ + { 14, 15, 14, 4, 3, 24, ZSTD_btopt }, /* level 12.*/ + { 14, 15, 14, 5, 3, 32, ZSTD_btultra }, /* level 13.*/ + { 14, 15, 15, 6, 3, 64, ZSTD_btultra }, /* level 14.*/ + { 14, 15, 15, 7, 3,256, ZSTD_btultra }, /* level 15.*/ + { 14, 15, 15, 5, 3, 48, ZSTD_btultra2}, /* level 16.*/ + { 14, 15, 15, 6, 3,128, ZSTD_btultra2}, /* level 17.*/ + { 14, 15, 15, 7, 3,256, ZSTD_btultra2}, /* level 18.*/ + { 14, 15, 15, 8, 3,256, ZSTD_btultra2}, /* level 19.*/ + { 14, 15, 15, 8, 3,512, ZSTD_btultra2}, /* level 20.*/ + { 14, 15, 15, 9, 3,512, ZSTD_btultra2}, /* level 21.*/ + { 14, 15, 15, 10, 3,999, ZSTD_btultra2}, /* level 22.*/ +}, +}; + + + +#endif /* ZSTD_CLEVELS_H */ diff --git a/src/dependencies/zstd-1.5.0/lib/compress/fse_compress.c b/src/dependencies/zstd-1.5.4/lib/compress/fse_compress.c similarity index 76% rename from src/dependencies/zstd-1.5.0/lib/compress/fse_compress.c rename to src/dependencies/zstd-1.5.4/lib/compress/fse_compress.c index b4297ec..5d37708 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/fse_compress.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/fse_compress.c @@ -1,6 +1,6 @@ /* ****************************************************************** * FSE : Finite State Entropy encoder - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy @@ -26,6 +26,7 @@ #define ZSTD_DEPS_NEED_MALLOC #define ZSTD_DEPS_NEED_MATH64 #include "../common/zstd_deps.h" /* ZSTD_malloc, ZSTD_free, ZSTD_memcpy, ZSTD_memset */ +#include "../common/bits.h" /* ZSTD_highbit32 */ /* ************************************************************** @@ -75,13 +76,14 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, void* const FSCT = ((U32*)ptr) + 1 /* header */ + (tableLog ? tableSize>>1 : 1) ; FSE_symbolCompressionTransform* const symbolTT = (FSE_symbolCompressionTransform*) (FSCT); U32 const step = FSE_TABLESTEP(tableSize); + U32 const maxSV1 = maxSymbolValue+1; - U32* cumul = (U32*)workSpace; - FSE_FUNCTION_TYPE* tableSymbol = (FSE_FUNCTION_TYPE*)(cumul + (maxSymbolValue + 2)); + U16* cumul = (U16*)workSpace; /* size = maxSV1 */ + FSE_FUNCTION_TYPE* const tableSymbol = (FSE_FUNCTION_TYPE*)(cumul + (maxSV1+1)); /* size = tableSize */ U32 highThreshold = tableSize-1; - if ((size_t)workSpace & 3) return ERROR(GENERIC); /* Must be 4 byte aligned */ + assert(((size_t)workSpace & 1) == 0); /* Must be 2 bytes-aligned */ if (FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) > wkspSize) return ERROR(tableLog_tooLarge); /* CTable header */ tableU16[-2] = (U16) tableLog; @@ -89,7 +91,7 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, assert(tableLog < 16); /* required for threshold strategy to work */ /* For explanations on how to distribute symbol values over the table : - * http://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html */ + * https://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html */ #ifdef __clang_analyzer__ ZSTD_memset(tableSymbol, 0, sizeof(*tableSymbol) * tableSize); /* useless initialization, just to keep scan-build happy */ @@ -98,20 +100,61 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, /* symbol start positions */ { U32 u; cumul[0] = 0; - for (u=1; u <= maxSymbolValue+1; u++) { + for (u=1; u <= maxSV1; u++) { if (normalizedCounter[u-1]==-1) { /* Low proba symbol */ cumul[u] = cumul[u-1] + 1; tableSymbol[highThreshold--] = (FSE_FUNCTION_TYPE)(u-1); } else { - cumul[u] = cumul[u-1] + normalizedCounter[u-1]; + assert(normalizedCounter[u-1] >= 0); + cumul[u] = cumul[u-1] + (U16)normalizedCounter[u-1]; + assert(cumul[u] >= cumul[u-1]); /* no overflow */ } } - cumul[maxSymbolValue+1] = tableSize+1; + cumul[maxSV1] = (U16)(tableSize+1); } /* Spread symbols */ - { U32 position = 0; + if (highThreshold == tableSize - 1) { + /* Case for no low prob count symbols. Lay down 8 bytes at a time + * to reduce branch misses since we are operating on a small block + */ + BYTE* const spread = tableSymbol + tableSize; /* size = tableSize + 8 (may write beyond tableSize) */ + { U64 const add = 0x0101010101010101ull; + size_t pos = 0; + U64 sv = 0; + U32 s; + for (s=0; s=0); + pos += (size_t)n; + } + } + /* Spread symbols across the table. Lack of lowprob symbols means that + * we don't need variable sized inner loop, so we can unroll the loop and + * reduce branch misses. + */ + { size_t position = 0; + size_t s; + size_t const unroll = 2; /* Experimentally determined optimal unroll */ + assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */ + for (s = 0; s < (size_t)tableSize; s += unroll) { + size_t u; + for (u = 0; u < unroll; ++u) { + size_t const uPosition = (position + (u * step)) & tableMask; + tableSymbol[uPosition] = spread[s + u]; + } + position = (position + (unroll * step)) & tableMask; + } + assert(position == 0); /* Must have initialized all positions */ + } + } else { + U32 position = 0; U32 symbol; - for (symbol=0; symbol<=maxSymbolValue; symbol++) { + for (symbol=0; symbol highThreshold) position = (position + step) & tableMask; /* Low proba area */ } } - assert(position==0); /* Must have initialized all positions */ } @@ -144,16 +186,17 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, case -1: case 1: symbolTT[s].deltaNbBits = (tableLog << 16) - (1< 1); + { U32 const maxBitsOut = tableLog - ZSTD_highbit32 ((U32)normalizedCounter[s]-1); + U32 const minStatePlus = (U32)normalizedCounter[s] << maxBitsOut; symbolTT[s].deltaNbBits = (maxBitsOut << 16) - minStatePlus; - symbolTT[s].deltaFindState = total - normalizedCounter[s]; - total += normalizedCounter[s]; + symbolTT[s].deltaFindState = (int)(total - (unsigned)normalizedCounter[s]); + total += (unsigned)normalizedCounter[s]; } } } } #if 0 /* debug : symbol costs */ @@ -164,32 +207,26 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, symbol, normalizedCounter[symbol], FSE_getMaxNbBits(symbolTT, symbol), (double)FSE_bitCost(symbolTT, tableLog, symbol, 8) / 256); - } - } + } } #endif return 0; } -#ifndef ZSTD_NO_UNUSED_FUNCTIONS -size_t FSE_buildCTable(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) -{ - FSE_FUNCTION_TYPE tableSymbol[FSE_MAX_TABLESIZE]; /* memset() is not necessary, even if static analyzer complain about it */ - return FSE_buildCTable_wksp(ct, normalizedCounter, maxSymbolValue, tableLog, tableSymbol, sizeof(tableSymbol)); -} -#endif - #ifndef FSE_COMMONDEFS_ONLY - /*-************************************************************** * FSE NCount encoding ****************************************************************/ size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog) { - size_t const maxHeaderSize = (((maxSymbolValue+1) * tableLog) >> 3) + 3; + size_t const maxHeaderSize = (((maxSymbolValue+1) * tableLog + + 4 /* bitCount initialized at 4 */ + + 2 /* first two symbols may use one additional bit each */) / 8) + + 1 /* round up to whole nb bytes */ + + 2 /* additional two bytes for bitstream flush */; return maxSymbolValue ? maxHeaderSize : FSE_NCOUNTBOUND; /* maxSymbolValue==0 ? use default */ } @@ -306,21 +343,11 @@ size_t FSE_writeNCount (void* buffer, size_t bufferSize, * FSE Compression Code ****************************************************************/ -FSE_CTable* FSE_createCTable (unsigned maxSymbolValue, unsigned tableLog) -{ - size_t size; - if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX; - size = FSE_CTABLE_SIZE_U32 (tableLog, maxSymbolValue) * sizeof(U32); - return (FSE_CTable*)ZSTD_malloc(size); -} - -void FSE_freeCTable (FSE_CTable* ct) { ZSTD_free(ct); } - /* provides the minimum logSize to safely represent a distribution */ static unsigned FSE_minTableLog(size_t srcSize, unsigned maxSymbolValue) { - U32 minBitsSrc = BIT_highbit32((U32)(srcSize)) + 1; - U32 minBitsSymbols = BIT_highbit32(maxSymbolValue) + 2; + U32 minBitsSrc = ZSTD_highbit32((U32)(srcSize)) + 1; + U32 minBitsSymbols = ZSTD_highbit32(maxSymbolValue) + 2; U32 minBits = minBitsSrc < minBitsSymbols ? minBitsSrc : minBitsSymbols; assert(srcSize > 1); /* Not supported, RLE should be used instead */ return minBits; @@ -328,7 +355,7 @@ static unsigned FSE_minTableLog(size_t srcSize, unsigned maxSymbolValue) unsigned FSE_optimalTableLog_internal(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, unsigned minus) { - U32 maxBitsSrc = BIT_highbit32((U32)(srcSize - 1)) - minus; + U32 maxBitsSrc = ZSTD_highbit32((U32)(srcSize - 1)) - minus; U32 tableLog = maxTableLog; U32 minBits = FSE_minTableLog(srcSize, maxSymbolValue); assert(srcSize > 1); /* Not supported, RLE should be used instead */ @@ -496,40 +523,6 @@ size_t FSE_normalizeCount (short* normalizedCounter, unsigned tableLog, return tableLog; } - -/* fake FSE_CTable, for raw (uncompressed) input */ -size_t FSE_buildCTable_raw (FSE_CTable* ct, unsigned nbBits) -{ - const unsigned tableSize = 1 << nbBits; - const unsigned tableMask = tableSize - 1; - const unsigned maxSymbolValue = tableMask; - void* const ptr = ct; - U16* const tableU16 = ( (U16*) ptr) + 2; - void* const FSCT = ((U32*)ptr) + 1 /* header */ + (tableSize>>1); /* assumption : tableLog >= 1 */ - FSE_symbolCompressionTransform* const symbolTT = (FSE_symbolCompressionTransform*) (FSCT); - unsigned s; - - /* Sanity checks */ - if (nbBits < 1) return ERROR(GENERIC); /* min size */ - - /* header */ - tableU16[-2] = (U16) nbBits; - tableU16[-1] = (U16) maxSymbolValue; - - /* Build table */ - for (s=0; s not compressible */ - if (maxCount < (srcSize >> 7)) return 0; /* Heuristic : not compressible enough */ - } - - tableLog = FSE_optimalTableLog(tableLog, srcSize, maxSymbolValue); - CHECK_F( FSE_normalizeCount(norm, tableLog, count, srcSize, maxSymbolValue, /* useLowProbCount */ srcSize >= 2048) ); - - /* Write table description header */ - { CHECK_V_F(nc_err, FSE_writeNCount(op, oend-op, norm, maxSymbolValue, tableLog) ); - op += nc_err; - } - - /* Compress */ - CHECK_F( FSE_buildCTable_wksp(CTable, norm, maxSymbolValue, tableLog, scratchBuffer, scratchBufferSize) ); - { CHECK_V_F(cSize, FSE_compress_usingCTable(op, oend - op, src, srcSize, CTable) ); - if (cSize == 0) return 0; /* not enough space for compressed data */ - op += cSize; - } - - /* check compressibility */ - if ( (size_t)(op-ostart) >= srcSize-1 ) return 0; - - return op-ostart; -} - -typedef struct { - FSE_CTable CTable_max[FSE_CTABLE_SIZE_U32(FSE_MAX_TABLELOG, FSE_MAX_SYMBOL_VALUE)]; - union { - U32 hist_wksp[HIST_WKSP_SIZE_U32]; - BYTE scratchBuffer[1 << FSE_MAX_TABLELOG]; - } workspace; -} fseWkspMax_t; - -size_t FSE_compress2 (void* dst, size_t dstCapacity, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog) -{ - fseWkspMax_t scratchBuffer; - DEBUG_STATIC_ASSERT(sizeof(scratchBuffer) >= FSE_COMPRESS_WKSP_SIZE_U32(FSE_MAX_TABLELOG, FSE_MAX_SYMBOL_VALUE)); /* compilation failures here means scratchBuffer is not large enough */ - if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge); - return FSE_compress_wksp(dst, dstCapacity, src, srcSize, maxSymbolValue, tableLog, &scratchBuffer, sizeof(scratchBuffer)); -} - -size_t FSE_compress (void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - return FSE_compress2(dst, dstCapacity, src, srcSize, FSE_MAX_SYMBOL_VALUE, FSE_DEFAULT_TABLELOG); -} -#endif - #endif /* FSE_COMMONDEFS_ONLY */ diff --git a/src/dependencies/zstd-1.5.0/lib/compress/hist.c b/src/dependencies/zstd-1.5.4/lib/compress/hist.c similarity index 99% rename from src/dependencies/zstd-1.5.0/lib/compress/hist.c rename to src/dependencies/zstd-1.5.4/lib/compress/hist.c index 073c57e..e2fb431 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/hist.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/hist.c @@ -1,7 +1,7 @@ /* ****************************************************************** * hist : Histogram functions * part of Finite State Entropy project - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy diff --git a/src/dependencies/zstd-1.5.0/lib/compress/hist.h b/src/dependencies/zstd-1.5.4/lib/compress/hist.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/compress/hist.h rename to src/dependencies/zstd-1.5.4/lib/compress/hist.h index 228ed48..887896b 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/hist.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/hist.h @@ -1,7 +1,7 @@ /* ****************************************************************** * hist : Histogram functions * part of Finite State Entropy project - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy diff --git a/src/dependencies/zstd-1.5.0/lib/compress/huf_compress.c b/src/dependencies/zstd-1.5.4/lib/compress/huf_compress.c similarity index 50% rename from src/dependencies/zstd-1.5.0/lib/compress/huf_compress.c rename to src/dependencies/zstd-1.5.4/lib/compress/huf_compress.c index 485906e..2987187 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/huf_compress.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/huf_compress.c @@ -1,6 +1,6 @@ /* ****************************************************************** * Huffman encoder, part of New Generation Entropy library - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * You can contact the author at : * - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy @@ -29,9 +29,9 @@ #include "hist.h" #define FSE_STATIC_LINKING_ONLY /* FSE_optimalTableLog_internal */ #include "../common/fse.h" /* header compression */ -#define HUF_STATIC_LINKING_ONLY #include "../common/huf.h" #include "../common/error_private.h" +#include "../common/bits.h" /* ZSTD_highbit32 */ /* ************************************************************** @@ -42,17 +42,93 @@ /* ************************************************************** -* Utils +* Required declarations ****************************************************************/ -unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue) +typedef struct nodeElt_s { + U32 count; + U16 parent; + BYTE byte; + BYTE nbBits; +} nodeElt; + + +/* ************************************************************** +* Debug Traces +****************************************************************/ + +#if DEBUGLEVEL >= 2 + +static size_t showU32(const U32* arr, size_t size) { - return FSE_optimalTableLog_internal(maxTableLog, srcSize, maxSymbolValue, 1); + size_t u; + for (u=0; u= add) { + assert(add < align); + assert(((size_t)aligned & mask) == 0); + *workspaceSizePtr -= add; + return aligned; + } else { + *workspaceSizePtr = 0; + return NULL; + } +} + + /* HUF_compressWeights() : * Same as FSE_compress(), but dedicated to huff0's weights compression. * The use case needs much less stack memory. @@ -67,7 +143,10 @@ typedef struct { S16 norm[HUF_TABLELOG_MAX+1]; } HUF_CompressWeightsWksp; -static size_t HUF_compressWeights(void* dst, size_t dstSize, const void* weightTable, size_t wtSize, void* workspace, size_t workspaceSize) +static size_t +HUF_compressWeights(void* dst, size_t dstSize, + const void* weightTable, size_t wtSize, + void* workspace, size_t workspaceSize) { BYTE* const ostart = (BYTE*) dst; BYTE* op = ostart; @@ -75,7 +154,7 @@ static size_t HUF_compressWeights(void* dst, size_t dstSize, const void* weightT unsigned maxSymbolValue = HUF_TABLELOG_MAX; U32 tableLog = MAX_FSE_TABLELOG_FOR_HUFF_HEADER; - HUF_CompressWeightsWksp* wksp = (HUF_CompressWeightsWksp*)workspace; + HUF_CompressWeightsWksp* wksp = (HUF_CompressWeightsWksp*)HUF_alignUpWorkspace(workspace, &workspaceSize, ZSTD_ALIGNOF(U32)); if (workspaceSize < sizeof(HUF_CompressWeightsWksp)) return ERROR(GENERIC); @@ -106,6 +185,40 @@ static size_t HUF_compressWeights(void* dst, size_t dstSize, const void* weightT return (size_t)(op-ostart); } +static size_t HUF_getNbBits(HUF_CElt elt) +{ + return elt & 0xFF; +} + +static size_t HUF_getNbBitsFast(HUF_CElt elt) +{ + return elt; +} + +static size_t HUF_getValue(HUF_CElt elt) +{ + return elt & ~(size_t)0xFF; +} + +static size_t HUF_getValueFast(HUF_CElt elt) +{ + return elt; +} + +static void HUF_setNbBits(HUF_CElt* elt, size_t nbBits) +{ + assert(nbBits <= HUF_TABLELOG_ABSOLUTEMAX); + *elt = nbBits; +} + +static void HUF_setValue(HUF_CElt* elt, size_t value) +{ + size_t const nbBits = HUF_getNbBits(*elt); + if (nbBits > 0) { + assert((value >> nbBits) == 0); + *elt |= value << (sizeof(HUF_CElt) * 8 - nbBits); + } +} typedef struct { HUF_CompressWeightsWksp wksp; @@ -117,9 +230,12 @@ size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog, void* workspace, size_t workspaceSize) { + HUF_CElt const* const ct = CTable + 1; BYTE* op = (BYTE*)dst; U32 n; - HUF_WriteCTableWksp* wksp = (HUF_WriteCTableWksp*)workspace; + HUF_WriteCTableWksp* wksp = (HUF_WriteCTableWksp*)HUF_alignUpWorkspace(workspace, &workspaceSize, ZSTD_ALIGNOF(U32)); + + HUF_STATIC_ASSERT(HUF_CTABLE_WORKSPACE_SIZE >= sizeof(HUF_WriteCTableWksp)); /* check conditions */ if (workspaceSize < sizeof(HUF_WriteCTableWksp)) return ERROR(GENERIC); @@ -130,9 +246,10 @@ size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, for (n=1; nbitsToWeight[n] = (BYTE)(huffLog + 1 - n); for (n=0; nhuffWeight[n] = wksp->bitsToWeight[CTable[n].nbBits]; + wksp->huffWeight[n] = wksp->bitsToWeight[HUF_getNbBits(ct[n])]; /* attempt weights compression by FSE */ + if (maxDstSize < 1) return ERROR(dstSize_tooSmall); { CHECK_V_F(hSize, HUF_compressWeights(op+1, maxDstSize-1, wksp->huffWeight, maxSymbolValue, &wksp->wksp, sizeof(wksp->wksp)) ); if ((hSize>1) & (hSize < maxSymbolValue/2)) { /* FSE compressed */ op[0] = (BYTE)hSize; @@ -149,16 +266,6 @@ size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, return ((maxSymbolValue+1)/2) + 1; } -/*! HUF_writeCTable() : - `CTable` : Huffman tree to save, using huf representation. - @return : size of saved CTable */ -size_t HUF_writeCTable (void* dst, size_t maxDstSize, - const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog) -{ - HUF_WriteCTableWksp wksp; - return HUF_writeCTable_wksp(dst, maxDstSize, CTable, maxSymbolValue, huffLog, &wksp, sizeof(wksp)); -} - size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize, unsigned* hasZeroWeights) { @@ -166,6 +273,7 @@ size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void U32 rankVal[HUF_TABLELOG_ABSOLUTEMAX + 1]; /* large enough for values from 0 to 16 */ U32 tableLog = 0; U32 nbSymbols = 0; + HUF_CElt* const ct = CTable + 1; /* get symbol weights */ CHECK_V_F(readSize, HUF_readStats(huffWeight, HUF_SYMBOLVALUE_MAX+1, rankVal, &nbSymbols, &tableLog, src, srcSize)); @@ -175,6 +283,8 @@ size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void if (tableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); if (nbSymbols > *maxSymbolValuePtr+1) return ERROR(maxSymbolValue_tooSmall); + CTable[0] = tableLog; + /* Prepare base value per rank */ { U32 n, nextRankStart = 0; for (n=1; n<=tableLog; n++) { @@ -186,13 +296,13 @@ size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void /* fill nbBits */ { U32 n; for (n=0; nn=tableLog+1 */ U16 valPerRank[HUF_TABLELOG_MAX+2] = {0}; - { U32 n; for (n=0; n>= 1; } } /* assign value within rank, symbol order */ - { U32 n; for (n=0; n maxNbBits to be maxNbBits. Then it adjusts - * the tree to so that it is a valid canonical Huffman tree. + * It attempts to convert all nodes with nbBits > @targetNbBits + * to employ @targetNbBits instead. Then it adjusts the tree + * so that it remains a valid canonical Huffman tree. * * @pre The sum of the ranks of each symbol == 2^largestBits, * where largestBits == huffNode[lastNonNull].nbBits. * @post The sum of the ranks of each symbol == 2^largestBits, - * where largestBits is the return value <= maxNbBits. + * where largestBits is the return value (expected <= targetNbBits). * - * @param huffNode The Huffman tree modified in place to enforce maxNbBits. + * @param huffNode The Huffman tree modified in place to enforce targetNbBits. + * It's presumed sorted, from most frequent to rarest symbol. * @param lastNonNull The symbol with the lowest count in the Huffman tree. - * @param maxNbBits The maximum allowed number of bits, which the Huffman tree + * @param targetNbBits The allowed number of bits, which the Huffman tree * may not respect. After this function the Huffman tree will - * respect maxNbBits. - * @return The maximum number of bits of the Huffman tree after adjustment, - * necessarily no more than maxNbBits. + * respect targetNbBits. + * @return The maximum number of bits of the Huffman tree after adjustment. */ -static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits) +static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 targetNbBits) { const U32 largestBits = huffNode[lastNonNull].nbBits; - /* early exit : no elt > maxNbBits, so the tree is already valid. */ - if (largestBits <= maxNbBits) return largestBits; + /* early exit : no elt > targetNbBits, so the tree is already valid. */ + if (largestBits <= targetNbBits) return largestBits; + + DEBUGLOG(5, "HUF_setMaxHeight (targetNbBits = %u)", targetNbBits); /* there are several too large elements (at least >= 2) */ { int totalCost = 0; - const U32 baseCost = 1 << (largestBits - maxNbBits); + const U32 baseCost = 1 << (largestBits - targetNbBits); int n = (int)lastNonNull; - /* Adjust any ranks > maxNbBits to maxNbBits. + /* Adjust any ranks > targetNbBits to targetNbBits. * Compute totalCost, which is how far the sum of the ranks is * we are over 2^largestBits after adjust the offending ranks. */ - while (huffNode[n].nbBits > maxNbBits) { + while (huffNode[n].nbBits > targetNbBits) { totalCost += baseCost - (1 << (largestBits - huffNode[n].nbBits)); - huffNode[n].nbBits = (BYTE)maxNbBits; + huffNode[n].nbBits = (BYTE)targetNbBits; n--; } - /* n stops at huffNode[n].nbBits <= maxNbBits */ - assert(huffNode[n].nbBits <= maxNbBits); - /* n end at index of smallest symbol using < maxNbBits */ - while (huffNode[n].nbBits == maxNbBits) --n; + /* n stops at huffNode[n].nbBits <= targetNbBits */ + assert(huffNode[n].nbBits <= targetNbBits); + /* n end at index of smallest symbol using < targetNbBits */ + while (huffNode[n].nbBits == targetNbBits) --n; - /* renorm totalCost from 2^largestBits to 2^maxNbBits + /* renorm totalCost from 2^largestBits to 2^targetNbBits * note : totalCost is necessarily a multiple of baseCost */ - assert((totalCost & (baseCost - 1)) == 0); - totalCost >>= (largestBits - maxNbBits); + assert(((U32)totalCost & (baseCost - 1)) == 0); + totalCost >>= (largestBits - targetNbBits); assert(totalCost > 0); /* repay normalized cost */ @@ -281,19 +387,19 @@ static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits) /* Get pos of last (smallest = lowest cum. count) symbol per rank */ ZSTD_memset(rankLast, 0xF0, sizeof(rankLast)); - { U32 currentNbBits = maxNbBits; + { U32 currentNbBits = targetNbBits; int pos; for (pos=n ; pos >= 0; pos--) { if (huffNode[pos].nbBits >= currentNbBits) continue; - currentNbBits = huffNode[pos].nbBits; /* < maxNbBits */ - rankLast[maxNbBits-currentNbBits] = (U32)pos; + currentNbBits = huffNode[pos].nbBits; /* < targetNbBits */ + rankLast[targetNbBits-currentNbBits] = (U32)pos; } } while (totalCost > 0) { /* Try to reduce the next power of 2 above totalCost because we * gain back half the rank. */ - U32 nBitsToDecrease = BIT_highbit32((U32)totalCost) + 1; + U32 nBitsToDecrease = ZSTD_highbit32((U32)totalCost) + 1; for ( ; nBitsToDecrease > 1; nBitsToDecrease--) { U32 const highPos = rankLast[nBitsToDecrease]; U32 const lowPos = rankLast[nBitsToDecrease-1]; @@ -333,7 +439,7 @@ static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits) rankLast[nBitsToDecrease] = noSymbol; else { rankLast[nBitsToDecrease]--; - if (huffNode[rankLast[nBitsToDecrease]].nbBits != maxNbBits-nBitsToDecrease) + if (huffNode[rankLast[nBitsToDecrease]].nbBits != targetNbBits-nBitsToDecrease) rankLast[nBitsToDecrease] = noSymbol; /* this rank is now empty */ } } /* while (totalCost > 0) */ @@ -345,11 +451,11 @@ static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits) * TODO. */ while (totalCost < 0) { /* Sometimes, cost correction overshoot */ - /* special case : no rank 1 symbol (using maxNbBits-1); - * let's create one from largest rank 0 (using maxNbBits). + /* special case : no rank 1 symbol (using targetNbBits-1); + * let's create one from largest rank 0 (using targetNbBits). */ if (rankLast[1] == noSymbol) { - while (huffNode[n].nbBits == maxNbBits) n--; + while (huffNode[n].nbBits == targetNbBits) n--; huffNode[n+1].nbBits--; assert(n >= 0); rankLast[1] = (U32)(n+1); @@ -363,26 +469,122 @@ static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits) } /* repay normalized cost */ } /* there are several too large elements (at least >= 2) */ - return maxNbBits; + return targetNbBits; } typedef struct { - U32 base; - U32 curr; + U16 base; + U16 curr; } rankPos; -typedef nodeElt huffNodeTable[HUF_CTABLE_WORKSPACE_SIZE_U32]; +typedef nodeElt huffNodeTable[2 * (HUF_SYMBOLVALUE_MAX + 1)]; -#define RANK_POSITION_TABLE_SIZE 32 +/* Number of buckets available for HUF_sort() */ +#define RANK_POSITION_TABLE_SIZE 192 typedef struct { huffNodeTable huffNodeTbl; rankPos rankPosition[RANK_POSITION_TABLE_SIZE]; } HUF_buildCTable_wksp_tables; +/* RANK_POSITION_DISTINCT_COUNT_CUTOFF == Cutoff point in HUF_sort() buckets for which we use log2 bucketing. + * Strategy is to use as many buckets as possible for representing distinct + * counts while using the remainder to represent all "large" counts. + * + * To satisfy this requirement for 192 buckets, we can do the following: + * Let buckets 0-166 represent distinct counts of [0, 166] + * Let buckets 166 to 192 represent all remaining counts up to RANK_POSITION_MAX_COUNT_LOG using log2 bucketing. + */ +#define RANK_POSITION_MAX_COUNT_LOG 32 +#define RANK_POSITION_LOG_BUCKETS_BEGIN ((RANK_POSITION_TABLE_SIZE - 1) - RANK_POSITION_MAX_COUNT_LOG - 1 /* == 158 */) +#define RANK_POSITION_DISTINCT_COUNT_CUTOFF (RANK_POSITION_LOG_BUCKETS_BEGIN + ZSTD_highbit32(RANK_POSITION_LOG_BUCKETS_BEGIN) /* == 166 */) + +/* Return the appropriate bucket index for a given count. See definition of + * RANK_POSITION_DISTINCT_COUNT_CUTOFF for explanation of bucketing strategy. + */ +static U32 HUF_getIndex(U32 const count) { + return (count < RANK_POSITION_DISTINCT_COUNT_CUTOFF) + ? count + : ZSTD_highbit32(count) + RANK_POSITION_LOG_BUCKETS_BEGIN; +} + +/* Helper swap function for HUF_quickSortPartition() */ +static void HUF_swapNodes(nodeElt* a, nodeElt* b) { + nodeElt tmp = *a; + *a = *b; + *b = tmp; +} + +/* Returns 0 if the huffNode array is not sorted by descending count */ +MEM_STATIC int HUF_isSorted(nodeElt huffNode[], U32 const maxSymbolValue1) { + U32 i; + for (i = 1; i < maxSymbolValue1; ++i) { + if (huffNode[i].count > huffNode[i-1].count) { + return 0; + } + } + return 1; +} + +/* Insertion sort by descending order */ +HINT_INLINE void HUF_insertionSort(nodeElt huffNode[], int const low, int const high) { + int i; + int const size = high-low+1; + huffNode += low; + for (i = 1; i < size; ++i) { + nodeElt const key = huffNode[i]; + int j = i - 1; + while (j >= 0 && huffNode[j].count < key.count) { + huffNode[j + 1] = huffNode[j]; + j--; + } + huffNode[j + 1] = key; + } +} + +/* Pivot helper function for quicksort. */ +static int HUF_quickSortPartition(nodeElt arr[], int const low, int const high) { + /* Simply select rightmost element as pivot. "Better" selectors like + * median-of-three don't experimentally appear to have any benefit. + */ + U32 const pivot = arr[high].count; + int i = low - 1; + int j = low; + for ( ; j < high; j++) { + if (arr[j].count > pivot) { + i++; + HUF_swapNodes(&arr[i], &arr[j]); + } + } + HUF_swapNodes(&arr[i + 1], &arr[high]); + return i + 1; +} + +/* Classic quicksort by descending with partially iterative calls + * to reduce worst case callstack size. + */ +static void HUF_simpleQuickSort(nodeElt arr[], int low, int high) { + int const kInsertionSortThreshold = 8; + if (high - low < kInsertionSortThreshold) { + HUF_insertionSort(arr, low, high); + return; + } + while (low < high) { + int const idx = HUF_quickSortPartition(arr, low, high); + if (idx - low < high - idx) { + HUF_simpleQuickSort(arr, low, idx - 1); + low = idx + 1; + } else { + HUF_simpleQuickSort(arr, idx + 1, high); + high = idx - 1; + } + } +} + /** * HUF_sort(): * Sorts the symbols [0, maxSymbolValue] by count[symbol] in decreasing order. + * This is a typical bucket sorting strategy that uses either quicksort or insertion sort to sort each bucket. * * @param[out] huffNode Sorted symbols by decreasing count. Only members `.count` and `.byte` are filled. * Must have (maxSymbolValue + 1) entries. @@ -390,42 +592,51 @@ typedef struct { * @param[in] maxSymbolValue Maximum symbol value. * @param rankPosition This is a scratch workspace. Must have RANK_POSITION_TABLE_SIZE entries. */ -static void HUF_sort(nodeElt* huffNode, const unsigned* count, U32 maxSymbolValue, rankPos* rankPosition) -{ - int n; - int const maxSymbolValue1 = (int)maxSymbolValue + 1; +static void HUF_sort(nodeElt huffNode[], const unsigned count[], U32 const maxSymbolValue, rankPos rankPosition[]) { + U32 n; + U32 const maxSymbolValue1 = maxSymbolValue+1; /* Compute base and set curr to base. - * For symbol s let lowerRank = BIT_highbit32(count[n]+1) and rank = lowerRank + 1. - * Then 2^lowerRank <= count[n]+1 <= 2^rank. + * For symbol s let lowerRank = HUF_getIndex(count[n]) and rank = lowerRank + 1. + * See HUF_getIndex to see bucketing strategy. * We attribute each symbol to lowerRank's base value, because we want to know where * each rank begins in the output, so for rank R we want to count ranks R+1 and above. */ ZSTD_memset(rankPosition, 0, sizeof(*rankPosition) * RANK_POSITION_TABLE_SIZE); for (n = 0; n < maxSymbolValue1; ++n) { - U32 lowerRank = BIT_highbit32(count[n] + 1); + U32 lowerRank = HUF_getIndex(count[n]); + assert(lowerRank < RANK_POSITION_TABLE_SIZE - 1); rankPosition[lowerRank].base++; } + assert(rankPosition[RANK_POSITION_TABLE_SIZE - 1].base == 0); + /* Set up the rankPosition table */ for (n = RANK_POSITION_TABLE_SIZE - 1; n > 0; --n) { rankPosition[n-1].base += rankPosition[n].base; rankPosition[n-1].curr = rankPosition[n-1].base; } - /* Sort */ + + /* Insert each symbol into their appropriate bucket, setting up rankPosition table. */ for (n = 0; n < maxSymbolValue1; ++n) { U32 const c = count[n]; - U32 const r = BIT_highbit32(c+1) + 1; - U32 pos = rankPosition[r].curr++; - /* Insert into the correct position in the rank. - * We have at most 256 symbols, so this insertion should be fine. - */ - while ((pos > rankPosition[r].base) && (c > huffNode[pos-1].count)) { - huffNode[pos] = huffNode[pos-1]; - pos--; - } + U32 const r = HUF_getIndex(c) + 1; + U32 const pos = rankPosition[r].curr++; + assert(pos < maxSymbolValue1); huffNode[pos].count = c; huffNode[pos].byte = (BYTE)n; } + + /* Sort each bucket. */ + for (n = RANK_POSITION_DISTINCT_COUNT_CUTOFF; n < RANK_POSITION_TABLE_SIZE - 1; ++n) { + int const bucketSize = rankPosition[n].curr - rankPosition[n].base; + U32 const bucketStartIdx = rankPosition[n].base; + if (bucketSize > 1) { + assert(bucketStartIdx < maxSymbolValue1); + HUF_simpleQuickSort(huffNode + bucketStartIdx, 0, bucketSize-1); + } + } + + assert(HUF_isSorted(huffNode, maxSymbolValue1)); } @@ -449,6 +660,7 @@ static int HUF_buildTree(nodeElt* huffNode, U32 maxSymbolValue) int lowS, lowN; int nodeNb = STARTNODE; int n, nodeRoot; + DEBUGLOG(5, "HUF_buildTree (alphabet size = %u)", maxSymbolValue + 1); /* init for parents */ nonNullRank = (int)maxSymbolValue; while(huffNode[nonNullRank].count == 0) nonNullRank--; @@ -475,6 +687,8 @@ static int HUF_buildTree(nodeElt* huffNode, U32 maxSymbolValue) for (n=0; n<=nonNullRank; n++) huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; + DEBUGLOG(6, "Initial distribution of bits completed (%zu sorted symbols)", showHNodeBits(huffNode, maxSymbolValue+1)); + return nonNullRank; } @@ -490,6 +704,7 @@ static int HUF_buildTree(nodeElt* huffNode, U32 maxSymbolValue) */ static void HUF_buildCTableFromTree(HUF_CElt* CTable, nodeElt const* huffNode, int nonNullRank, U32 maxSymbolValue, U32 maxNbBits) { + HUF_CElt* const ct = CTable + 1; /* fill result into ctable (val, nbBits) */ int n; U16 nbPerRank[HUF_TABLELOG_MAX+1] = {0}; @@ -505,127 +720,373 @@ static void HUF_buildCTableFromTree(HUF_CElt* CTable, nodeElt const* huffNode, i min >>= 1; } } for (n=0; nhuffNodeTbl; nodeElt* const huffNode = huffNode0+1; int nonNullRank; + HUF_STATIC_ASSERT(HUF_CTABLE_WORKSPACE_SIZE == sizeof(HUF_buildCTable_wksp_tables)); + + DEBUGLOG(5, "HUF_buildCTable_wksp (alphabet size = %u)", maxSymbolValue+1); + /* safety checks */ - if (((size_t)workSpace & 3) != 0) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */ if (wkspSize < sizeof(HUF_buildCTable_wksp_tables)) - return ERROR(workSpace_tooSmall); + return ERROR(workSpace_tooSmall); if (maxNbBits == 0) maxNbBits = HUF_TABLELOG_DEFAULT; if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) - return ERROR(maxSymbolValue_tooLarge); + return ERROR(maxSymbolValue_tooLarge); ZSTD_memset(huffNode0, 0, sizeof(huffNodeTable)); /* sort, decreasing order */ HUF_sort(huffNode, count, maxSymbolValue, wksp_tables->rankPosition); + DEBUGLOG(6, "sorted symbols completed (%zu symbols)", showHNodeSymbols(huffNode, maxSymbolValue+1)); /* build tree */ nonNullRank = HUF_buildTree(huffNode, maxSymbolValue); - /* enforce maxTableLog */ + /* determine and enforce maxTableLog */ maxNbBits = HUF_setMaxHeight(huffNode, (U32)nonNullRank, maxNbBits); if (maxNbBits > HUF_TABLELOG_MAX) return ERROR(GENERIC); /* check fit into table */ - HUF_buildCTableFromTree(tree, huffNode, nonNullRank, maxSymbolValue, maxNbBits); + HUF_buildCTableFromTree(CTable, huffNode, nonNullRank, maxSymbolValue, maxNbBits); return maxNbBits; } size_t HUF_estimateCompressedSize(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue) { + HUF_CElt const* ct = CTable + 1; size_t nbBits = 0; int s; for (s = 0; s <= (int)maxSymbolValue; ++s) { - nbBits += CTable[s].nbBits * count[s]; + nbBits += HUF_getNbBits(ct[s]) * count[s]; } return nbBits >> 3; } int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue) { + HUF_CElt const* ct = CTable + 1; int bad = 0; int s; for (s = 0; s <= (int)maxSymbolValue; ++s) { - bad |= (count[s] != 0) & (CTable[s].nbBits == 0); + bad |= (count[s] != 0) & (HUF_getNbBits(ct[s]) == 0); } return !bad; } size_t HUF_compressBound(size_t size) { return HUF_COMPRESSBOUND(size); } -FORCE_INLINE_TEMPLATE void -HUF_encodeSymbol(BIT_CStream_t* bitCPtr, U32 symbol, const HUF_CElt* CTable) +/** HUF_CStream_t: + * Huffman uses its own BIT_CStream_t implementation. + * There are three major differences from BIT_CStream_t: + * 1. HUF_addBits() takes a HUF_CElt (size_t) which is + * the pair (nbBits, value) in the format: + * format: + * - Bits [0, 4) = nbBits + * - Bits [4, 64 - nbBits) = 0 + * - Bits [64 - nbBits, 64) = value + * 2. The bitContainer is built from the upper bits and + * right shifted. E.g. to add a new value of N bits + * you right shift the bitContainer by N, then or in + * the new value into the N upper bits. + * 3. The bitstream has two bit containers. You can add + * bits to the second container and merge them into + * the first container. + */ + +#define HUF_BITS_IN_CONTAINER (sizeof(size_t) * 8) + +typedef struct { + size_t bitContainer[2]; + size_t bitPos[2]; + + BYTE* startPtr; + BYTE* ptr; + BYTE* endPtr; +} HUF_CStream_t; + +/**! HUF_initCStream(): + * Initializes the bitstream. + * @returns 0 or an error code. + */ +static size_t HUF_initCStream(HUF_CStream_t* bitC, + void* startPtr, size_t dstCapacity) { - BIT_addBitsFast(bitCPtr, CTable[symbol].val, CTable[symbol].nbBits); + ZSTD_memset(bitC, 0, sizeof(*bitC)); + bitC->startPtr = (BYTE*)startPtr; + bitC->ptr = bitC->startPtr; + bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer[0]); + if (dstCapacity <= sizeof(bitC->bitContainer[0])) return ERROR(dstSize_tooSmall); + return 0; } -#define HUF_FLUSHBITS(s) BIT_flushBits(s) +/*! HUF_addBits(): + * Adds the symbol stored in HUF_CElt elt to the bitstream. + * + * @param elt The element we're adding. This is a (nbBits, value) pair. + * See the HUF_CStream_t docs for the format. + * @param idx Insert into the bitstream at this idx. + * @param kFast This is a template parameter. If the bitstream is guaranteed + * to have at least 4 unused bits after this call it may be 1, + * otherwise it must be 0. HUF_addBits() is faster when fast is set. + */ +FORCE_INLINE_TEMPLATE void HUF_addBits(HUF_CStream_t* bitC, HUF_CElt elt, int idx, int kFast) +{ + assert(idx <= 1); + assert(HUF_getNbBits(elt) <= HUF_TABLELOG_ABSOLUTEMAX); + /* This is efficient on x86-64 with BMI2 because shrx + * only reads the low 6 bits of the register. The compiler + * knows this and elides the mask. When fast is set, + * every operation can use the same value loaded from elt. + */ + bitC->bitContainer[idx] >>= HUF_getNbBits(elt); + bitC->bitContainer[idx] |= kFast ? HUF_getValueFast(elt) : HUF_getValue(elt); + /* We only read the low 8 bits of bitC->bitPos[idx] so it + * doesn't matter that the high bits have noise from the value. + */ + bitC->bitPos[idx] += HUF_getNbBitsFast(elt); + assert((bitC->bitPos[idx] & 0xFF) <= HUF_BITS_IN_CONTAINER); + /* The last 4-bits of elt are dirty if fast is set, + * so we must not be overwriting bits that have already been + * inserted into the bit container. + */ +#if DEBUGLEVEL >= 1 + { + size_t const nbBits = HUF_getNbBits(elt); + size_t const dirtyBits = nbBits == 0 ? 0 : ZSTD_highbit32((U32)nbBits) + 1; + (void)dirtyBits; + /* Middle bits are 0. */ + assert(((elt >> dirtyBits) << (dirtyBits + nbBits)) == 0); + /* We didn't overwrite any bits in the bit container. */ + assert(!kFast || (bitC->bitPos[idx] & 0xFF) <= HUF_BITS_IN_CONTAINER); + (void)dirtyBits; + } +#endif +} -#define HUF_FLUSHBITS_1(stream) \ - if (sizeof((stream)->bitContainer)*8 < HUF_TABLELOG_MAX*2+7) HUF_FLUSHBITS(stream) +FORCE_INLINE_TEMPLATE void HUF_zeroIndex1(HUF_CStream_t* bitC) +{ + bitC->bitContainer[1] = 0; + bitC->bitPos[1] = 0; +} + +/*! HUF_mergeIndex1() : + * Merges the bit container @ index 1 into the bit container @ index 0 + * and zeros the bit container @ index 1. + */ +FORCE_INLINE_TEMPLATE void HUF_mergeIndex1(HUF_CStream_t* bitC) +{ + assert((bitC->bitPos[1] & 0xFF) < HUF_BITS_IN_CONTAINER); + bitC->bitContainer[0] >>= (bitC->bitPos[1] & 0xFF); + bitC->bitContainer[0] |= bitC->bitContainer[1]; + bitC->bitPos[0] += bitC->bitPos[1]; + assert((bitC->bitPos[0] & 0xFF) <= HUF_BITS_IN_CONTAINER); +} + +/*! HUF_flushBits() : +* Flushes the bits in the bit container @ index 0. +* +* @post bitPos will be < 8. +* @param kFast If kFast is set then we must know a-priori that +* the bit container will not overflow. +*/ +FORCE_INLINE_TEMPLATE void HUF_flushBits(HUF_CStream_t* bitC, int kFast) +{ + /* The upper bits of bitPos are noisy, so we must mask by 0xFF. */ + size_t const nbBits = bitC->bitPos[0] & 0xFF; + size_t const nbBytes = nbBits >> 3; + /* The top nbBits bits of bitContainer are the ones we need. */ + size_t const bitContainer = bitC->bitContainer[0] >> (HUF_BITS_IN_CONTAINER - nbBits); + /* Mask bitPos to account for the bytes we consumed. */ + bitC->bitPos[0] &= 7; + assert(nbBits > 0); + assert(nbBits <= sizeof(bitC->bitContainer[0]) * 8); + assert(bitC->ptr <= bitC->endPtr); + MEM_writeLEST(bitC->ptr, bitContainer); + bitC->ptr += nbBytes; + assert(!kFast || bitC->ptr <= bitC->endPtr); + if (!kFast && bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr; + /* bitContainer doesn't need to be modified because the leftover + * bits are already the top bitPos bits. And we don't care about + * noise in the lower values. + */ +} + +/*! HUF_endMark() + * @returns The Huffman stream end mark: A 1-bit value = 1. + */ +static HUF_CElt HUF_endMark(void) +{ + HUF_CElt endMark; + HUF_setNbBits(&endMark, 1); + HUF_setValue(&endMark, 1); + return endMark; +} + +/*! HUF_closeCStream() : + * @return Size of CStream, in bytes, + * or 0 if it could not fit into dstBuffer */ +static size_t HUF_closeCStream(HUF_CStream_t* bitC) +{ + HUF_addBits(bitC, HUF_endMark(), /* idx */ 0, /* kFast */ 0); + HUF_flushBits(bitC, /* kFast */ 0); + { + size_t const nbBits = bitC->bitPos[0] & 0xFF; + if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */ + return (size_t)(bitC->ptr - bitC->startPtr) + (nbBits > 0); + } +} + +FORCE_INLINE_TEMPLATE void +HUF_encodeSymbol(HUF_CStream_t* bitCPtr, U32 symbol, const HUF_CElt* CTable, int idx, int fast) +{ + HUF_addBits(bitCPtr, CTable[symbol], idx, fast); +} + +FORCE_INLINE_TEMPLATE void +HUF_compress1X_usingCTable_internal_body_loop(HUF_CStream_t* bitC, + const BYTE* ip, size_t srcSize, + const HUF_CElt* ct, + int kUnroll, int kFastFlush, int kLastFast) +{ + /* Join to kUnroll */ + int n = (int)srcSize; + int rem = n % kUnroll; + if (rem > 0) { + for (; rem > 0; --rem) { + HUF_encodeSymbol(bitC, ip[--n], ct, 0, /* fast */ 0); + } + HUF_flushBits(bitC, kFastFlush); + } + assert(n % kUnroll == 0); + + /* Join to 2 * kUnroll */ + if (n % (2 * kUnroll)) { + int u; + for (u = 1; u < kUnroll; ++u) { + HUF_encodeSymbol(bitC, ip[n - u], ct, 0, 1); + } + HUF_encodeSymbol(bitC, ip[n - kUnroll], ct, 0, kLastFast); + HUF_flushBits(bitC, kFastFlush); + n -= kUnroll; + } + assert(n % (2 * kUnroll) == 0); + + for (; n>0; n-= 2 * kUnroll) { + /* Encode kUnroll symbols into the bitstream @ index 0. */ + int u; + for (u = 1; u < kUnroll; ++u) { + HUF_encodeSymbol(bitC, ip[n - u], ct, /* idx */ 0, /* fast */ 1); + } + HUF_encodeSymbol(bitC, ip[n - kUnroll], ct, /* idx */ 0, /* fast */ kLastFast); + HUF_flushBits(bitC, kFastFlush); + /* Encode kUnroll symbols into the bitstream @ index 1. + * This allows us to start filling the bit container + * without any data dependencies. + */ + HUF_zeroIndex1(bitC); + for (u = 1; u < kUnroll; ++u) { + HUF_encodeSymbol(bitC, ip[n - kUnroll - u], ct, /* idx */ 1, /* fast */ 1); + } + HUF_encodeSymbol(bitC, ip[n - kUnroll - kUnroll], ct, /* idx */ 1, /* fast */ kLastFast); + /* Merge bitstream @ index 1 into the bitstream @ index 0 */ + HUF_mergeIndex1(bitC); + HUF_flushBits(bitC, kFastFlush); + } + assert(n == 0); + +} + +/** + * Returns a tight upper bound on the output space needed by Huffman + * with 8 bytes buffer to handle over-writes. If the output is at least + * this large we don't need to do bounds checks during Huffman encoding. + */ +static size_t HUF_tightCompressBound(size_t srcSize, size_t tableLog) +{ + return ((srcSize * tableLog) >> 3) + 8; +} -#define HUF_FLUSHBITS_2(stream) \ - if (sizeof((stream)->bitContainer)*8 < HUF_TABLELOG_MAX*4+7) HUF_FLUSHBITS(stream) FORCE_INLINE_TEMPLATE size_t HUF_compress1X_usingCTable_internal_body(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable) { + U32 const tableLog = (U32)CTable[0]; + HUF_CElt const* ct = CTable + 1; const BYTE* ip = (const BYTE*) src; BYTE* const ostart = (BYTE*)dst; BYTE* const oend = ostart + dstSize; BYTE* op = ostart; - size_t n; - BIT_CStream_t bitC; + HUF_CStream_t bitC; /* init */ if (dstSize < 8) return 0; /* not enough space to compress */ - { size_t const initErr = BIT_initCStream(&bitC, op, (size_t)(oend-op)); + { size_t const initErr = HUF_initCStream(&bitC, op, (size_t)(oend-op)); if (HUF_isError(initErr)) return 0; } - n = srcSize & ~3; /* join to mod 4 */ - switch (srcSize & 3) - { - case 3 : HUF_encodeSymbol(&bitC, ip[n+ 2], CTable); - HUF_FLUSHBITS_2(&bitC); - /* fall-through */ - case 2 : HUF_encodeSymbol(&bitC, ip[n+ 1], CTable); - HUF_FLUSHBITS_1(&bitC); - /* fall-through */ - case 1 : HUF_encodeSymbol(&bitC, ip[n+ 0], CTable); - HUF_FLUSHBITS(&bitC); - /* fall-through */ - case 0 : /* fall-through */ - default: break; + if (dstSize < HUF_tightCompressBound(srcSize, (size_t)tableLog) || tableLog > 11) + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ MEM_32bits() ? 2 : 4, /* kFast */ 0, /* kLastFast */ 0); + else { + if (MEM_32bits()) { + switch (tableLog) { + case 11: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 2, /* kFastFlush */ 1, /* kLastFast */ 0); + break; + case 10: ZSTD_FALLTHROUGH; + case 9: ZSTD_FALLTHROUGH; + case 8: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 2, /* kFastFlush */ 1, /* kLastFast */ 1); + break; + case 7: ZSTD_FALLTHROUGH; + default: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 3, /* kFastFlush */ 1, /* kLastFast */ 1); + break; + } + } else { + switch (tableLog) { + case 11: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 5, /* kFastFlush */ 1, /* kLastFast */ 0); + break; + case 10: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 5, /* kFastFlush */ 1, /* kLastFast */ 1); + break; + case 9: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 6, /* kFastFlush */ 1, /* kLastFast */ 0); + break; + case 8: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 7, /* kFastFlush */ 1, /* kLastFast */ 0); + break; + case 7: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 8, /* kFastFlush */ 1, /* kLastFast */ 0); + break; + case 6: ZSTD_FALLTHROUGH; + default: + HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 9, /* kFastFlush */ 1, /* kLastFast */ 1); + break; + } + } } + assert(bitC.ptr <= bitC.endPtr); - for (; n>0; n-=4) { /* note : n&3==0 at this stage */ - HUF_encodeSymbol(&bitC, ip[n- 1], CTable); - HUF_FLUSHBITS_1(&bitC); - HUF_encodeSymbol(&bitC, ip[n- 2], CTable); - HUF_FLUSHBITS_2(&bitC); - HUF_encodeSymbol(&bitC, ip[n- 3], CTable); - HUF_FLUSHBITS_1(&bitC); - HUF_encodeSymbol(&bitC, ip[n- 4], CTable); - HUF_FLUSHBITS(&bitC); - } - - return BIT_closeCStream(&bitC); + return HUF_closeCStream(&bitC); } #if DYNAMIC_BMI2 -static TARGET_ATTRIBUTE("bmi2") size_t +static BMI2_TARGET_ATTRIBUTE size_t HUF_compress1X_usingCTable_internal_bmi2(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable) @@ -644,9 +1105,9 @@ HUF_compress1X_usingCTable_internal_default(void* dst, size_t dstSize, static size_t HUF_compress1X_usingCTable_internal(void* dst, size_t dstSize, const void* src, size_t srcSize, - const HUF_CElt* CTable, const int bmi2) + const HUF_CElt* CTable, const int flags) { - if (bmi2) { + if (flags & HUF_flags_bmi2) { return HUF_compress1X_usingCTable_internal_bmi2(dst, dstSize, src, srcSize, CTable); } return HUF_compress1X_usingCTable_internal_default(dst, dstSize, src, srcSize, CTable); @@ -657,24 +1118,23 @@ HUF_compress1X_usingCTable_internal(void* dst, size_t dstSize, static size_t HUF_compress1X_usingCTable_internal(void* dst, size_t dstSize, const void* src, size_t srcSize, - const HUF_CElt* CTable, const int bmi2) + const HUF_CElt* CTable, const int flags) { - (void)bmi2; + (void)flags; return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable); } #endif -size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable) +size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags) { - return HUF_compress1X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, /* bmi2 */ 0); + return HUF_compress1X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, flags); } - static size_t HUF_compress4X_usingCTable_internal(void* dst, size_t dstSize, const void* src, size_t srcSize, - const HUF_CElt* CTable, int bmi2) + const HUF_CElt* CTable, int flags) { size_t const segmentSize = (srcSize+3)/4; /* first 3 segments */ const BYTE* ip = (const BYTE*) src; @@ -688,27 +1148,24 @@ HUF_compress4X_usingCTable_internal(void* dst, size_t dstSize, op += 6; /* jumpTable */ assert(op <= oend); - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, bmi2) ); - if (cSize==0) return 0; - assert(cSize <= 65535); + { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, flags) ); + if (cSize == 0 || cSize > 65535) return 0; MEM_writeLE16(ostart, (U16)cSize); op += cSize; } ip += segmentSize; assert(op <= oend); - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, bmi2) ); - if (cSize==0) return 0; - assert(cSize <= 65535); + { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, flags) ); + if (cSize == 0 || cSize > 65535) return 0; MEM_writeLE16(ostart+2, (U16)cSize); op += cSize; } ip += segmentSize; assert(op <= oend); - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, bmi2) ); - if (cSize==0) return 0; - assert(cSize <= 65535); + { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, segmentSize, CTable, flags) ); + if (cSize == 0 || cSize > 65535) return 0; MEM_writeLE16(ostart+4, (U16)cSize); op += cSize; } @@ -716,17 +1173,17 @@ HUF_compress4X_usingCTable_internal(void* dst, size_t dstSize, ip += segmentSize; assert(op <= oend); assert(ip <= iend); - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, (size_t)(iend-ip), CTable, bmi2) ); - if (cSize==0) return 0; + { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, (size_t)(oend-op), ip, (size_t)(iend-ip), CTable, flags) ); + if (cSize == 0 || cSize > 65535) return 0; op += cSize; } return (size_t)(op-ostart); } -size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable) +size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags) { - return HUF_compress4X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, /* bmi2 */ 0); + return HUF_compress4X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, flags); } typedef enum { HUF_singleStream, HUF_fourStreams } HUF_nbStreams_e; @@ -734,11 +1191,11 @@ typedef enum { HUF_singleStream, HUF_fourStreams } HUF_nbStreams_e; static size_t HUF_compressCTable_internal( BYTE* const ostart, BYTE* op, BYTE* const oend, const void* src, size_t srcSize, - HUF_nbStreams_e nbStreams, const HUF_CElt* CTable, const int bmi2) + HUF_nbStreams_e nbStreams, const HUF_CElt* CTable, const int flags) { size_t const cSize = (nbStreams==HUF_singleStream) ? - HUF_compress1X_usingCTable_internal(op, (size_t)(oend - op), src, srcSize, CTable, bmi2) : - HUF_compress4X_usingCTable_internal(op, (size_t)(oend - op), src, srcSize, CTable, bmi2); + HUF_compress1X_usingCTable_internal(op, (size_t)(oend - op), src, srcSize, CTable, flags) : + HUF_compress4X_usingCTable_internal(op, (size_t)(oend - op), src, srcSize, CTable, flags); if (HUF_isError(cSize)) { return cSize; } if (cSize==0) { return 0; } /* uncompressible */ op += cSize; @@ -750,35 +1207,111 @@ static size_t HUF_compressCTable_internal( typedef struct { unsigned count[HUF_SYMBOLVALUE_MAX + 1]; - HUF_CElt CTable[HUF_SYMBOLVALUE_MAX + 1]; + HUF_CElt CTable[HUF_CTABLE_SIZE_ST(HUF_SYMBOLVALUE_MAX)]; union { HUF_buildCTable_wksp_tables buildCTable_wksp; HUF_WriteCTableWksp writeCTable_wksp; + U32 hist_wksp[HIST_WKSP_SIZE_U32]; } wksps; } HUF_compress_tables_t; +#define SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE 4096 +#define SUSPECT_INCOMPRESSIBLE_SAMPLE_RATIO 10 /* Must be >= 2 */ + +unsigned HUF_cardinality(const unsigned* count, unsigned maxSymbolValue) +{ + unsigned cardinality = 0; + unsigned i; + + for (i = 0; i < maxSymbolValue + 1; i++) { + if (count[i] != 0) cardinality += 1; + } + + return cardinality; +} + +unsigned HUF_minTableLog(unsigned symbolCardinality) +{ + U32 minBitsSymbols = ZSTD_highbit32(symbolCardinality) + 1; + return minBitsSymbols; +} + +unsigned HUF_optimalTableLog( + unsigned maxTableLog, + size_t srcSize, + unsigned maxSymbolValue, + void* workSpace, size_t wkspSize, + HUF_CElt* table, + const unsigned* count, + int flags) +{ + assert(srcSize > 1); /* Not supported, RLE should be used instead */ + assert(wkspSize >= sizeof(HUF_buildCTable_wksp_tables)); + + if (!(flags & HUF_flags_optimalDepth)) { + /* cheap evaluation, based on FSE */ + return FSE_optimalTableLog_internal(maxTableLog, srcSize, maxSymbolValue, 1); + } + + { BYTE* dst = (BYTE*)workSpace + sizeof(HUF_WriteCTableWksp); + size_t dstSize = wkspSize - sizeof(HUF_WriteCTableWksp); + size_t maxBits, hSize, newSize; + const unsigned symbolCardinality = HUF_cardinality(count, maxSymbolValue); + const unsigned minTableLog = HUF_minTableLog(symbolCardinality); + size_t optSize = ((size_t) ~0) - 1; + unsigned optLog = maxTableLog, optLogGuess; + + DEBUGLOG(6, "HUF_optimalTableLog: probing huf depth (srcSize=%zu)", srcSize); + + /* Search until size increases */ + for (optLogGuess = minTableLog; optLogGuess <= maxTableLog; optLogGuess++) { + DEBUGLOG(7, "checking for huffLog=%u", optLogGuess); + maxBits = HUF_buildCTable_wksp(table, count, maxSymbolValue, optLogGuess, workSpace, wkspSize); + if (ERR_isError(maxBits)) continue; + + if (maxBits < optLogGuess && optLogGuess > minTableLog) break; + + hSize = HUF_writeCTable_wksp(dst, dstSize, table, maxSymbolValue, (U32)maxBits, workSpace, wkspSize); + + if (ERR_isError(hSize)) continue; + + newSize = HUF_estimateCompressedSize(table, count, maxSymbolValue) + hSize; + + if (newSize > optSize + 1) { + break; + } + + if (newSize < optSize) { + optSize = newSize; + optLog = optLogGuess; + } + } + assert(optLog <= HUF_TABLELOG_MAX); + return optLog; + } +} + /* HUF_compress_internal() : * `workSpace_align4` must be aligned on 4-bytes boundaries, - * and occupies the same space as a table of HUF_WORKSPACE_SIZE_U32 unsigned */ + * and occupies the same space as a table of HUF_WORKSPACE_SIZE_U64 unsigned */ static size_t HUF_compress_internal (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned huffLog, HUF_nbStreams_e nbStreams, - void* workSpace_align4, size_t wkspSize, - HUF_CElt* oldHufTable, HUF_repeat* repeat, int preferRepeat, - const int bmi2) + void* workSpace, size_t wkspSize, + HUF_CElt* oldHufTable, HUF_repeat* repeat, int flags) { - HUF_compress_tables_t* const table = (HUF_compress_tables_t*)workSpace_align4; + HUF_compress_tables_t* const table = (HUF_compress_tables_t*)HUF_alignUpWorkspace(workSpace, &wkspSize, ZSTD_ALIGNOF(size_t)); BYTE* const ostart = (BYTE*)dst; BYTE* const oend = ostart + dstSize; BYTE* op = ostart; - HUF_STATIC_ASSERT(sizeof(*table) <= HUF_WORKSPACE_SIZE); - assert(((size_t)workSpace_align4 & 3) == 0); /* must be aligned on 4-bytes boundaries */ + DEBUGLOG(5, "HUF_compress_internal (srcSize=%zu)", srcSize); + HUF_STATIC_ASSERT(sizeof(*table) + HUF_WORKSPACE_MAX_ALIGNMENT <= HUF_WORKSPACE_SIZE); /* checks & inits */ - if (wkspSize < HUF_WORKSPACE_SIZE) return ERROR(workSpace_tooSmall); + if (wkspSize < sizeof(*table)) return ERROR(workSpace_tooSmall); if (!srcSize) return 0; /* Uncompressed */ if (!dstSize) return 0; /* cannot fit anything within dst budget */ if (srcSize > HUF_BLOCKSIZE_MAX) return ERROR(srcSize_wrong); /* current block size limit */ @@ -788,17 +1321,34 @@ HUF_compress_internal (void* dst, size_t dstSize, if (!huffLog) huffLog = HUF_TABLELOG_DEFAULT; /* Heuristic : If old table is valid, use it for small inputs */ - if (preferRepeat && repeat && *repeat == HUF_repeat_valid) { + if ((flags & HUF_flags_preferRepeat) && repeat && *repeat == HUF_repeat_valid) { return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, - nbStreams, oldHufTable, bmi2); + nbStreams, oldHufTable, flags); + } + + /* If uncompressible data is suspected, do a smaller sampling first */ + DEBUG_STATIC_ASSERT(SUSPECT_INCOMPRESSIBLE_SAMPLE_RATIO >= 2); + if ((flags & HUF_flags_suspectUncompressible) && srcSize >= (SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE * SUSPECT_INCOMPRESSIBLE_SAMPLE_RATIO)) { + size_t largestTotal = 0; + DEBUGLOG(5, "input suspected incompressible : sampling to check"); + { unsigned maxSymbolValueBegin = maxSymbolValue; + CHECK_V_F(largestBegin, HIST_count_simple (table->count, &maxSymbolValueBegin, (const BYTE*)src, SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE) ); + largestTotal += largestBegin; + } + { unsigned maxSymbolValueEnd = maxSymbolValue; + CHECK_V_F(largestEnd, HIST_count_simple (table->count, &maxSymbolValueEnd, (const BYTE*)src + srcSize - SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE, SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE) ); + largestTotal += largestEnd; + } + if (largestTotal <= ((2 * SUSPECT_INCOMPRESSIBLE_SAMPLE_SIZE) >> 7)+4) return 0; /* heuristic : probably not compressible enough */ } /* Scan input and build symbol stats */ - { CHECK_V_F(largest, HIST_count_wksp (table->count, &maxSymbolValue, (const BYTE*)src, srcSize, workSpace_align4, wkspSize) ); + { CHECK_V_F(largest, HIST_count_wksp (table->count, &maxSymbolValue, (const BYTE*)src, srcSize, table->wksps.hist_wksp, sizeof(table->wksps.hist_wksp)) ); if (largest == srcSize) { *ostart = ((const BYTE*)src)[0]; return 1; } /* single symbol, rle */ if (largest <= (srcSize >> 7)+4) return 0; /* heuristic : probably not compressible enough */ } + DEBUGLOG(6, "histogram detail completed (%zu symbols)", showU32(table->count, maxSymbolValue+1)); /* Check validity of previous table */ if ( repeat @@ -807,22 +1357,26 @@ HUF_compress_internal (void* dst, size_t dstSize, *repeat = HUF_repeat_none; } /* Heuristic : use existing table for small inputs */ - if (preferRepeat && repeat && *repeat != HUF_repeat_none) { + if ((flags & HUF_flags_preferRepeat) && repeat && *repeat != HUF_repeat_none) { return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, - nbStreams, oldHufTable, bmi2); + nbStreams, oldHufTable, flags); } /* Build Huffman Tree */ - huffLog = HUF_optimalTableLog(huffLog, srcSize, maxSymbolValue); + huffLog = HUF_optimalTableLog(huffLog, srcSize, maxSymbolValue, &table->wksps, sizeof(table->wksps), table->CTable, table->count, flags); { size_t const maxBits = HUF_buildCTable_wksp(table->CTable, table->count, maxSymbolValue, huffLog, &table->wksps.buildCTable_wksp, sizeof(table->wksps.buildCTable_wksp)); CHECK_F(maxBits); huffLog = (U32)maxBits; - /* Zero unused symbols in CTable, so we can check it for validity */ - ZSTD_memset(table->CTable + (maxSymbolValue + 1), 0, - sizeof(table->CTable) - ((maxSymbolValue + 1) * sizeof(HUF_CElt))); + DEBUGLOG(6, "bit distribution completed (%zu symbols)", showCTableBits(table->CTable + 1, maxSymbolValue+1)); + } + /* Zero unused symbols in CTable, so we can check it for validity */ + { + size_t const ctableSize = HUF_CTABLE_SIZE_ST(maxSymbolValue); + size_t const unusedSize = sizeof(table->CTable) - ctableSize * sizeof(HUF_CElt); + ZSTD_memset(table->CTable + ctableSize, 0, unusedSize); } /* Write table description header */ @@ -835,7 +1389,7 @@ HUF_compress_internal (void* dst, size_t dstSize, if (oldSize <= hSize + newSize || hSize + 12 >= srcSize) { return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, - nbStreams, oldHufTable, bmi2); + nbStreams, oldHufTable, flags); } } /* Use the new huffman table */ @@ -847,91 +1401,35 @@ HUF_compress_internal (void* dst, size_t dstSize, } return HUF_compressCTable_internal(ostart, op, oend, src, srcSize, - nbStreams, table->CTable, bmi2); -} - - -size_t HUF_compress1X_wksp (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog, - void* workSpace, size_t wkspSize) -{ - return HUF_compress_internal(dst, dstSize, src, srcSize, - maxSymbolValue, huffLog, HUF_singleStream, - workSpace, wkspSize, - NULL, NULL, 0, 0 /*bmi2*/); + nbStreams, table->CTable, flags); } size_t HUF_compress1X_repeat (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned huffLog, void* workSpace, size_t wkspSize, - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2) + HUF_CElt* hufTable, HUF_repeat* repeat, int flags) { + DEBUGLOG(5, "HUF_compress1X_repeat (srcSize = %zu)", srcSize); return HUF_compress_internal(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, HUF_singleStream, workSpace, wkspSize, hufTable, - repeat, preferRepeat, bmi2); -} - -/* HUF_compress4X_repeat(): - * compress input using 4 streams. - * provide workspace to generate compression tables */ -size_t HUF_compress4X_wksp (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog, - void* workSpace, size_t wkspSize) -{ - return HUF_compress_internal(dst, dstSize, src, srcSize, - maxSymbolValue, huffLog, HUF_fourStreams, - workSpace, wkspSize, - NULL, NULL, 0, 0 /*bmi2*/); + repeat, flags); } /* HUF_compress4X_repeat(): * compress input using 4 streams. + * consider skipping quickly * re-use an existing huffman compression table */ size_t HUF_compress4X_repeat (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned huffLog, void* workSpace, size_t wkspSize, - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2) + HUF_CElt* hufTable, HUF_repeat* repeat, int flags) { + DEBUGLOG(5, "HUF_compress4X_repeat (srcSize = %zu)", srcSize); return HUF_compress_internal(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, HUF_fourStreams, workSpace, wkspSize, - hufTable, repeat, preferRepeat, bmi2); + hufTable, repeat, flags); } - -#ifndef ZSTD_NO_UNUSED_FUNCTIONS -/** HUF_buildCTable() : - * @return : maxNbBits - * Note : count is used before tree is written, so they can safely overlap - */ -size_t HUF_buildCTable (HUF_CElt* tree, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits) -{ - HUF_buildCTable_wksp_tables workspace; - return HUF_buildCTable_wksp(tree, count, maxSymbolValue, maxNbBits, &workspace, sizeof(workspace)); -} - -size_t HUF_compress1X (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog) -{ - unsigned workSpace[HUF_WORKSPACE_SIZE_U32]; - return HUF_compress1X_wksp(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, workSpace, sizeof(workSpace)); -} - -size_t HUF_compress2 (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog) -{ - unsigned workSpace[HUF_WORKSPACE_SIZE_U32]; - return HUF_compress4X_wksp(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, workSpace, sizeof(workSpace)); -} - -size_t HUF_compress (void* dst, size_t maxDstSize, const void* src, size_t srcSize) -{ - return HUF_compress2(dst, maxDstSize, src, srcSize, 255, HUF_TABLELOG_DEFAULT); -} -#endif diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress.c similarity index 78% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_compress.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_compress.c index b7ee298..b55f684 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -12,12 +12,10 @@ * Dependencies ***************************************/ #include "../common/zstd_deps.h" /* INT_MAX, ZSTD_memset, ZSTD_memcpy */ -#include "../common/cpu.h" #include "../common/mem.h" #include "hist.h" /* HIST_countFast_wksp */ #define FSE_STATIC_LINKING_ONLY /* FSE_encodeSymbol */ #include "../common/fse.h" -#define HUF_STATIC_LINKING_ONLY #include "../common/huf.h" #include "zstd_compress_internal.h" #include "zstd_compress_sequences.h" @@ -28,6 +26,7 @@ #include "zstd_opt.h" #include "zstd_ldm.h" #include "zstd_compress_superblock.h" +#include "../common/bits.h" /* ZSTD_highbit32 */ /* *************************************************************** * Tuning parameters @@ -42,19 +41,34 @@ # define ZSTD_COMPRESS_HEAPMODE 0 #endif +/*! + * ZSTD_HASHLOG3_MAX : + * Maximum size of the hash table dedicated to find 3-bytes matches, + * in log format, aka 17 => 1 << 17 == 128Ki positions. + * This structure is only used in zstd_opt. + * Since allocation is centralized for all strategies, it has to be known here. + * The actual (selected) size of the hash table is then stored in ZSTD_matchState_t.hashLog3, + * so that zstd_opt.c doesn't need to know about this constant. + */ +#ifndef ZSTD_HASHLOG3_MAX +# define ZSTD_HASHLOG3_MAX 17 +#endif /*-************************************* * Helper functions ***************************************/ /* ZSTD_compressBound() - * Note that the result from this function is only compatible with the "normal" - * full-block strategy. - * When there are a lot of small blocks due to frequent flush in streaming mode - * the overhead of headers can make the compressed data to be larger than the - * return value of ZSTD_compressBound(). + * Note that the result from this function is only valid for + * the one-pass compression functions. + * When employing the streaming mode, + * if flushes are frequently altering the size of blocks, + * the overhead from block headers can make the compressed data larger + * than the return value of ZSTD_compressBound(). */ size_t ZSTD_compressBound(size_t srcSize) { - return ZSTD_COMPRESSBOUND(srcSize); + size_t const r = ZSTD_COMPRESSBOUND(srcSize); + if (r==0) return ERROR(srcSize_wrong); + return r; } @@ -72,10 +86,10 @@ struct ZSTD_CDict_s { ZSTD_customMem customMem; U32 dictID; int compressionLevel; /* 0 indicates that advanced API was used to select CDict params */ - ZSTD_useRowMatchFinderMode_e useRowMatchFinder; /* Indicates whether the CDict was created with params that would use - * row-based matchfinder. Unless the cdict is reloaded, we will use - * the same greedy/lazy matchfinder at compression time. - */ + ZSTD_paramSwitch_e useRowMatchFinder; /* Indicates whether the CDict was created with params that would use + * row-based matchfinder. Unless the cdict is reloaded, we will use + * the same greedy/lazy matchfinder at compression time. + */ }; /* typedef'd to ZSTD_CDict within "zstd.h" */ ZSTD_CCtx* ZSTD_createCCtx(void) @@ -88,7 +102,7 @@ static void ZSTD_initCCtx(ZSTD_CCtx* cctx, ZSTD_customMem memManager) assert(cctx != NULL); ZSTD_memset(cctx, 0, sizeof(*cctx)); cctx->customMem = memManager; - cctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); + cctx->bmi2 = ZSTD_cpuSupportsBmi2(); { size_t const err = ZSTD_CCtx_reset(cctx, ZSTD_reset_parameters); assert(!ZSTD_isError(err)); (void)err; @@ -166,12 +180,9 @@ size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) if (cctx==NULL) return 0; /* support free on NULL */ RETURN_ERROR_IF(cctx->staticSize, memory_allocation, "not compatible with static CCtx"); - { - int cctxInWorkspace = ZSTD_cwksp_owns_buffer(&cctx->workspace, cctx); + { int cctxInWorkspace = ZSTD_cwksp_owns_buffer(&cctx->workspace, cctx); ZSTD_freeCCtxContent(cctx); - if (!cctxInWorkspace) { - ZSTD_customFree(cctx, cctx->customMem); - } + if (!cctxInWorkspace) ZSTD_customFree(cctx, cctx->customMem); } return 0; } @@ -214,55 +225,84 @@ static int ZSTD_rowMatchFinderSupported(const ZSTD_strategy strategy) { /* Returns true if the strategy and useRowMatchFinder mode indicate that we will use the row based matchfinder * for this compression. */ -static int ZSTD_rowMatchFinderUsed(const ZSTD_strategy strategy, const ZSTD_useRowMatchFinderMode_e mode) { - assert(mode != ZSTD_urm_auto); - return ZSTD_rowMatchFinderSupported(strategy) && (mode == ZSTD_urm_enableRowMatchFinder); +static int ZSTD_rowMatchFinderUsed(const ZSTD_strategy strategy, const ZSTD_paramSwitch_e mode) { + assert(mode != ZSTD_ps_auto); + return ZSTD_rowMatchFinderSupported(strategy) && (mode == ZSTD_ps_enable); } -/* Returns row matchfinder usage enum given an initial mode and cParams */ -static ZSTD_useRowMatchFinderMode_e ZSTD_resolveRowMatchFinderMode(ZSTD_useRowMatchFinderMode_e mode, - const ZSTD_compressionParameters* const cParams) { -#if !defined(ZSTD_NO_INTRINSICS) && (defined(__SSE2__) || defined(__ARM_NEON)) +/* Returns row matchfinder usage given an initial mode and cParams */ +static ZSTD_paramSwitch_e ZSTD_resolveRowMatchFinderMode(ZSTD_paramSwitch_e mode, + const ZSTD_compressionParameters* const cParams) { +#if defined(ZSTD_ARCH_X86_SSE2) || defined(ZSTD_ARCH_ARM_NEON) int const kHasSIMD128 = 1; #else int const kHasSIMD128 = 0; #endif - if (mode != ZSTD_urm_auto) return mode; /* if requested enabled, but no SIMD, we still will use row matchfinder */ - mode = ZSTD_urm_disableRowMatchFinder; + if (mode != ZSTD_ps_auto) return mode; /* if requested enabled, but no SIMD, we still will use row matchfinder */ + mode = ZSTD_ps_disable; if (!ZSTD_rowMatchFinderSupported(cParams->strategy)) return mode; if (kHasSIMD128) { - if (cParams->windowLog > 14) mode = ZSTD_urm_enableRowMatchFinder; + if (cParams->windowLog > 14) mode = ZSTD_ps_enable; } else { - if (cParams->windowLog > 17) mode = ZSTD_urm_enableRowMatchFinder; + if (cParams->windowLog > 17) mode = ZSTD_ps_enable; } return mode; } +/* Returns block splitter usage (generally speaking, when using slower/stronger compression modes) */ +static ZSTD_paramSwitch_e ZSTD_resolveBlockSplitterMode(ZSTD_paramSwitch_e mode, + const ZSTD_compressionParameters* const cParams) { + if (mode != ZSTD_ps_auto) return mode; + return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 17) ? ZSTD_ps_enable : ZSTD_ps_disable; +} + /* Returns 1 if the arguments indicate that we should allocate a chainTable, 0 otherwise */ static int ZSTD_allocateChainTable(const ZSTD_strategy strategy, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const U32 forDDSDict) { - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); /* We always should allocate a chaintable if we are allocating a matchstate for a DDS dictionary matchstate. * We do not allocate a chaintable if we are using ZSTD_fast, or are using the row-based matchfinder. */ return forDDSDict || ((strategy != ZSTD_fast) && !ZSTD_rowMatchFinderUsed(strategy, useRowMatchFinder)); } -/* Returns 1 if compression parameters are such that we should +/* Returns ZSTD_ps_enable if compression parameters are such that we should * enable long distance matching (wlog >= 27, strategy >= btopt). - * Returns 0 otherwise. + * Returns ZSTD_ps_disable otherwise. */ -static U32 ZSTD_CParams_shouldEnableLdm(const ZSTD_compressionParameters* const cParams) { - return cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27; +static ZSTD_paramSwitch_e ZSTD_resolveEnableLdm(ZSTD_paramSwitch_e mode, + const ZSTD_compressionParameters* const cParams) { + if (mode != ZSTD_ps_auto) return mode; + return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27) ? ZSTD_ps_enable : ZSTD_ps_disable; } -/* Returns 1 if compression parameters are such that we should - * enable blockSplitter (wlog >= 17, strategy >= btopt). - * Returns 0 otherwise. - */ -static U32 ZSTD_CParams_useBlockSplitter(const ZSTD_compressionParameters* const cParams) { - return cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 17; +static int ZSTD_resolveExternalSequenceValidation(int mode) { + return mode; +} + +/* Resolves maxBlockSize to the default if no value is present. */ +static size_t ZSTD_resolveMaxBlockSize(size_t maxBlockSize) { + if (maxBlockSize == 0) { + return ZSTD_BLOCKSIZE_MAX; + } else { + return maxBlockSize; + } +} + +static ZSTD_paramSwitch_e ZSTD_resolveExternalRepcodeSearch(ZSTD_paramSwitch_e value, int cLevel) { + if (value != ZSTD_ps_auto) return value; + if (cLevel < 10) { + return ZSTD_ps_disable; + } else { + return ZSTD_ps_enable; + } +} + +/* Returns 1 if compression parameters are such that CDict hashtable and chaintable indices are tagged. + * If so, the tags need to be removed in ZSTD_resetCCtx_byCopyingCDict. */ +static int ZSTD_CDictIndicesAreTagged(const ZSTD_compressionParameters* const cParams) { + return cParams->strategy == ZSTD_fast || cParams->strategy == ZSTD_dfast; } static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams( @@ -274,21 +314,18 @@ static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams( cctxParams.cParams = cParams; /* Adjust advanced params according to cParams */ - if (ZSTD_CParams_shouldEnableLdm(&cParams)) { - DEBUGLOG(4, "ZSTD_makeCCtxParamsFromCParams(): Including LDM into cctx params"); - cctxParams.ldmParams.enableLdm = 1; - /* LDM is enabled by default for optimal parser and window size >= 128MB */ + cctxParams.ldmParams.enableLdm = ZSTD_resolveEnableLdm(cctxParams.ldmParams.enableLdm, &cParams); + if (cctxParams.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_ldm_adjustParameters(&cctxParams.ldmParams, &cParams); assert(cctxParams.ldmParams.hashLog >= cctxParams.ldmParams.bucketSizeLog); assert(cctxParams.ldmParams.hashRateLog < 32); } - - if (ZSTD_CParams_useBlockSplitter(&cParams)) { - DEBUGLOG(4, "ZSTD_makeCCtxParamsFromCParams(): Including block splitting into cctx params"); - cctxParams.splitBlocks = 1; - } - + cctxParams.useBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams.useBlockSplitter, &cParams); cctxParams.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams.useRowMatchFinder, &cParams); + cctxParams.validateSequences = ZSTD_resolveExternalSequenceValidation(cctxParams.validateSequences); + cctxParams.maxBlockSize = ZSTD_resolveMaxBlockSize(cctxParams.maxBlockSize); + cctxParams.searchForExternalRepcodes = ZSTD_resolveExternalRepcodeSearch(cctxParams.searchForExternalRepcodes, + cctxParams.compressionLevel); assert(!ZSTD_checkCParams(cParams)); return cctxParams; } @@ -334,10 +371,13 @@ size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel) #define ZSTD_NO_CLEVEL 0 /** - * Initializes the cctxParams from params and compressionLevel. + * Initializes `cctxParams` from `params` and `compressionLevel`. * @param compressionLevel If params are derived from a compression level then that compression level, otherwise ZSTD_NO_CLEVEL. */ -static void ZSTD_CCtxParams_init_internal(ZSTD_CCtx_params* cctxParams, ZSTD_parameters const* params, int compressionLevel) +static void +ZSTD_CCtxParams_init_internal(ZSTD_CCtx_params* cctxParams, + const ZSTD_parameters* params, + int compressionLevel) { assert(!ZSTD_checkCParams(params->cParams)); ZSTD_memset(cctxParams, 0, sizeof(*cctxParams)); @@ -348,7 +388,13 @@ static void ZSTD_CCtxParams_init_internal(ZSTD_CCtx_params* cctxParams, ZSTD_par */ cctxParams->compressionLevel = compressionLevel; cctxParams->useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams->useRowMatchFinder, ¶ms->cParams); - DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d", cctxParams->useRowMatchFinder); + cctxParams->useBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams->useBlockSplitter, ¶ms->cParams); + cctxParams->ldmParams.enableLdm = ZSTD_resolveEnableLdm(cctxParams->ldmParams.enableLdm, ¶ms->cParams); + cctxParams->validateSequences = ZSTD_resolveExternalSequenceValidation(cctxParams->validateSequences); + cctxParams->maxBlockSize = ZSTD_resolveMaxBlockSize(cctxParams->maxBlockSize); + cctxParams->searchForExternalRepcodes = ZSTD_resolveExternalRepcodeSearch(cctxParams->searchForExternalRepcodes, compressionLevel); + DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d, useBlockSplitter=%d ldm=%d", + cctxParams->useRowMatchFinder, cctxParams->useBlockSplitter, cctxParams->ldmParams.enableLdm); } size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params) @@ -361,7 +407,7 @@ size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_paramete /** * Sets cctxParams' cParams and fParams from params, but otherwise leaves them alone. - * @param param Validated zstd parameters. + * @param params Validated zstd parameters. */ static void ZSTD_CCtxParams_setZstdParams( ZSTD_CCtx_params* cctxParams, const ZSTD_parameters* params) @@ -470,8 +516,8 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param) return bounds; case ZSTD_c_enableLongDistanceMatching: - bounds.lowerBound = 0; - bounds.upperBound = 1; + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; return bounds; case ZSTD_c_ldmHashLog: @@ -518,9 +564,9 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param) return bounds; case ZSTD_c_literalCompressionMode: - ZSTD_STATIC_ASSERT(ZSTD_lcm_auto < ZSTD_lcm_huffman && ZSTD_lcm_huffman < ZSTD_lcm_uncompressed); - bounds.lowerBound = ZSTD_lcm_auto; - bounds.upperBound = ZSTD_lcm_uncompressed; + ZSTD_STATIC_ASSERT(ZSTD_ps_auto < ZSTD_ps_enable && ZSTD_ps_enable < ZSTD_ps_disable); + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; return bounds; case ZSTD_c_targetCBlockSize: @@ -549,14 +595,14 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param) bounds.upperBound = 1; return bounds; - case ZSTD_c_splitBlocks: - bounds.lowerBound = 0; - bounds.upperBound = 1; + case ZSTD_c_useBlockSplitter: + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; return bounds; case ZSTD_c_useRowMatchFinder: - bounds.lowerBound = (int)ZSTD_urm_auto; - bounds.upperBound = (int)ZSTD_urm_enableRowMatchFinder; + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; return bounds; case ZSTD_c_deterministicRefPrefix: @@ -564,6 +610,26 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param) bounds.upperBound = 1; return bounds; + case ZSTD_c_prefetchCDictTables: + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; + return bounds; + + case ZSTD_c_enableSeqProducerFallback: + bounds.lowerBound = 0; + bounds.upperBound = 1; + return bounds; + + case ZSTD_c_maxBlockSize: + bounds.lowerBound = ZSTD_BLOCKSIZE_MAX_MIN; + bounds.upperBound = ZSTD_BLOCKSIZE_MAX; + return bounds; + + case ZSTD_c_searchForExternalRepcodes: + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; + return bounds; + default: bounds.error = ERROR(parameter_unsupported); return bounds; @@ -625,9 +691,13 @@ static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param) case ZSTD_c_stableOutBuffer: case ZSTD_c_blockDelimiters: case ZSTD_c_validateSequences: - case ZSTD_c_splitBlocks: + case ZSTD_c_useBlockSplitter: case ZSTD_c_useRowMatchFinder: case ZSTD_c_deterministicRefPrefix: + case ZSTD_c_prefetchCDictTables: + case ZSTD_c_enableSeqProducerFallback: + case ZSTD_c_maxBlockSize: + case ZSTD_c_searchForExternalRepcodes: default: return 0; } @@ -640,7 +710,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value) if (ZSTD_isUpdateAuthorized(param)) { cctx->cParamsChanged = 1; } else { - RETURN_ERROR(stage_wrong, "can only set params in ctx init stage"); + RETURN_ERROR(stage_wrong, "can only set params in cctx init stage"); } } switch(param) @@ -680,9 +750,13 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value) case ZSTD_c_stableOutBuffer: case ZSTD_c_blockDelimiters: case ZSTD_c_validateSequences: - case ZSTD_c_splitBlocks: + case ZSTD_c_useBlockSplitter: case ZSTD_c_useRowMatchFinder: case ZSTD_c_deterministicRefPrefix: + case ZSTD_c_prefetchCDictTables: + case ZSTD_c_enableSeqProducerFallback: + case ZSTD_c_maxBlockSize: + case ZSTD_c_searchForExternalRepcodes: break; default: RETURN_ERROR(parameter_unsupported, "unknown parameter"); @@ -738,12 +812,12 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, case ZSTD_c_minMatch : if (value!=0) /* 0 => use default */ BOUNDCHECK(ZSTD_c_minMatch, value); - CCtxParams->cParams.minMatch = value; + CCtxParams->cParams.minMatch = (U32)value; return CCtxParams->cParams.minMatch; case ZSTD_c_targetLength : BOUNDCHECK(ZSTD_c_targetLength, value); - CCtxParams->cParams.targetLength = value; + CCtxParams->cParams.targetLength = (U32)value; return CCtxParams->cParams.targetLength; case ZSTD_c_strategy : @@ -756,12 +830,12 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, /* Content size written in frame header _when known_ (default:1) */ DEBUGLOG(4, "set content size flag = %u", (value!=0)); CCtxParams->fParams.contentSizeFlag = value != 0; - return CCtxParams->fParams.contentSizeFlag; + return (size_t)CCtxParams->fParams.contentSizeFlag; case ZSTD_c_checksumFlag : /* A 32-bits content checksum will be calculated and written at end of frame (default:0) */ CCtxParams->fParams.checksumFlag = value != 0; - return CCtxParams->fParams.checksumFlag; + return (size_t)CCtxParams->fParams.checksumFlag; case ZSTD_c_dictIDFlag : /* When applicable, dictionary's dictID is provided in frame header (default:1) */ DEBUGLOG(4, "set dictIDFlag = %u", (value!=0)); @@ -770,18 +844,18 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, case ZSTD_c_forceMaxWindow : CCtxParams->forceWindow = (value != 0); - return CCtxParams->forceWindow; + return (size_t)CCtxParams->forceWindow; case ZSTD_c_forceAttachDict : { const ZSTD_dictAttachPref_e pref = (ZSTD_dictAttachPref_e)value; - BOUNDCHECK(ZSTD_c_forceAttachDict, pref); + BOUNDCHECK(ZSTD_c_forceAttachDict, (int)pref); CCtxParams->attachDictPref = pref; return CCtxParams->attachDictPref; } case ZSTD_c_literalCompressionMode : { - const ZSTD_literalCompressionMode_e lcm = (ZSTD_literalCompressionMode_e)value; - BOUNDCHECK(ZSTD_c_literalCompressionMode, lcm); + const ZSTD_paramSwitch_e lcm = (ZSTD_paramSwitch_e)value; + BOUNDCHECK(ZSTD_c_literalCompressionMode, (int)lcm); CCtxParams->literalCompressionMode = lcm; return CCtxParams->literalCompressionMode; } @@ -832,47 +906,48 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, case ZSTD_c_enableDedicatedDictSearch : CCtxParams->enableDedicatedDictSearch = (value!=0); - return CCtxParams->enableDedicatedDictSearch; + return (size_t)CCtxParams->enableDedicatedDictSearch; case ZSTD_c_enableLongDistanceMatching : - CCtxParams->ldmParams.enableLdm = (value!=0); + BOUNDCHECK(ZSTD_c_enableLongDistanceMatching, value); + CCtxParams->ldmParams.enableLdm = (ZSTD_paramSwitch_e)value; return CCtxParams->ldmParams.enableLdm; case ZSTD_c_ldmHashLog : if (value!=0) /* 0 ==> auto */ BOUNDCHECK(ZSTD_c_ldmHashLog, value); - CCtxParams->ldmParams.hashLog = value; + CCtxParams->ldmParams.hashLog = (U32)value; return CCtxParams->ldmParams.hashLog; case ZSTD_c_ldmMinMatch : if (value!=0) /* 0 ==> default */ BOUNDCHECK(ZSTD_c_ldmMinMatch, value); - CCtxParams->ldmParams.minMatchLength = value; + CCtxParams->ldmParams.minMatchLength = (U32)value; return CCtxParams->ldmParams.minMatchLength; case ZSTD_c_ldmBucketSizeLog : if (value!=0) /* 0 ==> default */ BOUNDCHECK(ZSTD_c_ldmBucketSizeLog, value); - CCtxParams->ldmParams.bucketSizeLog = value; + CCtxParams->ldmParams.bucketSizeLog = (U32)value; return CCtxParams->ldmParams.bucketSizeLog; case ZSTD_c_ldmHashRateLog : - RETURN_ERROR_IF(value > ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN, - parameter_outOfBound, "Param out of bounds!"); - CCtxParams->ldmParams.hashRateLog = value; + if (value!=0) /* 0 ==> default */ + BOUNDCHECK(ZSTD_c_ldmHashRateLog, value); + CCtxParams->ldmParams.hashRateLog = (U32)value; return CCtxParams->ldmParams.hashRateLog; case ZSTD_c_targetCBlockSize : if (value!=0) /* 0 ==> default */ BOUNDCHECK(ZSTD_c_targetCBlockSize, value); - CCtxParams->targetCBlockSize = value; + CCtxParams->targetCBlockSize = (U32)value; return CCtxParams->targetCBlockSize; case ZSTD_c_srcSizeHint : if (value!=0) /* 0 ==> default */ BOUNDCHECK(ZSTD_c_srcSizeHint, value); CCtxParams->srcSizeHint = value; - return CCtxParams->srcSizeHint; + return (size_t)CCtxParams->srcSizeHint; case ZSTD_c_stableInBuffer: BOUNDCHECK(ZSTD_c_stableInBuffer, value); @@ -894,14 +969,14 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, CCtxParams->validateSequences = value; return CCtxParams->validateSequences; - case ZSTD_c_splitBlocks: - BOUNDCHECK(ZSTD_c_splitBlocks, value); - CCtxParams->splitBlocks = value; - return CCtxParams->splitBlocks; + case ZSTD_c_useBlockSplitter: + BOUNDCHECK(ZSTD_c_useBlockSplitter, value); + CCtxParams->useBlockSplitter = (ZSTD_paramSwitch_e)value; + return CCtxParams->useBlockSplitter; case ZSTD_c_useRowMatchFinder: BOUNDCHECK(ZSTD_c_useRowMatchFinder, value); - CCtxParams->useRowMatchFinder = (ZSTD_useRowMatchFinderMode_e)value; + CCtxParams->useRowMatchFinder = (ZSTD_paramSwitch_e)value; return CCtxParams->useRowMatchFinder; case ZSTD_c_deterministicRefPrefix: @@ -909,6 +984,27 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, CCtxParams->deterministicRefPrefix = !!value; return CCtxParams->deterministicRefPrefix; + case ZSTD_c_prefetchCDictTables: + BOUNDCHECK(ZSTD_c_prefetchCDictTables, value); + CCtxParams->prefetchCDictTables = (ZSTD_paramSwitch_e)value; + return CCtxParams->prefetchCDictTables; + + case ZSTD_c_enableSeqProducerFallback: + BOUNDCHECK(ZSTD_c_enableSeqProducerFallback, value); + CCtxParams->enableMatchFinderFallback = value; + return CCtxParams->enableMatchFinderFallback; + + case ZSTD_c_maxBlockSize: + if (value!=0) /* 0 ==> default */ + BOUNDCHECK(ZSTD_c_maxBlockSize, value); + CCtxParams->maxBlockSize = value; + return CCtxParams->maxBlockSize; + + case ZSTD_c_searchForExternalRepcodes: + BOUNDCHECK(ZSTD_c_searchForExternalRepcodes, value); + CCtxParams->searchForExternalRepcodes = (ZSTD_paramSwitch_e)value; + return CCtxParams->searchForExternalRepcodes; + default: RETURN_ERROR(parameter_unsupported, "unknown parameter"); } } @@ -1032,8 +1128,8 @@ size_t ZSTD_CCtxParams_getParameter( case ZSTD_c_validateSequences : *value = (int)CCtxParams->validateSequences; break; - case ZSTD_c_splitBlocks : - *value = (int)CCtxParams->splitBlocks; + case ZSTD_c_useBlockSplitter : + *value = (int)CCtxParams->useBlockSplitter; break; case ZSTD_c_useRowMatchFinder : *value = (int)CCtxParams->useRowMatchFinder; @@ -1041,6 +1137,18 @@ size_t ZSTD_CCtxParams_getParameter( case ZSTD_c_deterministicRefPrefix: *value = (int)CCtxParams->deterministicRefPrefix; break; + case ZSTD_c_prefetchCDictTables: + *value = (int)CCtxParams->prefetchCDictTables; + break; + case ZSTD_c_enableSeqProducerFallback: + *value = CCtxParams->enableMatchFinderFallback; + break; + case ZSTD_c_maxBlockSize: + *value = (int)CCtxParams->maxBlockSize; + break; + case ZSTD_c_searchForExternalRepcodes: + *value = (int)CCtxParams->searchForExternalRepcodes; + break; default: RETURN_ERROR(parameter_unsupported, "unknown parameter"); } return 0; @@ -1067,9 +1175,24 @@ size_t ZSTD_CCtx_setParametersUsingCCtxParams( return 0; } -ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize) +size_t ZSTD_CCtx_setCParams(ZSTD_CCtx* cctx, ZSTD_compressionParameters cparams) { - DEBUGLOG(4, "ZSTD_CCtx_setPledgedSrcSize to %u bytes", (U32)pledgedSrcSize); + DEBUGLOG(4, "ZSTD_CCtx_setCParams"); + assert(cctx != NULL); + if (cctx->streamStage != zcss_init) { + /* All parameters in @cparams are allowed to be updated during MT compression. + * This must be signaled, so that MT compression picks up the changes */ + cctx->cParamsChanged = 1; + } + /* only update if parameters are valid */ + FORWARD_IF_ERROR(ZSTD_checkCParams(cparams), ""); + cctx->requestedParams.cParams = cparams; + return 0; +} + +size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize) +{ + DEBUGLOG(4, "ZSTD_CCtx_setPledgedSrcSize to %llu bytes", pledgedSrcSize); RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong, "Can't set pledgedSrcSize when not in init stage."); cctx->pledgedSrcSizePlusOne = pledgedSrcSize+1; @@ -1147,14 +1270,14 @@ size_t ZSTD_CCtx_loadDictionary_advanced( return 0; } -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference( +size_t ZSTD_CCtx_loadDictionary_byReference( ZSTD_CCtx* cctx, const void* dict, size_t dictSize) { return ZSTD_CCtx_loadDictionary_advanced( cctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto); } -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize) +size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize) { return ZSTD_CCtx_loadDictionary_advanced( cctx, dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto); @@ -1212,6 +1335,7 @@ size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset) RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong, "Can't reset parameters only when not in init stage."); ZSTD_clearAllDicts(cctx); + ZSTD_memset(&cctx->externalMatchCtx, 0, sizeof(cctx->externalMatchCtx)); return ZSTD_CCtxParams_reset(&cctx->requestedParams); } return 0; @@ -1308,7 +1432,8 @@ static ZSTD_compressionParameters ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize, - ZSTD_cParamMode_e mode) + ZSTD_cParamMode_e mode, + ZSTD_paramSwitch_e useRowMatchFinder) { const U64 minSrcSize = 513; /* (1<<9) + 1 */ const U64 maxWindowResize = 1ULL << (ZSTD_WINDOWLOG_MAX-1); @@ -1324,7 +1449,7 @@ ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar, break; case ZSTD_cpm_createCDict: /* Assume a small source size when creating a dictionary - * with an unkown source size. + * with an unknown source size. */ if (dictSize && srcSize == ZSTD_CONTENTSIZE_UNKNOWN) srcSize = minSrcSize; @@ -1342,8 +1467,8 @@ ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar, } /* resize windowLog if input is small enough, to use less memory */ - if ( (srcSize < maxWindowResize) - && (dictSize < maxWindowResize) ) { + if ( (srcSize <= maxWindowResize) + && (dictSize <= maxWindowResize) ) { U32 const tSize = (U32)(srcSize + dictSize); static U32 const hashSizeMin = 1 << ZSTD_HASHLOG_MIN; U32 const srcLog = (tSize < hashSizeMin) ? ZSTD_HASHLOG_MIN : @@ -1361,6 +1486,42 @@ ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar, if (cPar.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN) cPar.windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN; /* minimum wlog required for valid frame header */ + /* We can't use more than 32 bits of hash in total, so that means that we require: + * (hashLog + 8) <= 32 && (chainLog + 8) <= 32 + */ + if (mode == ZSTD_cpm_createCDict && ZSTD_CDictIndicesAreTagged(&cPar)) { + U32 const maxShortCacheHashLog = 32 - ZSTD_SHORT_CACHE_TAG_BITS; + if (cPar.hashLog > maxShortCacheHashLog) { + cPar.hashLog = maxShortCacheHashLog; + } + if (cPar.chainLog > maxShortCacheHashLog) { + cPar.chainLog = maxShortCacheHashLog; + } + } + + + /* At this point, we aren't 100% sure if we are using the row match finder. + * Unless it is explicitly disabled, conservatively assume that it is enabled. + * In this case it will only be disabled for small sources, so shrinking the + * hash log a little bit shouldn't result in any ratio loss. + */ + if (useRowMatchFinder == ZSTD_ps_auto) + useRowMatchFinder = ZSTD_ps_enable; + + /* We can't hash more than 32-bits in total. So that means that we require: + * (hashLog - rowLog + 8) <= 32 + */ + if (ZSTD_rowMatchFinderUsed(cPar.strategy, useRowMatchFinder)) { + /* Switch to 32-entry rows if searchLog is 5 (or more) */ + U32 const rowLog = BOUNDED(4, cPar.searchLog, 6); + U32 const maxRowHashLog = 32 - ZSTD_ROW_HASH_TAG_BITS; + U32 const maxHashLog = maxRowHashLog + rowLog; + assert(cPar.hashLog >= rowLog); + if (cPar.hashLog > maxHashLog) { + cPar.hashLog = maxHashLog; + } + } + return cPar; } @@ -1371,7 +1532,7 @@ ZSTD_adjustCParams(ZSTD_compressionParameters cPar, { cPar = ZSTD_clampCParams(cPar); /* resulting cPar is necessarily valid (all parameters within range) */ if (srcSize == 0) srcSize = ZSTD_CONTENTSIZE_UNKNOWN; - return ZSTD_adjustCParams_internal(cPar, srcSize, dictSize, ZSTD_cpm_unknown); + return ZSTD_adjustCParams_internal(cPar, srcSize, dictSize, ZSTD_cpm_unknown, ZSTD_ps_auto); } static ZSTD_compressionParameters ZSTD_getCParams_internal(int compressionLevel, unsigned long long srcSizeHint, size_t dictSize, ZSTD_cParamMode_e mode); @@ -1398,16 +1559,16 @@ ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams( srcSizeHint = CCtxParams->srcSizeHint; } cParams = ZSTD_getCParams_internal(CCtxParams->compressionLevel, srcSizeHint, dictSize, mode); - if (CCtxParams->ldmParams.enableLdm) cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG; + if (CCtxParams->ldmParams.enableLdm == ZSTD_ps_enable) cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG; ZSTD_overrideCParams(&cParams, &CCtxParams->cParams); assert(!ZSTD_checkCParams(cParams)); /* srcSizeHint == 0 means 0 */ - return ZSTD_adjustCParams_internal(cParams, srcSizeHint, dictSize, mode); + return ZSTD_adjustCParams_internal(cParams, srcSizeHint, dictSize, mode, CCtxParams->useRowMatchFinder); } static size_t ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const U32 enableDedicatedDictSearch, const U32 forCCtx) { @@ -1440,26 +1601,34 @@ ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams, /* tables are guaranteed to be sized in multiples of 64 bytes (or 16 uint32_t) */ ZSTD_STATIC_ASSERT(ZSTD_HASHLOG_MIN >= 4 && ZSTD_WINDOWLOG_MIN >= 4 && ZSTD_CHAINLOG_MIN >= 4); - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); DEBUGLOG(4, "chainSize: %u - hSize: %u - h3Size: %u", (U32)chainSize, (U32)hSize, (U32)h3Size); return tableSpace + optSpace + slackSpace + lazyAdditionalSpace; } +/* Helper function for calculating memory requirements. + * Gives a tighter bound than ZSTD_sequenceBound() by taking minMatch into account. */ +static size_t ZSTD_maxNbSeq(size_t blockSize, unsigned minMatch, int useSequenceProducer) { + U32 const divider = (minMatch==3 || useSequenceProducer) ? 3 : 4; + return blockSize / divider; +} + static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal( const ZSTD_compressionParameters* cParams, const ldmParams_t* ldmParams, const int isStatic, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const size_t buffInSize, const size_t buffOutSize, - const U64 pledgedSrcSize) + const U64 pledgedSrcSize, + int useSequenceProducer, + size_t maxBlockSize) { - size_t const windowSize = MAX(1, (size_t)MIN(((U64)1 << cParams->windowLog), pledgedSrcSize)); - size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, windowSize); - U32 const divider = (cParams->minMatch==3) ? 3 : 4; - size_t const maxNbSeq = blockSize / divider; + size_t const windowSize = (size_t) BOUNDED(1ULL, 1ULL << cParams->windowLog, pledgedSrcSize); + size_t const blockSize = MIN(ZSTD_resolveMaxBlockSize(maxBlockSize), windowSize); + size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, cParams->minMatch, useSequenceProducer); size_t const tokenSpace = ZSTD_cwksp_alloc_size(WILDCOPY_OVERLENGTH + blockSize) + ZSTD_cwksp_aligned_alloc_size(maxNbSeq * sizeof(seqDef)) + 3 * ZSTD_cwksp_alloc_size(maxNbSeq * sizeof(BYTE)); @@ -1469,7 +1638,7 @@ static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal( size_t const ldmSpace = ZSTD_ldm_getTableSize(*ldmParams); size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(*ldmParams, blockSize); - size_t const ldmSeqSpace = ldmParams->enableLdm ? + size_t const ldmSeqSpace = ldmParams->enableLdm == ZSTD_ps_enable ? ZSTD_cwksp_aligned_alloc_size(maxNbLdmSeq * sizeof(rawSeq)) : 0; @@ -1478,6 +1647,11 @@ static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal( size_t const cctxSpace = isStatic ? ZSTD_cwksp_alloc_size(sizeof(ZSTD_CCtx)) : 0; + size_t const maxNbExternalSeq = ZSTD_sequenceBound(blockSize); + size_t const externalSeqSpace = useSequenceProducer + ? ZSTD_cwksp_aligned_alloc_size(maxNbExternalSeq * sizeof(ZSTD_Sequence)) + : 0; + size_t const neededSpace = cctxSpace + entropySpace + @@ -1486,7 +1660,8 @@ static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal( ldmSeqSpace + matchStateSize + tokenSpace + - bufferSpace; + bufferSpace + + externalSeqSpace; DEBUGLOG(5, "estimate workspace : %u", (U32)neededSpace); return neededSpace; @@ -1496,15 +1671,15 @@ size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params) { ZSTD_compressionParameters const cParams = ZSTD_getCParamsFromCCtxParams(params, ZSTD_CONTENTSIZE_UNKNOWN, 0, ZSTD_cpm_noAttachDict); - ZSTD_useRowMatchFinderMode_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, - &cParams); + ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, + &cParams); RETURN_ERROR_IF(params->nbWorkers > 0, GENERIC, "Estimate CCtx size is supported for single-threaded compression only."); /* estimateCCtxSize is for one-shot compression. So no buffers should * be needed. However, we still allocate two 0-sized buffers, which can * take space under ASAN. */ return ZSTD_estimateCCtxSize_usingCCtxParams_internal( - &cParams, ¶ms->ldmParams, 1, useRowMatchFinder, 0, 0, ZSTD_CONTENTSIZE_UNKNOWN); + &cParams, ¶ms->ldmParams, 1, useRowMatchFinder, 0, 0, ZSTD_CONTENTSIZE_UNKNOWN, params->useSequenceProducer, params->maxBlockSize); } size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams) @@ -1514,9 +1689,9 @@ size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams) /* Pick bigger of not using and using row-based matchfinder for greedy and lazy strategies */ size_t noRowCCtxSize; size_t rowCCtxSize; - initialParams.useRowMatchFinder = ZSTD_urm_disableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_disable; noRowCCtxSize = ZSTD_estimateCCtxSize_usingCCtxParams(&initialParams); - initialParams.useRowMatchFinder = ZSTD_urm_enableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_enable; rowCCtxSize = ZSTD_estimateCCtxSize_usingCCtxParams(&initialParams); return MAX(noRowCCtxSize, rowCCtxSize); } else { @@ -1554,18 +1729,18 @@ size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params) RETURN_ERROR_IF(params->nbWorkers > 0, GENERIC, "Estimate CCtx size is supported for single-threaded compression only."); { ZSTD_compressionParameters const cParams = ZSTD_getCParamsFromCCtxParams(params, ZSTD_CONTENTSIZE_UNKNOWN, 0, ZSTD_cpm_noAttachDict); - size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, (size_t)1 << cParams.windowLog); + size_t const blockSize = MIN(ZSTD_resolveMaxBlockSize(params->maxBlockSize), (size_t)1 << cParams.windowLog); size_t const inBuffSize = (params->inBufferMode == ZSTD_bm_buffered) ? ((size_t)1 << cParams.windowLog) + blockSize : 0; size_t const outBuffSize = (params->outBufferMode == ZSTD_bm_buffered) ? ZSTD_compressBound(blockSize) + 1 : 0; - ZSTD_useRowMatchFinderMode_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, ¶ms->cParams); + ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, ¶ms->cParams); return ZSTD_estimateCCtxSize_usingCCtxParams_internal( &cParams, ¶ms->ldmParams, 1, useRowMatchFinder, inBuffSize, outBuffSize, - ZSTD_CONTENTSIZE_UNKNOWN); + ZSTD_CONTENTSIZE_UNKNOWN, params->useSequenceProducer, params->maxBlockSize); } } @@ -1576,9 +1751,9 @@ size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams) /* Pick bigger of not using and using row-based matchfinder for greedy and lazy strategies */ size_t noRowCCtxSize; size_t rowCCtxSize; - initialParams.useRowMatchFinder = ZSTD_urm_disableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_disable; noRowCCtxSize = ZSTD_estimateCStreamSize_usingCCtxParams(&initialParams); - initialParams.useRowMatchFinder = ZSTD_urm_enableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_enable; rowCCtxSize = ZSTD_estimateCStreamSize_usingCCtxParams(&initialParams); return MAX(noRowCCtxSize, rowCCtxSize); } else { @@ -1713,7 +1888,7 @@ static size_t ZSTD_reset_matchState(ZSTD_matchState_t* ms, ZSTD_cwksp* ws, const ZSTD_compressionParameters* cParams, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const ZSTD_compResetPolicy_e crp, const ZSTD_indexResetPolicy_e forceResetIndex, const ZSTD_resetTarget_e forWho) @@ -1728,7 +1903,7 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms, size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0; DEBUGLOG(4, "reset indices : %u", forceResetIndex == ZSTDirp_reset); - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); if (forceResetIndex == ZSTDirp_reset) { ZSTD_window_init(&ms->window); ZSTD_cwksp_mark_tables_dirty(ws); @@ -1774,8 +1949,8 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms, if (ms->tagTable) ZSTD_memset(ms->tagTable, 0, tagTableSize); } { /* Switch to 32-entry rows if searchLog is 5 (or more) */ - U32 const rowLog = cParams->searchLog < 5 ? 4 : 5; - assert(cParams->hashLog > rowLog); + U32 const rowLog = BOUNDED(4, cParams->searchLog, 6); + assert(cParams->hashLog >= rowLog); ms->rowHashLog = cParams->hashLog - rowLog; } } @@ -1824,8 +1999,8 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, ZSTD_buffered_policy_e const zbuff) { ZSTD_cwksp* const ws = &zc->workspace; - DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u, useRowMatchFinder=%d", - (U32)pledgedSrcSize, params->cParams.windowLog, (int)params->useRowMatchFinder); + DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u, useRowMatchFinder=%d useBlockSplitter=%d", + (U32)pledgedSrcSize, params->cParams.windowLog, (int)params->useRowMatchFinder, (int)params->useBlockSplitter); assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams))); zc->isFirstBlock = 1; @@ -1836,8 +2011,11 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->appliedParams = *params; params = &zc->appliedParams; - assert(params->useRowMatchFinder != ZSTD_urm_auto); - if (params->ldmParams.enableLdm) { + assert(params->useRowMatchFinder != ZSTD_ps_auto); + assert(params->useBlockSplitter != ZSTD_ps_auto); + assert(params->ldmParams.enableLdm != ZSTD_ps_auto); + assert(params->maxBlockSize != 0); + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* Adjust long distance matching parameters */ ZSTD_ldm_adjustParameters(&zc->appliedParams.ldmParams, ¶ms->cParams); assert(params->ldmParams.hashLog >= params->ldmParams.bucketSizeLog); @@ -1845,9 +2023,8 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, } { size_t const windowSize = MAX(1, (size_t)MIN(((U64)1 << params->cParams.windowLog), pledgedSrcSize)); - size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, windowSize); - U32 const divider = (params->cParams.minMatch==3) ? 3 : 4; - size_t const maxNbSeq = blockSize / divider; + size_t const blockSize = MIN(params->maxBlockSize, windowSize); + size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, params->cParams.minMatch, params->useSequenceProducer); size_t const buffOutSize = (zbuff == ZSTDb_buffered && params->outBufferMode == ZSTD_bm_buffered) ? ZSTD_compressBound(blockSize) + 1 : 0; @@ -1864,7 +2041,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, size_t const neededSpace = ZSTD_estimateCCtxSize_usingCCtxParams_internal( ¶ms->cParams, ¶ms->ldmParams, zc->staticSize != 0, params->useRowMatchFinder, - buffInSize, buffOutSize, pledgedSrcSize); + buffInSize, buffOutSize, pledgedSrcSize, params->useSequenceProducer, params->maxBlockSize); int resizeWorkspace; FORWARD_IF_ERROR(neededSpace, "cctx size estimate failed!"); @@ -1900,13 +2077,14 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->blockState.nextCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t)); RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate nextCBlock"); zc->entropyWorkspace = (U32*) ZSTD_cwksp_reserve_object(ws, ENTROPY_WORKSPACE_SIZE); - RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate entropyWorkspace"); + RETURN_ERROR_IF(zc->entropyWorkspace == NULL, memory_allocation, "couldn't allocate entropyWorkspace"); } } ZSTD_cwksp_clear(ws); /* init params */ zc->blockState.matchState.cParams = params->cParams; + zc->blockState.matchState.prefetchCDictTables = params->prefetchCDictTables == ZSTD_ps_enable; zc->pledgedSrcSizePlusOne = pledgedSrcSize+1; zc->consumedSrcSize = 0; zc->producedCSize = 0; @@ -1937,7 +2115,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->outBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffOutSize); /* ldm bucketOffsets table */ - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* TODO: avoid memset? */ size_t const numBuckets = ((size_t)1) << (params->ldmParams.hashLog - @@ -1964,7 +2142,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, ZSTD_resetTarget_CCtx), ""); /* ldm hash table */ - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* TODO: avoid memset? */ size_t const ldmHSize = ((size_t)1) << params->ldmParams.hashLog; zc->ldmState.hashTable = (ldmEntry_t*)ZSTD_cwksp_reserve_aligned(ws, ldmHSize * sizeof(ldmEntry_t)); @@ -1976,8 +2154,16 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->ldmState.loadedDictEnd = 0; } - assert(ZSTD_cwksp_estimated_space_within_bounds(ws, neededSpace, resizeWorkspace)); + /* reserve space for block-level external sequences */ + if (params->useSequenceProducer) { + size_t const maxNbExternalSeq = ZSTD_sequenceBound(blockSize); + zc->externalMatchCtx.seqBufferCapacity = maxNbExternalSeq; + zc->externalMatchCtx.seqBuffer = + (ZSTD_Sequence*)ZSTD_cwksp_reserve_aligned(ws, maxNbExternalSeq * sizeof(ZSTD_Sequence)); + } + DEBUGLOG(3, "wksp: finished allocating, %zd bytes remain available", ZSTD_cwksp_available_space(ws)); + assert(ZSTD_cwksp_estimated_space_within_bounds(ws, neededSpace, resizeWorkspace)); zc->initialized = 1; @@ -2049,7 +2235,8 @@ ZSTD_resetCCtx_byAttachingCDict(ZSTD_CCtx* cctx, } params.cParams = ZSTD_adjustCParams_internal(adjusted_cdict_cParams, pledgedSrcSize, - cdict->dictContentSize, ZSTD_cpm_attachDict); + cdict->dictContentSize, ZSTD_cpm_attachDict, + params.useRowMatchFinder); params.cParams.windowLog = windowLog; params.useRowMatchFinder = cdict->useRowMatchFinder; /* cdict overrides */ FORWARD_IF_ERROR(ZSTD_resetCCtx_internal(cctx, ¶ms, pledgedSrcSize, @@ -2088,6 +2275,22 @@ ZSTD_resetCCtx_byAttachingCDict(ZSTD_CCtx* cctx, return 0; } +static void ZSTD_copyCDictTableIntoCCtx(U32* dst, U32 const* src, size_t tableSize, + ZSTD_compressionParameters const* cParams) { + if (ZSTD_CDictIndicesAreTagged(cParams)){ + /* Remove tags from the CDict table if they are present. + * See docs on "short cache" in zstd_compress_internal.h for context. */ + size_t i; + for (i = 0; i < tableSize; i++) { + U32 const taggedIndex = src[i]; + U32 const index = taggedIndex >> ZSTD_SHORT_CACHE_TAG_BITS; + dst[i] = index; + } + } else { + ZSTD_memcpy(dst, src, tableSize * sizeof(U32)); + } +} + static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict, ZSTD_CCtx_params params, @@ -2115,7 +2318,7 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx, } ZSTD_cwksp_mark_tables_dirty(&cctx->workspace); - assert(params.useRowMatchFinder != ZSTD_urm_auto); + assert(params.useRowMatchFinder != ZSTD_ps_auto); /* copy tables */ { size_t const chainSize = ZSTD_allocateChainTable(cdict_cParams->strategy, cdict->useRowMatchFinder, 0 /* DDS guaranteed disabled */) @@ -2123,14 +2326,15 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx, : 0; size_t const hSize = (size_t)1 << cdict_cParams->hashLog; - ZSTD_memcpy(cctx->blockState.matchState.hashTable, - cdict->matchState.hashTable, - hSize * sizeof(U32)); + ZSTD_copyCDictTableIntoCCtx(cctx->blockState.matchState.hashTable, + cdict->matchState.hashTable, + hSize, cdict_cParams); + /* Do not copy cdict's chainTable if cctx has parameters such that it would not use chainTable */ if (ZSTD_allocateChainTable(cctx->appliedParams.cParams.strategy, cctx->appliedParams.useRowMatchFinder, 0 /* forDDSDict */)) { - ZSTD_memcpy(cctx->blockState.matchState.chainTable, - cdict->matchState.chainTable, - chainSize * sizeof(U32)); + ZSTD_copyCDictTableIntoCCtx(cctx->blockState.matchState.chainTable, + cdict->matchState.chainTable, + chainSize, cdict_cParams); } /* copy tag table */ if (ZSTD_rowMatchFinderUsed(cdict_cParams->strategy, cdict->useRowMatchFinder)) { @@ -2209,9 +2413,14 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx, { ZSTD_CCtx_params params = dstCCtx->requestedParams; /* Copy only compression parameters related to tables. */ params.cParams = srcCCtx->appliedParams.cParams; - assert(srcCCtx->appliedParams.useRowMatchFinder != ZSTD_urm_auto); + assert(srcCCtx->appliedParams.useRowMatchFinder != ZSTD_ps_auto); + assert(srcCCtx->appliedParams.useBlockSplitter != ZSTD_ps_auto); + assert(srcCCtx->appliedParams.ldmParams.enableLdm != ZSTD_ps_auto); params.useRowMatchFinder = srcCCtx->appliedParams.useRowMatchFinder; + params.useBlockSplitter = srcCCtx->appliedParams.useBlockSplitter; + params.ldmParams = srcCCtx->appliedParams.ldmParams; params.fParams = fParams; + params.maxBlockSize = srcCCtx->appliedParams.maxBlockSize; ZSTD_resetCCtx_internal(dstCCtx, ¶ms, pledgedSrcSize, /* loadedDictSize */ 0, ZSTDcrp_leaveDirty, zbuff); @@ -2296,6 +2505,8 @@ ZSTD_reduceTable_internal (U32* const table, U32 const size, U32 const reducerVa int const nbRows = (int)size / ZSTD_ROWSIZE; int cellNb = 0; int rowNb; + /* Protect special index values < ZSTD_WINDOW_START_INDEX. */ + U32 const reducerThreshold = reducerValue + ZSTD_WINDOW_START_INDEX; assert((size & (ZSTD_ROWSIZE-1)) == 0); /* multiple of ZSTD_ROWSIZE */ assert(size < (1U<<31)); /* can be casted to int */ @@ -2315,12 +2526,17 @@ ZSTD_reduceTable_internal (U32* const table, U32 const size, U32 const reducerVa for (rowNb=0 ; rowNb < nbRows ; rowNb++) { int column; for (column=0; columnsequencesStart; BYTE* const llCodeTable = seqStorePtr->llCode; @@ -2372,18 +2588,24 @@ void ZSTD_seqToCodes(const seqStore_t* seqStorePtr) BYTE* const mlCodeTable = seqStorePtr->mlCode; U32 const nbSeq = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); U32 u; + int longOffsets = 0; assert(nbSeq <= seqStorePtr->maxNbSeq); for (u=0; u= STREAM_ACCUMULATOR_MIN)); + if (MEM_32bits() && ofCode >= STREAM_ACCUMULATOR_MIN) + longOffsets = 1; } if (seqStorePtr->longLengthType==ZSTD_llt_literalLength) llCodeTable[seqStorePtr->longLengthPos] = MaxLL; if (seqStorePtr->longLengthType==ZSTD_llt_matchLength) mlCodeTable[seqStorePtr->longLengthPos] = MaxML; + return longOffsets; } /* ZSTD_useTargetCBlockSize(): @@ -2399,11 +2621,13 @@ static int ZSTD_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams) /* ZSTD_blockSplitterEnabled(): * Returns if block splitting param is being used * If used, compression will do best effort to split a block in order to improve compression ratio. + * At the time this function is called, the parameter must be finalized. * Returns 1 if true, 0 otherwise. */ static int ZSTD_blockSplitterEnabled(ZSTD_CCtx_params* cctxParams) { - DEBUGLOG(5, "ZSTD_blockSplitterEnabled(splitBlocks=%d)", cctxParams->splitBlocks); - return (cctxParams->splitBlocks != 0); + DEBUGLOG(5, "ZSTD_blockSplitterEnabled (useBlockSplitter=%d)", cctxParams->useBlockSplitter); + assert(cctxParams->useBlockSplitter != ZSTD_ps_auto); + return (cctxParams->useBlockSplitter == ZSTD_ps_enable); } /* Type returned by ZSTD_buildSequencesStatistics containing finalized symbol encoding types @@ -2415,6 +2639,7 @@ typedef struct { U32 MLtype; size_t size; size_t lastCountSize; /* Accounts for bug in 1.3.4. More detail in ZSTD_entropyCompressSeqStore_internal() */ + int longOffsets; } ZSTD_symbolEncodingTypeStats_t; /* ZSTD_buildSequencesStatistics(): @@ -2425,11 +2650,13 @@ typedef struct { * entropyWkspSize must be of size at least ENTROPY_WORKSPACE_SIZE - (MaxSeq + 1)*sizeof(U32) */ static ZSTD_symbolEncodingTypeStats_t -ZSTD_buildSequencesStatistics(seqStore_t* seqStorePtr, size_t nbSeq, - const ZSTD_fseCTables_t* prevEntropy, ZSTD_fseCTables_t* nextEntropy, - BYTE* dst, const BYTE* const dstEnd, - ZSTD_strategy strategy, unsigned* countWorkspace, - void* entropyWorkspace, size_t entropyWkspSize) { +ZSTD_buildSequencesStatistics( + const seqStore_t* seqStorePtr, size_t nbSeq, + const ZSTD_fseCTables_t* prevEntropy, ZSTD_fseCTables_t* nextEntropy, + BYTE* dst, const BYTE* const dstEnd, + ZSTD_strategy strategy, unsigned* countWorkspace, + void* entropyWorkspace, size_t entropyWkspSize) +{ BYTE* const ostart = dst; const BYTE* const oend = dstEnd; BYTE* op = ostart; @@ -2443,7 +2670,7 @@ ZSTD_buildSequencesStatistics(seqStore_t* seqStorePtr, size_t nbSeq, stats.lastCountSize = 0; /* convert length/distances into codes */ - ZSTD_seqToCodes(seqStorePtr); + stats.longOffsets = ZSTD_seqToCodes(seqStorePtr); assert(op <= oend); assert(nbSeq != 0); /* ZSTD_selectEncodingType() divides by nbSeq */ /* build CTable for Literal Lengths */ @@ -2546,23 +2773,24 @@ ZSTD_buildSequencesStatistics(seqStore_t* seqStorePtr, size_t nbSeq, * compresses both literals and sequences * Returns compressed size of block, or a zstd error. */ +#define SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO 20 MEM_STATIC size_t -ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr, - const ZSTD_entropyCTables_t* prevEntropy, - ZSTD_entropyCTables_t* nextEntropy, - const ZSTD_CCtx_params* cctxParams, - void* dst, size_t dstCapacity, - void* entropyWorkspace, size_t entropyWkspSize, - const int bmi2) +ZSTD_entropyCompressSeqStore_internal( + const seqStore_t* seqStorePtr, + const ZSTD_entropyCTables_t* prevEntropy, + ZSTD_entropyCTables_t* nextEntropy, + const ZSTD_CCtx_params* cctxParams, + void* dst, size_t dstCapacity, + void* entropyWorkspace, size_t entropyWkspSize, + const int bmi2) { - const int longOffsets = cctxParams->cParams.windowLog > STREAM_ACCUMULATOR_MIN; ZSTD_strategy const strategy = cctxParams->cParams.strategy; unsigned* count = (unsigned*)entropyWorkspace; FSE_CTable* CTable_LitLength = nextEntropy->fse.litlengthCTable; FSE_CTable* CTable_OffsetBits = nextEntropy->fse.offcodeCTable; FSE_CTable* CTable_MatchLength = nextEntropy->fse.matchlengthCTable; const seqDef* const sequences = seqStorePtr->sequencesStart; - const size_t nbSeq = seqStorePtr->sequences - seqStorePtr->sequencesStart; + const size_t nbSeq = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart); const BYTE* const ofCodeTable = seqStorePtr->ofCode; const BYTE* const llCodeTable = seqStorePtr->llCode; const BYTE* const mlCodeTable = seqStorePtr->mlCode; @@ -2570,25 +2798,31 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr, BYTE* const oend = ostart + dstCapacity; BYTE* op = ostart; size_t lastCountSize; + int longOffsets = 0; entropyWorkspace = count + (MaxSeq + 1); entropyWkspSize -= (MaxSeq + 1) * sizeof(*count); - DEBUGLOG(4, "ZSTD_entropyCompressSeqStore_internal (nbSeq=%zu)", nbSeq); + DEBUGLOG(5, "ZSTD_entropyCompressSeqStore_internal (nbSeq=%zu, dstCapacity=%zu)", nbSeq, dstCapacity); ZSTD_STATIC_ASSERT(HUF_WORKSPACE_SIZE >= (1<= HUF_WORKSPACE_SIZE); /* Compress literals */ { const BYTE* const literals = seqStorePtr->litStart; + size_t const numSequences = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart); + size_t const numLiterals = (size_t)(seqStorePtr->lit - seqStorePtr->litStart); + /* Base suspicion of uncompressibility on ratio of literals to sequences */ + unsigned const suspectUncompressible = (numSequences == 0) || (numLiterals / numSequences >= SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO); size_t const litSize = (size_t)(seqStorePtr->lit - literals); + size_t const cSize = ZSTD_compressLiterals( - &prevEntropy->huf, &nextEntropy->huf, - cctxParams->cParams.strategy, - ZSTD_disableLiteralsCompression(cctxParams), op, dstCapacity, literals, litSize, entropyWorkspace, entropyWkspSize, - bmi2); + &prevEntropy->huf, &nextEntropy->huf, + cctxParams->cParams.strategy, + ZSTD_literalsCompressionIsDisabled(cctxParams), + suspectUncompressible, bmi2); FORWARD_IF_ERROR(cSize, "ZSTD_compressLiterals failed"); assert(cSize <= dstCapacity); op += cSize; @@ -2614,11 +2848,10 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr, ZSTD_memcpy(&nextEntropy->fse, &prevEntropy->fse, sizeof(prevEntropy->fse)); return (size_t)(op - ostart); } - { - ZSTD_symbolEncodingTypeStats_t stats; - BYTE* seqHead = op++; + { BYTE* const seqHead = op++; /* build stats for sequences */ - stats = ZSTD_buildSequencesStatistics(seqStorePtr, nbSeq, + const ZSTD_symbolEncodingTypeStats_t stats = + ZSTD_buildSequencesStatistics(seqStorePtr, nbSeq, &prevEntropy->fse, &nextEntropy->fse, op, oend, strategy, count, @@ -2627,6 +2860,7 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr, *seqHead = (BYTE)((stats.LLtype<<6) + (stats.Offtype<<4) + (stats.MLtype<<2)); lastCountSize = stats.lastCountSize; op += stats.size; + longOffsets = stats.longOffsets; } { size_t const bitstreamSize = ZSTD_encodeSequences( @@ -2661,14 +2895,15 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr, } MEM_STATIC size_t -ZSTD_entropyCompressSeqStore(seqStore_t* seqStorePtr, - const ZSTD_entropyCTables_t* prevEntropy, - ZSTD_entropyCTables_t* nextEntropy, - const ZSTD_CCtx_params* cctxParams, - void* dst, size_t dstCapacity, - size_t srcSize, - void* entropyWorkspace, size_t entropyWkspSize, - int bmi2) +ZSTD_entropyCompressSeqStore( + const seqStore_t* seqStorePtr, + const ZSTD_entropyCTables_t* prevEntropy, + ZSTD_entropyCTables_t* nextEntropy, + const ZSTD_CCtx_params* cctxParams, + void* dst, size_t dstCapacity, + size_t srcSize, + void* entropyWorkspace, size_t entropyWkspSize, + int bmi2) { size_t const cSize = ZSTD_entropyCompressSeqStore_internal( seqStorePtr, prevEntropy, nextEntropy, cctxParams, @@ -2678,22 +2913,28 @@ ZSTD_entropyCompressSeqStore(seqStore_t* seqStorePtr, /* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block. * Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block. */ - if ((cSize == ERROR(dstSize_tooSmall)) & (srcSize <= dstCapacity)) + if ((cSize == ERROR(dstSize_tooSmall)) & (srcSize <= dstCapacity)) { + DEBUGLOG(4, "not enough dstCapacity (%zu) for ZSTD_entropyCompressSeqStore_internal()=> do not compress block", dstCapacity); return 0; /* block not compressed */ + } FORWARD_IF_ERROR(cSize, "ZSTD_entropyCompressSeqStore_internal failed"); /* Check compressibility */ { size_t const maxCSize = srcSize - ZSTD_minGain(srcSize, cctxParams->cParams.strategy); if (cSize >= maxCSize) return 0; /* block not compressed */ } - DEBUGLOG(4, "ZSTD_entropyCompressSeqStore() cSize: %zu", cSize); + DEBUGLOG(5, "ZSTD_entropyCompressSeqStore() cSize: %zu", cSize); + /* libzstd decoder before > v1.5.4 is not compatible with compressed blocks of size ZSTD_BLOCKSIZE_MAX exactly. + * This restriction is indirectly already fulfilled by respecting ZSTD_minGain() condition above. + */ + assert(cSize < ZSTD_BLOCKSIZE_MAX); return cSize; } /* ZSTD_selectBlockCompressor() : * Not static, but internal use only (used by long distance matcher) * assumption : strat is a valid strategy */ -ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_useRowMatchFinderMode_e useRowMatchFinder, ZSTD_dictMode_e dictMode) +ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramSwitch_e useRowMatchFinder, ZSTD_dictMode_e dictMode) { static const ZSTD_blockCompressor blockCompressor[4][ZSTD_STRATEGY_MAX+1] = { { ZSTD_compressBlock_fast /* default for 0 */, @@ -2758,7 +2999,7 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_useRow ZSTD_compressBlock_lazy2_dedicatedDictSearch_row } }; DEBUGLOG(4, "Selecting a row-based matchfinder"); - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); selectedCompressor = rowBasedBlockCompressors[(int)dictMode][(int)strat - (int)ZSTD_greedy]; } else { selectedCompressor = blockCompressor[(int)dictMode][(int)strat]; @@ -2781,6 +3022,72 @@ void ZSTD_resetSeqStore(seqStore_t* ssPtr) ssPtr->longLengthType = ZSTD_llt_none; } +/* ZSTD_postProcessSequenceProducerResult() : + * Validates and post-processes sequences obtained through the external matchfinder API: + * - Checks whether nbExternalSeqs represents an error condition. + * - Appends a block delimiter to outSeqs if one is not already present. + * See zstd.h for context regarding block delimiters. + * Returns the number of sequences after post-processing, or an error code. */ +static size_t ZSTD_postProcessSequenceProducerResult( + ZSTD_Sequence* outSeqs, size_t nbExternalSeqs, size_t outSeqsCapacity, size_t srcSize +) { + RETURN_ERROR_IF( + nbExternalSeqs > outSeqsCapacity, + sequenceProducer_failed, + "External sequence producer returned error code %lu", + (unsigned long)nbExternalSeqs + ); + + RETURN_ERROR_IF( + nbExternalSeqs == 0 && srcSize > 0, + sequenceProducer_failed, + "Got zero sequences from external sequence producer for a non-empty src buffer!" + ); + + if (srcSize == 0) { + ZSTD_memset(&outSeqs[0], 0, sizeof(ZSTD_Sequence)); + return 1; + } + + { + ZSTD_Sequence const lastSeq = outSeqs[nbExternalSeqs - 1]; + + /* We can return early if lastSeq is already a block delimiter. */ + if (lastSeq.offset == 0 && lastSeq.matchLength == 0) { + return nbExternalSeqs; + } + + /* This error condition is only possible if the external matchfinder + * produced an invalid parse, by definition of ZSTD_sequenceBound(). */ + RETURN_ERROR_IF( + nbExternalSeqs == outSeqsCapacity, + sequenceProducer_failed, + "nbExternalSeqs == outSeqsCapacity but lastSeq is not a block delimiter!" + ); + + /* lastSeq is not a block delimiter, so we need to append one. */ + ZSTD_memset(&outSeqs[nbExternalSeqs], 0, sizeof(ZSTD_Sequence)); + return nbExternalSeqs + 1; + } +} + +/* ZSTD_fastSequenceLengthSum() : + * Returns sum(litLen) + sum(matchLen) + lastLits for *seqBuf*. + * Similar to another function in zstd_compress.c (determine_blockSize), + * except it doesn't check for a block delimiter to end summation. + * Removing the early exit allows the compiler to auto-vectorize (https://godbolt.org/z/cY1cajz9P). + * This function can be deleted and replaced by determine_blockSize after we resolve issue #3456. */ +static size_t ZSTD_fastSequenceLengthSum(ZSTD_Sequence const* seqBuf, size_t seqBufSize) { + size_t matchLenSum, litLenSum, i; + matchLenSum = 0; + litLenSum = 0; + for (i = 0; i < seqBufSize; i++) { + litLenSum += seqBuf[i].litLength; + matchLenSum += seqBuf[i].matchLength; + } + return litLenSum + matchLenSum; +} + typedef enum { ZSTDbss_compress, ZSTDbss_noCompress } ZSTD_buildSeqStore_e; static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) @@ -2790,7 +3097,9 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) assert(srcSize <= ZSTD_BLOCKSIZE_MAX); /* Assert that we have correctly flushed the ctx params into the ms's copy */ ZSTD_assertEqualCParams(zc->appliedParams.cParams, ms->cParams); - if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) { + /* TODO: See 3090. We reduced MIN_CBLOCK_SIZE from 3 to 2 so to compensate we are adding + * additional 1. We need to revisit and change this logic to be more consistent */ + if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1+1) { if (zc->appliedParams.cParams.strategy >= ZSTD_btopt) { ZSTD_ldm_skipRawSeqStoreBytes(&zc->externSeqStore, srcSize); } else { @@ -2825,7 +3134,16 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) zc->blockState.nextCBlock->rep[i] = zc->blockState.prevCBlock->rep[i]; } if (zc->externSeqStore.pos < zc->externSeqStore.size) { - assert(!zc->appliedParams.ldmParams.enableLdm); + assert(zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_disable); + + /* External matchfinder + LDM is technically possible, just not implemented yet. + * We need to revisit soon and implement it. */ + RETURN_ERROR_IF( + zc->appliedParams.useSequenceProducer, + parameter_combination_unsupported, + "Long-distance matching with external sequence producer enabled is not currently supported." + ); + /* Updates ldmSeqStore.pos */ lastLLSize = ZSTD_ldm_blockCompress(&zc->externSeqStore, @@ -2834,9 +3152,17 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) zc->appliedParams.useRowMatchFinder, src, srcSize); assert(zc->externSeqStore.pos <= zc->externSeqStore.size); - } else if (zc->appliedParams.ldmParams.enableLdm) { + } else if (zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) { rawSeqStore_t ldmSeqStore = kNullRawSeqStore; + /* External matchfinder + LDM is technically possible, just not implemented yet. + * We need to revisit soon and implement it. */ + RETURN_ERROR_IF( + zc->appliedParams.useSequenceProducer, + parameter_combination_unsupported, + "Long-distance matching with external sequence producer enabled is not currently supported." + ); + ldmSeqStore.seq = zc->ldmSequences; ldmSeqStore.capacity = zc->maxNbLdmSequences; /* Updates ldmSeqStore.size */ @@ -2851,7 +3177,68 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) zc->appliedParams.useRowMatchFinder, src, srcSize); assert(ldmSeqStore.pos == ldmSeqStore.size); - } else { /* not long range mode */ + } else if (zc->appliedParams.useSequenceProducer) { + assert( + zc->externalMatchCtx.seqBufferCapacity >= ZSTD_sequenceBound(srcSize) + ); + assert(zc->externalMatchCtx.mFinder != NULL); + + { U32 const windowSize = (U32)1 << zc->appliedParams.cParams.windowLog; + + size_t const nbExternalSeqs = (zc->externalMatchCtx.mFinder)( + zc->externalMatchCtx.mState, + zc->externalMatchCtx.seqBuffer, + zc->externalMatchCtx.seqBufferCapacity, + src, srcSize, + NULL, 0, /* dict and dictSize, currently not supported */ + zc->appliedParams.compressionLevel, + windowSize + ); + + size_t const nbPostProcessedSeqs = ZSTD_postProcessSequenceProducerResult( + zc->externalMatchCtx.seqBuffer, + nbExternalSeqs, + zc->externalMatchCtx.seqBufferCapacity, + srcSize + ); + + /* Return early if there is no error, since we don't need to worry about last literals */ + if (!ZSTD_isError(nbPostProcessedSeqs)) { + ZSTD_sequencePosition seqPos = {0,0,0}; + size_t const seqLenSum = ZSTD_fastSequenceLengthSum(zc->externalMatchCtx.seqBuffer, nbPostProcessedSeqs); + RETURN_ERROR_IF(seqLenSum > srcSize, externalSequences_invalid, "External sequences imply too large a block!"); + FORWARD_IF_ERROR( + ZSTD_copySequencesToSeqStoreExplicitBlockDelim( + zc, &seqPos, + zc->externalMatchCtx.seqBuffer, nbPostProcessedSeqs, + src, srcSize, + zc->appliedParams.searchForExternalRepcodes + ), + "Failed to copy external sequences to seqStore!" + ); + ms->ldmSeqStore = NULL; + DEBUGLOG(5, "Copied %lu sequences from external sequence producer to internal seqStore.", (unsigned long)nbExternalSeqs); + return ZSTDbss_compress; + } + + /* Propagate the error if fallback is disabled */ + if (!zc->appliedParams.enableMatchFinderFallback) { + return nbPostProcessedSeqs; + } + + /* Fallback to software matchfinder */ + { ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, + zc->appliedParams.useRowMatchFinder, + dictMode); + ms->ldmSeqStore = NULL; + DEBUGLOG( + 5, + "External sequence producer returned error code %lu. Falling back to internal parser.", + (unsigned long)nbExternalSeqs + ); + lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize); + } } + } else { /* not long range mode and no external matchfinder */ ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, zc->appliedParams.useRowMatchFinder, dictMode); @@ -2882,9 +3269,9 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) assert(zc->seqCollector.maxSequences >= seqStoreSeqSize + 1); ZSTD_memcpy(updatedRepcodes.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t)); for (i = 0; i < seqStoreSeqSize; ++i) { - U32 rawOffset = seqStoreSeqs[i].offset - ZSTD_REP_NUM; + U32 rawOffset = seqStoreSeqs[i].offBase - ZSTD_REP_NUM; outSeqs[i].litLength = seqStoreSeqs[i].litLength; - outSeqs[i].matchLength = seqStoreSeqs[i].matchLength + MINMATCH; + outSeqs[i].matchLength = seqStoreSeqs[i].mlBase + MINMATCH; outSeqs[i].rep = 0; if (i == seqStore->longLengthPos) { @@ -2895,9 +3282,9 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) } } - if (seqStoreSeqs[i].offset <= ZSTD_REP_NUM) { + if (seqStoreSeqs[i].offBase <= ZSTD_REP_NUM) { /* Derive the correct offset corresponding to a repcode */ - outSeqs[i].rep = seqStoreSeqs[i].offset; + outSeqs[i].rep = seqStoreSeqs[i].offBase; if (outSeqs[i].litLength != 0) { rawOffset = updatedRepcodes.rep[outSeqs[i].rep - 1]; } else { @@ -2911,9 +3298,9 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) outSeqs[i].offset = rawOffset; /* seqStoreSeqs[i].offset == offCode+1, and ZSTD_updateRep() expects offCode so we provide seqStoreSeqs[i].offset - 1 */ - updatedRepcodes = ZSTD_updateRep(updatedRepcodes.rep, - seqStoreSeqs[i].offset - 1, - seqStoreSeqs[i].litLength == 0); + ZSTD_updateRep(updatedRepcodes.rep, + seqStoreSeqs[i].offBase, + seqStoreSeqs[i].litLength == 0); literalsRead += outSeqs[i].litLength; } /* Insert last literals (if any exist) in the block as a sequence with ml == off == 0. @@ -2928,6 +3315,10 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) zc->seqCollector.seqIndex += seqStoreSeqSize; } +size_t ZSTD_sequenceBound(size_t srcSize) { + return (srcSize / ZSTD_MINMATCH_MIN) + 1; +} + size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, size_t outSeqsSize, const void* src, size_t srcSize) { @@ -2973,19 +3364,17 @@ static int ZSTD_isRLE(const BYTE* src, size_t length) { const size_t unrollMask = unrollSize - 1; const size_t prefixLength = length & unrollMask; size_t i; - size_t u; if (length == 1) return 1; /* Check if prefix is RLE first before using unrolled loop */ if (prefixLength && ZSTD_count(ip+1, ip, ip+prefixLength) != prefixLength-1) { return 0; } for (i = prefixLength; i != length; i += unrollSize) { + size_t u; for (u = 0; u < unrollSize; u += sizeof(size_t)) { if (MEM_readST(ip + i + u) != valueST) { return 0; - } - } - } + } } } return 1; } @@ -3001,7 +3390,8 @@ static int ZSTD_maybeRLE(seqStore_t const* seqStore) return nbSeqs < 4 && nbLits < 10; } -static void ZSTD_blockState_confirmRepcodesAndEntropyTables(ZSTD_blockState_t* const bs) +static void +ZSTD_blockState_confirmRepcodesAndEntropyTables(ZSTD_blockState_t* const bs) { ZSTD_compressedBlockState_t* const tmp = bs->prevCBlock; bs->prevCBlock = bs->nextCBlock; @@ -3009,7 +3399,9 @@ static void ZSTD_blockState_confirmRepcodesAndEntropyTables(ZSTD_blockState_t* c } /* Writes the block header */ -static void writeBlockHeader(void* op, size_t cSize, size_t blockSize, U32 lastBlock) { +static void +writeBlockHeader(void* op, size_t cSize, size_t blockSize, U32 lastBlock) +{ U32 const cBlockHeader = cSize == 1 ? lastBlock + (((U32)bt_rle)<<1) + (U32)(blockSize << 3) : lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3); @@ -3022,13 +3414,16 @@ static void writeBlockHeader(void* op, size_t cSize, size_t blockSize, U32 lastB * Stores literals block type (raw, rle, compressed, repeat) and * huffman description table to hufMetadata. * Requires ENTROPY_WORKSPACE_SIZE workspace - * @return : size of huffman description table or error code */ -static size_t ZSTD_buildBlockEntropyStats_literals(void* const src, size_t srcSize, - const ZSTD_hufCTables_t* prevHuf, - ZSTD_hufCTables_t* nextHuf, - ZSTD_hufCTablesMetadata_t* hufMetadata, - const int disableLiteralsCompression, - void* workspace, size_t wkspSize) + * @return : size of huffman description table, or an error code + */ +static size_t +ZSTD_buildBlockEntropyStats_literals(void* const src, size_t srcSize, + const ZSTD_hufCTables_t* prevHuf, + ZSTD_hufCTables_t* nextHuf, + ZSTD_hufCTablesMetadata_t* hufMetadata, + const int literalsCompressionIsDisabled, + void* workspace, size_t wkspSize, + int hufFlags) { BYTE* const wkspStart = (BYTE*)workspace; BYTE* const wkspEnd = wkspStart + wkspSize; @@ -3036,16 +3431,16 @@ static size_t ZSTD_buildBlockEntropyStats_literals(void* const src, size_t srcSi unsigned* const countWksp = (unsigned*)workspace; const size_t countWkspSize = (HUF_SYMBOLVALUE_MAX + 1) * sizeof(unsigned); BYTE* const nodeWksp = countWkspStart + countWkspSize; - const size_t nodeWkspSize = wkspEnd-nodeWksp; + const size_t nodeWkspSize = (size_t)(wkspEnd - nodeWksp); unsigned maxSymbolValue = HUF_SYMBOLVALUE_MAX; - unsigned huffLog = HUF_TABLELOG_DEFAULT; + unsigned huffLog = LitHufLog; HUF_repeat repeat = prevHuf->repeatMode; DEBUGLOG(5, "ZSTD_buildBlockEntropyStats_literals (srcSize=%zu)", srcSize); /* Prepare nextEntropy assuming reusing the existing table */ ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - if (disableLiteralsCompression) { + if (literalsCompressionIsDisabled) { DEBUGLOG(5, "set_basic - disabled"); hufMetadata->hType = set_basic; return 0; @@ -3053,73 +3448,77 @@ static size_t ZSTD_buildBlockEntropyStats_literals(void* const src, size_t srcSi /* small ? don't even attempt compression (speed opt) */ #ifndef COMPRESS_LITERALS_SIZE_MIN -#define COMPRESS_LITERALS_SIZE_MIN 63 +# define COMPRESS_LITERALS_SIZE_MIN 63 /* heuristic */ #endif { size_t const minLitSize = (prevHuf->repeatMode == HUF_repeat_valid) ? 6 : COMPRESS_LITERALS_SIZE_MIN; if (srcSize <= minLitSize) { DEBUGLOG(5, "set_basic - too small"); hufMetadata->hType = set_basic; return 0; - } - } + } } /* Scan input and build symbol stats */ - { size_t const largest = HIST_count_wksp (countWksp, &maxSymbolValue, (const BYTE*)src, srcSize, workspace, wkspSize); + { size_t const largest = + HIST_count_wksp (countWksp, &maxSymbolValue, + (const BYTE*)src, srcSize, + workspace, wkspSize); FORWARD_IF_ERROR(largest, "HIST_count_wksp failed"); if (largest == srcSize) { + /* only one literal symbol */ DEBUGLOG(5, "set_rle"); hufMetadata->hType = set_rle; return 0; } if (largest <= (srcSize >> 7)+4) { + /* heuristic: likely not compressible */ DEBUGLOG(5, "set_basic - no gain"); hufMetadata->hType = set_basic; return 0; - } - } + } } /* Validate the previous Huffman table */ - if (repeat == HUF_repeat_check && !HUF_validateCTable((HUF_CElt const*)prevHuf->CTable, countWksp, maxSymbolValue)) { + if (repeat == HUF_repeat_check + && !HUF_validateCTable((HUF_CElt const*)prevHuf->CTable, countWksp, maxSymbolValue)) { repeat = HUF_repeat_none; } /* Build Huffman Tree */ ZSTD_memset(nextHuf->CTable, 0, sizeof(nextHuf->CTable)); - huffLog = HUF_optimalTableLog(huffLog, srcSize, maxSymbolValue); + huffLog = HUF_optimalTableLog(huffLog, srcSize, maxSymbolValue, nodeWksp, nodeWkspSize, nextHuf->CTable, countWksp, hufFlags); + assert(huffLog <= LitHufLog); { size_t const maxBits = HUF_buildCTable_wksp((HUF_CElt*)nextHuf->CTable, countWksp, maxSymbolValue, huffLog, nodeWksp, nodeWkspSize); FORWARD_IF_ERROR(maxBits, "HUF_buildCTable_wksp"); huffLog = (U32)maxBits; - { /* Build and write the CTable */ - size_t const newCSize = HUF_estimateCompressedSize( - (HUF_CElt*)nextHuf->CTable, countWksp, maxSymbolValue); - size_t const hSize = HUF_writeCTable_wksp( - hufMetadata->hufDesBuffer, sizeof(hufMetadata->hufDesBuffer), - (HUF_CElt*)nextHuf->CTable, maxSymbolValue, huffLog, - nodeWksp, nodeWkspSize); - /* Check against repeating the previous CTable */ - if (repeat != HUF_repeat_none) { - size_t const oldCSize = HUF_estimateCompressedSize( - (HUF_CElt const*)prevHuf->CTable, countWksp, maxSymbolValue); - if (oldCSize < srcSize && (oldCSize <= hSize + newCSize || hSize + 12 >= srcSize)) { - DEBUGLOG(5, "set_repeat - smaller"); - ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - hufMetadata->hType = set_repeat; - return 0; - } - } - if (newCSize + hSize >= srcSize) { - DEBUGLOG(5, "set_basic - no gains"); + } + { /* Build and write the CTable */ + size_t const newCSize = HUF_estimateCompressedSize( + (HUF_CElt*)nextHuf->CTable, countWksp, maxSymbolValue); + size_t const hSize = HUF_writeCTable_wksp( + hufMetadata->hufDesBuffer, sizeof(hufMetadata->hufDesBuffer), + (HUF_CElt*)nextHuf->CTable, maxSymbolValue, huffLog, + nodeWksp, nodeWkspSize); + /* Check against repeating the previous CTable */ + if (repeat != HUF_repeat_none) { + size_t const oldCSize = HUF_estimateCompressedSize( + (HUF_CElt const*)prevHuf->CTable, countWksp, maxSymbolValue); + if (oldCSize < srcSize && (oldCSize <= hSize + newCSize || hSize + 12 >= srcSize)) { + DEBUGLOG(5, "set_repeat - smaller"); ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - hufMetadata->hType = set_basic; + hufMetadata->hType = set_repeat; return 0; - } - DEBUGLOG(5, "set_compressed (hSize=%u)", (U32)hSize); - hufMetadata->hType = set_compressed; - nextHuf->repeatMode = HUF_repeat_check; - return hSize; + } } + if (newCSize + hSize >= srcSize) { + DEBUGLOG(5, "set_basic - no gains"); + ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); + hufMetadata->hType = set_basic; + return 0; } + DEBUGLOG(5, "set_compressed (hSize=%u)", (U32)hSize); + hufMetadata->hType = set_compressed; + nextHuf->repeatMode = HUF_repeat_check; + return hSize; } } @@ -3129,8 +3528,9 @@ static size_t ZSTD_buildBlockEntropyStats_literals(void* const src, size_t srcSi * and updates nextEntropy to the appropriate repeatMode. */ static ZSTD_symbolEncodingTypeStats_t -ZSTD_buildDummySequencesStatistics(ZSTD_fseCTables_t* nextEntropy) { - ZSTD_symbolEncodingTypeStats_t stats = {set_basic, set_basic, set_basic, 0, 0}; +ZSTD_buildDummySequencesStatistics(ZSTD_fseCTables_t* nextEntropy) +{ + ZSTD_symbolEncodingTypeStats_t stats = {set_basic, set_basic, set_basic, 0, 0, 0}; nextEntropy->litlength_repeatMode = FSE_repeat_none; nextEntropy->offcode_repeatMode = FSE_repeat_none; nextEntropy->matchlength_repeatMode = FSE_repeat_none; @@ -3141,16 +3541,18 @@ ZSTD_buildDummySequencesStatistics(ZSTD_fseCTables_t* nextEntropy) { * Builds entropy for the sequences. * Stores symbol compression modes and fse table to fseMetadata. * Requires ENTROPY_WORKSPACE_SIZE wksp. - * @return : size of fse tables or error code */ -static size_t ZSTD_buildBlockEntropyStats_sequences(seqStore_t* seqStorePtr, - const ZSTD_fseCTables_t* prevEntropy, - ZSTD_fseCTables_t* nextEntropy, - const ZSTD_CCtx_params* cctxParams, - ZSTD_fseCTablesMetadata_t* fseMetadata, - void* workspace, size_t wkspSize) + * @return : size of fse tables or error code */ +static size_t +ZSTD_buildBlockEntropyStats_sequences( + const seqStore_t* seqStorePtr, + const ZSTD_fseCTables_t* prevEntropy, + ZSTD_fseCTables_t* nextEntropy, + const ZSTD_CCtx_params* cctxParams, + ZSTD_fseCTablesMetadata_t* fseMetadata, + void* workspace, size_t wkspSize) { ZSTD_strategy const strategy = cctxParams->cParams.strategy; - size_t const nbSeq = seqStorePtr->sequences - seqStorePtr->sequencesStart; + size_t const nbSeq = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart); BYTE* const ostart = fseMetadata->fseTablesBuffer; BYTE* const oend = ostart + sizeof(fseMetadata->fseTablesBuffer); BYTE* op = ostart; @@ -3177,23 +3579,28 @@ static size_t ZSTD_buildBlockEntropyStats_sequences(seqStore_t* seqStorePtr, /** ZSTD_buildBlockEntropyStats() : * Builds entropy for the block. * Requires workspace size ENTROPY_WORKSPACE_SIZE - * - * @return : 0 on success or error code + * @return : 0 on success, or an error code + * Note : also employed in superblock */ -size_t ZSTD_buildBlockEntropyStats(seqStore_t* seqStorePtr, - const ZSTD_entropyCTables_t* prevEntropy, - ZSTD_entropyCTables_t* nextEntropy, - const ZSTD_CCtx_params* cctxParams, - ZSTD_entropyCTablesMetadata_t* entropyMetadata, - void* workspace, size_t wkspSize) +size_t ZSTD_buildBlockEntropyStats( + const seqStore_t* seqStorePtr, + const ZSTD_entropyCTables_t* prevEntropy, + ZSTD_entropyCTables_t* nextEntropy, + const ZSTD_CCtx_params* cctxParams, + ZSTD_entropyCTablesMetadata_t* entropyMetadata, + void* workspace, size_t wkspSize) { - size_t const litSize = seqStorePtr->lit - seqStorePtr->litStart; + size_t const litSize = (size_t)(seqStorePtr->lit - seqStorePtr->litStart); + int const huf_useOptDepth = (cctxParams->cParams.strategy >= HUF_OPTIMAL_DEPTH_THRESHOLD); + int const hufFlags = huf_useOptDepth ? HUF_flags_optimalDepth : 0; + entropyMetadata->hufMetadata.hufDesSize = ZSTD_buildBlockEntropyStats_literals(seqStorePtr->litStart, litSize, &prevEntropy->huf, &nextEntropy->huf, &entropyMetadata->hufMetadata, - ZSTD_disableLiteralsCompression(cctxParams), - workspace, wkspSize); + ZSTD_literalsCompressionIsDisabled(cctxParams), + workspace, wkspSize, hufFlags); + FORWARD_IF_ERROR(entropyMetadata->hufMetadata.hufDesSize, "ZSTD_buildBlockEntropyStats_literals failed"); entropyMetadata->fseMetadata.fseTablesSize = ZSTD_buildBlockEntropyStats_sequences(seqStorePtr, @@ -3206,11 +3613,12 @@ size_t ZSTD_buildBlockEntropyStats(seqStore_t* seqStorePtr, } /* Returns the size estimate for the literals section (header + content) of a block */ -static size_t ZSTD_estimateBlockSize_literal(const BYTE* literals, size_t litSize, - const ZSTD_hufCTables_t* huf, - const ZSTD_hufCTablesMetadata_t* hufMetadata, - void* workspace, size_t wkspSize, - int writeEntropy) +static size_t +ZSTD_estimateBlockSize_literal(const BYTE* literals, size_t litSize, + const ZSTD_hufCTables_t* huf, + const ZSTD_hufCTablesMetadata_t* hufMetadata, + void* workspace, size_t wkspSize, + int writeEntropy) { unsigned* const countWksp = (unsigned*)workspace; unsigned maxSymbolValue = HUF_SYMBOLVALUE_MAX; @@ -3232,12 +3640,13 @@ static size_t ZSTD_estimateBlockSize_literal(const BYTE* literals, size_t litSiz } /* Returns the size estimate for the FSE-compressed symbols (of, ml, ll) of a block */ -static size_t ZSTD_estimateBlockSize_symbolType(symbolEncodingType_e type, - const BYTE* codeTable, size_t nbSeq, unsigned maxCode, - const FSE_CTable* fseCTable, - const U32* additionalBits, - short const* defaultNorm, U32 defaultNormLog, U32 defaultMax, - void* workspace, size_t wkspSize) +static size_t +ZSTD_estimateBlockSize_symbolType(symbolEncodingType_e type, + const BYTE* codeTable, size_t nbSeq, unsigned maxCode, + const FSE_CTable* fseCTable, + const U8* additionalBits, + short const* defaultNorm, U32 defaultNormLog, U32 defaultMax, + void* workspace, size_t wkspSize) { unsigned* const countWksp = (unsigned*)workspace; const BYTE* ctp = codeTable; @@ -3269,98 +3678,107 @@ static size_t ZSTD_estimateBlockSize_symbolType(symbolEncodingType_e type, } /* Returns the size estimate for the sequences section (header + content) of a block */ -static size_t ZSTD_estimateBlockSize_sequences(const BYTE* ofCodeTable, - const BYTE* llCodeTable, - const BYTE* mlCodeTable, - size_t nbSeq, - const ZSTD_fseCTables_t* fseTables, - const ZSTD_fseCTablesMetadata_t* fseMetadata, - void* workspace, size_t wkspSize, - int writeEntropy) +static size_t +ZSTD_estimateBlockSize_sequences(const BYTE* ofCodeTable, + const BYTE* llCodeTable, + const BYTE* mlCodeTable, + size_t nbSeq, + const ZSTD_fseCTables_t* fseTables, + const ZSTD_fseCTablesMetadata_t* fseMetadata, + void* workspace, size_t wkspSize, + int writeEntropy) { size_t sequencesSectionHeaderSize = 1 /* seqHead */ + 1 /* min seqSize size */ + (nbSeq >= 128) + (nbSeq >= LONGNBSEQ); size_t cSeqSizeEstimate = 0; cSeqSizeEstimate += ZSTD_estimateBlockSize_symbolType(fseMetadata->ofType, ofCodeTable, nbSeq, MaxOff, - fseTables->offcodeCTable, NULL, - OF_defaultNorm, OF_defaultNormLog, DefaultMaxOff, - workspace, wkspSize); + fseTables->offcodeCTable, NULL, + OF_defaultNorm, OF_defaultNormLog, DefaultMaxOff, + workspace, wkspSize); cSeqSizeEstimate += ZSTD_estimateBlockSize_symbolType(fseMetadata->llType, llCodeTable, nbSeq, MaxLL, - fseTables->litlengthCTable, LL_bits, - LL_defaultNorm, LL_defaultNormLog, MaxLL, - workspace, wkspSize); + fseTables->litlengthCTable, LL_bits, + LL_defaultNorm, LL_defaultNormLog, MaxLL, + workspace, wkspSize); cSeqSizeEstimate += ZSTD_estimateBlockSize_symbolType(fseMetadata->mlType, mlCodeTable, nbSeq, MaxML, - fseTables->matchlengthCTable, ML_bits, - ML_defaultNorm, ML_defaultNormLog, MaxML, - workspace, wkspSize); + fseTables->matchlengthCTable, ML_bits, + ML_defaultNorm, ML_defaultNormLog, MaxML, + workspace, wkspSize); if (writeEntropy) cSeqSizeEstimate += fseMetadata->fseTablesSize; return cSeqSizeEstimate + sequencesSectionHeaderSize; } /* Returns the size estimate for a given stream of literals, of, ll, ml */ -static size_t ZSTD_estimateBlockSize(const BYTE* literals, size_t litSize, - const BYTE* ofCodeTable, - const BYTE* llCodeTable, - const BYTE* mlCodeTable, - size_t nbSeq, - const ZSTD_entropyCTables_t* entropy, - const ZSTD_entropyCTablesMetadata_t* entropyMetadata, - void* workspace, size_t wkspSize, - int writeLitEntropy, int writeSeqEntropy) { +static size_t +ZSTD_estimateBlockSize(const BYTE* literals, size_t litSize, + const BYTE* ofCodeTable, + const BYTE* llCodeTable, + const BYTE* mlCodeTable, + size_t nbSeq, + const ZSTD_entropyCTables_t* entropy, + const ZSTD_entropyCTablesMetadata_t* entropyMetadata, + void* workspace, size_t wkspSize, + int writeLitEntropy, int writeSeqEntropy) +{ size_t const literalsSize = ZSTD_estimateBlockSize_literal(literals, litSize, - &entropy->huf, &entropyMetadata->hufMetadata, - workspace, wkspSize, writeLitEntropy); + &entropy->huf, &entropyMetadata->hufMetadata, + workspace, wkspSize, writeLitEntropy); size_t const seqSize = ZSTD_estimateBlockSize_sequences(ofCodeTable, llCodeTable, mlCodeTable, - nbSeq, &entropy->fse, &entropyMetadata->fseMetadata, - workspace, wkspSize, writeSeqEntropy); + nbSeq, &entropy->fse, &entropyMetadata->fseMetadata, + workspace, wkspSize, writeSeqEntropy); return seqSize + literalsSize + ZSTD_blockHeaderSize; } /* Builds entropy statistics and uses them for blocksize estimation. * - * Returns the estimated compressed size of the seqStore, or a zstd error. + * @return: estimated compressed size of the seqStore, or a zstd error. */ -static size_t ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(seqStore_t* seqStore, const ZSTD_CCtx* zc) { - ZSTD_entropyCTablesMetadata_t entropyMetadata; +static size_t +ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(seqStore_t* seqStore, ZSTD_CCtx* zc) +{ + ZSTD_entropyCTablesMetadata_t* const entropyMetadata = &zc->blockSplitCtx.entropyMetadata; + DEBUGLOG(6, "ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize()"); FORWARD_IF_ERROR(ZSTD_buildBlockEntropyStats(seqStore, &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy, &zc->appliedParams, - &entropyMetadata, - zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE /* statically allocated in resetCCtx */), ""); - return ZSTD_estimateBlockSize(seqStore->litStart, (size_t)(seqStore->lit - seqStore->litStart), + entropyMetadata, + zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE), ""); + return ZSTD_estimateBlockSize( + seqStore->litStart, (size_t)(seqStore->lit - seqStore->litStart), seqStore->ofCode, seqStore->llCode, seqStore->mlCode, (size_t)(seqStore->sequences - seqStore->sequencesStart), - &zc->blockState.nextCBlock->entropy, &entropyMetadata, zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE, - (int)(entropyMetadata.hufMetadata.hType == set_compressed), 1); + &zc->blockState.nextCBlock->entropy, + entropyMetadata, + zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE, + (int)(entropyMetadata->hufMetadata.hType == set_compressed), 1); } /* Returns literals bytes represented in a seqStore */ -static size_t ZSTD_countSeqStoreLiteralsBytes(const seqStore_t* const seqStore) { +static size_t ZSTD_countSeqStoreLiteralsBytes(const seqStore_t* const seqStore) +{ size_t literalsBytes = 0; - size_t const nbSeqs = seqStore->sequences - seqStore->sequencesStart; + size_t const nbSeqs = (size_t)(seqStore->sequences - seqStore->sequencesStart); size_t i; for (i = 0; i < nbSeqs; ++i) { - seqDef seq = seqStore->sequencesStart[i]; + seqDef const seq = seqStore->sequencesStart[i]; literalsBytes += seq.litLength; if (i == seqStore->longLengthPos && seqStore->longLengthType == ZSTD_llt_literalLength) { literalsBytes += 0x10000; - } - } + } } return literalsBytes; } /* Returns match bytes represented in a seqStore */ -static size_t ZSTD_countSeqStoreMatchBytes(const seqStore_t* const seqStore) { +static size_t ZSTD_countSeqStoreMatchBytes(const seqStore_t* const seqStore) +{ size_t matchBytes = 0; - size_t const nbSeqs = seqStore->sequences - seqStore->sequencesStart; + size_t const nbSeqs = (size_t)(seqStore->sequences - seqStore->sequencesStart); size_t i; for (i = 0; i < nbSeqs; ++i) { seqDef seq = seqStore->sequencesStart[i]; - matchBytes += seq.matchLength + MINMATCH; + matchBytes += seq.mlBase + MINMATCH; if (i == seqStore->longLengthPos && seqStore->longLengthType == ZSTD_llt_matchLength) { matchBytes += 0x10000; - } - } + } } return matchBytes; } @@ -3369,15 +3787,12 @@ static size_t ZSTD_countSeqStoreMatchBytes(const seqStore_t* const seqStore) { */ static void ZSTD_deriveSeqStoreChunk(seqStore_t* resultSeqStore, const seqStore_t* originalSeqStore, - size_t startIdx, size_t endIdx) { - BYTE* const litEnd = originalSeqStore->lit; - size_t literalsBytes; - size_t literalsBytesPreceding = 0; - + size_t startIdx, size_t endIdx) +{ *resultSeqStore = *originalSeqStore; if (startIdx > 0) { resultSeqStore->sequences = originalSeqStore->sequencesStart + startIdx; - literalsBytesPreceding = ZSTD_countSeqStoreLiteralsBytes(resultSeqStore); + resultSeqStore->litStart += ZSTD_countSeqStoreLiteralsBytes(resultSeqStore); } /* Move longLengthPos into the correct position if necessary */ @@ -3390,13 +3805,12 @@ static void ZSTD_deriveSeqStoreChunk(seqStore_t* resultSeqStore, } resultSeqStore->sequencesStart = originalSeqStore->sequencesStart + startIdx; resultSeqStore->sequences = originalSeqStore->sequencesStart + endIdx; - literalsBytes = ZSTD_countSeqStoreLiteralsBytes(resultSeqStore); - resultSeqStore->litStart += literalsBytesPreceding; if (endIdx == (size_t)(originalSeqStore->sequences - originalSeqStore->sequencesStart)) { /* This accounts for possible last literals if the derived chunk reaches the end of the block */ - resultSeqStore->lit = litEnd; + assert(resultSeqStore->lit == originalSeqStore->lit); } else { - resultSeqStore->lit = resultSeqStore->litStart+literalsBytes; + size_t const literalsBytes = ZSTD_countSeqStoreLiteralsBytes(resultSeqStore); + resultSeqStore->lit = resultSeqStore->litStart + literalsBytes; } resultSeqStore->llCode += startIdx; resultSeqStore->mlCode += startIdx; @@ -3404,52 +3818,67 @@ static void ZSTD_deriveSeqStoreChunk(seqStore_t* resultSeqStore, } /** - * Returns the raw offset represented by the combination of offCode, ll0, and repcode history. - * offCode must be an offCode representing a repcode, therefore in the range of [0, 2]. + * Returns the raw offset represented by the combination of offBase, ll0, and repcode history. + * offBase must represent a repcode in the numeric representation of ZSTD_storeSeq(). */ -static U32 ZSTD_resolveRepcodeToRawOffset(const U32 rep[ZSTD_REP_NUM], const U32 offCode, const U32 ll0) { - U32 const adjustedOffCode = offCode + ll0; - assert(offCode < ZSTD_REP_NUM); - if (adjustedOffCode == ZSTD_REP_NUM) { - /* litlength == 0 and offCode == 2 implies selection of first repcode - 1 */ - assert(rep[0] > 0); +static U32 +ZSTD_resolveRepcodeToRawOffset(const U32 rep[ZSTD_REP_NUM], const U32 offBase, const U32 ll0) +{ + U32 const adjustedRepCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0; /* [ 0 - 3 ] */ + assert(OFFBASE_IS_REPCODE(offBase)); + if (adjustedRepCode == ZSTD_REP_NUM) { + assert(ll0); + /* litlength == 0 and offCode == 2 implies selection of first repcode - 1 + * This is only valid if it results in a valid offset value, aka > 0. + * Note : it may happen that `rep[0]==1` in exceptional circumstances. + * In which case this function will return 0, which is an invalid offset. + * It's not an issue though, since this value will be + * compared and discarded within ZSTD_seqStore_resolveOffCodes(). + */ return rep[0] - 1; } - return rep[adjustedOffCode]; + return rep[adjustedRepCode]; } /** * ZSTD_seqStore_resolveOffCodes() reconciles any possible divergences in offset history that may arise - * due to emission of RLE/raw blocks that disturb the offset history, and replaces any repcodes within - * the seqStore that may be invalid. + * due to emission of RLE/raw blocks that disturb the offset history, + * and replaces any repcodes within the seqStore that may be invalid. * - * dRepcodes are updated as would be on the decompression side. cRepcodes are updated exactly in - * accordance with the seqStore. + * dRepcodes are updated as would be on the decompression side. + * cRepcodes are updated exactly in accordance with the seqStore. + * + * Note : this function assumes seq->offBase respects the following numbering scheme : + * 0 : invalid + * 1-3 : repcode 1-3 + * 4+ : real_offset+3 */ -static void ZSTD_seqStore_resolveOffCodes(repcodes_t* const dRepcodes, repcodes_t* const cRepcodes, - seqStore_t* const seqStore, U32 const nbSeq) { +static void +ZSTD_seqStore_resolveOffCodes(repcodes_t* const dRepcodes, repcodes_t* const cRepcodes, + const seqStore_t* const seqStore, U32 const nbSeq) +{ U32 idx = 0; for (; idx < nbSeq; ++idx) { seqDef* const seq = seqStore->sequencesStart + idx; U32 const ll0 = (seq->litLength == 0); - U32 offCode = seq->offset - 1; - assert(seq->offset > 0); - if (offCode <= ZSTD_REP_MOVE) { - U32 const dRawOffset = ZSTD_resolveRepcodeToRawOffset(dRepcodes->rep, offCode, ll0); - U32 const cRawOffset = ZSTD_resolveRepcodeToRawOffset(cRepcodes->rep, offCode, ll0); + U32 const offBase = seq->offBase; + assert(offBase > 0); + if (OFFBASE_IS_REPCODE(offBase)) { + U32 const dRawOffset = ZSTD_resolveRepcodeToRawOffset(dRepcodes->rep, offBase, ll0); + U32 const cRawOffset = ZSTD_resolveRepcodeToRawOffset(cRepcodes->rep, offBase, ll0); /* Adjust simulated decompression repcode history if we come across a mismatch. Replace * the repcode with the offset it actually references, determined by the compression * repcode history. */ if (dRawOffset != cRawOffset) { - seq->offset = cRawOffset + ZSTD_REP_NUM; + seq->offBase = OFFSET_TO_OFFBASE(cRawOffset); } } /* Compression repcode history is always updated with values directly from the unmodified seqStore. * Decompression repcode history may use modified seq->offset value taken from compression repcode history. */ - *dRepcodes = ZSTD_updateRep(dRepcodes->rep, seq->offset - 1, ll0); - *cRepcodes = ZSTD_updateRep(cRepcodes->rep, offCode, ll0); + ZSTD_updateRep(dRepcodes->rep, seq->offBase, ll0); + ZSTD_updateRep(cRepcodes->rep, offBase, ll0); } } @@ -3458,11 +3887,14 @@ static void ZSTD_seqStore_resolveOffCodes(repcodes_t* const dRepcodes, repcodes_ * * Returns the total size of that block (including header) or a ZSTD error code. */ -static size_t ZSTD_compressSeqStore_singleBlock(ZSTD_CCtx* zc, seqStore_t* const seqStore, - repcodes_t* const dRep, repcodes_t* const cRep, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - U32 lastBlock, U32 isPartition) { +static size_t +ZSTD_compressSeqStore_singleBlock(ZSTD_CCtx* zc, + const seqStore_t* const seqStore, + repcodes_t* const dRep, repcodes_t* const cRep, + void* dst, size_t dstCapacity, + const void* src, size_t srcSize, + U32 lastBlock, U32 isPartition) +{ const U32 rleMaxLength = 25; BYTE* op = (BYTE*)dst; const BYTE* ip = (const BYTE*)src; @@ -3471,9 +3903,11 @@ static size_t ZSTD_compressSeqStore_singleBlock(ZSTD_CCtx* zc, seqStore_t* const /* In case of an RLE or raw block, the simulated decompression repcode history must be reset */ repcodes_t const dRepOriginal = *dRep; + DEBUGLOG(5, "ZSTD_compressSeqStore_singleBlock"); if (isPartition) ZSTD_seqStore_resolveOffCodes(dRep, cRep, seqStore, (U32)(seqStore->sequences - seqStore->sequencesStart)); + RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize, dstSize_tooSmall, "Block header doesn't fit"); cSeqsSize = ZSTD_entropyCompressSeqStore(seqStore, &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy, &zc->appliedParams, @@ -3499,9 +3933,6 @@ static size_t ZSTD_compressSeqStore_singleBlock(ZSTD_CCtx* zc, seqStore_t* const return 0; } - if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid) - zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check; - if (cSeqsSize == 0) { cSize = ZSTD_noCompressBlock(op, dstCapacity, ip, srcSize, lastBlock); FORWARD_IF_ERROR(cSize, "Nocompress block failed"); @@ -3518,6 +3949,10 @@ static size_t ZSTD_compressSeqStore_singleBlock(ZSTD_CCtx* zc, seqStore_t* const cSize = ZSTD_blockHeaderSize + cSeqsSize; DEBUGLOG(4, "Writing out compressed block, size: %zu", cSize); } + + if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid) + zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check; + return cSize; } @@ -3528,45 +3963,52 @@ typedef struct { } seqStoreSplits; #define MIN_SEQUENCES_BLOCK_SPLITTING 300 -#define MAX_NB_SPLITS 196 /* Helper function to perform the recursive search for block splits. * Estimates the cost of seqStore prior to split, and estimates the cost of splitting the sequences in half. - * If advantageous to split, then we recurse down the two sub-blocks. If not, or if an error occurred in estimation, then - * we do not recurse. + * If advantageous to split, then we recurse down the two sub-blocks. + * If not, or if an error occurred in estimation, then we do not recurse. * - * Note: The recursion depth is capped by a heuristic minimum number of sequences, defined by MIN_SEQUENCES_BLOCK_SPLITTING. + * Note: The recursion depth is capped by a heuristic minimum number of sequences, + * defined by MIN_SEQUENCES_BLOCK_SPLITTING. * In theory, this means the absolute largest recursion depth is 10 == log2(maxNbSeqInBlock/MIN_SEQUENCES_BLOCK_SPLITTING). * In practice, recursion depth usually doesn't go beyond 4. * - * Furthermore, the number of splits is capped by MAX_NB_SPLITS. At MAX_NB_SPLITS == 196 with the current existing blockSize + * Furthermore, the number of splits is capped by ZSTD_MAX_NB_BLOCK_SPLITS. + * At ZSTD_MAX_NB_BLOCK_SPLITS == 196 with the current existing blockSize * maximum of 128 KB, this value is actually impossible to reach. */ -static void ZSTD_deriveBlockSplitsHelper(seqStoreSplits* splits, size_t startIdx, size_t endIdx, - const ZSTD_CCtx* zc, const seqStore_t* origSeqStore) { - seqStore_t fullSeqStoreChunk; - seqStore_t firstHalfSeqStore; - seqStore_t secondHalfSeqStore; +static void +ZSTD_deriveBlockSplitsHelper(seqStoreSplits* splits, size_t startIdx, size_t endIdx, + ZSTD_CCtx* zc, const seqStore_t* origSeqStore) +{ + seqStore_t* const fullSeqStoreChunk = &zc->blockSplitCtx.fullSeqStoreChunk; + seqStore_t* const firstHalfSeqStore = &zc->blockSplitCtx.firstHalfSeqStore; + seqStore_t* const secondHalfSeqStore = &zc->blockSplitCtx.secondHalfSeqStore; size_t estimatedOriginalSize; size_t estimatedFirstHalfSize; size_t estimatedSecondHalfSize; size_t midIdx = (startIdx + endIdx)/2; - if (endIdx - startIdx < MIN_SEQUENCES_BLOCK_SPLITTING || splits->idx >= MAX_NB_SPLITS) { + DEBUGLOG(5, "ZSTD_deriveBlockSplitsHelper: startIdx=%zu endIdx=%zu", startIdx, endIdx); + assert(endIdx >= startIdx); + if (endIdx - startIdx < MIN_SEQUENCES_BLOCK_SPLITTING || splits->idx >= ZSTD_MAX_NB_BLOCK_SPLITS) { + DEBUGLOG(6, "ZSTD_deriveBlockSplitsHelper: Too few sequences (%zu)", endIdx - startIdx); return; } - ZSTD_deriveSeqStoreChunk(&fullSeqStoreChunk, origSeqStore, startIdx, endIdx); - ZSTD_deriveSeqStoreChunk(&firstHalfSeqStore, origSeqStore, startIdx, midIdx); - ZSTD_deriveSeqStoreChunk(&secondHalfSeqStore, origSeqStore, midIdx, endIdx); - estimatedOriginalSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&fullSeqStoreChunk, zc); - estimatedFirstHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&firstHalfSeqStore, zc); - estimatedSecondHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&secondHalfSeqStore, zc); + ZSTD_deriveSeqStoreChunk(fullSeqStoreChunk, origSeqStore, startIdx, endIdx); + ZSTD_deriveSeqStoreChunk(firstHalfSeqStore, origSeqStore, startIdx, midIdx); + ZSTD_deriveSeqStoreChunk(secondHalfSeqStore, origSeqStore, midIdx, endIdx); + estimatedOriginalSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(fullSeqStoreChunk, zc); + estimatedFirstHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(firstHalfSeqStore, zc); + estimatedSecondHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(secondHalfSeqStore, zc); DEBUGLOG(5, "Estimated original block size: %zu -- First half split: %zu -- Second half split: %zu", estimatedOriginalSize, estimatedFirstHalfSize, estimatedSecondHalfSize); if (ZSTD_isError(estimatedOriginalSize) || ZSTD_isError(estimatedFirstHalfSize) || ZSTD_isError(estimatedSecondHalfSize)) { return; } if (estimatedFirstHalfSize + estimatedSecondHalfSize < estimatedOriginalSize) { + DEBUGLOG(5, "split decided at seqNb:%zu", midIdx); ZSTD_deriveBlockSplitsHelper(splits, startIdx, midIdx, zc, origSeqStore); splits->splitLocations[splits->idx] = (U32)midIdx; splits->idx++; @@ -3574,14 +4016,18 @@ static void ZSTD_deriveBlockSplitsHelper(seqStoreSplits* splits, size_t startIdx } } -/* Base recursive function. Populates a table with intra-block partition indices that can improve compression ratio. +/* Base recursive function. + * Populates a table with intra-block partition indices that can improve compression ratio. * - * Returns the number of splits made (which equals the size of the partition table - 1). + * @return: number of splits made (which equals the size of the partition table - 1). */ -static size_t ZSTD_deriveBlockSplits(ZSTD_CCtx* zc, U32 partitions[], U32 nbSeq) { - seqStoreSplits splits = {partitions, 0}; +static size_t ZSTD_deriveBlockSplits(ZSTD_CCtx* zc, U32 partitions[], U32 nbSeq) +{ + seqStoreSplits splits; + splits.splitLocations = partitions; + splits.idx = 0; if (nbSeq <= 4) { - DEBUGLOG(4, "ZSTD_deriveBlockSplits: Too few sequences to split"); + DEBUGLOG(5, "ZSTD_deriveBlockSplits: Too few sequences to split (%u <= 4)", nbSeq); /* Refuse to try and split anything with less than 4 sequences */ return 0; } @@ -3596,17 +4042,21 @@ static size_t ZSTD_deriveBlockSplits(ZSTD_CCtx* zc, U32 partitions[], U32 nbSeq) * * Returns combined size of all blocks (which includes headers), or a ZSTD error code. */ -static size_t ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc, void* dst, size_t dstCapacity, - const void* src, size_t blockSize, U32 lastBlock, U32 nbSeq) { +static size_t +ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc, + void* dst, size_t dstCapacity, + const void* src, size_t blockSize, + U32 lastBlock, U32 nbSeq) +{ size_t cSize = 0; const BYTE* ip = (const BYTE*)src; BYTE* op = (BYTE*)dst; - U32 partitions[MAX_NB_SPLITS]; size_t i = 0; size_t srcBytesTotal = 0; - size_t numSplits = ZSTD_deriveBlockSplits(zc, partitions, nbSeq); - seqStore_t nextSeqStore; - seqStore_t currSeqStore; + U32* const partitions = zc->blockSplitCtx.partitions; /* size == ZSTD_MAX_NB_BLOCK_SPLITS */ + seqStore_t* const nextSeqStore = &zc->blockSplitCtx.nextSeqStore; + seqStore_t* const currSeqStore = &zc->blockSplitCtx.currSeqStore; + size_t const numSplits = ZSTD_deriveBlockSplits(zc, partitions, nbSeq); /* If a block is split and some partitions are emitted as RLE/uncompressed, then repcode history * may become invalid. In order to reconcile potentially invalid repcodes, we keep track of two @@ -3626,77 +4076,81 @@ static size_t ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc, void* dst, s repcodes_t cRep; ZSTD_memcpy(dRep.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t)); ZSTD_memcpy(cRep.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t)); + ZSTD_memset(nextSeqStore, 0, sizeof(seqStore_t)); - DEBUGLOG(4, "ZSTD_compressBlock_splitBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)", + DEBUGLOG(5, "ZSTD_compressBlock_splitBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)", (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit, (unsigned)zc->blockState.matchState.nextToUpdate); if (numSplits == 0) { - size_t cSizeSingleBlock = ZSTD_compressSeqStore_singleBlock(zc, &zc->seqStore, - &dRep, &cRep, - op, dstCapacity, - ip, blockSize, - lastBlock, 0 /* isPartition */); + size_t cSizeSingleBlock = + ZSTD_compressSeqStore_singleBlock(zc, &zc->seqStore, + &dRep, &cRep, + op, dstCapacity, + ip, blockSize, + lastBlock, 0 /* isPartition */); FORWARD_IF_ERROR(cSizeSingleBlock, "Compressing single block from splitBlock_internal() failed!"); DEBUGLOG(5, "ZSTD_compressBlock_splitBlock_internal: No splits"); - assert(cSizeSingleBlock <= ZSTD_BLOCKSIZE_MAX + ZSTD_blockHeaderSize); + assert(zc->blockSize <= ZSTD_BLOCKSIZE_MAX); + assert(cSizeSingleBlock <= zc->blockSize + ZSTD_blockHeaderSize); return cSizeSingleBlock; } - ZSTD_deriveSeqStoreChunk(&currSeqStore, &zc->seqStore, 0, partitions[0]); + ZSTD_deriveSeqStoreChunk(currSeqStore, &zc->seqStore, 0, partitions[0]); for (i = 0; i <= numSplits; ++i) { - size_t srcBytes; size_t cSizeChunk; U32 const lastPartition = (i == numSplits); U32 lastBlockEntireSrc = 0; - srcBytes = ZSTD_countSeqStoreLiteralsBytes(&currSeqStore) + ZSTD_countSeqStoreMatchBytes(&currSeqStore); + size_t srcBytes = ZSTD_countSeqStoreLiteralsBytes(currSeqStore) + ZSTD_countSeqStoreMatchBytes(currSeqStore); srcBytesTotal += srcBytes; if (lastPartition) { /* This is the final partition, need to account for possible last literals */ srcBytes += blockSize - srcBytesTotal; lastBlockEntireSrc = lastBlock; } else { - ZSTD_deriveSeqStoreChunk(&nextSeqStore, &zc->seqStore, partitions[i], partitions[i+1]); + ZSTD_deriveSeqStoreChunk(nextSeqStore, &zc->seqStore, partitions[i], partitions[i+1]); } - cSizeChunk = ZSTD_compressSeqStore_singleBlock(zc, &currSeqStore, + cSizeChunk = ZSTD_compressSeqStore_singleBlock(zc, currSeqStore, &dRep, &cRep, op, dstCapacity, ip, srcBytes, lastBlockEntireSrc, 1 /* isPartition */); - DEBUGLOG(5, "Estimated size: %zu actual size: %zu", ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&currSeqStore, zc), cSizeChunk); + DEBUGLOG(5, "Estimated size: %zu vs %zu : actual size", + ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(currSeqStore, zc), cSizeChunk); FORWARD_IF_ERROR(cSizeChunk, "Compressing chunk failed!"); ip += srcBytes; op += cSizeChunk; dstCapacity -= cSizeChunk; cSize += cSizeChunk; - currSeqStore = nextSeqStore; - assert(cSizeChunk <= ZSTD_BLOCKSIZE_MAX + ZSTD_blockHeaderSize); + *currSeqStore = *nextSeqStore; + assert(cSizeChunk <= zc->blockSize + ZSTD_blockHeaderSize); } - /* cRep and dRep may have diverged during the compression. If so, we use the dRep repcodes - * for the next block. + /* cRep and dRep may have diverged during the compression. + * If so, we use the dRep repcodes for the next block. */ ZSTD_memcpy(zc->blockState.prevCBlock->rep, dRep.rep, sizeof(repcodes_t)); return cSize; } -static size_t ZSTD_compressBlock_splitBlock(ZSTD_CCtx* zc, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, U32 lastBlock) { - const BYTE* ip = (const BYTE*)src; - BYTE* op = (BYTE*)dst; +static size_t +ZSTD_compressBlock_splitBlock(ZSTD_CCtx* zc, + void* dst, size_t dstCapacity, + const void* src, size_t srcSize, U32 lastBlock) +{ U32 nbSeq; size_t cSize; DEBUGLOG(4, "ZSTD_compressBlock_splitBlock"); + assert(zc->appliedParams.useBlockSplitter == ZSTD_ps_enable); { const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize); FORWARD_IF_ERROR(bss, "ZSTD_buildSeqStore failed"); if (bss == ZSTDbss_noCompress) { if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid) zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check; - cSize = ZSTD_noCompressBlock(op, dstCapacity, ip, srcSize, lastBlock); + cSize = ZSTD_noCompressBlock(dst, dstCapacity, src, srcSize, lastBlock); FORWARD_IF_ERROR(cSize, "ZSTD_noCompressBlock failed"); DEBUGLOG(4, "ZSTD_compressBlock_splitBlock: Nocompress block"); return cSize; @@ -3704,19 +4158,19 @@ static size_t ZSTD_compressBlock_splitBlock(ZSTD_CCtx* zc, nbSeq = (U32)(zc->seqStore.sequences - zc->seqStore.sequencesStart); } - assert(zc->appliedParams.splitBlocks == 1); cSize = ZSTD_compressBlock_splitBlock_internal(zc, dst, dstCapacity, src, srcSize, lastBlock, nbSeq); FORWARD_IF_ERROR(cSize, "Splitting blocks failed!"); return cSize; } -static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, U32 frame) +static size_t +ZSTD_compressBlock_internal(ZSTD_CCtx* zc, + void* dst, size_t dstCapacity, + const void* src, size_t srcSize, U32 frame) { - /* This the upper bound for the length of an rle block. - * This isn't the actual upper bound. Finding the real threshold - * needs further investigation. + /* This is an estimated upper bound for the length of an rle block. + * This isn't the actual upper bound. + * Finding the real threshold needs further investigation. */ const U32 rleMaxLength = 25; size_t cSize; @@ -3746,12 +4200,6 @@ static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE /* statically allocated in resetCCtx */, zc->bmi2); - if (zc->seqCollector.collectSequences) { - ZSTD_copyBlockSequences(zc); - return 0; - } - - if (frame && /* We don't want to emit our first block as a RLE even if it qualifies because * doing so will cause the decoder (cli only) to throw a "should consume all input error." @@ -3814,10 +4262,11 @@ static size_t ZSTD_compressBlock_targetCBlockSize_body(ZSTD_CCtx* zc, * * cSize >= blockBound(srcSize): We have expanded the block too much so * emit an uncompressed block. */ - { - size_t const cSize = ZSTD_compressSuperBlock(zc, dst, dstCapacity, src, srcSize, lastBlock); + { size_t const cSize = + ZSTD_compressSuperBlock(zc, dst, dstCapacity, src, srcSize, lastBlock); if (cSize != ERROR(dstSize_tooSmall)) { - size_t const maxCSize = srcSize - ZSTD_minGain(srcSize, zc->appliedParams.cParams.strategy); + size_t const maxCSize = + srcSize - ZSTD_minGain(srcSize, zc->appliedParams.cParams.strategy); FORWARD_IF_ERROR(cSize, "ZSTD_compressSuperBlock failed"); if (cSize != 0 && cSize < maxCSize + ZSTD_blockHeaderSize) { ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState); @@ -3825,7 +4274,7 @@ static size_t ZSTD_compressBlock_targetCBlockSize_body(ZSTD_CCtx* zc, } } } - } + } /* if (bss == ZSTDbss_compress)*/ DEBUGLOG(6, "Resorting to ZSTD_noCompressBlock()"); /* Superblock compression failed, attempt to emit a single no compress block. @@ -3883,7 +4332,7 @@ static void ZSTD_overflowCorrectIfNeeded(ZSTD_matchState_t* ms, * All blocks will be terminated, all input will be consumed. * Function will issue an error if there is not enough `dstCapacity` to hold the compressed content. * Frame is supposed already started (header already produced) -* @return : compressed size, or an error code +* @return : compressed size, or an error code */ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, @@ -3907,7 +4356,9 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx, ZSTD_matchState_t* const ms = &cctx->blockState.matchState; U32 const lastBlock = lastFrameChunk & (blockSize >= remaining); - RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE, + /* TODO: See 3090. We reduced MIN_CBLOCK_SIZE from 3 to 2 so to compensate we are adding + * additional 1. We need to revisit and change this logic to be more consistent */ + RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE + 1, dstSize_tooSmall, "not enough space to store compressed block"); if (remaining < blockSize) blockSize = remaining; @@ -3915,6 +4366,7 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx, ZSTD_overflowCorrectIfNeeded( ms, &cctx->workspace, &cctx->appliedParams, ip, ip + blockSize); ZSTD_checkDictValidity(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd, &ms->dictMatchState); + ZSTD_window_enforceMaxDist(&ms->window, ip, maxDist, &ms->loadedDictEnd, &ms->dictMatchState); /* Ensure hash/chain table insertion resumes no sooner than lowlimit */ if (ms->nextToUpdate < ms->window.lowLimit) ms->nextToUpdate = ms->window.lowLimit; @@ -3945,7 +4397,7 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx, MEM_writeLE24(op, cBlockHeader); cSize += ZSTD_blockHeaderSize; } - } + } /* if (ZSTD_useTargetCBlockSize(&cctx->appliedParams))*/ ip += blockSize; @@ -3991,7 +4443,9 @@ static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity, if (!singleSegment) op[pos++] = windowLogByte; switch(dictIDSizeCode) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : break; case 1 : op[pos] = (BYTE)(dictID); pos++; break; case 2 : MEM_writeLE16(op+pos, (U16)dictID); pos+=2; break; @@ -3999,7 +4453,9 @@ static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity, } switch(fcsCode) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : if (singleSegment) op[pos++] = (BYTE)(pledgedSrcSize); break; case 1 : MEM_writeLE16(op+pos, (U16)(pledgedSrcSize-256)); pos+=2; break; case 2 : MEM_writeLE32(op+pos, (U32)(pledgedSrcSize)); pos+=4; break; @@ -4047,7 +4503,7 @@ size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSe { RETURN_ERROR_IF(cctx->stage != ZSTDcs_init, stage_wrong, "wrong cctx stage"); - RETURN_ERROR_IF(cctx->appliedParams.ldmParams.enableLdm, + RETURN_ERROR_IF(cctx->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable, parameter_unsupported, "incompatible with ldm"); cctx->externSeqStore.seq = seq; @@ -4088,7 +4544,7 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx, ms->forceNonContiguous = 0; ms->nextToUpdate = ms->window.dictLimit; } - if (cctx->appliedParams.ldmParams.enableLdm) { + if (cctx->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_window_update(&cctx->ldmState.window, src, srcSize, /* forceNonContiguous */ 0); } @@ -4133,7 +4589,7 @@ size_t ZSTD_getBlockSize(const ZSTD_CCtx* cctx) { ZSTD_compressionParameters const cParams = cctx->appliedParams.cParams; assert(!ZSTD_checkCParams(cParams)); - return MIN (ZSTD_BLOCKSIZE_MAX, (U32)1 << cParams.windowLog); + return MIN(cctx->appliedParams.maxBlockSize, (size_t)1 << cParams.windowLog); } size_t ZSTD_compressBlock(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize) @@ -4153,31 +4609,47 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, ZSTD_cwksp* ws, ZSTD_CCtx_params const* params, const void* src, size_t srcSize, - ZSTD_dictTableLoadMethod_e dtlm) + ZSTD_dictTableLoadMethod_e dtlm, + ZSTD_tableFillPurpose_e tfp) { const BYTE* ip = (const BYTE*) src; const BYTE* const iend = ip + srcSize; - int const loadLdmDict = params->ldmParams.enableLdm && ls != NULL; + int const loadLdmDict = params->ldmParams.enableLdm == ZSTD_ps_enable && ls != NULL; - /* Assert that we the ms params match the params we're being given */ + /* Assert that the ms params match the params we're being given */ ZSTD_assertEqualCParams(params->cParams, ms->cParams); - if (srcSize > ZSTD_CHUNKSIZE_MAX) { + { /* Ensure large dictionaries can't cause index overflow */ + /* Allow the dictionary to set indices up to exactly ZSTD_CURRENT_MAX. * Dictionaries right at the edge will immediately trigger overflow * correction, but I don't want to insert extra constraints here. */ - U32 const maxDictSize = ZSTD_CURRENT_MAX - 1; - /* We must have cleared our windows when our source is this large. */ - assert(ZSTD_window_isEmpty(ms->window)); - if (loadLdmDict) - assert(ZSTD_window_isEmpty(ls->window)); + U32 maxDictSize = ZSTD_CURRENT_MAX - ZSTD_WINDOW_START_INDEX; + + int const CDictTaggedIndices = ZSTD_CDictIndicesAreTagged(¶ms->cParams); + if (CDictTaggedIndices && tfp == ZSTD_tfp_forCDict) { + /* Some dictionary matchfinders in zstd use "short cache", + * which treats the lower ZSTD_SHORT_CACHE_TAG_BITS of each + * CDict hashtable entry as a tag rather than as part of an index. + * When short cache is used, we need to truncate the dictionary + * so that its indices don't overlap with the tag. */ + U32 const shortCacheMaxDictSize = (1u << (32 - ZSTD_SHORT_CACHE_TAG_BITS)) - ZSTD_WINDOW_START_INDEX; + maxDictSize = MIN(maxDictSize, shortCacheMaxDictSize); + assert(!loadLdmDict); + } + /* If the dictionary is too large, only load the suffix of the dictionary. */ if (srcSize > maxDictSize) { ip = iend - maxDictSize; src = ip; srcSize = maxDictSize; - } + } } + + if (srcSize > ZSTD_CHUNKSIZE_MAX) { + /* We must have cleared our windows when our source is this large. */ + assert(ZSTD_window_isEmpty(ms->window)); + if (loadLdmDict) assert(ZSTD_window_isEmpty(ls->window)); } DEBUGLOG(4, "ZSTD_loadDictionaryContent(): useRowMatchFinder=%d", (int)params->useRowMatchFinder); @@ -4200,10 +4672,10 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, switch(params->cParams.strategy) { case ZSTD_fast: - ZSTD_fillHashTable(ms, iend, dtlm); + ZSTD_fillHashTable(ms, iend, dtlm, tfp); break; case ZSTD_dfast: - ZSTD_fillDoubleHashTable(ms, iend, dtlm); + ZSTD_fillDoubleHashTable(ms, iend, dtlm, tfp); break; case ZSTD_greedy: @@ -4214,8 +4686,8 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, assert(ms->chainTable != NULL); ZSTD_dedicatedDictSearch_lazy_loadDictionary(ms, iend-HASH_READ_SIZE); } else { - assert(params->useRowMatchFinder != ZSTD_urm_auto); - if (params->useRowMatchFinder == ZSTD_urm_enableRowMatchFinder) { + assert(params->useRowMatchFinder != ZSTD_ps_auto); + if (params->useRowMatchFinder == ZSTD_ps_enable) { size_t const tagTableSize = ((size_t)1 << params->cParams.hashLog) * sizeof(U16); ZSTD_memset(ms->tagTable, 0, tagTableSize); ZSTD_row_update(ms, iend-HASH_READ_SIZE); @@ -4369,6 +4841,7 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs, ZSTD_CCtx_params const* params, const void* dict, size_t dictSize, ZSTD_dictTableLoadMethod_e dtlm, + ZSTD_tableFillPurpose_e tfp, void* workspace) { const BYTE* dictPtr = (const BYTE*)dict; @@ -4387,7 +4860,7 @@ static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs, { size_t const dictContentSize = (size_t)(dictEnd - dictPtr); FORWARD_IF_ERROR(ZSTD_loadDictionaryContent( - ms, NULL, ws, params, dictPtr, dictContentSize, dtlm), ""); + ms, NULL, ws, params, dictPtr, dictContentSize, dtlm, tfp), ""); } return dictID; } @@ -4403,6 +4876,7 @@ ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, const void* dict, size_t dictSize, ZSTD_dictContentType_e dictContentType, ZSTD_dictTableLoadMethod_e dtlm, + ZSTD_tableFillPurpose_e tfp, void* workspace) { DEBUGLOG(4, "ZSTD_compress_insertDictionary (dictSize=%u)", (U32)dictSize); @@ -4415,13 +4889,13 @@ ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, /* dict restricted modes */ if (dictContentType == ZSTD_dct_rawContent) - return ZSTD_loadDictionaryContent(ms, ls, ws, params, dict, dictSize, dtlm); + return ZSTD_loadDictionaryContent(ms, ls, ws, params, dict, dictSize, dtlm, tfp); if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) { if (dictContentType == ZSTD_dct_auto) { DEBUGLOG(4, "raw content dictionary detected"); return ZSTD_loadDictionaryContent( - ms, ls, ws, params, dict, dictSize, dtlm); + ms, ls, ws, params, dict, dictSize, dtlm, tfp); } RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong, ""); assert(0); /* impossible */ @@ -4429,13 +4903,14 @@ ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, /* dict as full zstd dictionary */ return ZSTD_loadZstdDictionary( - bs, ms, ws, params, dict, dictSize, dtlm, workspace); + bs, ms, ws, params, dict, dictSize, dtlm, tfp, workspace); } #define ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF (128 KB) #define ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER (6ULL) /*! ZSTD_compressBegin_internal() : + * Assumption : either @dict OR @cdict (or none) is non-NULL, never both * @return : 0, or an error code */ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, @@ -4471,11 +4946,11 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx, cctx->blockState.prevCBlock, &cctx->blockState.matchState, &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, cdict->dictContent, cdict->dictContentSize, cdict->dictContentType, dtlm, - cctx->entropyWorkspace) + ZSTD_tfp_forCCtx, cctx->entropyWorkspace) : ZSTD_compress_insertDictionary( cctx->blockState.prevCBlock, &cctx->blockState.matchState, &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, dict, dictSize, - dictContentType, dtlm, cctx->entropyWorkspace); + dictContentType, dtlm, ZSTD_tfp_forCCtx, cctx->entropyWorkspace); FORWARD_IF_ERROR(dictID, "ZSTD_compress_insertDictionary failed"); assert(dictID <= UINT_MAX); cctx->dictID = (U32)dictID; @@ -4516,11 +4991,11 @@ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, &cctxParams, pledgedSrcSize); } -size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel) +size_t +ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel) { ZSTD_CCtx_params cctxParams; - { - ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, dictSize, ZSTD_cpm_noAttachDict); + { ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, dictSize, ZSTD_cpm_noAttachDict); ZSTD_CCtxParams_init_internal(&cctxParams, ¶ms, (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : compressionLevel); } DEBUGLOG(4, "ZSTD_compressBegin_usingDict (dictSize=%u)", (unsigned)dictSize); @@ -4715,7 +5190,7 @@ size_t ZSTD_estimateCDictSize_advanced( + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) /* enableDedicatedDictSearch == 1 ensures that CDict estimation will not be too small * in case we are using DDS with row-hash. */ - + ZSTD_sizeof_matchState(&cParams, ZSTD_resolveRowMatchFinderMode(ZSTD_urm_auto, &cParams), + + ZSTD_sizeof_matchState(&cParams, ZSTD_resolveRowMatchFinderMode(ZSTD_ps_auto, &cParams), /* enableDedicatedDictSearch */ 1, /* forCCtx */ 0) + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void *)))); @@ -4779,7 +5254,7 @@ static size_t ZSTD_initCDict_internal( { size_t const dictID = ZSTD_compress_insertDictionary( &cdict->cBlockState, &cdict->matchState, NULL, &cdict->workspace, ¶ms, cdict->dictContent, cdict->dictContentSize, - dictContentType, ZSTD_dtlm_full, cdict->entropyWorkspace); + dictContentType, ZSTD_dtlm_full, ZSTD_tfp_forCDict, cdict->entropyWorkspace); FORWARD_IF_ERROR(dictID, "ZSTD_compress_insertDictionary failed"); assert(dictID <= (size_t)(U32)-1); cdict->dictID = (U32)dictID; @@ -4792,7 +5267,7 @@ static size_t ZSTD_initCDict_internal( static ZSTD_CDict* ZSTD_createCDict_advanced_internal(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_compressionParameters cParams, - ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + ZSTD_paramSwitch_e useRowMatchFinder, U32 enableDedicatedDictSearch, ZSTD_customMem customMem) { @@ -4842,7 +5317,7 @@ ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize, &cctxParams, customMem); } -ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced2( +ZSTD_CDict* ZSTD_createCDict_advanced2( const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, @@ -4947,7 +5422,7 @@ const ZSTD_CDict* ZSTD_initStaticCDict( ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams) { - ZSTD_useRowMatchFinderMode_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(ZSTD_urm_auto, &cParams); + ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(ZSTD_ps_auto, &cParams); /* enableDedicatedDictSearch == 1 ensures matchstate is not too small in case this CDict will be used for DDS + row hash */ size_t const matchStateSize = ZSTD_sizeof_matchState(&cParams, useRowMatchFinder, /* enableDedicatedDictSearch */ 1, /* forCCtx */ 0); size_t const neededSize = ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) @@ -5267,30 +5742,41 @@ size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel) static size_t ZSTD_nextInputSizeHint(const ZSTD_CCtx* cctx) { - size_t hintInSize = cctx->inBuffTarget - cctx->inBuffPos; - if (hintInSize==0) hintInSize = cctx->blockSize; - return hintInSize; + if (cctx->appliedParams.inBufferMode == ZSTD_bm_stable) { + return cctx->blockSize - cctx->stableIn_notConsumed; + } + assert(cctx->appliedParams.inBufferMode == ZSTD_bm_buffered); + { size_t hintInSize = cctx->inBuffTarget - cctx->inBuffPos; + if (hintInSize==0) hintInSize = cctx->blockSize; + return hintInSize; + } } /** ZSTD_compressStream_generic(): * internal function for all *compressStream*() variants - * non-static, because can be called from zstdmt_compress.c - * @return : hint size for next input */ + * @return : hint size for next input to complete ongoing block */ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input, ZSTD_EndDirective const flushMode) { - const char* const istart = (const char*)input->src; - const char* const iend = input->size != 0 ? istart + input->size : istart; - const char* ip = input->pos != 0 ? istart + input->pos : istart; - char* const ostart = (char*)output->dst; - char* const oend = output->size != 0 ? ostart + output->size : ostart; - char* op = output->pos != 0 ? ostart + output->pos : ostart; + const char* const istart = (assert(input != NULL), (const char*)input->src); + const char* const iend = (istart != NULL) ? istart + input->size : istart; + const char* ip = (istart != NULL) ? istart + input->pos : istart; + char* const ostart = (assert(output != NULL), (char*)output->dst); + char* const oend = (ostart != NULL) ? ostart + output->size : ostart; + char* op = (ostart != NULL) ? ostart + output->pos : ostart; U32 someMoreWork = 1; /* check expectations */ - DEBUGLOG(5, "ZSTD_compressStream_generic, flush=%u", (unsigned)flushMode); + DEBUGLOG(5, "ZSTD_compressStream_generic, flush=%i, srcSize = %zu", (int)flushMode, input->size - input->pos); + assert(zcs != NULL); + if (zcs->appliedParams.inBufferMode == ZSTD_bm_stable) { + assert(input->pos >= zcs->stableIn_notConsumed); + input->pos -= zcs->stableIn_notConsumed; + ip -= zcs->stableIn_notConsumed; + zcs->stableIn_notConsumed = 0; + } if (zcs->appliedParams.inBufferMode == ZSTD_bm_buffered) { assert(zcs->inBuff != NULL); assert(zcs->inBuffSize > 0); @@ -5299,8 +5785,10 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, assert(zcs->outBuff != NULL); assert(zcs->outBuffSize > 0); } - assert(output->pos <= output->size); + if (input->src == NULL) assert(input->size == 0); assert(input->pos <= input->size); + if (output->dst == NULL) assert(output->size == 0); + assert(output->pos <= output->size); assert((U32)flushMode <= (U32)ZSTD_e_end); while (someMoreWork) { @@ -5332,8 +5820,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, zcs->inBuff + zcs->inBuffPos, toLoad, ip, iend-ip); zcs->inBuffPos += loaded; - if (loaded != 0) - ip += loaded; + if (ip) ip += loaded; if ( (flushMode == ZSTD_e_continue) && (zcs->inBuffPos < zcs->inBuffTarget) ) { /* not enough input to fill full block : stop here */ @@ -5344,6 +5831,20 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, /* empty */ someMoreWork = 0; break; } + } else { + assert(zcs->appliedParams.inBufferMode == ZSTD_bm_stable); + if ( (flushMode == ZSTD_e_continue) + && ( (size_t)(iend - ip) < zcs->blockSize) ) { + /* can't compress a full block : stop here */ + zcs->stableIn_notConsumed = (size_t)(iend - ip); + ip = iend; /* pretend to have consumed input */ + someMoreWork = 0; break; + } + if ( (flushMode == ZSTD_e_flush) + && (ip == iend) ) { + /* empty */ + someMoreWork = 0; break; + } } /* compress current block (note : this stage cannot be stopped in the middle) */ DEBUGLOG(5, "stream compression stage (flushMode==%u)", flushMode); @@ -5351,9 +5852,8 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, void* cDst; size_t cSize; size_t oSize = oend-op; - size_t const iSize = inputBuffered - ? zcs->inBuffPos - zcs->inToCompress - : MIN((size_t)(iend - ip), zcs->blockSize); + size_t const iSize = inputBuffered ? zcs->inBuffPos - zcs->inToCompress + : MIN((size_t)(iend - ip), zcs->blockSize); if (oSize >= ZSTD_compressBound(iSize) || zcs->appliedParams.outBufferMode == ZSTD_bm_stable) cDst = op; /* compress into output buffer, to skip flush stage */ else @@ -5376,19 +5876,16 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, if (!lastBlock) assert(zcs->inBuffTarget <= zcs->inBuffSize); zcs->inToCompress = zcs->inBuffPos; - } else { - unsigned const lastBlock = (ip + iSize == iend); - assert(flushMode == ZSTD_e_end /* Already validated */); + } else { /* !inputBuffered, hence ZSTD_bm_stable */ + unsigned const lastBlock = (flushMode == ZSTD_e_end) && (ip + iSize == iend); cSize = lastBlock ? ZSTD_compressEnd(zcs, cDst, oSize, ip, iSize) : ZSTD_compressContinue(zcs, cDst, oSize, ip, iSize); /* Consume the input prior to error checking to mirror buffered mode. */ - if (iSize > 0) - ip += iSize; + if (ip) ip += iSize; FORWARD_IF_ERROR(cSize, "%s", lastBlock ? "ZSTD_compressEnd failed" : "ZSTD_compressContinue failed"); zcs->frameEnded = lastBlock; - if (lastBlock) - assert(ip == iend); + if (lastBlock) assert(ip == iend); } if (cDst == op) { /* no need to flush */ op += cSize; @@ -5403,7 +5900,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, zcs->outBuffFlushedSize = 0; zcs->streamStage = zcss_flush; /* pass-through to flush stage */ } - /* fall-through */ + ZSTD_FALLTHROUGH; case zcss_flush: DEBUGLOG(5, "flush stage"); assert(zcs->appliedParams.outBufferMode == ZSTD_bm_buffered); @@ -5464,8 +5961,10 @@ size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuf /* After a compression call set the expected input/output buffer. * This is validated at the start of the next compression call. */ -static void ZSTD_setBufferExpectations(ZSTD_CCtx* cctx, ZSTD_outBuffer const* output, ZSTD_inBuffer const* input) +static void +ZSTD_setBufferExpectations(ZSTD_CCtx* cctx, const ZSTD_outBuffer* output, const ZSTD_inBuffer* input) { + DEBUGLOG(5, "ZSTD_setBufferExpectations (for advanced stable in/out modes)"); if (cctx->appliedParams.inBufferMode == ZSTD_bm_stable) { cctx->expectedInBuffer = *input; } @@ -5484,22 +5983,22 @@ static size_t ZSTD_checkBufferStability(ZSTD_CCtx const* cctx, { if (cctx->appliedParams.inBufferMode == ZSTD_bm_stable) { ZSTD_inBuffer const expect = cctx->expectedInBuffer; - if (expect.src != input->src || expect.pos != input->pos || expect.size != input->size) - RETURN_ERROR(srcBuffer_wrong, "ZSTD_c_stableInBuffer enabled but input differs!"); - if (endOp != ZSTD_e_end) - RETURN_ERROR(srcBuffer_wrong, "ZSTD_c_stableInBuffer can only be used with ZSTD_e_end!"); + if (expect.src != input->src || expect.pos != input->pos) + RETURN_ERROR(stabilityCondition_notRespected, "ZSTD_c_stableInBuffer enabled but input differs!"); } + (void)endOp; if (cctx->appliedParams.outBufferMode == ZSTD_bm_stable) { size_t const outBufferSize = output->size - output->pos; if (cctx->expectedOutBufferSize != outBufferSize) - RETURN_ERROR(dstBuffer_wrong, "ZSTD_c_stableOutBuffer enabled but output size differs!"); + RETURN_ERROR(stabilityCondition_notRespected, "ZSTD_c_stableOutBuffer enabled but output size differs!"); } return 0; } static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, ZSTD_EndDirective endOp, - size_t inSize) { + size_t inSize) +{ ZSTD_CCtx_params params = cctx->requestedParams; ZSTD_prefixDict const prefixDict = cctx->prefixDict; FORWARD_IF_ERROR( ZSTD_initLocalDict(cctx) , ""); /* Init the local dict if present. */ @@ -5513,9 +6012,9 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, params.compressionLevel = cctx->cdict->compressionLevel; } DEBUGLOG(4, "ZSTD_compressStream2 : transparent init stage"); - if (endOp == ZSTD_e_end) cctx->pledgedSrcSizePlusOne = inSize + 1; /* auto-fix pledgedSrcSize */ - { - size_t const dictSize = prefixDict.dict + if (endOp == ZSTD_e_end) cctx->pledgedSrcSizePlusOne = inSize + 1; /* auto-determine pledgedSrcSize */ + + { size_t const dictSize = prefixDict.dict ? prefixDict.dictSize : (cctx->cdict ? cctx->cdict->dictContentSize : 0); ZSTD_cParamMode_e const mode = ZSTD_getCParamMode(cctx->cdict, ¶ms, cctx->pledgedSrcSizePlusOne - 1); @@ -5524,20 +6023,21 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, dictSize, mode); } - if (ZSTD_CParams_shouldEnableLdm(¶ms.cParams)) { - /* Enable LDM by default for optimal parser and window size >= 128MB */ - DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)"); - params.ldmParams.enableLdm = 1; - } - - if (ZSTD_CParams_useBlockSplitter(¶ms.cParams)) { - DEBUGLOG(4, "Block splitter enabled by default (window size >= 128K, strategy >= btopt)"); - params.splitBlocks = 1; - } - + params.useBlockSplitter = ZSTD_resolveBlockSplitterMode(params.useBlockSplitter, ¶ms.cParams); + params.ldmParams.enableLdm = ZSTD_resolveEnableLdm(params.ldmParams.enableLdm, ¶ms.cParams); params.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params.useRowMatchFinder, ¶ms.cParams); + params.validateSequences = ZSTD_resolveExternalSequenceValidation(params.validateSequences); + params.maxBlockSize = ZSTD_resolveMaxBlockSize(params.maxBlockSize); + params.searchForExternalRepcodes = ZSTD_resolveExternalRepcodeSearch(params.searchForExternalRepcodes, params.compressionLevel); #ifdef ZSTD_MULTITHREAD + /* If external matchfinder is enabled, make sure to fail before checking job size (for consistency) */ + RETURN_ERROR_IF( + params.useSequenceProducer == 1 && params.nbWorkers >= 1, + parameter_combination_unsupported, + "External sequence producer isn't supported with nbWorkers >= 1" + ); + if ((cctx->pledgedSrcSizePlusOne-1) <= ZSTDMT_JOBSIZE_MIN) { params.nbWorkers = 0; /* do not invoke multi-threading when src size is too small */ } @@ -5565,7 +6065,7 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, cctx->streamStage = zcss_load; cctx->appliedParams = params; } else -#endif +#endif /* ZSTD_MULTITHREAD */ { U64 const pledgedSrcSize = cctx->pledgedSrcSizePlusOne - 1; assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams))); FORWARD_IF_ERROR( ZSTD_compressBegin_internal(cctx, @@ -5591,6 +6091,8 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, return 0; } +/* @return provides a minimum amount of data remaining to be flushed from internal buffers + */ size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, ZSTD_outBuffer* output, ZSTD_inBuffer* input, @@ -5605,8 +6107,27 @@ size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, /* transparent initialization stage */ if (cctx->streamStage == zcss_init) { - FORWARD_IF_ERROR(ZSTD_CCtx_init_compressStream2(cctx, endOp, input->size), "CompressStream2 initialization failed"); - ZSTD_setBufferExpectations(cctx, output, input); /* Set initial buffer expectations now that we've initialized */ + size_t const inputSize = input->size - input->pos; /* no obligation to start from pos==0 */ + size_t const totalInputSize = inputSize + cctx->stableIn_notConsumed; + if ( (cctx->requestedParams.inBufferMode == ZSTD_bm_stable) /* input is presumed stable, across invocations */ + && (endOp == ZSTD_e_continue) /* no flush requested, more input to come */ + && (totalInputSize < ZSTD_BLOCKSIZE_MAX) ) { /* not even reached one block yet */ + if (cctx->stableIn_notConsumed) { /* not the first time */ + /* check stable source guarantees */ + RETURN_ERROR_IF(input->src != cctx->expectedInBuffer.src, stabilityCondition_notRespected, "stableInBuffer condition not respected: wrong src pointer"); + RETURN_ERROR_IF(input->pos != cctx->expectedInBuffer.size, stabilityCondition_notRespected, "stableInBuffer condition not respected: externally modified pos"); + } + /* pretend input was consumed, to give a sense forward progress */ + input->pos = input->size; + /* save stable inBuffer, for later control, and flush/end */ + cctx->expectedInBuffer = *input; + /* but actually input wasn't consumed, so keep track of position from where compression shall resume */ + cctx->stableIn_notConsumed += inputSize; + /* don't initialize yet, wait for the first block of flush() order, for better parameters adaptation */ + return ZSTD_FRAMEHEADERSIZE_MIN(cctx->requestedParams.format); /* at least some header to produce */ + } + FORWARD_IF_ERROR(ZSTD_CCtx_init_compressStream2(cctx, endOp, totalInputSize), "compressStream2 initialization failed"); + ZSTD_setBufferExpectations(cctx, output, input); /* Set initial buffer expectations now that we've initialized */ } /* end of transparent initialization stage */ @@ -5619,6 +6140,13 @@ size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, ZSTDMT_updateCParams_whileCompressing(cctx->mtctx, &cctx->requestedParams); cctx->cParamsChanged = 0; } + if (cctx->stableIn_notConsumed) { + assert(cctx->appliedParams.inBufferMode == ZSTD_bm_stable); + /* some early data was skipped - make it available for consumption */ + assert(input->pos >= cctx->stableIn_notConsumed); + input->pos -= cctx->stableIn_notConsumed; + cctx->stableIn_notConsumed = 0; + } for (;;) { size_t const ipos = input->pos; size_t const opos = output->pos; @@ -5657,7 +6185,7 @@ size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, ZSTD_setBufferExpectations(cctx, output, input); return flushMin; } -#endif +#endif /* ZSTD_MULTITHREAD */ FORWARD_IF_ERROR( ZSTD_compressStream_generic(cctx, output, input, endOp) , ""); DEBUGLOG(5, "completed ZSTD_compressStream2"); ZSTD_setBufferExpectations(cctx, output, input); @@ -5670,13 +6198,20 @@ size_t ZSTD_compressStream2_simpleArgs ( const void* src, size_t srcSize, size_t* srcPos, ZSTD_EndDirective endOp) { - ZSTD_outBuffer output = { dst, dstCapacity, *dstPos }; - ZSTD_inBuffer input = { src, srcSize, *srcPos }; + ZSTD_outBuffer output; + ZSTD_inBuffer input; + output.dst = dst; + output.size = dstCapacity; + output.pos = *dstPos; + input.src = src; + input.size = srcSize; + input.pos = *srcPos; /* ZSTD_compressStream2() will check validity of dstPos and srcPos */ - size_t const cErr = ZSTD_compressStream2(cctx, &output, &input, endOp); - *dstPos = output.pos; - *srcPos = input.pos; - return cErr; + { size_t const cErr = ZSTD_compressStream2(cctx, &output, &input, endOp); + *dstPos = output.pos; + *srcPos = input.pos; + return cErr; + } } size_t ZSTD_compress2(ZSTD_CCtx* cctx, @@ -5699,6 +6234,7 @@ size_t ZSTD_compress2(ZSTD_CCtx* cctx, /* Reset to the original values. */ cctx->requestedParams.inBufferMode = originalInBufferMode; cctx->requestedParams.outBufferMode = originalOutBufferMode; + FORWARD_IF_ERROR(result, "ZSTD_compressStream2_simpleArgs failed"); if (result != 0) { /* compression not completed, due to lack of output space */ assert(oPos == dstCapacity); @@ -5709,64 +6245,60 @@ size_t ZSTD_compress2(ZSTD_CCtx* cctx, } } -typedef struct { - U32 idx; /* Index in array of ZSTD_Sequence */ - U32 posInSequence; /* Position within sequence at idx */ - size_t posInSrc; /* Number of bytes given by sequences provided so far */ -} ZSTD_sequencePosition; - -/* Returns a ZSTD error code if sequence is not valid */ -static size_t ZSTD_validateSequence(U32 offCode, U32 matchLength, - size_t posInSrc, U32 windowLog, size_t dictSize, U32 minMatch) { - size_t offsetBound; - U32 windowSize = 1 << windowLog; - /* posInSrc represents the amount of data the the decoder would decode up to this point. +/* ZSTD_validateSequence() : + * @offCode : is presumed to follow format required by ZSTD_storeSeq() + * @returns a ZSTD error code if sequence is not valid + */ +static size_t +ZSTD_validateSequence(U32 offCode, U32 matchLength, U32 minMatch, + size_t posInSrc, U32 windowLog, size_t dictSize, int useSequenceProducer) +{ + U32 const windowSize = 1u << windowLog; + /* posInSrc represents the amount of data the decoder would decode up to this point. * As long as the amount of data decoded is less than or equal to window size, offsets may be * larger than the total length of output decoded in order to reference the dict, even larger than * window size. After output surpasses windowSize, we're limited to windowSize offsets again. */ - offsetBound = posInSrc > windowSize ? (size_t)windowSize : posInSrc + (size_t)dictSize; - RETURN_ERROR_IF(offCode > offsetBound + ZSTD_REP_MOVE, corruption_detected, "Offset too large!"); - RETURN_ERROR_IF(matchLength < minMatch, corruption_detected, "Matchlength too small"); + size_t const offsetBound = posInSrc > windowSize ? (size_t)windowSize : posInSrc + (size_t)dictSize; + size_t const matchLenLowerBound = (minMatch == 3 || useSequenceProducer) ? 3 : 4; + RETURN_ERROR_IF(offCode > OFFSET_TO_OFFBASE(offsetBound), externalSequences_invalid, "Offset too large!"); + /* Validate maxNbSeq is large enough for the given matchLength and minMatch */ + RETURN_ERROR_IF(matchLength < matchLenLowerBound, externalSequences_invalid, "Matchlength too small for the minMatch"); return 0; } /* Returns an offset code, given a sequence's raw offset, the ongoing repcode array, and whether litLength == 0 */ -static U32 ZSTD_finalizeOffCode(U32 rawOffset, const U32 rep[ZSTD_REP_NUM], U32 ll0) { - U32 offCode = rawOffset + ZSTD_REP_MOVE; - U32 repCode = 0; +static U32 ZSTD_finalizeOffBase(U32 rawOffset, const U32 rep[ZSTD_REP_NUM], U32 ll0) +{ + U32 offBase = OFFSET_TO_OFFBASE(rawOffset); if (!ll0 && rawOffset == rep[0]) { - repCode = 1; + offBase = REPCODE1_TO_OFFBASE; } else if (rawOffset == rep[1]) { - repCode = 2 - ll0; + offBase = REPCODE_TO_OFFBASE(2 - ll0); } else if (rawOffset == rep[2]) { - repCode = 3 - ll0; + offBase = REPCODE_TO_OFFBASE(3 - ll0); } else if (ll0 && rawOffset == rep[0] - 1) { - repCode = 3; + offBase = REPCODE3_TO_OFFBASE; } - if (repCode) { - /* ZSTD_storeSeq expects a number in the range [0, 2] to represent a repcode */ - offCode = repCode - 1; - } - return offCode; + return offBase; } -/* Returns 0 on success, and a ZSTD_error otherwise. This function scans through an array of - * ZSTD_Sequence, storing the sequences it finds, until it reaches a block delimiter. - */ -static size_t ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos, - const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, - const void* src, size_t blockSize) { +size_t +ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx, + ZSTD_sequencePosition* seqPos, + const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, + const void* src, size_t blockSize, + ZSTD_paramSwitch_e externalRepSearch) +{ U32 idx = seqPos->idx; + U32 const startIdx = idx; BYTE const* ip = (BYTE const*)(src); const BYTE* const iend = ip + blockSize; repcodes_t updatedRepcodes; U32 dictSize; - U32 litLength; - U32 matchLength; - U32 ll0; - U32 offCode; + + DEBUGLOG(5, "ZSTD_copySequencesToSeqStoreExplicitBlockDelim (blockSize = %zu)", blockSize); if (cctx->cdict) { dictSize = (U32)cctx->cdict->dictContentSize; @@ -5776,26 +6308,55 @@ static size_t ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx, ZS dictSize = 0; } ZSTD_memcpy(updatedRepcodes.rep, cctx->blockState.prevCBlock->rep, sizeof(repcodes_t)); - for (; (inSeqs[idx].matchLength != 0 || inSeqs[idx].offset != 0) && idx < inSeqsSize; ++idx) { - litLength = inSeqs[idx].litLength; - matchLength = inSeqs[idx].matchLength; - ll0 = litLength == 0; - offCode = ZSTD_finalizeOffCode(inSeqs[idx].offset, updatedRepcodes.rep, ll0); - updatedRepcodes = ZSTD_updateRep(updatedRepcodes.rep, offCode, ll0); + for (; idx < inSeqsSize && (inSeqs[idx].matchLength != 0 || inSeqs[idx].offset != 0); ++idx) { + U32 const litLength = inSeqs[idx].litLength; + U32 const matchLength = inSeqs[idx].matchLength; + U32 offBase; - DEBUGLOG(6, "Storing sequence: (of: %u, ml: %u, ll: %u)", offCode, matchLength, litLength); + if (externalRepSearch == ZSTD_ps_disable) { + offBase = OFFSET_TO_OFFBASE(inSeqs[idx].offset); + } else { + U32 const ll0 = (litLength == 0); + offBase = ZSTD_finalizeOffBase(inSeqs[idx].offset, updatedRepcodes.rep, ll0); + ZSTD_updateRep(updatedRepcodes.rep, offBase, ll0); + } + + DEBUGLOG(6, "Storing sequence: (of: %u, ml: %u, ll: %u)", offBase, matchLength, litLength); if (cctx->appliedParams.validateSequences) { seqPos->posInSrc += litLength + matchLength; - FORWARD_IF_ERROR(ZSTD_validateSequence(offCode, matchLength, seqPos->posInSrc, - cctx->appliedParams.cParams.windowLog, dictSize, - cctx->appliedParams.cParams.minMatch), + FORWARD_IF_ERROR(ZSTD_validateSequence(offBase, matchLength, cctx->appliedParams.cParams.minMatch, seqPos->posInSrc, + cctx->appliedParams.cParams.windowLog, dictSize, cctx->appliedParams.useSequenceProducer), "Sequence validation failed"); } - RETURN_ERROR_IF(idx - seqPos->idx > cctx->seqStore.maxNbSeq, memory_allocation, + RETURN_ERROR_IF(idx - seqPos->idx >= cctx->seqStore.maxNbSeq, externalSequences_invalid, "Not enough memory allocated. Try adjusting ZSTD_c_minMatch."); - ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offCode, matchLength - MINMATCH); + ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offBase, matchLength); ip += matchLength + litLength; } + + /* If we skipped repcode search while parsing, we need to update repcodes now */ + assert(externalRepSearch != ZSTD_ps_auto); + assert(idx >= startIdx); + if (externalRepSearch == ZSTD_ps_disable && idx != startIdx) { + U32* const rep = updatedRepcodes.rep; + U32 lastSeqIdx = idx - 1; /* index of last non-block-delimiter sequence */ + + if (lastSeqIdx >= startIdx + 2) { + rep[2] = inSeqs[lastSeqIdx - 2].offset; + rep[1] = inSeqs[lastSeqIdx - 1].offset; + rep[0] = inSeqs[lastSeqIdx].offset; + } else if (lastSeqIdx == startIdx + 1) { + rep[2] = rep[0]; + rep[1] = inSeqs[lastSeqIdx - 1].offset; + rep[0] = inSeqs[lastSeqIdx].offset; + } else { + assert(lastSeqIdx == startIdx); + rep[2] = rep[1]; + rep[1] = rep[0]; + rep[0] = inSeqs[lastSeqIdx].offset; + } + } + ZSTD_memcpy(cctx->blockState.nextCBlock->rep, updatedRepcodes.rep, sizeof(repcodes_t)); if (inSeqs[idx].litLength) { @@ -5804,25 +6365,16 @@ static size_t ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx, ZS ip += inSeqs[idx].litLength; seqPos->posInSrc += inSeqs[idx].litLength; } - RETURN_ERROR_IF(ip != iend, corruption_detected, "Blocksize doesn't agree with block delimiter!"); + RETURN_ERROR_IF(ip != iend, externalSequences_invalid, "Blocksize doesn't agree with block delimiter!"); seqPos->idx = idx+1; return 0; } -/* Returns the number of bytes to move the current read position back by. Only non-zero - * if we ended up splitting a sequence. Otherwise, it may return a ZSTD error if something - * went wrong. - * - * This function will attempt to scan through blockSize bytes represented by the sequences - * in inSeqs, storing any (partial) sequences. - * - * Occasionally, we may want to change the actual number of bytes we consumed from inSeqs to - * avoid splitting a match, or to avoid splitting a match such that it would produce a match - * smaller than MINMATCH. In this case, we return the number of bytes that we didn't read from this block. - */ -static size_t ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos, - const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, - const void* src, size_t blockSize) { +size_t +ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos, + const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, + const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch) +{ U32 idx = seqPos->idx; U32 startPosInSequence = seqPos->posInSequence; U32 endPosInSequence = seqPos->posInSequence + (U32)blockSize; @@ -5832,10 +6384,9 @@ static size_t ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_seq repcodes_t updatedRepcodes; U32 bytesAdjustment = 0; U32 finalMatchSplit = 0; - U32 litLength; - U32 matchLength; - U32 rawOffset; - U32 offCode; + + /* TODO(embg) support fast parsing mode in noBlockDelim mode */ + (void)externalRepSearch; if (cctx->cdict) { dictSize = cctx->cdict->dictContentSize; @@ -5844,14 +6395,15 @@ static size_t ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_seq } else { dictSize = 0; } - DEBUGLOG(5, "ZSTD_copySequencesToSeqStore: idx: %u PIS: %u blockSize: %zu", idx, startPosInSequence, blockSize); + DEBUGLOG(5, "ZSTD_copySequencesToSeqStoreNoBlockDelim: idx: %u PIS: %u blockSize: %zu", idx, startPosInSequence, blockSize); DEBUGLOG(5, "Start seq: idx: %u (of: %u ml: %u ll: %u)", idx, inSeqs[idx].offset, inSeqs[idx].matchLength, inSeqs[idx].litLength); ZSTD_memcpy(updatedRepcodes.rep, cctx->blockState.prevCBlock->rep, sizeof(repcodes_t)); while (endPosInSequence && idx < inSeqsSize && !finalMatchSplit) { const ZSTD_Sequence currSeq = inSeqs[idx]; - litLength = currSeq.litLength; - matchLength = currSeq.matchLength; - rawOffset = currSeq.offset; + U32 litLength = currSeq.litLength; + U32 matchLength = currSeq.matchLength; + U32 const rawOffset = currSeq.offset; + U32 offBase; /* Modify the sequence depending on where endPosInSequence lies */ if (endPosInSequence >= currSeq.litLength + currSeq.matchLength) { @@ -5865,7 +6417,6 @@ static size_t ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_seq /* Move to the next sequence */ endPosInSequence -= currSeq.litLength + currSeq.matchLength; startPosInSequence = 0; - idx++; } else { /* This is the final (partial) sequence we're adding from inSeqs, and endPosInSequence does not reach the end of the match. So, we have to split the sequence */ @@ -5904,23 +6455,24 @@ static size_t ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_seq } } /* Check if this offset can be represented with a repcode */ - { U32 ll0 = (litLength == 0); - offCode = ZSTD_finalizeOffCode(rawOffset, updatedRepcodes.rep, ll0); - updatedRepcodes = ZSTD_updateRep(updatedRepcodes.rep, offCode, ll0); + { U32 const ll0 = (litLength == 0); + offBase = ZSTD_finalizeOffBase(rawOffset, updatedRepcodes.rep, ll0); + ZSTD_updateRep(updatedRepcodes.rep, offBase, ll0); } if (cctx->appliedParams.validateSequences) { seqPos->posInSrc += litLength + matchLength; - FORWARD_IF_ERROR(ZSTD_validateSequence(offCode, matchLength, seqPos->posInSrc, - cctx->appliedParams.cParams.windowLog, dictSize, - cctx->appliedParams.cParams.minMatch), + FORWARD_IF_ERROR(ZSTD_validateSequence(offBase, matchLength, cctx->appliedParams.cParams.minMatch, seqPos->posInSrc, + cctx->appliedParams.cParams.windowLog, dictSize, cctx->appliedParams.useSequenceProducer), "Sequence validation failed"); } - DEBUGLOG(6, "Storing sequence: (of: %u, ml: %u, ll: %u)", offCode, matchLength, litLength); - RETURN_ERROR_IF(idx - seqPos->idx > cctx->seqStore.maxNbSeq, memory_allocation, + DEBUGLOG(6, "Storing sequence: (of: %u, ml: %u, ll: %u)", offBase, matchLength, litLength); + RETURN_ERROR_IF(idx - seqPos->idx >= cctx->seqStore.maxNbSeq, externalSequences_invalid, "Not enough memory allocated. Try adjusting ZSTD_c_minMatch."); - ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offCode, matchLength - MINMATCH); + ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offBase, matchLength); ip += matchLength + litLength; + if (!finalMatchSplit) + idx++; /* Next Sequence */ } DEBUGLOG(5, "Ending seq: idx: %u (of: %u ml: %u ll: %u)", idx, inSeqs[idx].offset, inSeqs[idx].matchLength, inSeqs[idx].litLength); assert(idx == inSeqsSize || endPosInSequence <= inSeqs[idx].litLength + inSeqs[idx].matchLength); @@ -5943,8 +6495,9 @@ static size_t ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_seq typedef size_t (*ZSTD_sequenceCopier) (ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos, const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, - const void* src, size_t blockSize); -static ZSTD_sequenceCopier ZSTD_selectSequenceCopier(ZSTD_sequenceFormat_e mode) { + const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch); +static ZSTD_sequenceCopier ZSTD_selectSequenceCopier(ZSTD_sequenceFormat_e mode) +{ ZSTD_sequenceCopier sequenceCopier = NULL; assert(ZSTD_cParam_withinBounds(ZSTD_c_blockDelimiters, mode)); if (mode == ZSTD_sf_explicitBlockDelimiters) { @@ -5956,24 +6509,75 @@ static ZSTD_sequenceCopier ZSTD_selectSequenceCopier(ZSTD_sequenceFormat_e mode) return sequenceCopier; } +/* Discover the size of next block by searching for the delimiter. + * Note that a block delimiter **must** exist in this mode, + * otherwise it's an input error. + * The block size retrieved will be later compared to ensure it remains within bounds */ +static size_t +blockSize_explicitDelimiter(const ZSTD_Sequence* inSeqs, size_t inSeqsSize, ZSTD_sequencePosition seqPos) +{ + int end = 0; + size_t blockSize = 0; + size_t spos = seqPos.idx; + DEBUGLOG(6, "blockSize_explicitDelimiter : seq %zu / %zu", spos, inSeqsSize); + assert(spos <= inSeqsSize); + while (spos < inSeqsSize) { + end = (inSeqs[spos].offset == 0); + blockSize += inSeqs[spos].litLength + inSeqs[spos].matchLength; + if (end) { + if (inSeqs[spos].matchLength != 0) + RETURN_ERROR(externalSequences_invalid, "delimiter format error : both matchlength and offset must be == 0"); + break; + } + spos++; + } + if (!end) + RETURN_ERROR(externalSequences_invalid, "Reached end of sequences without finding a block delimiter"); + return blockSize; +} + +/* More a "target" block size */ +static size_t blockSize_noDelimiter(size_t blockSize, size_t remaining) +{ + int const lastBlock = (remaining <= blockSize); + return lastBlock ? remaining : blockSize; +} + +static size_t determine_blockSize(ZSTD_sequenceFormat_e mode, + size_t blockSize, size_t remaining, + const ZSTD_Sequence* inSeqs, size_t inSeqsSize, ZSTD_sequencePosition seqPos) +{ + DEBUGLOG(6, "determine_blockSize : remainingSize = %zu", remaining); + if (mode == ZSTD_sf_noBlockDelimiters) + return blockSize_noDelimiter(blockSize, remaining); + { size_t const explicitBlockSize = blockSize_explicitDelimiter(inSeqs, inSeqsSize, seqPos); + FORWARD_IF_ERROR(explicitBlockSize, "Error while determining block size with explicit delimiters"); + if (explicitBlockSize > blockSize) + RETURN_ERROR(externalSequences_invalid, "sequences incorrectly define a too large block"); + if (explicitBlockSize > remaining) + RETURN_ERROR(externalSequences_invalid, "sequences define a frame longer than source"); + return explicitBlockSize; + } +} + /* Compress, block-by-block, all of the sequences given. * - * Returns the cumulative size of all compressed blocks (including their headers), otherwise a ZSTD error. + * Returns the cumulative size of all compressed blocks (including their headers), + * otherwise a ZSTD error. */ -static size_t ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const ZSTD_Sequence* inSeqs, size_t inSeqsSize, - const void* src, size_t srcSize) { +static size_t +ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, + void* dst, size_t dstCapacity, + const ZSTD_Sequence* inSeqs, size_t inSeqsSize, + const void* src, size_t srcSize) +{ size_t cSize = 0; - U32 lastBlock; - size_t blockSize; - size_t compressedSeqsSize; size_t remaining = srcSize; ZSTD_sequencePosition seqPos = {0, 0, 0}; BYTE const* ip = (BYTE const*)src; BYTE* op = (BYTE*)dst; - ZSTD_sequenceCopier sequenceCopier = ZSTD_selectSequenceCopier(cctx->appliedParams.blockDelimiters); + ZSTD_sequenceCopier const sequenceCopier = ZSTD_selectSequenceCopier(cctx->appliedParams.blockDelimiters); DEBUGLOG(4, "ZSTD_compressSequences_internal srcSize: %zu, inSeqsSize: %zu", srcSize, inSeqsSize); /* Special case: empty frame */ @@ -5987,22 +6591,29 @@ static size_t ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, } while (remaining) { + size_t compressedSeqsSize; size_t cBlockSize; size_t additionalByteAdjustment; - lastBlock = remaining <= cctx->blockSize; - blockSize = lastBlock ? (U32)remaining : (U32)cctx->blockSize; + size_t blockSize = determine_blockSize(cctx->appliedParams.blockDelimiters, + cctx->blockSize, remaining, + inSeqs, inSeqsSize, seqPos); + U32 const lastBlock = (blockSize == remaining); + FORWARD_IF_ERROR(blockSize, "Error while trying to determine block size"); + assert(blockSize <= remaining); ZSTD_resetSeqStore(&cctx->seqStore); - DEBUGLOG(4, "Working on new block. Blocksize: %zu", blockSize); + DEBUGLOG(5, "Working on new block. Blocksize: %zu (total:%zu)", blockSize, (ip - (const BYTE*)src) + blockSize); - additionalByteAdjustment = sequenceCopier(cctx, &seqPos, inSeqs, inSeqsSize, ip, blockSize); + additionalByteAdjustment = sequenceCopier(cctx, &seqPos, inSeqs, inSeqsSize, ip, blockSize, cctx->appliedParams.searchForExternalRepcodes); FORWARD_IF_ERROR(additionalByteAdjustment, "Bad sequence copy"); blockSize -= additionalByteAdjustment; /* If blocks are too small, emit as a nocompress block */ - if (blockSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) { + /* TODO: See 3090. We reduced MIN_CBLOCK_SIZE from 3 to 2 so to compensate we are adding + * additional 1. We need to revisit and change this logic to be more consistent */ + if (blockSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1+1) { cBlockSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock); FORWARD_IF_ERROR(cBlockSize, "Nocompress block failed"); - DEBUGLOG(4, "Block too small, writing out nocompress block: cSize: %zu", cBlockSize); + DEBUGLOG(5, "Block too small, writing out nocompress block: cSize: %zu", cBlockSize); cSize += cBlockSize; ip += blockSize; op += cBlockSize; @@ -6011,6 +6622,7 @@ static size_t ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, continue; } + RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize, dstSize_tooSmall, "not enough dstCapacity to write a new compressed block"); compressedSeqsSize = ZSTD_entropyCompressSeqStore(&cctx->seqStore, &cctx->blockState.prevCBlock->entropy, &cctx->blockState.nextCBlock->entropy, &cctx->appliedParams, @@ -6019,11 +6631,11 @@ static size_t ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, cctx->entropyWorkspace, ENTROPY_WORKSPACE_SIZE /* statically allocated in resetCCtx */, cctx->bmi2); FORWARD_IF_ERROR(compressedSeqsSize, "Compressing sequences of block failed"); - DEBUGLOG(4, "Compressed sequences size: %zu", compressedSeqsSize); + DEBUGLOG(5, "Compressed sequences size: %zu", compressedSeqsSize); if (!cctx->isFirstBlock && ZSTD_maybeRLE(&cctx->seqStore) && - ZSTD_isRLE((BYTE const*)src, srcSize)) { + ZSTD_isRLE(ip, blockSize)) { /* We don't want to emit our first block as a RLE even if it qualifies because * doing so will cause the decoder (cli only) to throw a "should consume all input error." * This is only an issue for zstd <= v1.4.3 @@ -6034,12 +6646,12 @@ static size_t ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, if (compressedSeqsSize == 0) { /* ZSTD_noCompressBlock writes the block header as well */ cBlockSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock); - FORWARD_IF_ERROR(cBlockSize, "Nocompress block failed"); - DEBUGLOG(4, "Writing out nocompress block, size: %zu", cBlockSize); + FORWARD_IF_ERROR(cBlockSize, "ZSTD_noCompressBlock failed"); + DEBUGLOG(5, "Writing out nocompress block, size: %zu", cBlockSize); } else if (compressedSeqsSize == 1) { cBlockSize = ZSTD_rleCompressBlock(op, dstCapacity, *ip, blockSize, lastBlock); - FORWARD_IF_ERROR(cBlockSize, "RLE compress block failed"); - DEBUGLOG(4, "Writing out RLE block, size: %zu", cBlockSize); + FORWARD_IF_ERROR(cBlockSize, "ZSTD_rleCompressBlock failed"); + DEBUGLOG(5, "Writing out RLE block, size: %zu", cBlockSize); } else { U32 cBlockHeader; /* Error checking and repcodes update */ @@ -6051,11 +6663,10 @@ static size_t ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, cBlockHeader = lastBlock + (((U32)bt_compressed)<<1) + (U32)(compressedSeqsSize << 3); MEM_writeLE24(op, cBlockHeader); cBlockSize = ZSTD_blockHeaderSize + compressedSeqsSize; - DEBUGLOG(4, "Writing out compressed block, size: %zu", cBlockSize); + DEBUGLOG(5, "Writing out compressed block, size: %zu", cBlockSize); } cSize += cBlockSize; - DEBUGLOG(4, "cSize running total: %zu", cSize); if (lastBlock) { break; @@ -6066,21 +6677,25 @@ static size_t ZSTD_compressSequences_internal(ZSTD_CCtx* cctx, dstCapacity -= cBlockSize; cctx->isFirstBlock = 0; } + DEBUGLOG(5, "cSize running total: %zu (remaining dstCapacity=%zu)", cSize, dstCapacity); } + DEBUGLOG(4, "cSize final total: %zu", cSize); return cSize; } -size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size_t dstCapacity, +size_t ZSTD_compressSequences(ZSTD_CCtx* cctx, + void* dst, size_t dstCapacity, const ZSTD_Sequence* inSeqs, size_t inSeqsSize, - const void* src, size_t srcSize) { + const void* src, size_t srcSize) +{ BYTE* op = (BYTE*)dst; size_t cSize = 0; size_t compressedBlocksSize = 0; size_t frameHeaderSize = 0; /* Transparent initialization stage, same as compressStream2() */ - DEBUGLOG(3, "ZSTD_compressSequences()"); + DEBUGLOG(4, "ZSTD_compressSequences (dstCapacity=%zu)", dstCapacity); assert(cctx != NULL); FORWARD_IF_ERROR(ZSTD_CCtx_init_compressStream2(cctx, ZSTD_e_end, srcSize), "CCtx initialization failed"); /* Begin writing output, starting with frame header */ @@ -6108,26 +6723,34 @@ size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size_t dstCapaci cSize += 4; } - DEBUGLOG(3, "Final compressed size: %zu", cSize); + DEBUGLOG(4, "Final compressed size: %zu", cSize); return cSize; } /*====== Finalize ======*/ +static ZSTD_inBuffer inBuffer_forEndFlush(const ZSTD_CStream* zcs) +{ + const ZSTD_inBuffer nullInput = { NULL, 0, 0 }; + const int stableInput = (zcs->appliedParams.inBufferMode == ZSTD_bm_stable); + return stableInput ? zcs->expectedInBuffer : nullInput; +} + /*! ZSTD_flushStream() : * @return : amount of data remaining to flush */ size_t ZSTD_flushStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output) { - ZSTD_inBuffer input = { NULL, 0, 0 }; + ZSTD_inBuffer input = inBuffer_forEndFlush(zcs); + input.size = input.pos; /* do not ingest more input during flush */ return ZSTD_compressStream2(zcs, output, &input, ZSTD_e_flush); } size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output) { - ZSTD_inBuffer input = { NULL, 0, 0 }; + ZSTD_inBuffer input = inBuffer_forEndFlush(zcs); size_t const remainingToFlush = ZSTD_compressStream2(zcs, output, &input, ZSTD_e_end); - FORWARD_IF_ERROR( remainingToFlush , "ZSTD_compressStream2 failed"); + FORWARD_IF_ERROR(remainingToFlush , "ZSTD_compressStream2(,,ZSTD_e_end) failed"); if (zcs->appliedParams.nbWorkers > 0) return remainingToFlush; /* minimal estimation */ /* single thread mode : attempt to calculate remaining to flush more precisely */ { size_t const lastBlockSize = zcs->frameEnded ? 0 : ZSTD_BLOCKHEADERSIZE; @@ -6140,119 +6763,12 @@ size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output) /*-===== Pre-defined compression levels =====-*/ +#include "clevels.h" -#define ZSTD_MAX_CLEVEL 22 int ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; } int ZSTD_minCLevel(void) { return (int)-ZSTD_TARGETLENGTH_MAX; } int ZSTD_defaultCLevel(void) { return ZSTD_CLEVEL_DEFAULT; } -static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = { -{ /* "default" - for any srcSize > 256 KB */ - /* W, C, H, S, L, TL, strat */ - { 19, 12, 13, 1, 6, 1, ZSTD_fast }, /* base for negative levels */ - { 19, 13, 14, 1, 7, 0, ZSTD_fast }, /* level 1 */ - { 20, 15, 16, 1, 6, 0, ZSTD_fast }, /* level 2 */ - { 21, 16, 17, 1, 5, 0, ZSTD_dfast }, /* level 3 */ - { 21, 18, 18, 1, 5, 0, ZSTD_dfast }, /* level 4 */ - { 21, 18, 19, 2, 5, 2, ZSTD_greedy }, /* level 5 */ - { 21, 19, 19, 3, 5, 4, ZSTD_greedy }, /* level 6 */ - { 21, 19, 19, 3, 5, 8, ZSTD_lazy }, /* level 7 */ - { 21, 19, 19, 3, 5, 16, ZSTD_lazy2 }, /* level 8 */ - { 21, 19, 20, 4, 5, 16, ZSTD_lazy2 }, /* level 9 */ - { 22, 20, 21, 4, 5, 16, ZSTD_lazy2 }, /* level 10 */ - { 22, 21, 22, 4, 5, 16, ZSTD_lazy2 }, /* level 11 */ - { 22, 21, 22, 5, 5, 16, ZSTD_lazy2 }, /* level 12 */ - { 22, 21, 22, 5, 5, 32, ZSTD_btlazy2 }, /* level 13 */ - { 22, 22, 23, 5, 5, 32, ZSTD_btlazy2 }, /* level 14 */ - { 22, 23, 23, 6, 5, 32, ZSTD_btlazy2 }, /* level 15 */ - { 22, 22, 22, 5, 5, 48, ZSTD_btopt }, /* level 16 */ - { 23, 23, 22, 5, 4, 64, ZSTD_btopt }, /* level 17 */ - { 23, 23, 22, 6, 3, 64, ZSTD_btultra }, /* level 18 */ - { 23, 24, 22, 7, 3,256, ZSTD_btultra2}, /* level 19 */ - { 25, 25, 23, 7, 3,256, ZSTD_btultra2}, /* level 20 */ - { 26, 26, 24, 7, 3,512, ZSTD_btultra2}, /* level 21 */ - { 27, 27, 25, 9, 3,999, ZSTD_btultra2}, /* level 22 */ -}, -{ /* for srcSize <= 256 KB */ - /* W, C, H, S, L, T, strat */ - { 18, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ - { 18, 13, 14, 1, 6, 0, ZSTD_fast }, /* level 1 */ - { 18, 14, 14, 1, 5, 0, ZSTD_dfast }, /* level 2 */ - { 18, 16, 16, 1, 4, 0, ZSTD_dfast }, /* level 3 */ - { 18, 16, 17, 2, 5, 2, ZSTD_greedy }, /* level 4.*/ - { 18, 18, 18, 3, 5, 2, ZSTD_greedy }, /* level 5.*/ - { 18, 18, 19, 3, 5, 4, ZSTD_lazy }, /* level 6.*/ - { 18, 18, 19, 4, 4, 4, ZSTD_lazy }, /* level 7 */ - { 18, 18, 19, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ - { 18, 18, 19, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ - { 18, 18, 19, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ - { 18, 18, 19, 5, 4, 12, ZSTD_btlazy2 }, /* level 11.*/ - { 18, 19, 19, 7, 4, 12, ZSTD_btlazy2 }, /* level 12.*/ - { 18, 18, 19, 4, 4, 16, ZSTD_btopt }, /* level 13 */ - { 18, 18, 19, 4, 3, 32, ZSTD_btopt }, /* level 14.*/ - { 18, 18, 19, 6, 3,128, ZSTD_btopt }, /* level 15.*/ - { 18, 19, 19, 6, 3,128, ZSTD_btultra }, /* level 16.*/ - { 18, 19, 19, 8, 3,256, ZSTD_btultra }, /* level 17.*/ - { 18, 19, 19, 6, 3,128, ZSTD_btultra2}, /* level 18.*/ - { 18, 19, 19, 8, 3,256, ZSTD_btultra2}, /* level 19.*/ - { 18, 19, 19, 10, 3,512, ZSTD_btultra2}, /* level 20.*/ - { 18, 19, 19, 12, 3,512, ZSTD_btultra2}, /* level 21.*/ - { 18, 19, 19, 13, 3,999, ZSTD_btultra2}, /* level 22.*/ -}, -{ /* for srcSize <= 128 KB */ - /* W, C, H, S, L, T, strat */ - { 17, 12, 12, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ - { 17, 12, 13, 1, 6, 0, ZSTD_fast }, /* level 1 */ - { 17, 13, 15, 1, 5, 0, ZSTD_fast }, /* level 2 */ - { 17, 15, 16, 2, 5, 0, ZSTD_dfast }, /* level 3 */ - { 17, 17, 17, 2, 4, 0, ZSTD_dfast }, /* level 4 */ - { 17, 16, 17, 3, 4, 2, ZSTD_greedy }, /* level 5 */ - { 17, 17, 17, 3, 4, 4, ZSTD_lazy }, /* level 6 */ - { 17, 17, 17, 3, 4, 8, ZSTD_lazy2 }, /* level 7 */ - { 17, 17, 17, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ - { 17, 17, 17, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ - { 17, 17, 17, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ - { 17, 17, 17, 5, 4, 8, ZSTD_btlazy2 }, /* level 11 */ - { 17, 18, 17, 7, 4, 12, ZSTD_btlazy2 }, /* level 12 */ - { 17, 18, 17, 3, 4, 12, ZSTD_btopt }, /* level 13.*/ - { 17, 18, 17, 4, 3, 32, ZSTD_btopt }, /* level 14.*/ - { 17, 18, 17, 6, 3,256, ZSTD_btopt }, /* level 15.*/ - { 17, 18, 17, 6, 3,128, ZSTD_btultra }, /* level 16.*/ - { 17, 18, 17, 8, 3,256, ZSTD_btultra }, /* level 17.*/ - { 17, 18, 17, 10, 3,512, ZSTD_btultra }, /* level 18.*/ - { 17, 18, 17, 5, 3,256, ZSTD_btultra2}, /* level 19.*/ - { 17, 18, 17, 7, 3,512, ZSTD_btultra2}, /* level 20.*/ - { 17, 18, 17, 9, 3,512, ZSTD_btultra2}, /* level 21.*/ - { 17, 18, 17, 11, 3,999, ZSTD_btultra2}, /* level 22.*/ -}, -{ /* for srcSize <= 16 KB */ - /* W, C, H, S, L, T, strat */ - { 14, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ - { 14, 14, 15, 1, 5, 0, ZSTD_fast }, /* level 1 */ - { 14, 14, 15, 1, 4, 0, ZSTD_fast }, /* level 2 */ - { 14, 14, 15, 2, 4, 0, ZSTD_dfast }, /* level 3 */ - { 14, 14, 14, 4, 4, 2, ZSTD_greedy }, /* level 4 */ - { 14, 14, 14, 3, 4, 4, ZSTD_lazy }, /* level 5.*/ - { 14, 14, 14, 4, 4, 8, ZSTD_lazy2 }, /* level 6 */ - { 14, 14, 14, 6, 4, 8, ZSTD_lazy2 }, /* level 7 */ - { 14, 14, 14, 8, 4, 8, ZSTD_lazy2 }, /* level 8.*/ - { 14, 15, 14, 5, 4, 8, ZSTD_btlazy2 }, /* level 9.*/ - { 14, 15, 14, 9, 4, 8, ZSTD_btlazy2 }, /* level 10.*/ - { 14, 15, 14, 3, 4, 12, ZSTD_btopt }, /* level 11.*/ - { 14, 15, 14, 4, 3, 24, ZSTD_btopt }, /* level 12.*/ - { 14, 15, 14, 5, 3, 32, ZSTD_btultra }, /* level 13.*/ - { 14, 15, 15, 6, 3, 64, ZSTD_btultra }, /* level 14.*/ - { 14, 15, 15, 7, 3,256, ZSTD_btultra }, /* level 15.*/ - { 14, 15, 15, 5, 3, 48, ZSTD_btultra2}, /* level 16.*/ - { 14, 15, 15, 6, 3,128, ZSTD_btultra2}, /* level 17.*/ - { 14, 15, 15, 7, 3,256, ZSTD_btultra2}, /* level 18.*/ - { 14, 15, 15, 8, 3,256, ZSTD_btultra2}, /* level 19.*/ - { 14, 15, 15, 8, 3,512, ZSTD_btultra2}, /* level 20.*/ - { 14, 15, 15, 9, 3,512, ZSTD_btultra2}, /* level 21.*/ - { 14, 15, 15, 10, 3,999, ZSTD_btultra2}, /* level 22.*/ -}, -}; - static ZSTD_compressionParameters ZSTD_dedicatedDictSearch_getCParams(int const compressionLevel, size_t const dictSize) { ZSTD_compressionParameters cParams = ZSTD_getCParams_internal(compressionLevel, 0, dictSize, ZSTD_cpm_createCDict); @@ -6356,7 +6872,7 @@ static ZSTD_compressionParameters ZSTD_getCParams_internal(int compressionLevel, cp.targetLength = (unsigned)(-clampedCompressionLevel); } /* refine parameters based on srcSize & dictSize */ - return ZSTD_adjustCParams_internal(cp, srcSizeHint, dictSize, mode); + return ZSTD_adjustCParams_internal(cp, srcSizeHint, dictSize, mode, ZSTD_ps_auto); } } @@ -6391,3 +6907,21 @@ ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long srcSizeH if (srcSizeHint == 0) srcSizeHint = ZSTD_CONTENTSIZE_UNKNOWN; return ZSTD_getParams_internal(compressionLevel, srcSizeHint, dictSize, ZSTD_cpm_unknown); } + +void ZSTD_registerSequenceProducer( + ZSTD_CCtx* zc, void* mState, + ZSTD_sequenceProducer_F* mFinder +) { + if (mFinder != NULL) { + ZSTD_externalMatchCtx emctx; + emctx.mState = mState; + emctx.mFinder = mFinder; + emctx.seqBuffer = NULL; + emctx.seqBufferCapacity = 0; + zc->externalMatchCtx = emctx; + zc->requestedParams.useSequenceProducer = 1; + } else { + ZSTD_memset(&zc->externalMatchCtx, 0, sizeof(zc->externalMatchCtx)); + zc->requestedParams.useSequenceProducer = 0; + } +} diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_internal.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_internal.h similarity index 78% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_internal.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_internal.h index 3b04fd0..cbb85e5 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_internal.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -23,6 +23,7 @@ #ifdef ZSTD_MULTITHREAD # include "zstdmt_compress.h" #endif +#include "../common/bits.h" /* ZSTD_highbit32, ZSTD_NbCommonBytes */ #if defined (__cplusplus) extern "C" { @@ -63,7 +64,7 @@ typedef struct { } ZSTD_localDict; typedef struct { - HUF_CElt CTable[HUF_CTABLE_SIZE_U32(255)]; + HUF_CElt CTable[HUF_CTABLE_SIZE_ST(255)]; HUF_repeat repeatMode; } ZSTD_hufCTables_t; @@ -117,19 +118,20 @@ typedef struct { /** ZSTD_buildBlockEntropyStats() : * Builds entropy for the block. * @return : 0 on success or error code */ -size_t ZSTD_buildBlockEntropyStats(seqStore_t* seqStorePtr, - const ZSTD_entropyCTables_t* prevEntropy, - ZSTD_entropyCTables_t* nextEntropy, - const ZSTD_CCtx_params* cctxParams, - ZSTD_entropyCTablesMetadata_t* entropyMetadata, - void* workspace, size_t wkspSize); +size_t ZSTD_buildBlockEntropyStats( + const seqStore_t* seqStorePtr, + const ZSTD_entropyCTables_t* prevEntropy, + ZSTD_entropyCTables_t* nextEntropy, + const ZSTD_CCtx_params* cctxParams, + ZSTD_entropyCTablesMetadata_t* entropyMetadata, + void* workspace, size_t wkspSize); /********************************* * Compression internals structs * *********************************/ typedef struct { - U32 off; /* Offset code (offset + ZSTD_REP_MOVE) for the match */ + U32 off; /* Offset sumtype code for the match, using ZSTD_storeSeq() format */ U32 len; /* Raw length of match */ } ZSTD_match_t; @@ -148,6 +150,12 @@ typedef struct { size_t capacity; /* The capacity starting from `seq` pointer */ } rawSeqStore_t; +typedef struct { + U32 idx; /* Index in array of ZSTD_Sequence */ + U32 posInSequence; /* Position within sequence at idx */ + size_t posInSrc; /* Number of bytes given by sequences provided so far */ +} ZSTD_sequencePosition; + UNUSED_ATTR static const rawSeqStore_t kNullRawSeqStore = {NULL, 0, 0, 0, 0}; typedef struct { @@ -179,7 +187,7 @@ typedef struct { U32 offCodeSumBasePrice; /* to compare to log2(offreq) */ ZSTD_OptPrice_e priceType; /* prices can be determined dynamically, or follow a pre-defined cost structure */ const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated dictionary statistics */ - ZSTD_literalCompressionMode_e literalCompressionMode; + ZSTD_paramSwitch_e literalCompressionMode; } optState_t; typedef struct { @@ -199,6 +207,8 @@ typedef struct { */ } ZSTD_window_t; +#define ZSTD_WINDOW_START_INDEX 2 + typedef struct ZSTD_matchState_t ZSTD_matchState_t; #define ZSTD_ROW_HASH_CACHE_SIZE 8 /* Size of prefetching hash cache for row-based matchfinder */ @@ -232,6 +242,11 @@ struct ZSTD_matchState_t { const ZSTD_matchState_t* dictMatchState; ZSTD_compressionParameters cParams; const rawSeqStore_t* ldmSeqStore; + + /* Controls prefetching in some dictMatchState matchfinders. + * This behavior is controlled from the cctx ms. + * This parameter has no effect in the cdict ms. */ + int prefetchCDictTables; }; typedef struct { @@ -264,7 +279,7 @@ typedef struct { } ldmState_t; typedef struct { - U32 enableLdm; /* 1 if enable long distance matching */ + ZSTD_paramSwitch_e enableLdm; /* ZSTD_ps_enable to enable LDM. ZSTD_ps_auto by default */ U32 hashLog; /* Log size of hashTable */ U32 bucketSizeLog; /* Log bucket size for collision resolution, at most 8 */ U32 minMatchLength; /* Minimum match length */ @@ -295,7 +310,7 @@ struct ZSTD_CCtx_params_s { * There is no guarantee that hint is close to actual source size */ ZSTD_dictAttachPref_e attachDictPref; - ZSTD_literalCompressionMode_e literalCompressionMode; + ZSTD_paramSwitch_e literalCompressionMode; /* Multithreading: used to pass parameters to mtctx */ int nbWorkers; @@ -318,16 +333,34 @@ struct ZSTD_CCtx_params_s { int validateSequences; /* Block splitting */ - int splitBlocks; + ZSTD_paramSwitch_e useBlockSplitter; /* Param for deciding whether to use row-based matchfinder */ - ZSTD_useRowMatchFinderMode_e useRowMatchFinder; + ZSTD_paramSwitch_e useRowMatchFinder; /* Always load a dictionary in ext-dict mode (not prefix mode)? */ int deterministicRefPrefix; /* Internal use, for createCCtxParams() and freeCCtxParams() only */ ZSTD_customMem customMem; + + /* Controls prefetching in some dictMatchState matchfinders */ + ZSTD_paramSwitch_e prefetchCDictTables; + + /* Controls whether zstd will fall back to an internal matchfinder + * if the external matchfinder returns an error code. */ + int enableMatchFinderFallback; + + /* Indicates whether an external matchfinder has been referenced. + * Users can't set this externally. + * It is set internally in ZSTD_registerSequenceProducer(). */ + int useSequenceProducer; + + /* Adjust the max block size*/ + size_t maxBlockSize; + + /* Controls repcode search in external sequence parsing */ + ZSTD_paramSwitch_e searchForExternalRepcodes; }; /* typedef'd to ZSTD_CCtx_params within "zstd.h" */ #define COMPRESS_SEQUENCES_WORKSPACE_SIZE (sizeof(unsigned) * (MaxSeq + 2)) @@ -343,6 +376,30 @@ typedef enum { ZSTDb_buffered } ZSTD_buffered_policy_e; +/** + * Struct that contains all elements of block splitter that should be allocated + * in a wksp. + */ +#define ZSTD_MAX_NB_BLOCK_SPLITS 196 +typedef struct { + seqStore_t fullSeqStoreChunk; + seqStore_t firstHalfSeqStore; + seqStore_t secondHalfSeqStore; + seqStore_t currSeqStore; + seqStore_t nextSeqStore; + + U32 partitions[ZSTD_MAX_NB_BLOCK_SPLITS]; + ZSTD_entropyCTablesMetadata_t entropyMetadata; +} ZSTD_blockSplitCtx; + +/* Context for block-level external matchfinder API */ +typedef struct { + void* mState; + ZSTD_sequenceProducer_F* mFinder; + ZSTD_Sequence* seqBuffer; + size_t seqBufferCapacity; +} ZSTD_externalMatchCtx; + struct ZSTD_CCtx_s { ZSTD_compressionStage_e stage; int cParamsChanged; /* == 1 if cParams(except wlog) or compression level are changed in requestedParams. Triggers transmission of new params to ZSTDMT (if available) then reset to 0. */ @@ -374,7 +431,7 @@ struct ZSTD_CCtx_s { ZSTD_blockState_t blockState; U32* entropyWorkspace; /* entropy workspace of ENTROPY_WORKSPACE_SIZE bytes */ - /* Wether we are streaming or not */ + /* Whether we are streaming or not */ ZSTD_buffered_policy_e bufferedPolicy; /* streaming */ @@ -392,6 +449,7 @@ struct ZSTD_CCtx_s { /* Stable in/out buffer verification */ ZSTD_inBuffer expectedInBuffer; + size_t stableIn_notConsumed; /* nb bytes within stable input buffer that are said to be consumed but are not */ size_t expectedOutBufferSize; /* Dictionary */ @@ -408,9 +466,16 @@ struct ZSTD_CCtx_s { #if ZSTD_TRACE ZSTD_TraceCtx traceCtx; #endif + + /* Workspace for block splitter */ + ZSTD_blockSplitCtx blockSplitCtx; + + /* Workspace for external matchfinder */ + ZSTD_externalMatchCtx externalMatchCtx; }; typedef enum { ZSTD_dtlm_fast, ZSTD_dtlm_full } ZSTD_dictTableLoadMethod_e; +typedef enum { ZSTD_tfp_forCCtx, ZSTD_tfp_forCDict } ZSTD_tableFillPurpose_e; typedef enum { ZSTD_noDict = 0, @@ -432,7 +497,7 @@ typedef enum { * In this mode we take both the source size and the dictionary size * into account when selecting and adjusting the parameters. */ - ZSTD_cpm_unknown = 3, /* ZSTD_getCParams, ZSTD_getParams, ZSTD_adjustParams. + ZSTD_cpm_unknown = 3 /* ZSTD_getCParams, ZSTD_getParams, ZSTD_adjustParams. * We don't know what these parameters are for. We default to the legacy * behavior of taking both the source size and the dict size into account * when selecting and adjusting parameters. @@ -442,7 +507,7 @@ typedef enum { typedef size_t (*ZSTD_blockCompressor) ( ZSTD_matchState_t* bs, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_useRowMatchFinderMode_e rowMatchfinderMode, ZSTD_dictMode_e dictMode); +ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramSwitch_e rowMatchfinderMode, ZSTD_dictMode_e dictMode); MEM_STATIC U32 ZSTD_LLcode(U32 litLength) @@ -476,31 +541,6 @@ MEM_STATIC U32 ZSTD_MLcode(U32 mlBase) return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase]; } -typedef struct repcodes_s { - U32 rep[3]; -} repcodes_t; - -MEM_STATIC repcodes_t ZSTD_updateRep(U32 const rep[3], U32 const offset, U32 const ll0) -{ - repcodes_t newReps; - if (offset >= ZSTD_REP_NUM) { /* full offset */ - newReps.rep[2] = rep[1]; - newReps.rep[1] = rep[0]; - newReps.rep[0] = offset - ZSTD_REP_MOVE; - } else { /* repcode */ - U32 const repCode = offset + ll0; - if (repCode > 0) { /* note : if repCode==0, no change */ - U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; - newReps.rep[2] = (repCode >= 2) ? rep[1] : rep[2]; - newReps.rep[1] = rep[0]; - newReps.rep[0] = currentOffset; - } else { /* repCode == 0 */ - ZSTD_memcpy(&newReps, rep, sizeof(newReps)); - } - } - return newReps; -} - /* ZSTD_cParam_withinBounds: * @return 1 if value is within cParam bounds, * 0 otherwise */ @@ -516,9 +556,11 @@ MEM_STATIC int ZSTD_cParam_withinBounds(ZSTD_cParameter cParam, int value) /* ZSTD_noCompressBlock() : * Writes uncompressed block to dst buffer from given src. * Returns the size of the block */ -MEM_STATIC size_t ZSTD_noCompressBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize, U32 lastBlock) +MEM_STATIC size_t +ZSTD_noCompressBlock(void* dst, size_t dstCapacity, const void* src, size_t srcSize, U32 lastBlock) { U32 const cBlockHeader24 = lastBlock + (((U32)bt_raw)<<1) + (U32)(srcSize << 3); + DEBUGLOG(5, "ZSTD_noCompressBlock (srcSize=%zu, dstCapacity=%zu)", srcSize, dstCapacity); RETURN_ERROR_IF(srcSize + ZSTD_blockHeaderSize > dstCapacity, dstSize_tooSmall, "dst buf too small for uncompressed block"); MEM_writeLE24(dst, cBlockHeader24); @@ -526,7 +568,8 @@ MEM_STATIC size_t ZSTD_noCompressBlock (void* dst, size_t dstCapacity, const voi return ZSTD_blockHeaderSize + srcSize; } -MEM_STATIC size_t ZSTD_rleCompressBlock (void* dst, size_t dstCapacity, BYTE src, size_t srcSize, U32 lastBlock) +MEM_STATIC size_t +ZSTD_rleCompressBlock(void* dst, size_t dstCapacity, BYTE src, size_t srcSize, U32 lastBlock) { BYTE* const op = (BYTE*)dst; U32 const cBlockHeader = lastBlock + (((U32)bt_rle)<<1) + (U32)(srcSize << 3); @@ -545,21 +588,21 @@ MEM_STATIC size_t ZSTD_minGain(size_t srcSize, ZSTD_strategy strat) { U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6; ZSTD_STATIC_ASSERT(ZSTD_btultra == 8); - assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, strat)); + assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat)); return (srcSize >> minlog) + 2; } -MEM_STATIC int ZSTD_disableLiteralsCompression(const ZSTD_CCtx_params* cctxParams) +MEM_STATIC int ZSTD_literalsCompressionIsDisabled(const ZSTD_CCtx_params* cctxParams) { switch (cctxParams->literalCompressionMode) { - case ZSTD_lcm_huffman: + case ZSTD_ps_enable: return 0; - case ZSTD_lcm_uncompressed: + case ZSTD_ps_disable: return 1; default: assert(0 /* impossible: pre-validated */); - /* fall-through */ - case ZSTD_lcm_auto: + ZSTD_FALLTHROUGH; + case ZSTD_ps_auto: return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0); } } @@ -569,7 +612,9 @@ MEM_STATIC int ZSTD_disableLiteralsCompression(const ZSTD_CCtx_params* cctxParam * Only called when the sequence ends past ilimit_w, so it only needs to be optimized for single * large copies. */ -static void ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE const* ilimit_w) { +static void +ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE const* ilimit_w) +{ assert(iend > ilimit_w); if (ip <= ilimit_w) { ZSTD_wildcopy(op, ip, ilimit_w - ip, ZSTD_no_overlap); @@ -579,14 +624,28 @@ static void ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const ie while (ip < iend) *op++ = *ip++; } + +#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1) +#define REPCODE2_TO_OFFBASE REPCODE_TO_OFFBASE(2) +#define REPCODE3_TO_OFFBASE REPCODE_TO_OFFBASE(3) +#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */ +#define OFFSET_TO_OFFBASE(o) (assert((o)>0), o + ZSTD_REP_NUM) +#define OFFBASE_IS_OFFSET(o) ((o) > ZSTD_REP_NUM) +#define OFFBASE_IS_REPCODE(o) ( 1 <= (o) && (o) <= ZSTD_REP_NUM) +#define OFFBASE_TO_OFFSET(o) (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM) +#define OFFBASE_TO_REPCODE(o) (assert(OFFBASE_IS_REPCODE(o)), (o)) /* returns ID 1,2,3 */ + /*! ZSTD_storeSeq() : - * Store a sequence (litlen, litPtr, offCode and mlBase) into seqStore_t. - * `offCode` : distance to match + ZSTD_REP_MOVE (values <= ZSTD_REP_MOVE are repCodes). - * `mlBase` : matchLength - MINMATCH - * Allowed to overread literals up to litLimit. + * Store a sequence (litlen, litPtr, offBase and matchLength) into seqStore_t. + * @offBase : Users should employ macros REPCODE_TO_OFFBASE() and OFFSET_TO_OFFBASE(). + * @matchLength : must be >= MINMATCH + * Allowed to over-read literals up to litLimit. */ -HINT_INLINE UNUSED_ATTR -void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const BYTE* literals, const BYTE* litLimit, U32 offCode, size_t mlBase) +HINT_INLINE UNUSED_ATTR void +ZSTD_storeSeq(seqStore_t* seqStorePtr, + size_t litLength, const BYTE* literals, const BYTE* litLimit, + U32 offBase, + size_t matchLength) { BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; BYTE const* const litEnd = literals + litLength; @@ -594,8 +653,8 @@ void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const BYTE* litera static const BYTE* g_start = NULL; if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ { U32 const pos = (U32)((const BYTE*)literals - g_start); - DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offCode%7u", - pos, (U32)litLength, (U32)mlBase+MINMATCH, (U32)offCode); + DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u", + pos, (U32)litLength, (U32)matchLength, (U32)offBase); } #endif assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); @@ -605,9 +664,9 @@ void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const BYTE* litera assert(literals + litLength <= litLimit); if (litEnd <= litLimit_w) { /* Common case we can use wildcopy. - * First copy 16 bytes, because literals are likely short. - */ - assert(WILDCOPY_OVERLENGTH >= 16); + * First copy 16 bytes, because literals are likely short. + */ + ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16); ZSTD_copy16(seqStorePtr->lit, literals); if (litLength > 16) { ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, (ptrdiff_t)litLength-16, ZSTD_no_overlap); @@ -626,96 +685,63 @@ void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const BYTE* litera seqStorePtr->sequences[0].litLength = (U16)litLength; /* match offset */ - seqStorePtr->sequences[0].offset = offCode + 1; + seqStorePtr->sequences[0].offBase = offBase; /* match Length */ - if (mlBase>0xFFFF) { - assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ - seqStorePtr->longLengthType = ZSTD_llt_matchLength; - seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); + assert(matchLength >= MINMATCH); + { size_t const mlBase = matchLength - MINMATCH; + if (mlBase>0xFFFF) { + assert(seqStorePtr->longLengthType == ZSTD_llt_none); /* there can only be a single long length */ + seqStorePtr->longLengthType = ZSTD_llt_matchLength; + seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); + } + seqStorePtr->sequences[0].mlBase = (U16)mlBase; } - seqStorePtr->sequences[0].matchLength = (U16)mlBase; seqStorePtr->sequences++; } +/* ZSTD_updateRep() : + * updates in-place @rep (array of repeat offsets) + * @offBase : sum-type, using numeric representation of ZSTD_storeSeq() + */ +MEM_STATIC void +ZSTD_updateRep(U32 rep[ZSTD_REP_NUM], U32 const offBase, U32 const ll0) +{ + if (OFFBASE_IS_OFFSET(offBase)) { /* full offset */ + rep[2] = rep[1]; + rep[1] = rep[0]; + rep[0] = OFFBASE_TO_OFFSET(offBase); + } else { /* repcode */ + U32 const repCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0; + if (repCode > 0) { /* note : if repCode==0, no change */ + U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; + rep[2] = (repCode >= 2) ? rep[1] : rep[2]; + rep[1] = rep[0]; + rep[0] = currentOffset; + } else { /* repCode == 0 */ + /* nothing to do */ + } + } +} + +typedef struct repcodes_s { + U32 rep[3]; +} repcodes_t; + +MEM_STATIC repcodes_t +ZSTD_newRep(U32 const rep[ZSTD_REP_NUM], U32 const offBase, U32 const ll0) +{ + repcodes_t newReps; + ZSTD_memcpy(&newReps, rep, sizeof(newReps)); + ZSTD_updateRep(newReps.rep, offBase, ll0); + return newReps; +} + /*-************************************* * Match length counter ***************************************/ -static unsigned ZSTD_NbCommonBytes (size_t val) -{ - if (MEM_isLittleEndian()) { - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) -# if STATIC_BMI2 - return _tzcnt_u64(val) >> 3; -# else - unsigned long r = 0; - return _BitScanForward64( &r, (U64)val ) ? (unsigned)(r >> 3) : 0; -# endif -# elif defined(__GNUC__) && (__GNUC__ >= 4) - return (__builtin_ctzll((U64)val) >> 3); -# else - static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, - 0, 3, 1, 3, 1, 4, 2, 7, - 0, 2, 3, 6, 1, 5, 3, 5, - 1, 3, 4, 4, 2, 5, 6, 7, - 7, 0, 1, 2, 3, 3, 4, 6, - 2, 6, 5, 5, 3, 4, 5, 6, - 7, 1, 2, 4, 6, 4, 4, 5, - 7, 2, 6, 5, 7, 6, 7, 7 }; - return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r=0; - return _BitScanForward( &r, (U32)val ) ? (unsigned)(r >> 3) : 0; -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_ctz((U32)val) >> 3); -# else - static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, - 3, 2, 2, 1, 3, 2, 0, 1, - 3, 3, 1, 2, 2, 2, 2, 0, - 3, 1, 2, 0, 1, 0, 1, 1 }; - return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; -# endif - } - } else { /* Big Endian CPU */ - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) -# if STATIC_BMI2 - return _lzcnt_u64(val) >> 3; -# else - unsigned long r = 0; - return _BitScanReverse64(&r, (U64)val) ? (unsigned)(r >> 3) : 0; -# endif -# elif defined(__GNUC__) && (__GNUC__ >= 4) - return (__builtin_clzll(val) >> 3); -# else - unsigned r; - const unsigned n32 = sizeof(size_t)*4; /* calculate this way due to compiler complaining in 32-bits mode */ - if (!(val>>n32)) { r=4; } else { r=0; val>>=n32; } - if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } - r += (!val); - return r; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r = 0; - return _BitScanReverse( &r, (unsigned long)val ) ? (unsigned)(r >> 3) : 0; -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_clz((U32)val) >> 3); -# else - unsigned r; - if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } - r += (!val); - return r; -# endif - } } -} - - MEM_STATIC size_t ZSTD_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* const pInLimit) { const BYTE* const pStart = pIn; @@ -761,32 +787,36 @@ ZSTD_count_2segments(const BYTE* ip, const BYTE* match, * Hashes ***************************************/ static const U32 prime3bytes = 506832829U; -static U32 ZSTD_hash3(U32 u, U32 h) { return ((u << (32-24)) * prime3bytes) >> (32-h) ; } +static U32 ZSTD_hash3(U32 u, U32 h) { assert(h <= 32); return ((u << (32-24)) * prime3bytes) >> (32-h) ; } MEM_STATIC size_t ZSTD_hash3Ptr(const void* ptr, U32 h) { return ZSTD_hash3(MEM_readLE32(ptr), h); } /* only in zstd_opt.h */ static const U32 prime4bytes = 2654435761U; -static U32 ZSTD_hash4(U32 u, U32 h) { return (u * prime4bytes) >> (32-h) ; } -static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_read32(ptr), h); } +static U32 ZSTD_hash4(U32 u, U32 h) { assert(h <= 32); return (u * prime4bytes) >> (32-h) ; } +static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h); } static const U64 prime5bytes = 889523592379ULL; -static size_t ZSTD_hash5(U64 u, U32 h) { return (size_t)(((u << (64-40)) * prime5bytes) >> (64-h)) ; } +static size_t ZSTD_hash5(U64 u, U32 h) { assert(h <= 64); return (size_t)(((u << (64-40)) * prime5bytes) >> (64-h)) ; } static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h); } static const U64 prime6bytes = 227718039650203ULL; -static size_t ZSTD_hash6(U64 u, U32 h) { return (size_t)(((u << (64-48)) * prime6bytes) >> (64-h)) ; } +static size_t ZSTD_hash6(U64 u, U32 h) { assert(h <= 64); return (size_t)(((u << (64-48)) * prime6bytes) >> (64-h)) ; } static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h); } static const U64 prime7bytes = 58295818150454627ULL; -static size_t ZSTD_hash7(U64 u, U32 h) { return (size_t)(((u << (64-56)) * prime7bytes) >> (64-h)) ; } +static size_t ZSTD_hash7(U64 u, U32 h) { assert(h <= 64); return (size_t)(((u << (64-56)) * prime7bytes) >> (64-h)) ; } static size_t ZSTD_hash7Ptr(const void* p, U32 h) { return ZSTD_hash7(MEM_readLE64(p), h); } static const U64 prime8bytes = 0xCF1BBCDCB7A56463ULL; -static size_t ZSTD_hash8(U64 u, U32 h) { return (size_t)(((u) * prime8bytes) >> (64-h)) ; } +static size_t ZSTD_hash8(U64 u, U32 h) { assert(h <= 64); return (size_t)(((u) * prime8bytes) >> (64-h)) ; } static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h); } MEM_STATIC FORCE_INLINE_ATTR size_t ZSTD_hashPtr(const void* p, U32 hBits, U32 mls) { + /* Although some of these hashes do support hBits up to 64, some do not. + * To be on the safe side, always avoid hBits > 32. */ + assert(hBits <= 32); + switch(mls) { default: @@ -884,9 +914,9 @@ MEM_STATIC void ZSTD_window_clear(ZSTD_window_t* window) MEM_STATIC U32 ZSTD_window_isEmpty(ZSTD_window_t const window) { - return window.dictLimit == 1 && - window.lowLimit == 1 && - (window.nextSrc - window.base) == 1; + return window.dictLimit == ZSTD_WINDOW_START_INDEX && + window.lowLimit == ZSTD_WINDOW_START_INDEX && + (window.nextSrc - window.base) == ZSTD_WINDOW_START_INDEX; } /** @@ -937,7 +967,9 @@ MEM_STATIC U32 ZSTD_window_canOverflowCorrect(ZSTD_window_t const window, { U32 const cycleSize = 1u << cycleLog; U32 const curr = (U32)((BYTE const*)src - window.base); - U32 const minIndexToOverflowCorrect = cycleSize + MAX(maxDist, cycleSize); + U32 const minIndexToOverflowCorrect = cycleSize + + MAX(maxDist, cycleSize) + + ZSTD_WINDOW_START_INDEX; /* Adjust the min index to backoff the overflow correction frequency, * so we don't waste too much CPU in overflow correction. If this @@ -1012,10 +1044,14 @@ MEM_STATIC U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog, U32 const cycleSize = 1u << cycleLog; U32 const cycleMask = cycleSize - 1; U32 const curr = (U32)((BYTE const*)src - window->base); - U32 const currentCycle0 = curr & cycleMask; - /* Exclude zero so that newCurrent - maxDist >= 1. */ - U32 const currentCycle1 = currentCycle0 == 0 ? cycleSize : currentCycle0; - U32 const newCurrent = currentCycle1 + MAX(maxDist, cycleSize); + U32 const currentCycle = curr & cycleMask; + /* Ensure newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX. */ + U32 const currentCycleCorrection = currentCycle < ZSTD_WINDOW_START_INDEX + ? MAX(cycleSize, ZSTD_WINDOW_START_INDEX) + : 0; + U32 const newCurrent = currentCycle + + currentCycleCorrection + + MAX(maxDist, cycleSize); U32 const correction = curr - newCurrent; /* maxDist must be a power of two so that: * (newCurrent & cycleMask) == (curr & cycleMask) @@ -1031,14 +1067,20 @@ MEM_STATIC U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog, window->base += correction; window->dictBase += correction; - if (window->lowLimit <= correction) window->lowLimit = 1; - else window->lowLimit -= correction; - if (window->dictLimit <= correction) window->dictLimit = 1; - else window->dictLimit -= correction; + if (window->lowLimit < correction + ZSTD_WINDOW_START_INDEX) { + window->lowLimit = ZSTD_WINDOW_START_INDEX; + } else { + window->lowLimit -= correction; + } + if (window->dictLimit < correction + ZSTD_WINDOW_START_INDEX) { + window->dictLimit = ZSTD_WINDOW_START_INDEX; + } else { + window->dictLimit -= correction; + } /* Ensure we can still reference the full window. */ assert(newCurrent >= maxDist); - assert(newCurrent - maxDist >= 1); + assert(newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX); /* Ensure that lowLimit and dictLimit didn't underflow. */ assert(window->lowLimit <= newCurrent); assert(window->dictLimit <= newCurrent); @@ -1133,10 +1175,15 @@ ZSTD_checkDictValidity(const ZSTD_window_t* window, (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); assert(blockEndIdx >= loadedDictEnd); - if (blockEndIdx > loadedDictEnd + maxDist) { + if (blockEndIdx > loadedDictEnd + maxDist || loadedDictEnd != window->dictLimit) { /* On reaching window size, dictionaries are invalidated. * For simplification, if window size is reached anywhere within next block, * the dictionary is invalidated for the full block. + * + * We also have to invalidate the dictionary if ZSTD_window_update() has detected + * non-contiguous segments, which means that loadedDictEnd != window->dictLimit. + * loadedDictEnd may be 0, if forceWindow is true, but in that case we never use + * dictMatchState, so setting it to NULL is not a problem. */ DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)"); *loadedDictEndPtr = 0; @@ -1149,11 +1196,12 @@ ZSTD_checkDictValidity(const ZSTD_window_t* window, MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) { ZSTD_memset(window, 0, sizeof(*window)); - window->base = (BYTE const*)""; - window->dictBase = (BYTE const*)""; - window->dictLimit = 1; /* start from 1, so that 1st position is valid */ - window->lowLimit = 1; /* it ensures first and later CCtx usages compress the same */ - window->nextSrc = window->base + 1; /* see issue #1241 */ + window->base = (BYTE const*)" "; + window->dictBase = (BYTE const*)" "; + ZSTD_STATIC_ASSERT(ZSTD_DUBT_UNSORTED_MARK < ZSTD_WINDOW_START_INDEX); /* Start above ZSTD_DUBT_UNSORTED_MARK */ + window->dictLimit = ZSTD_WINDOW_START_INDEX; /* start from >0, so that 1st position is valid */ + window->lowLimit = ZSTD_WINDOW_START_INDEX; /* it ensures first and later CCtx usages compress the same */ + window->nextSrc = window->base + ZSTD_WINDOW_START_INDEX; /* see issue #1241 */ window->nbOverflowCorrections = 0; } @@ -1206,15 +1254,15 @@ MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window, */ MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_matchState_t* ms, U32 curr, unsigned windowLog) { - U32 const maxDistance = 1U << windowLog; - U32 const lowestValid = ms->window.lowLimit; - U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; - U32 const isDictionary = (ms->loadedDictEnd != 0); + U32 const maxDistance = 1U << windowLog; + U32 const lowestValid = ms->window.lowLimit; + U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; + U32 const isDictionary = (ms->loadedDictEnd != 0); /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't * valid for the entire block. So this check is sufficient to find the lowest valid match index. */ - U32 const matchLowest = isDictionary ? lowestValid : withinWindow; + U32 const matchLowest = isDictionary ? lowestValid : withinWindow; return matchLowest; } @@ -1267,6 +1315,42 @@ MEM_STATIC void ZSTD_debugTable(const U32* table, U32 max) #endif +/* Short Cache */ + +/* Normally, zstd matchfinders follow this flow: + * 1. Compute hash at ip + * 2. Load index from hashTable[hash] + * 3. Check if *ip == *(base + index) + * In dictionary compression, loading *(base + index) is often an L2 or even L3 miss. + * + * Short cache is an optimization which allows us to avoid step 3 most of the time + * when the data doesn't actually match. With short cache, the flow becomes: + * 1. Compute (hash, currentTag) at ip. currentTag is an 8-bit independent hash at ip. + * 2. Load (index, matchTag) from hashTable[hash]. See ZSTD_writeTaggedIndex to understand how this works. + * 3. Only if currentTag == matchTag, check *ip == *(base + index). Otherwise, continue. + * + * Currently, short cache is only implemented in CDict hashtables. Thus, its use is limited to + * dictMatchState matchfinders. + */ +#define ZSTD_SHORT_CACHE_TAG_BITS 8 +#define ZSTD_SHORT_CACHE_TAG_MASK ((1u << ZSTD_SHORT_CACHE_TAG_BITS) - 1) + +/* Helper function for ZSTD_fillHashTable and ZSTD_fillDoubleHashTable. + * Unpacks hashAndTag into (hash, tag), then packs (index, tag) into hashTable[hash]. */ +MEM_STATIC void ZSTD_writeTaggedIndex(U32* const hashTable, size_t hashAndTag, U32 index) { + size_t const hash = hashAndTag >> ZSTD_SHORT_CACHE_TAG_BITS; + U32 const tag = (U32)(hashAndTag & ZSTD_SHORT_CACHE_TAG_MASK); + assert(index >> (32 - ZSTD_SHORT_CACHE_TAG_BITS) == 0); + hashTable[hash] = (index << ZSTD_SHORT_CACHE_TAG_BITS) | tag; +} + +/* Helper function for short cache matchfinders. + * Unpacks tag1 and tag2 from lower bits of packedTag1 and packedTag2, then checks if the tags match. */ +MEM_STATIC int ZSTD_comparePackedTags(size_t packedTag1, size_t packedTag2) { + U32 const tag1 = packedTag1 & ZSTD_SHORT_CACHE_TAG_MASK; + U32 const tag2 = packedTag2 & ZSTD_SHORT_CACHE_TAG_MASK; + return tag1 == tag2; +} #if defined (__cplusplus) } @@ -1364,4 +1448,31 @@ U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat); */ void ZSTD_CCtx_trace(ZSTD_CCtx* cctx, size_t extraCSize); +/* Returns 0 on success, and a ZSTD_error otherwise. This function scans through an array of + * ZSTD_Sequence, storing the sequences it finds, until it reaches a block delimiter. + * Note that the block delimiter must include the last literals of the block. + */ +size_t +ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx, + ZSTD_sequencePosition* seqPos, + const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, + const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch); + +/* Returns the number of bytes to move the current read position back by. + * Only non-zero if we ended up splitting a sequence. + * Otherwise, it may return a ZSTD error if something went wrong. + * + * This function will attempt to scan through blockSize bytes + * represented by the sequences in @inSeqs, + * storing any (partial) sequences. + * + * Occasionally, we may want to change the actual number of bytes we consumed from inSeqs to + * avoid splitting a match, or to avoid splitting a match such that it would produce a match + * smaller than MINMATCH. In this case, we return the number of bytes that we didn't read from this block. + */ +size_t +ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos, + const ZSTD_Sequence* const inSeqs, size_t inSeqsSize, + const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch); + #endif /* ZSTD_COMPRESS_H */ diff --git a/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_literals.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_literals.c new file mode 100644 index 0000000..bfd4f11 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_literals.c @@ -0,0 +1,235 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + + /*-************************************* + * Dependencies + ***************************************/ +#include "zstd_compress_literals.h" + + +/* ************************************************************** +* Debug Traces +****************************************************************/ +#if DEBUGLEVEL >= 2 + +static size_t showHexa(const void* src, size_t srcSize) +{ + const BYTE* const ip = (const BYTE*)src; + size_t u; + for (u=0; u31) + (srcSize>4095); + + DEBUGLOG(5, "ZSTD_noCompressLiterals: srcSize=%zu, dstCapacity=%zu", srcSize, dstCapacity); + + RETURN_ERROR_IF(srcSize + flSize > dstCapacity, dstSize_tooSmall, ""); + + switch(flSize) + { + case 1: /* 2 - 1 - 5 */ + ostart[0] = (BYTE)((U32)set_basic + (srcSize<<3)); + break; + case 2: /* 2 - 2 - 12 */ + MEM_writeLE16(ostart, (U16)((U32)set_basic + (1<<2) + (srcSize<<4))); + break; + case 3: /* 2 - 2 - 20 */ + MEM_writeLE32(ostart, (U32)((U32)set_basic + (3<<2) + (srcSize<<4))); + break; + default: /* not necessary : flSize is {1,2,3} */ + assert(0); + } + + ZSTD_memcpy(ostart + flSize, src, srcSize); + DEBUGLOG(5, "Raw (uncompressed) literals: %u -> %u", (U32)srcSize, (U32)(srcSize + flSize)); + return srcSize + flSize; +} + +static int allBytesIdentical(const void* src, size_t srcSize) +{ + assert(srcSize >= 1); + assert(src != NULL); + { const BYTE b = ((const BYTE*)src)[0]; + size_t p; + for (p=1; p31) + (srcSize>4095); + + assert(dstCapacity >= 4); (void)dstCapacity; + assert(allBytesIdentical(src, srcSize)); + + switch(flSize) + { + case 1: /* 2 - 1 - 5 */ + ostart[0] = (BYTE)((U32)set_rle + (srcSize<<3)); + break; + case 2: /* 2 - 2 - 12 */ + MEM_writeLE16(ostart, (U16)((U32)set_rle + (1<<2) + (srcSize<<4))); + break; + case 3: /* 2 - 2 - 20 */ + MEM_writeLE32(ostart, (U32)((U32)set_rle + (3<<2) + (srcSize<<4))); + break; + default: /* not necessary : flSize is {1,2,3} */ + assert(0); + } + + ostart[flSize] = *(const BYTE*)src; + DEBUGLOG(5, "RLE : Repeated Literal (%02X: %u times) -> %u bytes encoded", ((const BYTE*)src)[0], (U32)srcSize, (U32)flSize + 1); + return flSize+1; +} + +/* ZSTD_minLiteralsToCompress() : + * returns minimal amount of literals + * for literal compression to even be attempted. + * Minimum is made tighter as compression strategy increases. + */ +static size_t +ZSTD_minLiteralsToCompress(ZSTD_strategy strategy, HUF_repeat huf_repeat) +{ + assert((int)strategy >= 0); + assert((int)strategy <= 9); + /* btultra2 : min 8 bytes; + * then 2x larger for each successive compression strategy + * max threshold 64 bytes */ + { int const shift = MIN(9-(int)strategy, 3); + size_t const mintc = (huf_repeat == HUF_repeat_valid) ? 6 : (size_t)8 << shift; + DEBUGLOG(7, "minLiteralsToCompress = %zu", mintc); + return mintc; + } +} + +size_t ZSTD_compressLiterals ( + void* dst, size_t dstCapacity, + const void* src, size_t srcSize, + void* entropyWorkspace, size_t entropyWorkspaceSize, + const ZSTD_hufCTables_t* prevHuf, + ZSTD_hufCTables_t* nextHuf, + ZSTD_strategy strategy, + int disableLiteralCompression, + int suspectUncompressible, + int bmi2) +{ + size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB); + BYTE* const ostart = (BYTE*)dst; + U32 singleStream = srcSize < 256; + symbolEncodingType_e hType = set_compressed; + size_t cLitSize; + + DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i, srcSize=%u, dstCapacity=%zu)", + disableLiteralCompression, (U32)srcSize, dstCapacity); + + DEBUGLOG(6, "Completed literals listing (%zu bytes)", showHexa(src, srcSize)); + + /* Prepare nextEntropy assuming reusing the existing table */ + ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); + + if (disableLiteralCompression) + return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); + + /* if too small, don't even attempt compression (speed opt) */ + if (srcSize < ZSTD_minLiteralsToCompress(strategy, prevHuf->repeatMode)) + return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); + + RETURN_ERROR_IF(dstCapacity < lhSize+1, dstSize_tooSmall, "not enough space for compression"); + { HUF_repeat repeat = prevHuf->repeatMode; + int const flags = 0 + | (bmi2 ? HUF_flags_bmi2 : 0) + | (strategy < ZSTD_lazy && srcSize <= 1024 ? HUF_flags_preferRepeat : 0) + | (strategy >= HUF_OPTIMAL_DEPTH_THRESHOLD ? HUF_flags_optimalDepth : 0) + | (suspectUncompressible ? HUF_flags_suspectUncompressible : 0); + + typedef size_t (*huf_compress_f)(void*, size_t, const void*, size_t, unsigned, unsigned, void*, size_t, HUF_CElt*, HUF_repeat*, int); + huf_compress_f huf_compress; + if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1; + huf_compress = singleStream ? HUF_compress1X_repeat : HUF_compress4X_repeat; + cLitSize = huf_compress(ostart+lhSize, dstCapacity-lhSize, + src, srcSize, + HUF_SYMBOLVALUE_MAX, LitHufLog, + entropyWorkspace, entropyWorkspaceSize, + (HUF_CElt*)nextHuf->CTable, + &repeat, flags); + DEBUGLOG(5, "%zu literals compressed into %zu bytes (before header)", srcSize, cLitSize); + if (repeat != HUF_repeat_none) { + /* reused the existing table */ + DEBUGLOG(5, "reusing statistics from previous huffman block"); + hType = set_repeat; + } + } + + { size_t const minGain = ZSTD_minGain(srcSize, strategy); + if ((cLitSize==0) || (cLitSize >= srcSize - minGain) || ERR_isError(cLitSize)) { + ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); + return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); + } } + if (cLitSize==1) { + /* A return value of 1 signals that the alphabet consists of a single symbol. + * However, in some rare circumstances, it could be the compressed size (a single byte). + * For that outcome to have a chance to happen, it's necessary that `srcSize < 8`. + * (it's also necessary to not generate statistics). + * Therefore, in such a case, actively check that all bytes are identical. */ + if ((srcSize >= 8) || allBytesIdentical(src, srcSize)) { + ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); + return ZSTD_compressRleLiteralsBlock(dst, dstCapacity, src, srcSize); + } } + + if (hType == set_compressed) { + /* using a newly constructed table */ + nextHuf->repeatMode = HUF_repeat_check; + } + + /* Build header */ + switch(lhSize) + { + case 3: /* 2 - 2 - 10 - 10 */ + if (!singleStream) assert(srcSize >= MIN_LITERALS_FOR_4_STREAMS); + { U32 const lhc = hType + ((U32)(!singleStream) << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<14); + MEM_writeLE24(ostart, lhc); + break; + } + case 4: /* 2 - 2 - 14 - 14 */ + assert(srcSize >= MIN_LITERALS_FOR_4_STREAMS); + { U32 const lhc = hType + (2 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<18); + MEM_writeLE32(ostart, lhc); + break; + } + case 5: /* 2 - 2 - 18 - 18 */ + assert(srcSize >= MIN_LITERALS_FOR_4_STREAMS); + { U32 const lhc = hType + (3 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<22); + MEM_writeLE32(ostart, lhc); + ostart[4] = (BYTE)(cLitSize >> 10); + break; + } + default: /* not possible : lhSize is {3,4,5} */ + assert(0); + } + DEBUGLOG(5, "Compressed literals: %u -> %u", (U32)srcSize, (U32)(lhSize+cLitSize)); + return lhSize+cLitSize; +} diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_literals.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_literals.h similarity index 61% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_literals.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_literals.h index 9904c0c..b060c8a 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_literals.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_literals.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -16,14 +16,24 @@ size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize); +/* ZSTD_compressRleLiteralsBlock() : + * Conditions : + * - All bytes in @src are identical + * - dstCapacity >= 4 */ size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize); -size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf, - ZSTD_hufCTables_t* nextHuf, - ZSTD_strategy strategy, int disableLiteralCompression, - void* dst, size_t dstCapacity, +/* ZSTD_compressLiterals(): + * @entropyWorkspace: must be aligned on 4-bytes boundaries + * @entropyWorkspaceSize : must be >= HUF_WORKSPACE_SIZE + * @suspectUncompressible: sampling checks, to potentially skip huffman coding + */ +size_t ZSTD_compressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize, void* entropyWorkspace, size_t entropyWorkspaceSize, - const int bmi2); + const ZSTD_hufCTables_t* prevHuf, + ZSTD_hufCTables_t* nextHuf, + ZSTD_strategy strategy, int disableLiteralCompression, + int suspectUncompressible, + int bmi2); #endif /* ZSTD_COMPRESS_LITERALS_H */ diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_sequences.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_sequences.c similarity index 93% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_sequences.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_sequences.c index 611eabd..8872d4d 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_sequences.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_sequences.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -58,7 +58,7 @@ static unsigned ZSTD_useLowProbCount(size_t const nbSeq) { /* Heuristic: This should cover most blocks <= 16K and * start to fade out after 16K to about 32K depending on - * comprssibility. + * compressibility. */ return nbSeq >= 2048; } @@ -166,7 +166,7 @@ ZSTD_selectEncodingType( if (mostFrequent == nbSeq) { *repeatMode = FSE_repeat_none; if (isDefaultAllowed && nbSeq <= 2) { - /* Prefer set_basic over set_rle when there are 2 or less symbols, + /* Prefer set_basic over set_rle when there are 2 or fewer symbols, * since RLE uses 1 byte, but set_basic uses 5-6 bits per symbol. * If basic encoding isn't possible, always choose RLE. */ @@ -275,10 +275,11 @@ ZSTD_buildCTable(void* dst, size_t dstCapacity, assert(nbSeq_1 > 1); assert(entropyWorkspaceSize >= sizeof(ZSTD_BuildCTableWksp)); (void)entropyWorkspaceSize; - FORWARD_IF_ERROR(FSE_normalizeCount(wksp->norm, tableLog, count, nbSeq_1, max, ZSTD_useLowProbCount(nbSeq_1)), ""); - { size_t const NCountSize = FSE_writeNCount(op, oend - op, wksp->norm, max, tableLog); /* overflow protected */ + FORWARD_IF_ERROR(FSE_normalizeCount(wksp->norm, tableLog, count, nbSeq_1, max, ZSTD_useLowProbCount(nbSeq_1)), "FSE_normalizeCount failed"); + assert(oend >= op); + { size_t const NCountSize = FSE_writeNCount(op, (size_t)(oend - op), wksp->norm, max, tableLog); /* overflow protected */ FORWARD_IF_ERROR(NCountSize, "FSE_writeNCount failed"); - FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, wksp->norm, max, tableLog, wksp->wksp, sizeof(wksp->wksp)), ""); + FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, wksp->norm, max, tableLog, wksp->wksp, sizeof(wksp->wksp)), "FSE_buildCTable_wksp failed"); return NCountSize; } } @@ -312,19 +313,19 @@ ZSTD_encodeSequences_body( FSE_initCState2(&stateLitLength, CTable_LitLength, llCodeTable[nbSeq-1]); BIT_addBits(&blockStream, sequences[nbSeq-1].litLength, LL_bits[llCodeTable[nbSeq-1]]); if (MEM_32bits()) BIT_flushBits(&blockStream); - BIT_addBits(&blockStream, sequences[nbSeq-1].matchLength, ML_bits[mlCodeTable[nbSeq-1]]); + BIT_addBits(&blockStream, sequences[nbSeq-1].mlBase, ML_bits[mlCodeTable[nbSeq-1]]); if (MEM_32bits()) BIT_flushBits(&blockStream); if (longOffsets) { U32 const ofBits = ofCodeTable[nbSeq-1]; unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1); if (extraBits) { - BIT_addBits(&blockStream, sequences[nbSeq-1].offset, extraBits); + BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, extraBits); BIT_flushBits(&blockStream); } - BIT_addBits(&blockStream, sequences[nbSeq-1].offset >> extraBits, + BIT_addBits(&blockStream, sequences[nbSeq-1].offBase >> extraBits, ofBits - extraBits); } else { - BIT_addBits(&blockStream, sequences[nbSeq-1].offset, ofCodeTable[nbSeq-1]); + BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, ofCodeTable[nbSeq-1]); } BIT_flushBits(&blockStream); @@ -338,8 +339,8 @@ ZSTD_encodeSequences_body( U32 const mlBits = ML_bits[mlCode]; DEBUGLOG(6, "encoding: litlen:%2u - matchlen:%2u - offCode:%7u", (unsigned)sequences[n].litLength, - (unsigned)sequences[n].matchLength + MINMATCH, - (unsigned)sequences[n].offset); + (unsigned)sequences[n].mlBase + MINMATCH, + (unsigned)sequences[n].offBase); /* 32b*/ /* 64b*/ /* (7)*/ /* (7)*/ FSE_encodeSymbol(&blockStream, &stateOffsetBits, ofCode); /* 15 */ /* 15 */ @@ -350,18 +351,18 @@ ZSTD_encodeSequences_body( BIT_flushBits(&blockStream); /* (7)*/ BIT_addBits(&blockStream, sequences[n].litLength, llBits); if (MEM_32bits() && ((llBits+mlBits)>24)) BIT_flushBits(&blockStream); - BIT_addBits(&blockStream, sequences[n].matchLength, mlBits); + BIT_addBits(&blockStream, sequences[n].mlBase, mlBits); if (MEM_32bits() || (ofBits+mlBits+llBits > 56)) BIT_flushBits(&blockStream); if (longOffsets) { unsigned const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1); if (extraBits) { - BIT_addBits(&blockStream, sequences[n].offset, extraBits); + BIT_addBits(&blockStream, sequences[n].offBase, extraBits); BIT_flushBits(&blockStream); /* (7)*/ } - BIT_addBits(&blockStream, sequences[n].offset >> extraBits, + BIT_addBits(&blockStream, sequences[n].offBase >> extraBits, ofBits - extraBits); /* 31 */ } else { - BIT_addBits(&blockStream, sequences[n].offset, ofBits); /* 31 */ + BIT_addBits(&blockStream, sequences[n].offBase, ofBits); /* 31 */ } BIT_flushBits(&blockStream); /* (7)*/ DEBUGLOG(7, "remaining space : %i", (int)(blockStream.endPtr - blockStream.ptr)); @@ -398,7 +399,7 @@ ZSTD_encodeSequences_default( #if DYNAMIC_BMI2 -static TARGET_ATTRIBUTE("bmi2") size_t +static BMI2_TARGET_ATTRIBUTE size_t ZSTD_encodeSequences_bmi2( void* dst, size_t dstCapacity, FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_sequences.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_sequences.h similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_sequences.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_sequences.h index 7991364..4a3a05d 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_sequences.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_sequences.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_superblock.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_superblock.c similarity index 94% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_superblock.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_superblock.c index e4e4506..638c4ac 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_superblock.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_superblock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -36,13 +36,14 @@ * If it is set_compressed, first sub-block's literals section will be Treeless_Literals_Block * and the following sub-blocks' literals sections will be Treeless_Literals_Block. * @return : compressed size of literals section of a sub-block - * Or 0 if it unable to compress. + * Or 0 if unable to compress. * Or error code */ -static size_t ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, - const ZSTD_hufCTablesMetadata_t* hufMetadata, - const BYTE* literals, size_t litSize, - void* dst, size_t dstSize, - const int bmi2, int writeEntropy, int* entropyWritten) +static size_t +ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, + const ZSTD_hufCTablesMetadata_t* hufMetadata, + const BYTE* literals, size_t litSize, + void* dst, size_t dstSize, + const int bmi2, int writeEntropy, int* entropyWritten) { size_t const header = writeEntropy ? 200 : 0; size_t const lhSize = 3 + (litSize >= (1 KB - header)) + (litSize >= (16 KB - header)); @@ -53,8 +54,6 @@ static size_t ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, symbolEncodingType_e hType = writeEntropy ? hufMetadata->hType : set_repeat; size_t cLitSize = 0; - (void)bmi2; /* TODO bmi2... */ - DEBUGLOG(5, "ZSTD_compressSubBlock_literal (litSize=%zu, lhSize=%zu, writeEntropy=%d)", litSize, lhSize, writeEntropy); *entropyWritten = 0; @@ -76,9 +75,9 @@ static size_t ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, DEBUGLOG(5, "ZSTD_compressSubBlock_literal (hSize=%zu)", hufMetadata->hufDesSize); } - /* TODO bmi2 */ - { const size_t cSize = singleStream ? HUF_compress1X_usingCTable(op, oend-op, literals, litSize, hufTable) - : HUF_compress4X_usingCTable(op, oend-op, literals, litSize, hufTable); + { int const flags = bmi2 ? HUF_flags_bmi2 : 0; + const size_t cSize = singleStream ? HUF_compress1X_usingCTable(op, oend-op, literals, litSize, hufTable, flags) + : HUF_compress4X_usingCTable(op, oend-op, literals, litSize, hufTable, flags); op += cSize; cLitSize += cSize; if (cSize == 0 || ERR_isError(cSize)) { @@ -126,12 +125,17 @@ static size_t ZSTD_compressSubBlock_literal(const HUF_CElt* hufTable, return op-ostart; } -static size_t ZSTD_seqDecompressedSize(seqStore_t const* seqStore, const seqDef* sequences, size_t nbSeq, size_t litSize, int lastSequence) { +static size_t +ZSTD_seqDecompressedSize(seqStore_t const* seqStore, + const seqDef* sequences, size_t nbSeq, + size_t litSize, int lastSequence) +{ const seqDef* const sstart = sequences; const seqDef* const send = sequences + nbSeq; const seqDef* sp = sstart; size_t matchLengthSum = 0; size_t litLengthSum = 0; + (void)(litLengthSum); /* suppress unused variable warning on some environments */ while (send-sp > 0) { ZSTD_sequenceLength const seqLen = ZSTD_getSequenceLength(seqStore, sp); litLengthSum += seqLen.litLength; @@ -155,13 +159,14 @@ static size_t ZSTD_seqDecompressedSize(seqStore_t const* seqStore, const seqDef* * @return : compressed size of sequences section of a sub-block * Or 0 if it is unable to compress * Or error code. */ -static size_t ZSTD_compressSubBlock_sequences(const ZSTD_fseCTables_t* fseTables, - const ZSTD_fseCTablesMetadata_t* fseMetadata, - const seqDef* sequences, size_t nbSeq, - const BYTE* llCode, const BYTE* mlCode, const BYTE* ofCode, - const ZSTD_CCtx_params* cctxParams, - void* dst, size_t dstCapacity, - const int bmi2, int writeEntropy, int* entropyWritten) +static size_t +ZSTD_compressSubBlock_sequences(const ZSTD_fseCTables_t* fseTables, + const ZSTD_fseCTablesMetadata_t* fseMetadata, + const seqDef* sequences, size_t nbSeq, + const BYTE* llCode, const BYTE* mlCode, const BYTE* ofCode, + const ZSTD_CCtx_params* cctxParams, + void* dst, size_t dstCapacity, + const int bmi2, int writeEntropy, int* entropyWritten) { const int longOffsets = cctxParams->cParams.windowLog > STREAM_ACCUMULATOR_MIN; BYTE* const ostart = (BYTE*)dst; @@ -324,7 +329,7 @@ static size_t ZSTD_estimateSubBlockSize_literal(const BYTE* literals, size_t lit static size_t ZSTD_estimateSubBlockSize_symbolType(symbolEncodingType_e type, const BYTE* codeTable, unsigned maxCode, size_t nbSeq, const FSE_CTable* fseCTable, - const U32* additionalBits, + const U8* additionalBits, short const* defaultNorm, U32 defaultNormLog, U32 defaultMax, void* workspace, size_t wkspSize) { @@ -474,7 +479,7 @@ static size_t ZSTD_compressSubBlock_multi(const seqStore_t* seqStorePtr, /* I think there is an optimization opportunity here. * Calling ZSTD_estimateSubBlockSize for every sequence can be wasteful * since it recalculates estimate from scratch. - * For example, it would recount literal distribution and symbol codes everytime. + * For example, it would recount literal distribution and symbol codes every time. */ cBlockSizeEstimate = ZSTD_estimateSubBlockSize(lp, litSize, ofCodePtr, llCodePtr, mlCodePtr, seqCount, &nextCBlock->entropy, entropyMetadata, @@ -538,7 +543,7 @@ static size_t ZSTD_compressSubBlock_multi(const seqStore_t* seqStorePtr, repcodes_t rep; ZSTD_memcpy(&rep, prevCBlock->rep, sizeof(rep)); for (seq = sstart; seq < sp; ++seq) { - rep = ZSTD_updateRep(rep.rep, seq->offset - 1, ZSTD_getSequenceLength(seqStorePtr, seq).litLength == 0); + ZSTD_updateRep(rep.rep, seq->offBase, ZSTD_getSequenceLength(seqStorePtr, seq).litLength == 0); } ZSTD_memcpy(nextCBlock->rep, &rep, sizeof(rep)); } diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_superblock.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_superblock.h similarity index 95% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_superblock.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_superblock.h index 176f9b1..8e494f0 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_compress_superblock.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_compress_superblock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_cwksp.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_cwksp.h similarity index 92% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_cwksp.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_cwksp.h index 2656d26..9767669 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_cwksp.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_cwksp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -219,7 +219,7 @@ MEM_STATIC size_t ZSTD_cwksp_aligned_alloc_size(size_t size) { MEM_STATIC size_t ZSTD_cwksp_slack_space_required(void) { /* For alignment, the wksp will always allocate an additional n_1=[1, 64] bytes * to align the beginning of tables section, as well as another n_2=[0, 63] bytes - * to align the beginning of the aligned secion. + * to align the beginning of the aligned section. * * n_1 + n_2 == 64 bytes if the cwksp is freshly allocated, due to tables and * aligneds being sized in multiples of 64 bytes. @@ -243,12 +243,14 @@ MEM_STATIC size_t ZSTD_cwksp_bytes_to_align_ptr(void* ptr, const size_t alignByt /** * Internal function. Do not use directly. - * Reserves the given number of bytes within the aligned/buffer segment of the wksp, which - * counts from the end of the wksp. (as opposed to the object/table segment) + * Reserves the given number of bytes within the aligned/buffer segment of the wksp, + * which counts from the end of the wksp (as opposed to the object/table segment). * * Returns a pointer to the beginning of that space. */ -MEM_STATIC void* ZSTD_cwksp_reserve_internal_buffer_space(ZSTD_cwksp* ws, size_t const bytes) { +MEM_STATIC void* +ZSTD_cwksp_reserve_internal_buffer_space(ZSTD_cwksp* ws, size_t const bytes) +{ void* const alloc = (BYTE*)ws->allocStart - bytes; void* const bottom = ws->tableEnd; DEBUGLOG(5, "cwksp: reserving %p %zd bytes, %zd bytes remaining", @@ -260,6 +262,8 @@ MEM_STATIC void* ZSTD_cwksp_reserve_internal_buffer_space(ZSTD_cwksp* ws, size_t ws->allocFailed = 1; return NULL; } + /* the area is reserved from the end of wksp. + * If it overlaps with tableValidEnd, it voids guarantees on values' range */ if (alloc < ws->tableValidEnd) { ws->tableValidEnd = alloc; } @@ -269,10 +273,12 @@ MEM_STATIC void* ZSTD_cwksp_reserve_internal_buffer_space(ZSTD_cwksp* ws, size_t /** * Moves the cwksp to the next phase, and does any necessary allocations. + * cwksp initialization must necessarily go through each phase in order. * Returns a 0 on success, or zstd error */ -MEM_STATIC size_t ZSTD_cwksp_internal_advance_phase( - ZSTD_cwksp* ws, ZSTD_cwksp_alloc_phase_e phase) { +MEM_STATIC size_t +ZSTD_cwksp_internal_advance_phase(ZSTD_cwksp* ws, ZSTD_cwksp_alloc_phase_e phase) +{ assert(phase >= ws->phase); if (phase > ws->phase) { /* Going from allocating objects to allocating buffers */ @@ -295,15 +301,15 @@ MEM_STATIC size_t ZSTD_cwksp_internal_advance_phase( { /* Align the start of the tables to 64 bytes. Use [0, 63] bytes */ void* const alloc = ws->objectEnd; size_t const bytesToAlign = ZSTD_cwksp_bytes_to_align_ptr(alloc, ZSTD_CWKSP_ALIGNMENT_BYTES); - void* const end = (BYTE*)alloc + bytesToAlign; + void* const objectEnd = (BYTE*)alloc + bytesToAlign; DEBUGLOG(5, "reserving table alignment addtl space: %zu", bytesToAlign); - RETURN_ERROR_IF(end > ws->workspaceEnd, memory_allocation, + RETURN_ERROR_IF(objectEnd > ws->workspaceEnd, memory_allocation, "table phase - alignment initial allocation failed!"); - ws->objectEnd = end; - ws->tableEnd = end; - ws->tableValidEnd = end; - } - } + ws->objectEnd = objectEnd; + ws->tableEnd = objectEnd; /* table area starts being empty */ + if (ws->tableValidEnd < ws->tableEnd) { + ws->tableValidEnd = ws->tableEnd; + } } } ws->phase = phase; ZSTD_cwksp_assert_internal_consistency(ws); } @@ -313,15 +319,17 @@ MEM_STATIC size_t ZSTD_cwksp_internal_advance_phase( /** * Returns whether this object/buffer/etc was allocated in this workspace. */ -MEM_STATIC int ZSTD_cwksp_owns_buffer(const ZSTD_cwksp* ws, const void* ptr) { +MEM_STATIC int ZSTD_cwksp_owns_buffer(const ZSTD_cwksp* ws, const void* ptr) +{ return (ptr != NULL) && (ws->workspace <= ptr) && (ptr <= ws->workspaceEnd); } /** * Internal function. Do not use directly. */ -MEM_STATIC void* ZSTD_cwksp_reserve_internal( - ZSTD_cwksp* ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase) { +MEM_STATIC void* +ZSTD_cwksp_reserve_internal(ZSTD_cwksp* ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase) +{ void* alloc; if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase)) || bytes == 0) { return NULL; @@ -340,7 +348,9 @@ MEM_STATIC void* ZSTD_cwksp_reserve_internal( if (alloc) { alloc = (BYTE *)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE; if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) { - __asan_unpoison_memory_region(alloc, bytes); + /* We need to keep the redzone poisoned while unpoisoning the bytes that + * are actually allocated. */ + __asan_unpoison_memory_region(alloc, bytes - 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE); } } #endif @@ -351,14 +361,16 @@ MEM_STATIC void* ZSTD_cwksp_reserve_internal( /** * Reserves and returns unaligned memory. */ -MEM_STATIC BYTE* ZSTD_cwksp_reserve_buffer(ZSTD_cwksp* ws, size_t bytes) { +MEM_STATIC BYTE* ZSTD_cwksp_reserve_buffer(ZSTD_cwksp* ws, size_t bytes) +{ return (BYTE*)ZSTD_cwksp_reserve_internal(ws, bytes, ZSTD_cwksp_alloc_buffers); } /** * Reserves and returns memory sized on and aligned on ZSTD_CWKSP_ALIGNMENT_BYTES (64 bytes). */ -MEM_STATIC void* ZSTD_cwksp_reserve_aligned(ZSTD_cwksp* ws, size_t bytes) { +MEM_STATIC void* ZSTD_cwksp_reserve_aligned(ZSTD_cwksp* ws, size_t bytes) +{ void* ptr = ZSTD_cwksp_reserve_internal(ws, ZSTD_cwksp_align(bytes, ZSTD_CWKSP_ALIGNMENT_BYTES), ZSTD_cwksp_alloc_aligned); assert(((size_t)ptr & (ZSTD_CWKSP_ALIGNMENT_BYTES-1))== 0); @@ -370,7 +382,8 @@ MEM_STATIC void* ZSTD_cwksp_reserve_aligned(ZSTD_cwksp* ws, size_t bytes) { * their values remain constrained, allowing us to re-use them without * memset()-ing them. */ -MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes) { +MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes) +{ const ZSTD_cwksp_alloc_phase_e phase = ZSTD_cwksp_alloc_aligned; void* alloc; void* end; @@ -408,9 +421,11 @@ MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes) { /** * Aligned on sizeof(void*). + * Note : should happen only once, at workspace first initialization */ -MEM_STATIC void* ZSTD_cwksp_reserve_object(ZSTD_cwksp* ws, size_t bytes) { - size_t roundedBytes = ZSTD_cwksp_align(bytes, sizeof(void*)); +MEM_STATIC void* ZSTD_cwksp_reserve_object(ZSTD_cwksp* ws, size_t bytes) +{ + size_t const roundedBytes = ZSTD_cwksp_align(bytes, sizeof(void*)); void* alloc = ws->objectEnd; void* end = (BYTE*)alloc + roundedBytes; @@ -419,15 +434,15 @@ MEM_STATIC void* ZSTD_cwksp_reserve_object(ZSTD_cwksp* ws, size_t bytes) { end = (BYTE *)end + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE; #endif - DEBUGLOG(5, + DEBUGLOG(4, "cwksp: reserving %p object %zd bytes (rounded to %zd), %zd bytes remaining", alloc, bytes, roundedBytes, ZSTD_cwksp_available_space(ws) - roundedBytes); - assert(((size_t)alloc & (sizeof(void*)-1)) == 0); - assert((bytes & (sizeof(void*)-1)) == 0); + assert((size_t)alloc % ZSTD_ALIGNOF(void*) == 0); + assert(bytes % ZSTD_ALIGNOF(void*) == 0); ZSTD_cwksp_assert_internal_consistency(ws); /* we must be in the first phase, no advance is possible */ if (ws->phase != ZSTD_cwksp_alloc_objects || end > ws->workspaceEnd) { - DEBUGLOG(4, "cwksp: object alloc failed!"); + DEBUGLOG(3, "cwksp: object alloc failed!"); ws->allocFailed = 1; return NULL; } @@ -438,7 +453,7 @@ MEM_STATIC void* ZSTD_cwksp_reserve_object(ZSTD_cwksp* ws, size_t bytes) { #if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on * either size. */ - alloc = (BYTE *)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE; + alloc = (BYTE*)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE; if (ws->isStatic == ZSTD_cwksp_dynamic_alloc) { __asan_unpoison_memory_region(alloc, bytes); } @@ -447,7 +462,8 @@ MEM_STATIC void* ZSTD_cwksp_reserve_object(ZSTD_cwksp* ws, size_t bytes) { return alloc; } -MEM_STATIC void ZSTD_cwksp_mark_tables_dirty(ZSTD_cwksp* ws) { +MEM_STATIC void ZSTD_cwksp_mark_tables_dirty(ZSTD_cwksp* ws) +{ DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty"); #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) @@ -485,7 +501,7 @@ MEM_STATIC void ZSTD_cwksp_clean_tables(ZSTD_cwksp* ws) { assert(ws->tableValidEnd >= ws->objectEnd); assert(ws->tableValidEnd <= ws->allocStart); if (ws->tableValidEnd < ws->tableEnd) { - ZSTD_memset(ws->tableValidEnd, 0, (BYTE*)ws->tableEnd - (BYTE*)ws->tableValidEnd); + ZSTD_memset(ws->tableValidEnd, 0, (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->tableValidEnd)); } ZSTD_cwksp_mark_tables_clean(ws); } diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_double_fast.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_double_fast.c similarity index 51% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_double_fast.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_double_fast.c index d0d3a78..0ad88ff 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_double_fast.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_double_fast.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -11,8 +11,43 @@ #include "zstd_compress_internal.h" #include "zstd_double_fast.h" +static void ZSTD_fillDoubleHashTableForCDict(ZSTD_matchState_t* ms, + void const* end, ZSTD_dictTableLoadMethod_e dtlm) +{ + const ZSTD_compressionParameters* const cParams = &ms->cParams; + U32* const hashLarge = ms->hashTable; + U32 const hBitsL = cParams->hashLog + ZSTD_SHORT_CACHE_TAG_BITS; + U32 const mls = cParams->minMatch; + U32* const hashSmall = ms->chainTable; + U32 const hBitsS = cParams->chainLog + ZSTD_SHORT_CACHE_TAG_BITS; + const BYTE* const base = ms->window.base; + const BYTE* ip = base + ms->nextToUpdate; + const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE; + const U32 fastHashFillStep = 3; -void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, + /* Always insert every fastHashFillStep position into the hash tables. + * Insert the other positions into the large hash table if their entry + * is empty. + */ + for (; ip + fastHashFillStep - 1 <= iend; ip += fastHashFillStep) { + U32 const curr = (U32)(ip - base); + U32 i; + for (i = 0; i < fastHashFillStep; ++i) { + size_t const smHashAndTag = ZSTD_hashPtr(ip + i, hBitsS, mls); + size_t const lgHashAndTag = ZSTD_hashPtr(ip + i, hBitsL, 8); + if (i == 0) { + ZSTD_writeTaggedIndex(hashSmall, smHashAndTag, curr + i); + } + if (i == 0 || hashLarge[lgHashAndTag >> ZSTD_SHORT_CACHE_TAG_BITS] == 0) { + ZSTD_writeTaggedIndex(hashLarge, lgHashAndTag, curr + i); + } + /* Only load extra positions for ZSTD_dtlm_full */ + if (dtlm == ZSTD_dtlm_fast) + break; + } } +} + +static void ZSTD_fillDoubleHashTableForCCtx(ZSTD_matchState_t* ms, void const* end, ZSTD_dictTableLoadMethod_e dtlm) { const ZSTD_compressionParameters* const cParams = &ms->cParams; @@ -43,15 +78,26 @@ void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, /* Only load extra positions for ZSTD_dtlm_full */ if (dtlm == ZSTD_dtlm_fast) break; - } } + } } +} + +void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, + const void* const end, + ZSTD_dictTableLoadMethod_e dtlm, + ZSTD_tableFillPurpose_e tfp) +{ + if (tfp == ZSTD_tfp_forCDict) { + ZSTD_fillDoubleHashTableForCDict(ms, end, dtlm); + } else { + ZSTD_fillDoubleHashTableForCCtx(ms, end, dtlm); + } } FORCE_INLINE_TEMPLATE -size_t ZSTD_compressBlock_doubleFast_generic( +size_t ZSTD_compressBlock_doubleFast_noDict_generic( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, - U32 const mls /* template */, ZSTD_dictMode_e const dictMode) + void const* src, size_t srcSize, U32 const mls /* template */) { ZSTD_compressionParameters const* cParams = &ms->cParams; U32* const hashLong = ms->hashTable; @@ -60,7 +106,6 @@ size_t ZSTD_compressBlock_doubleFast_generic( const U32 hBitsS = cParams->chainLog; const BYTE* const base = ms->window.base; const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; const BYTE* anchor = istart; const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); /* presumes that, if there is a dictionary, it must be using Attach mode */ @@ -69,188 +114,161 @@ size_t ZSTD_compressBlock_doubleFast_generic( const BYTE* const iend = istart + srcSize; const BYTE* const ilimit = iend - HASH_READ_SIZE; U32 offset_1=rep[0], offset_2=rep[1]; - U32 offsetSaved = 0; + U32 offsetSaved1 = 0, offsetSaved2 = 0; - const ZSTD_matchState_t* const dms = ms->dictMatchState; - const ZSTD_compressionParameters* const dictCParams = - dictMode == ZSTD_dictMatchState ? - &dms->cParams : NULL; - const U32* const dictHashLong = dictMode == ZSTD_dictMatchState ? - dms->hashTable : NULL; - const U32* const dictHashSmall = dictMode == ZSTD_dictMatchState ? - dms->chainTable : NULL; - const U32 dictStartIndex = dictMode == ZSTD_dictMatchState ? - dms->window.dictLimit : 0; - const BYTE* const dictBase = dictMode == ZSTD_dictMatchState ? - dms->window.base : NULL; - const BYTE* const dictStart = dictMode == ZSTD_dictMatchState ? - dictBase + dictStartIndex : NULL; - const BYTE* const dictEnd = dictMode == ZSTD_dictMatchState ? - dms->window.nextSrc : NULL; - const U32 dictIndexDelta = dictMode == ZSTD_dictMatchState ? - prefixLowestIndex - (U32)(dictEnd - dictBase) : - 0; - const U32 dictHBitsL = dictMode == ZSTD_dictMatchState ? - dictCParams->hashLog : hBitsL; - const U32 dictHBitsS = dictMode == ZSTD_dictMatchState ? - dictCParams->chainLog : hBitsS; - const U32 dictAndPrefixLength = (U32)((ip - prefixLowest) + (dictEnd - dictStart)); + size_t mLength; + U32 offset; + U32 curr; - DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_generic"); + /* how many positions to search before increasing step size */ + const size_t kStepIncr = 1 << kSearchStrength; + /* the position at which to increment the step size if no match is found */ + const BYTE* nextStep; + size_t step; /* the current step size */ - assert(dictMode == ZSTD_noDict || dictMode == ZSTD_dictMatchState); + size_t hl0; /* the long hash at ip */ + size_t hl1; /* the long hash at ip1 */ - /* if a dictionary is attached, it must be within window range */ - if (dictMode == ZSTD_dictMatchState) { - assert(ms->window.dictLimit + (1U << cParams->windowLog) >= endIndex); - } + U32 idxl0; /* the long match index for ip */ + U32 idxl1; /* the long match index for ip1 */ + + const BYTE* matchl0; /* the long match for ip */ + const BYTE* matchs0; /* the short match for ip */ + const BYTE* matchl1; /* the long match for ip1 */ + + const BYTE* ip = istart; /* the current position */ + const BYTE* ip1; /* the next position */ + + DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_noDict_generic"); /* init */ - ip += (dictAndPrefixLength == 0); - if (dictMode == ZSTD_noDict) { - U32 const curr = (U32)(ip - base); - U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, cParams->windowLog); - U32 const maxRep = curr - windowLow; - if (offset_2 > maxRep) offsetSaved = offset_2, offset_2 = 0; - if (offset_1 > maxRep) offsetSaved = offset_1, offset_1 = 0; - } - if (dictMode == ZSTD_dictMatchState) { - /* dictMatchState repCode checks don't currently handle repCode == 0 - * disabling. */ - assert(offset_1 <= dictAndPrefixLength); - assert(offset_2 <= dictAndPrefixLength); + ip += ((ip - prefixLowest) == 0); + { + U32 const current = (U32)(ip - base); + U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, current, cParams->windowLog); + U32 const maxRep = current - windowLow; + if (offset_2 > maxRep) offsetSaved2 = offset_2, offset_2 = 0; + if (offset_1 > maxRep) offsetSaved1 = offset_1, offset_1 = 0; } - /* Main Search Loop */ - while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */ - size_t mLength; - U32 offset; - size_t const h2 = ZSTD_hashPtr(ip, hBitsL, 8); - size_t const h = ZSTD_hashPtr(ip, hBitsS, mls); - size_t const dictHL = ZSTD_hashPtr(ip, dictHBitsL, 8); - size_t const dictHS = ZSTD_hashPtr(ip, dictHBitsS, mls); - U32 const curr = (U32)(ip-base); - U32 const matchIndexL = hashLong[h2]; - U32 matchIndexS = hashSmall[h]; - const BYTE* matchLong = base + matchIndexL; - const BYTE* match = base + matchIndexS; - const U32 repIndex = curr + 1 - offset_1; - const BYTE* repMatch = (dictMode == ZSTD_dictMatchState - && repIndex < prefixLowestIndex) ? - dictBase + (repIndex - dictIndexDelta) : - base + repIndex; - hashLong[h2] = hashSmall[h] = curr; /* update hash tables */ + /* Outer Loop: one iteration per match found and stored */ + while (1) { + step = 1; + nextStep = ip + kStepIncr; + ip1 = ip + step; - /* check dictMatchState repcode */ - if (dictMode == ZSTD_dictMatchState - && ((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; - mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); - goto _match_stored; + if (ip1 > ilimit) { + goto _cleanup; } - /* check noDict repcode */ - if ( dictMode == ZSTD_noDict - && ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) { - mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); - goto _match_stored; - } + hl0 = ZSTD_hashPtr(ip, hBitsL, 8); + idxl0 = hashLong[hl0]; + matchl0 = base + idxl0; - if (matchIndexL > prefixLowestIndex) { - /* check prefix long match */ - if (MEM_read64(matchLong) == MEM_read64(ip)) { - mLength = ZSTD_count(ip+8, matchLong+8, iend) + 8; - offset = (U32)(ip-matchLong); - while (((ip>anchor) & (matchLong>prefixLowest)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */ - goto _match_found; + /* Inner Loop: one iteration per search / position */ + do { + const size_t hs0 = ZSTD_hashPtr(ip, hBitsS, mls); + const U32 idxs0 = hashSmall[hs0]; + curr = (U32)(ip-base); + matchs0 = base + idxs0; + + hashLong[hl0] = hashSmall[hs0] = curr; /* update hash tables */ + + /* check noDict repcode */ + if ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1))) { + mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4; + ip++; + ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, REPCODE1_TO_OFFBASE, mLength); + goto _match_stored; } - } else if (dictMode == ZSTD_dictMatchState) { - /* check dictMatchState long match */ - U32 const dictMatchIndexL = dictHashLong[dictHL]; - const BYTE* dictMatchL = dictBase + dictMatchIndexL; - assert(dictMatchL < dictEnd); - if (dictMatchL > dictStart && MEM_read64(dictMatchL) == MEM_read64(ip)) { - mLength = ZSTD_count_2segments(ip+8, dictMatchL+8, iend, dictEnd, prefixLowest) + 8; - offset = (U32)(curr - dictMatchIndexL - dictIndexDelta); - while (((ip>anchor) & (dictMatchL>dictStart)) && (ip[-1] == dictMatchL[-1])) { ip--; dictMatchL--; mLength++; } /* catch up */ - goto _match_found; - } } + hl1 = ZSTD_hashPtr(ip1, hBitsL, 8); - if (matchIndexS > prefixLowestIndex) { - /* check prefix short match */ - if (MEM_read32(match) == MEM_read32(ip)) { - goto _search_next_long; + if (idxl0 > prefixLowestIndex) { + /* check prefix long match */ + if (MEM_read64(matchl0) == MEM_read64(ip)) { + mLength = ZSTD_count(ip+8, matchl0+8, iend) + 8; + offset = (U32)(ip-matchl0); + while (((ip>anchor) & (matchl0>prefixLowest)) && (ip[-1] == matchl0[-1])) { ip--; matchl0--; mLength++; } /* catch up */ + goto _match_found; + } } - } else if (dictMode == ZSTD_dictMatchState) { - /* check dictMatchState short match */ - U32 const dictMatchIndexS = dictHashSmall[dictHS]; - match = dictBase + dictMatchIndexS; - matchIndexS = dictMatchIndexS + dictIndexDelta; - if (match > dictStart && MEM_read32(match) == MEM_read32(ip)) { - goto _search_next_long; - } } + idxl1 = hashLong[hl1]; + matchl1 = base + idxl1; - ip += ((ip-anchor) >> kSearchStrength) + 1; -#if defined(__aarch64__) - PREFETCH_L1(ip+256); -#endif - continue; + if (idxs0 > prefixLowestIndex) { + /* check prefix short match */ + if (MEM_read32(matchs0) == MEM_read32(ip)) { + goto _search_next_long; + } + } + + if (ip1 >= nextStep) { + PREFETCH_L1(ip1 + 64); + PREFETCH_L1(ip1 + 128); + step++; + nextStep += kStepIncr; + } + ip = ip1; + ip1 += step; + + hl0 = hl1; + idxl0 = idxl1; + matchl0 = matchl1; + #if defined(__aarch64__) + PREFETCH_L1(ip+256); + #endif + } while (ip1 <= ilimit); + +_cleanup: + /* If offset_1 started invalid (offsetSaved1 != 0) and became valid (offset_1 != 0), + * rotate saved offsets. See comment in ZSTD_compressBlock_fast_noDict for more context. */ + offsetSaved2 = ((offsetSaved1 != 0) && (offset_1 != 0)) ? offsetSaved1 : offsetSaved2; + + /* save reps for next block */ + rep[0] = offset_1 ? offset_1 : offsetSaved1; + rep[1] = offset_2 ? offset_2 : offsetSaved2; + + /* Return the last literals size */ + return (size_t)(iend - anchor); _search_next_long: - { size_t const hl3 = ZSTD_hashPtr(ip+1, hBitsL, 8); - size_t const dictHLNext = ZSTD_hashPtr(ip+1, dictHBitsL, 8); - U32 const matchIndexL3 = hashLong[hl3]; - const BYTE* matchL3 = base + matchIndexL3; - hashLong[hl3] = curr + 1; - - /* check prefix long +1 match */ - if (matchIndexL3 > prefixLowestIndex) { - if (MEM_read64(matchL3) == MEM_read64(ip+1)) { - mLength = ZSTD_count(ip+9, matchL3+8, iend) + 8; - ip++; - offset = (U32)(ip-matchL3); - while (((ip>anchor) & (matchL3>prefixLowest)) && (ip[-1] == matchL3[-1])) { ip--; matchL3--; mLength++; } /* catch up */ - goto _match_found; - } - } else if (dictMode == ZSTD_dictMatchState) { - /* check dict long +1 match */ - U32 const dictMatchIndexL3 = dictHashLong[dictHLNext]; - const BYTE* dictMatchL3 = dictBase + dictMatchIndexL3; - assert(dictMatchL3 < dictEnd); - if (dictMatchL3 > dictStart && MEM_read64(dictMatchL3) == MEM_read64(ip+1)) { - mLength = ZSTD_count_2segments(ip+1+8, dictMatchL3+8, iend, dictEnd, prefixLowest) + 8; - ip++; - offset = (U32)(curr + 1 - dictMatchIndexL3 - dictIndexDelta); - while (((ip>anchor) & (dictMatchL3>dictStart)) && (ip[-1] == dictMatchL3[-1])) { ip--; dictMatchL3--; mLength++; } /* catch up */ - goto _match_found; - } } } + /* check prefix long +1 match */ + if (idxl1 > prefixLowestIndex) { + if (MEM_read64(matchl1) == MEM_read64(ip1)) { + ip = ip1; + mLength = ZSTD_count(ip+8, matchl1+8, iend) + 8; + offset = (U32)(ip-matchl1); + while (((ip>anchor) & (matchl1>prefixLowest)) && (ip[-1] == matchl1[-1])) { ip--; matchl1--; mLength++; } /* catch up */ + goto _match_found; + } + } /* if no long +1 match, explore the short match we found */ - if (dictMode == ZSTD_dictMatchState && matchIndexS < prefixLowestIndex) { - mLength = ZSTD_count_2segments(ip+4, match+4, iend, dictEnd, prefixLowest) + 4; - offset = (U32)(curr - matchIndexS); - while (((ip>anchor) & (match>dictStart)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - } else { - mLength = ZSTD_count(ip+4, match+4, iend) + 4; - offset = (U32)(ip - match); - while (((ip>anchor) & (match>prefixLowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - } + mLength = ZSTD_count(ip+4, matchs0+4, iend) + 4; + offset = (U32)(ip - matchs0); + while (((ip>anchor) & (matchs0>prefixLowest)) && (ip[-1] == matchs0[-1])) { ip--; matchs0--; mLength++; } /* catch up */ /* fall-through */ -_match_found: +_match_found: /* requires ip, offset, mLength */ offset_2 = offset_1; offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); + if (step < 4) { + /* It is unsafe to write this value back to the hashtable when ip1 is + * greater than or equal to the new ip we will have after we're done + * processing this match. Rather than perform that test directly + * (ip1 >= ip + mLength), which costs speed in practice, we do a simpler + * more predictable test. The minmatch even if we take a short match is + * 4 bytes, so as long as step, the distance between ip and ip1 + * (initially) is less than 4, we know ip1 < new ip. */ + hashLong[hl1] = (U32)(ip1 - base); + } + + ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, OFFSET_TO_OFFBASE(offset), mLength); _match_stored: /* match found */ @@ -268,53 +286,268 @@ _match_stored: } /* check immediate repcode */ - if (dictMode == ZSTD_dictMatchState) { - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex2 = current2 - offset_2; - const BYTE* repMatch2 = dictMode == ZSTD_dictMatchState - && repIndex2 < prefixLowestIndex ? - dictBase + repIndex2 - dictIndexDelta : - base + repIndex2; - if ( ((U32)((prefixLowestIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */) - && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex2 < prefixLowestIndex ? dictEnd : iend; - size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixLowest) + 4; - U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, repLength2-MINMATCH); - hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = current2; - hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2; - ip += repLength2; - anchor = ip; - continue; - } - break; - } } + while ( (ip <= ilimit) + && ( (offset_2>0) + & (MEM_read32(ip) == MEM_read32(ip - offset_2)) )) { + /* store sequence */ + size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4; + U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; /* swap offset_2 <=> offset_1 */ + hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip-base); + hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip-base); + ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, rLength); + ip += rLength; + anchor = ip; + continue; /* faster when present ... (?) */ + } + } + } +} - if (dictMode == ZSTD_noDict) { - while ( (ip <= ilimit) - && ( (offset_2>0) - & (MEM_read32(ip) == MEM_read32(ip - offset_2)) )) { - /* store sequence */ - size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4; - U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; /* swap offset_2 <=> offset_1 */ - hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip-base); - hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip-base); - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, rLength-MINMATCH); - ip += rLength; - anchor = ip; - continue; /* faster when present ... (?) */ + +FORCE_INLINE_TEMPLATE +size_t ZSTD_compressBlock_doubleFast_dictMatchState_generic( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize, + U32 const mls /* template */) +{ + ZSTD_compressionParameters const* cParams = &ms->cParams; + U32* const hashLong = ms->hashTable; + const U32 hBitsL = cParams->hashLog; + U32* const hashSmall = ms->chainTable; + const U32 hBitsS = cParams->chainLog; + const BYTE* const base = ms->window.base; + const BYTE* const istart = (const BYTE*)src; + const BYTE* ip = istart; + const BYTE* anchor = istart; + const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); + /* presumes that, if there is a dictionary, it must be using Attach mode */ + const U32 prefixLowestIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog); + const BYTE* const prefixLowest = base + prefixLowestIndex; + const BYTE* const iend = istart + srcSize; + const BYTE* const ilimit = iend - HASH_READ_SIZE; + U32 offset_1=rep[0], offset_2=rep[1]; + + const ZSTD_matchState_t* const dms = ms->dictMatchState; + const ZSTD_compressionParameters* const dictCParams = &dms->cParams; + const U32* const dictHashLong = dms->hashTable; + const U32* const dictHashSmall = dms->chainTable; + const U32 dictStartIndex = dms->window.dictLimit; + const BYTE* const dictBase = dms->window.base; + const BYTE* const dictStart = dictBase + dictStartIndex; + const BYTE* const dictEnd = dms->window.nextSrc; + const U32 dictIndexDelta = prefixLowestIndex - (U32)(dictEnd - dictBase); + const U32 dictHBitsL = dictCParams->hashLog + ZSTD_SHORT_CACHE_TAG_BITS; + const U32 dictHBitsS = dictCParams->chainLog + ZSTD_SHORT_CACHE_TAG_BITS; + const U32 dictAndPrefixLength = (U32)((ip - prefixLowest) + (dictEnd - dictStart)); + + DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_dictMatchState_generic"); + + /* if a dictionary is attached, it must be within window range */ + assert(ms->window.dictLimit + (1U << cParams->windowLog) >= endIndex); + + if (ms->prefetchCDictTables) { + size_t const hashTableBytes = (((size_t)1) << dictCParams->hashLog) * sizeof(U32); + size_t const chainTableBytes = (((size_t)1) << dictCParams->chainLog) * sizeof(U32); + PREFETCH_AREA(dictHashLong, hashTableBytes) + PREFETCH_AREA(dictHashSmall, chainTableBytes) + } + + /* init */ + ip += (dictAndPrefixLength == 0); + + /* dictMatchState repCode checks don't currently handle repCode == 0 + * disabling. */ + assert(offset_1 <= dictAndPrefixLength); + assert(offset_2 <= dictAndPrefixLength); + + /* Main Search Loop */ + while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */ + size_t mLength; + U32 offset; + size_t const h2 = ZSTD_hashPtr(ip, hBitsL, 8); + size_t const h = ZSTD_hashPtr(ip, hBitsS, mls); + size_t const dictHashAndTagL = ZSTD_hashPtr(ip, dictHBitsL, 8); + size_t const dictHashAndTagS = ZSTD_hashPtr(ip, dictHBitsS, mls); + U32 const dictMatchIndexAndTagL = dictHashLong[dictHashAndTagL >> ZSTD_SHORT_CACHE_TAG_BITS]; + U32 const dictMatchIndexAndTagS = dictHashSmall[dictHashAndTagS >> ZSTD_SHORT_CACHE_TAG_BITS]; + int const dictTagsMatchL = ZSTD_comparePackedTags(dictMatchIndexAndTagL, dictHashAndTagL); + int const dictTagsMatchS = ZSTD_comparePackedTags(dictMatchIndexAndTagS, dictHashAndTagS); + U32 const curr = (U32)(ip-base); + U32 const matchIndexL = hashLong[h2]; + U32 matchIndexS = hashSmall[h]; + const BYTE* matchLong = base + matchIndexL; + const BYTE* match = base + matchIndexS; + const U32 repIndex = curr + 1 - offset_1; + const BYTE* repMatch = (repIndex < prefixLowestIndex) ? + dictBase + (repIndex - dictIndexDelta) : + base + repIndex; + hashLong[h2] = hashSmall[h] = curr; /* update hash tables */ + + /* check repcode */ + if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) + && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { + const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; + mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; + ip++; + ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, REPCODE1_TO_OFFBASE, mLength); + goto _match_stored; + } + + if (matchIndexL > prefixLowestIndex) { + /* check prefix long match */ + if (MEM_read64(matchLong) == MEM_read64(ip)) { + mLength = ZSTD_count(ip+8, matchLong+8, iend) + 8; + offset = (U32)(ip-matchLong); + while (((ip>anchor) & (matchLong>prefixLowest)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */ + goto _match_found; + } + } else if (dictTagsMatchL) { + /* check dictMatchState long match */ + U32 const dictMatchIndexL = dictMatchIndexAndTagL >> ZSTD_SHORT_CACHE_TAG_BITS; + const BYTE* dictMatchL = dictBase + dictMatchIndexL; + assert(dictMatchL < dictEnd); + + if (dictMatchL > dictStart && MEM_read64(dictMatchL) == MEM_read64(ip)) { + mLength = ZSTD_count_2segments(ip+8, dictMatchL+8, iend, dictEnd, prefixLowest) + 8; + offset = (U32)(curr - dictMatchIndexL - dictIndexDelta); + while (((ip>anchor) & (dictMatchL>dictStart)) && (ip[-1] == dictMatchL[-1])) { ip--; dictMatchL--; mLength++; } /* catch up */ + goto _match_found; + } } + + if (matchIndexS > prefixLowestIndex) { + /* check prefix short match */ + if (MEM_read32(match) == MEM_read32(ip)) { + goto _search_next_long; + } + } else if (dictTagsMatchS) { + /* check dictMatchState short match */ + U32 const dictMatchIndexS = dictMatchIndexAndTagS >> ZSTD_SHORT_CACHE_TAG_BITS; + match = dictBase + dictMatchIndexS; + matchIndexS = dictMatchIndexS + dictIndexDelta; + + if (match > dictStart && MEM_read32(match) == MEM_read32(ip)) { + goto _search_next_long; + } } + + ip += ((ip-anchor) >> kSearchStrength) + 1; +#if defined(__aarch64__) + PREFETCH_L1(ip+256); +#endif + continue; + +_search_next_long: + { size_t const hl3 = ZSTD_hashPtr(ip+1, hBitsL, 8); + size_t const dictHashAndTagL3 = ZSTD_hashPtr(ip+1, dictHBitsL, 8); + U32 const matchIndexL3 = hashLong[hl3]; + U32 const dictMatchIndexAndTagL3 = dictHashLong[dictHashAndTagL3 >> ZSTD_SHORT_CACHE_TAG_BITS]; + int const dictTagsMatchL3 = ZSTD_comparePackedTags(dictMatchIndexAndTagL3, dictHashAndTagL3); + const BYTE* matchL3 = base + matchIndexL3; + hashLong[hl3] = curr + 1; + + /* check prefix long +1 match */ + if (matchIndexL3 > prefixLowestIndex) { + if (MEM_read64(matchL3) == MEM_read64(ip+1)) { + mLength = ZSTD_count(ip+9, matchL3+8, iend) + 8; + ip++; + offset = (U32)(ip-matchL3); + while (((ip>anchor) & (matchL3>prefixLowest)) && (ip[-1] == matchL3[-1])) { ip--; matchL3--; mLength++; } /* catch up */ + goto _match_found; + } + } else if (dictTagsMatchL3) { + /* check dict long +1 match */ + U32 const dictMatchIndexL3 = dictMatchIndexAndTagL3 >> ZSTD_SHORT_CACHE_TAG_BITS; + const BYTE* dictMatchL3 = dictBase + dictMatchIndexL3; + assert(dictMatchL3 < dictEnd); + if (dictMatchL3 > dictStart && MEM_read64(dictMatchL3) == MEM_read64(ip+1)) { + mLength = ZSTD_count_2segments(ip+1+8, dictMatchL3+8, iend, dictEnd, prefixLowest) + 8; + ip++; + offset = (U32)(curr + 1 - dictMatchIndexL3 - dictIndexDelta); + while (((ip>anchor) & (dictMatchL3>dictStart)) && (ip[-1] == dictMatchL3[-1])) { ip--; dictMatchL3--; mLength++; } /* catch up */ + goto _match_found; } } } + + /* if no long +1 match, explore the short match we found */ + if (matchIndexS < prefixLowestIndex) { + mLength = ZSTD_count_2segments(ip+4, match+4, iend, dictEnd, prefixLowest) + 4; + offset = (U32)(curr - matchIndexS); + while (((ip>anchor) & (match>dictStart)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ + } else { + mLength = ZSTD_count(ip+4, match+4, iend) + 4; + offset = (U32)(ip - match); + while (((ip>anchor) & (match>prefixLowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ + } + +_match_found: + offset_2 = offset_1; + offset_1 = offset; + + ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, OFFSET_TO_OFFBASE(offset), mLength); + +_match_stored: + /* match found */ + ip += mLength; + anchor = ip; + + if (ip <= ilimit) { + /* Complementary insertion */ + /* done after iLimit test, as candidates could be > iend-8 */ + { U32 const indexToInsert = curr+2; + hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert; + hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base); + hashSmall[ZSTD_hashPtr(base+indexToInsert, hBitsS, mls)] = indexToInsert; + hashSmall[ZSTD_hashPtr(ip-1, hBitsS, mls)] = (U32)(ip-1-base); + } + + /* check immediate repcode */ + while (ip <= ilimit) { + U32 const current2 = (U32)(ip-base); + U32 const repIndex2 = current2 - offset_2; + const BYTE* repMatch2 = repIndex2 < prefixLowestIndex ? + dictBase + repIndex2 - dictIndexDelta : + base + repIndex2; + if ( ((U32)((prefixLowestIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */) + && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { + const BYTE* const repEnd2 = repIndex2 < prefixLowestIndex ? dictEnd : iend; + size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixLowest) + 4; + U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ + ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, repLength2); + hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = current2; + hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2; + ip += repLength2; + anchor = ip; + continue; + } + break; + } + } } /* while (ip < ilimit) */ /* save reps for next block */ - rep[0] = offset_1 ? offset_1 : offsetSaved; - rep[1] = offset_2 ? offset_2 : offsetSaved; + rep[0] = offset_1; + rep[1] = offset_2; /* Return the last literals size */ return (size_t)(iend - anchor); } +#define ZSTD_GEN_DFAST_FN(dictMode, mls) \ + static size_t ZSTD_compressBlock_doubleFast_##dictMode##_##mls( \ + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], \ + void const* src, size_t srcSize) \ + { \ + return ZSTD_compressBlock_doubleFast_##dictMode##_generic(ms, seqStore, rep, src, srcSize, mls); \ + } + +ZSTD_GEN_DFAST_FN(noDict, 4) +ZSTD_GEN_DFAST_FN(noDict, 5) +ZSTD_GEN_DFAST_FN(noDict, 6) +ZSTD_GEN_DFAST_FN(noDict, 7) + +ZSTD_GEN_DFAST_FN(dictMatchState, 4) +ZSTD_GEN_DFAST_FN(dictMatchState, 5) +ZSTD_GEN_DFAST_FN(dictMatchState, 6) +ZSTD_GEN_DFAST_FN(dictMatchState, 7) + size_t ZSTD_compressBlock_doubleFast( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], @@ -325,13 +558,13 @@ size_t ZSTD_compressBlock_doubleFast( { default: /* includes case 3 */ case 4 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 4, ZSTD_noDict); + return ZSTD_compressBlock_doubleFast_noDict_4(ms, seqStore, rep, src, srcSize); case 5 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 5, ZSTD_noDict); + return ZSTD_compressBlock_doubleFast_noDict_5(ms, seqStore, rep, src, srcSize); case 6 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 6, ZSTD_noDict); + return ZSTD_compressBlock_doubleFast_noDict_6(ms, seqStore, rep, src, srcSize); case 7 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 7, ZSTD_noDict); + return ZSTD_compressBlock_doubleFast_noDict_7(ms, seqStore, rep, src, srcSize); } } @@ -345,13 +578,13 @@ size_t ZSTD_compressBlock_doubleFast_dictMatchState( { default: /* includes case 3 */ case 4 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 4, ZSTD_dictMatchState); + return ZSTD_compressBlock_doubleFast_dictMatchState_4(ms, seqStore, rep, src, srcSize); case 5 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 5, ZSTD_dictMatchState); + return ZSTD_compressBlock_doubleFast_dictMatchState_5(ms, seqStore, rep, src, srcSize); case 6 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 6, ZSTD_dictMatchState); + return ZSTD_compressBlock_doubleFast_dictMatchState_6(ms, seqStore, rep, src, srcSize); case 7 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 7, ZSTD_dictMatchState); + return ZSTD_compressBlock_doubleFast_dictMatchState_7(ms, seqStore, rep, src, srcSize); } } @@ -387,7 +620,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic( /* if extDict is invalidated due to maxDistance, switch to "regular" variant */ if (prefixStartIndex == dictStartIndex) - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, mls, ZSTD_noDict); + return ZSTD_compressBlock_doubleFast(ms, seqStore, rep, src, srcSize); /* Search Loop */ while (ip < ilimit) { /* < instead of <=, because (ip+1) */ @@ -409,12 +642,12 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic( hashSmall[hSmall] = hashLong[hLong] = curr; /* update hash table */ if ((((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow : ensure repIndex doesn't overlap dict + prefix */ - & (offset_1 < curr+1 - dictStartIndex)) /* note: we are searching at curr+1 */ + & (offset_1 <= curr+1 - dictStartIndex)) /* note: we are searching at curr+1 */ && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { const BYTE* repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixStart) + 4; ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); + ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, REPCODE1_TO_OFFBASE, mLength); } else { if ((matchLongIndex > dictStartIndex) && (MEM_read64(matchLong) == MEM_read64(ip))) { const BYTE* const matchEnd = matchLongIndex < prefixStartIndex ? dictEnd : iend; @@ -425,7 +658,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic( while (((ip>anchor) & (matchLong>lowMatchPtr)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */ offset_2 = offset_1; offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); + ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, OFFSET_TO_OFFBASE(offset), mLength); } else if ((matchIndex > dictStartIndex) && (MEM_read32(match) == MEM_read32(ip))) { size_t const h3 = ZSTD_hashPtr(ip+1, hBitsL, 8); @@ -450,7 +683,7 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic( } offset_2 = offset_1; offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); + ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, OFFSET_TO_OFFBASE(offset), mLength); } else { ip += ((ip-anchor) >> kSearchStrength) + 1; @@ -477,12 +710,12 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic( U32 const repIndex2 = current2 - offset_2; const BYTE* repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2; if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) /* intentional overflow : ensure repIndex2 doesn't overlap dict + prefix */ - & (offset_2 < current2 - dictStartIndex)) + & (offset_2 <= current2 - dictStartIndex)) && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; U32 const tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, repLength2-MINMATCH); + ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, repLength2); hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = current2; hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2; ip += repLength2; @@ -500,6 +733,10 @@ static size_t ZSTD_compressBlock_doubleFast_extDict_generic( return (size_t)(iend - anchor); } +ZSTD_GEN_DFAST_FN(extDict, 4) +ZSTD_GEN_DFAST_FN(extDict, 5) +ZSTD_GEN_DFAST_FN(extDict, 6) +ZSTD_GEN_DFAST_FN(extDict, 7) size_t ZSTD_compressBlock_doubleFast_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], @@ -510,12 +747,12 @@ size_t ZSTD_compressBlock_doubleFast_extDict( { default: /* includes case 3 */ case 4 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 4); + return ZSTD_compressBlock_doubleFast_extDict_4(ms, seqStore, rep, src, srcSize); case 5 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 5); + return ZSTD_compressBlock_doubleFast_extDict_5(ms, seqStore, rep, src, srcSize); case 6 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 6); + return ZSTD_compressBlock_doubleFast_extDict_6(ms, seqStore, rep, src, srcSize); case 7 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 7); + return ZSTD_compressBlock_doubleFast_extDict_7(ms, seqStore, rep, src, srcSize); } } diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_double_fast.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_double_fast.h similarity index 90% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_double_fast.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_double_fast.h index e16b7b0..6f0047c 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_double_fast.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_double_fast.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -19,7 +19,8 @@ extern "C" { #include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */ void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, - void const* end, ZSTD_dictTableLoadMethod_e dtlm); + void const* end, ZSTD_dictTableLoadMethod_e dtlm, + ZSTD_tableFillPurpose_e tfp); size_t ZSTD_compressBlock_doubleFast( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); diff --git a/src/dependencies/zstd-1.5.4/lib/compress/zstd_fast.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_fast.c new file mode 100644 index 0000000..5f2c6a2 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_fast.c @@ -0,0 +1,960 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#include "zstd_compress_internal.h" /* ZSTD_hashPtr, ZSTD_count, ZSTD_storeSeq */ +#include "zstd_fast.h" + +static void ZSTD_fillHashTableForCDict(ZSTD_matchState_t* ms, + const void* const end, + ZSTD_dictTableLoadMethod_e dtlm) +{ + const ZSTD_compressionParameters* const cParams = &ms->cParams; + U32* const hashTable = ms->hashTable; + U32 const hBits = cParams->hashLog + ZSTD_SHORT_CACHE_TAG_BITS; + U32 const mls = cParams->minMatch; + const BYTE* const base = ms->window.base; + const BYTE* ip = base + ms->nextToUpdate; + const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE; + const U32 fastHashFillStep = 3; + + /* Currently, we always use ZSTD_dtlm_full for filling CDict tables. + * Feel free to remove this assert if there's a good reason! */ + assert(dtlm == ZSTD_dtlm_full); + + /* Always insert every fastHashFillStep position into the hash table. + * Insert the other positions if their hash entry is empty. + */ + for ( ; ip + fastHashFillStep < iend + 2; ip += fastHashFillStep) { + U32 const curr = (U32)(ip - base); + { size_t const hashAndTag = ZSTD_hashPtr(ip, hBits, mls); + ZSTD_writeTaggedIndex(hashTable, hashAndTag, curr); } + + if (dtlm == ZSTD_dtlm_fast) continue; + /* Only load extra positions for ZSTD_dtlm_full */ + { U32 p; + for (p = 1; p < fastHashFillStep; ++p) { + size_t const hashAndTag = ZSTD_hashPtr(ip + p, hBits, mls); + if (hashTable[hashAndTag >> ZSTD_SHORT_CACHE_TAG_BITS] == 0) { /* not yet filled */ + ZSTD_writeTaggedIndex(hashTable, hashAndTag, curr + p); + } } } } +} + +static void ZSTD_fillHashTableForCCtx(ZSTD_matchState_t* ms, + const void* const end, + ZSTD_dictTableLoadMethod_e dtlm) +{ + const ZSTD_compressionParameters* const cParams = &ms->cParams; + U32* const hashTable = ms->hashTable; + U32 const hBits = cParams->hashLog; + U32 const mls = cParams->minMatch; + const BYTE* const base = ms->window.base; + const BYTE* ip = base + ms->nextToUpdate; + const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE; + const U32 fastHashFillStep = 3; + + /* Currently, we always use ZSTD_dtlm_fast for filling CCtx tables. + * Feel free to remove this assert if there's a good reason! */ + assert(dtlm == ZSTD_dtlm_fast); + + /* Always insert every fastHashFillStep position into the hash table. + * Insert the other positions if their hash entry is empty. + */ + for ( ; ip + fastHashFillStep < iend + 2; ip += fastHashFillStep) { + U32 const curr = (U32)(ip - base); + size_t const hash0 = ZSTD_hashPtr(ip, hBits, mls); + hashTable[hash0] = curr; + if (dtlm == ZSTD_dtlm_fast) continue; + /* Only load extra positions for ZSTD_dtlm_full */ + { U32 p; + for (p = 1; p < fastHashFillStep; ++p) { + size_t const hash = ZSTD_hashPtr(ip + p, hBits, mls); + if (hashTable[hash] == 0) { /* not yet filled */ + hashTable[hash] = curr + p; + } } } } +} + +void ZSTD_fillHashTable(ZSTD_matchState_t* ms, + const void* const end, + ZSTD_dictTableLoadMethod_e dtlm, + ZSTD_tableFillPurpose_e tfp) +{ + if (tfp == ZSTD_tfp_forCDict) { + ZSTD_fillHashTableForCDict(ms, end, dtlm); + } else { + ZSTD_fillHashTableForCCtx(ms, end, dtlm); + } +} + + +/** + * If you squint hard enough (and ignore repcodes), the search operation at any + * given position is broken into 4 stages: + * + * 1. Hash (map position to hash value via input read) + * 2. Lookup (map hash val to index via hashtable read) + * 3. Load (map index to value at that position via input read) + * 4. Compare + * + * Each of these steps involves a memory read at an address which is computed + * from the previous step. This means these steps must be sequenced and their + * latencies are cumulative. + * + * Rather than do 1->2->3->4 sequentially for a single position before moving + * onto the next, this implementation interleaves these operations across the + * next few positions: + * + * R = Repcode Read & Compare + * H = Hash + * T = Table Lookup + * M = Match Read & Compare + * + * Pos | Time --> + * ----+------------------- + * N | ... M + * N+1 | ... TM + * N+2 | R H T M + * N+3 | H TM + * N+4 | R H T M + * N+5 | H ... + * N+6 | R ... + * + * This is very much analogous to the pipelining of execution in a CPU. And just + * like a CPU, we have to dump the pipeline when we find a match (i.e., take a + * branch). + * + * When this happens, we throw away our current state, and do the following prep + * to re-enter the loop: + * + * Pos | Time --> + * ----+------------------- + * N | H T + * N+1 | H + * + * This is also the work we do at the beginning to enter the loop initially. + */ +FORCE_INLINE_TEMPLATE size_t +ZSTD_compressBlock_fast_noDict_generic( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize, + U32 const mls, U32 const hasStep) +{ + const ZSTD_compressionParameters* const cParams = &ms->cParams; + U32* const hashTable = ms->hashTable; + U32 const hlog = cParams->hashLog; + /* support stepSize of 0 */ + size_t const stepSize = hasStep ? (cParams->targetLength + !(cParams->targetLength) + 1) : 2; + const BYTE* const base = ms->window.base; + const BYTE* const istart = (const BYTE*)src; + const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); + const U32 prefixStartIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog); + const BYTE* const prefixStart = base + prefixStartIndex; + const BYTE* const iend = istart + srcSize; + const BYTE* const ilimit = iend - HASH_READ_SIZE; + + const BYTE* anchor = istart; + const BYTE* ip0 = istart; + const BYTE* ip1; + const BYTE* ip2; + const BYTE* ip3; + U32 current0; + + U32 rep_offset1 = rep[0]; + U32 rep_offset2 = rep[1]; + U32 offsetSaved1 = 0, offsetSaved2 = 0; + + size_t hash0; /* hash for ip0 */ + size_t hash1; /* hash for ip1 */ + U32 idx; /* match idx for ip0 */ + U32 mval; /* src value at match idx */ + + U32 offcode; + const BYTE* match0; + size_t mLength; + + /* ip0 and ip1 are always adjacent. The targetLength skipping and + * uncompressibility acceleration is applied to every other position, + * matching the behavior of #1562. step therefore represents the gap + * between pairs of positions, from ip0 to ip2 or ip1 to ip3. */ + size_t step; + const BYTE* nextStep; + const size_t kStepIncr = (1 << (kSearchStrength - 1)); + + DEBUGLOG(5, "ZSTD_compressBlock_fast_generic"); + ip0 += (ip0 == prefixStart); + { U32 const curr = (U32)(ip0 - base); + U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, cParams->windowLog); + U32 const maxRep = curr - windowLow; + if (rep_offset2 > maxRep) offsetSaved2 = rep_offset2, rep_offset2 = 0; + if (rep_offset1 > maxRep) offsetSaved1 = rep_offset1, rep_offset1 = 0; + } + + /* start each op */ +_start: /* Requires: ip0 */ + + step = stepSize; + nextStep = ip0 + kStepIncr; + + /* calculate positions, ip0 - anchor == 0, so we skip step calc */ + ip1 = ip0 + 1; + ip2 = ip0 + step; + ip3 = ip2 + 1; + + if (ip3 >= ilimit) { + goto _cleanup; + } + + hash0 = ZSTD_hashPtr(ip0, hlog, mls); + hash1 = ZSTD_hashPtr(ip1, hlog, mls); + + idx = hashTable[hash0]; + + do { + /* load repcode match for ip[2]*/ + const U32 rval = MEM_read32(ip2 - rep_offset1); + + /* write back hash table entry */ + current0 = (U32)(ip0 - base); + hashTable[hash0] = current0; + + /* check repcode at ip[2] */ + if ((MEM_read32(ip2) == rval) & (rep_offset1 > 0)) { + ip0 = ip2; + match0 = ip0 - rep_offset1; + mLength = ip0[-1] == match0[-1]; + ip0 -= mLength; + match0 -= mLength; + offcode = REPCODE1_TO_OFFBASE; + mLength += 4; + + /* First write next hash table entry; we've already calculated it. + * This write is known to be safe because the ip1 is before the + * repcode (ip2). */ + hashTable[hash1] = (U32)(ip1 - base); + + goto _match; + } + + /* load match for ip[0] */ + if (idx >= prefixStartIndex) { + mval = MEM_read32(base + idx); + } else { + mval = MEM_read32(ip0) ^ 1; /* guaranteed to not match. */ + } + + /* check match at ip[0] */ + if (MEM_read32(ip0) == mval) { + /* found a match! */ + + /* First write next hash table entry; we've already calculated it. + * This write is known to be safe because the ip1 == ip0 + 1, so + * we know we will resume searching after ip1 */ + hashTable[hash1] = (U32)(ip1 - base); + + goto _offset; + } + + /* lookup ip[1] */ + idx = hashTable[hash1]; + + /* hash ip[2] */ + hash0 = hash1; + hash1 = ZSTD_hashPtr(ip2, hlog, mls); + + /* advance to next positions */ + ip0 = ip1; + ip1 = ip2; + ip2 = ip3; + + /* write back hash table entry */ + current0 = (U32)(ip0 - base); + hashTable[hash0] = current0; + + /* load match for ip[0] */ + if (idx >= prefixStartIndex) { + mval = MEM_read32(base + idx); + } else { + mval = MEM_read32(ip0) ^ 1; /* guaranteed to not match. */ + } + + /* check match at ip[0] */ + if (MEM_read32(ip0) == mval) { + /* found a match! */ + + /* first write next hash table entry; we've already calculated it */ + if (step <= 4) { + /* We need to avoid writing an index into the hash table >= the + * position at which we will pick up our searching after we've + * taken this match. + * + * The minimum possible match has length 4, so the earliest ip0 + * can be after we take this match will be the current ip0 + 4. + * ip1 is ip0 + step - 1. If ip1 is >= ip0 + 4, we can't safely + * write this position. + */ + hashTable[hash1] = (U32)(ip1 - base); + } + + goto _offset; + } + + /* lookup ip[1] */ + idx = hashTable[hash1]; + + /* hash ip[2] */ + hash0 = hash1; + hash1 = ZSTD_hashPtr(ip2, hlog, mls); + + /* advance to next positions */ + ip0 = ip1; + ip1 = ip2; + ip2 = ip0 + step; + ip3 = ip1 + step; + + /* calculate step */ + if (ip2 >= nextStep) { + step++; + PREFETCH_L1(ip1 + 64); + PREFETCH_L1(ip1 + 128); + nextStep += kStepIncr; + } + } while (ip3 < ilimit); + +_cleanup: + /* Note that there are probably still a couple positions we could search. + * However, it seems to be a meaningful performance hit to try to search + * them. So let's not. */ + + /* When the repcodes are outside of the prefix, we set them to zero before the loop. + * When the offsets are still zero, we need to restore them after the block to have a correct + * repcode history. If only one offset was invalid, it is easy. The tricky case is when both + * offsets were invalid. We need to figure out which offset to refill with. + * - If both offsets are zero they are in the same order. + * - If both offsets are non-zero, we won't restore the offsets from `offsetSaved[12]`. + * - If only one is zero, we need to decide which offset to restore. + * - If rep_offset1 is non-zero, then rep_offset2 must be offsetSaved1. + * - It is impossible for rep_offset2 to be non-zero. + * + * So if rep_offset1 started invalid (offsetSaved1 != 0) and became valid (rep_offset1 != 0), then + * set rep[0] = rep_offset1 and rep[1] = offsetSaved1. + */ + offsetSaved2 = ((offsetSaved1 != 0) && (rep_offset1 != 0)) ? offsetSaved1 : offsetSaved2; + + /* save reps for next block */ + rep[0] = rep_offset1 ? rep_offset1 : offsetSaved1; + rep[1] = rep_offset2 ? rep_offset2 : offsetSaved2; + + /* Return the last literals size */ + return (size_t)(iend - anchor); + +_offset: /* Requires: ip0, idx */ + + /* Compute the offset code. */ + match0 = base + idx; + rep_offset2 = rep_offset1; + rep_offset1 = (U32)(ip0-match0); + offcode = OFFSET_TO_OFFBASE(rep_offset1); + mLength = 4; + + /* Count the backwards match length. */ + while (((ip0>anchor) & (match0>prefixStart)) && (ip0[-1] == match0[-1])) { + ip0--; + match0--; + mLength++; + } + +_match: /* Requires: ip0, match0, offcode */ + + /* Count the forward length. */ + mLength += ZSTD_count(ip0 + mLength, match0 + mLength, iend); + + ZSTD_storeSeq(seqStore, (size_t)(ip0 - anchor), anchor, iend, offcode, mLength); + + ip0 += mLength; + anchor = ip0; + + /* Fill table and check for immediate repcode. */ + if (ip0 <= ilimit) { + /* Fill Table */ + assert(base+current0+2 > istart); /* check base overflow */ + hashTable[ZSTD_hashPtr(base+current0+2, hlog, mls)] = current0+2; /* here because current+2 could be > iend-8 */ + hashTable[ZSTD_hashPtr(ip0-2, hlog, mls)] = (U32)(ip0-2-base); + + if (rep_offset2 > 0) { /* rep_offset2==0 means rep_offset2 is invalidated */ + while ( (ip0 <= ilimit) && (MEM_read32(ip0) == MEM_read32(ip0 - rep_offset2)) ) { + /* store sequence */ + size_t const rLength = ZSTD_count(ip0+4, ip0+4-rep_offset2, iend) + 4; + { U32 const tmpOff = rep_offset2; rep_offset2 = rep_offset1; rep_offset1 = tmpOff; } /* swap rep_offset2 <=> rep_offset1 */ + hashTable[ZSTD_hashPtr(ip0, hlog, mls)] = (U32)(ip0-base); + ip0 += rLength; + ZSTD_storeSeq(seqStore, 0 /*litLen*/, anchor, iend, REPCODE1_TO_OFFBASE, rLength); + anchor = ip0; + continue; /* faster when present (confirmed on gcc-8) ... (?) */ + } } } + + goto _start; +} + +#define ZSTD_GEN_FAST_FN(dictMode, mls, step) \ + static size_t ZSTD_compressBlock_fast_##dictMode##_##mls##_##step( \ + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], \ + void const* src, size_t srcSize) \ + { \ + return ZSTD_compressBlock_fast_##dictMode##_generic(ms, seqStore, rep, src, srcSize, mls, step); \ + } + +ZSTD_GEN_FAST_FN(noDict, 4, 1) +ZSTD_GEN_FAST_FN(noDict, 5, 1) +ZSTD_GEN_FAST_FN(noDict, 6, 1) +ZSTD_GEN_FAST_FN(noDict, 7, 1) + +ZSTD_GEN_FAST_FN(noDict, 4, 0) +ZSTD_GEN_FAST_FN(noDict, 5, 0) +ZSTD_GEN_FAST_FN(noDict, 6, 0) +ZSTD_GEN_FAST_FN(noDict, 7, 0) + +size_t ZSTD_compressBlock_fast( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + U32 const mls = ms->cParams.minMatch; + assert(ms->dictMatchState == NULL); + if (ms->cParams.targetLength > 1) { + switch(mls) + { + default: /* includes case 3 */ + case 4 : + return ZSTD_compressBlock_fast_noDict_4_1(ms, seqStore, rep, src, srcSize); + case 5 : + return ZSTD_compressBlock_fast_noDict_5_1(ms, seqStore, rep, src, srcSize); + case 6 : + return ZSTD_compressBlock_fast_noDict_6_1(ms, seqStore, rep, src, srcSize); + case 7 : + return ZSTD_compressBlock_fast_noDict_7_1(ms, seqStore, rep, src, srcSize); + } + } else { + switch(mls) + { + default: /* includes case 3 */ + case 4 : + return ZSTD_compressBlock_fast_noDict_4_0(ms, seqStore, rep, src, srcSize); + case 5 : + return ZSTD_compressBlock_fast_noDict_5_0(ms, seqStore, rep, src, srcSize); + case 6 : + return ZSTD_compressBlock_fast_noDict_6_0(ms, seqStore, rep, src, srcSize); + case 7 : + return ZSTD_compressBlock_fast_noDict_7_0(ms, seqStore, rep, src, srcSize); + } + + } +} + +FORCE_INLINE_TEMPLATE +size_t ZSTD_compressBlock_fast_dictMatchState_generic( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize, U32 const mls, U32 const hasStep) +{ + const ZSTD_compressionParameters* const cParams = &ms->cParams; + U32* const hashTable = ms->hashTable; + U32 const hlog = cParams->hashLog; + /* support stepSize of 0 */ + U32 const stepSize = cParams->targetLength + !(cParams->targetLength); + const BYTE* const base = ms->window.base; + const BYTE* const istart = (const BYTE*)src; + const BYTE* ip0 = istart; + const BYTE* ip1 = ip0 + stepSize; /* we assert below that stepSize >= 1 */ + const BYTE* anchor = istart; + const U32 prefixStartIndex = ms->window.dictLimit; + const BYTE* const prefixStart = base + prefixStartIndex; + const BYTE* const iend = istart + srcSize; + const BYTE* const ilimit = iend - HASH_READ_SIZE; + U32 offset_1=rep[0], offset_2=rep[1]; + + const ZSTD_matchState_t* const dms = ms->dictMatchState; + const ZSTD_compressionParameters* const dictCParams = &dms->cParams ; + const U32* const dictHashTable = dms->hashTable; + const U32 dictStartIndex = dms->window.dictLimit; + const BYTE* const dictBase = dms->window.base; + const BYTE* const dictStart = dictBase + dictStartIndex; + const BYTE* const dictEnd = dms->window.nextSrc; + const U32 dictIndexDelta = prefixStartIndex - (U32)(dictEnd - dictBase); + const U32 dictAndPrefixLength = (U32)(istart - prefixStart + dictEnd - dictStart); + const U32 dictHBits = dictCParams->hashLog + ZSTD_SHORT_CACHE_TAG_BITS; + + /* if a dictionary is still attached, it necessarily means that + * it is within window size. So we just check it. */ + const U32 maxDistance = 1U << cParams->windowLog; + const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); + assert(endIndex - prefixStartIndex <= maxDistance); + (void)maxDistance; (void)endIndex; /* these variables are not used when assert() is disabled */ + + (void)hasStep; /* not currently specialized on whether it's accelerated */ + + /* ensure there will be no underflow + * when translating a dict index into a local index */ + assert(prefixStartIndex >= (U32)(dictEnd - dictBase)); + + if (ms->prefetchCDictTables) { + size_t const hashTableBytes = (((size_t)1) << dictCParams->hashLog) * sizeof(U32); + PREFETCH_AREA(dictHashTable, hashTableBytes) + } + + /* init */ + DEBUGLOG(5, "ZSTD_compressBlock_fast_dictMatchState_generic"); + ip0 += (dictAndPrefixLength == 0); + /* dictMatchState repCode checks don't currently handle repCode == 0 + * disabling. */ + assert(offset_1 <= dictAndPrefixLength); + assert(offset_2 <= dictAndPrefixLength); + + /* Outer search loop */ + assert(stepSize >= 1); + while (ip1 <= ilimit) { /* repcode check at (ip0 + 1) is safe because ip0 < ip1 */ + size_t mLength; + size_t hash0 = ZSTD_hashPtr(ip0, hlog, mls); + + size_t const dictHashAndTag0 = ZSTD_hashPtr(ip0, dictHBits, mls); + U32 dictMatchIndexAndTag = dictHashTable[dictHashAndTag0 >> ZSTD_SHORT_CACHE_TAG_BITS]; + int dictTagsMatch = ZSTD_comparePackedTags(dictMatchIndexAndTag, dictHashAndTag0); + + U32 matchIndex = hashTable[hash0]; + U32 curr = (U32)(ip0 - base); + size_t step = stepSize; + const size_t kStepIncr = 1 << kSearchStrength; + const BYTE* nextStep = ip0 + kStepIncr; + + /* Inner search loop */ + while (1) { + const BYTE* match = base + matchIndex; + const U32 repIndex = curr + 1 - offset_1; + const BYTE* repMatch = (repIndex < prefixStartIndex) ? + dictBase + (repIndex - dictIndexDelta) : + base + repIndex; + const size_t hash1 = ZSTD_hashPtr(ip1, hlog, mls); + size_t const dictHashAndTag1 = ZSTD_hashPtr(ip1, dictHBits, mls); + hashTable[hash0] = curr; /* update hash table */ + + if (((U32) ((prefixStartIndex - 1) - repIndex) >= + 3) /* intentional underflow : ensure repIndex isn't overlapping dict + prefix */ + && (MEM_read32(repMatch) == MEM_read32(ip0 + 1))) { + const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; + mLength = ZSTD_count_2segments(ip0 + 1 + 4, repMatch + 4, iend, repMatchEnd, prefixStart) + 4; + ip0++; + ZSTD_storeSeq(seqStore, (size_t) (ip0 - anchor), anchor, iend, REPCODE1_TO_OFFBASE, mLength); + break; + } + + if (dictTagsMatch) { + /* Found a possible dict match */ + const U32 dictMatchIndex = dictMatchIndexAndTag >> ZSTD_SHORT_CACHE_TAG_BITS; + const BYTE* dictMatch = dictBase + dictMatchIndex; + if (dictMatchIndex > dictStartIndex && + MEM_read32(dictMatch) == MEM_read32(ip0)) { + /* To replicate extDict parse behavior, we only use dict matches when the normal matchIndex is invalid */ + if (matchIndex <= prefixStartIndex) { + U32 const offset = (U32) (curr - dictMatchIndex - dictIndexDelta); + mLength = ZSTD_count_2segments(ip0 + 4, dictMatch + 4, iend, dictEnd, prefixStart) + 4; + while (((ip0 > anchor) & (dictMatch > dictStart)) + && (ip0[-1] == dictMatch[-1])) { + ip0--; + dictMatch--; + mLength++; + } /* catch up */ + offset_2 = offset_1; + offset_1 = offset; + ZSTD_storeSeq(seqStore, (size_t) (ip0 - anchor), anchor, iend, OFFSET_TO_OFFBASE(offset), mLength); + break; + } + } + } + + if (matchIndex > prefixStartIndex && MEM_read32(match) == MEM_read32(ip0)) { + /* found a regular match */ + U32 const offset = (U32) (ip0 - match); + mLength = ZSTD_count(ip0 + 4, match + 4, iend) + 4; + while (((ip0 > anchor) & (match > prefixStart)) + && (ip0[-1] == match[-1])) { + ip0--; + match--; + mLength++; + } /* catch up */ + offset_2 = offset_1; + offset_1 = offset; + ZSTD_storeSeq(seqStore, (size_t) (ip0 - anchor), anchor, iend, OFFSET_TO_OFFBASE(offset), mLength); + break; + } + + /* Prepare for next iteration */ + dictMatchIndexAndTag = dictHashTable[dictHashAndTag1 >> ZSTD_SHORT_CACHE_TAG_BITS]; + dictTagsMatch = ZSTD_comparePackedTags(dictMatchIndexAndTag, dictHashAndTag1); + matchIndex = hashTable[hash1]; + + if (ip1 >= nextStep) { + step++; + nextStep += kStepIncr; + } + ip0 = ip1; + ip1 = ip1 + step; + if (ip1 > ilimit) goto _cleanup; + + curr = (U32)(ip0 - base); + hash0 = hash1; + } /* end inner search loop */ + + /* match found */ + assert(mLength); + ip0 += mLength; + anchor = ip0; + + if (ip0 <= ilimit) { + /* Fill Table */ + assert(base+curr+2 > istart); /* check base overflow */ + hashTable[ZSTD_hashPtr(base+curr+2, hlog, mls)] = curr+2; /* here because curr+2 could be > iend-8 */ + hashTable[ZSTD_hashPtr(ip0-2, hlog, mls)] = (U32)(ip0-2-base); + + /* check immediate repcode */ + while (ip0 <= ilimit) { + U32 const current2 = (U32)(ip0-base); + U32 const repIndex2 = current2 - offset_2; + const BYTE* repMatch2 = repIndex2 < prefixStartIndex ? + dictBase - dictIndexDelta + repIndex2 : + base + repIndex2; + if ( ((U32)((prefixStartIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */) + && (MEM_read32(repMatch2) == MEM_read32(ip0))) { + const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; + size_t const repLength2 = ZSTD_count_2segments(ip0+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; + U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ + ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, repLength2); + hashTable[ZSTD_hashPtr(ip0, hlog, mls)] = current2; + ip0 += repLength2; + anchor = ip0; + continue; + } + break; + } + } + + /* Prepare for next iteration */ + assert(ip0 == anchor); + ip1 = ip0 + stepSize; + } + +_cleanup: + /* save reps for next block */ + rep[0] = offset_1; + rep[1] = offset_2; + + /* Return the last literals size */ + return (size_t)(iend - anchor); +} + + +ZSTD_GEN_FAST_FN(dictMatchState, 4, 0) +ZSTD_GEN_FAST_FN(dictMatchState, 5, 0) +ZSTD_GEN_FAST_FN(dictMatchState, 6, 0) +ZSTD_GEN_FAST_FN(dictMatchState, 7, 0) + +size_t ZSTD_compressBlock_fast_dictMatchState( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + U32 const mls = ms->cParams.minMatch; + assert(ms->dictMatchState != NULL); + switch(mls) + { + default: /* includes case 3 */ + case 4 : + return ZSTD_compressBlock_fast_dictMatchState_4_0(ms, seqStore, rep, src, srcSize); + case 5 : + return ZSTD_compressBlock_fast_dictMatchState_5_0(ms, seqStore, rep, src, srcSize); + case 6 : + return ZSTD_compressBlock_fast_dictMatchState_6_0(ms, seqStore, rep, src, srcSize); + case 7 : + return ZSTD_compressBlock_fast_dictMatchState_7_0(ms, seqStore, rep, src, srcSize); + } +} + + +static size_t ZSTD_compressBlock_fast_extDict_generic( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize, U32 const mls, U32 const hasStep) +{ + const ZSTD_compressionParameters* const cParams = &ms->cParams; + U32* const hashTable = ms->hashTable; + U32 const hlog = cParams->hashLog; + /* support stepSize of 0 */ + size_t const stepSize = cParams->targetLength + !(cParams->targetLength) + 1; + const BYTE* const base = ms->window.base; + const BYTE* const dictBase = ms->window.dictBase; + const BYTE* const istart = (const BYTE*)src; + const BYTE* anchor = istart; + const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); + const U32 lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog); + const U32 dictStartIndex = lowLimit; + const BYTE* const dictStart = dictBase + dictStartIndex; + const U32 dictLimit = ms->window.dictLimit; + const U32 prefixStartIndex = dictLimit < lowLimit ? lowLimit : dictLimit; + const BYTE* const prefixStart = base + prefixStartIndex; + const BYTE* const dictEnd = dictBase + prefixStartIndex; + const BYTE* const iend = istart + srcSize; + const BYTE* const ilimit = iend - 8; + U32 offset_1=rep[0], offset_2=rep[1]; + U32 offsetSaved1 = 0, offsetSaved2 = 0; + + const BYTE* ip0 = istart; + const BYTE* ip1; + const BYTE* ip2; + const BYTE* ip3; + U32 current0; + + + size_t hash0; /* hash for ip0 */ + size_t hash1; /* hash for ip1 */ + U32 idx; /* match idx for ip0 */ + const BYTE* idxBase; /* base pointer for idx */ + + U32 offcode; + const BYTE* match0; + size_t mLength; + const BYTE* matchEnd = 0; /* initialize to avoid warning, assert != 0 later */ + + size_t step; + const BYTE* nextStep; + const size_t kStepIncr = (1 << (kSearchStrength - 1)); + + (void)hasStep; /* not currently specialized on whether it's accelerated */ + + DEBUGLOG(5, "ZSTD_compressBlock_fast_extDict_generic (offset_1=%u)", offset_1); + + /* switch to "regular" variant if extDict is invalidated due to maxDistance */ + if (prefixStartIndex == dictStartIndex) + return ZSTD_compressBlock_fast(ms, seqStore, rep, src, srcSize); + + { U32 const curr = (U32)(ip0 - base); + U32 const maxRep = curr - dictStartIndex; + if (offset_2 >= maxRep) offsetSaved2 = offset_2, offset_2 = 0; + if (offset_1 >= maxRep) offsetSaved1 = offset_1, offset_1 = 0; + } + + /* start each op */ +_start: /* Requires: ip0 */ + + step = stepSize; + nextStep = ip0 + kStepIncr; + + /* calculate positions, ip0 - anchor == 0, so we skip step calc */ + ip1 = ip0 + 1; + ip2 = ip0 + step; + ip3 = ip2 + 1; + + if (ip3 >= ilimit) { + goto _cleanup; + } + + hash0 = ZSTD_hashPtr(ip0, hlog, mls); + hash1 = ZSTD_hashPtr(ip1, hlog, mls); + + idx = hashTable[hash0]; + idxBase = idx < prefixStartIndex ? dictBase : base; + + do { + { /* load repcode match for ip[2] */ + U32 const current2 = (U32)(ip2 - base); + U32 const repIndex = current2 - offset_1; + const BYTE* const repBase = repIndex < prefixStartIndex ? dictBase : base; + U32 rval; + if ( ((U32)(prefixStartIndex - repIndex) >= 4) /* intentional underflow */ + & (offset_1 > 0) ) { + rval = MEM_read32(repBase + repIndex); + } else { + rval = MEM_read32(ip2) ^ 1; /* guaranteed to not match. */ + } + + /* write back hash table entry */ + current0 = (U32)(ip0 - base); + hashTable[hash0] = current0; + + /* check repcode at ip[2] */ + if (MEM_read32(ip2) == rval) { + ip0 = ip2; + match0 = repBase + repIndex; + matchEnd = repIndex < prefixStartIndex ? dictEnd : iend; + assert((match0 != prefixStart) & (match0 != dictStart)); + mLength = ip0[-1] == match0[-1]; + ip0 -= mLength; + match0 -= mLength; + offcode = REPCODE1_TO_OFFBASE; + mLength += 4; + goto _match; + } } + + { /* load match for ip[0] */ + U32 const mval = idx >= dictStartIndex ? + MEM_read32(idxBase + idx) : + MEM_read32(ip0) ^ 1; /* guaranteed not to match */ + + /* check match at ip[0] */ + if (MEM_read32(ip0) == mval) { + /* found a match! */ + goto _offset; + } } + + /* lookup ip[1] */ + idx = hashTable[hash1]; + idxBase = idx < prefixStartIndex ? dictBase : base; + + /* hash ip[2] */ + hash0 = hash1; + hash1 = ZSTD_hashPtr(ip2, hlog, mls); + + /* advance to next positions */ + ip0 = ip1; + ip1 = ip2; + ip2 = ip3; + + /* write back hash table entry */ + current0 = (U32)(ip0 - base); + hashTable[hash0] = current0; + + { /* load match for ip[0] */ + U32 const mval = idx >= dictStartIndex ? + MEM_read32(idxBase + idx) : + MEM_read32(ip0) ^ 1; /* guaranteed not to match */ + + /* check match at ip[0] */ + if (MEM_read32(ip0) == mval) { + /* found a match! */ + goto _offset; + } } + + /* lookup ip[1] */ + idx = hashTable[hash1]; + idxBase = idx < prefixStartIndex ? dictBase : base; + + /* hash ip[2] */ + hash0 = hash1; + hash1 = ZSTD_hashPtr(ip2, hlog, mls); + + /* advance to next positions */ + ip0 = ip1; + ip1 = ip2; + ip2 = ip0 + step; + ip3 = ip1 + step; + + /* calculate step */ + if (ip2 >= nextStep) { + step++; + PREFETCH_L1(ip1 + 64); + PREFETCH_L1(ip1 + 128); + nextStep += kStepIncr; + } + } while (ip3 < ilimit); + +_cleanup: + /* Note that there are probably still a couple positions we could search. + * However, it seems to be a meaningful performance hit to try to search + * them. So let's not. */ + + /* If offset_1 started invalid (offsetSaved1 != 0) and became valid (offset_1 != 0), + * rotate saved offsets. See comment in ZSTD_compressBlock_fast_noDict for more context. */ + offsetSaved2 = ((offsetSaved1 != 0) && (offset_1 != 0)) ? offsetSaved1 : offsetSaved2; + + /* save reps for next block */ + rep[0] = offset_1 ? offset_1 : offsetSaved1; + rep[1] = offset_2 ? offset_2 : offsetSaved2; + + /* Return the last literals size */ + return (size_t)(iend - anchor); + +_offset: /* Requires: ip0, idx, idxBase */ + + /* Compute the offset code. */ + { U32 const offset = current0 - idx; + const BYTE* const lowMatchPtr = idx < prefixStartIndex ? dictStart : prefixStart; + matchEnd = idx < prefixStartIndex ? dictEnd : iend; + match0 = idxBase + idx; + offset_2 = offset_1; + offset_1 = offset; + offcode = OFFSET_TO_OFFBASE(offset); + mLength = 4; + + /* Count the backwards match length. */ + while (((ip0>anchor) & (match0>lowMatchPtr)) && (ip0[-1] == match0[-1])) { + ip0--; + match0--; + mLength++; + } } + +_match: /* Requires: ip0, match0, offcode, matchEnd */ + + /* Count the forward length. */ + assert(matchEnd != 0); + mLength += ZSTD_count_2segments(ip0 + mLength, match0 + mLength, iend, matchEnd, prefixStart); + + ZSTD_storeSeq(seqStore, (size_t)(ip0 - anchor), anchor, iend, offcode, mLength); + + ip0 += mLength; + anchor = ip0; + + /* write next hash table entry */ + if (ip1 < ip0) { + hashTable[hash1] = (U32)(ip1 - base); + } + + /* Fill table and check for immediate repcode. */ + if (ip0 <= ilimit) { + /* Fill Table */ + assert(base+current0+2 > istart); /* check base overflow */ + hashTable[ZSTD_hashPtr(base+current0+2, hlog, mls)] = current0+2; /* here because current+2 could be > iend-8 */ + hashTable[ZSTD_hashPtr(ip0-2, hlog, mls)] = (U32)(ip0-2-base); + + while (ip0 <= ilimit) { + U32 const repIndex2 = (U32)(ip0-base) - offset_2; + const BYTE* const repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2; + if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) & (offset_2 > 0)) /* intentional underflow */ + && (MEM_read32(repMatch2) == MEM_read32(ip0)) ) { + const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; + size_t const repLength2 = ZSTD_count_2segments(ip0+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; + { U32 const tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; } /* swap offset_2 <=> offset_1 */ + ZSTD_storeSeq(seqStore, 0 /*litlen*/, anchor, iend, REPCODE1_TO_OFFBASE, repLength2); + hashTable[ZSTD_hashPtr(ip0, hlog, mls)] = (U32)(ip0-base); + ip0 += repLength2; + anchor = ip0; + continue; + } + break; + } } + + goto _start; +} + +ZSTD_GEN_FAST_FN(extDict, 4, 0) +ZSTD_GEN_FAST_FN(extDict, 5, 0) +ZSTD_GEN_FAST_FN(extDict, 6, 0) +ZSTD_GEN_FAST_FN(extDict, 7, 0) + +size_t ZSTD_compressBlock_fast_extDict( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + void const* src, size_t srcSize) +{ + U32 const mls = ms->cParams.minMatch; + assert(ms->dictMatchState == NULL); + switch(mls) + { + default: /* includes case 3 */ + case 4 : + return ZSTD_compressBlock_fast_extDict_4_0(ms, seqStore, rep, src, srcSize); + case 5 : + return ZSTD_compressBlock_fast_extDict_5_0(ms, seqStore, rep, src, srcSize); + case 6 : + return ZSTD_compressBlock_fast_extDict_6_0(ms, seqStore, rep, src, srcSize); + case 7 : + return ZSTD_compressBlock_fast_extDict_7_0(ms, seqStore, rep, src, srcSize); + } +} diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_fast.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_fast.h similarity index 90% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_fast.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_fast.h index 0d4a0c1..9e4236b 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_fast.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_fast.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -19,7 +19,8 @@ extern "C" { #include "zstd_compress_internal.h" void ZSTD_fillHashTable(ZSTD_matchState_t* ms, - void const* end, ZSTD_dictTableLoadMethod_e dtlm); + void const* end, ZSTD_dictTableLoadMethod_e dtlm, + ZSTD_tableFillPurpose_e tfp); size_t ZSTD_compressBlock_fast( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_lazy.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_lazy.c similarity index 70% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_lazy.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_lazy.c index 3d523e8..a247342 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_lazy.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_lazy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -10,6 +10,7 @@ #include "zstd_compress_internal.h" #include "zstd_lazy.h" +#include "../common/bits.h" /* ZSTD_countTrailingZeros64 */ /*-************************************* @@ -61,7 +62,7 @@ ZSTD_updateDUBT(ZSTD_matchState_t* ms, * assumption : curr >= btlow == (curr - btmask) * doesn't fail */ static void -ZSTD_insertDUBT1(ZSTD_matchState_t* ms, +ZSTD_insertDUBT1(const ZSTD_matchState_t* ms, U32 curr, const BYTE* inputEnd, U32 nbCompares, U32 btLow, const ZSTD_dictMode_e dictMode) @@ -93,7 +94,7 @@ ZSTD_insertDUBT1(ZSTD_matchState_t* ms, assert(curr >= btLow); assert(ip < iend); /* condition for ZSTD_count */ - while (nbCompares-- && (matchIndex > windowLow)) { + for (; nbCompares && (matchIndex > windowLow); --nbCompares) { U32* const nextPtr = bt + 2*(matchIndex & btMask); size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ assert(matchIndex < curr); @@ -151,7 +152,7 @@ ZSTD_insertDUBT1(ZSTD_matchState_t* ms, static size_t ZSTD_DUBT_findBetterDictMatch ( - ZSTD_matchState_t* ms, + const ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, size_t* offsetPtr, size_t bestLength, @@ -185,7 +186,7 @@ ZSTD_DUBT_findBetterDictMatch ( (void)dictMode; assert(dictMode == ZSTD_dictMatchState); - while (nbCompares-- && (dictMatchIndex > dictLowLimit)) { + for (; nbCompares && (dictMatchIndex > dictLowLimit); --nbCompares) { U32* const nextPtr = dictBt + 2*(dictMatchIndex & btMask); size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ const BYTE* match = dictBase + dictMatchIndex; @@ -197,8 +198,8 @@ ZSTD_DUBT_findBetterDictMatch ( U32 matchIndex = dictMatchIndex + dictIndexDelta; if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(curr-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1)) ) { DEBUGLOG(9, "ZSTD_DUBT_findBetterDictMatch(%u) : found better match length %u -> %u and offsetCode %u -> %u (dictMatchIndex %u, matchIndex %u)", - curr, (U32)bestLength, (U32)matchLength, (U32)*offsetPtr, ZSTD_REP_MOVE + curr - matchIndex, dictMatchIndex, matchIndex); - bestLength = matchLength, *offsetPtr = ZSTD_REP_MOVE + curr - matchIndex; + curr, (U32)bestLength, (U32)matchLength, (U32)*offsetPtr, OFFSET_TO_OFFBASE(curr - matchIndex), dictMatchIndex, matchIndex); + bestLength = matchLength, *offsetPtr = OFFSET_TO_OFFBASE(curr - matchIndex); } if (ip+matchLength == iend) { /* reached end of input : ip[matchLength] is not valid, no way to know if it's larger or smaller than match */ break; /* drop, to guarantee consistency (miss a little bit of compression) */ @@ -218,7 +219,7 @@ ZSTD_DUBT_findBetterDictMatch ( } if (bestLength >= MINMATCH) { - U32 const mIndex = curr - ((U32)*offsetPtr - ZSTD_REP_MOVE); (void)mIndex; + U32 const mIndex = curr - (U32)OFFBASE_TO_OFFSET(*offsetPtr); (void)mIndex; DEBUGLOG(8, "ZSTD_DUBT_findBetterDictMatch(%u) : found match of length %u and offsetCode %u (pos %u)", curr, (U32)bestLength, (U32)*offsetPtr, mIndex); } @@ -230,7 +231,7 @@ ZSTD_DUBT_findBetterDictMatch ( static size_t ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, - size_t* offsetPtr, + size_t* offBasePtr, U32 const mls, const ZSTD_dictMode_e dictMode) { @@ -309,7 +310,7 @@ ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, matchIndex = hashTable[h]; hashTable[h] = curr; /* Update Hash Table */ - while (nbCompares-- && (matchIndex > windowLow)) { + for (; nbCompares && (matchIndex > windowLow); --nbCompares) { U32* const nextPtr = bt + 2*(matchIndex & btMask); size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ const BYTE* match; @@ -327,8 +328,8 @@ ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, if (matchLength > bestLength) { if (matchLength > matchEndIdx - matchIndex) matchEndIdx = matchIndex + (U32)matchLength; - if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(curr-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1)) ) - bestLength = matchLength, *offsetPtr = ZSTD_REP_MOVE + curr - matchIndex; + if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(curr - matchIndex + 1) - ZSTD_highbit32((U32)*offBasePtr)) ) + bestLength = matchLength, *offBasePtr = OFFSET_TO_OFFBASE(curr - matchIndex); if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */ if (dictMode == ZSTD_dictMatchState) { nbCompares = 0; /* in addition to avoiding checking any @@ -357,19 +358,20 @@ ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, *smallerPtr = *largerPtr = 0; + assert(nbCompares <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */ if (dictMode == ZSTD_dictMatchState && nbCompares) { bestLength = ZSTD_DUBT_findBetterDictMatch( ms, ip, iend, - offsetPtr, bestLength, nbCompares, + offBasePtr, bestLength, nbCompares, mls, dictMode); } assert(matchEndIdx > curr+8); /* ensure nextToUpdate is increased */ ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */ if (bestLength >= MINMATCH) { - U32 const mIndex = curr - ((U32)*offsetPtr - ZSTD_REP_MOVE); (void)mIndex; + U32 const mIndex = curr - (U32)OFFBASE_TO_OFFSET(*offBasePtr); (void)mIndex; DEBUGLOG(8, "ZSTD_DUBT_findBestMatch(%u) : found match of length %u and offsetCode %u (pos %u)", - curr, (U32)bestLength, (U32)*offsetPtr, mIndex); + curr, (U32)bestLength, (U32)*offBasePtr, mIndex); } return bestLength; } @@ -380,62 +382,14 @@ ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, FORCE_INLINE_TEMPLATE size_t ZSTD_BtFindBestMatch( ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iLimit, - size_t* offsetPtr, + size_t* offBasePtr, const U32 mls /* template */, const ZSTD_dictMode_e dictMode) { DEBUGLOG(7, "ZSTD_BtFindBestMatch"); if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */ ZSTD_updateDUBT(ms, ip, iLimit, mls); - return ZSTD_DUBT_findBestMatch(ms, ip, iLimit, offsetPtr, mls, dictMode); -} - - -static size_t -ZSTD_BtFindBestMatch_selectMLS ( ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_noDict); - case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_noDict); - case 7 : - case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_noDict); - } -} - - -static size_t ZSTD_BtFindBestMatch_dictMatchState_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_dictMatchState); - case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_dictMatchState); - case 7 : - case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_dictMatchState); - } -} - - -static size_t ZSTD_BtFindBestMatch_extDict_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_extDict); - case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_extDict); - case 7 : - case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_extDict); - } + return ZSTD_DUBT_findBestMatch(ms, ip, iLimit, offBasePtr, mls, dictMode); } /*********************************** @@ -450,7 +404,7 @@ void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const B U32* const chainTable = ms->chainTable; U32 const chainSize = 1 << ms->cParams.chainLog; U32 idx = ms->nextToUpdate; - U32 const minChain = chainSize < target ? target - chainSize : idx; + U32 const minChain = chainSize < target - idx ? target - chainSize : idx; U32 const bucketSize = 1 << ZSTD_LAZY_DDSS_BUCKET_LOG; U32 const cacheSize = bucketSize - 1; U32 const chainAttempts = (1 << ms->cParams.searchLog) - cacheSize; @@ -464,7 +418,7 @@ void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const B U32 const hashLog = ms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG; U32* const tmpHashTable = hashTable; U32* const tmpChainTable = hashTable + ((size_t)1 << hashLog); - U32 const tmpChainSize = ((1 << ZSTD_LAZY_DDSS_BUCKET_LOG) - 1) << hashLog; + U32 const tmpChainSize = (U32)((1 << ZSTD_LAZY_DDSS_BUCKET_LOG) - 1) << hashLog; U32 const tmpMinChain = tmpChainSize < target ? target - tmpChainSize : idx; U32 hashIdx; @@ -608,7 +562,7 @@ size_t ZSTD_dedicatedDictSearch_lazy_search(size_t* offsetPtr, size_t ml, U32 nb /* save best solution */ if (currentMl > ml) { ml = currentMl; - *offsetPtr = curr - (matchIndex + ddsIndexDelta) + ZSTD_REP_MOVE; + *offsetPtr = OFFSET_TO_OFFBASE(curr - (matchIndex + ddsIndexDelta)); if (ip+currentMl == iLimit) { /* best possible, avoids read overflow on next attempt */ return ml; @@ -645,7 +599,7 @@ size_t ZSTD_dedicatedDictSearch_lazy_search(size_t* offsetPtr, size_t ml, U32 nb /* save best solution */ if (currentMl > ml) { ml = currentMl; - *offsetPtr = curr - (matchIndex + ddsIndexDelta) + ZSTD_REP_MOVE; + *offsetPtr = OFFSET_TO_OFFBASE(curr - (matchIndex + ddsIndexDelta)); if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */ } } @@ -692,7 +646,7 @@ U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip) { /* inlining is important to hardwire a hot branch (template emulation) */ FORCE_INLINE_TEMPLATE -size_t ZSTD_HcFindBestMatch_generic ( +size_t ZSTD_HcFindBestMatch( ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iLimit, size_t* offsetPtr, @@ -738,7 +692,8 @@ size_t ZSTD_HcFindBestMatch_generic ( if ((dictMode != ZSTD_extDict) || matchIndex >= dictLimit) { const BYTE* const match = base + matchIndex; assert(matchIndex >= dictLimit); /* ensures this is true if dictMode != ZSTD_extDict */ - if (match[ml] == ip[ml]) /* potentially better */ + /* read 4B starting from (match + ml + 1 - sizeof(U32)) */ + if (MEM_read32(match + ml - 3) == MEM_read32(ip + ml - 3)) /* potentially better */ currentMl = ZSTD_count(ip, match, iLimit); } else { const BYTE* const match = dictBase + matchIndex; @@ -750,7 +705,7 @@ size_t ZSTD_HcFindBestMatch_generic ( /* save best solution */ if (currentMl > ml) { ml = currentMl; - *offsetPtr = curr - matchIndex + ZSTD_REP_MOVE; + *offsetPtr = OFFSET_TO_OFFBASE(curr - matchIndex); if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */ } @@ -758,6 +713,7 @@ size_t ZSTD_HcFindBestMatch_generic ( matchIndex = NEXT_IN_CHAIN(matchIndex, chainMask); } + assert(nbAttempts <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */ if (dictMode == ZSTD_dedicatedDictSearch) { ml = ZSTD_dedicatedDictSearch_lazy_search(offsetPtr, ml, nbAttempts, dms, ip, iLimit, prefixStart, curr, dictLimit, ddsIdx); @@ -784,7 +740,8 @@ size_t ZSTD_HcFindBestMatch_generic ( /* save best solution */ if (currentMl > ml) { ml = currentMl; - *offsetPtr = curr - (matchIndex + dmsIndexDelta) + ZSTD_REP_MOVE; + assert(curr > matchIndex + dmsIndexDelta); + *offsetPtr = OFFSET_TO_OFFBASE(curr - (matchIndex + dmsIndexDelta)); if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */ } @@ -797,310 +754,49 @@ size_t ZSTD_HcFindBestMatch_generic ( return ml; } - -FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_noDict); - case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_noDict); - case 7 : - case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_noDict); - } -} - - -static size_t ZSTD_HcFindBestMatch_dictMatchState_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_dictMatchState); - case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_dictMatchState); - case 7 : - case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_dictMatchState); - } -} - - -static size_t ZSTD_HcFindBestMatch_dedicatedDictSearch_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_dedicatedDictSearch); - case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_dedicatedDictSearch); - case 7 : - case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_dedicatedDictSearch); - } -} - - -FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_extDict_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_extDict); - case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_extDict); - case 7 : - case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_extDict); - } -} - /* ********************************* * (SIMD) Row-based matchfinder ***********************************/ /* Constants for row-based hash */ -#define ZSTD_ROW_HASH_TAG_OFFSET 1 /* byte offset of hashes in the match state's tagTable from the beginning of a row */ -#define ZSTD_ROW_HASH_TAG_BITS 8 /* nb bits to use for the tag */ +#define ZSTD_ROW_HASH_TAG_OFFSET 16 /* byte offset of hashes in the match state's tagTable from the beginning of a row */ #define ZSTD_ROW_HASH_TAG_MASK ((1u << ZSTD_ROW_HASH_TAG_BITS) - 1) +#define ZSTD_ROW_HASH_MAX_ENTRIES 64 /* absolute maximum number of entries per row, for all configurations */ #define ZSTD_ROW_HASH_CACHE_MASK (ZSTD_ROW_HASH_CACHE_SIZE - 1) -typedef U32 ZSTD_VecMask; /* Clarifies when we are interacting with a U32 representing a mask of matches */ - -#if !defined(ZSTD_NO_INTRINSICS) && defined(__SSE2__) /* SIMD SSE version */ - -#include -typedef __m128i ZSTD_Vec128; - -/* Returns a 128-bit container with 128-bits from src */ -static ZSTD_Vec128 ZSTD_Vec128_read(const void* const src) { - return _mm_loadu_si128((ZSTD_Vec128 const*)src); -} - -/* Returns a ZSTD_Vec128 with the byte "val" packed 16 times */ -static ZSTD_Vec128 ZSTD_Vec128_set8(BYTE val) { - return _mm_set1_epi8((char)val); -} - -/* Do byte-by-byte comparison result of x and y. Then collapse 128-bit resultant mask - * into a 32-bit mask that is the MSB of each byte. - * */ -static ZSTD_VecMask ZSTD_Vec128_cmpMask8(ZSTD_Vec128 x, ZSTD_Vec128 y) { - return (ZSTD_VecMask)_mm_movemask_epi8(_mm_cmpeq_epi8(x, y)); -} - -typedef struct { - __m128i fst; - __m128i snd; -} ZSTD_Vec256; - -static ZSTD_Vec256 ZSTD_Vec256_read(const void* const ptr) { - ZSTD_Vec256 v; - v.fst = ZSTD_Vec128_read(ptr); - v.snd = ZSTD_Vec128_read((ZSTD_Vec128 const*)ptr + 1); - return v; -} - -static ZSTD_Vec256 ZSTD_Vec256_set8(BYTE val) { - ZSTD_Vec256 v; - v.fst = ZSTD_Vec128_set8(val); - v.snd = ZSTD_Vec128_set8(val); - return v; -} - -static ZSTD_VecMask ZSTD_Vec256_cmpMask8(ZSTD_Vec256 x, ZSTD_Vec256 y) { - ZSTD_VecMask fstMask; - ZSTD_VecMask sndMask; - fstMask = ZSTD_Vec128_cmpMask8(x.fst, y.fst); - sndMask = ZSTD_Vec128_cmpMask8(x.snd, y.snd); - return fstMask | (sndMask << 16); -} - -#elif !defined(ZSTD_NO_INTRINSICS) && defined(__ARM_NEON) /* SIMD ARM NEON Version */ - -#include -typedef uint8x16_t ZSTD_Vec128; - -static ZSTD_Vec128 ZSTD_Vec128_read(const void* const src) { - return vld1q_u8((const BYTE* const)src); -} - -static ZSTD_Vec128 ZSTD_Vec128_set8(BYTE val) { - return vdupq_n_u8(val); -} - -/* Mimics '_mm_movemask_epi8()' from SSE */ -static U32 ZSTD_vmovmaskq_u8(ZSTD_Vec128 val) { - /* Shift out everything but the MSB bits in each byte */ - uint16x8_t highBits = vreinterpretq_u16_u8(vshrq_n_u8(val, 7)); - /* Merge the even lanes together with vsra (right shift and add) */ - uint32x4_t paired16 = vreinterpretq_u32_u16(vsraq_n_u16(highBits, highBits, 7)); - uint64x2_t paired32 = vreinterpretq_u64_u32(vsraq_n_u32(paired16, paired16, 14)); - uint8x16_t paired64 = vreinterpretq_u8_u64(vsraq_n_u64(paired32, paired32, 28)); - /* Extract the low 8 bits from each lane, merge */ - return vgetq_lane_u8(paired64, 0) | ((U32)vgetq_lane_u8(paired64, 8) << 8); -} - -static ZSTD_VecMask ZSTD_Vec128_cmpMask8(ZSTD_Vec128 x, ZSTD_Vec128 y) { - return (ZSTD_VecMask)ZSTD_vmovmaskq_u8(vceqq_u8(x, y)); -} - -typedef struct { - uint8x16_t fst; - uint8x16_t snd; -} ZSTD_Vec256; - -static ZSTD_Vec256 ZSTD_Vec256_read(const void* const ptr) { - ZSTD_Vec256 v; - v.fst = ZSTD_Vec128_read(ptr); - v.snd = ZSTD_Vec128_read((ZSTD_Vec128 const*)ptr + 1); - return v; -} - -static ZSTD_Vec256 ZSTD_Vec256_set8(BYTE val) { - ZSTD_Vec256 v; - v.fst = ZSTD_Vec128_set8(val); - v.snd = ZSTD_Vec128_set8(val); - return v; -} - -static ZSTD_VecMask ZSTD_Vec256_cmpMask8(ZSTD_Vec256 x, ZSTD_Vec256 y) { - ZSTD_VecMask fstMask; - ZSTD_VecMask sndMask; - fstMask = ZSTD_Vec128_cmpMask8(x.fst, y.fst); - sndMask = ZSTD_Vec128_cmpMask8(x.snd, y.snd); - return fstMask | (sndMask << 16); -} - -#else /* Scalar fallback version */ - -#define VEC128_NB_SIZE_T (16 / sizeof(size_t)) -typedef struct { - size_t vec[VEC128_NB_SIZE_T]; -} ZSTD_Vec128; - -static ZSTD_Vec128 ZSTD_Vec128_read(const void* const src) { - ZSTD_Vec128 ret; - ZSTD_memcpy(ret.vec, src, VEC128_NB_SIZE_T*sizeof(size_t)); - return ret; -} - -static ZSTD_Vec128 ZSTD_Vec128_set8(BYTE val) { - ZSTD_Vec128 ret = { {0} }; - int startBit = sizeof(size_t) * 8 - 8; - for (;startBit >= 0; startBit -= 8) { - unsigned j = 0; - for (;j < VEC128_NB_SIZE_T; ++j) { - ret.vec[j] |= ((size_t)val << startBit); - } - } - return ret; -} - -/* Compare x to y, byte by byte, generating a "matches" bitfield */ -static ZSTD_VecMask ZSTD_Vec128_cmpMask8(ZSTD_Vec128 x, ZSTD_Vec128 y) { - ZSTD_VecMask res = 0; - unsigned i = 0; - unsigned l = 0; - for (; i < VEC128_NB_SIZE_T; ++i) { - const size_t cmp1 = x.vec[i]; - const size_t cmp2 = y.vec[i]; - unsigned j = 0; - for (; j < sizeof(size_t); ++j, ++l) { - if (((cmp1 >> j*8) & 0xFF) == ((cmp2 >> j*8) & 0xFF)) { - res |= ((U32)1 << (j+i*sizeof(size_t))); - } - } - } - return res; -} - -#define VEC256_NB_SIZE_T 2*VEC128_NB_SIZE_T -typedef struct { - size_t vec[VEC256_NB_SIZE_T]; -} ZSTD_Vec256; - -static ZSTD_Vec256 ZSTD_Vec256_read(const void* const src) { - ZSTD_Vec256 ret; - ZSTD_memcpy(ret.vec, src, VEC256_NB_SIZE_T*sizeof(size_t)); - return ret; -} - -static ZSTD_Vec256 ZSTD_Vec256_set8(BYTE val) { - ZSTD_Vec256 ret = { {0} }; - int startBit = sizeof(size_t) * 8 - 8; - for (;startBit >= 0; startBit -= 8) { - unsigned j = 0; - for (;j < VEC256_NB_SIZE_T; ++j) { - ret.vec[j] |= ((size_t)val << startBit); - } - } - return ret; -} - -/* Compare x to y, byte by byte, generating a "matches" bitfield */ -static ZSTD_VecMask ZSTD_Vec256_cmpMask8(ZSTD_Vec256 x, ZSTD_Vec256 y) { - ZSTD_VecMask res = 0; - unsigned i = 0; - unsigned l = 0; - for (; i < VEC256_NB_SIZE_T; ++i) { - const size_t cmp1 = x.vec[i]; - const size_t cmp2 = y.vec[i]; - unsigned j = 0; - for (; j < sizeof(size_t); ++j, ++l) { - if (((cmp1 >> j*8) & 0xFF) == ((cmp2 >> j*8) & 0xFF)) { - res |= ((U32)1 << (j+i*sizeof(size_t))); - } - } - } - return res; -} - -#endif /* !defined(ZSTD_NO_INTRINSICS) && defined(__SSE2__) */ +typedef U64 ZSTD_VecMask; /* Clarifies when we are interacting with a U64 representing a mask of matches */ /* ZSTD_VecMask_next(): * Starting from the LSB, returns the idx of the next non-zero bit. * Basically counting the nb of trailing zeroes. */ -static U32 ZSTD_VecMask_next(ZSTD_VecMask val) { -# if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - return _BitScanForward(&r, val) ? (U32)r : 0; -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (U32)__builtin_ctz(val); -# else - /* Software ctz version: http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup */ - static const U32 multiplyDeBruijnBitPosition[32] = - { - 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, - 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 - }; - return multiplyDeBruijnBitPosition[((U32)((v & -(int)v) * 0x077CB531U)) >> 27]; -# endif +MEM_STATIC U32 ZSTD_VecMask_next(ZSTD_VecMask val) { + return ZSTD_countTrailingZeros64(val); } -/* ZSTD_VecMask_rotateRight(): - * Rotates a bitfield to the right by "rotation" bits. - * If the rotation is greater than totalBits, the returned mask is 0. +/* ZSTD_rotateRight_*(): + * Rotates a bitfield to the right by "count" bits. + * https://en.wikipedia.org/w/index.php?title=Circular_shift&oldid=991635599#Implementing_circular_shifts */ -FORCE_INLINE_TEMPLATE ZSTD_VecMask -ZSTD_VecMask_rotateRight(ZSTD_VecMask mask, U32 const rotation, U32 const totalBits) { - if (rotation == 0) - return mask; - switch (totalBits) { - default: - assert(0); - case 16: - return (mask >> rotation) | (U16)(mask << (16 - rotation)); - case 32: - return (mask >> rotation) | (U32)(mask << (32 - rotation)); - } +FORCE_INLINE_TEMPLATE +U64 ZSTD_rotateRight_U64(U64 const value, U32 count) { + assert(count < 64); + count &= 0x3F; /* for fickle pattern recognition */ + return (value >> count) | (U64)(value << ((0U - count) & 0x3F)); +} + +FORCE_INLINE_TEMPLATE +U32 ZSTD_rotateRight_U32(U32 const value, U32 count) { + assert(count < 32); + count &= 0x1F; /* for fickle pattern recognition */ + return (value >> count) | (U32)(value << ((0U - count) & 0x1F)); +} + +FORCE_INLINE_TEMPLATE +U16 ZSTD_rotateRight_U16(U16 const value, U32 count) { + assert(count < 16); + count &= 0x0F; /* for fickle pattern recognition */ + return (value >> count) | (U16)(value << ((0U - count) & 0x0F)); } /* ZSTD_row_nextIndex(): @@ -1126,20 +822,24 @@ MEM_STATIC int ZSTD_isAligned(void const* ptr, size_t align) { */ FORCE_INLINE_TEMPLATE void ZSTD_row_prefetch(U32 const* hashTable, U16 const* tagTable, U32 const relRow, U32 const rowLog) { PREFETCH_L1(hashTable + relRow); - if (rowLog == 5) { + if (rowLog >= 5) { PREFETCH_L1(hashTable + relRow + 16); + /* Note: prefetching more of the hash table does not appear to be beneficial for 128-entry rows */ } PREFETCH_L1(tagTable + relRow); - assert(rowLog == 4 || rowLog == 5); + if (rowLog == 6) { + PREFETCH_L1(tagTable + relRow + 32); + } + assert(rowLog == 4 || rowLog == 5 || rowLog == 6); assert(ZSTD_isAligned(hashTable + relRow, 64)); /* prefetched hash row always 64-byte aligned */ - assert(ZSTD_isAligned(tagTable + relRow, (size_t)1 << rowLog)); /* prefetched tagRow sits on a multiple of 32 or 64 bytes */ + assert(ZSTD_isAligned(tagTable + relRow, (size_t)1 << rowLog)); /* prefetched tagRow sits on correct multiple of bytes (32,64,128) */ } /* ZSTD_row_fillHashCache(): * Fill up the hash cache starting at idx, prefetching up to ZSTD_ROW_HASH_CACHE_SIZE entries, * but not beyond iLimit. */ -static void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const BYTE* base, +FORCE_INLINE_TEMPLATE void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const BYTE* base, U32 const rowLog, U32 const mls, U32 idx, const BYTE* const iLimit) { @@ -1179,35 +879,65 @@ FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextCachedHash(U32* cache, U32 const* hashTab } } -/* ZSTD_row_update_internal(): - * Inserts the byte at ip into the appropriate position in the hash table. - * Determines the relative row, and the position within the {16, 32} entry row to insert at. +/* ZSTD_row_update_internalImpl(): + * Updates the hash table with positions starting from updateStartIdx until updateEndIdx. */ -FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const BYTE* ip, - U32 const mls, U32 const rowLog, - U32 const rowMask, U32 const useCache) +FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms, + U32 updateStartIdx, U32 const updateEndIdx, + U32 const mls, U32 const rowLog, + U32 const rowMask, U32 const useCache) { U32* const hashTable = ms->hashTable; U16* const tagTable = ms->tagTable; U32 const hashLog = ms->rowHashLog; const BYTE* const base = ms->window.base; - const U32 target = (U32)(ip - base); - U32 idx = ms->nextToUpdate; - DEBUGLOG(6, "ZSTD_row_update_internal(): nextToUpdate=%u, current=%u", idx, target); - for (; idx < target; ++idx) { - U32 const hash = useCache ? ZSTD_row_nextCachedHash(ms->hashCache, hashTable, tagTable, base, idx, hashLog, rowLog, mls) - : (U32)ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls); + DEBUGLOG(6, "ZSTD_row_update_internalImpl(): updateStartIdx=%u, updateEndIdx=%u", updateStartIdx, updateEndIdx); + for (; updateStartIdx < updateEndIdx; ++updateStartIdx) { + U32 const hash = useCache ? ZSTD_row_nextCachedHash(ms->hashCache, hashTable, tagTable, base, updateStartIdx, hashLog, rowLog, mls) + : (U32)ZSTD_hashPtr(base + updateStartIdx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls); U32 const relRow = (hash >> ZSTD_ROW_HASH_TAG_BITS) << rowLog; U32* const row = hashTable + relRow; BYTE* tagRow = (BYTE*)(tagTable + relRow); /* Though tagTable is laid out as a table of U16, each tag is only 1 byte. Explicit cast allows us to get exact desired position within each row */ U32 const pos = ZSTD_row_nextIndex(tagRow, rowMask); - assert(hash == ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls)); + assert(hash == ZSTD_hashPtr(base + updateStartIdx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls)); ((BYTE*)tagRow)[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK; - row[pos] = idx; + row[pos] = updateStartIdx; } +} + +/* ZSTD_row_update_internal(): + * Inserts the byte at ip into the appropriate position in the hash table, and updates ms->nextToUpdate. + * Skips sections of long matches as is necessary. + */ +FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const BYTE* ip, + U32 const mls, U32 const rowLog, + U32 const rowMask, U32 const useCache) +{ + U32 idx = ms->nextToUpdate; + const BYTE* const base = ms->window.base; + const U32 target = (U32)(ip - base); + const U32 kSkipThreshold = 384; + const U32 kMaxMatchStartPositionsToUpdate = 96; + const U32 kMaxMatchEndPositionsToUpdate = 32; + + if (useCache) { + /* Only skip positions when using hash cache, i.e. + * if we are loading a dict, don't skip anything. + * If we decide to skip, then we only update a set number + * of positions at the beginning and end of the match. + */ + if (UNLIKELY(target - idx > kSkipThreshold)) { + U32 const bound = idx + kMaxMatchStartPositionsToUpdate; + ZSTD_row_update_internalImpl(ms, idx, bound, mls, rowLog, rowMask, useCache); + idx = target - kMaxMatchEndPositionsToUpdate; + ZSTD_row_fillHashCache(ms, base, rowLog, mls, idx, ip+1); + } + } + assert(target >= idx); + ZSTD_row_update_internalImpl(ms, idx, target, mls, rowLog, rowMask, useCache); ms->nextToUpdate = target; } @@ -1216,34 +946,178 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const * processing. */ void ZSTD_row_update(ZSTD_matchState_t* const ms, const BYTE* ip) { - const U32 rowLog = ms->cParams.searchLog < 5 ? 4 : 5; + const U32 rowLog = BOUNDED(4, ms->cParams.searchLog, 6); const U32 rowMask = (1u << rowLog) - 1; const U32 mls = MIN(ms->cParams.minMatch, 6 /* mls caps out at 6 */); DEBUGLOG(5, "ZSTD_row_update(), rowLog=%u", rowLog); - ZSTD_row_update_internal(ms, ip, mls, rowLog, rowMask, 0 /* dont use cache */); + ZSTD_row_update_internal(ms, ip, mls, rowLog, rowMask, 0 /* don't use cache */); } -/* Returns a ZSTD_VecMask (U32) that has the nth bit set to 1 if the newly-computed "tag" matches - * the hash at the nth position in a row of the tagTable. +/* Returns the mask width of bits group of which will be set to 1. Given not all + * architectures have easy movemask instruction, this helps to iterate over + * groups of bits easier and faster. */ -FORCE_INLINE_TEMPLATE -ZSTD_VecMask ZSTD_row_getMatchMask(const BYTE* const tagRow, const BYTE tag, const U32 head, const U32 rowEntries) { - ZSTD_VecMask matches = 0; - if (rowEntries == 16) { - ZSTD_Vec128 hashes = ZSTD_Vec128_read(tagRow + ZSTD_ROW_HASH_TAG_OFFSET); - ZSTD_Vec128 expandedTags = ZSTD_Vec128_set8(tag); - matches = ZSTD_Vec128_cmpMask8(hashes, expandedTags); - } else if (rowEntries == 32) { - ZSTD_Vec256 hashes = ZSTD_Vec256_read(tagRow + ZSTD_ROW_HASH_TAG_OFFSET); - ZSTD_Vec256 expandedTags = ZSTD_Vec256_set8(tag); - matches = ZSTD_Vec256_cmpMask8(hashes, expandedTags); - } else { - assert(0); +FORCE_INLINE_TEMPLATE U32 +ZSTD_row_matchMaskGroupWidth(const U32 rowEntries) +{ + assert((rowEntries == 16) || (rowEntries == 32) || rowEntries == 64); + assert(rowEntries <= ZSTD_ROW_HASH_MAX_ENTRIES); + (void)rowEntries; +#if defined(ZSTD_ARCH_ARM_NEON) + /* NEON path only works for little endian */ + if (!MEM_isLittleEndian()) { + return 1; } - /* Each row is a circular buffer beginning at the value of "head". So we must rotate the "matches" bitfield - to match up with the actual layout of the entries within the hashTable */ - return ZSTD_VecMask_rotateRight(matches, head, rowEntries); + if (rowEntries == 16) { + return 4; + } + if (rowEntries == 32) { + return 2; + } + if (rowEntries == 64) { + return 1; + } +#endif + return 1; +} + +#if defined(ZSTD_ARCH_X86_SSE2) +FORCE_INLINE_TEMPLATE ZSTD_VecMask +ZSTD_row_getSSEMask(int nbChunks, const BYTE* const src, const BYTE tag, const U32 head) +{ + const __m128i comparisonMask = _mm_set1_epi8((char)tag); + int matches[4] = {0}; + int i; + assert(nbChunks == 1 || nbChunks == 2 || nbChunks == 4); + for (i=0; i> chunkSize; + do { + size_t chunk = MEM_readST(&src[i]); + chunk ^= splatChar; + chunk = (((chunk | x80) - x01) | chunk) & x80; + matches <<= chunkSize; + matches |= (chunk * extractMagic) >> shiftAmount; + i -= chunkSize; + } while (i >= 0); + } else { /* big endian: reverse bits during extraction */ + const size_t msb = xFF ^ (xFF >> 1); + const size_t extractMagic = (msb / 0x1FF) | msb; + do { + size_t chunk = MEM_readST(&src[i]); + chunk ^= splatChar; + chunk = (((chunk | x80) - x01) | chunk) & x80; + matches <<= chunkSize; + matches |= ((chunk >> 7) * extractMagic) >> shiftAmount; + i -= chunkSize; + } while (i >= 0); + } + matches = ~matches; + if (rowEntries == 16) { + return ZSTD_rotateRight_U16((U16)matches, headGrouped); + } else if (rowEntries == 32) { + return ZSTD_rotateRight_U32((U32)matches, headGrouped); + } else { + return ZSTD_rotateRight_U64((U64)matches, headGrouped); + } + } +#endif } /* The high-level approach of the SIMD row based match finder is as follows: @@ -1262,7 +1136,7 @@ ZSTD_VecMask ZSTD_row_getMatchMask(const BYTE* const tagRow, const BYTE tag, con * - Pick the longest match. */ FORCE_INLINE_TEMPLATE -size_t ZSTD_RowFindBestMatch_generic ( +size_t ZSTD_RowFindBestMatch( ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iLimit, size_t* offsetPtr, @@ -1288,16 +1162,19 @@ size_t ZSTD_RowFindBestMatch_generic ( const U32 rowEntries = (1U << rowLog); const U32 rowMask = rowEntries - 1; const U32 cappedSearchLog = MIN(cParams->searchLog, rowLog); /* nb of searches is capped at nb entries per row */ + const U32 groupWidth = ZSTD_row_matchMaskGroupWidth(rowEntries); U32 nbAttempts = 1U << cappedSearchLog; size_t ml=4-1; /* DMS/DDS variables that may be referenced laster */ const ZSTD_matchState_t* const dms = ms->dictMatchState; - size_t ddsIdx; - U32 ddsExtraAttempts; /* cctx hash tables are limited in searches, but allow extra searches into DDS */ - U32 dmsTag; - U32* dmsRow; - BYTE* dmsTagRow; + + /* Initialize the following variables to satisfy static analyzer */ + size_t ddsIdx = 0; + U32 ddsExtraAttempts = 0; /* cctx hash tables are limited in searches, but allow extra searches into DDS */ + U32 dmsTag = 0; + U32* dmsRow = NULL; + BYTE* dmsTagRow = NULL; if (dictMode == ZSTD_dedicatedDictSearch) { const U32 ddsHashLog = dms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG; @@ -1328,15 +1205,15 @@ size_t ZSTD_RowFindBestMatch_generic ( U32 const tag = hash & ZSTD_ROW_HASH_TAG_MASK; U32* const row = hashTable + relRow; BYTE* tagRow = (BYTE*)(tagTable + relRow); - U32 const head = *tagRow & rowMask; - U32 matchBuffer[32 /* maximum nb entries per row */]; + U32 const headGrouped = (*tagRow & rowMask) * groupWidth; + U32 matchBuffer[ZSTD_ROW_HASH_MAX_ENTRIES]; size_t numMatches = 0; size_t currMatch = 0; - ZSTD_VecMask matches = ZSTD_row_getMatchMask(tagRow, (BYTE)tag, head, rowEntries); + ZSTD_VecMask matches = ZSTD_row_getMatchMask(tagRow, (BYTE)tag, headGrouped, rowEntries); /* Cycle through the matches and prefetch */ for (; (matches > 0) && (nbAttempts > 0); --nbAttempts, matches &= (matches - 1)) { - U32 const matchPos = (head + ZSTD_VecMask_next(matches)) & rowMask; + U32 const matchPos = ((headGrouped + ZSTD_VecMask_next(matches)) / groupWidth) & rowMask; U32 const matchIndex = row[matchPos]; assert(numMatches < rowEntries); if (matchIndex < lowLimit) @@ -1367,7 +1244,8 @@ size_t ZSTD_RowFindBestMatch_generic ( if ((dictMode != ZSTD_extDict) || matchIndex >= dictLimit) { const BYTE* const match = base + matchIndex; assert(matchIndex >= dictLimit); /* ensures this is true if dictMode != ZSTD_extDict */ - if (match[ml] == ip[ml]) /* potentially better */ + /* read 4B starting from (match + ml + 1 - sizeof(U32)) */ + if (MEM_read32(match + ml - 3) == MEM_read32(ip + ml - 3)) /* potentially better */ currentMl = ZSTD_count(ip, match, iLimit); } else { const BYTE* const match = dictBase + matchIndex; @@ -1379,12 +1257,13 @@ size_t ZSTD_RowFindBestMatch_generic ( /* Save best solution */ if (currentMl > ml) { ml = currentMl; - *offsetPtr = curr - matchIndex + ZSTD_REP_MOVE; + *offsetPtr = OFFSET_TO_OFFBASE(curr - matchIndex); if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */ } } } + assert(nbAttempts <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */ if (dictMode == ZSTD_dedicatedDictSearch) { ml = ZSTD_dedicatedDictSearch_lazy_search(offsetPtr, ml, nbAttempts + ddsExtraAttempts, dms, ip, iLimit, prefixStart, curr, dictLimit, ddsIdx); @@ -1396,14 +1275,14 @@ size_t ZSTD_RowFindBestMatch_generic ( const U32 dmsSize = (U32)(dmsEnd - dmsBase); const U32 dmsIndexDelta = dictLimit - dmsSize; - { U32 const head = *dmsTagRow & rowMask; - U32 matchBuffer[32 /* maximum nb row entries */]; + { U32 const headGrouped = (*dmsTagRow & rowMask) * groupWidth; + U32 matchBuffer[ZSTD_ROW_HASH_MAX_ENTRIES]; size_t numMatches = 0; size_t currMatch = 0; - ZSTD_VecMask matches = ZSTD_row_getMatchMask(dmsTagRow, (BYTE)dmsTag, head, rowEntries); + ZSTD_VecMask matches = ZSTD_row_getMatchMask(dmsTagRow, (BYTE)dmsTag, headGrouped, rowEntries); for (; (matches > 0) && (nbAttempts > 0); --nbAttempts, matches &= (matches - 1)) { - U32 const matchPos = (head + ZSTD_VecMask_next(matches)) & rowMask; + U32 const matchPos = ((headGrouped + ZSTD_VecMask_next(matches)) / groupWidth) & rowMask; U32 const matchIndex = dmsRow[matchPos]; if (matchIndex < dmsLowestIndex) break; @@ -1426,7 +1305,8 @@ size_t ZSTD_RowFindBestMatch_generic ( if (currentMl > ml) { ml = currentMl; - *offsetPtr = curr - (matchIndex + dmsIndexDelta) + ZSTD_REP_MOVE; + assert(curr > matchIndex + dmsIndexDelta); + *offsetPtr = OFFSET_TO_OFFBASE(curr - (matchIndex + dmsIndexDelta)); if (ip+currentMl == iLimit) break; } } @@ -1435,83 +1315,183 @@ size_t ZSTD_RowFindBestMatch_generic ( return ml; } -/* Inlining is important to hardwire a hot branch (template emulation) */ -FORCE_INLINE_TEMPLATE size_t ZSTD_RowFindBestMatch_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - const ZSTD_dictMode_e dictMode, size_t* offsetPtr, const U32 rowLog) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_RowFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, dictMode, rowLog); - case 5 : return ZSTD_RowFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, dictMode, rowLog); - case 7 : - case 6 : return ZSTD_RowFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, dictMode, rowLog); - } -} -FORCE_INLINE_TEMPLATE size_t ZSTD_RowFindBestMatch_selectRowLog ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - const U32 cappedSearchLog = MIN(ms->cParams.searchLog, 5); - switch(cappedSearchLog) - { - default : - case 4 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_noDict, offsetPtr, 4); - case 5 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_noDict, offsetPtr, 5); - } -} +/** + * Generate search functions templated on (dictMode, mls, rowLog). + * These functions are outlined for code size & compilation time. + * ZSTD_searchMax() dispatches to the correct implementation function. + * + * TODO: The start of the search function involves loading and calculating a + * bunch of constants from the ZSTD_matchState_t. These computations could be + * done in an initialization function, and saved somewhere in the match state. + * Then we could pass a pointer to the saved state instead of the match state, + * and avoid duplicate computations. + * + * TODO: Move the match re-winding into searchMax. This improves compression + * ratio, and unlocks further simplifications with the next TODO. + * + * TODO: Try moving the repcode search into searchMax. After the re-winding + * and repcode search are in searchMax, there is no more logic in the match + * finder loop that requires knowledge about the dictMode. So we should be + * able to avoid force inlining it, and we can join the extDict loop with + * the single segment loop. It should go in searchMax instead of its own + * function to avoid having multiple virtual function calls per search. + */ -FORCE_INLINE_TEMPLATE size_t ZSTD_RowFindBestMatch_dictMatchState_selectRowLog( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - const U32 cappedSearchLog = MIN(ms->cParams.searchLog, 5); - switch(cappedSearchLog) - { - default : - case 4 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_dictMatchState, offsetPtr, 4); - case 5 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_dictMatchState, offsetPtr, 5); - } -} +#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls +#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls +#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog -FORCE_INLINE_TEMPLATE size_t ZSTD_RowFindBestMatch_dedicatedDictSearch_selectRowLog( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - const U32 cappedSearchLog = MIN(ms->cParams.searchLog, 5); - switch(cappedSearchLog) - { - default : - case 4 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_dedicatedDictSearch, offsetPtr, 4); - case 5 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_dedicatedDictSearch, offsetPtr, 5); - } -} +#define ZSTD_SEARCH_FN_ATTRS FORCE_NOINLINE -FORCE_INLINE_TEMPLATE size_t ZSTD_RowFindBestMatch_extDict_selectRowLog ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - const U32 cappedSearchLog = MIN(ms->cParams.searchLog, 5); - switch(cappedSearchLog) - { - default : - case 4 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_extDict, offsetPtr, 4); - case 5 : return ZSTD_RowFindBestMatch_selectMLS(ms, ip, iLimit, ZSTD_extDict, offsetPtr, 5); - } -} +#define GEN_ZSTD_BT_SEARCH_FN(dictMode, mls) \ + ZSTD_SEARCH_FN_ATTRS size_t ZSTD_BT_SEARCH_FN(dictMode, mls)( \ + ZSTD_matchState_t* ms, \ + const BYTE* ip, const BYTE* const iLimit, \ + size_t* offBasePtr) \ + { \ + assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls); \ + return ZSTD_BtFindBestMatch(ms, ip, iLimit, offBasePtr, mls, ZSTD_##dictMode); \ + } \ +#define GEN_ZSTD_HC_SEARCH_FN(dictMode, mls) \ + ZSTD_SEARCH_FN_ATTRS size_t ZSTD_HC_SEARCH_FN(dictMode, mls)( \ + ZSTD_matchState_t* ms, \ + const BYTE* ip, const BYTE* const iLimit, \ + size_t* offsetPtr) \ + { \ + assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls); \ + return ZSTD_HcFindBestMatch(ms, ip, iLimit, offsetPtr, mls, ZSTD_##dictMode); \ + } \ + +#define GEN_ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) \ + ZSTD_SEARCH_FN_ATTRS size_t ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)( \ + ZSTD_matchState_t* ms, \ + const BYTE* ip, const BYTE* const iLimit, \ + size_t* offsetPtr) \ + { \ + assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls); \ + assert(MAX(4, MIN(6, ms->cParams.searchLog)) == rowLog); \ + return ZSTD_RowFindBestMatch(ms, ip, iLimit, offsetPtr, mls, ZSTD_##dictMode, rowLog); \ + } \ + +#define ZSTD_FOR_EACH_ROWLOG(X, dictMode, mls) \ + X(dictMode, mls, 4) \ + X(dictMode, mls, 5) \ + X(dictMode, mls, 6) + +#define ZSTD_FOR_EACH_MLS_ROWLOG(X, dictMode) \ + ZSTD_FOR_EACH_ROWLOG(X, dictMode, 4) \ + ZSTD_FOR_EACH_ROWLOG(X, dictMode, 5) \ + ZSTD_FOR_EACH_ROWLOG(X, dictMode, 6) + +#define ZSTD_FOR_EACH_MLS(X, dictMode) \ + X(dictMode, 4) \ + X(dictMode, 5) \ + X(dictMode, 6) + +#define ZSTD_FOR_EACH_DICT_MODE(X, ...) \ + X(__VA_ARGS__, noDict) \ + X(__VA_ARGS__, extDict) \ + X(__VA_ARGS__, dictMatchState) \ + X(__VA_ARGS__, dedicatedDictSearch) + +/* Generate row search fns for each combination of (dictMode, mls, rowLog) */ +ZSTD_FOR_EACH_DICT_MODE(ZSTD_FOR_EACH_MLS_ROWLOG, GEN_ZSTD_ROW_SEARCH_FN) +/* Generate binary Tree search fns for each combination of (dictMode, mls) */ +ZSTD_FOR_EACH_DICT_MODE(ZSTD_FOR_EACH_MLS, GEN_ZSTD_BT_SEARCH_FN) +/* Generate hash chain search fns for each combination of (dictMode, mls) */ +ZSTD_FOR_EACH_DICT_MODE(ZSTD_FOR_EACH_MLS, GEN_ZSTD_HC_SEARCH_FN) + +typedef enum { search_hashChain=0, search_binaryTree=1, search_rowHash=2 } searchMethod_e; + +#define GEN_ZSTD_CALL_BT_SEARCH_FN(dictMode, mls) \ + case mls: \ + return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr); +#define GEN_ZSTD_CALL_HC_SEARCH_FN(dictMode, mls) \ + case mls: \ + return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr); +#define GEN_ZSTD_CALL_ROW_SEARCH_FN(dictMode, mls, rowLog) \ + case rowLog: \ + return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr); + +#define ZSTD_SWITCH_MLS(X, dictMode) \ + switch (mls) { \ + ZSTD_FOR_EACH_MLS(X, dictMode) \ + } + +#define ZSTD_SWITCH_ROWLOG(dictMode, mls) \ + case mls: \ + switch (rowLog) { \ + ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \ + } \ + ZSTD_UNREACHABLE; \ + break; + +#define ZSTD_SWITCH_SEARCH_METHOD(dictMode) \ + switch (searchMethod) { \ + case search_hashChain: \ + ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \ + break; \ + case search_binaryTree: \ + ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \ + break; \ + case search_rowHash: \ + ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode) \ + break; \ + } \ + ZSTD_UNREACHABLE; + +/** + * Searches for the longest match at @p ip. + * Dispatches to the correct implementation function based on the + * (searchMethod, dictMode, mls, rowLog). We use switch statements + * here instead of using an indirect function call through a function + * pointer because after Spectre and Meltdown mitigations, indirect + * function calls can be very costly, especially in the kernel. + * + * NOTE: dictMode and searchMethod should be templated, so those switch + * statements should be optimized out. Only the mls & rowLog switches + * should be left. + * + * @param ms The match state. + * @param ip The position to search at. + * @param iend The end of the input data. + * @param[out] offsetPtr Stores the match offset into this pointer. + * @param mls The minimum search length, in the range [4, 6]. + * @param rowLog The row log (if applicable), in the range [4, 6]. + * @param searchMethod The search method to use (templated). + * @param dictMode The dictMode (templated). + * + * @returns The length of the longest match found, or < mls if no match is found. + * If a match is found its offset is stored in @p offsetPtr. + */ +FORCE_INLINE_TEMPLATE size_t ZSTD_searchMax( + ZSTD_matchState_t* ms, + const BYTE* ip, + const BYTE* iend, + size_t* offsetPtr, + U32 const mls, + U32 const rowLog, + searchMethod_e const searchMethod, + ZSTD_dictMode_e const dictMode) +{ + if (dictMode == ZSTD_noDict) { + ZSTD_SWITCH_SEARCH_METHOD(noDict) + } else if (dictMode == ZSTD_extDict) { + ZSTD_SWITCH_SEARCH_METHOD(extDict) + } else if (dictMode == ZSTD_dictMatchState) { + ZSTD_SWITCH_SEARCH_METHOD(dictMatchState) + } else if (dictMode == ZSTD_dedicatedDictSearch) { + ZSTD_SWITCH_SEARCH_METHOD(dedicatedDictSearch) + } + ZSTD_UNREACHABLE; + return 0; +} /* ******************************* * Common parser - lazy strategy *********************************/ -typedef enum { search_hashChain=0, search_binaryTree=1, search_rowHash=2 } searchMethod_e; FORCE_INLINE_TEMPLATE size_t ZSTD_compressBlock_lazy_generic( @@ -1525,47 +1505,15 @@ ZSTD_compressBlock_lazy_generic( const BYTE* ip = istart; const BYTE* anchor = istart; const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = searchMethod == search_rowHash ? iend - 8 - ZSTD_ROW_HASH_CACHE_SIZE : iend - 8; + const BYTE* const ilimit = (searchMethod == search_rowHash) ? iend - 8 - ZSTD_ROW_HASH_CACHE_SIZE : iend - 8; const BYTE* const base = ms->window.base; const U32 prefixLowestIndex = ms->window.dictLimit; const BYTE* const prefixLowest = base + prefixLowestIndex; - const U32 rowLog = ms->cParams.searchLog < 5 ? 4 : 5; + const U32 mls = BOUNDED(4, ms->cParams.minMatch, 6); + const U32 rowLog = BOUNDED(4, ms->cParams.searchLog, 6); - typedef size_t (*searchMax_f)( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* iLimit, size_t* offsetPtr); - - /** - * This table is indexed first by the four ZSTD_dictMode_e values, and then - * by the two searchMethod_e values. NULLs are placed for configurations - * that should never occur (extDict modes go to the other implementation - * below and there is no DDSS for binary tree search yet). - */ - const searchMax_f searchFuncs[4][3] = { - { - ZSTD_HcFindBestMatch_selectMLS, - ZSTD_BtFindBestMatch_selectMLS, - ZSTD_RowFindBestMatch_selectRowLog - }, - { - NULL, - NULL, - NULL - }, - { - ZSTD_HcFindBestMatch_dictMatchState_selectMLS, - ZSTD_BtFindBestMatch_dictMatchState_selectMLS, - ZSTD_RowFindBestMatch_dictMatchState_selectRowLog - }, - { - ZSTD_HcFindBestMatch_dedicatedDictSearch_selectMLS, - NULL, - ZSTD_RowFindBestMatch_dedicatedDictSearch_selectRowLog - } - }; - - searchMax_f const searchMax = searchFuncs[dictMode][(int)searchMethod]; - U32 offset_1 = rep[0], offset_2 = rep[1], savedOffset=0; + U32 offset_1 = rep[0], offset_2 = rep[1]; + U32 offsetSaved1 = 0, offsetSaved2 = 0; const int isDMS = dictMode == ZSTD_dictMatchState; const int isDDS = dictMode == ZSTD_dedicatedDictSearch; @@ -1580,16 +1528,14 @@ ZSTD_compressBlock_lazy_generic( 0; const U32 dictAndPrefixLength = (U32)((ip - prefixLowest) + (dictEnd - dictLowest)); - assert(searchMax != NULL); - DEBUGLOG(5, "ZSTD_compressBlock_lazy_generic (dictMode=%u) (searchFunc=%u)", (U32)dictMode, (U32)searchMethod); ip += (dictAndPrefixLength == 0); if (dictMode == ZSTD_noDict) { U32 const curr = (U32)(ip - base); U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, ms->cParams.windowLog); U32 const maxRep = curr - windowLow; - if (offset_2 > maxRep) savedOffset = offset_2, offset_2 = 0; - if (offset_1 > maxRep) savedOffset = offset_1, offset_1 = 0; + if (offset_2 > maxRep) offsetSaved2 = offset_2, offset_2 = 0; + if (offset_1 > maxRep) offsetSaved1 = offset_1, offset_1 = 0; } if (isDxS) { /* dictMatchState repCode checks don't currently handle repCode == 0 @@ -1613,8 +1559,9 @@ ZSTD_compressBlock_lazy_generic( #endif while (ip < ilimit) { size_t matchLength=0; - size_t offset=0; + size_t offBase = REPCODE1_TO_OFFBASE; const BYTE* start=ip+1; + DEBUGLOG(7, "search baseline (depth 0)"); /* check repCode */ if (isDxS) { @@ -1637,10 +1584,10 @@ ZSTD_compressBlock_lazy_generic( } /* first search (depth 0) */ - { size_t offsetFound = 999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offsetFound); + { size_t offbaseFound = 999999999; + size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &offbaseFound, mls, rowLog, searchMethod, dictMode); if (ml2 > matchLength) - matchLength = ml2, start = ip, offset=offsetFound; + matchLength = ml2, start = ip, offBase = offbaseFound; } if (matchLength < 4) { @@ -1651,14 +1598,15 @@ ZSTD_compressBlock_lazy_generic( /* let's try to find a better solution */ if (depth>=1) while (ip0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) { + && (offBase) && ((offset_1>0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) { size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4; int const gain2 = (int)(mlRep * 3); - int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); + int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offBase) + 1); if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; + matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip; } if (isDxS) { const U32 repIndex = (U32)(ip - base) - offset_1; @@ -1670,30 +1618,31 @@ ZSTD_compressBlock_lazy_generic( const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; int const gain2 = (int)(mlRep * 3); - int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); + int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offBase) + 1); if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; + matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip; } } - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4); + { size_t ofbCandidate=999999999; + size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, dictMode); + int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate)); /* raw approx */ + int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 4); if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offBase = ofbCandidate, start = ip; continue; /* search a better one */ } } /* let's find an even better one */ if ((depth==2) && (ip0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) { + && (offBase) && ((offset_1>0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) { size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4; int const gain2 = (int)(mlRep * 4); - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); + int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 1); if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; + matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip; } if (isDxS) { const U32 repIndex = (U32)(ip - base) - offset_1; @@ -1705,46 +1654,45 @@ ZSTD_compressBlock_lazy_generic( const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; int const gain2 = (int)(mlRep * 4); - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); + int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 1); if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; + matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip; } } - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7); + { size_t ofbCandidate=999999999; + size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, dictMode); + int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate)); /* raw approx */ + int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 7); if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offBase = ofbCandidate, start = ip; continue; } } } break; /* nothing found : store previous solution */ } /* NOTE: - * start[-offset+ZSTD_REP_MOVE-1] is undefined behavior. - * (-offset+ZSTD_REP_MOVE-1) is unsigned, and is added to start, which - * overflows the pointer, which is undefined behavior. + * Pay attention that `start[-value]` can lead to strange undefined behavior + * notably if `value` is unsigned, resulting in a large positive `-value`. */ /* catch up */ - if (offset) { + if (OFFBASE_IS_OFFSET(offBase)) { if (dictMode == ZSTD_noDict) { - while ( ((start > anchor) & (start - (offset-ZSTD_REP_MOVE) > prefixLowest)) - && (start[-1] == (start-(offset-ZSTD_REP_MOVE))[-1]) ) /* only search for offset within prefix */ + while ( ((start > anchor) & (start - OFFBASE_TO_OFFSET(offBase) > prefixLowest)) + && (start[-1] == (start-OFFBASE_TO_OFFSET(offBase))[-1]) ) /* only search for offset within prefix */ { start--; matchLength++; } } if (isDxS) { - U32 const matchIndex = (U32)((start-base) - (offset - ZSTD_REP_MOVE)); + U32 const matchIndex = (U32)((size_t)(start-base) - OFFBASE_TO_OFFSET(offBase)); const BYTE* match = (matchIndex < prefixLowestIndex) ? dictBase + matchIndex - dictIndexDelta : base + matchIndex; const BYTE* const mStart = (matchIndex < prefixLowestIndex) ? dictLowest : prefixLowest; while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLength++; } /* catch up */ } - offset_2 = offset_1; offset_1 = (U32)(offset - ZSTD_REP_MOVE); + offset_2 = offset_1; offset_1 = (U32)OFFBASE_TO_OFFSET(offBase); } /* store sequence */ _storeSequence: - { size_t const litLength = start - anchor; - ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offset, matchLength-MINMATCH); + { size_t const litLength = (size_t)(start - anchor); + ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offBase, matchLength); anchor = ip = start + matchLength; } @@ -1760,8 +1708,8 @@ _storeSequence: && (MEM_read32(repMatch) == MEM_read32(ip)) ) { const BYTE* const repEnd2 = repIndex < prefixLowestIndex ? dictEnd : iend; matchLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd2, prefixLowest) + 4; - offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, matchLength-MINMATCH); + offBase = offset_2; offset_2 = offset_1; offset_1 = (U32)offBase; /* swap offset_2 <=> offset_1 */ + ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, matchLength); ip += matchLength; anchor = ip; continue; @@ -1775,16 +1723,20 @@ _storeSequence: && (MEM_read32(ip) == MEM_read32(ip - offset_2)) ) { /* store sequence */ matchLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4; - offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap repcodes */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, matchLength-MINMATCH); + offBase = offset_2; offset_2 = offset_1; offset_1 = (U32)offBase; /* swap repcodes */ + ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, matchLength); ip += matchLength; anchor = ip; continue; /* faster when present ... (?) */ } } } - /* Save reps for next block */ - rep[0] = offset_1 ? offset_1 : savedOffset; - rep[1] = offset_2 ? offset_2 : savedOffset; + /* If offset_1 started invalid (offsetSaved1 != 0) and became valid (offset_1 != 0), + * rotate saved offsets. See comment in ZSTD_compressBlock_fast_noDict for more context. */ + offsetSaved2 = ((offsetSaved1 != 0) && (offset_1 != 0)) ? offsetSaved1 : offsetSaved2; + + /* save reps for next block */ + rep[0] = offset_1 ? offset_1 : offsetSaved1; + rep[1] = offset_2 ? offset_2 : offsetSaved2; /* Return the last literals size */ return (size_t)(iend - anchor); @@ -1953,17 +1905,9 @@ size_t ZSTD_compressBlock_lazy_extDict_generic( const BYTE* const dictEnd = dictBase + dictLimit; const BYTE* const dictStart = dictBase + ms->window.lowLimit; const U32 windowLog = ms->cParams.windowLog; - const U32 rowLog = ms->cParams.searchLog < 5 ? 4 : 5; + const U32 mls = BOUNDED(4, ms->cParams.minMatch, 6); + const U32 rowLog = BOUNDED(4, ms->cParams.searchLog, 6); - typedef size_t (*searchMax_f)( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* iLimit, size_t* offsetPtr); - const searchMax_f searchFuncs[3] = { - ZSTD_HcFindBestMatch_extDict_selectMLS, - ZSTD_BtFindBestMatch_extDict_selectMLS, - ZSTD_RowFindBestMatch_extDict_selectRowLog - }; - searchMax_f searchMax = searchFuncs[(int)searchMethod]; U32 offset_1 = rep[0], offset_2 = rep[1]; DEBUGLOG(5, "ZSTD_compressBlock_lazy_extDict_generic (searchFunc=%u)", (U32)searchMethod); @@ -1985,7 +1929,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic( #endif while (ip < ilimit) { size_t matchLength=0; - size_t offset=0; + size_t offBase = REPCODE1_TO_OFFBASE; const BYTE* start=ip+1; U32 curr = (U32)(ip-base); @@ -1995,7 +1939,7 @@ size_t ZSTD_compressBlock_lazy_extDict_generic( const BYTE* const repBase = repIndex < dictLimit ? dictBase : base; const BYTE* const repMatch = repBase + repIndex; if ( ((U32)((dictLimit-1) - repIndex) >= 3) /* intentional overflow */ - & (offset_1 < curr+1 - windowLow) ) /* note: we are searching at curr+1 */ + & (offset_1 <= curr+1 - windowLow) ) /* note: we are searching at curr+1 */ if (MEM_read32(ip+1) == MEM_read32(repMatch)) { /* repcode detected we should take it */ const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; @@ -2004,13 +1948,13 @@ size_t ZSTD_compressBlock_lazy_extDict_generic( } } /* first search (depth 0) */ - { size_t offsetFound = 999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offsetFound); + { size_t ofbCandidate = 999999999; + size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, ZSTD_extDict); if (ml2 > matchLength) - matchLength = ml2, start = ip, offset=offsetFound; + matchLength = ml2, start = ip, offBase = ofbCandidate; } - if (matchLength < 4) { + if (matchLength < 4) { ip += ((ip-anchor) >> kSearchStrength) + 1; /* jump faster over incompressible sections */ continue; } @@ -2021,30 +1965,30 @@ size_t ZSTD_compressBlock_lazy_extDict_generic( ip ++; curr++; /* check repCode */ - if (offset) { + if (offBase) { const U32 windowLow = ZSTD_getLowestMatchIndex(ms, curr, windowLog); const U32 repIndex = (U32)(curr - offset_1); const BYTE* const repBase = repIndex < dictLimit ? dictBase : base; const BYTE* const repMatch = repBase + repIndex; if ( ((U32)((dictLimit-1) - repIndex) >= 3) /* intentional overflow : do not test positions overlapping 2 memory segments */ - & (offset_1 < curr - windowLow) ) /* equivalent to `curr > repIndex >= windowLow` */ + & (offset_1 <= curr - windowLow) ) /* equivalent to `curr > repIndex >= windowLow` */ if (MEM_read32(ip) == MEM_read32(repMatch)) { /* repcode detected */ const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; size_t const repLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd, prefixStart) + 4; int const gain2 = (int)(repLength * 3); - int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); + int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offBase) + 1); if ((repLength >= 4) && (gain2 > gain1)) - matchLength = repLength, offset = 0, start = ip; + matchLength = repLength, offBase = REPCODE1_TO_OFFBASE, start = ip; } } /* search match, depth 1 */ - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4); + { size_t ofbCandidate = 999999999; + size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, ZSTD_extDict); + int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate)); /* raw approx */ + int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 4); if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offBase = ofbCandidate, start = ip; continue; /* search a better one */ } } @@ -2053,48 +1997,48 @@ size_t ZSTD_compressBlock_lazy_extDict_generic( ip ++; curr++; /* check repCode */ - if (offset) { + if (offBase) { const U32 windowLow = ZSTD_getLowestMatchIndex(ms, curr, windowLog); const U32 repIndex = (U32)(curr - offset_1); const BYTE* const repBase = repIndex < dictLimit ? dictBase : base; const BYTE* const repMatch = repBase + repIndex; if ( ((U32)((dictLimit-1) - repIndex) >= 3) /* intentional overflow : do not test positions overlapping 2 memory segments */ - & (offset_1 < curr - windowLow) ) /* equivalent to `curr > repIndex >= windowLow` */ + & (offset_1 <= curr - windowLow) ) /* equivalent to `curr > repIndex >= windowLow` */ if (MEM_read32(ip) == MEM_read32(repMatch)) { /* repcode detected */ const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; size_t const repLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd, prefixStart) + 4; int const gain2 = (int)(repLength * 4); - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); + int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 1); if ((repLength >= 4) && (gain2 > gain1)) - matchLength = repLength, offset = 0, start = ip; + matchLength = repLength, offBase = REPCODE1_TO_OFFBASE, start = ip; } } /* search match, depth 2 */ - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7); + { size_t ofbCandidate = 999999999; + size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, ZSTD_extDict); + int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate)); /* raw approx */ + int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 7); if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offBase = ofbCandidate, start = ip; continue; } } } break; /* nothing found : store previous solution */ } /* catch up */ - if (offset) { - U32 const matchIndex = (U32)((start-base) - (offset - ZSTD_REP_MOVE)); + if (OFFBASE_IS_OFFSET(offBase)) { + U32 const matchIndex = (U32)((size_t)(start-base) - OFFBASE_TO_OFFSET(offBase)); const BYTE* match = (matchIndex < dictLimit) ? dictBase + matchIndex : base + matchIndex; const BYTE* const mStart = (matchIndex < dictLimit) ? dictStart : prefixStart; while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLength++; } /* catch up */ - offset_2 = offset_1; offset_1 = (U32)(offset - ZSTD_REP_MOVE); + offset_2 = offset_1; offset_1 = (U32)OFFBASE_TO_OFFSET(offBase); } /* store sequence */ _storeSequence: - { size_t const litLength = start - anchor; - ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offset, matchLength-MINMATCH); + { size_t const litLength = (size_t)(start - anchor); + ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offBase, matchLength); anchor = ip = start + matchLength; } @@ -2106,13 +2050,13 @@ _storeSequence: const BYTE* const repBase = repIndex < dictLimit ? dictBase : base; const BYTE* const repMatch = repBase + repIndex; if ( ((U32)((dictLimit-1) - repIndex) >= 3) /* intentional overflow : do not test positions overlapping 2 memory segments */ - & (offset_2 < repCurrent - windowLow) ) /* equivalent to `curr > repIndex >= windowLow` */ + & (offset_2 <= repCurrent - windowLow) ) /* equivalent to `curr > repIndex >= windowLow` */ if (MEM_read32(ip) == MEM_read32(repMatch)) { /* repcode detected we should take it */ const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; matchLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd, prefixStart) + 4; - offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap offset history */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, matchLength-MINMATCH); + offBase = offset_2; offset_2 = offset_1; offset_1 = (U32)offBase; /* swap offset history */ + ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, matchLength); ip += matchLength; anchor = ip; continue; /* faster when present ... (?) */ @@ -2178,7 +2122,6 @@ size_t ZSTD_compressBlock_lazy_extDict_row( size_t ZSTD_compressBlock_lazy2_extDict_row( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize) - { return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_rowHash, 2); } diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_lazy.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_lazy.h similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_lazy.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_lazy.h index 150f7b3..3bde673 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_lazy.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_lazy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -25,6 +25,8 @@ extern "C" { */ #define ZSTD_LAZY_DDSS_BUCKET_LOG 2 +#define ZSTD_ROW_HASH_TAG_BITS 8 /* nb bits to use for the tag */ + U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip); void ZSTD_row_update(ZSTD_matchState_t* const ms, const BYTE* ip); @@ -116,7 +118,7 @@ size_t ZSTD_compressBlock_lazy2_extDict_row( size_t ZSTD_compressBlock_btlazy2_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); - + #if defined (__cplusplus) } diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm.c similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm.c index fa4ebea..3d74ff1 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -159,12 +159,12 @@ size_t ZSTD_ldm_getTableSize(ldmParams_t params) size_t const ldmBucketSize = ((size_t)1) << (params.hashLog - ldmBucketSizeLog); size_t const totalSize = ZSTD_cwksp_alloc_size(ldmBucketSize) + ZSTD_cwksp_alloc_size(ldmHSize * sizeof(ldmEntry_t)); - return params.enableLdm ? totalSize : 0; + return params.enableLdm == ZSTD_ps_enable ? totalSize : 0; } size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize) { - return params.enableLdm ? (maxChunkSize / params.minMatchLength) : 0; + return params.enableLdm == ZSTD_ps_enable ? (maxChunkSize / params.minMatchLength) : 0; } /** ZSTD_ldm_getBucket() : @@ -242,11 +242,11 @@ static size_t ZSTD_ldm_fillFastTables(ZSTD_matchState_t* ms, switch(ms->cParams.strategy) { case ZSTD_fast: - ZSTD_fillHashTable(ms, iend, ZSTD_dtlm_fast); + ZSTD_fillHashTable(ms, iend, ZSTD_dtlm_fast, ZSTD_tfp_forCCtx); break; case ZSTD_dfast: - ZSTD_fillDoubleHashTable(ms, iend, ZSTD_dtlm_fast); + ZSTD_fillDoubleHashTable(ms, iend, ZSTD_dtlm_fast, ZSTD_tfp_forCCtx); break; case ZSTD_greedy: @@ -478,7 +478,7 @@ static size_t ZSTD_ldm_generateSequences_internal( */ if (anchor > ip + hashed) { ZSTD_ldm_gear_reset(&hashState, anchor - minMatchLength, minMatchLength); - /* Continue the outter loop at anchor (ip + hashed == anchor). */ + /* Continue the outer loop at anchor (ip + hashed == anchor). */ ip = anchor - hashed; break; } @@ -549,7 +549,7 @@ size_t ZSTD_ldm_generateSequences( * the window through early invalidation. * TODO: * Test the chunk size. * * Try invalidation after the sequence generation and test the - * the offset against maxDist directly. + * offset against maxDist directly. * * NOTE: Because of dictionaries + sequence splitting we MUST make sure * that any offset used is valid at the END of the sequence, since it may @@ -579,7 +579,9 @@ size_t ZSTD_ldm_generateSequences( return 0; } -void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, U32 const minMatch) { +void +ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, U32 const minMatch) +{ while (srcSize > 0 && rawSeqStore->pos < rawSeqStore->size) { rawSeq* seq = rawSeqStore->seq + rawSeqStore->pos; if (srcSize <= seq->litLength) { @@ -657,7 +659,7 @@ void ZSTD_ldm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes) { size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + ZSTD_paramSwitch_e useRowMatchFinder, void const* src, size_t srcSize) { const ZSTD_compressionParameters* const cParams = &ms->cParams; @@ -709,8 +711,8 @@ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, rep[0] = sequence.offset; /* Store the sequence */ ZSTD_storeSeq(seqStore, newLitLength, ip - newLitLength, iend, - sequence.offset + ZSTD_REP_MOVE, - sequence.matchLength - MINMATCH); + OFFSET_TO_OFFBASE(sequence.offset), + sequence.matchLength); ip += sequence.matchLength; } } diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm.h similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm.h index 393466f..f147021 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -66,7 +66,7 @@ size_t ZSTD_ldm_generateSequences( */ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + ZSTD_paramSwitch_e useRowMatchFinder, void const* src, size_t srcSize); /** diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm_geartab.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm_geartab.h similarity index 96% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm_geartab.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm_geartab.h index e5c24d8..ef34bc5 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_ldm_geartab.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_ldm_geartab.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -11,7 +11,10 @@ #ifndef ZSTD_LDM_GEARTAB_H #define ZSTD_LDM_GEARTAB_H -static U64 ZSTD_ldm_gearTab[256] = { +#include "../common/compiler.h" /* UNUSED_ATTR */ +#include "../common/mem.h" /* U64 */ + +static UNUSED_ATTR const U64 ZSTD_ldm_gearTab[256] = { 0xf5b8f72c5f77775c, 0x84935f266b7ac412, 0xb647ada9ca730ccc, 0xb065bb4b114fb1de, 0x34584e7e8c3a9fd0, 0x4e97e17c6ae26b05, 0x3a03d743bc99a604, 0xcecd042422c4044f, 0x76de76c58524259e, diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_opt.c b/src/dependencies/zstd-1.5.4/lib/compress/zstd_opt.c similarity index 75% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_opt.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_opt.c index 402a7e5..fdd7f9d 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_opt.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_opt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -14,40 +14,47 @@ #define ZSTD_LITFREQ_ADD 2 /* scaling factor for litFreq, so that frequencies adapt faster to new stats */ -#define ZSTD_FREQ_DIV 4 /* log factor when using previous stats to init next stats */ #define ZSTD_MAX_PRICE (1<<30) -#define ZSTD_PREDEF_THRESHOLD 1024 /* if srcSize < ZSTD_PREDEF_THRESHOLD, symbols' cost is assumed static, directly determined by pre-defined distributions */ +#define ZSTD_PREDEF_THRESHOLD 8 /* if srcSize < ZSTD_PREDEF_THRESHOLD, symbols' cost is assumed static, directly determined by pre-defined distributions */ /*-************************************* * Price functions for optimal parser ***************************************/ -#if 0 /* approximation at bit level */ +#if 0 /* approximation at bit level (for tests) */ # define BITCOST_ACCURACY 0 # define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY) -# define WEIGHT(stat) ((void)opt, ZSTD_bitWeight(stat)) -#elif 0 /* fractional bit accuracy */ +# define WEIGHT(stat, opt) ((void)(opt), ZSTD_bitWeight(stat)) +#elif 0 /* fractional bit accuracy (for tests) */ # define BITCOST_ACCURACY 8 # define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY) -# define WEIGHT(stat,opt) ((void)opt, ZSTD_fracWeight(stat)) +# define WEIGHT(stat,opt) ((void)(opt), ZSTD_fracWeight(stat)) #else /* opt==approx, ultra==accurate */ # define BITCOST_ACCURACY 8 # define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY) -# define WEIGHT(stat,opt) (opt ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat)) +# define WEIGHT(stat,opt) ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat)) #endif +/* ZSTD_bitWeight() : + * provide estimated "cost" of a stat in full bits only */ MEM_STATIC U32 ZSTD_bitWeight(U32 stat) { return (ZSTD_highbit32(stat+1) * BITCOST_MULTIPLIER); } +/* ZSTD_fracWeight() : + * provide fractional-bit "cost" of a stat, + * using linear interpolation approximation */ MEM_STATIC U32 ZSTD_fracWeight(U32 rawStat) { U32 const stat = rawStat + 1; U32 const hb = ZSTD_highbit32(stat); U32 const BWeight = hb * BITCOST_MULTIPLIER; + /* Fweight was meant for "Fractional weight" + * but it's effectively a value between 1 and 2 + * using fixed point arithmetic */ U32 const FWeight = (stat << BITCOST_ACCURACY) >> hb; U32 const weight = BWeight + FWeight; assert(hb + BITCOST_ACCURACY < 31); @@ -58,7 +65,7 @@ MEM_STATIC U32 ZSTD_fracWeight(U32 rawStat) /* debugging function, * @return price in bytes as fractional value * for debug messages only */ -MEM_STATIC double ZSTD_fCost(U32 price) +MEM_STATIC double ZSTD_fCost(int price) { return (double)price / (BITCOST_MULTIPLIER*8); } @@ -66,7 +73,7 @@ MEM_STATIC double ZSTD_fCost(U32 price) static int ZSTD_compressedLiterals(optState_t const* const optPtr) { - return optPtr->literalCompressionMode != ZSTD_lcm_uncompressed; + return optPtr->literalCompressionMode != ZSTD_ps_disable; } static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel) @@ -79,25 +86,52 @@ static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel) } -/* ZSTD_downscaleStat() : - * reduce all elements in table by a factor 2^(ZSTD_FREQ_DIV+malus) - * return the resulting sum of elements */ -static U32 ZSTD_downscaleStat(unsigned* table, U32 lastEltIndex, int malus) +static U32 sum_u32(const unsigned table[], size_t nbElts) +{ + size_t n; + U32 total = 0; + for (n=0; n 0 && ZSTD_FREQ_DIV+malus < 31); + DEBUGLOG(5, "ZSTD_downscaleStats (nbElts=%u, shift=%u)", + (unsigned)lastEltIndex+1, (unsigned)shift ); + assert(shift < 30); for (s=0; s> (ZSTD_FREQ_DIV+malus)); - sum += table[s]; + unsigned const base = base1 ? 1 : (table[s]>0); + unsigned const newStat = base + (table[s] >> shift); + sum += newStat; + table[s] = newStat; } return sum; } +/* ZSTD_scaleStats() : + * reduce all elt frequencies in table if sum too large + * return the resulting sum of elements */ +static U32 ZSTD_scaleStats(unsigned* table, U32 lastEltIndex, U32 logTarget) +{ + U32 const prevsum = sum_u32(table, lastEltIndex+1); + U32 const factor = prevsum >> logTarget; + DEBUGLOG(5, "ZSTD_scaleStats (nbElts=%u, target=%u)", (unsigned)lastEltIndex+1, (unsigned)logTarget); + assert(logTarget < 30); + if (factor <= 1) return prevsum; + return ZSTD_downscaleStats(table, lastEltIndex, ZSTD_highbit32(factor), base_1guaranteed); +} + /* ZSTD_rescaleFreqs() : * if first block (detected by optPtr->litLengthSum == 0) : init statistics * take hints from dictionary if there is one - * or init from zero, using src for literals stats, or flat 1 for match symbols + * and init from zero if there is none, + * using src for literals stats, and baseline stats for sequence symbols * otherwise downscale existing stats, to be used as seed for next block. */ static void @@ -109,24 +143,28 @@ ZSTD_rescaleFreqs(optState_t* const optPtr, DEBUGLOG(5, "ZSTD_rescaleFreqs (srcSize=%u)", (unsigned)srcSize); optPtr->priceType = zop_dynamic; - if (optPtr->litLengthSum == 0) { /* first block : init */ - if (srcSize <= ZSTD_PREDEF_THRESHOLD) { /* heuristic */ - DEBUGLOG(5, "(srcSize <= ZSTD_PREDEF_THRESHOLD) => zop_predef"); + if (optPtr->litLengthSum == 0) { /* no literals stats collected -> first block assumed -> init */ + + /* heuristic: use pre-defined stats for too small inputs */ + if (srcSize <= ZSTD_PREDEF_THRESHOLD) { + DEBUGLOG(5, "srcSize <= %i : use predefined stats", ZSTD_PREDEF_THRESHOLD); optPtr->priceType = zop_predef; } assert(optPtr->symbolCosts != NULL); if (optPtr->symbolCosts->huf.repeatMode == HUF_repeat_valid) { - /* huffman table presumed generated by dictionary */ + + /* huffman stats covering the full value set : table presumed generated by dictionary */ optPtr->priceType = zop_dynamic; if (compressedLiterals) { + /* generate literals statistics from huffman table */ unsigned lit; assert(optPtr->litFreq != NULL); optPtr->litSum = 0; for (lit=0; lit<=MaxLit; lit++) { U32 const scaleLog = 11; /* scale to 2K */ - U32 const bitCost = HUF_getNbBits(optPtr->symbolCosts->huf.CTable, lit); + U32 const bitCost = HUF_getNbBitsFromCTable(optPtr->symbolCosts->huf.CTable, lit); assert(bitCost <= scaleLog); optPtr->litFreq[lit] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; optPtr->litSum += optPtr->litFreq[lit]; @@ -168,20 +206,26 @@ ZSTD_rescaleFreqs(optState_t* const optPtr, optPtr->offCodeSum += optPtr->offCodeFreq[of]; } } - } else { /* not a dictionary */ + } else { /* first block, no dictionary */ assert(optPtr->litFreq != NULL); if (compressedLiterals) { + /* base initial cost of literals on direct frequency within src */ unsigned lit = MaxLit; HIST_count_simple(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistics */ - optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); + optPtr->litSum = ZSTD_downscaleStats(optPtr->litFreq, MaxLit, 8, base_0possible); } - { unsigned ll; - for (ll=0; ll<=MaxLL; ll++) - optPtr->litLengthFreq[ll] = 1; + { unsigned const baseLLfreqs[MaxLL+1] = { + 4, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1 + }; + ZSTD_memcpy(optPtr->litLengthFreq, baseLLfreqs, sizeof(baseLLfreqs)); + optPtr->litLengthSum = sum_u32(baseLLfreqs, MaxLL+1); } - optPtr->litLengthSum = MaxLL+1; { unsigned ml; for (ml=0; ml<=MaxML; ml++) @@ -189,21 +233,25 @@ ZSTD_rescaleFreqs(optState_t* const optPtr, } optPtr->matchLengthSum = MaxML+1; - { unsigned of; - for (of=0; of<=MaxOff; of++) - optPtr->offCodeFreq[of] = 1; + { unsigned const baseOFCfreqs[MaxOff+1] = { + 6, 2, 1, 1, 2, 3, 4, 4, + 4, 3, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1 + }; + ZSTD_memcpy(optPtr->offCodeFreq, baseOFCfreqs, sizeof(baseOFCfreqs)); + optPtr->offCodeSum = sum_u32(baseOFCfreqs, MaxOff+1); } - optPtr->offCodeSum = MaxOff+1; } - } else { /* new block : re-use previous statistics, scaled down */ + } else { /* new block : scale down accumulated statistics */ if (compressedLiterals) - optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); - optPtr->litLengthSum = ZSTD_downscaleStat(optPtr->litLengthFreq, MaxLL, 0); - optPtr->matchLengthSum = ZSTD_downscaleStat(optPtr->matchLengthFreq, MaxML, 0); - optPtr->offCodeSum = ZSTD_downscaleStat(optPtr->offCodeFreq, MaxOff, 0); + optPtr->litSum = ZSTD_scaleStats(optPtr->litFreq, MaxLit, 12); + optPtr->litLengthSum = ZSTD_scaleStats(optPtr->litLengthFreq, MaxLL, 11); + optPtr->matchLengthSum = ZSTD_scaleStats(optPtr->matchLengthFreq, MaxML, 11); + optPtr->offCodeSum = ZSTD_scaleStats(optPtr->offCodeFreq, MaxOff, 11); } ZSTD_setBasePrices(optPtr, optLevel); @@ -225,11 +273,14 @@ static U32 ZSTD_rawLiteralsCost(const BYTE* const literals, U32 const litLength, return (litLength*6) * BITCOST_MULTIPLIER; /* 6 bit per literal - no statistic used */ /* dynamic statistics */ - { U32 price = litLength * optPtr->litSumBasePrice; + { U32 price = optPtr->litSumBasePrice * litLength; + U32 const litPriceMax = optPtr->litSumBasePrice - BITCOST_MULTIPLIER; U32 u; + assert(optPtr->litSumBasePrice >= BITCOST_MULTIPLIER); for (u=0; u < litLength; u++) { - assert(WEIGHT(optPtr->litFreq[literals[u]], optLevel) <= optPtr->litSumBasePrice); /* literal cost should never be negative */ - price -= WEIGHT(optPtr->litFreq[literals[u]], optLevel); + U32 litPrice = WEIGHT(optPtr->litFreq[literals[u]], optLevel); + if (UNLIKELY(litPrice > litPriceMax)) litPrice = litPriceMax; + price -= litPrice; } return price; } @@ -239,7 +290,17 @@ static U32 ZSTD_rawLiteralsCost(const BYTE* const literals, U32 const litLength, * cost of literalLength symbol */ static U32 ZSTD_litLengthPrice(U32 const litLength, const optState_t* const optPtr, int optLevel) { - if (optPtr->priceType == zop_predef) return WEIGHT(litLength, optLevel); + assert(litLength <= ZSTD_BLOCKSIZE_MAX); + if (optPtr->priceType == zop_predef) + return WEIGHT(litLength, optLevel); + + /* ZSTD_LLcode() can't compute litLength price for sizes >= ZSTD_BLOCKSIZE_MAX + * because it isn't representable in the zstd format. + * So instead just pretend it would cost 1 bit more than ZSTD_BLOCKSIZE_MAX - 1. + * In such a case, the block would be all literals. + */ + if (litLength == ZSTD_BLOCKSIZE_MAX) + return BITCOST_MULTIPLIER + ZSTD_litLengthPrice(ZSTD_BLOCKSIZE_MAX - 1, optPtr, optLevel); /* dynamic statistics */ { U32 const llCode = ZSTD_LLcode(litLength); @@ -250,22 +311,25 @@ static U32 ZSTD_litLengthPrice(U32 const litLength, const optState_t* const optP } /* ZSTD_getMatchPrice() : - * Provides the cost of the match part (offset + matchLength) of a sequence + * Provides the cost of the match part (offset + matchLength) of a sequence. * Must be combined with ZSTD_fullLiteralsCost() to get the full cost of a sequence. - * optLevel: when <2, favors small offset for decompression speed (improved cache efficiency) */ + * @offBase : sumtype, representing an offset or a repcode, and using numeric representation of ZSTD_storeSeq() + * @optLevel: when <2, favors small offset for decompression speed (improved cache efficiency) + */ FORCE_INLINE_TEMPLATE U32 -ZSTD_getMatchPrice(U32 const offset, +ZSTD_getMatchPrice(U32 const offBase, U32 const matchLength, const optState_t* const optPtr, int const optLevel) { U32 price; - U32 const offCode = ZSTD_highbit32(offset+1); + U32 const offCode = ZSTD_highbit32(offBase); U32 const mlBase = matchLength - MINMATCH; assert(matchLength >= MINMATCH); - if (optPtr->priceType == zop_predef) /* fixed scheme, do not use statistics */ - return WEIGHT(mlBase, optLevel) + ((16 + offCode) * BITCOST_MULTIPLIER); + if (optPtr->priceType == zop_predef) /* fixed scheme, does not use statistics */ + return WEIGHT(mlBase, optLevel) + + ((16 + offCode) * BITCOST_MULTIPLIER); /* emulated offset cost */ /* dynamic statistics */ price = (offCode * BITCOST_MULTIPLIER) + (optPtr->offCodeSumBasePrice - WEIGHT(optPtr->offCodeFreq[offCode], optLevel)); @@ -284,10 +348,10 @@ ZSTD_getMatchPrice(U32 const offset, } /* ZSTD_updateStats() : - * assumption : literals + litLengtn <= iend */ + * assumption : literals + litLength <= iend */ static void ZSTD_updateStats(optState_t* const optPtr, U32 litLength, const BYTE* literals, - U32 offsetCode, U32 matchLength) + U32 offBase, U32 matchLength) { /* literals */ if (ZSTD_compressedLiterals(optPtr)) { @@ -303,8 +367,8 @@ static void ZSTD_updateStats(optState_t* const optPtr, optPtr->litLengthSum++; } - /* match offset code (0-2=>repCode; 3+=>offset+2) */ - { U32 const offCode = ZSTD_highbit32(offsetCode+1); + /* offset code : follows storeSeq() numeric representation */ + { U32 const offCode = ZSTD_highbit32(offBase); assert(offCode <= MaxOff); optPtr->offCodeFreq[offCode]++; optPtr->offCodeSum++; @@ -338,7 +402,7 @@ MEM_STATIC U32 ZSTD_readMINMATCH(const void* memPtr, U32 length) /* Update hashTable3 up to ip (excluded) Assumption : always within prefix (i.e. not within extDict) */ -static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_matchState_t* ms, +static U32 ZSTD_insertAndFindFirstIndexHash3 (const ZSTD_matchState_t* ms, U32* nextToUpdate3, const BYTE* const ip) { @@ -364,11 +428,13 @@ static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_matchState_t* ms, * Binary Tree search ***************************************/ /** ZSTD_insertBt1() : add one or multiple positions to tree. - * ip : assumed <= iend-8 . + * @param ip assumed <= iend-8 . + * @param target The target of ZSTD_updateTree_internal() - we are filling to this position * @return : nb of positions added */ static U32 ZSTD_insertBt1( - ZSTD_matchState_t* ms, + const ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, + U32 const target, U32 const mls, const int extDict) { const ZSTD_compressionParameters* const cParams = &ms->cParams; @@ -391,7 +457,10 @@ static U32 ZSTD_insertBt1( U32* smallerPtr = bt + 2*(curr&btMask); U32* largerPtr = smallerPtr + 1; U32 dummy32; /* to be nullified at the end */ - U32 const windowLow = ms->window.lowLimit; + /* windowLow is based on target because + * we only need positions that will be in the window at the end of the tree update. + */ + U32 const windowLow = ZSTD_getLowestMatchIndex(ms, target, cParams->windowLog); U32 matchEndIdx = curr+8+1; size_t bestLength = 8; U32 nbCompares = 1U << cParams->searchLog; @@ -404,11 +473,12 @@ static U32 ZSTD_insertBt1( DEBUGLOG(8, "ZSTD_insertBt1 (%u)", curr); + assert(curr <= target); assert(ip <= iend-8); /* required for h calculation */ hashTable[h] = curr; /* Update Hash Table */ assert(windowLow > 0); - while (nbCompares-- && (matchIndex >= windowLow)) { + for (; nbCompares && (matchIndex >= windowLow); --nbCompares) { U32* const nextPtr = bt + 2*(matchIndex & btMask); size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ assert(matchIndex < curr); @@ -492,7 +562,7 @@ void ZSTD_updateTree_internal( idx, target, dictMode); while(idx < target) { - U32 const forward = ZSTD_insertBt1(ms, base+idx, iend, mls, dictMode == ZSTD_extDict); + U32 const forward = ZSTD_insertBt1(ms, base+idx, iend, target, mls, dictMode == ZSTD_extDict); assert(idx < (U32)(idx + forward)); idx += forward; } @@ -505,16 +575,17 @@ void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend) { ZSTD_updateTree_internal(ms, ip, iend, ms->cParams.minMatch, ZSTD_noDict); } -FORCE_INLINE_TEMPLATE -U32 ZSTD_insertBtAndGetAllMatches ( - ZSTD_match_t* matches, /* store result (found matches) in this table (presumed large enough) */ - ZSTD_matchState_t* ms, - U32* nextToUpdate3, - const BYTE* const ip, const BYTE* const iLimit, const ZSTD_dictMode_e dictMode, - const U32 rep[ZSTD_REP_NUM], - U32 const ll0, /* tells if associated literal length is 0 or not. This value must be 0 or 1 */ - const U32 lengthToBeat, - U32 const mls /* template */) +FORCE_INLINE_TEMPLATE U32 +ZSTD_insertBtAndGetAllMatches ( + ZSTD_match_t* matches, /* store result (found matches) in this table (presumed large enough) */ + ZSTD_matchState_t* ms, + U32* nextToUpdate3, + const BYTE* const ip, const BYTE* const iLimit, + const ZSTD_dictMode_e dictMode, + const U32 rep[ZSTD_REP_NUM], + const U32 ll0, /* tells if associated literal length is 0 or not. This value must be 0 or 1 */ + const U32 lengthToBeat, + const U32 mls /* template */) { const ZSTD_compressionParameters* const cParams = &ms->cParams; U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1); @@ -597,7 +668,7 @@ U32 ZSTD_insertBtAndGetAllMatches ( DEBUGLOG(8, "found repCode %u (ll0:%u, offset:%u) of length %u", repCode, ll0, repOffset, repLen); bestLength = repLen; - matches[mnum].off = repCode - ll0; + matches[mnum].off = REPCODE_TO_OFFBASE(repCode - ll0 + 1); /* expect value between 1 and 3 */ matches[mnum].len = (U32)repLen; mnum++; if ( (repLen > sufficient_len) @@ -626,7 +697,7 @@ U32 ZSTD_insertBtAndGetAllMatches ( bestLength = mlen; assert(curr > matchIndex3); assert(mnum==0); /* no prior solution */ - matches[0].off = (curr - matchIndex3) + ZSTD_REP_MOVE; + matches[0].off = OFFSET_TO_OFFBASE(curr - matchIndex3); matches[0].len = (U32)mlen; mnum = 1; if ( (mlen > sufficient_len) | @@ -635,11 +706,11 @@ U32 ZSTD_insertBtAndGetAllMatches ( return 1; } } } /* no dictMatchState lookup: dicts don't have a populated HC3 table */ - } + } /* if (mls == 3) */ hashTable[h] = curr; /* Update Hash Table */ - while (nbCompares-- && (matchIndex >= matchLow)) { + for (; nbCompares && (matchIndex >= matchLow); --nbCompares) { U32* const nextPtr = bt + 2*(matchIndex & btMask); const BYTE* match; size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ @@ -659,21 +730,20 @@ U32 ZSTD_insertBtAndGetAllMatches ( } if (matchLength > bestLength) { - DEBUGLOG(8, "found match of length %u at distance %u (offCode=%u)", - (U32)matchLength, curr - matchIndex, curr - matchIndex + ZSTD_REP_MOVE); + DEBUGLOG(8, "found match of length %u at distance %u (offBase=%u)", + (U32)matchLength, curr - matchIndex, OFFSET_TO_OFFBASE(curr - matchIndex)); assert(matchEndIdx > matchIndex); if (matchLength > matchEndIdx - matchIndex) matchEndIdx = matchIndex + (U32)matchLength; bestLength = matchLength; - matches[mnum].off = (curr - matchIndex) + ZSTD_REP_MOVE; + matches[mnum].off = OFFSET_TO_OFFBASE(curr - matchIndex); matches[mnum].len = (U32)matchLength; mnum++; if ( (matchLength > ZSTD_OPT_NUM) | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) { if (dictMode == ZSTD_dictMatchState) nbCompares = 0; /* break should also skip searching dms */ break; /* drop, to preserve bt consistency (miss a little bit of compression) */ - } - } + } } if (match[matchLength] < ip[matchLength]) { /* match smaller than current */ @@ -692,12 +762,13 @@ U32 ZSTD_insertBtAndGetAllMatches ( *smallerPtr = *largerPtr = 0; + assert(nbCompares <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */ if (dictMode == ZSTD_dictMatchState && nbCompares) { size_t const dmsH = ZSTD_hashPtr(ip, dmsHashLog, mls); U32 dictMatchIndex = dms->hashTable[dmsH]; const U32* const dmsBt = dms->chainTable; commonLengthSmaller = commonLengthLarger = 0; - while (nbCompares-- && (dictMatchIndex > dmsLowLimit)) { + for (; nbCompares && (dictMatchIndex > dmsLowLimit); --nbCompares) { const U32* const nextPtr = dmsBt + 2*(dictMatchIndex & dmsBtMask); size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ const BYTE* match = dmsBase + dictMatchIndex; @@ -707,19 +778,18 @@ U32 ZSTD_insertBtAndGetAllMatches ( if (matchLength > bestLength) { matchIndex = dictMatchIndex + dmsIndexDelta; - DEBUGLOG(8, "found dms match of length %u at distance %u (offCode=%u)", - (U32)matchLength, curr - matchIndex, curr - matchIndex + ZSTD_REP_MOVE); + DEBUGLOG(8, "found dms match of length %u at distance %u (offBase=%u)", + (U32)matchLength, curr - matchIndex, OFFSET_TO_OFFBASE(curr - matchIndex)); if (matchLength > matchEndIdx - matchIndex) matchEndIdx = matchIndex + (U32)matchLength; bestLength = matchLength; - matches[mnum].off = (curr - matchIndex) + ZSTD_REP_MOVE; + matches[mnum].off = OFFSET_TO_OFFBASE(curr - matchIndex); matches[mnum].len = (U32)matchLength; mnum++; if ( (matchLength > ZSTD_OPT_NUM) | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) { break; /* drop, to guarantee consistency (miss a little bit of compression) */ - } - } + } } if (dictMatchIndex <= dmsBtLow) { break; } /* beyond tree size, stop the search */ if (match[matchLength] < ip[matchLength]) { @@ -729,39 +799,91 @@ U32 ZSTD_insertBtAndGetAllMatches ( /* match is larger than current */ commonLengthLarger = matchLength; dictMatchIndex = nextPtr[0]; - } - } - } + } } } /* if (dictMode == ZSTD_dictMatchState) */ assert(matchEndIdx > curr+8); ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */ return mnum; } +typedef U32 (*ZSTD_getAllMatchesFn)( + ZSTD_match_t*, + ZSTD_matchState_t*, + U32*, + const BYTE*, + const BYTE*, + const U32 rep[ZSTD_REP_NUM], + U32 const ll0, + U32 const lengthToBeat); -FORCE_INLINE_TEMPLATE U32 ZSTD_BtGetAllMatches ( - ZSTD_match_t* matches, /* store result (match found, increasing size) in this table */ - ZSTD_matchState_t* ms, - U32* nextToUpdate3, - const BYTE* ip, const BYTE* const iHighLimit, const ZSTD_dictMode_e dictMode, - const U32 rep[ZSTD_REP_NUM], - U32 const ll0, - U32 const lengthToBeat) +FORCE_INLINE_TEMPLATE U32 ZSTD_btGetAllMatches_internal( + ZSTD_match_t* matches, + ZSTD_matchState_t* ms, + U32* nextToUpdate3, + const BYTE* ip, + const BYTE* const iHighLimit, + const U32 rep[ZSTD_REP_NUM], + U32 const ll0, + U32 const lengthToBeat, + const ZSTD_dictMode_e dictMode, + const U32 mls) { - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32 const matchLengthSearch = cParams->minMatch; - DEBUGLOG(8, "ZSTD_BtGetAllMatches"); - if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */ - ZSTD_updateTree_internal(ms, ip, iHighLimit, matchLengthSearch, dictMode); - switch(matchLengthSearch) - { - case 3 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 3); - default : - case 4 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 4); - case 5 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 5); - case 7 : - case 6 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 6); + assert(BOUNDED(3, ms->cParams.minMatch, 6) == mls); + DEBUGLOG(8, "ZSTD_BtGetAllMatches(dictMode=%d, mls=%u)", (int)dictMode, mls); + if (ip < ms->window.base + ms->nextToUpdate) + return 0; /* skipped area */ + ZSTD_updateTree_internal(ms, ip, iHighLimit, mls, dictMode); + return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, mls); +} + +#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls) ZSTD_btGetAllMatches_##dictMode##_##mls + +#define GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, mls) \ + static U32 ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls)( \ + ZSTD_match_t* matches, \ + ZSTD_matchState_t* ms, \ + U32* nextToUpdate3, \ + const BYTE* ip, \ + const BYTE* const iHighLimit, \ + const U32 rep[ZSTD_REP_NUM], \ + U32 const ll0, \ + U32 const lengthToBeat) \ + { \ + return ZSTD_btGetAllMatches_internal( \ + matches, ms, nextToUpdate3, ip, iHighLimit, \ + rep, ll0, lengthToBeat, ZSTD_##dictMode, mls); \ } + +#define GEN_ZSTD_BT_GET_ALL_MATCHES(dictMode) \ + GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, 3) \ + GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, 4) \ + GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, 5) \ + GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, 6) + +GEN_ZSTD_BT_GET_ALL_MATCHES(noDict) +GEN_ZSTD_BT_GET_ALL_MATCHES(extDict) +GEN_ZSTD_BT_GET_ALL_MATCHES(dictMatchState) + +#define ZSTD_BT_GET_ALL_MATCHES_ARRAY(dictMode) \ + { \ + ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 3), \ + ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 4), \ + ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 5), \ + ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 6) \ + } + +static ZSTD_getAllMatchesFn +ZSTD_selectBtGetAllMatches(ZSTD_matchState_t const* ms, ZSTD_dictMode_e const dictMode) +{ + ZSTD_getAllMatchesFn const getAllMatchesFns[3][4] = { + ZSTD_BT_GET_ALL_MATCHES_ARRAY(noDict), + ZSTD_BT_GET_ALL_MATCHES_ARRAY(extDict), + ZSTD_BT_GET_ALL_MATCHES_ARRAY(dictMatchState) + }; + U32 const mls = BOUNDED(3, ms->cParams.minMatch, 6); + assert((U32)dictMode < 3); + assert(mls - 3 < 4); + return getAllMatchesFns[(int)dictMode][mls - 3]; } /************************* @@ -770,16 +892,18 @@ FORCE_INLINE_TEMPLATE U32 ZSTD_BtGetAllMatches ( /* Struct containing info needed to make decision about ldm inclusion */ typedef struct { - rawSeqStore_t seqStore; /* External match candidates store for this block */ - U32 startPosInBlock; /* Start position of the current match candidate */ - U32 endPosInBlock; /* End position of the current match candidate */ - U32 offset; /* Offset of the match candidate */ + rawSeqStore_t seqStore; /* External match candidates store for this block */ + U32 startPosInBlock; /* Start position of the current match candidate */ + U32 endPosInBlock; /* End position of the current match candidate */ + U32 offset; /* Offset of the match candidate */ } ZSTD_optLdm_t; /* ZSTD_optLdm_skipRawSeqStoreBytes(): - * Moves forward in rawSeqStore by nbBytes, which will update the fields 'pos' and 'posInSequence'. + * Moves forward in @rawSeqStore by @nbBytes, + * which will update the fields 'pos' and 'posInSequence'. */ -static void ZSTD_optLdm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes) { +static void ZSTD_optLdm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes) +{ U32 currPos = (U32)(rawSeqStore->posInSequence + nbBytes); while (currPos && rawSeqStore->pos < rawSeqStore->size) { rawSeq currSeq = rawSeqStore->seq[rawSeqStore->pos]; @@ -800,8 +924,10 @@ static void ZSTD_optLdm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t * Calculates the beginning and end of the next match in the current block. * Updates 'pos' and 'posInSequence' of the ldmSeqStore. */ -static void ZSTD_opt_getNextMatchAndUpdateSeqStore(ZSTD_optLdm_t* optLdm, U32 currPosInBlock, - U32 blockBytesRemaining) { +static void +ZSTD_opt_getNextMatchAndUpdateSeqStore(ZSTD_optLdm_t* optLdm, U32 currPosInBlock, + U32 blockBytesRemaining) +{ rawSeq currSeq; U32 currBlockEndPos; U32 literalsBytesRemaining; @@ -813,8 +939,8 @@ static void ZSTD_opt_getNextMatchAndUpdateSeqStore(ZSTD_optLdm_t* optLdm, U32 cu optLdm->endPosInBlock = UINT_MAX; return; } - /* Calculate appropriate bytes left in matchLength and litLength after adjusting - based on ldmSeqStore->posInSequence */ + /* Calculate appropriate bytes left in matchLength and litLength + * after adjusting based on ldmSeqStore->posInSequence */ currSeq = optLdm->seqStore.seq[optLdm->seqStore.pos]; assert(optLdm->seqStore.posInSequence <= currSeq.litLength + currSeq.matchLength); currBlockEndPos = currPosInBlock + blockBytesRemaining; @@ -850,15 +976,16 @@ static void ZSTD_opt_getNextMatchAndUpdateSeqStore(ZSTD_optLdm_t* optLdm, U32 cu } /* ZSTD_optLdm_maybeAddMatch(): - * Adds a match if it's long enough, based on it's 'matchStartPosInBlock' - * and 'matchEndPosInBlock', into 'matches'. Maintains the correct ordering of 'matches' + * Adds a match if it's long enough, + * based on it's 'matchStartPosInBlock' and 'matchEndPosInBlock', + * into 'matches'. Maintains the correct ordering of 'matches'. */ static void ZSTD_optLdm_maybeAddMatch(ZSTD_match_t* matches, U32* nbMatches, - ZSTD_optLdm_t* optLdm, U32 currPosInBlock) { - U32 posDiff = currPosInBlock - optLdm->startPosInBlock; - /* Note: ZSTD_match_t actually contains offCode and matchLength (before subtracting MINMATCH) */ - U32 candidateMatchLength = optLdm->endPosInBlock - optLdm->startPosInBlock - posDiff; - U32 candidateOffCode = optLdm->offset + ZSTD_REP_MOVE; + const ZSTD_optLdm_t* optLdm, U32 currPosInBlock) +{ + U32 const posDiff = currPosInBlock - optLdm->startPosInBlock; + /* Note: ZSTD_match_t actually contains offBase and matchLength (before subtracting MINMATCH) */ + U32 const candidateMatchLength = optLdm->endPosInBlock - optLdm->startPosInBlock - posDiff; /* Ensure that current block position is not outside of the match */ if (currPosInBlock < optLdm->startPosInBlock @@ -868,10 +995,11 @@ static void ZSTD_optLdm_maybeAddMatch(ZSTD_match_t* matches, U32* nbMatches, } if (*nbMatches == 0 || ((candidateMatchLength > matches[*nbMatches-1].len) && *nbMatches < ZSTD_OPT_NUM)) { - DEBUGLOG(6, "ZSTD_optLdm_maybeAddMatch(): Adding ldm candidate match (offCode: %u matchLength %u) at block position=%u", - candidateOffCode, candidateMatchLength, currPosInBlock); + U32 const candidateOffBase = OFFSET_TO_OFFBASE(optLdm->offset); + DEBUGLOG(6, "ZSTD_optLdm_maybeAddMatch(): Adding ldm candidate match (offBase: %u matchLength %u) at block position=%u", + candidateOffBase, candidateMatchLength, currPosInBlock); matches[*nbMatches].len = candidateMatchLength; - matches[*nbMatches].off = candidateOffCode; + matches[*nbMatches].off = candidateOffBase; (*nbMatches)++; } } @@ -879,8 +1007,11 @@ static void ZSTD_optLdm_maybeAddMatch(ZSTD_match_t* matches, U32* nbMatches, /* ZSTD_optLdm_processMatchCandidate(): * Wrapper function to update ldm seq store and call ldm functions as necessary. */ -static void ZSTD_optLdm_processMatchCandidate(ZSTD_optLdm_t* optLdm, ZSTD_match_t* matches, U32* nbMatches, - U32 currPosInBlock, U32 remainingBytes) { +static void +ZSTD_optLdm_processMatchCandidate(ZSTD_optLdm_t* optLdm, + ZSTD_match_t* matches, U32* nbMatches, + U32 currPosInBlock, U32 remainingBytes) +{ if (optLdm->seqStore.size == 0 || optLdm->seqStore.pos >= optLdm->seqStore.size) { return; } @@ -891,19 +1022,19 @@ static void ZSTD_optLdm_processMatchCandidate(ZSTD_optLdm_t* optLdm, ZSTD_match_ * at the end of a match from the ldm seq store, and will often be some bytes * over beyond matchEndPosInBlock. As such, we need to correct for these "overshoots" */ - U32 posOvershoot = currPosInBlock - optLdm->endPosInBlock; + U32 const posOvershoot = currPosInBlock - optLdm->endPosInBlock; ZSTD_optLdm_skipRawSeqStoreBytes(&optLdm->seqStore, posOvershoot); - } + } ZSTD_opt_getNextMatchAndUpdateSeqStore(optLdm, currPosInBlock, remainingBytes); } ZSTD_optLdm_maybeAddMatch(matches, nbMatches, optLdm, currPosInBlock); } + /*-******************************* * Optimal parser *********************************/ - static U32 ZSTD_totalLen(ZSTD_optimal_t sol) { return sol.litlen + sol.mlen; @@ -944,6 +1075,8 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, const BYTE* const prefixStart = base + ms->window.dictLimit; const ZSTD_compressionParameters* const cParams = &ms->cParams; + ZSTD_getAllMatchesFn getAllMatches = ZSTD_selectBtGetAllMatches(ms, dictMode); + U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1); U32 const minMatch = (cParams->minMatch == 3) ? 3 : 4; U32 nextToUpdate3 = ms->nextToUpdate; @@ -971,7 +1104,7 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, /* find first match */ { U32 const litlen = (U32)(ip - anchor); U32 const ll0 = !litlen; - U32 nbMatches = ZSTD_BtGetAllMatches(matches, ms, &nextToUpdate3, ip, iend, dictMode, rep, ll0, minMatch); + U32 nbMatches = getAllMatches(matches, ms, &nextToUpdate3, ip, iend, rep, ll0, minMatch); ZSTD_optLdm_processMatchCandidate(&optLdm, matches, &nbMatches, (U32)(ip-istart), (U32)(iend - ip)); if (!nbMatches) { ip++; continue; } @@ -985,18 +1118,18 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, * in every price. We include the literal length to avoid negative * prices when we subtract the previous literal length. */ - opt[0].price = ZSTD_litLengthPrice(litlen, optStatePtr, optLevel); + opt[0].price = (int)ZSTD_litLengthPrice(litlen, optStatePtr, optLevel); /* large match -> immediate encoding */ { U32 const maxML = matches[nbMatches-1].len; - U32 const maxOffset = matches[nbMatches-1].off; - DEBUGLOG(6, "found %u matches of maxLength=%u and maxOffCode=%u at cPos=%u => start new series", - nbMatches, maxML, maxOffset, (U32)(ip-prefixStart)); + U32 const maxOffBase = matches[nbMatches-1].off; + DEBUGLOG(6, "found %u matches of maxLength=%u and maxOffBase=%u at cPos=%u => start new series", + nbMatches, maxML, maxOffBase, (U32)(ip-prefixStart)); if (maxML > sufficient_len) { lastSequence.litlen = litlen; lastSequence.mlen = maxML; - lastSequence.off = maxOffset; + lastSequence.off = maxOffBase; DEBUGLOG(6, "large match (%u>%u), immediate encoding", maxML, sufficient_len); cur = 0; @@ -1005,24 +1138,25 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, } } /* set prices for first matches starting position == 0 */ - { U32 const literalsPrice = opt[0].price + ZSTD_litLengthPrice(0, optStatePtr, optLevel); + assert(opt[0].price >= 0); + { U32 const literalsPrice = (U32)opt[0].price + ZSTD_litLengthPrice(0, optStatePtr, optLevel); U32 pos; U32 matchNb; for (pos = 1; pos < minMatch; pos++) { opt[pos].price = ZSTD_MAX_PRICE; /* mlen, litlen and price will be fixed during forward scanning */ } for (matchNb = 0; matchNb < nbMatches; matchNb++) { - U32 const offset = matches[matchNb].off; + U32 const offBase = matches[matchNb].off; U32 const end = matches[matchNb].len; for ( ; pos <= end ; pos++ ) { - U32 const matchPrice = ZSTD_getMatchPrice(offset, pos, optStatePtr, optLevel); + U32 const matchPrice = ZSTD_getMatchPrice(offBase, pos, optStatePtr, optLevel); U32 const sequencePrice = literalsPrice + matchPrice; DEBUGLOG(7, "rPos:%u => set initial price : %.2f", - pos, ZSTD_fCost(sequencePrice)); + pos, ZSTD_fCost((int)sequencePrice)); opt[pos].mlen = pos; - opt[pos].off = offset; + opt[pos].off = offBase; opt[pos].litlen = litlen; - opt[pos].price = sequencePrice; + opt[pos].price = (int)sequencePrice; } } last_pos = pos-1; } @@ -1037,9 +1171,9 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, /* Fix current position with one literal if cheaper */ { U32 const litlen = (opt[cur-1].mlen == 0) ? opt[cur-1].litlen + 1 : 1; int const price = opt[cur-1].price - + ZSTD_rawLiteralsCost(ip+cur-1, 1, optStatePtr, optLevel) - + ZSTD_litLengthPrice(litlen, optStatePtr, optLevel) - - ZSTD_litLengthPrice(litlen-1, optStatePtr, optLevel); + + (int)ZSTD_rawLiteralsCost(ip+cur-1, 1, optStatePtr, optLevel) + + (int)ZSTD_litLengthPrice(litlen, optStatePtr, optLevel) + - (int)ZSTD_litLengthPrice(litlen-1, optStatePtr, optLevel); assert(price < 1000000000); /* overflow check */ if (price <= opt[cur].price) { DEBUGLOG(7, "cPos:%zi==rPos:%u : better price (%.2f<=%.2f) using literal (ll==%u) (hist:%u,%u,%u)", @@ -1065,7 +1199,7 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, assert(cur >= opt[cur].mlen); if (opt[cur].mlen != 0) { U32 const prev = cur - opt[cur].mlen; - repcodes_t newReps = ZSTD_updateRep(opt[prev].rep, opt[cur].off, opt[cur].litlen==0); + repcodes_t const newReps = ZSTD_newRep(opt[prev].rep, opt[cur].off, opt[cur].litlen==0); ZSTD_memcpy(opt[cur].rep, &newReps, sizeof(repcodes_t)); } else { ZSTD_memcpy(opt[cur].rep, opt[cur - 1].rep, sizeof(repcodes_t)); @@ -1082,11 +1216,12 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, continue; /* skip unpromising positions; about ~+6% speed, -0.01 ratio */ } + assert(opt[cur].price >= 0); { U32 const ll0 = (opt[cur].mlen != 0); U32 const litlen = (opt[cur].mlen == 0) ? opt[cur].litlen : 0; - U32 const previousPrice = opt[cur].price; + U32 const previousPrice = (U32)opt[cur].price; U32 const basePrice = previousPrice + ZSTD_litLengthPrice(0, optStatePtr, optLevel); - U32 nbMatches = ZSTD_BtGetAllMatches(matches, ms, &nextToUpdate3, inr, iend, dictMode, opt[cur].rep, ll0, minMatch); + U32 nbMatches = getAllMatches(matches, ms, &nextToUpdate3, inr, iend, opt[cur].rep, ll0, minMatch); U32 matchNb; ZSTD_optLdm_processMatchCandidate(&optLdm, matches, &nbMatches, @@ -1119,12 +1254,12 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, U32 const startML = (matchNb>0) ? matches[matchNb-1].len+1 : minMatch; U32 mlen; - DEBUGLOG(7, "testing match %u => offCode=%4u, mlen=%2u, llen=%2u", + DEBUGLOG(7, "testing match %u => offBase=%4u, mlen=%2u, llen=%2u", matchNb, matches[matchNb].off, lastML, litlen); for (mlen = lastML; mlen >= startML; mlen--) { /* scan downward */ U32 const pos = cur + mlen; - int const price = basePrice + ZSTD_getMatchPrice(offset, mlen, optStatePtr, optLevel); + int const price = (int)basePrice + (int)ZSTD_getMatchPrice(offset, mlen, optStatePtr, optLevel); if ((pos > last_pos) || (price < opt[pos].price)) { DEBUGLOG(7, "rPos:%u (ml=%2u) => new better price (%.2f<%.2f)", @@ -1154,7 +1289,7 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ * update them while traversing the sequences. */ if (lastSequence.mlen != 0) { - repcodes_t reps = ZSTD_updateRep(opt[cur].rep, lastSequence.off, lastSequence.litlen==0); + repcodes_t const reps = ZSTD_newRep(opt[cur].rep, lastSequence.off, lastSequence.litlen==0); ZSTD_memcpy(rep, &reps, sizeof(reps)); } else { ZSTD_memcpy(rep, opt[cur].rep, sizeof(repcodes_t)); @@ -1185,7 +1320,7 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ for (storePos=storeStart; storePos <= storeEnd; storePos++) { U32 const llen = opt[storePos].litlen; U32 const mlen = opt[storePos].mlen; - U32 const offCode = opt[storePos].off; + U32 const offBase = opt[storePos].off; U32 const advance = llen + mlen; DEBUGLOG(6, "considering seq starting at %zi, llen=%u, mlen=%u", anchor - istart, (unsigned)llen, (unsigned)mlen); @@ -1197,8 +1332,8 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ } assert(anchor + llen <= iend); - ZSTD_updateStats(optStatePtr, llen, anchor, offCode, mlen); - ZSTD_storeSeq(seqStore, llen, anchor, iend, offCode, mlen-MINMATCH); + ZSTD_updateStats(optStatePtr, llen, anchor, offBase, mlen); + ZSTD_storeSeq(seqStore, llen, anchor, iend, offBase, mlen); anchor += advance; ip = anchor; } } @@ -1210,43 +1345,35 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ return (size_t)(iend - anchor); } +static size_t ZSTD_compressBlock_opt0( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + const void* src, size_t srcSize, const ZSTD_dictMode_e dictMode) +{ + return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /* optLevel */, dictMode); +} + +static size_t ZSTD_compressBlock_opt2( + ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], + const void* src, size_t srcSize, const ZSTD_dictMode_e dictMode) +{ + return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /* optLevel */, dictMode); +} size_t ZSTD_compressBlock_btopt( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) { DEBUGLOG(5, "ZSTD_compressBlock_btopt"); - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /*optLevel*/, ZSTD_noDict); + return ZSTD_compressBlock_opt0(ms, seqStore, rep, src, srcSize, ZSTD_noDict); } -/* used in 2-pass strategy */ -static U32 ZSTD_upscaleStat(unsigned* table, U32 lastEltIndex, int bonus) -{ - U32 s, sum=0; - assert(ZSTD_FREQ_DIV+bonus >= 0); - for (s=0; slitSum = ZSTD_upscaleStat(optPtr->litFreq, MaxLit, 0); - optPtr->litLengthSum = ZSTD_upscaleStat(optPtr->litLengthFreq, MaxLL, 0); - optPtr->matchLengthSum = ZSTD_upscaleStat(optPtr->matchLengthFreq, MaxML, 0); - optPtr->offCodeSum = ZSTD_upscaleStat(optPtr->offCodeFreq, MaxOff, 0); -} /* ZSTD_initStats_ultra(): * make a first compression pass, just to seed stats with more accurate starting values. * only works on first block, with no dictionary and no ldm. - * this function cannot error, hence its contract must be respected. + * this function cannot error out, its narrow contract must be respected. */ static void ZSTD_initStats_ultra(ZSTD_matchState_t* ms, @@ -1263,17 +1390,15 @@ ZSTD_initStats_ultra(ZSTD_matchState_t* ms, assert(ms->window.dictLimit == ms->window.lowLimit); /* no dictionary */ assert(ms->window.dictLimit - ms->nextToUpdate <= 1); /* no prefix (note: intentional overflow, defined as 2-complement) */ - ZSTD_compressBlock_opt_generic(ms, seqStore, tmpRep, src, srcSize, 2 /*optLevel*/, ZSTD_noDict); /* generate stats into ms->opt*/ + ZSTD_compressBlock_opt2(ms, seqStore, tmpRep, src, srcSize, ZSTD_noDict); /* generate stats into ms->opt*/ - /* invalidate first scan from history */ + /* invalidate first scan from history, only keep entropy stats */ ZSTD_resetSeqStore(seqStore); ms->window.base -= srcSize; ms->window.dictLimit += (U32)srcSize; ms->window.lowLimit = ms->window.dictLimit; ms->nextToUpdate = ms->window.dictLimit; - /* re-inforce weight of collected statistics */ - ZSTD_upscaleStats(&ms->opt); } size_t ZSTD_compressBlock_btultra( @@ -1281,7 +1406,7 @@ size_t ZSTD_compressBlock_btultra( const void* src, size_t srcSize) { DEBUGLOG(5, "ZSTD_compressBlock_btultra (srcSize=%zu)", srcSize); - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_noDict); + return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_noDict); } size_t ZSTD_compressBlock_btultra2( @@ -1291,53 +1416,53 @@ size_t ZSTD_compressBlock_btultra2( U32 const curr = (U32)((const BYTE*)src - ms->window.base); DEBUGLOG(5, "ZSTD_compressBlock_btultra2 (srcSize=%zu)", srcSize); - /* 2-pass strategy: + /* 2-passes strategy: * this strategy makes a first pass over first block to collect statistics - * and seed next round's statistics with it. - * After 1st pass, function forgets everything, and starts a new block. + * in order to seed next round's statistics with it. + * After 1st pass, function forgets history, and starts a new block. * Consequently, this can only work if no data has been previously loaded in tables, * aka, no dictionary, no prefix, no ldm preprocessing. * The compression ratio gain is generally small (~0.5% on first block), - * the cost is 2x cpu time on first block. */ + ** the cost is 2x cpu time on first block. */ assert(srcSize <= ZSTD_BLOCKSIZE_MAX); if ( (ms->opt.litLengthSum==0) /* first block */ && (seqStore->sequences == seqStore->sequencesStart) /* no ldm */ && (ms->window.dictLimit == ms->window.lowLimit) /* no dictionary */ - && (curr == ms->window.dictLimit) /* start of frame, nothing already loaded nor skipped */ - && (srcSize > ZSTD_PREDEF_THRESHOLD) + && (curr == ms->window.dictLimit) /* start of frame, nothing already loaded nor skipped */ + && (srcSize > ZSTD_PREDEF_THRESHOLD) /* input large enough to not employ default stats */ ) { ZSTD_initStats_ultra(ms, seqStore, rep, src, srcSize); } - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_noDict); + return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_noDict); } size_t ZSTD_compressBlock_btopt_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) { - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /*optLevel*/, ZSTD_dictMatchState); + return ZSTD_compressBlock_opt0(ms, seqStore, rep, src, srcSize, ZSTD_dictMatchState); } size_t ZSTD_compressBlock_btultra_dictMatchState( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) { - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_dictMatchState); + return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_dictMatchState); } size_t ZSTD_compressBlock_btopt_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) { - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /*optLevel*/, ZSTD_extDict); + return ZSTD_compressBlock_opt0(ms, seqStore, rep, src, srcSize, ZSTD_extDict); } size_t ZSTD_compressBlock_btultra_extDict( ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], const void* src, size_t srcSize) { - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_extDict); + return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_extDict); } /* note : no btultra2 variant for extDict nor dictMatchState, diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstd_opt.h b/src/dependencies/zstd-1.5.4/lib/compress/zstd_opt.h similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/compress/zstd_opt.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstd_opt.h index 627255f..342e5a3 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstd_opt.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstd_opt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstdmt_compress.c b/src/dependencies/zstd-1.5.4/lib/compress/zstdmt_compress.c similarity index 94% rename from src/dependencies/zstd-1.5.0/lib/compress/zstdmt_compress.c rename to src/dependencies/zstd-1.5.4/lib/compress/zstdmt_compress.c index 22aa3e1..7a2c717 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstdmt_compress.c +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstdmt_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -102,9 +102,8 @@ typedef struct ZSTDMT_bufferPool_s { buffer_t bTable[1]; /* variable size */ } ZSTDMT_bufferPool; -static ZSTDMT_bufferPool* ZSTDMT_createBufferPool(unsigned nbWorkers, ZSTD_customMem cMem) +static ZSTDMT_bufferPool* ZSTDMT_createBufferPool(unsigned maxNbBuffers, ZSTD_customMem cMem) { - unsigned const maxNbBuffers = 2*nbWorkers + 3; ZSTDMT_bufferPool* const bufPool = (ZSTDMT_bufferPool*)ZSTD_customCalloc( sizeof(ZSTDMT_bufferPool) + (maxNbBuffers-1) * sizeof(buffer_t), cMem); if (bufPool==NULL) return NULL; @@ -160,9 +159,8 @@ static void ZSTDMT_setBufferSize(ZSTDMT_bufferPool* const bufPool, size_t const } -static ZSTDMT_bufferPool* ZSTDMT_expandBufferPool(ZSTDMT_bufferPool* srcBufPool, U32 nbWorkers) +static ZSTDMT_bufferPool* ZSTDMT_expandBufferPool(ZSTDMT_bufferPool* srcBufPool, unsigned maxNbBuffers) { - unsigned const maxNbBuffers = 2*nbWorkers + 3; if (srcBufPool==NULL) return NULL; if (srcBufPool->totalBuffers >= maxNbBuffers) /* good enough */ return srcBufPool; @@ -171,7 +169,7 @@ static ZSTDMT_bufferPool* ZSTDMT_expandBufferPool(ZSTDMT_bufferPool* srcBufPool, size_t const bSize = srcBufPool->bufferSize; /* forward parameters */ ZSTDMT_bufferPool* newBufPool; ZSTDMT_freeBufferPool(srcBufPool); - newBufPool = ZSTDMT_createBufferPool(nbWorkers, cMem); + newBufPool = ZSTDMT_createBufferPool(maxNbBuffers, cMem); if (newBufPool==NULL) return newBufPool; ZSTDMT_setBufferSize(newBufPool, bSize); return newBufPool; @@ -263,6 +261,16 @@ static void ZSTDMT_releaseBuffer(ZSTDMT_bufferPool* bufPool, buffer_t buf) ZSTD_customFree(buf.start, bufPool->cMem); } +/* We need 2 output buffers per worker since each dstBuff must be flushed after it is released. + * The 3 additional buffers are as follows: + * 1 buffer for input loading + * 1 buffer for "next input" when submitting current one + * 1 buffer stuck in queue */ +#define BUF_POOL_MAX_NB_BUFFERS(nbWorkers) (2*(nbWorkers) + 3) + +/* After a worker releases its rawSeqStore, it is immediately ready for reuse. + * So we only need one seq buffer per worker. */ +#define SEQ_POOL_MAX_NB_BUFFERS(nbWorkers) (nbWorkers) /* ===== Seq Pool Wrapper ====== */ @@ -316,7 +324,7 @@ static void ZSTDMT_setNbSeq(ZSTDMT_seqPool* const seqPool, size_t const nbSeq) static ZSTDMT_seqPool* ZSTDMT_createSeqPool(unsigned nbWorkers, ZSTD_customMem cMem) { - ZSTDMT_seqPool* const seqPool = ZSTDMT_createBufferPool(nbWorkers, cMem); + ZSTDMT_seqPool* const seqPool = ZSTDMT_createBufferPool(SEQ_POOL_MAX_NB_BUFFERS(nbWorkers), cMem); if (seqPool == NULL) return NULL; ZSTDMT_setNbSeq(seqPool, 0); return seqPool; @@ -329,7 +337,7 @@ static void ZSTDMT_freeSeqPool(ZSTDMT_seqPool* seqPool) static ZSTDMT_seqPool* ZSTDMT_expandSeqPool(ZSTDMT_seqPool* pool, U32 nbWorkers) { - return ZSTDMT_expandBufferPool(pool, nbWorkers); + return ZSTDMT_expandBufferPool(pool, SEQ_POOL_MAX_NB_BUFFERS(nbWorkers)); } @@ -467,7 +475,7 @@ ZSTDMT_serialState_reset(serialState_t* serialState, ZSTD_dictContentType_e dictContentType) { /* Adjust parameters */ - if (params.ldmParams.enableLdm) { + if (params.ldmParams.enableLdm == ZSTD_ps_enable) { DEBUGLOG(4, "LDM window size = %u KB", (1U << params.cParams.windowLog) >> 10); ZSTD_ldm_adjustParameters(¶ms.ldmParams, ¶ms.cParams); assert(params.ldmParams.hashLog >= params.ldmParams.bucketSizeLog); @@ -478,7 +486,7 @@ ZSTDMT_serialState_reset(serialState_t* serialState, serialState->nextJobID = 0; if (params.fParams.checksumFlag) XXH64_reset(&serialState->xxhState, 0); - if (params.ldmParams.enableLdm) { + if (params.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_customMem cMem = params.customMem; unsigned const hashLog = params.ldmParams.hashLog; size_t const hashSize = ((size_t)1 << hashLog) * sizeof(ldmEntry_t); @@ -564,7 +572,7 @@ static void ZSTDMT_serialState_update(serialState_t* serialState, /* A future job may error and skip our job */ if (serialState->nextJobID == jobID) { /* It is now our turn, do any processing necessary */ - if (serialState->params.ldmParams.enableLdm) { + if (serialState->params.ldmParams.enableLdm == ZSTD_ps_enable) { size_t error; assert(seqStore.seq != NULL && seqStore.pos == 0 && seqStore.size == 0 && seqStore.capacity > 0); @@ -594,7 +602,7 @@ static void ZSTDMT_serialState_update(serialState_t* serialState, if (seqStore.size > 0) { size_t const err = ZSTD_referenceExternalSequences( jobCCtx, seqStore.seq, seqStore.size); - assert(serialState->params.ldmParams.enableLdm); + assert(serialState->params.ldmParams.enableLdm == ZSTD_ps_enable); assert(!ZSTD_isError(err)); (void)err; } @@ -672,7 +680,7 @@ static void ZSTDMT_compressionJob(void* jobDescription) if (dstBuff.start==NULL) JOB_ERROR(ERROR(memory_allocation)); job->dstBuff = dstBuff; /* this value can be read in ZSTDMT_flush, when it copies the whole job */ } - if (jobParams.ldmParams.enableLdm && rawSeqStore.seq == NULL) + if (jobParams.ldmParams.enableLdm == ZSTD_ps_enable && rawSeqStore.seq == NULL) JOB_ERROR(ERROR(memory_allocation)); /* Don't compute the checksum for chunks, since we compute it externally, @@ -680,7 +688,7 @@ static void ZSTDMT_compressionJob(void* jobDescription) */ if (job->jobID != 0) jobParams.fParams.checksumFlag = 0; /* Don't run LDM for the chunks, since we handle it externally */ - jobParams.ldmParams.enableLdm = 0; + jobParams.ldmParams.enableLdm = ZSTD_ps_disable; /* Correct nbWorkers to 0. */ jobParams.nbWorkers = 0; @@ -807,6 +815,15 @@ typedef struct { static const roundBuff_t kNullRoundBuff = {NULL, 0, 0}; #define RSYNC_LENGTH 32 +/* Don't create chunks smaller than the zstd block size. + * This stops us from regressing compression ratio too much, + * and ensures our output fits in ZSTD_compressBound(). + * + * If this is shrunk < ZSTD_BLOCKSIZELOG_MIN then + * ZSTD_COMPRESSBOUND() will need to be updated. + */ +#define RSYNC_MIN_BLOCK_LOG ZSTD_BLOCKSIZELOG_MAX +#define RSYNC_MIN_BLOCK_SIZE (1<jobs = ZSTDMT_createJobsTable(&nbJobs, cMem); assert(nbJobs > 0); assert((nbJobs & (nbJobs - 1)) == 0); /* ensure nbJobs is a power of 2 */ mtctx->jobIDMask = nbJobs - 1; - mtctx->bufPool = ZSTDMT_createBufferPool(nbWorkers, cMem); + mtctx->bufPool = ZSTDMT_createBufferPool(BUF_POOL_MAX_NB_BUFFERS(nbWorkers), cMem); mtctx->cctxPool = ZSTDMT_createCCtxPool(nbWorkers, cMem); mtctx->seqPool = ZSTDMT_createSeqPool(nbWorkers, cMem); initError = ZSTDMT_serialState_init(&mtctx->serial); @@ -1030,7 +1047,7 @@ static size_t ZSTDMT_resize(ZSTDMT_CCtx* mtctx, unsigned nbWorkers) { if (POOL_resize(mtctx->factory, nbWorkers)) return ERROR(memory_allocation); FORWARD_IF_ERROR( ZSTDMT_expandJobsTable(mtctx, nbWorkers) , ""); - mtctx->bufPool = ZSTDMT_expandBufferPool(mtctx->bufPool, nbWorkers); + mtctx->bufPool = ZSTDMT_expandBufferPool(mtctx->bufPool, BUF_POOL_MAX_NB_BUFFERS(nbWorkers)); if (mtctx->bufPool == NULL) return ERROR(memory_allocation); mtctx->cctxPool = ZSTDMT_expandCCtxPool(mtctx->cctxPool, nbWorkers); if (mtctx->cctxPool == NULL) return ERROR(memory_allocation); @@ -1135,7 +1152,7 @@ size_t ZSTDMT_toFlushNow(ZSTDMT_CCtx* mtctx) static unsigned ZSTDMT_computeTargetJobLog(const ZSTD_CCtx_params* params) { unsigned jobLog; - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* In Long Range Mode, the windowLog is typically oversized. * In which case, it's preferable to determine the jobSize * based on cycleLog instead. */ @@ -1179,7 +1196,7 @@ static size_t ZSTDMT_computeOverlapSize(const ZSTD_CCtx_params* params) int const overlapRLog = 9 - ZSTDMT_overlapLog(params->overlapLog, params->cParams.strategy); int ovLog = (overlapRLog >= 8) ? 0 : (params->cParams.windowLog - overlapRLog); assert(0 <= overlapRLog && overlapRLog <= 8); - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* In Long Range Mode, the windowLog is typically oversized. * In which case, it's preferable to determine the jobSize * based on chainLog instead. @@ -1252,6 +1269,9 @@ size_t ZSTDMT_initCStream_internal( /* Aim for the targetsectionSize as the average job size. */ U32 const jobSizeKB = (U32)(mtctx->targetSectionSize >> 10); U32 const rsyncBits = (assert(jobSizeKB >= 1), ZSTD_highbit32(jobSizeKB) + 10); + /* We refuse to create jobs < RSYNC_MIN_BLOCK_SIZE bytes, so make sure our + * expected job size is at least 4x larger. */ + assert(rsyncBits >= RSYNC_MIN_BLOCK_LOG + 2); DEBUGLOG(4, "rsyncLog = %u", rsyncBits); mtctx->rsync.hash = 0; mtctx->rsync.hitMask = (1ULL << rsyncBits) - 1; @@ -1263,7 +1283,7 @@ size_t ZSTDMT_initCStream_internal( ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(mtctx->targetSectionSize)); { /* If ldm is enabled we need windowSize space. */ - size_t const windowSize = mtctx->params.ldmParams.enableLdm ? (1U << mtctx->params.cParams.windowLog) : 0; + size_t const windowSize = mtctx->params.ldmParams.enableLdm == ZSTD_ps_enable ? (1U << mtctx->params.cParams.windowLog) : 0; /* Two buffers of slack, plus extra space for the overlap * This is the minimum slack that LDM works with. One extra because * flush might waste up to targetSectionSize-1 bytes. Another extra @@ -1538,17 +1558,21 @@ static range_t ZSTDMT_getInputDataInUse(ZSTDMT_CCtx* mtctx) static int ZSTDMT_isOverlapped(buffer_t buffer, range_t range) { BYTE const* const bufferStart = (BYTE const*)buffer.start; - BYTE const* const bufferEnd = bufferStart + buffer.capacity; BYTE const* const rangeStart = (BYTE const*)range.start; - BYTE const* const rangeEnd = range.size != 0 ? rangeStart + range.size : rangeStart; if (rangeStart == NULL || bufferStart == NULL) return 0; - /* Empty ranges cannot overlap */ - if (bufferStart == bufferEnd || rangeStart == rangeEnd) - return 0; - return bufferStart < rangeEnd && rangeStart < bufferEnd; + { + BYTE const* const bufferEnd = bufferStart + buffer.capacity; + BYTE const* const rangeEnd = rangeStart + range.size; + + /* Empty ranges cannot overlap */ + if (bufferStart == bufferEnd || rangeStart == rangeEnd) + return 0; + + return bufferStart < rangeEnd && rangeStart < bufferEnd; + } } static int ZSTDMT_doesOverlapWindow(buffer_t buffer, ZSTD_window_t window) @@ -1575,7 +1599,7 @@ static int ZSTDMT_doesOverlapWindow(buffer_t buffer, ZSTD_window_t window) static void ZSTDMT_waitForLdmComplete(ZSTDMT_CCtx* mtctx, buffer_t buffer) { - if (mtctx->params.ldmParams.enableLdm) { + if (mtctx->params.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_pthread_mutex_t* mutex = &mtctx->serial.ldmWindowMutex; DEBUGLOG(5, "ZSTDMT_waitForLdmComplete"); DEBUGLOG(5, "source [0x%zx, 0x%zx)", @@ -1678,6 +1702,11 @@ findSynchronizationPoint(ZSTDMT_CCtx const* mtctx, ZSTD_inBuffer const input) if (!mtctx->params.rsyncable) /* Rsync is disabled. */ return syncPoint; + if (mtctx->inBuff.filled + input.size - input.pos < RSYNC_MIN_BLOCK_SIZE) + /* We don't emit synchronization points if it would produce too small blocks. + * We don't have enough input to find a synchronization point, so don't look. + */ + return syncPoint; if (mtctx->inBuff.filled + syncPoint.toLoad < RSYNC_LENGTH) /* Not enough to compute the hash. * We will miss any synchronization points in this RSYNC_LENGTH byte @@ -1688,10 +1717,28 @@ findSynchronizationPoint(ZSTDMT_CCtx const* mtctx, ZSTD_inBuffer const input) */ return syncPoint; /* Initialize the loop variables. */ - if (mtctx->inBuff.filled >= RSYNC_LENGTH) { - /* We have enough bytes buffered to initialize the hash. + if (mtctx->inBuff.filled < RSYNC_MIN_BLOCK_SIZE) { + /* We don't need to scan the first RSYNC_MIN_BLOCK_SIZE positions + * because they can't possibly be a sync point. So we can start + * part way through the input buffer. + */ + pos = RSYNC_MIN_BLOCK_SIZE - mtctx->inBuff.filled; + if (pos >= RSYNC_LENGTH) { + prev = istart + pos - RSYNC_LENGTH; + hash = ZSTD_rollingHash_compute(prev, RSYNC_LENGTH); + } else { + assert(mtctx->inBuff.filled >= RSYNC_LENGTH); + prev = (BYTE const*)mtctx->inBuff.buffer.start + mtctx->inBuff.filled - RSYNC_LENGTH; + hash = ZSTD_rollingHash_compute(prev + pos, (RSYNC_LENGTH - pos)); + hash = ZSTD_rollingHash_append(hash, istart, pos); + } + } else { + /* We have enough bytes buffered to initialize the hash, + * and have processed enough bytes to find a sync point. * Start scanning at the beginning of the input. */ + assert(mtctx->inBuff.filled >= RSYNC_MIN_BLOCK_SIZE); + assert(RSYNC_MIN_BLOCK_SIZE >= RSYNC_LENGTH); pos = 0; prev = (BYTE const*)mtctx->inBuff.buffer.start + mtctx->inBuff.filled - RSYNC_LENGTH; hash = ZSTD_rollingHash_compute(prev, RSYNC_LENGTH); @@ -1705,16 +1752,6 @@ findSynchronizationPoint(ZSTDMT_CCtx const* mtctx, ZSTD_inBuffer const input) syncPoint.flush = 1; return syncPoint; } - } else { - /* We don't have enough bytes buffered to initialize the hash, but - * we know we have at least RSYNC_LENGTH bytes total. - * Start scanning after the first RSYNC_LENGTH bytes less the bytes - * already buffered. - */ - pos = RSYNC_LENGTH - mtctx->inBuff.filled; - prev = (BYTE const*)mtctx->inBuff.buffer.start - pos; - hash = ZSTD_rollingHash_compute(mtctx->inBuff.buffer.start, mtctx->inBuff.filled); - hash = ZSTD_rollingHash_append(hash, istart, pos); } /* Starting with the hash of the previous RSYNC_LENGTH bytes, roll * through the input. If we hit a synchronization point, then cut the @@ -1724,16 +1761,24 @@ findSynchronizationPoint(ZSTDMT_CCtx const* mtctx, ZSTD_inBuffer const input) * then a block will be emitted anyways, but this is okay, since if we * are already synchronized we will remain synchronized. */ + assert(pos < RSYNC_LENGTH || ZSTD_rollingHash_compute(istart + pos - RSYNC_LENGTH, RSYNC_LENGTH) == hash); for (; pos < syncPoint.toLoad; ++pos) { BYTE const toRemove = pos < RSYNC_LENGTH ? prev[pos] : istart[pos - RSYNC_LENGTH]; - /* if (pos >= RSYNC_LENGTH) assert(ZSTD_rollingHash_compute(istart + pos - RSYNC_LENGTH, RSYNC_LENGTH) == hash); */ + /* This assert is very expensive, and Debian compiles with asserts enabled. + * So disable it for now. We can get similar coverage by checking it at the + * beginning & end of the loop. + * assert(pos < RSYNC_LENGTH || ZSTD_rollingHash_compute(istart + pos - RSYNC_LENGTH, RSYNC_LENGTH) == hash); + */ hash = ZSTD_rollingHash_rotate(hash, toRemove, istart[pos], primePower); + assert(mtctx->inBuff.filled + pos >= RSYNC_MIN_BLOCK_SIZE); if ((hash & hitMask) == hitMask) { syncPoint.toLoad = pos + 1; syncPoint.flush = 1; + ++pos; /* for assert */ break; } } + assert(pos < RSYNC_LENGTH || ZSTD_rollingHash_compute(istart + pos - RSYNC_LENGTH, RSYNC_LENGTH) == hash); return syncPoint; } diff --git a/src/dependencies/zstd-1.5.0/lib/compress/zstdmt_compress.h b/src/dependencies/zstd-1.5.4/lib/compress/zstdmt_compress.h similarity index 92% rename from src/dependencies/zstd-1.5.0/lib/compress/zstdmt_compress.h rename to src/dependencies/zstd-1.5.4/lib/compress/zstdmt_compress.h index 2fee2ec..ed4dc0e 100644 --- a/src/dependencies/zstd-1.5.0/lib/compress/zstdmt_compress.h +++ b/src/dependencies/zstd-1.5.4/lib/compress/zstdmt_compress.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -65,8 +65,11 @@ size_t ZSTDMT_nextInputSizeHint(const ZSTDMT_CCtx* mtctx); * Private use only. Init streaming operation. * expects params to be valid. * must receive dict, or cdict, or none, but not both. + * mtctx can be freshly constructed or reused from a prior compression. + * If mtctx is reused, memory allocations from the prior compression may not be freed, + * even if they are not needed for the current compression. * @return : 0, or an error code */ -size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs, +size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* mtctx, const void* dict, size_t dictSize, ZSTD_dictContentType_e dictContentType, const ZSTD_CDict* cdict, ZSTD_CCtx_params params, unsigned long long pledgedSrcSize); diff --git a/src/dependencies/zstd-1.5.4/lib/decompress/huf_decompress.c b/src/dependencies/zstd-1.5.4/lib/decompress/huf_decompress.c new file mode 100644 index 0000000..c2d1f63 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/decompress/huf_decompress.c @@ -0,0 +1,1882 @@ +/* ****************************************************************** + * huff0 huffman decoder, + * part of Finite State Entropy library + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * You can contact the author at : + * - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. +****************************************************************** */ + +/* ************************************************************** +* Dependencies +****************************************************************/ +#include "../common/zstd_deps.h" /* ZSTD_memcpy, ZSTD_memset */ +#include "../common/compiler.h" +#include "../common/bitstream.h" /* BIT_* */ +#include "../common/fse.h" /* to compress headers */ +#include "../common/huf.h" +#include "../common/error_private.h" +#include "../common/zstd_internal.h" +#include "../common/bits.h" /* ZSTD_highbit32, ZSTD_countTrailingZeros64 */ + +/* ************************************************************** +* Constants +****************************************************************/ + +#define HUF_DECODER_FAST_TABLELOG 11 + +/* ************************************************************** +* Macros +****************************************************************/ + +/* These two optional macros force the use one way or another of the two + * Huffman decompression implementations. You can't force in both directions + * at the same time. + */ +#if defined(HUF_FORCE_DECOMPRESS_X1) && \ + defined(HUF_FORCE_DECOMPRESS_X2) +#error "Cannot force the use of the X1 and X2 decoders at the same time!" +#endif + +/* When DYNAMIC_BMI2 is enabled, fast decoders are only called when bmi2 is + * supported at runtime, so we can add the BMI2 target attribute. + * When it is disabled, we will still get BMI2 if it is enabled statically. + */ +#if DYNAMIC_BMI2 +# define HUF_FAST_BMI2_ATTRS BMI2_TARGET_ATTRIBUTE +#else +# define HUF_FAST_BMI2_ATTRS +#endif + +#ifdef __cplusplus +# define HUF_EXTERN_C extern "C" +#else +# define HUF_EXTERN_C +#endif +#define HUF_ASM_DECL HUF_EXTERN_C + +#if DYNAMIC_BMI2 +# define HUF_NEED_BMI2_FUNCTION 1 +#else +# define HUF_NEED_BMI2_FUNCTION 0 +#endif + +/* ************************************************************** +* Error Management +****************************************************************/ +#define HUF_isError ERR_isError + + +/* ************************************************************** +* Byte alignment for workSpace management +****************************************************************/ +#define HUF_ALIGN(x, a) HUF_ALIGN_MASK((x), (a) - 1) +#define HUF_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) + + +/* ************************************************************** +* BMI2 Variant Wrappers +****************************************************************/ +typedef size_t (*HUF_DecompressUsingDTableFn)(void *dst, size_t dstSize, + const void *cSrc, + size_t cSrcSize, + const HUF_DTable *DTable); + +#if DYNAMIC_BMI2 + +#define HUF_DGEN(fn) \ + \ + static size_t fn##_default( \ + void* dst, size_t dstSize, \ + const void* cSrc, size_t cSrcSize, \ + const HUF_DTable* DTable) \ + { \ + return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ + } \ + \ + static BMI2_TARGET_ATTRIBUTE size_t fn##_bmi2( \ + void* dst, size_t dstSize, \ + const void* cSrc, size_t cSrcSize, \ + const HUF_DTable* DTable) \ + { \ + return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ + } \ + \ + static size_t fn(void* dst, size_t dstSize, void const* cSrc, \ + size_t cSrcSize, HUF_DTable const* DTable, int flags) \ + { \ + if (flags & HUF_flags_bmi2) { \ + return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); \ + } \ + return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable); \ + } + +#else + +#define HUF_DGEN(fn) \ + static size_t fn(void* dst, size_t dstSize, void const* cSrc, \ + size_t cSrcSize, HUF_DTable const* DTable, int flags) \ + { \ + (void)flags; \ + return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ + } + +#endif + + +/*-***************************/ +/* generic DTableDesc */ +/*-***************************/ +typedef struct { BYTE maxTableLog; BYTE tableType; BYTE tableLog; BYTE reserved; } DTableDesc; + +static DTableDesc HUF_getDTableDesc(const HUF_DTable* table) +{ + DTableDesc dtd; + ZSTD_memcpy(&dtd, table, sizeof(dtd)); + return dtd; +} + +static size_t HUF_initFastDStream(BYTE const* ip) { + BYTE const lastByte = ip[7]; + size_t const bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0; + size_t const value = MEM_readLEST(ip) | 1; + assert(bitsConsumed <= 8); + assert(sizeof(size_t) == 8); + return value << bitsConsumed; +} + + +/** + * The input/output arguments to the Huffman fast decoding loop: + * + * ip [in/out] - The input pointers, must be updated to reflect what is consumed. + * op [in/out] - The output pointers, must be updated to reflect what is written. + * bits [in/out] - The bitstream containers, must be updated to reflect the current state. + * dt [in] - The decoding table. + * ilimit [in] - The input limit, stop when any input pointer is below ilimit. + * oend [in] - The end of the output stream. op[3] must not cross oend. + * iend [in] - The end of each input stream. ip[i] may cross iend[i], + * as long as it is above ilimit, but that indicates corruption. + */ +typedef struct { + BYTE const* ip[4]; + BYTE* op[4]; + U64 bits[4]; + void const* dt; + BYTE const* ilimit; + BYTE* oend; + BYTE const* iend[4]; +} HUF_DecompressFastArgs; + +typedef void (*HUF_DecompressFastLoopFn)(HUF_DecompressFastArgs*); + +/** + * Initializes args for the fast decoding loop. + * @returns 1 on success + * 0 if the fallback implementation should be used. + * Or an error code on failure. + */ +static size_t HUF_DecompressFastArgs_init(HUF_DecompressFastArgs* args, void* dst, size_t dstSize, void const* src, size_t srcSize, const HUF_DTable* DTable) +{ + void const* dt = DTable + 1; + U32 const dtLog = HUF_getDTableDesc(DTable).tableLog; + + const BYTE* const ilimit = (const BYTE*)src + 6 + 8; + + BYTE* const oend = (BYTE*)dst + dstSize; + + /* The fast decoding loop assumes 64-bit little-endian. + * This condition is false on x32. + */ + if (!MEM_isLittleEndian() || MEM_32bits()) + return 0; + + /* strict minimum : jump table + 1 byte per stream */ + if (srcSize < 10) + return ERROR(corruption_detected); + + /* Must have at least 8 bytes per stream because we don't handle initializing smaller bit containers. + * If table log is not correct at this point, fallback to the old decoder. + * On small inputs we don't have enough data to trigger the fast loop, so use the old decoder. + */ + if (dtLog != HUF_DECODER_FAST_TABLELOG) + return 0; + + /* Read the jump table. */ + { + const BYTE* const istart = (const BYTE*)src; + size_t const length1 = MEM_readLE16(istart); + size_t const length2 = MEM_readLE16(istart+2); + size_t const length3 = MEM_readLE16(istart+4); + size_t const length4 = srcSize - (length1 + length2 + length3 + 6); + args->iend[0] = istart + 6; /* jumpTable */ + args->iend[1] = args->iend[0] + length1; + args->iend[2] = args->iend[1] + length2; + args->iend[3] = args->iend[2] + length3; + + /* HUF_initFastDStream() requires this, and this small of an input + * won't benefit from the ASM loop anyways. + * length1 must be >= 16 so that ip[0] >= ilimit before the loop + * starts. + */ + if (length1 < 16 || length2 < 8 || length3 < 8 || length4 < 8) + return 0; + if (length4 > srcSize) return ERROR(corruption_detected); /* overflow */ + } + /* ip[] contains the position that is currently loaded into bits[]. */ + args->ip[0] = args->iend[1] - sizeof(U64); + args->ip[1] = args->iend[2] - sizeof(U64); + args->ip[2] = args->iend[3] - sizeof(U64); + args->ip[3] = (BYTE const*)src + srcSize - sizeof(U64); + + /* op[] contains the output pointers. */ + args->op[0] = (BYTE*)dst; + args->op[1] = args->op[0] + (dstSize+3)/4; + args->op[2] = args->op[1] + (dstSize+3)/4; + args->op[3] = args->op[2] + (dstSize+3)/4; + + /* No point to call the ASM loop for tiny outputs. */ + if (args->op[3] >= oend) + return 0; + + /* bits[] is the bit container. + * It is read from the MSB down to the LSB. + * It is shifted left as it is read, and zeros are + * shifted in. After the lowest valid bit a 1 is + * set, so that CountTrailingZeros(bits[]) can be used + * to count how many bits we've consumed. + */ + args->bits[0] = HUF_initFastDStream(args->ip[0]); + args->bits[1] = HUF_initFastDStream(args->ip[1]); + args->bits[2] = HUF_initFastDStream(args->ip[2]); + args->bits[3] = HUF_initFastDStream(args->ip[3]); + + /* If ip[] >= ilimit, it is guaranteed to be safe to + * reload bits[]. It may be beyond its section, but is + * guaranteed to be valid (>= istart). + */ + args->ilimit = ilimit; + + args->oend = oend; + args->dt = dt; + + return 1; +} + +static size_t HUF_initRemainingDStream(BIT_DStream_t* bit, HUF_DecompressFastArgs const* args, int stream, BYTE* segmentEnd) +{ + /* Validate that we haven't overwritten. */ + if (args->op[stream] > segmentEnd) + return ERROR(corruption_detected); + /* Validate that we haven't read beyond iend[]. + * Note that ip[] may be < iend[] because the MSB is + * the next bit to read, and we may have consumed 100% + * of the stream, so down to iend[i] - 8 is valid. + */ + if (args->ip[stream] < args->iend[stream] - 8) + return ERROR(corruption_detected); + + /* Construct the BIT_DStream_t. */ + assert(sizeof(size_t) == 8); + bit->bitContainer = MEM_readLEST(args->ip[stream]); + bit->bitsConsumed = ZSTD_countTrailingZeros64(args->bits[stream]); + bit->start = (const char*)args->iend[0]; + bit->limitPtr = bit->start + sizeof(size_t); + bit->ptr = (const char*)args->ip[stream]; + + return 0; +} + + +#ifndef HUF_FORCE_DECOMPRESS_X2 + +/*-***************************/ +/* single-symbol decoding */ +/*-***************************/ +typedef struct { BYTE nbBits; BYTE byte; } HUF_DEltX1; /* single-symbol decoding */ + +/** + * Packs 4 HUF_DEltX1 structs into a U64. This is used to lay down 4 entries at + * a time. + */ +static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) { + U64 D4; + if (MEM_isLittleEndian()) { + D4 = (U64)((symbol << 8) + nbBits); + } else { + D4 = (U64)(symbol + (nbBits << 8)); + } + assert(D4 < (1U << 16)); + D4 *= 0x0001000100010001ULL; + return D4; +} + +/** + * Increase the tableLog to targetTableLog and rescales the stats. + * If tableLog > targetTableLog this is a no-op. + * @returns New tableLog + */ +static U32 HUF_rescaleStats(BYTE* huffWeight, U32* rankVal, U32 nbSymbols, U32 tableLog, U32 targetTableLog) +{ + if (tableLog > targetTableLog) + return tableLog; + if (tableLog < targetTableLog) { + U32 const scale = targetTableLog - tableLog; + U32 s; + /* Increase the weight for all non-zero probability symbols by scale. */ + for (s = 0; s < nbSymbols; ++s) { + huffWeight[s] += (BYTE)((huffWeight[s] == 0) ? 0 : scale); + } + /* Update rankVal to reflect the new weights. + * All weights except 0 get moved to weight + scale. + * Weights [1, scale] are empty. + */ + for (s = targetTableLog; s > scale; --s) { + rankVal[s] = rankVal[s - scale]; + } + for (s = scale; s > 0; --s) { + rankVal[s] = 0; + } + } + return targetTableLog; +} + +typedef struct { + U32 rankVal[HUF_TABLELOG_ABSOLUTEMAX + 1]; + U32 rankStart[HUF_TABLELOG_ABSOLUTEMAX + 1]; + U32 statsWksp[HUF_READ_STATS_WORKSPACE_SIZE_U32]; + BYTE symbols[HUF_SYMBOLVALUE_MAX + 1]; + BYTE huffWeight[HUF_SYMBOLVALUE_MAX + 1]; +} HUF_ReadDTableX1_Workspace; + +size_t HUF_readDTableX1_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int flags) +{ + U32 tableLog = 0; + U32 nbSymbols = 0; + size_t iSize; + void* const dtPtr = DTable + 1; + HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr; + HUF_ReadDTableX1_Workspace* wksp = (HUF_ReadDTableX1_Workspace*)workSpace; + + DEBUG_STATIC_ASSERT(HUF_DECOMPRESS_WORKSPACE_SIZE >= sizeof(*wksp)); + if (sizeof(*wksp) > wkspSize) return ERROR(tableLog_tooLarge); + + DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable)); + /* ZSTD_memset(huffWeight, 0, sizeof(huffWeight)); */ /* is not necessary, even though some analyzer complain ... */ + + iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), flags); + if (HUF_isError(iSize)) return iSize; + + + /* Table header */ + { DTableDesc dtd = HUF_getDTableDesc(DTable); + U32 const maxTableLog = dtd.maxTableLog + 1; + U32 const targetTableLog = MIN(maxTableLog, HUF_DECODER_FAST_TABLELOG); + tableLog = HUF_rescaleStats(wksp->huffWeight, wksp->rankVal, nbSymbols, tableLog, targetTableLog); + if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge); /* DTable too small, Huffman tree cannot fit in */ + dtd.tableType = 0; + dtd.tableLog = (BYTE)tableLog; + ZSTD_memcpy(DTable, &dtd, sizeof(dtd)); + } + + /* Compute symbols and rankStart given rankVal: + * + * rankVal already contains the number of values of each weight. + * + * symbols contains the symbols ordered by weight. First are the rankVal[0] + * weight 0 symbols, followed by the rankVal[1] weight 1 symbols, and so on. + * symbols[0] is filled (but unused) to avoid a branch. + * + * rankStart contains the offset where each rank belongs in the DTable. + * rankStart[0] is not filled because there are no entries in the table for + * weight 0. + */ + { int n; + U32 nextRankStart = 0; + int const unroll = 4; + int const nLimit = (int)nbSymbols - unroll + 1; + for (n=0; n<(int)tableLog+1; n++) { + U32 const curr = nextRankStart; + nextRankStart += wksp->rankVal[n]; + wksp->rankStart[n] = curr; + } + for (n=0; n < nLimit; n += unroll) { + int u; + for (u=0; u < unroll; ++u) { + size_t const w = wksp->huffWeight[n+u]; + wksp->symbols[wksp->rankStart[w]++] = (BYTE)(n+u); + } + } + for (; n < (int)nbSymbols; ++n) { + size_t const w = wksp->huffWeight[n]; + wksp->symbols[wksp->rankStart[w]++] = (BYTE)n; + } + } + + /* fill DTable + * We fill all entries of each weight in order. + * That way length is a constant for each iteration of the outer loop. + * We can switch based on the length to a different inner loop which is + * optimized for that particular case. + */ + { U32 w; + int symbol = wksp->rankVal[0]; + int rankStart = 0; + for (w=1; wrankVal[w]; + int const length = (1 << w) >> 1; + int uStart = rankStart; + BYTE const nbBits = (BYTE)(tableLog + 1 - w); + int s; + int u; + switch (length) { + case 1: + for (s=0; ssymbols[symbol + s]; + D.nbBits = nbBits; + dt[uStart] = D; + uStart += 1; + } + break; + case 2: + for (s=0; ssymbols[symbol + s]; + D.nbBits = nbBits; + dt[uStart+0] = D; + dt[uStart+1] = D; + uStart += 2; + } + break; + case 4: + for (s=0; ssymbols[symbol + s], nbBits); + MEM_write64(dt + uStart, D4); + uStart += 4; + } + break; + case 8: + for (s=0; ssymbols[symbol + s], nbBits); + MEM_write64(dt + uStart, D4); + MEM_write64(dt + uStart + 4, D4); + uStart += 8; + } + break; + default: + for (s=0; ssymbols[symbol + s], nbBits); + for (u=0; u < length; u += 16) { + MEM_write64(dt + uStart + u + 0, D4); + MEM_write64(dt + uStart + u + 4, D4); + MEM_write64(dt + uStart + u + 8, D4); + MEM_write64(dt + uStart + u + 12, D4); + } + assert(u == length); + uStart += length; + } + break; + } + symbol += symbolCount; + rankStart += symbolCount * length; + } + } + return iSize; +} + +FORCE_INLINE_TEMPLATE BYTE +HUF_decodeSymbolX1(BIT_DStream_t* Dstream, const HUF_DEltX1* dt, const U32 dtLog) +{ + size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */ + BYTE const c = dt[val].byte; + BIT_skipBits(Dstream, dt[val].nbBits); + return c; +} + +#define HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) \ + *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog) + +#define HUF_DECODE_SYMBOLX1_1(ptr, DStreamPtr) \ + if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ + HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) + +#define HUF_DECODE_SYMBOLX1_2(ptr, DStreamPtr) \ + if (MEM_64bits()) \ + HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) + +HINT_INLINE size_t +HUF_decodeStreamX1(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX1* const dt, const U32 dtLog) +{ + BYTE* const pStart = p; + + /* up to 4 symbols at a time */ + if ((pEnd - p) > 3) { + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) { + HUF_DECODE_SYMBOLX1_2(p, bitDPtr); + HUF_DECODE_SYMBOLX1_1(p, bitDPtr); + HUF_DECODE_SYMBOLX1_2(p, bitDPtr); + HUF_DECODE_SYMBOLX1_0(p, bitDPtr); + } + } else { + BIT_reloadDStream(bitDPtr); + } + + /* [0-3] symbols remaining */ + if (MEM_32bits()) + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd)) + HUF_DECODE_SYMBOLX1_0(p, bitDPtr); + + /* no more data to retrieve from bitstream, no need to reload */ + while (p < pEnd) + HUF_DECODE_SYMBOLX1_0(p, bitDPtr); + + return (size_t)(pEnd-pStart); +} + +FORCE_INLINE_TEMPLATE size_t +HUF_decompress1X1_usingDTable_internal_body( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable) +{ + BYTE* op = (BYTE*)dst; + BYTE* const oend = op + dstSize; + const void* dtPtr = DTable + 1; + const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr; + BIT_DStream_t bitD; + DTableDesc const dtd = HUF_getDTableDesc(DTable); + U32 const dtLog = dtd.tableLog; + + CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) ); + + HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog); + + if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected); + + return dstSize; +} + +/* HUF_decompress4X1_usingDTable_internal_body(): + * Conditions : + * @dstSize >= 6 + */ +FORCE_INLINE_TEMPLATE size_t +HUF_decompress4X1_usingDTable_internal_body( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable) +{ + /* Check */ + if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ + + { const BYTE* const istart = (const BYTE*) cSrc; + BYTE* const ostart = (BYTE*) dst; + BYTE* const oend = ostart + dstSize; + BYTE* const olimit = oend - 3; + const void* const dtPtr = DTable + 1; + const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr; + + /* Init */ + BIT_DStream_t bitD1; + BIT_DStream_t bitD2; + BIT_DStream_t bitD3; + BIT_DStream_t bitD4; + size_t const length1 = MEM_readLE16(istart); + size_t const length2 = MEM_readLE16(istart+2); + size_t const length3 = MEM_readLE16(istart+4); + size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6); + const BYTE* const istart1 = istart + 6; /* jumpTable */ + const BYTE* const istart2 = istart1 + length1; + const BYTE* const istart3 = istart2 + length2; + const BYTE* const istart4 = istart3 + length3; + const size_t segmentSize = (dstSize+3) / 4; + BYTE* const opStart2 = ostart + segmentSize; + BYTE* const opStart3 = opStart2 + segmentSize; + BYTE* const opStart4 = opStart3 + segmentSize; + BYTE* op1 = ostart; + BYTE* op2 = opStart2; + BYTE* op3 = opStart3; + BYTE* op4 = opStart4; + DTableDesc const dtd = HUF_getDTableDesc(DTable); + U32 const dtLog = dtd.tableLog; + U32 endSignal = 1; + + if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ + if (opStart4 > oend) return ERROR(corruption_detected); /* overflow */ + if (dstSize < 6) return ERROR(corruption_detected); /* stream 4-split doesn't work */ + CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); + CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); + CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); + CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); + + /* up to 16 symbols per loop (4 symbols per stream) in 64-bit mode */ + if ((size_t)(oend - op4) >= sizeof(size_t)) { + for ( ; (endSignal) & (op4 < olimit) ; ) { + HUF_DECODE_SYMBOLX1_2(op1, &bitD1); + HUF_DECODE_SYMBOLX1_2(op2, &bitD2); + HUF_DECODE_SYMBOLX1_2(op3, &bitD3); + HUF_DECODE_SYMBOLX1_2(op4, &bitD4); + HUF_DECODE_SYMBOLX1_1(op1, &bitD1); + HUF_DECODE_SYMBOLX1_1(op2, &bitD2); + HUF_DECODE_SYMBOLX1_1(op3, &bitD3); + HUF_DECODE_SYMBOLX1_1(op4, &bitD4); + HUF_DECODE_SYMBOLX1_2(op1, &bitD1); + HUF_DECODE_SYMBOLX1_2(op2, &bitD2); + HUF_DECODE_SYMBOLX1_2(op3, &bitD3); + HUF_DECODE_SYMBOLX1_2(op4, &bitD4); + HUF_DECODE_SYMBOLX1_0(op1, &bitD1); + HUF_DECODE_SYMBOLX1_0(op2, &bitD2); + HUF_DECODE_SYMBOLX1_0(op3, &bitD3); + HUF_DECODE_SYMBOLX1_0(op4, &bitD4); + endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; + } + } + + /* check corruption */ + /* note : should not be necessary : op# advance in lock step, and we control op4. + * but curiously, binary generated by gcc 7.2 & 7.3 with -mbmi2 runs faster when >=1 test is present */ + if (op1 > opStart2) return ERROR(corruption_detected); + if (op2 > opStart3) return ERROR(corruption_detected); + if (op3 > opStart4) return ERROR(corruption_detected); + /* note : op4 supposed already verified within main loop */ + + /* finish bitStreams one by one */ + HUF_decodeStreamX1(op1, &bitD1, opStart2, dt, dtLog); + HUF_decodeStreamX1(op2, &bitD2, opStart3, dt, dtLog); + HUF_decodeStreamX1(op3, &bitD3, opStart4, dt, dtLog); + HUF_decodeStreamX1(op4, &bitD4, oend, dt, dtLog); + + /* check */ + { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); + if (!endCheck) return ERROR(corruption_detected); } + + /* decoded size */ + return dstSize; + } +} + +#if HUF_NEED_BMI2_FUNCTION +static BMI2_TARGET_ATTRIBUTE +size_t HUF_decompress4X1_usingDTable_internal_bmi2(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} +#endif + +static +size_t HUF_decompress4X1_usingDTable_internal_default(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} + +#if ZSTD_ENABLE_ASM_X86_64_BMI2 + +HUF_ASM_DECL void HUF_decompress4X1_usingDTable_internal_fast_asm_loop(HUF_DecompressFastArgs* args) ZSTDLIB_HIDDEN; + +#endif + +static HUF_FAST_BMI2_ATTRS +void HUF_decompress4X1_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* args) +{ + U64 bits[4]; + BYTE const* ip[4]; + BYTE* op[4]; + U16 const* const dtable = (U16 const*)args->dt; + BYTE* const oend = args->oend; + BYTE const* const ilimit = args->ilimit; + + /* Copy the arguments to local variables */ + ZSTD_memcpy(&bits, &args->bits, sizeof(bits)); + ZSTD_memcpy(&ip, &args->ip, sizeof(ip)); + ZSTD_memcpy(&op, &args->op, sizeof(op)); + + assert(MEM_isLittleEndian()); + assert(!MEM_32bits()); + + for (;;) { + BYTE* olimit; + int stream; + int symbol; + + /* Assert loop preconditions */ +#ifndef NDEBUG + for (stream = 0; stream < 4; ++stream) { + assert(op[stream] <= (stream == 3 ? oend : op[stream + 1])); + assert(ip[stream] >= ilimit); + } +#endif + /* Compute olimit */ + { + /* Each iteration produces 5 output symbols per stream */ + size_t const oiters = (size_t)(oend - op[3]) / 5; + /* Each iteration consumes up to 11 bits * 5 = 55 bits < 7 bytes + * per stream. + */ + size_t const iiters = (size_t)(ip[0] - ilimit) / 7; + /* We can safely run iters iterations before running bounds checks */ + size_t const iters = MIN(oiters, iiters); + size_t const symbols = iters * 5; + + /* We can simply check that op[3] < olimit, instead of checking all + * of our bounds, since we can't hit the other bounds until we've run + * iters iterations, which only happens when op[3] == olimit. + */ + olimit = op[3] + symbols; + + /* Exit fast decoding loop once we get close to the end. */ + if (op[3] + 20 > olimit) + break; + + /* Exit the decoding loop if any input pointer has crossed the + * previous one. This indicates corruption, and a precondition + * to our loop is that ip[i] >= ip[0]. + */ + for (stream = 1; stream < 4; ++stream) { + if (ip[stream] < ip[stream - 1]) + goto _out; + } + } + +#ifndef NDEBUG + for (stream = 1; stream < 4; ++stream) { + assert(ip[stream] >= ip[stream - 1]); + } +#endif + + do { + /* Decode 5 symbols in each of the 4 streams */ + for (symbol = 0; symbol < 5; ++symbol) { + for (stream = 0; stream < 4; ++stream) { + int const index = (int)(bits[stream] >> 53); + int const entry = (int)dtable[index]; + bits[stream] <<= (entry & 63); + op[stream][symbol] = (BYTE)((entry >> 8) & 0xFF); + } + } + /* Reload the bitstreams */ + for (stream = 0; stream < 4; ++stream) { + int const ctz = ZSTD_countTrailingZeros64(bits[stream]); + int const nbBits = ctz & 7; + int const nbBytes = ctz >> 3; + op[stream] += 5; + ip[stream] -= nbBytes; + bits[stream] = MEM_read64(ip[stream]) | 1; + bits[stream] <<= nbBits; + } + } while (op[3] < olimit); + } + +_out: + + /* Save the final values of each of the state variables back to args. */ + ZSTD_memcpy(&args->bits, &bits, sizeof(bits)); + ZSTD_memcpy(&args->ip, &ip, sizeof(ip)); + ZSTD_memcpy(&args->op, &op, sizeof(op)); +} + +/** + * @returns @p dstSize on success (>= 6) + * 0 if the fallback implementation should be used + * An error if an error occurred + */ +static HUF_FAST_BMI2_ATTRS +size_t +HUF_decompress4X1_usingDTable_internal_fast( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable, + HUF_DecompressFastLoopFn loopFn) +{ + void const* dt = DTable + 1; + const BYTE* const iend = (const BYTE*)cSrc + 6; + BYTE* const oend = (BYTE*)dst + dstSize; + HUF_DecompressFastArgs args; + { size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable); + FORWARD_IF_ERROR(ret, "Failed to init fast loop args"); + if (ret == 0) + return 0; + } + + assert(args.ip[0] >= args.ilimit); + loopFn(&args); + + /* Our loop guarantees that ip[] >= ilimit and that we haven't + * overwritten any op[]. + */ + assert(args.ip[0] >= iend); + assert(args.ip[1] >= iend); + assert(args.ip[2] >= iend); + assert(args.ip[3] >= iend); + assert(args.op[3] <= oend); + (void)iend; + + /* finish bit streams one by one. */ + { size_t const segmentSize = (dstSize+3) / 4; + BYTE* segmentEnd = (BYTE*)dst; + int i; + for (i = 0; i < 4; ++i) { + BIT_DStream_t bit; + if (segmentSize <= (size_t)(oend - segmentEnd)) + segmentEnd += segmentSize; + else + segmentEnd = oend; + FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption"); + /* Decompress and validate that we've produced exactly the expected length. */ + args.op[i] += HUF_decodeStreamX1(args.op[i], &bit, segmentEnd, (HUF_DEltX1 const*)dt, HUF_DECODER_FAST_TABLELOG); + if (args.op[i] != segmentEnd) return ERROR(corruption_detected); + } + } + + /* decoded size */ + assert(dstSize != 0); + return dstSize; +} + +HUF_DGEN(HUF_decompress1X1_usingDTable_internal) + +static size_t HUF_decompress4X1_usingDTable_internal(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable, int flags) +{ + HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X1_usingDTable_internal_default; + HUF_DecompressFastLoopFn loopFn = HUF_decompress4X1_usingDTable_internal_fast_c_loop; + +#if DYNAMIC_BMI2 + if (flags & HUF_flags_bmi2) { + fallbackFn = HUF_decompress4X1_usingDTable_internal_bmi2; +# if ZSTD_ENABLE_ASM_X86_64_BMI2 + if (!(flags & HUF_flags_disableAsm)) { + loopFn = HUF_decompress4X1_usingDTable_internal_fast_asm_loop; + } +# endif + } else { + return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable); + } +#endif + +#if ZSTD_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__) + if (!(flags & HUF_flags_disableAsm)) { + loopFn = HUF_decompress4X1_usingDTable_internal_fast_asm_loop; + } +#endif + + if (!(flags & HUF_flags_disableFast)) { + size_t const ret = HUF_decompress4X1_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn); + if (ret != 0) + return ret; + } + return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable); +} + +static size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + void* workSpace, size_t wkspSize, int flags) +{ + const BYTE* ip = (const BYTE*) cSrc; + + size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags); + if (HUF_isError(hSize)) return hSize; + if (hSize >= cSrcSize) return ERROR(srcSize_wrong); + ip += hSize; cSrcSize -= hSize; + + return HUF_decompress4X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags); +} + +#endif /* HUF_FORCE_DECOMPRESS_X2 */ + + +#ifndef HUF_FORCE_DECOMPRESS_X1 + +/* *************************/ +/* double-symbols decoding */ +/* *************************/ + +typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX2; /* double-symbols decoding */ +typedef struct { BYTE symbol; } sortedSymbol_t; +typedef U32 rankValCol_t[HUF_TABLELOG_MAX + 1]; +typedef rankValCol_t rankVal_t[HUF_TABLELOG_MAX]; + +/** + * Constructs a HUF_DEltX2 in a U32. + */ +static U32 HUF_buildDEltX2U32(U32 symbol, U32 nbBits, U32 baseSeq, int level) +{ + U32 seq; + DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, sequence) == 0); + DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, nbBits) == 2); + DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, length) == 3); + DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(U32)); + if (MEM_isLittleEndian()) { + seq = level == 1 ? symbol : (baseSeq + (symbol << 8)); + return seq + (nbBits << 16) + ((U32)level << 24); + } else { + seq = level == 1 ? (symbol << 8) : ((baseSeq << 8) + symbol); + return (seq << 16) + (nbBits << 8) + (U32)level; + } +} + +/** + * Constructs a HUF_DEltX2. + */ +static HUF_DEltX2 HUF_buildDEltX2(U32 symbol, U32 nbBits, U32 baseSeq, int level) +{ + HUF_DEltX2 DElt; + U32 const val = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level); + DEBUG_STATIC_ASSERT(sizeof(DElt) == sizeof(val)); + ZSTD_memcpy(&DElt, &val, sizeof(val)); + return DElt; +} + +/** + * Constructs 2 HUF_DEltX2s and packs them into a U64. + */ +static U64 HUF_buildDEltX2U64(U32 symbol, U32 nbBits, U16 baseSeq, int level) +{ + U32 DElt = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level); + return (U64)DElt + ((U64)DElt << 32); +} + +/** + * Fills the DTable rank with all the symbols from [begin, end) that are each + * nbBits long. + * + * @param DTableRank The start of the rank in the DTable. + * @param begin The first symbol to fill (inclusive). + * @param end The last symbol to fill (exclusive). + * @param nbBits Each symbol is nbBits long. + * @param tableLog The table log. + * @param baseSeq If level == 1 { 0 } else { the first level symbol } + * @param level The level in the table. Must be 1 or 2. + */ +static void HUF_fillDTableX2ForWeight( + HUF_DEltX2* DTableRank, + sortedSymbol_t const* begin, sortedSymbol_t const* end, + U32 nbBits, U32 tableLog, + U16 baseSeq, int const level) +{ + U32 const length = 1U << ((tableLog - nbBits) & 0x1F /* quiet static-analyzer */); + const sortedSymbol_t* ptr; + assert(level >= 1 && level <= 2); + switch (length) { + case 1: + for (ptr = begin; ptr != end; ++ptr) { + HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level); + *DTableRank++ = DElt; + } + break; + case 2: + for (ptr = begin; ptr != end; ++ptr) { + HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level); + DTableRank[0] = DElt; + DTableRank[1] = DElt; + DTableRank += 2; + } + break; + case 4: + for (ptr = begin; ptr != end; ++ptr) { + U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level); + ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2)); + DTableRank += 4; + } + break; + case 8: + for (ptr = begin; ptr != end; ++ptr) { + U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level); + ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2)); + DTableRank += 8; + } + break; + default: + for (ptr = begin; ptr != end; ++ptr) { + U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level); + HUF_DEltX2* const DTableRankEnd = DTableRank + length; + for (; DTableRank != DTableRankEnd; DTableRank += 8) { + ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2)); + } + } + break; + } +} + +/* HUF_fillDTableX2Level2() : + * `rankValOrigin` must be a table of at least (HUF_TABLELOG_MAX + 1) U32 */ +static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 targetLog, const U32 consumedBits, + const U32* rankVal, const int minWeight, const int maxWeight1, + const sortedSymbol_t* sortedSymbols, U32 const* rankStart, + U32 nbBitsBaseline, U16 baseSeq) +{ + /* Fill skipped values (all positions up to rankVal[minWeight]). + * These are positions only get a single symbol because the combined weight + * is too large. + */ + if (minWeight>1) { + U32 const length = 1U << ((targetLog - consumedBits) & 0x1F /* quiet static-analyzer */); + U64 const DEltX2 = HUF_buildDEltX2U64(baseSeq, consumedBits, /* baseSeq */ 0, /* level */ 1); + int const skipSize = rankVal[minWeight]; + assert(length > 1); + assert((U32)skipSize < length); + switch (length) { + case 2: + assert(skipSize == 1); + ZSTD_memcpy(DTable, &DEltX2, sizeof(DEltX2)); + break; + case 4: + assert(skipSize <= 4); + ZSTD_memcpy(DTable + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + 2, &DEltX2, sizeof(DEltX2)); + break; + default: + { + int i; + for (i = 0; i < skipSize; i += 8) { + ZSTD_memcpy(DTable + i + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + i + 2, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + i + 4, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + i + 6, &DEltX2, sizeof(DEltX2)); + } + } + } + } + + /* Fill each of the second level symbols by weight. */ + { + int w; + for (w = minWeight; w < maxWeight1; ++w) { + int const begin = rankStart[w]; + int const end = rankStart[w+1]; + U32 const nbBits = nbBitsBaseline - w; + U32 const totalBits = nbBits + consumedBits; + HUF_fillDTableX2ForWeight( + DTable + rankVal[w], + sortedSymbols + begin, sortedSymbols + end, + totalBits, targetLog, + baseSeq, /* level */ 2); + } + } +} + +static void HUF_fillDTableX2(HUF_DEltX2* DTable, const U32 targetLog, + const sortedSymbol_t* sortedList, + const U32* rankStart, rankValCol_t* rankValOrigin, const U32 maxWeight, + const U32 nbBitsBaseline) +{ + U32* const rankVal = rankValOrigin[0]; + const int scaleLog = nbBitsBaseline - targetLog; /* note : targetLog >= srcLog, hence scaleLog <= 1 */ + const U32 minBits = nbBitsBaseline - maxWeight; + int w; + int const wEnd = (int)maxWeight + 1; + + /* Fill DTable in order of weight. */ + for (w = 1; w < wEnd; ++w) { + int const begin = (int)rankStart[w]; + int const end = (int)rankStart[w+1]; + U32 const nbBits = nbBitsBaseline - w; + + if (targetLog-nbBits >= minBits) { + /* Enough room for a second symbol. */ + int start = rankVal[w]; + U32 const length = 1U << ((targetLog - nbBits) & 0x1F /* quiet static-analyzer */); + int minWeight = nbBits + scaleLog; + int s; + if (minWeight < 1) minWeight = 1; + /* Fill the DTable for every symbol of weight w. + * These symbols get at least 1 second symbol. + */ + for (s = begin; s != end; ++s) { + HUF_fillDTableX2Level2( + DTable + start, targetLog, nbBits, + rankValOrigin[nbBits], minWeight, wEnd, + sortedList, rankStart, + nbBitsBaseline, sortedList[s].symbol); + start += length; + } + } else { + /* Only a single symbol. */ + HUF_fillDTableX2ForWeight( + DTable + rankVal[w], + sortedList + begin, sortedList + end, + nbBits, targetLog, + /* baseSeq */ 0, /* level */ 1); + } + } +} + +typedef struct { + rankValCol_t rankVal[HUF_TABLELOG_MAX]; + U32 rankStats[HUF_TABLELOG_MAX + 1]; + U32 rankStart0[HUF_TABLELOG_MAX + 3]; + sortedSymbol_t sortedSymbol[HUF_SYMBOLVALUE_MAX + 1]; + BYTE weightList[HUF_SYMBOLVALUE_MAX + 1]; + U32 calleeWksp[HUF_READ_STATS_WORKSPACE_SIZE_U32]; +} HUF_ReadDTableX2_Workspace; + +size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, + const void* src, size_t srcSize, + void* workSpace, size_t wkspSize, int flags) +{ + U32 tableLog, maxW, nbSymbols; + DTableDesc dtd = HUF_getDTableDesc(DTable); + U32 maxTableLog = dtd.maxTableLog; + size_t iSize; + void* dtPtr = DTable+1; /* force compiler to avoid strict-aliasing */ + HUF_DEltX2* const dt = (HUF_DEltX2*)dtPtr; + U32 *rankStart; + + HUF_ReadDTableX2_Workspace* const wksp = (HUF_ReadDTableX2_Workspace*)workSpace; + + if (sizeof(*wksp) > wkspSize) return ERROR(GENERIC); + + rankStart = wksp->rankStart0 + 1; + ZSTD_memset(wksp->rankStats, 0, sizeof(wksp->rankStats)); + ZSTD_memset(wksp->rankStart0, 0, sizeof(wksp->rankStart0)); + + DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(HUF_DTable)); /* if compiler fails here, assertion is wrong */ + if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); + /* ZSTD_memset(weightList, 0, sizeof(weightList)); */ /* is not necessary, even though some analyzer complain ... */ + + iSize = HUF_readStats_wksp(wksp->weightList, HUF_SYMBOLVALUE_MAX + 1, wksp->rankStats, &nbSymbols, &tableLog, src, srcSize, wksp->calleeWksp, sizeof(wksp->calleeWksp), flags); + if (HUF_isError(iSize)) return iSize; + + /* check result */ + if (tableLog > maxTableLog) return ERROR(tableLog_tooLarge); /* DTable can't fit code depth */ + if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG; + + /* find maxWeight */ + for (maxW = tableLog; wksp->rankStats[maxW]==0; maxW--) {} /* necessarily finds a solution before 0 */ + + /* Get start index of each weight */ + { U32 w, nextRankStart = 0; + for (w=1; wrankStats[w]; + rankStart[w] = curr; + } + rankStart[0] = nextRankStart; /* put all 0w symbols at the end of sorted list*/ + rankStart[maxW+1] = nextRankStart; + } + + /* sort symbols by weight */ + { U32 s; + for (s=0; sweightList[s]; + U32 const r = rankStart[w]++; + wksp->sortedSymbol[r].symbol = (BYTE)s; + } + rankStart[0] = 0; /* forget 0w symbols; this is beginning of weight(1) */ + } + + /* Build rankVal */ + { U32* const rankVal0 = wksp->rankVal[0]; + { int const rescale = (maxTableLog-tableLog) - 1; /* tableLog <= maxTableLog */ + U32 nextRankVal = 0; + U32 w; + for (w=1; wrankStats[w] << (w+rescale); + rankVal0[w] = curr; + } } + { U32 const minBits = tableLog+1 - maxW; + U32 consumed; + for (consumed = minBits; consumed < maxTableLog - minBits + 1; consumed++) { + U32* const rankValPtr = wksp->rankVal[consumed]; + U32 w; + for (w = 1; w < maxW+1; w++) { + rankValPtr[w] = rankVal0[w] >> consumed; + } } } } + + HUF_fillDTableX2(dt, maxTableLog, + wksp->sortedSymbol, + wksp->rankStart0, wksp->rankVal, maxW, + tableLog+1); + + dtd.tableLog = (BYTE)maxTableLog; + dtd.tableType = 1; + ZSTD_memcpy(DTable, &dtd, sizeof(dtd)); + return iSize; +} + + +FORCE_INLINE_TEMPLATE U32 +HUF_decodeSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) +{ + size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ + ZSTD_memcpy(op, &dt[val].sequence, 2); + BIT_skipBits(DStream, dt[val].nbBits); + return dt[val].length; +} + +FORCE_INLINE_TEMPLATE U32 +HUF_decodeLastSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) +{ + size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ + ZSTD_memcpy(op, &dt[val].sequence, 1); + if (dt[val].length==1) { + BIT_skipBits(DStream, dt[val].nbBits); + } else { + if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) { + BIT_skipBits(DStream, dt[val].nbBits); + if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8)) + /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */ + DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8); + } + } + return 1; +} + +#define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) \ + ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) + +#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \ + if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ + ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) + +#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr) \ + if (MEM_64bits()) \ + ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) + +HINT_INLINE size_t +HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, + const HUF_DEltX2* const dt, const U32 dtLog) +{ + BYTE* const pStart = p; + + /* up to 8 symbols at a time */ + if ((size_t)(pEnd - p) >= sizeof(bitDPtr->bitContainer)) { + if (dtLog <= 11 && MEM_64bits()) { + /* up to 10 symbols at a time */ + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-9)) { + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + } + } else { + /* up to 8 symbols at a time */ + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) { + HUF_DECODE_SYMBOLX2_2(p, bitDPtr); + HUF_DECODE_SYMBOLX2_1(p, bitDPtr); + HUF_DECODE_SYMBOLX2_2(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + } + } + } else { + BIT_reloadDStream(bitDPtr); + } + + /* closer to end : up to 2 symbols at a time */ + if ((size_t)(pEnd - p) >= 2) { + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2)) + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + + while (p <= pEnd-2) + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); /* no need to reload : reached the end of DStream */ + } + + if (p < pEnd) + p += HUF_decodeLastSymbolX2(p, bitDPtr, dt, dtLog); + + return p-pStart; +} + +FORCE_INLINE_TEMPLATE size_t +HUF_decompress1X2_usingDTable_internal_body( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable) +{ + BIT_DStream_t bitD; + + /* Init */ + CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) ); + + /* decode */ + { BYTE* const ostart = (BYTE*) dst; + BYTE* const oend = ostart + dstSize; + const void* const dtPtr = DTable+1; /* force compiler to not use strict-aliasing */ + const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr; + DTableDesc const dtd = HUF_getDTableDesc(DTable); + HUF_decodeStreamX2(ostart, &bitD, oend, dt, dtd.tableLog); + } + + /* check */ + if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected); + + /* decoded size */ + return dstSize; +} + +/* HUF_decompress4X2_usingDTable_internal_body(): + * Conditions: + * @dstSize >= 6 + */ +FORCE_INLINE_TEMPLATE size_t +HUF_decompress4X2_usingDTable_internal_body( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable) +{ + if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ + + { const BYTE* const istart = (const BYTE*) cSrc; + BYTE* const ostart = (BYTE*) dst; + BYTE* const oend = ostart + dstSize; + BYTE* const olimit = oend - (sizeof(size_t)-1); + const void* const dtPtr = DTable+1; + const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr; + + /* Init */ + BIT_DStream_t bitD1; + BIT_DStream_t bitD2; + BIT_DStream_t bitD3; + BIT_DStream_t bitD4; + size_t const length1 = MEM_readLE16(istart); + size_t const length2 = MEM_readLE16(istart+2); + size_t const length3 = MEM_readLE16(istart+4); + size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6); + const BYTE* const istart1 = istart + 6; /* jumpTable */ + const BYTE* const istart2 = istart1 + length1; + const BYTE* const istart3 = istart2 + length2; + const BYTE* const istart4 = istart3 + length3; + size_t const segmentSize = (dstSize+3) / 4; + BYTE* const opStart2 = ostart + segmentSize; + BYTE* const opStart3 = opStart2 + segmentSize; + BYTE* const opStart4 = opStart3 + segmentSize; + BYTE* op1 = ostart; + BYTE* op2 = opStart2; + BYTE* op3 = opStart3; + BYTE* op4 = opStart4; + U32 endSignal = 1; + DTableDesc const dtd = HUF_getDTableDesc(DTable); + U32 const dtLog = dtd.tableLog; + + if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ + if (opStart4 > oend) return ERROR(corruption_detected); /* overflow */ + if (dstSize < 6) return ERROR(corruption_detected); /* stream 4-split doesn't work */ + CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); + CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); + CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); + CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); + + /* 16-32 symbols per loop (4-8 symbols per stream) */ + if ((size_t)(oend - op4) >= sizeof(size_t)) { + for ( ; (endSignal) & (op4 < olimit); ) { +#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_1(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_0(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_1(op2, &bitD2); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_0(op2, &bitD2); + endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_1(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_0(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_1(op4, &bitD4); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_0(op4, &bitD4); + endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; +#else + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_1(op1, &bitD1); + HUF_DECODE_SYMBOLX2_1(op2, &bitD2); + HUF_DECODE_SYMBOLX2_1(op3, &bitD3); + HUF_DECODE_SYMBOLX2_1(op4, &bitD4); + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_0(op1, &bitD1); + HUF_DECODE_SYMBOLX2_0(op2, &bitD2); + HUF_DECODE_SYMBOLX2_0(op3, &bitD3); + HUF_DECODE_SYMBOLX2_0(op4, &bitD4); + endSignal = (U32)LIKELY((U32) + (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished) + & (BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished) + & (BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished) + & (BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished)); +#endif + } + } + + /* check corruption */ + if (op1 > opStart2) return ERROR(corruption_detected); + if (op2 > opStart3) return ERROR(corruption_detected); + if (op3 > opStart4) return ERROR(corruption_detected); + /* note : op4 already verified within main loop */ + + /* finish bitStreams one by one */ + HUF_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog); + HUF_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog); + HUF_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog); + HUF_decodeStreamX2(op4, &bitD4, oend, dt, dtLog); + + /* check */ + { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); + if (!endCheck) return ERROR(corruption_detected); } + + /* decoded size */ + return dstSize; + } +} + +#if HUF_NEED_BMI2_FUNCTION +static BMI2_TARGET_ATTRIBUTE +size_t HUF_decompress4X2_usingDTable_internal_bmi2(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} +#endif + +static +size_t HUF_decompress4X2_usingDTable_internal_default(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} + +#if ZSTD_ENABLE_ASM_X86_64_BMI2 + +HUF_ASM_DECL void HUF_decompress4X2_usingDTable_internal_fast_asm_loop(HUF_DecompressFastArgs* args) ZSTDLIB_HIDDEN; + +#endif + +static HUF_FAST_BMI2_ATTRS +void HUF_decompress4X2_usingDTable_internal_fast_c_loop(HUF_DecompressFastArgs* args) +{ + U64 bits[4]; + BYTE const* ip[4]; + BYTE* op[4]; + BYTE* oend[4]; + HUF_DEltX2 const* const dtable = (HUF_DEltX2 const*)args->dt; + BYTE const* const ilimit = args->ilimit; + + /* Copy the arguments to local registers. */ + ZSTD_memcpy(&bits, &args->bits, sizeof(bits)); + ZSTD_memcpy(&ip, &args->ip, sizeof(ip)); + ZSTD_memcpy(&op, &args->op, sizeof(op)); + + oend[0] = op[1]; + oend[1] = op[2]; + oend[2] = op[3]; + oend[3] = args->oend; + + assert(MEM_isLittleEndian()); + assert(!MEM_32bits()); + + for (;;) { + BYTE* olimit; + int stream; + int symbol; + + /* Assert loop preconditions */ +#ifndef NDEBUG + for (stream = 0; stream < 4; ++stream) { + assert(op[stream] <= oend[stream]); + assert(ip[stream] >= ilimit); + } +#endif + /* Compute olimit */ + { + /* Each loop does 5 table lookups for each of the 4 streams. + * Each table lookup consumes up to 11 bits of input, and produces + * up to 2 bytes of output. + */ + /* We can consume up to 7 bytes of input per iteration per stream. + * We also know that each input pointer is >= ip[0]. So we can run + * iters loops before running out of input. + */ + size_t iters = (size_t)(ip[0] - ilimit) / 7; + /* Each iteration can produce up to 10 bytes of output per stream. + * Each output stream my advance at different rates. So take the + * minimum number of safe iterations among all the output streams. + */ + for (stream = 0; stream < 4; ++stream) { + size_t const oiters = (size_t)(oend[stream] - op[stream]) / 10; + iters = MIN(iters, oiters); + } + + /* Each iteration produces at least 5 output symbols. So until + * op[3] crosses olimit, we know we haven't executed iters + * iterations yet. This saves us maintaining an iters counter, + * at the expense of computing the remaining # of iterations + * more frequently. + */ + olimit = op[3] + (iters * 5); + + /* Exit the fast decoding loop if we are too close to the end. */ + if (op[3] + 10 > olimit) + break; + + /* Exit the decoding loop if any input pointer has crossed the + * previous one. This indicates corruption, and a precondition + * to our loop is that ip[i] >= ip[0]. + */ + for (stream = 1; stream < 4; ++stream) { + if (ip[stream] < ip[stream - 1]) + goto _out; + } + } + +#ifndef NDEBUG + for (stream = 1; stream < 4; ++stream) { + assert(ip[stream] >= ip[stream - 1]); + } +#endif + + do { + /* Do 5 table lookups for each of the first 3 streams */ + for (symbol = 0; symbol < 5; ++symbol) { + for (stream = 0; stream < 3; ++stream) { + int const index = (int)(bits[stream] >> 53); + HUF_DEltX2 const entry = dtable[index]; + MEM_write16(op[stream], entry.sequence); + bits[stream] <<= (entry.nbBits); + op[stream] += (entry.length); + } + } + /* Do 1 table lookup from the final stream */ + { + int const index = (int)(bits[3] >> 53); + HUF_DEltX2 const entry = dtable[index]; + MEM_write16(op[3], entry.sequence); + bits[3] <<= (entry.nbBits); + op[3] += (entry.length); + } + /* Do 4 table lookups from the final stream & reload bitstreams */ + for (stream = 0; stream < 4; ++stream) { + /* Do a table lookup from the final stream. + * This is interleaved with the reloading to reduce register + * pressure. This shouldn't be necessary, but compilers can + * struggle with codegen with high register pressure. + */ + { + int const index = (int)(bits[3] >> 53); + HUF_DEltX2 const entry = dtable[index]; + MEM_write16(op[3], entry.sequence); + bits[3] <<= (entry.nbBits); + op[3] += (entry.length); + } + /* Reload the bistreams. The final bitstream must be reloaded + * after the 5th symbol was decoded. + */ + { + int const ctz = ZSTD_countTrailingZeros64(bits[stream]); + int const nbBits = ctz & 7; + int const nbBytes = ctz >> 3; + ip[stream] -= nbBytes; + bits[stream] = MEM_read64(ip[stream]) | 1; + bits[stream] <<= nbBits; + } + } + } while (op[3] < olimit); + } + +_out: + + /* Save the final values of each of the state variables back to args. */ + ZSTD_memcpy(&args->bits, &bits, sizeof(bits)); + ZSTD_memcpy(&args->ip, &ip, sizeof(ip)); + ZSTD_memcpy(&args->op, &op, sizeof(op)); +} + + +static HUF_FAST_BMI2_ATTRS size_t +HUF_decompress4X2_usingDTable_internal_fast( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable, + HUF_DecompressFastLoopFn loopFn) { + void const* dt = DTable + 1; + const BYTE* const iend = (const BYTE*)cSrc + 6; + BYTE* const oend = (BYTE*)dst + dstSize; + HUF_DecompressFastArgs args; + { + size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable); + FORWARD_IF_ERROR(ret, "Failed to init asm args"); + if (ret == 0) + return 0; + } + + assert(args.ip[0] >= args.ilimit); + loopFn(&args); + + /* note : op4 already verified within main loop */ + assert(args.ip[0] >= iend); + assert(args.ip[1] >= iend); + assert(args.ip[2] >= iend); + assert(args.ip[3] >= iend); + assert(args.op[3] <= oend); + (void)iend; + + /* finish bitStreams one by one */ + { + size_t const segmentSize = (dstSize+3) / 4; + BYTE* segmentEnd = (BYTE*)dst; + int i; + for (i = 0; i < 4; ++i) { + BIT_DStream_t bit; + if (segmentSize <= (size_t)(oend - segmentEnd)) + segmentEnd += segmentSize; + else + segmentEnd = oend; + FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption"); + args.op[i] += HUF_decodeStreamX2(args.op[i], &bit, segmentEnd, (HUF_DEltX2 const*)dt, HUF_DECODER_FAST_TABLELOG); + if (args.op[i] != segmentEnd) + return ERROR(corruption_detected); + } + } + + /* decoded size */ + return dstSize; +} + +static size_t HUF_decompress4X2_usingDTable_internal(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable, int flags) +{ + HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X2_usingDTable_internal_default; + HUF_DecompressFastLoopFn loopFn = HUF_decompress4X2_usingDTable_internal_fast_c_loop; + +#if DYNAMIC_BMI2 + if (flags & HUF_flags_bmi2) { + fallbackFn = HUF_decompress4X2_usingDTable_internal_bmi2; +# if ZSTD_ENABLE_ASM_X86_64_BMI2 + if (!(flags & HUF_flags_disableAsm)) { + loopFn = HUF_decompress4X2_usingDTable_internal_fast_asm_loop; + } +# endif + } else { + return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable); + } +#endif + +#if ZSTD_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__) + if (!(flags & HUF_flags_disableAsm)) { + loopFn = HUF_decompress4X2_usingDTable_internal_fast_asm_loop; + } +#endif + + if (!(flags & HUF_flags_disableFast)) { + size_t const ret = HUF_decompress4X2_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn); + if (ret != 0) + return ret; + } + return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable); +} + +HUF_DGEN(HUF_decompress1X2_usingDTable_internal) + +size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + void* workSpace, size_t wkspSize, int flags) +{ + const BYTE* ip = (const BYTE*) cSrc; + + size_t const hSize = HUF_readDTableX2_wksp(DCtx, cSrc, cSrcSize, + workSpace, wkspSize, flags); + if (HUF_isError(hSize)) return hSize; + if (hSize >= cSrcSize) return ERROR(srcSize_wrong); + ip += hSize; cSrcSize -= hSize; + + return HUF_decompress1X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx, flags); +} + +static size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + void* workSpace, size_t wkspSize, int flags) +{ + const BYTE* ip = (const BYTE*) cSrc; + + size_t hSize = HUF_readDTableX2_wksp(dctx, cSrc, cSrcSize, + workSpace, wkspSize, flags); + if (HUF_isError(hSize)) return hSize; + if (hSize >= cSrcSize) return ERROR(srcSize_wrong); + ip += hSize; cSrcSize -= hSize; + + return HUF_decompress4X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags); +} + +#endif /* HUF_FORCE_DECOMPRESS_X1 */ + + +/* ***********************************/ +/* Universal decompression selectors */ +/* ***********************************/ + + +#if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2) +typedef struct { U32 tableTime; U32 decode256Time; } algo_time_t; +static const algo_time_t algoTime[16 /* Quantization */][2 /* single, double */] = +{ + /* single, double, quad */ + {{0,0}, {1,1}}, /* Q==0 : impossible */ + {{0,0}, {1,1}}, /* Q==1 : impossible */ + {{ 150,216}, { 381,119}}, /* Q == 2 : 12-18% */ + {{ 170,205}, { 514,112}}, /* Q == 3 : 18-25% */ + {{ 177,199}, { 539,110}}, /* Q == 4 : 25-32% */ + {{ 197,194}, { 644,107}}, /* Q == 5 : 32-38% */ + {{ 221,192}, { 735,107}}, /* Q == 6 : 38-44% */ + {{ 256,189}, { 881,106}}, /* Q == 7 : 44-50% */ + {{ 359,188}, {1167,109}}, /* Q == 8 : 50-56% */ + {{ 582,187}, {1570,114}}, /* Q == 9 : 56-62% */ + {{ 688,187}, {1712,122}}, /* Q ==10 : 62-69% */ + {{ 825,186}, {1965,136}}, /* Q ==11 : 69-75% */ + {{ 976,185}, {2131,150}}, /* Q ==12 : 75-81% */ + {{1180,186}, {2070,175}}, /* Q ==13 : 81-87% */ + {{1377,185}, {1731,202}}, /* Q ==14 : 87-93% */ + {{1412,185}, {1695,202}}, /* Q ==15 : 93-99% */ +}; +#endif + +/** HUF_selectDecoder() : + * Tells which decoder is likely to decode faster, + * based on a set of pre-computed metrics. + * @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 . + * Assumption : 0 < dstSize <= 128 KB */ +U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize) +{ + assert(dstSize > 0); + assert(dstSize <= 128*1024); +#if defined(HUF_FORCE_DECOMPRESS_X1) + (void)dstSize; + (void)cSrcSize; + return 0; +#elif defined(HUF_FORCE_DECOMPRESS_X2) + (void)dstSize; + (void)cSrcSize; + return 1; +#else + /* decoder timing evaluation */ + { U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize); /* Q < 16 */ + U32 const D256 = (U32)(dstSize >> 8); + U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256); + U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256); + DTime1 += DTime1 >> 5; /* small advantage to algorithm using less memory, to reduce cache eviction */ + return DTime1 < DTime0; + } +#endif +} + +size_t HUF_decompress1X_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + void* workSpace, size_t wkspSize, int flags) +{ + /* validation checks */ + if (dstSize == 0) return ERROR(dstSize_tooSmall); + if (cSrcSize > dstSize) return ERROR(corruption_detected); /* invalid */ + if (cSrcSize == dstSize) { ZSTD_memcpy(dst, cSrc, dstSize); return dstSize; } /* not compressed */ + if (cSrcSize == 1) { ZSTD_memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; } /* RLE */ + + { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); +#if defined(HUF_FORCE_DECOMPRESS_X1) + (void)algoNb; + assert(algoNb == 0); + return HUF_decompress1X1_DCtx_wksp(dctx, dst, dstSize, cSrc, + cSrcSize, workSpace, wkspSize, flags); +#elif defined(HUF_FORCE_DECOMPRESS_X2) + (void)algoNb; + assert(algoNb == 1); + return HUF_decompress1X2_DCtx_wksp(dctx, dst, dstSize, cSrc, + cSrcSize, workSpace, wkspSize, flags); +#else + return algoNb ? HUF_decompress1X2_DCtx_wksp(dctx, dst, dstSize, cSrc, + cSrcSize, workSpace, wkspSize, flags): + HUF_decompress1X1_DCtx_wksp(dctx, dst, dstSize, cSrc, + cSrcSize, workSpace, wkspSize, flags); +#endif + } +} + + +size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags) +{ + DTableDesc const dtd = HUF_getDTableDesc(DTable); +#if defined(HUF_FORCE_DECOMPRESS_X1) + (void)dtd; + assert(dtd.tableType == 0); + return HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags); +#elif defined(HUF_FORCE_DECOMPRESS_X2) + (void)dtd; + assert(dtd.tableType == 1); + return HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags); +#else + return dtd.tableType ? HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags) : + HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags); +#endif +} + +#ifndef HUF_FORCE_DECOMPRESS_X2 +size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags) +{ + const BYTE* ip = (const BYTE*) cSrc; + + size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags); + if (HUF_isError(hSize)) return hSize; + if (hSize >= cSrcSize) return ERROR(srcSize_wrong); + ip += hSize; cSrcSize -= hSize; + + return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags); +} +#endif + +size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags) +{ + DTableDesc const dtd = HUF_getDTableDesc(DTable); +#if defined(HUF_FORCE_DECOMPRESS_X1) + (void)dtd; + assert(dtd.tableType == 0); + return HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags); +#elif defined(HUF_FORCE_DECOMPRESS_X2) + (void)dtd; + assert(dtd.tableType == 1); + return HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags); +#else + return dtd.tableType ? HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags) : + HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags); +#endif +} + +size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags) +{ + /* validation checks */ + if (dstSize == 0) return ERROR(dstSize_tooSmall); + if (cSrcSize == 0) return ERROR(corruption_detected); + + { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); +#if defined(HUF_FORCE_DECOMPRESS_X1) + (void)algoNb; + assert(algoNb == 0); + return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags); +#elif defined(HUF_FORCE_DECOMPRESS_X2) + (void)algoNb; + assert(algoNb == 1); + return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags); +#else + return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags) : + HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags); +#endif + } +} diff --git a/src/dependencies/zstd-1.5.4/lib/decompress/huf_decompress_amd64.S b/src/dependencies/zstd-1.5.4/lib/decompress/huf_decompress_amd64.S new file mode 100644 index 0000000..671624f --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/decompress/huf_decompress_amd64.S @@ -0,0 +1,576 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#include "../common/portability_macros.h" + +/* Stack marking + * ref: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart + */ +#if defined(__ELF__) && defined(__GNUC__) +.section .note.GNU-stack,"",%progbits +#endif + +#if ZSTD_ENABLE_ASM_X86_64_BMI2 + +/* Calling convention: + * + * %rdi contains the first argument: HUF_DecompressAsmArgs*. + * %rbp isn't maintained (no frame pointer). + * %rsp contains the stack pointer that grows down. + * No red-zone is assumed, only addresses >= %rsp are used. + * All register contents are preserved. + * + * TODO: Support Windows calling convention. + */ + +ZSTD_HIDE_ASM_FUNCTION(HUF_decompress4X1_usingDTable_internal_fast_asm_loop) +ZSTD_HIDE_ASM_FUNCTION(HUF_decompress4X2_usingDTable_internal_fast_asm_loop) +ZSTD_HIDE_ASM_FUNCTION(_HUF_decompress4X2_usingDTable_internal_fast_asm_loop) +ZSTD_HIDE_ASM_FUNCTION(_HUF_decompress4X1_usingDTable_internal_fast_asm_loop) +.global HUF_decompress4X1_usingDTable_internal_fast_asm_loop +.global HUF_decompress4X2_usingDTable_internal_fast_asm_loop +.global _HUF_decompress4X1_usingDTable_internal_fast_asm_loop +.global _HUF_decompress4X2_usingDTable_internal_fast_asm_loop +.text + +/* Sets up register mappings for clarity. + * op[], bits[], dtable & ip[0] each get their own register. + * ip[1,2,3] & olimit alias var[]. + * %rax is a scratch register. + */ + +#define op0 rsi +#define op1 rbx +#define op2 rcx +#define op3 rdi + +#define ip0 r8 +#define ip1 r9 +#define ip2 r10 +#define ip3 r11 + +#define bits0 rbp +#define bits1 rdx +#define bits2 r12 +#define bits3 r13 +#define dtable r14 +#define olimit r15 + +/* var[] aliases ip[1,2,3] & olimit + * ip[1,2,3] are saved every iteration. + * olimit is only used in compute_olimit. + */ +#define var0 r15 +#define var1 r9 +#define var2 r10 +#define var3 r11 + +/* 32-bit var registers */ +#define vard0 r15d +#define vard1 r9d +#define vard2 r10d +#define vard3 r11d + +/* Calls X(N) for each stream 0, 1, 2, 3. */ +#define FOR_EACH_STREAM(X) \ + X(0); \ + X(1); \ + X(2); \ + X(3) + +/* Calls X(N, idx) for each stream 0, 1, 2, 3. */ +#define FOR_EACH_STREAM_WITH_INDEX(X, idx) \ + X(0, idx); \ + X(1, idx); \ + X(2, idx); \ + X(3, idx) + +/* Define both _HUF_* & HUF_* symbols because MacOS + * C symbols are prefixed with '_' & Linux symbols aren't. + */ +_HUF_decompress4X1_usingDTable_internal_fast_asm_loop: +HUF_decompress4X1_usingDTable_internal_fast_asm_loop: + ZSTD_CET_ENDBRANCH + /* Save all registers - even if they are callee saved for simplicity. */ + push %rax + push %rbx + push %rcx + push %rdx + push %rbp + push %rsi + push %rdi + push %r8 + push %r9 + push %r10 + push %r11 + push %r12 + push %r13 + push %r14 + push %r15 + + /* Read HUF_DecompressAsmArgs* args from %rax */ + movq %rdi, %rax + movq 0(%rax), %ip0 + movq 8(%rax), %ip1 + movq 16(%rax), %ip2 + movq 24(%rax), %ip3 + movq 32(%rax), %op0 + movq 40(%rax), %op1 + movq 48(%rax), %op2 + movq 56(%rax), %op3 + movq 64(%rax), %bits0 + movq 72(%rax), %bits1 + movq 80(%rax), %bits2 + movq 88(%rax), %bits3 + movq 96(%rax), %dtable + push %rax /* argument */ + push 104(%rax) /* ilimit */ + push 112(%rax) /* oend */ + push %olimit /* olimit space */ + + subq $24, %rsp + +.L_4X1_compute_olimit: + /* Computes how many iterations we can do safely + * %r15, %rax may be clobbered + * rbx, rdx must be saved + * op3 & ip0 mustn't be clobbered + */ + movq %rbx, 0(%rsp) + movq %rdx, 8(%rsp) + + movq 32(%rsp), %rax /* rax = oend */ + subq %op3, %rax /* rax = oend - op3 */ + + /* r15 = (oend - op3) / 5 */ + movabsq $-3689348814741910323, %rdx + mulq %rdx + movq %rdx, %r15 + shrq $2, %r15 + + movq %ip0, %rax /* rax = ip0 */ + movq 40(%rsp), %rdx /* rdx = ilimit */ + subq %rdx, %rax /* rax = ip0 - ilimit */ + movq %rax, %rbx /* rbx = ip0 - ilimit */ + + /* rdx = (ip0 - ilimit) / 7 */ + movabsq $2635249153387078803, %rdx + mulq %rdx + subq %rdx, %rbx + shrq %rbx + addq %rbx, %rdx + shrq $2, %rdx + + /* r15 = min(%rdx, %r15) */ + cmpq %rdx, %r15 + cmova %rdx, %r15 + + /* r15 = r15 * 5 */ + leaq (%r15, %r15, 4), %r15 + + /* olimit = op3 + r15 */ + addq %op3, %olimit + + movq 8(%rsp), %rdx + movq 0(%rsp), %rbx + + /* If (op3 + 20 > olimit) */ + movq %op3, %rax /* rax = op3 */ + addq $20, %rax /* rax = op3 + 20 */ + cmpq %rax, %olimit /* op3 + 20 > olimit */ + jb .L_4X1_exit + + /* If (ip1 < ip0) go to exit */ + cmpq %ip0, %ip1 + jb .L_4X1_exit + + /* If (ip2 < ip1) go to exit */ + cmpq %ip1, %ip2 + jb .L_4X1_exit + + /* If (ip3 < ip2) go to exit */ + cmpq %ip2, %ip3 + jb .L_4X1_exit + +/* Reads top 11 bits from bits[n] + * Loads dt[bits[n]] into var[n] + */ +#define GET_NEXT_DELT(n) \ + movq $53, %var##n; \ + shrxq %var##n, %bits##n, %var##n; \ + movzwl (%dtable,%var##n,2),%vard##n + +/* var[n] must contain the DTable entry computed with GET_NEXT_DELT + * Moves var[n] to %rax + * bits[n] <<= var[n] & 63 + * op[n][idx] = %rax >> 8 + * %ah is a way to access bits [8, 16) of %rax + */ +#define DECODE_FROM_DELT(n, idx) \ + movq %var##n, %rax; \ + shlxq %var##n, %bits##n, %bits##n; \ + movb %ah, idx(%op##n) + +/* Assumes GET_NEXT_DELT has been called. + * Calls DECODE_FROM_DELT then GET_NEXT_DELT + */ +#define DECODE_AND_GET_NEXT(n, idx) \ + DECODE_FROM_DELT(n, idx); \ + GET_NEXT_DELT(n) \ + +/* // ctz & nbBytes is stored in bits[n] + * // nbBits is stored in %rax + * ctz = CTZ[bits[n]] + * nbBits = ctz & 7 + * nbBytes = ctz >> 3 + * op[n] += 5 + * ip[n] -= nbBytes + * // Note: x86-64 is little-endian ==> no bswap + * bits[n] = MEM_readST(ip[n]) | 1 + * bits[n] <<= nbBits + */ +#define RELOAD_BITS(n) \ + bsfq %bits##n, %bits##n; \ + movq %bits##n, %rax; \ + andq $7, %rax; \ + shrq $3, %bits##n; \ + leaq 5(%op##n), %op##n; \ + subq %bits##n, %ip##n; \ + movq (%ip##n), %bits##n; \ + orq $1, %bits##n; \ + shlx %rax, %bits##n, %bits##n + + /* Store clobbered variables on the stack */ + movq %olimit, 24(%rsp) + movq %ip1, 0(%rsp) + movq %ip2, 8(%rsp) + movq %ip3, 16(%rsp) + + /* Call GET_NEXT_DELT for each stream */ + FOR_EACH_STREAM(GET_NEXT_DELT) + + .p2align 6 + +.L_4X1_loop_body: + /* Decode 5 symbols in each of the 4 streams (20 total) + * Must have called GET_NEXT_DELT for each stream + */ + FOR_EACH_STREAM_WITH_INDEX(DECODE_AND_GET_NEXT, 0) + FOR_EACH_STREAM_WITH_INDEX(DECODE_AND_GET_NEXT, 1) + FOR_EACH_STREAM_WITH_INDEX(DECODE_AND_GET_NEXT, 2) + FOR_EACH_STREAM_WITH_INDEX(DECODE_AND_GET_NEXT, 3) + FOR_EACH_STREAM_WITH_INDEX(DECODE_FROM_DELT, 4) + + /* Load ip[1,2,3] from stack (var[] aliases them) + * ip[] is needed for RELOAD_BITS + * Each will be stored back to the stack after RELOAD + */ + movq 0(%rsp), %ip1 + movq 8(%rsp), %ip2 + movq 16(%rsp), %ip3 + + /* Reload each stream & fetch the next table entry + * to prepare for the next iteration + */ + RELOAD_BITS(0) + GET_NEXT_DELT(0) + + RELOAD_BITS(1) + movq %ip1, 0(%rsp) + GET_NEXT_DELT(1) + + RELOAD_BITS(2) + movq %ip2, 8(%rsp) + GET_NEXT_DELT(2) + + RELOAD_BITS(3) + movq %ip3, 16(%rsp) + GET_NEXT_DELT(3) + + /* If op3 < olimit: continue the loop */ + cmp %op3, 24(%rsp) + ja .L_4X1_loop_body + + /* Reload ip[1,2,3] from stack */ + movq 0(%rsp), %ip1 + movq 8(%rsp), %ip2 + movq 16(%rsp), %ip3 + + /* Re-compute olimit */ + jmp .L_4X1_compute_olimit + +#undef GET_NEXT_DELT +#undef DECODE_FROM_DELT +#undef DECODE +#undef RELOAD_BITS +.L_4X1_exit: + addq $24, %rsp + + /* Restore stack (oend & olimit) */ + pop %rax /* olimit */ + pop %rax /* oend */ + pop %rax /* ilimit */ + pop %rax /* arg */ + + /* Save ip / op / bits */ + movq %ip0, 0(%rax) + movq %ip1, 8(%rax) + movq %ip2, 16(%rax) + movq %ip3, 24(%rax) + movq %op0, 32(%rax) + movq %op1, 40(%rax) + movq %op2, 48(%rax) + movq %op3, 56(%rax) + movq %bits0, 64(%rax) + movq %bits1, 72(%rax) + movq %bits2, 80(%rax) + movq %bits3, 88(%rax) + + /* Restore registers */ + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %r11 + pop %r10 + pop %r9 + pop %r8 + pop %rdi + pop %rsi + pop %rbp + pop %rdx + pop %rcx + pop %rbx + pop %rax + ret + +_HUF_decompress4X2_usingDTable_internal_fast_asm_loop: +HUF_decompress4X2_usingDTable_internal_fast_asm_loop: + ZSTD_CET_ENDBRANCH + /* Save all registers - even if they are callee saved for simplicity. */ + push %rax + push %rbx + push %rcx + push %rdx + push %rbp + push %rsi + push %rdi + push %r8 + push %r9 + push %r10 + push %r11 + push %r12 + push %r13 + push %r14 + push %r15 + + movq %rdi, %rax + movq 0(%rax), %ip0 + movq 8(%rax), %ip1 + movq 16(%rax), %ip2 + movq 24(%rax), %ip3 + movq 32(%rax), %op0 + movq 40(%rax), %op1 + movq 48(%rax), %op2 + movq 56(%rax), %op3 + movq 64(%rax), %bits0 + movq 72(%rax), %bits1 + movq 80(%rax), %bits2 + movq 88(%rax), %bits3 + movq 96(%rax), %dtable + push %rax /* argument */ + push %rax /* olimit */ + push 104(%rax) /* ilimit */ + + movq 112(%rax), %rax + push %rax /* oend3 */ + + movq %op3, %rax + push %rax /* oend2 */ + + movq %op2, %rax + push %rax /* oend1 */ + + movq %op1, %rax + push %rax /* oend0 */ + + /* Scratch space */ + subq $8, %rsp + +.L_4X2_compute_olimit: + /* Computes how many iterations we can do safely + * %r15, %rax may be clobbered + * rdx must be saved + * op[1,2,3,4] & ip0 mustn't be clobbered + */ + movq %rdx, 0(%rsp) + + /* We can consume up to 7 input bytes each iteration. */ + movq %ip0, %rax /* rax = ip0 */ + movq 40(%rsp), %rdx /* rdx = ilimit */ + subq %rdx, %rax /* rax = ip0 - ilimit */ + movq %rax, %r15 /* r15 = ip0 - ilimit */ + + /* rdx = rax / 7 */ + movabsq $2635249153387078803, %rdx + mulq %rdx + subq %rdx, %r15 + shrq %r15 + addq %r15, %rdx + shrq $2, %rdx + + /* r15 = (ip0 - ilimit) / 7 */ + movq %rdx, %r15 + + /* r15 = min(r15, min(oend0 - op0, oend1 - op1, oend2 - op2, oend3 - op3) / 10) */ + movq 8(%rsp), %rax /* rax = oend0 */ + subq %op0, %rax /* rax = oend0 - op0 */ + movq 16(%rsp), %rdx /* rdx = oend1 */ + subq %op1, %rdx /* rdx = oend1 - op1 */ + + cmpq %rax, %rdx + cmova %rax, %rdx /* rdx = min(%rdx, %rax) */ + + movq 24(%rsp), %rax /* rax = oend2 */ + subq %op2, %rax /* rax = oend2 - op2 */ + + cmpq %rax, %rdx + cmova %rax, %rdx /* rdx = min(%rdx, %rax) */ + + movq 32(%rsp), %rax /* rax = oend3 */ + subq %op3, %rax /* rax = oend3 - op3 */ + + cmpq %rax, %rdx + cmova %rax, %rdx /* rdx = min(%rdx, %rax) */ + + movabsq $-3689348814741910323, %rax + mulq %rdx + shrq $3, %rdx /* rdx = rdx / 10 */ + + /* r15 = min(%rdx, %r15) */ + cmpq %rdx, %r15 + cmova %rdx, %r15 + + /* olimit = op3 + 5 * r15 */ + movq %r15, %rax + leaq (%op3, %rax, 4), %olimit + addq %rax, %olimit + + movq 0(%rsp), %rdx + + /* If (op3 + 10 > olimit) */ + movq %op3, %rax /* rax = op3 */ + addq $10, %rax /* rax = op3 + 10 */ + cmpq %rax, %olimit /* op3 + 10 > olimit */ + jb .L_4X2_exit + + /* If (ip1 < ip0) go to exit */ + cmpq %ip0, %ip1 + jb .L_4X2_exit + + /* If (ip2 < ip1) go to exit */ + cmpq %ip1, %ip2 + jb .L_4X2_exit + + /* If (ip3 < ip2) go to exit */ + cmpq %ip2, %ip3 + jb .L_4X2_exit + +#define DECODE(n, idx) \ + movq %bits##n, %rax; \ + shrq $53, %rax; \ + movzwl 0(%dtable,%rax,4),%r8d; \ + movzbl 2(%dtable,%rax,4),%r15d; \ + movzbl 3(%dtable,%rax,4),%eax; \ + movw %r8w, (%op##n); \ + shlxq %r15, %bits##n, %bits##n; \ + addq %rax, %op##n + +#define RELOAD_BITS(n) \ + bsfq %bits##n, %bits##n; \ + movq %bits##n, %rax; \ + shrq $3, %bits##n; \ + andq $7, %rax; \ + subq %bits##n, %ip##n; \ + movq (%ip##n), %bits##n; \ + orq $1, %bits##n; \ + shlxq %rax, %bits##n, %bits##n + + + movq %olimit, 48(%rsp) + + .p2align 6 + +.L_4X2_loop_body: + /* We clobber r8, so store it on the stack */ + movq %r8, 0(%rsp) + + /* Decode 5 symbols from each of the 4 streams (20 symbols total). */ + FOR_EACH_STREAM_WITH_INDEX(DECODE, 0) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 1) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 2) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 3) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 4) + + /* Reload r8 */ + movq 0(%rsp), %r8 + + FOR_EACH_STREAM(RELOAD_BITS) + + cmp %op3, 48(%rsp) + ja .L_4X2_loop_body + jmp .L_4X2_compute_olimit + +#undef DECODE +#undef RELOAD_BITS +.L_4X2_exit: + addq $8, %rsp + /* Restore stack (oend & olimit) */ + pop %rax /* oend0 */ + pop %rax /* oend1 */ + pop %rax /* oend2 */ + pop %rax /* oend3 */ + pop %rax /* ilimit */ + pop %rax /* olimit */ + pop %rax /* arg */ + + /* Save ip / op / bits */ + movq %ip0, 0(%rax) + movq %ip1, 8(%rax) + movq %ip2, 16(%rax) + movq %ip3, 24(%rax) + movq %op0, 32(%rax) + movq %op1, 40(%rax) + movq %op2, 48(%rax) + movq %op3, 56(%rax) + movq %bits0, 64(%rax) + movq %bits1, 72(%rax) + movq %bits2, 80(%rax) + movq %bits3, 88(%rax) + + /* Restore registers */ + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %r11 + pop %r10 + pop %r9 + pop %r8 + pop %rdi + pop %rsi + pop %rbp + pop %rdx + pop %rcx + pop %rbx + pop %rax + ret + +#endif diff --git a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_ddict.c b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_ddict.c similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/decompress/zstd_ddict.c rename to src/dependencies/zstd-1.5.4/lib/decompress/zstd_ddict.c index ce33547..ad5c34a 100644 --- a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_ddict.c +++ b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_ddict.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -19,7 +19,6 @@ #include "../common/mem.h" /* low level memory routines */ #define FSE_STATIC_LINKING_ONLY #include "../common/fse.h" -#define HUF_STATIC_LINKING_ONLY #include "../common/huf.h" #include "zstd_decompress_internal.h" #include "zstd_ddict.h" @@ -134,7 +133,7 @@ static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict, ZSTD_memcpy(internalBuffer, dict, dictSize); } ddict->dictSize = dictSize; - ddict->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endian */ + ddict->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001); /* cover both little and big endian */ /* parse dictionary content */ FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) , ""); @@ -240,5 +239,5 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict) unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict) { if (ddict==NULL) return 0; - return ZSTD_getDictID_fromDict(ddict->dictContent, ddict->dictSize); + return ddict->dictID; } diff --git a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_ddict.h b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_ddict.h similarity index 95% rename from src/dependencies/zstd-1.5.0/lib/decompress/zstd_ddict.h rename to src/dependencies/zstd-1.5.4/lib/decompress/zstd_ddict.h index bd03268..c4ca887 100644 --- a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_ddict.h +++ b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_ddict.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress.c b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress.c similarity index 88% rename from src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress.c rename to src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress.c index 910bc03..d487966 100644 --- a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress.c +++ b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -56,17 +56,16 @@ * Dependencies *********************************************************/ #include "../common/zstd_deps.h" /* ZSTD_memcpy, ZSTD_memmove, ZSTD_memset */ -#include "../common/cpu.h" /* bmi2 */ #include "../common/mem.h" /* low level memory routines */ #define FSE_STATIC_LINKING_ONLY #include "../common/fse.h" -#define HUF_STATIC_LINKING_ONLY #include "../common/huf.h" #include "../common/xxhash.h" /* XXH64_reset, XXH64_update, XXH64_digest, XXH64 */ #include "../common/zstd_internal.h" /* blockProperties_t */ #include "zstd_decompress_internal.h" /* ZSTD_DCtx */ #include "zstd_ddict.h" /* ZSTD_DDictDictContent */ #include "zstd_decompress_block.h" /* ZSTD_decompressBlock_internal */ +#include "../common/bits.h" /* ZSTD_highbit32 */ #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) # include "../legacy/zstd_legacy.h" @@ -79,11 +78,11 @@ *************************************/ #define DDICT_HASHSET_MAX_LOAD_FACTOR_COUNT_MULT 4 -#define DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT 3 /* These two constants represent SIZE_MULT/COUNT_MULT load factor without using a float. - * Currently, that means a 0.75 load factor. - * So, if count * COUNT_MULT / size * SIZE_MULT != 0, then we've exceeded - * the load factor of the ddict hash set. - */ +#define DDICT_HASHSET_MAX_LOAD_FACTOR_SIZE_MULT 3 /* These two constants represent SIZE_MULT/COUNT_MULT load factor without using a float. + * Currently, that means a 0.75 load factor. + * So, if count * COUNT_MULT / size * SIZE_MULT != 0, then we've exceeded + * the load factor of the ddict hash set. + */ #define DDICT_HASHSET_TABLE_BASE_SIZE 64 #define DDICT_HASHSET_RESIZE_FACTOR 2 @@ -177,12 +176,15 @@ static const ZSTD_DDict* ZSTD_DDictHashSet_getDDict(ZSTD_DDictHashSet* hashSet, static ZSTD_DDictHashSet* ZSTD_createDDictHashSet(ZSTD_customMem customMem) { ZSTD_DDictHashSet* ret = (ZSTD_DDictHashSet*)ZSTD_customMalloc(sizeof(ZSTD_DDictHashSet), customMem); DEBUGLOG(4, "Allocating new hash set"); + if (!ret) + return NULL; ret->ddictPtrTable = (const ZSTD_DDict**)ZSTD_customCalloc(DDICT_HASHSET_TABLE_BASE_SIZE * sizeof(ZSTD_DDict*), customMem); - ret->ddictPtrTableSize = DDICT_HASHSET_TABLE_BASE_SIZE; - ret->ddictPtrCount = 0; - if (!ret || !ret->ddictPtrTable) { + if (!ret->ddictPtrTable) { + ZSTD_customFree(ret, customMem); return NULL; } + ret->ddictPtrTableSize = DDICT_HASHSET_TABLE_BASE_SIZE; + ret->ddictPtrCount = 0; return ret; } @@ -241,6 +243,7 @@ static void ZSTD_DCtx_resetParameters(ZSTD_DCtx* dctx) dctx->outBufferMode = ZSTD_bm_buffered; dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum; dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict; + dctx->disableHufAsm = 0; } static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) @@ -255,11 +258,15 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) dctx->inBuffSize = 0; dctx->outBuffSize = 0; dctx->streamStage = zdss_init; +#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) dctx->legacyContext = NULL; dctx->previousLegacyVersion = 0; +#endif dctx->noForwardProgress = 0; dctx->oversizedDuration = 0; - dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); +#if DYNAMIC_BMI2 + dctx->bmi2 = ZSTD_cpuSupportsBmi2(); +#endif dctx->ddictSet = NULL; ZSTD_DCtx_resetParameters(dctx); #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION @@ -280,8 +287,7 @@ ZSTD_DCtx* ZSTD_initStaticDCtx(void *workspace, size_t workspaceSize) return dctx; } -ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem) -{ +static ZSTD_DCtx* ZSTD_createDCtx_internal(ZSTD_customMem customMem) { if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL; { ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_customMalloc(sizeof(*dctx), customMem); @@ -292,10 +298,15 @@ ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem) } } +ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem) +{ + return ZSTD_createDCtx_internal(customMem); +} + ZSTD_DCtx* ZSTD_createDCtx(void) { DEBUGLOG(3, "ZSTD_createDCtx"); - return ZSTD_createDCtx_advanced(ZSTD_defaultCMem); + return ZSTD_createDCtx_internal(ZSTD_defaultCMem); } static void ZSTD_clearDict(ZSTD_DCtx* dctx) @@ -380,6 +391,19 @@ unsigned ZSTD_isFrame(const void* buffer, size_t size) return 0; } +/*! ZSTD_isSkippableFrame() : + * Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame. + * Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0. + */ +unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size) +{ + if (size < ZSTD_FRAMEIDSIZE) return 0; + { U32 const magic = MEM_readLE32(buffer); + if ((magic & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) return 1; + } + return 0; +} + /** ZSTD_frameHeaderSize_internal() : * srcSize must be large enough to reach header size fields. * note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless. @@ -415,16 +439,40 @@ size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize) * note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless * @return : 0, `zfhPtr` is correctly filled, * >0, `srcSize` is too small, value is wanted `srcSize` amount, - * or an error code, which can be tested using ZSTD_isError() */ +** or an error code, which can be tested using ZSTD_isError() */ size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format) { const BYTE* ip = (const BYTE*)src; size_t const minInputSize = ZSTD_startingInputLength(format); - ZSTD_memset(zfhPtr, 0, sizeof(*zfhPtr)); /* not strictly necessary, but static analyzer do not understand that zfhPtr is only going to be read only if return value is zero, since they are 2 different signals */ - if (srcSize < minInputSize) return minInputSize; - RETURN_ERROR_IF(src==NULL, GENERIC, "invalid parameter"); + DEBUGLOG(5, "ZSTD_getFrameHeader_advanced: minInputSize = %zu, srcSize = %zu", minInputSize, srcSize); + if (srcSize > 0) { + /* note : technically could be considered an assert(), since it's an invalid entry */ + RETURN_ERROR_IF(src==NULL, GENERIC, "invalid parameter : src==NULL, but srcSize>0"); + } + if (srcSize < minInputSize) { + if (srcSize > 0 && format != ZSTD_f_zstd1_magicless) { + /* when receiving less than @minInputSize bytes, + * control these bytes at least correspond to a supported magic number + * in order to error out early if they don't. + **/ + size_t const toCopy = MIN(4, srcSize); + unsigned char hbuf[4]; MEM_writeLE32(hbuf, ZSTD_MAGICNUMBER); + assert(src != NULL); + ZSTD_memcpy(hbuf, src, toCopy); + if ( MEM_readLE32(hbuf) != ZSTD_MAGICNUMBER ) { + /* not a zstd frame : let's check if it's a skippable frame */ + MEM_writeLE32(hbuf, ZSTD_MAGIC_SKIPPABLE_START); + ZSTD_memcpy(hbuf, src, toCopy); + if ((MEM_readLE32(hbuf) & ZSTD_MAGIC_SKIPPABLE_MASK) != ZSTD_MAGIC_SKIPPABLE_START) { + RETURN_ERROR(prefix_unknown, + "first bytes don't correspond to any supported magic number"); + } } } + return minInputSize; + } + + ZSTD_memset(zfhPtr, 0, sizeof(*zfhPtr)); /* not strictly necessary, but static analyzers may not understand that zfhPtr will be read only if return value is zero, since they are 2 different signals */ if ( (format != ZSTD_f_zstd1_magicless) && (MEM_readLE32(src) != ZSTD_MAGICNUMBER) ) { if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { @@ -466,7 +514,9 @@ size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, s } switch(dictIDSizeCode) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : break; case 1 : dictID = ip[pos]; pos++; break; case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break; @@ -474,7 +524,9 @@ size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, s } switch(fcsID) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : if (singleSegment) frameContentSize = ip[pos]; break; case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break; case 2 : frameContentSize = MEM_readLE32(ip+pos); break; @@ -503,7 +555,6 @@ size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t src return ZSTD_getFrameHeader_advanced(zfhPtr, src, srcSize, ZSTD_f_zstd1); } - /** ZSTD_getFrameContentSize() : * compatible with legacy mode * @return : decompressed size of the single frame pointed to be `src` if known, otherwise @@ -544,6 +595,37 @@ static size_t readSkippableFrameSize(void const* src, size_t srcSize) } } +/*! ZSTD_readSkippableFrame() : + * Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer. + * + * The parameter magicVariant will receive the magicVariant that was supplied when the frame was written, + * i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested + * in the magicVariant. + * + * Returns an error if destination buffer is not large enough, or if the frame is not skippable. + * + * @return : number of bytes written or a ZSTD error. + */ +ZSTDLIB_API size_t ZSTD_readSkippableFrame(void* dst, size_t dstCapacity, unsigned* magicVariant, + const void* src, size_t srcSize) +{ + U32 const magicNumber = MEM_readLE32(src); + size_t skippableFrameSize = readSkippableFrameSize(src, srcSize); + size_t skippableContentSize = skippableFrameSize - ZSTD_SKIPPABLEHEADERSIZE; + + /* check input validity */ + RETURN_ERROR_IF(!ZSTD_isSkippableFrame(src, srcSize), frameParameter_unsupported, ""); + RETURN_ERROR_IF(skippableFrameSize < ZSTD_SKIPPABLEHEADERSIZE || skippableFrameSize > srcSize, srcSize_wrong, ""); + RETURN_ERROR_IF(skippableContentSize > dstCapacity, dstSize_tooSmall, ""); + + /* deliver payload */ + if (skippableContentSize > 0 && dst != NULL) + ZSTD_memcpy(dst, (const BYTE *)src + ZSTD_SKIPPABLEHEADERSIZE, skippableContentSize); + if (magicVariant != NULL) + *magicVariant = magicNumber - ZSTD_MAGIC_SKIPPABLE_START; + return skippableContentSize; +} + /** ZSTD_findDecompressedSize() : * compatible with legacy mode * `srcSize` must be the exact length of some number of ZSTD compressed and/or @@ -700,10 +782,11 @@ static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t srcSize ip += 4; } + frameSizeInfo.nbBlocks = nbBlocks; frameSizeInfo.compressedSize = (size_t)(ip - ipstart); frameSizeInfo.decompressedBound = (zfh.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) ? zfh.frameContentSize - : nbBlocks * zfh.blockSizeMax; + : (unsigned long long)nbBlocks * zfh.blockSizeMax; return frameSizeInfo; } } @@ -743,6 +826,48 @@ unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize) return bound; } +size_t ZSTD_decompressionMargin(void const* src, size_t srcSize) +{ + size_t margin = 0; + unsigned maxBlockSize = 0; + + /* Iterate over each frame */ + while (srcSize > 0) { + ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize); + size_t const compressedSize = frameSizeInfo.compressedSize; + unsigned long long const decompressedBound = frameSizeInfo.decompressedBound; + ZSTD_frameHeader zfh; + + FORWARD_IF_ERROR(ZSTD_getFrameHeader(&zfh, src, srcSize), ""); + if (ZSTD_isError(compressedSize) || decompressedBound == ZSTD_CONTENTSIZE_ERROR) + return ERROR(corruption_detected); + + if (zfh.frameType == ZSTD_frame) { + /* Add the frame header to our margin */ + margin += zfh.headerSize; + /* Add the checksum to our margin */ + margin += zfh.checksumFlag ? 4 : 0; + /* Add 3 bytes per block */ + margin += 3 * frameSizeInfo.nbBlocks; + + /* Compute the max block size */ + maxBlockSize = MAX(maxBlockSize, zfh.blockSizeMax); + } else { + assert(zfh.frameType == ZSTD_skippableFrame); + /* Add the entire skippable frame size to our margin. */ + margin += compressedSize; + } + + assert(srcSize >= compressedSize); + src = (const BYTE*)src + compressedSize; + srcSize -= compressedSize; + } + + /* Add the max block size back to the margin. */ + margin += maxBlockSize; + + return margin; +} /*-************************************************************* * Frame decoding @@ -768,7 +893,7 @@ static size_t ZSTD_copyRawBlock(void* dst, size_t dstCapacity, if (srcSize == 0) return 0; RETURN_ERROR(dstBuffer_null, ""); } - ZSTD_memcpy(dst, src, srcSize); + ZSTD_memmove(dst, src, srcSize); return srcSize; } @@ -846,6 +971,7 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, /* Loop on each block */ while (1) { + BYTE* oBlockEnd = oend; size_t decodedSize; blockProperties_t blockProperties; size_t const cBlockSize = ZSTD_getcBlockSize(ip, remainingSrcSize, &blockProperties); @@ -855,16 +981,34 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, remainingSrcSize -= ZSTD_blockHeaderSize; RETURN_ERROR_IF(cBlockSize > remainingSrcSize, srcSize_wrong, ""); + if (ip >= op && ip < oBlockEnd) { + /* We are decompressing in-place. Limit the output pointer so that we + * don't overwrite the block that we are currently reading. This will + * fail decompression if the input & output pointers aren't spaced + * far enough apart. + * + * This is important to set, even when the pointers are far enough + * apart, because ZSTD_decompressBlock_internal() can decide to store + * literals in the output buffer, after the block it is decompressing. + * Since we don't want anything to overwrite our input, we have to tell + * ZSTD_decompressBlock_internal to never write past ip. + * + * See ZSTD_allocateLiteralsBuffer() for reference. + */ + oBlockEnd = op + (ip - op); + } + switch(blockProperties.blockType) { case bt_compressed: - decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oend-op), ip, cBlockSize, /* frame */ 1); + decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, /* frame */ 1, not_streaming); break; case bt_raw : + /* Use oend instead of oBlockEnd because this function is safe to overlap. It uses memmove. */ decodedSize = ZSTD_copyRawBlock(op, (size_t)(oend-op), ip, cBlockSize); break; case bt_rle : - decodedSize = ZSTD_setRleBlock(op, (size_t)(oend-op), *ip, blockProperties.origSize); + decodedSize = ZSTD_setRleBlock(op, (size_t)(oBlockEnd-op), *ip, blockProperties.origSize); break; case bt_reserved : default: @@ -899,6 +1043,7 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, } ZSTD_DCtx_trace_end(dctx, (U64)(op-ostart), (U64)(ip-istart), /* streaming */ 0); /* Allow caller to get size read */ + DEBUGLOG(4, "ZSTD_decompressFrame: decompressed frame of size %zi, consuming %zi bytes of input", op-ostart, ip - (const BYTE*)*srcPtr); *srcPtr = ip; *srcSizePtr = remainingSrcSize; return (size_t)(op-ostart); @@ -1009,7 +1154,7 @@ static ZSTD_DDict const* ZSTD_getDDict(ZSTD_DCtx* dctx) switch (dctx->dictUses) { default: assert(0 /* Impossible */); - /* fall-through */ + ZSTD_FALLTHROUGH; case ZSTD_dont_use: ZSTD_clearDict(dctx); return NULL; @@ -1031,7 +1176,7 @@ size_t ZSTD_decompress(void* dst, size_t dstCapacity, const void* src, size_t sr { #if defined(ZSTD_HEAPMODE) && (ZSTD_HEAPMODE>=1) size_t regenSize; - ZSTD_DCtx* const dctx = ZSTD_createDCtx(); + ZSTD_DCtx* const dctx = ZSTD_createDCtx_internal(ZSTD_defaultCMem); RETURN_ERROR_IF(dctx==NULL, memory_allocation, "NULL pointer!"); regenSize = ZSTD_decompressDCtx(dctx, dst, dstCapacity, src, srcSize); ZSTD_freeDCtx(dctx); @@ -1051,8 +1196,8 @@ size_t ZSTD_decompress(void* dst, size_t dstCapacity, const void* src, size_t sr size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx) { return dctx->expected; } /** - * Similar to ZSTD_nextSrcSizeToDecompress(), but when when a block input can be streamed, - * we allow taking a partial block as the input. Currently only raw uncompressed blocks can + * Similar to ZSTD_nextSrcSizeToDecompress(), but when a block input can be streamed, we + * allow taking a partial block as the input. Currently only raw uncompressed blocks can * be streamed. * * For blocks that can be streamed, this allows us to reduce the latency until we produce @@ -1065,7 +1210,7 @@ static size_t ZSTD_nextSrcSizeToDecompressWithInputSize(ZSTD_DCtx* dctx, size_t return dctx->expected; if (dctx->bType != bt_raw) return dctx->expected; - return MIN(MAX(inputSize, 1), dctx->expected); + return BOUNDED(1, inputSize, dctx->expected); } ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) { @@ -1073,7 +1218,9 @@ ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) { { default: /* should not happen */ assert(0); + ZSTD_FALLTHROUGH; case ZSTDds_getFrameHeaderSize: + ZSTD_FALLTHROUGH; case ZSTDds_decodeFrameHeader: return ZSTDnit_frameHeader; case ZSTDds_decodeBlockHeader: @@ -1085,6 +1232,7 @@ ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) { case ZSTDds_checkChecksum: return ZSTDnit_checksum; case ZSTDds_decodeSkippableHeader: + ZSTD_FALLTHROUGH; case ZSTDds_skipFrame: return ZSTDnit_skippableFrame; } @@ -1168,7 +1316,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c { case bt_compressed: DEBUGLOG(5, "ZSTD_decompressContinue: case bt_compressed"); - rSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 1); + rSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 1, is_streaming); dctx->expected = 0; /* Streaming not supported */ break; case bt_raw : @@ -1249,7 +1397,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, c default: assert(0); /* impossible */ - RETURN_ERROR(GENERIC, "impossible to reach"); /* some compiler require default to do something */ + RETURN_ERROR(GENERIC, "impossible to reach"); /* some compilers require default to do something */ } } @@ -1290,11 +1438,11 @@ ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy, /* in minimal huffman, we always use X1 variants */ size_t const hSize = HUF_readDTableX1_wksp(entropy->hufTable, dictPtr, dictEnd - dictPtr, - workspace, workspaceSize); + workspace, workspaceSize, /* flags */ 0); #else size_t const hSize = HUF_readDTableX2_wksp(entropy->hufTable, dictPtr, (size_t)(dictEnd - dictPtr), - workspace, workspaceSize); + workspace, workspaceSize, /* flags */ 0); #endif RETURN_ERROR_IF(HUF_isError(hSize), dictionary_corrupted, ""); dictPtr += hSize; @@ -1393,7 +1541,7 @@ size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx) dctx->prefixStart = NULL; dctx->virtualStart = NULL; dctx->dictEnd = NULL; - dctx->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endian */ + dctx->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001); /* cover both little and big endian */ dctx->litEntropy = dctx->fseEntropy = 0; dctx->dictID = 0; dctx->bType = bt_reserved; @@ -1455,7 +1603,7 @@ unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize) * This could for one of the following reasons : * - The frame does not require a dictionary (most common case). * - The frame was built with dictID intentionally removed. - * Needed dictionary is a hidden information. + * Needed dictionary is a hidden piece of information. * Note : this use case also happens when using a non-conformant dictionary. * - `srcSize` is too small, and as a result, frame header could not be decoded. * Note : possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`. @@ -1464,7 +1612,7 @@ unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize) * ZSTD_getFrameHeader(), which will provide a more precise error code. */ unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize) { - ZSTD_frameHeader zfp = { 0, 0, 0, ZSTD_frame, 0, 0, 0 }; + ZSTD_frameHeader zfp = { 0, 0, 0, ZSTD_frame, 0, 0, 0, 0, 0 }; size_t const hError = ZSTD_getFrameHeader(&zfp, src, srcSize); if (ZSTD_isError(hError)) return 0; return zfp.dictID; @@ -1493,7 +1641,7 @@ size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx, ZSTD_DStream* ZSTD_createDStream(void) { DEBUGLOG(3, "ZSTD_createDStream"); - return ZSTD_createDStream_advanced(ZSTD_defaultCMem); + return ZSTD_createDCtx_internal(ZSTD_defaultCMem); } ZSTD_DStream* ZSTD_initStaticDStream(void *workspace, size_t workspaceSize) @@ -1503,7 +1651,7 @@ ZSTD_DStream* ZSTD_initStaticDStream(void *workspace, size_t workspaceSize) ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem) { - return ZSTD_createDCtx_advanced(customMem); + return ZSTD_createDCtx_internal(customMem); } size_t ZSTD_freeDStream(ZSTD_DStream* zds) @@ -1571,7 +1719,9 @@ size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t di size_t ZSTD_initDStream(ZSTD_DStream* zds) { DEBUGLOG(4, "ZSTD_initDStream"); - return ZSTD_initDStream_usingDDict(zds, NULL); + FORWARD_IF_ERROR(ZSTD_DCtx_reset(zds, ZSTD_reset_session_only), ""); + FORWARD_IF_ERROR(ZSTD_DCtx_refDDict(zds, NULL), ""); + return ZSTD_startingInputLength(zds->format); } /* ZSTD_initDStream_usingDDict() : @@ -1579,6 +1729,7 @@ size_t ZSTD_initDStream(ZSTD_DStream* zds) * this function cannot fail */ size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* dctx, const ZSTD_DDict* ddict) { + DEBUGLOG(4, "ZSTD_initDStream_usingDDict"); FORWARD_IF_ERROR( ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only) , ""); FORWARD_IF_ERROR( ZSTD_DCtx_refDDict(dctx, ddict) , ""); return ZSTD_startingInputLength(dctx->format); @@ -1589,6 +1740,7 @@ size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* dctx, const ZSTD_DDict* ddict) * this function cannot fail */ size_t ZSTD_resetDStream(ZSTD_DStream* dctx) { + DEBUGLOG(4, "ZSTD_resetDStream"); FORWARD_IF_ERROR(ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only), ""); return ZSTD_startingInputLength(dctx->format); } @@ -1660,6 +1812,11 @@ ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam) bounds.lowerBound = (int)ZSTD_rmd_refSingleDDict; bounds.upperBound = (int)ZSTD_rmd_refMultipleDDicts; return bounds; + case ZSTD_d_disableHuffmanAssembly: + bounds.lowerBound = 0; + bounds.upperBound = 1; + return bounds; + default:; } bounds.error = ERROR(parameter_unsupported); @@ -1700,6 +1857,9 @@ size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value case ZSTD_d_refMultipleDDicts: *value = (int)dctx->refMultipleDDicts; return 0; + case ZSTD_d_disableHuffmanAssembly: + *value = (int)dctx->disableHufAsm; + return 0; default:; } RETURN_ERROR(parameter_unsupported, ""); @@ -1733,6 +1893,10 @@ size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value } dctx->refMultipleDDicts = (ZSTD_refMultipleDDicts_e)value; return 0; + case ZSTD_d_disableHuffmanAssembly: + CHECK_DBOUNDS(ZSTD_d_disableHuffmanAssembly, value); + dctx->disableHufAsm = value != 0; + return 0; default:; } RETURN_ERROR(parameter_unsupported, ""); @@ -1763,7 +1927,8 @@ size_t ZSTD_sizeof_DStream(const ZSTD_DStream* dctx) size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize) { size_t const blockSize = (size_t) MIN(windowSize, ZSTD_BLOCKSIZE_MAX); - unsigned long long const neededRBSize = windowSize + blockSize + (WILDCOPY_OVERLENGTH * 2); + /* space is needed to store the litbuffer after the output of a given block without stomping the extDict of a previous run, as well as to cover both windows against wildcopy*/ + unsigned long long const neededRBSize = windowSize + blockSize + ZSTD_BLOCKSIZE_MAX + (WILDCOPY_OVERLENGTH * 2); unsigned long long const neededSize = MIN(frameContentSize, neededRBSize); size_t const minRBSize = (size_t) neededSize; RETURN_ERROR_IF((unsigned long long)minRBSize != neededSize, @@ -1897,10 +2062,12 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB DEBUGLOG(5, "stage zdss_init => transparent reset "); zds->streamStage = zdss_loadHeader; zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0; +#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) zds->legacyVersion = 0; +#endif zds->hostageByte = 0; zds->expectedOutBuffer = *output; - /* fall-through */ + ZSTD_FALLTHROUGH; case zdss_loadHeader : DEBUGLOG(5, "stage zdss_loadHeader (srcSize : %u)", (U32)(iend - ip)); @@ -1917,7 +2084,6 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB if (zds->refMultipleDDicts && zds->ddictSet) { ZSTD_DCtx_selectFrameDDict(zds); } - DEBUGLOG(5, "header size : %u", (U32)hSize); if (ZSTD_isError(hSize)) { #if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) U32 const legacyVersion = ZSTD_isLegacy(istart, iend-istart); @@ -1949,6 +2115,11 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB zds->lhSize += remainingInput; } input->pos = input->size; + /* check first few bytes */ + FORWARD_IF_ERROR( + ZSTD_getFrameHeader_advanced(&zds->fParams, zds->headerBuffer, zds->lhSize, zds->format), + "First few bytes detected incorrect" ); + /* return hint input size */ return (MAX((size_t)ZSTD_FRAMEHEADERSIZE_MIN(zds->format), hSize) - zds->lhSize) + ZSTD_blockHeaderSize; /* remaining header bytes + next block header */ } assert(ip != NULL); @@ -1966,8 +2137,9 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB size_t const decompressedSize = ZSTD_decompress_usingDDict(zds, op, (size_t)(oend-op), istart, cSize, ZSTD_getDDict(zds)); if (ZSTD_isError(decompressedSize)) return decompressedSize; DEBUGLOG(4, "shortcut to single-pass ZSTD_decompress_usingDDict()") + assert(istart != NULL); ip = istart + cSize; - op += decompressedSize; + op = op ? op + decompressedSize : op; /* can occur if frameContentSize = 0 (empty frame) */ zds->expected = 0; zds->streamStage = zdss_init; someMoreWork = 0; @@ -2038,7 +2210,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB zds->outBuffSize = neededOutBuffSize; } } } zds->streamStage = zdss_read; - /* fall-through */ + ZSTD_FALLTHROUGH; case zdss_read: DEBUGLOG(5, "stage zdss_read"); @@ -2051,13 +2223,14 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB } if ((size_t)(iend-ip) >= neededInSize) { /* decode directly from src */ FORWARD_IF_ERROR(ZSTD_decompressContinueStream(zds, &op, oend, ip, neededInSize), ""); + assert(ip != NULL); ip += neededInSize; /* Function modifies the stage so we must break */ break; } } if (ip==iend) { someMoreWork = 0; break; } /* no more input */ zds->streamStage = zdss_load; - /* fall-through */ + ZSTD_FALLTHROUGH; case zdss_load: { size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds); @@ -2065,7 +2238,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB int const isSkipFrame = ZSTD_isSkipFrame(zds); size_t loadedSize; /* At this point we shouldn't be decompressing a block that we can stream. */ - assert(neededInSize == ZSTD_nextSrcSizeToDecompressWithInputSize(zds, iend - ip)); + assert(neededInSize == ZSTD_nextSrcSizeToDecompressWithInputSize(zds, (size_t)(iend - ip))); if (isSkipFrame) { loadedSize = MIN(toLoad, (size_t)(iend-ip)); } else { @@ -2074,8 +2247,11 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB "should never happen"); loadedSize = ZSTD_limitCopy(zds->inBuff + zds->inPos, toLoad, ip, (size_t)(iend-ip)); } - ip += loadedSize; - zds->inPos += loadedSize; + if (loadedSize != 0) { + /* ip may be NULL */ + ip += loadedSize; + zds->inPos += loadedSize; + } if (loadedSize < toLoad) { someMoreWork = 0; break; } /* not enough input, wait for more */ /* decode loaded input */ @@ -2085,14 +2261,17 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB break; } case zdss_flush: - { size_t const toFlushSize = zds->outEnd - zds->outStart; + { + size_t const toFlushSize = zds->outEnd - zds->outStart; size_t const flushedSize = ZSTD_limitCopy(op, (size_t)(oend-op), zds->outBuff + zds->outStart, toFlushSize); - op += flushedSize; + + op = op ? op + flushedSize : op; + zds->outStart += flushedSize; if (flushedSize == toFlushSize) { /* flush completed */ zds->streamStage = zdss_read; if ( (zds->outBuffSize < zds->fParams.frameContentSize) - && (zds->outStart + zds->fParams.blockSizeMax > zds->outBuffSize) ) { + && (zds->outStart + zds->fParams.blockSizeMax > zds->outBuffSize) ) { DEBUGLOG(5, "restart filling outBuff from beginning (left:%i, needed:%u)", (int)(zds->outBuffSize - zds->outStart), (U32)zds->fParams.blockSizeMax); @@ -2106,7 +2285,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB default: assert(0); /* impossible */ - RETURN_ERROR(GENERIC, "impossible to reach"); /* some compiler require default to do something */ + RETURN_ERROR(GENERIC, "impossible to reach"); /* some compilers require default to do something */ } } /* result */ @@ -2119,8 +2298,8 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB if ((ip==istart) && (op==ostart)) { /* no forward progress */ zds->noForwardProgress ++; if (zds->noForwardProgress >= ZSTD_NO_FORWARD_PROGRESS_MAX) { - RETURN_ERROR_IF(op==oend, dstSize_tooSmall, ""); - RETURN_ERROR_IF(ip==iend, srcSize_wrong, ""); + RETURN_ERROR_IF(op==oend, noForwardProgress_destFull, ""); + RETURN_ERROR_IF(ip==iend, noForwardProgress_inputEmpty, ""); assert(0); } } else { @@ -2157,11 +2336,17 @@ size_t ZSTD_decompressStream_simpleArgs ( void* dst, size_t dstCapacity, size_t* dstPos, const void* src, size_t srcSize, size_t* srcPos) { - ZSTD_outBuffer output = { dst, dstCapacity, *dstPos }; - ZSTD_inBuffer input = { src, srcSize, *srcPos }; - /* ZSTD_compress_generic() will check validity of dstPos and srcPos */ - size_t const cErr = ZSTD_decompressStream(dctx, &output, &input); - *dstPos = output.pos; - *srcPos = input.pos; - return cErr; + ZSTD_outBuffer output; + ZSTD_inBuffer input; + output.dst = dst; + output.size = dstCapacity; + output.pos = *dstPos; + input.src = src; + input.size = srcSize; + input.pos = *srcPos; + { size_t const cErr = ZSTD_decompressStream(dctx, &output, &input); + *dstPos = output.pos; + *srcPos = input.pos; + return cErr; + } } diff --git a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_block.c b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_block.c similarity index 52% rename from src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_block.c rename to src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_block.c index 349dcdc..0a06a02 100644 --- a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_block.c +++ b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_block.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -20,12 +20,12 @@ #include "../common/mem.h" /* low level memory routines */ #define FSE_STATIC_LINKING_ONLY #include "../common/fse.h" -#define HUF_STATIC_LINKING_ONLY #include "../common/huf.h" #include "../common/zstd_internal.h" #include "zstd_decompress_internal.h" /* ZSTD_DCtx */ #include "zstd_ddict.h" /* ZSTD_DDictDictContent */ #include "zstd_decompress_block.h" +#include "../common/bits.h" /* ZSTD_highbit32 */ /*_******************************************************* * Macros @@ -69,15 +69,56 @@ size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, } } +/* Allocate buffer for literals, either overlapping current dst, or split between dst and litExtraBuffer, or stored entirely within litExtraBuffer */ +static void ZSTD_allocateLiteralsBuffer(ZSTD_DCtx* dctx, void* const dst, const size_t dstCapacity, const size_t litSize, + const streaming_operation streaming, const size_t expectedWriteSize, const unsigned splitImmediately) +{ + if (streaming == not_streaming && dstCapacity > ZSTD_BLOCKSIZE_MAX + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) + { + /* room for litbuffer to fit without read faulting */ + dctx->litBuffer = (BYTE*)dst + ZSTD_BLOCKSIZE_MAX + WILDCOPY_OVERLENGTH; + dctx->litBufferEnd = dctx->litBuffer + litSize; + dctx->litBufferLocation = ZSTD_in_dst; + } + else if (litSize > ZSTD_LITBUFFEREXTRASIZE) + { + /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */ + if (splitImmediately) { + /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */ + dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH; + dctx->litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE; + } + else { + /* initially this will be stored entirely in dst during huffman decoding, it will partially be shifted to litExtraBuffer after */ + dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize; + dctx->litBufferEnd = (BYTE*)dst + expectedWriteSize; + } + dctx->litBufferLocation = ZSTD_split; + } + else + { + /* fits entirely within litExtraBuffer, so no split is necessary */ + dctx->litBuffer = dctx->litExtraBuffer; + dctx->litBufferEnd = dctx->litBuffer + litSize; + dctx->litBufferLocation = ZSTD_not_in_dst; + } +} /* Hidden declaration for fullbench */ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, - const void* src, size_t srcSize); + const void* src, size_t srcSize, + void* dst, size_t dstCapacity, const streaming_operation streaming); /*! ZSTD_decodeLiteralsBlock() : + * Where it is possible to do so without being stomped by the output during decompression, the literals block will be stored + * in the dstBuffer. If there is room to do so, it will be stored in full in the excess dst space after where the current + * block will be output. Otherwise it will be stored at the end of the current dst blockspace, with a small portion being + * stored in dctx->litExtraBuffer to help keep it "ahead" of the current output write. + * * @return : nb of bytes read from src (< srcSize ) * note : symbol not declared but exposed for fullbench */ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, - const void* src, size_t srcSize) /* note : srcSize < BLOCKSIZE */ + const void* src, size_t srcSize, /* note : srcSize < BLOCKSIZE */ + void* dst, size_t dstCapacity, const streaming_operation streaming) { DEBUGLOG(5, "ZSTD_decodeLiteralsBlock"); RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected, ""); @@ -90,15 +131,19 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, case set_repeat: DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block"); RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted, ""); - /* fall-through */ + ZSTD_FALLTHROUGH; case set_compressed: - RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3"); + RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need up to 5 for case 3"); { size_t lhSize, litSize, litCSize; U32 singleStream=0; U32 const lhlCode = (istart[0] >> 2) & 3; U32 const lhc = MEM_readLE32(istart); size_t hufSuccess; + size_t expectedWriteSize = MIN(ZSTD_BLOCKSIZE_MAX, dstCapacity); + int const flags = 0 + | (ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0) + | (dctx->disableHufAsm ? HUF_flags_disableAsm : 0); switch(lhlCode) { case 0: case 1: default: /* note : default is impossible, since lhlCode into [0..3] */ @@ -121,8 +166,15 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, litCSize = (lhc >> 22) + ((size_t)istart[4] << 10); break; } + RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled"); RETURN_ERROR_IF(litSize > ZSTD_BLOCKSIZE_MAX, corruption_detected, ""); + if (!singleStream) + RETURN_ERROR_IF(litSize < MIN_LITERALS_FOR_4_STREAMS, literals_headerWrong, + "Not enough literals (%zu) for the 4-streams mode (min %u)", + litSize, MIN_LITERALS_FOR_4_STREAMS); RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected, ""); + RETURN_ERROR_IF(expectedWriteSize < litSize , dstSize_tooSmall, ""); + ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 0); /* prefetch huffman table if cold */ if (dctx->ddictIsCold && (litSize > 768 /* heuristic */)) { @@ -131,13 +183,14 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, if (litEncType==set_repeat) { if (singleStream) { - hufSuccess = HUF_decompress1X_usingDTable_bmi2( + hufSuccess = HUF_decompress1X_usingDTable( dctx->litBuffer, litSize, istart+lhSize, litCSize, - dctx->HUFptr, dctx->bmi2); + dctx->HUFptr, flags); } else { - hufSuccess = HUF_decompress4X_usingDTable_bmi2( + assert(litSize >= MIN_LITERALS_FOR_4_STREAMS); + hufSuccess = HUF_decompress4X_usingDTable( dctx->litBuffer, litSize, istart+lhSize, litCSize, - dctx->HUFptr, dctx->bmi2); + dctx->HUFptr, flags); } } else { if (singleStream) { @@ -145,20 +198,27 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, hufSuccess = HUF_decompress1X_DCtx_wksp( dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace)); + sizeof(dctx->workspace), flags); #else - hufSuccess = HUF_decompress1X1_DCtx_wksp_bmi2( + hufSuccess = HUF_decompress1X1_DCtx_wksp( dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace), dctx->bmi2); + sizeof(dctx->workspace), flags); #endif } else { - hufSuccess = HUF_decompress4X_hufOnly_wksp_bmi2( + hufSuccess = HUF_decompress4X_hufOnly_wksp( dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace), dctx->bmi2); + sizeof(dctx->workspace), flags); } } + if (dctx->litBufferLocation == ZSTD_split) + { + ZSTD_memcpy(dctx->litExtraBuffer, dctx->litBufferEnd - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE); + ZSTD_memmove(dctx->litBuffer + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH, dctx->litBuffer, litSize - ZSTD_LITBUFFEREXTRASIZE); + dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH; + dctx->litBufferEnd -= WILDCOPY_OVERLENGTH; + } RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected, ""); @@ -166,13 +226,13 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, dctx->litSize = litSize; dctx->litEntropy = 1; if (litEncType==set_compressed) dctx->HUFptr = dctx->entropy.hufTable; - ZSTD_memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH); return litCSize + lhSize; } case set_basic: { size_t litSize, lhSize; U32 const lhlCode = ((istart[0]) >> 2) & 3; + size_t expectedWriteSize = MIN(ZSTD_BLOCKSIZE_MAX, dstCapacity); switch(lhlCode) { case 0: case 2: default: /* note : default is impossible, since lhlCode into [0..3] */ @@ -185,27 +245,41 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, break; case 3: lhSize = 3; + RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize = 3"); litSize = MEM_readLE24(istart) >> 4; break; } + RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled"); + RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, ""); + ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1); if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) { /* risk reading beyond src buffer with wildcopy */ RETURN_ERROR_IF(litSize+lhSize > srcSize, corruption_detected, ""); - ZSTD_memcpy(dctx->litBuffer, istart+lhSize, litSize); + if (dctx->litBufferLocation == ZSTD_split) + { + ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize - ZSTD_LITBUFFEREXTRASIZE); + ZSTD_memcpy(dctx->litExtraBuffer, istart + lhSize + litSize - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE); + } + else + { + ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize); + } dctx->litPtr = dctx->litBuffer; dctx->litSize = litSize; - ZSTD_memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH); return lhSize+litSize; } /* direct reference into compressed stream */ dctx->litPtr = istart+lhSize; dctx->litSize = litSize; + dctx->litBufferEnd = dctx->litPtr + litSize; + dctx->litBufferLocation = ZSTD_not_in_dst; return lhSize+litSize; } case set_rle: { U32 const lhlCode = ((istart[0]) >> 2) & 3; size_t litSize, lhSize; + size_t expectedWriteSize = MIN(ZSTD_BLOCKSIZE_MAX, dstCapacity); switch(lhlCode) { case 0: case 2: default: /* note : default is impossible, since lhlCode into [0..3] */ @@ -214,16 +288,28 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, break; case 1: lhSize = 2; + RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 3"); litSize = MEM_readLE16(istart) >> 4; break; case 3: lhSize = 3; + RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 4"); litSize = MEM_readLE24(istart) >> 4; - RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4"); break; } + RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled"); RETURN_ERROR_IF(litSize > ZSTD_BLOCKSIZE_MAX, corruption_detected, ""); - ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH); + RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, ""); + ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1); + if (dctx->litBufferLocation == ZSTD_split) + { + ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize - ZSTD_LITBUFFEREXTRASIZE); + ZSTD_memset(dctx->litExtraBuffer, istart[lhSize], ZSTD_LITBUFFEREXTRASIZE); + } + else + { + ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize); + } dctx->litPtr = dctx->litBuffer; dctx->litSize = litSize; return lhSize+1; @@ -343,7 +429,7 @@ static const ZSTD_seqSymbol ML_defaultDTable[(1<nbBits = 0; cell->nextState = 0; assert(nbAddBits < 255); - cell->nbAdditionalBits = (BYTE)nbAddBits; + cell->nbAdditionalBits = nbAddBits; cell->baseValue = baseValue; } @@ -367,7 +453,7 @@ static void ZSTD_buildSeqTable_rle(ZSTD_seqSymbol* dt, U32 baseValue, U32 nbAddB FORCE_INLINE_TEMPLATE void ZSTD_buildFSETable_body(ZSTD_seqSymbol* dt, const short* normalizedCounter, unsigned maxSymbolValue, - const U32* baseValue, const U32* nbAdditionalBits, + const U32* baseValue, const U8* nbAdditionalBits, unsigned tableLog, void* wksp, size_t wkspSize) { ZSTD_seqSymbol* const tableDecode = dt+1; @@ -430,14 +516,15 @@ void ZSTD_buildFSETable_body(ZSTD_seqSymbol* dt, for (i = 8; i < n; i += 8) { MEM_write64(spread + pos + i, sv); } - pos += n; + assert(n>=0); + pos += (size_t)n; } } /* Now we spread those positions across the table. - * The benefit of doing it in two stages is that we avoid the the + * The benefit of doing it in two stages is that we avoid the * variable size inner loop, which caused lots of branch misses. * Now we can run through all the positions without any branch misses. - * We unroll the loop twice, since that is what emperically worked best. + * We unroll the loop twice, since that is what empirically worked best. */ { size_t position = 0; @@ -464,7 +551,7 @@ void ZSTD_buildFSETable_body(ZSTD_seqSymbol* dt, for (i=0; i highThreshold) position = (position + step) & tableMask; /* lowprob area */ + while (UNLIKELY(position > highThreshold)) position = (position + step) & tableMask; /* lowprob area */ } } assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */ } @@ -475,10 +562,10 @@ void ZSTD_buildFSETable_body(ZSTD_seqSymbol* dt, for (u=0; u max, corruption_detected, ""); { U32 const symbol = *(const BYTE*)src; U32 const baseline = baseValue[symbol]; - U32 const nbBits = nbAdditionalBits[symbol]; + U8 const nbBits = nbAdditionalBits[symbol]; ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits); } *DTablePtr = DTableSpace; @@ -620,7 +707,7 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, LL_defaultDTable, dctx->fseEntropy, dctx->ddictIsCold, nbSeq, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + ZSTD_DCtx_get_bmi2(dctx)); RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected, "ZSTD_buildSeqTable failed"); ip += llhSize; } @@ -632,7 +719,7 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, OF_defaultDTable, dctx->fseEntropy, dctx->ddictIsCold, nbSeq, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + ZSTD_DCtx_get_bmi2(dctx)); RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected, "ZSTD_buildSeqTable failed"); ip += ofhSize; } @@ -644,7 +731,7 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, ML_defaultDTable, dctx->fseEntropy, dctx->ddictIsCold, nbSeq, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + ZSTD_DCtx_get_bmi2(dctx)); RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected, "ZSTD_buildSeqTable failed"); ip += mlhSize; } @@ -713,7 +800,7 @@ HINT_INLINE void ZSTD_overlapCopy8(BYTE** op, BYTE const** ip, size_t offset) { * - ZSTD_overlap_src_before_dst: The src and dst may overlap and may be any distance apart. * The src buffer must be before the dst buffer. */ -static void ZSTD_safecopy(BYTE* op, BYTE* const oend_w, BYTE const* ip, ptrdiff_t length, ZSTD_overlap_e ovtype) { +static void ZSTD_safecopy(BYTE* op, const BYTE* const oend_w, BYTE const* ip, ptrdiff_t length, ZSTD_overlap_e ovtype) { ptrdiff_t const diff = op - ip; BYTE* const oend = op + length; @@ -729,6 +816,7 @@ static void ZSTD_safecopy(BYTE* op, BYTE* const oend_w, BYTE const* ip, ptrdiff_ /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */ assert(length >= 8); ZSTD_overlapCopy8(&op, &ip, diff); + length -= 8; assert(op - ip >= 8); assert(op <= oend); } @@ -743,12 +831,35 @@ static void ZSTD_safecopy(BYTE* op, BYTE* const oend_w, BYTE const* ip, ptrdiff_ assert(oend > oend_w); ZSTD_wildcopy(op, ip, oend_w - op, ovtype); ip += oend_w - op; - op = oend_w; + op += oend_w - op; } /* Handle the leftovers. */ while (op < oend) *op++ = *ip++; } +/* ZSTD_safecopyDstBeforeSrc(): + * This version allows overlap with dst before src, or handles the non-overlap case with dst after src + * Kept separate from more common ZSTD_safecopy case to avoid performance impact to the safecopy common case */ +static void ZSTD_safecopyDstBeforeSrc(BYTE* op, BYTE const* ip, ptrdiff_t length) { + ptrdiff_t const diff = op - ip; + BYTE* const oend = op + length; + + if (length < 8 || diff > -8) { + /* Handle short lengths, close overlaps, and dst not before src. */ + while (op < oend) *op++ = *ip++; + return; + } + + if (op <= oend - WILDCOPY_OVERLENGTH && diff < -WILDCOPY_VECLEN) { + ZSTD_wildcopy(op, ip, oend - WILDCOPY_OVERLENGTH - op, ZSTD_no_overlap); + ip += oend - WILDCOPY_OVERLENGTH - op; + op += oend - WILDCOPY_OVERLENGTH - op; + } + + /* Handle the leftovers. */ + while (op < oend) *op++ = *ip++; +} + /* ZSTD_execSequenceEnd(): * This version handles cases that are near the end of the output buffer. It requires * more careful checks to make sure there is no overflow. By separating out these hard @@ -759,9 +870,9 @@ static void ZSTD_safecopy(BYTE* op, BYTE* const oend_w, BYTE const* ip, ptrdiff_ */ FORCE_NOINLINE size_t ZSTD_execSequenceEnd(BYTE* op, - BYTE* const oend, seq_t sequence, - const BYTE** litPtr, const BYTE* const litLimit, - const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) + BYTE* const oend, seq_t sequence, + const BYTE** litPtr, const BYTE* const litLimit, + const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) { BYTE* const oLitEnd = op + sequence.litLength; size_t const sequenceLength = sequence.litLength + sequence.matchLength; @@ -784,27 +895,76 @@ size_t ZSTD_execSequenceEnd(BYTE* op, if (sequence.offset > (size_t)(oLitEnd - prefixStart)) { /* offset beyond prefix */ RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, ""); - match = dictEnd - (prefixStart-match); + match = dictEnd - (prefixStart - match); if (match + sequence.matchLength <= dictEnd) { ZSTD_memmove(oLitEnd, match, sequence.matchLength); return sequenceLength; } /* span extDict & currentPrefixSegment */ { size_t const length1 = dictEnd - match; - ZSTD_memmove(oLitEnd, match, length1); - op = oLitEnd + length1; - sequence.matchLength -= length1; - match = prefixStart; - } } + ZSTD_memmove(oLitEnd, match, length1); + op = oLitEnd + length1; + sequence.matchLength -= length1; + match = prefixStart; + } + } + ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst); + return sequenceLength; +} + +/* ZSTD_execSequenceEndSplitLitBuffer(): + * This version is intended to be used during instances where the litBuffer is still split. It is kept separate to avoid performance impact for the good case. + */ +FORCE_NOINLINE +size_t ZSTD_execSequenceEndSplitLitBuffer(BYTE* op, + BYTE* const oend, const BYTE* const oend_w, seq_t sequence, + const BYTE** litPtr, const BYTE* const litLimit, + const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) +{ + BYTE* const oLitEnd = op + sequence.litLength; + size_t const sequenceLength = sequence.litLength + sequence.matchLength; + const BYTE* const iLitEnd = *litPtr + sequence.litLength; + const BYTE* match = oLitEnd - sequence.offset; + + + /* bounds checks : careful of address space overflow in 32-bit mode */ + RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer"); + RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer"); + assert(op < op + sequenceLength); + assert(oLitEnd < op + sequenceLength); + + /* copy literals */ + RETURN_ERROR_IF(op > *litPtr && op < *litPtr + sequence.litLength, dstSize_tooSmall, "output should not catch up to and overwrite literal buffer"); + ZSTD_safecopyDstBeforeSrc(op, *litPtr, sequence.litLength); + op = oLitEnd; + *litPtr = iLitEnd; + + /* copy Match */ + if (sequence.offset > (size_t)(oLitEnd - prefixStart)) { + /* offset beyond prefix */ + RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, ""); + match = dictEnd - (prefixStart - match); + if (match + sequence.matchLength <= dictEnd) { + ZSTD_memmove(oLitEnd, match, sequence.matchLength); + return sequenceLength; + } + /* span extDict & currentPrefixSegment */ + { size_t const length1 = dictEnd - match; + ZSTD_memmove(oLitEnd, match, length1); + op = oLitEnd + length1; + sequence.matchLength -= length1; + match = prefixStart; + } + } ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst); return sequenceLength; } HINT_INLINE size_t ZSTD_execSequence(BYTE* op, - BYTE* const oend, seq_t sequence, - const BYTE** litPtr, const BYTE* const litLimit, - const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) + BYTE* const oend, seq_t sequence, + const BYTE** litPtr, const BYTE* const litLimit, + const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) { BYTE* const oLitEnd = op + sequence.litLength; size_t const sequenceLength = sequence.litLength + sequence.matchLength; @@ -815,6 +975,103 @@ size_t ZSTD_execSequence(BYTE* op, assert(op != NULL /* Precondition */); assert(oend_w < oend /* No underflow */); + +#if defined(__aarch64__) + /* prefetch sequence starting from match that will be used for copy later */ + PREFETCH_L1(match); +#endif + /* Handle edge cases in a slow path: + * - Read beyond end of literals + * - Match end is within WILDCOPY_OVERLIMIT of oend + * - 32-bit mode and the match length overflows + */ + if (UNLIKELY( + iLitEnd > litLimit || + oMatchEnd > oend_w || + (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH))) + return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd); + + /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */ + assert(op <= oLitEnd /* No overflow */); + assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */); + assert(oMatchEnd <= oend /* No underflow */); + assert(iLitEnd <= litLimit /* Literal length is in bounds */); + assert(oLitEnd <= oend_w /* Can wildcopy literals */); + assert(oMatchEnd <= oend_w /* Can wildcopy matches */); + + /* Copy Literals: + * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9. + * We likely don't need the full 32-byte wildcopy. + */ + assert(WILDCOPY_OVERLENGTH >= 16); + ZSTD_copy16(op, (*litPtr)); + if (UNLIKELY(sequence.litLength > 16)) { + ZSTD_wildcopy(op + 16, (*litPtr) + 16, sequence.litLength - 16, ZSTD_no_overlap); + } + op = oLitEnd; + *litPtr = iLitEnd; /* update for next sequence */ + + /* Copy Match */ + if (sequence.offset > (size_t)(oLitEnd - prefixStart)) { + /* offset beyond prefix -> go into extDict */ + RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, ""); + match = dictEnd + (match - prefixStart); + if (match + sequence.matchLength <= dictEnd) { + ZSTD_memmove(oLitEnd, match, sequence.matchLength); + return sequenceLength; + } + /* span extDict & currentPrefixSegment */ + { size_t const length1 = dictEnd - match; + ZSTD_memmove(oLitEnd, match, length1); + op = oLitEnd + length1; + sequence.matchLength -= length1; + match = prefixStart; + } + } + /* Match within prefix of 1 or more bytes */ + assert(op <= oMatchEnd); + assert(oMatchEnd <= oend_w); + assert(match >= prefixStart); + assert(sequence.matchLength >= 1); + + /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy + * without overlap checking. + */ + if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) { + /* We bet on a full wildcopy for matches, since we expect matches to be + * longer than literals (in general). In silesia, ~10% of matches are longer + * than 16 bytes. + */ + ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap); + return sequenceLength; + } + assert(sequence.offset < WILDCOPY_VECLEN); + + /* Copy 8 bytes and spread the offset to be >= 8. */ + ZSTD_overlapCopy8(&op, &match, sequence.offset); + + /* If the match length is > 8 bytes, then continue with the wildcopy. */ + if (sequence.matchLength > 8) { + assert(op < oMatchEnd); + ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength - 8, ZSTD_overlap_src_before_dst); + } + return sequenceLength; +} + +HINT_INLINE +size_t ZSTD_execSequenceSplitLitBuffer(BYTE* op, + BYTE* const oend, const BYTE* const oend_w, seq_t sequence, + const BYTE** litPtr, const BYTE* const litLimit, + const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) +{ + BYTE* const oLitEnd = op + sequence.litLength; + size_t const sequenceLength = sequence.litLength + sequence.matchLength; + BYTE* const oMatchEnd = op + sequenceLength; /* risk : address space overflow (32-bits) */ + const BYTE* const iLitEnd = *litPtr + sequence.litLength; + const BYTE* match = oLitEnd - sequence.offset; + + assert(op != NULL /* Precondition */); + assert(oend_w < oend /* No underflow */); /* Handle edge cases in a slow path: * - Read beyond end of literals * - Match end is within WILDCOPY_OVERLIMIT of oend @@ -824,7 +1081,7 @@ size_t ZSTD_execSequence(BYTE* op, iLitEnd > litLimit || oMatchEnd > oend_w || (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH))) - return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd); + return ZSTD_execSequenceEndSplitLitBuffer(op, oend, oend_w, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd); /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */ assert(op <= oLitEnd /* No overflow */); @@ -892,6 +1149,7 @@ size_t ZSTD_execSequence(BYTE* op, return sequenceLength; } + static void ZSTD_initFseState(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, const ZSTD_seqSymbol* dt) { @@ -905,24 +1163,14 @@ ZSTD_initFseState(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, const ZSTD_seqS } FORCE_INLINE_TEMPLATE void -ZSTD_updateFseState(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD) +ZSTD_updateFseStateWithDInfo(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, U16 nextState, U32 nbBits) { - ZSTD_seqSymbol const DInfo = DStatePtr->table[DStatePtr->state]; - U32 const nbBits = DInfo.nbBits; size_t const lowBits = BIT_readBits(bitD, nbBits); - DStatePtr->state = DInfo.nextState + lowBits; -} - -FORCE_INLINE_TEMPLATE void -ZSTD_updateFseStateWithDInfo(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, ZSTD_seqSymbol const DInfo) -{ - U32 const nbBits = DInfo.nbBits; - size_t const lowBits = BIT_readBits(bitD, nbBits); - DStatePtr->state = DInfo.nextState + lowBits; + DStatePtr->state = nextState + lowBits; } /* We need to add at most (ZSTD_WINDOWLOG_MAX_32 - 1) bits to read the maximum - * offset bits. But we can only read at most (STREAM_ACCUMULATOR_MIN_32 - 1) + * offset bits. But we can only read at most STREAM_ACCUMULATOR_MIN_32 * bits before reloading. This value is the maximum number of bytes we read * after reloading when we are decoding long offsets. */ @@ -937,102 +1185,125 @@ FORCE_INLINE_TEMPLATE seq_t ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets) { seq_t seq; - ZSTD_seqSymbol const llDInfo = seqState->stateLL.table[seqState->stateLL.state]; - ZSTD_seqSymbol const mlDInfo = seqState->stateML.table[seqState->stateML.state]; - ZSTD_seqSymbol const ofDInfo = seqState->stateOffb.table[seqState->stateOffb.state]; - U32 const llBase = llDInfo.baseValue; - U32 const mlBase = mlDInfo.baseValue; - U32 const ofBase = ofDInfo.baseValue; - BYTE const llBits = llDInfo.nbAdditionalBits; - BYTE const mlBits = mlDInfo.nbAdditionalBits; - BYTE const ofBits = ofDInfo.nbAdditionalBits; - BYTE const totalBits = llBits+mlBits+ofBits; - - /* sequence */ - { size_t offset; - if (ofBits > 1) { - ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1); - ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5); - assert(ofBits <= MaxOff); - if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) { - U32 const extraBits = ofBits - MIN(ofBits, 32 - seqState->DStream.bitsConsumed); - offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits); - BIT_reloadDStream(&seqState->DStream); - if (extraBits) offset += BIT_readBitsFast(&seqState->DStream, extraBits); - assert(extraBits <= LONG_OFFSETS_MAX_EXTRA_BITS_32); /* to avoid another reload */ - } else { - offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); - } - seqState->prevOffset[2] = seqState->prevOffset[1]; - seqState->prevOffset[1] = seqState->prevOffset[0]; - seqState->prevOffset[0] = offset; - } else { - U32 const ll0 = (llBase == 0); - if (LIKELY((ofBits == 0))) { - if (LIKELY(!ll0)) - offset = seqState->prevOffset[0]; - else { - offset = seqState->prevOffset[1]; - seqState->prevOffset[1] = seqState->prevOffset[0]; - seqState->prevOffset[0] = offset; - } - } else { - offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1); - { size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset]; - temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */ - if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1]; - seqState->prevOffset[1] = seqState->prevOffset[0]; - seqState->prevOffset[0] = offset = temp; - } } } - seq.offset = offset; - } - - seq.matchLength = mlBase; - if (mlBits > 0) - seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/); - - if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32)) - BIT_reloadDStream(&seqState->DStream); - if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog))) - BIT_reloadDStream(&seqState->DStream); - /* Ensure there are enough bits to read the rest of data in 64-bit mode. */ - ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64); - - seq.litLength = llBase; - if (llBits > 0) - seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/); - - if (MEM_32bits()) - BIT_reloadDStream(&seqState->DStream); - - DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u", - (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset); - - /* ANS state update - * gcc-9.0.0 does 2.5% worse with ZSTD_updateFseStateWithDInfo(). - * clang-9.2.0 does 7% worse with ZSTD_updateFseState(). - * Naturally it seems like ZSTD_updateFseStateWithDInfo() should be the - * better option, so it is the default for other compilers. But, if you - * measure that it is worse, please put up a pull request. + /* + * ZSTD_seqSymbol is a structure with a total of 64 bits wide. So it can be + * loaded in one operation and extracted its fields by simply shifting or + * bit-extracting on aarch64. + * GCC doesn't recognize this and generates more unnecessary ldr/ldrb/ldrh + * operations that cause performance drop. This can be avoided by using this + * ZSTD_memcpy hack. */ - { -#if defined(__GNUC__) && !defined(__clang__) - const int kUseUpdateFseState = 1; +#if defined(__aarch64__) && (defined(__GNUC__) && !defined(__clang__)) + ZSTD_seqSymbol llDInfoS, mlDInfoS, ofDInfoS; + ZSTD_seqSymbol* const llDInfo = &llDInfoS; + ZSTD_seqSymbol* const mlDInfo = &mlDInfoS; + ZSTD_seqSymbol* const ofDInfo = &ofDInfoS; + ZSTD_memcpy(llDInfo, seqState->stateLL.table + seqState->stateLL.state, sizeof(ZSTD_seqSymbol)); + ZSTD_memcpy(mlDInfo, seqState->stateML.table + seqState->stateML.state, sizeof(ZSTD_seqSymbol)); + ZSTD_memcpy(ofDInfo, seqState->stateOffb.table + seqState->stateOffb.state, sizeof(ZSTD_seqSymbol)); #else - const int kUseUpdateFseState = 0; + const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state; + const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state; + const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state; #endif - if (kUseUpdateFseState) { - ZSTD_updateFseState(&seqState->stateLL, &seqState->DStream); /* <= 9 bits */ - ZSTD_updateFseState(&seqState->stateML, &seqState->DStream); /* <= 9 bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */ - ZSTD_updateFseState(&seqState->stateOffb, &seqState->DStream); /* <= 8 bits */ - } else { - ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llDInfo); /* <= 9 bits */ - ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlDInfo); /* <= 9 bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */ - ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofDInfo); /* <= 8 bits */ + seq.matchLength = mlDInfo->baseValue; + seq.litLength = llDInfo->baseValue; + { U32 const ofBase = ofDInfo->baseValue; + BYTE const llBits = llDInfo->nbAdditionalBits; + BYTE const mlBits = mlDInfo->nbAdditionalBits; + BYTE const ofBits = ofDInfo->nbAdditionalBits; + BYTE const totalBits = llBits+mlBits+ofBits; + + U16 const llNext = llDInfo->nextState; + U16 const mlNext = mlDInfo->nextState; + U16 const ofNext = ofDInfo->nextState; + U32 const llnbBits = llDInfo->nbBits; + U32 const mlnbBits = mlDInfo->nbBits; + U32 const ofnbBits = ofDInfo->nbBits; + + assert(llBits <= MaxLLBits); + assert(mlBits <= MaxMLBits); + assert(ofBits <= MaxOff); + /* + * As gcc has better branch and block analyzers, sometimes it is only + * valuable to mark likeliness for clang, it gives around 3-4% of + * performance. + */ + + /* sequence */ + { size_t offset; + #if defined(__clang__) + if (LIKELY(ofBits > 1)) { + #else + if (ofBits > 1) { + #endif + ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1); + ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5); + ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32); + ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits); + if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) { + /* Always read extra bits, this keeps the logic simple, + * avoids branches, and avoids accidentally reading 0 bits. + */ + U32 const extraBits = LONG_OFFSETS_MAX_EXTRA_BITS_32; + offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits); + BIT_reloadDStream(&seqState->DStream); + offset += BIT_readBitsFast(&seqState->DStream, extraBits); + } else { + offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */ + if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); + } + seqState->prevOffset[2] = seqState->prevOffset[1]; + seqState->prevOffset[1] = seqState->prevOffset[0]; + seqState->prevOffset[0] = offset; + } else { + U32 const ll0 = (llDInfo->baseValue == 0); + if (LIKELY((ofBits == 0))) { + offset = seqState->prevOffset[ll0]; + seqState->prevOffset[1] = seqState->prevOffset[!ll0]; + seqState->prevOffset[0] = offset; + } else { + offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1); + { size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset]; + temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */ + if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1]; + seqState->prevOffset[1] = seqState->prevOffset[0]; + seqState->prevOffset[0] = offset = temp; + } } } + seq.offset = offset; } + + #if defined(__clang__) + if (UNLIKELY(mlBits > 0)) + #else + if (mlBits > 0) + #endif + seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/); + + if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32)) + BIT_reloadDStream(&seqState->DStream); + if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog))) + BIT_reloadDStream(&seqState->DStream); + /* Ensure there are enough bits to read the rest of data in 64-bit mode. */ + ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64); + + #if defined(__clang__) + if (UNLIKELY(llBits > 0)) + #else + if (llBits > 0) + #endif + seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/); + + if (MEM_32bits()) + BIT_reloadDStream(&seqState->DStream); + + DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u", + (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset); + + ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits); /* <= 9 bits */ + ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits); /* <= 9 bits */ + if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */ + ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits); /* <= 8 bits */ } return seq; @@ -1085,9 +1356,11 @@ MEM_STATIC void ZSTD_assertValidSequence( #endif #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG + + FORCE_INLINE_TEMPLATE size_t DONT_VECTORIZE -ZSTD_decompressSequences_body( ZSTD_DCtx* dctx, +ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, const ZSTD_longOffset_e isLongOffset, @@ -1099,11 +1372,11 @@ ZSTD_decompressSequences_body( ZSTD_DCtx* dctx, BYTE* const oend = ostart + maxDstSize; BYTE* op = ostart; const BYTE* litPtr = dctx->litPtr; - const BYTE* const litEnd = litPtr + dctx->litSize; + const BYTE* litBufferEnd = dctx->litBufferEnd; const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart); const BYTE* const vBase = (const BYTE*) (dctx->virtualStart); const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd); - DEBUGLOG(5, "ZSTD_decompressSequences_body"); + DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer"); (void)frame; /* Regen sequences */ @@ -1124,55 +1397,237 @@ ZSTD_decompressSequences_body( ZSTD_DCtx* dctx, BIT_DStream_endOfBuffer < BIT_DStream_completed && BIT_DStream_completed < BIT_DStream_overflow); + /* decompress without overrunning litPtr begins */ + { + seq_t sequence = ZSTD_decodeSequence(&seqState, isLongOffset); + /* Align the decompression loop to 32 + 16 bytes. + * + * zstd compiled with gcc-9 on an Intel i9-9900k shows 10% decompression + * speed swings based on the alignment of the decompression loop. This + * performance swing is caused by parts of the decompression loop falling + * out of the DSB. The entire decompression loop should fit in the DSB, + * when it can't we get much worse performance. You can measure if you've + * hit the good case or the bad case with this perf command for some + * compressed file test.zst: + * + * perf stat -e cycles -e instructions -e idq.all_dsb_cycles_any_uops \ + * -e idq.all_mite_cycles_any_uops -- ./zstd -tq test.zst + * + * If you see most cycles served out of the MITE you've hit the bad case. + * If you see most cycles served out of the DSB you've hit the good case. + * If it is pretty even then you may be in an okay case. + * + * This issue has been reproduced on the following CPUs: + * - Kabylake: Macbook Pro (15-inch, 2019) 2.4 GHz Intel Core i9 + * Use Instruments->Counters to get DSB/MITE cycles. + * I never got performance swings, but I was able to + * go from the good case of mostly DSB to half of the + * cycles served from MITE. + * - Coffeelake: Intel i9-9900k + * - Coffeelake: Intel i7-9700k + * + * I haven't been able to reproduce the instability or DSB misses on any + * of the following CPUS: + * - Haswell + * - Broadwell: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GH + * - Skylake + * + * Alignment is done for each of the three major decompression loops: + * - ZSTD_decompressSequences_bodySplitLitBuffer - presplit section of the literal buffer + * - ZSTD_decompressSequences_bodySplitLitBuffer - postsplit section of the literal buffer + * - ZSTD_decompressSequences_body + * Alignment choices are made to minimize large swings on bad cases and influence on performance + * from changes external to this code, rather than to overoptimize on the current commit. + * + * If you are seeing performance stability this script can help test. + * It tests on 4 commits in zstd where I saw performance change. + * + * https://gist.github.com/terrelln/9889fc06a423fd5ca6e99351564473f4 + */ #if defined(__GNUC__) && defined(__x86_64__) - /* Align the decompression loop to 32 + 16 bytes. - * - * zstd compiled with gcc-9 on an Intel i9-9900k shows 10% decompression - * speed swings based on the alignment of the decompression loop. This - * performance swing is caused by parts of the decompression loop falling - * out of the DSB. The entire decompression loop should fit in the DSB, - * when it can't we get much worse performance. You can measure if you've - * hit the good case or the bad case with this perf command for some - * compressed file test.zst: - * - * perf stat -e cycles -e instructions -e idq.all_dsb_cycles_any_uops \ - * -e idq.all_mite_cycles_any_uops -- ./zstd -tq test.zst - * - * If you see most cycles served out of the MITE you've hit the bad case. - * If you see most cycles served out of the DSB you've hit the good case. - * If it is pretty even then you may be in an okay case. - * - * This issue has been reproduced on the following CPUs: - * - Kabylake: Macbook Pro (15-inch, 2019) 2.4 GHz Intel Core i9 - * Use Instruments->Counters to get DSB/MITE cycles. - * I never got performance swings, but I was able to - * go from the good case of mostly DSB to half of the - * cycles served from MITE. - * - Coffeelake: Intel i9-9900k - * - Coffeelake: Intel i7-9700k - * - * I haven't been able to reproduce the instability or DSB misses on any - * of the following CPUS: - * - Haswell - * - Broadwell: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GH - * - Skylake - * - * If you are seeing performance stability this script can help test. - * It tests on 4 commits in zstd where I saw performance change. - * - * https://gist.github.com/terrelln/9889fc06a423fd5ca6e99351564473f4 - */ - __asm__(".p2align 6"); - __asm__("nop"); - __asm__(".p2align 5"); - __asm__("nop"); -# if __GNUC__ >= 9 - /* better for gcc-9 and gcc-10, worse for clang and gcc-8 */ - __asm__(".p2align 3"); -# else - __asm__(".p2align 4"); + __asm__(".p2align 6"); +# if __GNUC__ >= 7 + /* good for gcc-7, gcc-9, and gcc-11 */ + __asm__("nop"); + __asm__(".p2align 5"); + __asm__("nop"); + __asm__(".p2align 4"); +# if __GNUC__ == 8 || __GNUC__ == 10 + /* good for gcc-8 and gcc-10 */ + __asm__("nop"); + __asm__(".p2align 3"); +# endif # endif #endif + + /* Handle the initial state where litBuffer is currently split between dst and litExtraBuffer */ + for (; litPtr + sequence.litLength <= dctx->litBufferEnd; ) { + size_t const oneSeqSize = ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence.litLength - WILDCOPY_OVERLENGTH, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) + assert(!ZSTD_isError(oneSeqSize)); + if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); +#endif + if (UNLIKELY(ZSTD_isError(oneSeqSize))) + return oneSeqSize; + DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); + op += oneSeqSize; + if (UNLIKELY(!--nbSeq)) + break; + BIT_reloadDStream(&(seqState.DStream)); + sequence = ZSTD_decodeSequence(&seqState, isLongOffset); + } + + /* If there are more sequences, they will need to read literals from litExtraBuffer; copy over the remainder from dst and update litPtr and litEnd */ + if (nbSeq > 0) { + const size_t leftoverLit = dctx->litBufferEnd - litPtr; + if (leftoverLit) + { + RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer"); + ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit); + sequence.litLength -= leftoverLit; + op += leftoverLit; + } + litPtr = dctx->litExtraBuffer; + litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; + dctx->litBufferLocation = ZSTD_not_in_dst; + { + size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) + assert(!ZSTD_isError(oneSeqSize)); + if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); +#endif + if (UNLIKELY(ZSTD_isError(oneSeqSize))) + return oneSeqSize; + DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); + op += oneSeqSize; + if (--nbSeq) + BIT_reloadDStream(&(seqState.DStream)); + } + } + } + + if (nbSeq > 0) /* there is remaining lit from extra buffer */ + { + +#if defined(__GNUC__) && defined(__x86_64__) + __asm__(".p2align 6"); + __asm__("nop"); +# if __GNUC__ != 7 + /* worse for gcc-7 better for gcc-8, gcc-9, and gcc-10 and clang */ + __asm__(".p2align 4"); + __asm__("nop"); + __asm__(".p2align 3"); +# elif __GNUC__ >= 11 + __asm__(".p2align 3"); +# else + __asm__(".p2align 5"); + __asm__("nop"); + __asm__(".p2align 3"); +# endif +#endif + + for (; ; ) { + seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset); + size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd); +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) + assert(!ZSTD_isError(oneSeqSize)); + if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase); +#endif + if (UNLIKELY(ZSTD_isError(oneSeqSize))) + return oneSeqSize; + DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); + op += oneSeqSize; + if (UNLIKELY(!--nbSeq)) + break; + BIT_reloadDStream(&(seqState.DStream)); + } + } + + /* check if reached exact end */ + DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer: after decode loop, remaining nbSeq : %i", nbSeq); + RETURN_ERROR_IF(nbSeq, corruption_detected, ""); + RETURN_ERROR_IF(BIT_reloadDStream(&seqState.DStream) < BIT_DStream_completed, corruption_detected, ""); + /* save reps for next block */ + { U32 i; for (i=0; ientropy.rep[i] = (U32)(seqState.prevOffset[i]); } + } + + /* last literal segment */ + if (dctx->litBufferLocation == ZSTD_split) /* split hasn't been reached yet, first get dst then copy litExtraBuffer */ + { + size_t const lastLLSize = litBufferEnd - litPtr; + RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, ""); + if (op != NULL) { + ZSTD_memmove(op, litPtr, lastLLSize); + op += lastLLSize; + } + litPtr = dctx->litExtraBuffer; + litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; + dctx->litBufferLocation = ZSTD_not_in_dst; + } + { size_t const lastLLSize = litBufferEnd - litPtr; + RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, ""); + if (op != NULL) { + ZSTD_memcpy(op, litPtr, lastLLSize); + op += lastLLSize; + } + } + + return op-ostart; +} + +FORCE_INLINE_TEMPLATE size_t +DONT_VECTORIZE +ZSTD_decompressSequences_body(ZSTD_DCtx* dctx, + void* dst, size_t maxDstSize, + const void* seqStart, size_t seqSize, int nbSeq, + const ZSTD_longOffset_e isLongOffset, + const int frame) +{ + const BYTE* ip = (const BYTE*)seqStart; + const BYTE* const iend = ip + seqSize; + BYTE* const ostart = (BYTE*)dst; + BYTE* const oend = dctx->litBufferLocation == ZSTD_not_in_dst ? ostart + maxDstSize : dctx->litBuffer; + BYTE* op = ostart; + const BYTE* litPtr = dctx->litPtr; + const BYTE* const litEnd = litPtr + dctx->litSize; + const BYTE* const prefixStart = (const BYTE*)(dctx->prefixStart); + const BYTE* const vBase = (const BYTE*)(dctx->virtualStart); + const BYTE* const dictEnd = (const BYTE*)(dctx->dictEnd); + DEBUGLOG(5, "ZSTD_decompressSequences_body: nbSeq = %d", nbSeq); + (void)frame; + + /* Regen sequences */ + if (nbSeq) { + seqState_t seqState; + dctx->fseEntropy = 1; + { U32 i; for (i = 0; i < ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; } + RETURN_ERROR_IF( + ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend - ip)), + corruption_detected, ""); + ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr); + ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr); + ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); + assert(dst != NULL); + + ZSTD_STATIC_ASSERT( + BIT_DStream_unfinished < BIT_DStream_completed && + BIT_DStream_endOfBuffer < BIT_DStream_completed && + BIT_DStream_completed < BIT_DStream_overflow); + +#if defined(__GNUC__) && defined(__x86_64__) + __asm__(".p2align 6"); + __asm__("nop"); +# if __GNUC__ >= 7 + __asm__(".p2align 5"); + __asm__("nop"); + __asm__(".p2align 3"); +# else + __asm__(".p2align 4"); + __asm__("nop"); + __asm__(".p2align 3"); +# endif +#endif + for ( ; ; ) { seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset); size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd); @@ -1218,6 +1673,16 @@ ZSTD_decompressSequences_default(ZSTD_DCtx* dctx, { return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); } + +static size_t +ZSTD_decompressSequencesSplitLitBuffer_default(ZSTD_DCtx* dctx, + void* dst, size_t maxDstSize, + const void* seqStart, size_t seqSize, int nbSeq, + const ZSTD_longOffset_e isLongOffset, + const int frame) +{ + return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); +} #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT @@ -1250,10 +1715,10 @@ ZSTD_decompressSequencesLong_body( const BYTE* ip = (const BYTE*)seqStart; const BYTE* const iend = ip + seqSize; BYTE* const ostart = (BYTE*)dst; - BYTE* const oend = ostart + maxDstSize; + BYTE* const oend = dctx->litBufferLocation == ZSTD_in_dst ? dctx->litBuffer : ostart + maxDstSize; BYTE* op = ostart; const BYTE* litPtr = dctx->litPtr; - const BYTE* const litEnd = litPtr + dctx->litSize; + const BYTE* litBufferEnd = dctx->litBufferEnd; const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart); const BYTE* const dictStart = (const BYTE*) (dctx->virtualStart); const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd); @@ -1289,32 +1754,94 @@ ZSTD_decompressSequencesLong_body( } RETURN_ERROR_IF(seqNblitBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) + { + /* lit buffer is reaching split point, empty out the first buffer and transition to litExtraBuffer */ + const size_t leftoverLit = dctx->litBufferEnd - litPtr; + if (leftoverLit) + { + RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer"); + ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit); + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength -= leftoverLit; + op += leftoverLit; + } + litPtr = dctx->litExtraBuffer; + litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; + dctx->litBufferLocation = ZSTD_not_in_dst; + oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) + assert(!ZSTD_isError(oneSeqSize)); + if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); +#endif + if (ZSTD_isError(oneSeqSize)) return oneSeqSize; + + prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); + sequences[seqNb & STORED_SEQS_MASK] = sequence; + op += oneSeqSize; + } + else + { + /* lit buffer is either wholly contained in first or second split, or not split at all*/ + oneSeqSize = dctx->litBufferLocation == ZSTD_split ? + ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) : + ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) + assert(!ZSTD_isError(oneSeqSize)); + if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart); +#endif + if (ZSTD_isError(oneSeqSize)) return oneSeqSize; + + prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd); + sequences[seqNb & STORED_SEQS_MASK] = sequence; + op += oneSeqSize; + } } RETURN_ERROR_IF(seqNblitBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) + { + const size_t leftoverLit = dctx->litBufferEnd - litPtr; + if (leftoverLit) + { + RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer"); + ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit); + sequence->litLength -= leftoverLit; + op += leftoverLit; + } + litPtr = dctx->litExtraBuffer; + litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; + dctx->litBufferLocation = ZSTD_not_in_dst; + { + size_t const oneSeqSize = ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) - assert(!ZSTD_isError(oneSeqSize)); - if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); + assert(!ZSTD_isError(oneSeqSize)); + if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); #endif - if (ZSTD_isError(oneSeqSize)) return oneSeqSize; - op += oneSeqSize; + if (ZSTD_isError(oneSeqSize)) return oneSeqSize; + op += oneSeqSize; + } + } + else + { + size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ? + ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence->litLength - WILDCOPY_OVERLENGTH, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) : + ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd); +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE) + assert(!ZSTD_isError(oneSeqSize)); + if (frame) ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart); +#endif + if (ZSTD_isError(oneSeqSize)) return oneSeqSize; + op += oneSeqSize; + } } /* save reps for next block */ @@ -1322,10 +1849,21 @@ ZSTD_decompressSequencesLong_body( } /* last literal segment */ - { size_t const lastLLSize = litEnd - litPtr; + if (dctx->litBufferLocation == ZSTD_split) /* first deplete literal buffer in dst, then copy litExtraBuffer */ + { + size_t const lastLLSize = litBufferEnd - litPtr; + RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, ""); + if (op != NULL) { + ZSTD_memmove(op, litPtr, lastLLSize); + op += lastLLSize; + } + litPtr = dctx->litExtraBuffer; + litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; + } + { size_t const lastLLSize = litBufferEnd - litPtr; RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, ""); if (op != NULL) { - ZSTD_memcpy(op, litPtr, lastLLSize); + ZSTD_memmove(op, litPtr, lastLLSize); op += lastLLSize; } } @@ -1349,7 +1887,7 @@ ZSTD_decompressSequencesLong_default(ZSTD_DCtx* dctx, #if DYNAMIC_BMI2 #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG -static TARGET_ATTRIBUTE("bmi2") size_t +static BMI2_TARGET_ATTRIBUTE size_t DONT_VECTORIZE ZSTD_decompressSequences_bmi2(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, @@ -1359,10 +1897,20 @@ ZSTD_decompressSequences_bmi2(ZSTD_DCtx* dctx, { return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); } +static BMI2_TARGET_ATTRIBUTE size_t +DONT_VECTORIZE +ZSTD_decompressSequencesSplitLitBuffer_bmi2(ZSTD_DCtx* dctx, + void* dst, size_t maxDstSize, + const void* seqStart, size_t seqSize, int nbSeq, + const ZSTD_longOffset_e isLongOffset, + const int frame) +{ + return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); +} #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT -static TARGET_ATTRIBUTE("bmi2") size_t +static BMI2_TARGET_ATTRIBUTE size_t ZSTD_decompressSequencesLong_bmi2(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, const void* seqStart, size_t seqSize, int nbSeq, @@ -1391,11 +1939,25 @@ ZSTD_decompressSequences(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, { DEBUGLOG(5, "ZSTD_decompressSequences"); #if DYNAMIC_BMI2 - if (dctx->bmi2) { + if (ZSTD_DCtx_get_bmi2(dctx)) { return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); } #endif - return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); +} +static size_t +ZSTD_decompressSequencesSplitLitBuffer(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, + const void* seqStart, size_t seqSize, int nbSeq, + const ZSTD_longOffset_e isLongOffset, + const int frame) +{ + DEBUGLOG(5, "ZSTD_decompressSequencesSplitLitBuffer"); +#if DYNAMIC_BMI2 + if (ZSTD_DCtx_get_bmi2(dctx)) { + return ZSTD_decompressSequencesSplitLitBuffer_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); + } +#endif + return ZSTD_decompressSequencesSplitLitBuffer_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); } #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ @@ -1415,7 +1977,7 @@ ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx, { DEBUGLOG(5, "ZSTD_decompressSequencesLong"); #if DYNAMIC_BMI2 - if (dctx->bmi2) { + if (ZSTD_DCtx_get_bmi2(dctx)) { return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); } #endif @@ -1424,55 +1986,101 @@ ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx, #endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT */ +/** + * @returns The total size of the history referencable by zstd, including + * both the prefix and the extDict. At @p op any offset larger than this + * is invalid. + */ +static size_t ZSTD_totalHistorySize(BYTE* op, BYTE const* virtualStart) +{ + return (size_t)(op - virtualStart); +} -#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ - !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) -/* ZSTD_getLongOffsetsShare() : +typedef struct { + unsigned longOffsetShare; + unsigned maxNbAdditionalBits; +} ZSTD_OffsetInfo; + +/* ZSTD_getOffsetInfo() : * condition : offTable must be valid * @return : "share" of long offsets (arbitrarily defined as > (1<<23)) - * compared to maximum possible of (1< 22) total += 1; + assert(max <= (1 << OffFSELog)); /* max not too large */ + for (u=0; u 22) info.longOffsetShare += 1; + } + + assert(tableLog <= OffFSELog); + info.longOffsetShare <<= (OffFSELog - tableLog); /* scale to OffFSELog */ } - assert(tableLog <= OffFSELog); - total <<= (OffFSELog - tableLog); /* scale to OffFSELog */ - - return total; + return info; +} + +/** + * @returns The maximum offset we can decode in one read of our bitstream, without + * reloading more bits in the middle of the offset bits read. Any offsets larger + * than this must use the long offset decoder. + */ +static size_t ZSTD_maxShortOffset(void) +{ + if (MEM_64bits()) { + /* We can decode any offset without reloading bits. + * This might change if the max window size grows. + */ + ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX <= 31); + return (size_t)-1; + } else { + /* The maximum offBase is (1 << (STREAM_ACCUMULATOR_MIN + 1)) - 1. + * This offBase would require STREAM_ACCUMULATOR_MIN extra bits. + * Then we have to subtract ZSTD_REP_NUM to get the maximum possible offset. + */ + size_t const maxOffbase = ((size_t)1 << (STREAM_ACCUMULATOR_MIN + 1)) - 1; + size_t const maxOffset = maxOffbase - ZSTD_REP_NUM; + assert(ZSTD_highbit32((U32)maxOffbase) == STREAM_ACCUMULATOR_MIN); + return maxOffset; + } } -#endif size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, - const void* src, size_t srcSize, const int frame) + const void* src, size_t srcSize, const int frame, const streaming_operation streaming) { /* blockType == blockCompressed */ const BYTE* ip = (const BYTE*)src; - /* isLongOffset must be true if there are long offsets. - * Offsets are long if they are larger than 2^STREAM_ACCUMULATOR_MIN. - * We don't expect that to be the case in 64-bit mode. - * In block mode, window size is not known, so we have to be conservative. - * (note: but it could be evaluated from current-lowLimit) - */ - ZSTD_longOffset_e const isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (!frame || (dctx->fParams.windowSize > (1ULL << STREAM_ACCUMULATOR_MIN)))); DEBUGLOG(5, "ZSTD_decompressBlock_internal (size : %u)", (U32)srcSize); - RETURN_ERROR_IF(srcSize >= ZSTD_BLOCKSIZE_MAX, srcSize_wrong, ""); + /* Note : the wording of the specification + * allows compressed block to be sized exactly ZSTD_BLOCKSIZE_MAX. + * This generally does not happen, as it makes little sense, + * since an uncompressed block would feature same size and have no decompression cost. + * Also, note that decoder from reference libzstd before < v1.5.4 + * would consider this edge case as an error. + * As a consequence, avoid generating compressed blocks of size ZSTD_BLOCKSIZE_MAX + * for broader compatibility with the deployed ecosystem of zstd decoders */ + RETURN_ERROR_IF(srcSize > ZSTD_BLOCKSIZE_MAX, srcSize_wrong, ""); /* Decode literals section */ - { size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize); - DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : %u", (U32)litCSize); + { size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, streaming); + DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : cSize=%u, nbLiterals=%zu", (U32)litCSize, dctx->litSize); if (ZSTD_isError(litCSize)) return litCSize; ip += litCSize; srcSize -= litCSize; @@ -1480,6 +2088,23 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, /* Build Decoding Tables */ { + /* Compute the maximum block size, which must also work when !frame and fParams are unset. + * Additionally, take the min with dstCapacity to ensure that the totalHistorySize fits in a size_t. + */ + size_t const blockSizeMax = MIN(dstCapacity, (frame ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX)); + size_t const totalHistorySize = ZSTD_totalHistorySize((BYTE*)dst + blockSizeMax, (BYTE const*)dctx->virtualStart); + /* isLongOffset must be true if there are long offsets. + * Offsets are long if they are larger than ZSTD_maxShortOffset(). + * We don't expect that to be the case in 64-bit mode. + * + * We check here to see if our history is large enough to allow long offsets. + * If it isn't, then we can't possible have (valid) long offsets. If the offset + * is invalid, then it is okay to read it incorrectly. + * + * If isLongOffsets is true, then we will later check our decoding table to see + * if it is even possible to generate long offsets. + */ + ZSTD_longOffset_e isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (totalHistorySize > ZSTD_maxShortOffset())); /* These macros control at build-time which decompressor implementation * we use. If neither is defined, we do some inspection and dispatch at * runtime. @@ -1487,6 +2112,11 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, #if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) int usePrefetchDecoder = dctx->ddictIsCold; +#else + /* Set to 1 to avoid computing offset info if we don't need to. + * Otherwise this value is ignored. + */ + int usePrefetchDecoder = 1; #endif int nbSeq; size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize); @@ -1496,30 +2126,45 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, RETURN_ERROR_IF(dst == NULL && nbSeq > 0, dstSize_tooSmall, "NULL not handled"); -#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ - !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) - if ( !usePrefetchDecoder - && (!frame || (dctx->fParams.windowSize > (1<<24))) - && (nbSeq>ADVANCED_SEQS) ) { /* could probably use a larger nbSeq limit */ - U32 const shareLongOffsets = ZSTD_getLongOffsetsShare(dctx->OFTptr); - U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */ - usePrefetchDecoder = (shareLongOffsets >= minShare); + /* If we could potentially have long offsets, or we might want to use the prefetch decoder, + * compute information about the share of long offsets, and the maximum nbAdditionalBits. + * NOTE: could probably use a larger nbSeq limit + */ + if (isLongOffset || (!usePrefetchDecoder && (totalHistorySize > (1u << 24)) && (nbSeq > 8))) { + ZSTD_OffsetInfo const info = ZSTD_getOffsetInfo(dctx->OFTptr, nbSeq); + if (isLongOffset && info.maxNbAdditionalBits <= STREAM_ACCUMULATOR_MIN) { + /* If isLongOffset, but the maximum number of additional bits that we see in our table is small + * enough, then we know it is impossible to have too long an offset in this block, so we can + * use the regular offset decoder. + */ + isLongOffset = ZSTD_lo_isRegularOffset; + } + if (!usePrefetchDecoder) { + U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */ + usePrefetchDecoder = (info.longOffsetShare >= minShare); + } } -#endif dctx->ddictIsCold = 0; #if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) - if (usePrefetchDecoder) + if (usePrefetchDecoder) { +#else + (void)usePrefetchDecoder; + { #endif #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset, frame); #endif + } #ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG /* else */ - return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset, frame); + if (dctx->litBufferLocation == ZSTD_split) + return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset, frame); + else + return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset, frame); #endif } } @@ -1542,7 +2187,7 @@ size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, { size_t dSize; ZSTD_checkContinuity(dctx, dst, dstCapacity); - dSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 0); + dSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 0, not_streaming); dctx->previousDstEnd = (char*)dst + dSize; return dSize; } diff --git a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_block.h b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_block.h similarity index 86% rename from src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_block.h rename to src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_block.h index 049a0cd..67791db 100644 --- a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_block.h +++ b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_block.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -33,6 +33,12 @@ */ + /* Streaming state is used to inform allocation of the literal buffer */ +typedef enum { + not_streaming = 0, + is_streaming = 1 +} streaming_operation; + /* ZSTD_decompressBlock_internal() : * decompress block, starting at `src`, * into destination buffer `dst`. @@ -41,7 +47,7 @@ */ size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, - const void* src, size_t srcSize, const int frame); + const void* src, size_t srcSize, const int frame, const streaming_operation streaming); /* ZSTD_buildFSETable() : * generate FSE decoding table for one symbol (ll, ml or off) @@ -54,7 +60,7 @@ size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, */ void ZSTD_buildFSETable(ZSTD_seqSymbol* dt, const short* normalizedCounter, unsigned maxSymbolValue, - const U32* baseValue, const U32* nbAdditionalBits, + const U32* baseValue, const U8* nbAdditionalBits, unsigned tableLog, void* wksp, size_t wkspSize, int bmi2); diff --git a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_internal.h b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_internal.h similarity index 84% rename from src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_internal.h rename to src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_internal.h index ebda0c9..c2ec5d9 100644 --- a/src/dependencies/zstd-1.5.0/lib/decompress/zstd_decompress_internal.h +++ b/src/dependencies/zstd-1.5.4/lib/decompress/zstd_decompress_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -20,7 +20,7 @@ * Dependencies *********************************************************/ #include "../common/mem.h" /* BYTE, U16, U32 */ -#include "../common/zstd_internal.h" /* ZSTD_seqSymbol */ +#include "../common/zstd_internal.h" /* constants : MaxLL, MaxML, MaxOff, LLFSELog, etc. */ @@ -40,7 +40,7 @@ static UNUSED_ATTR const U32 OF_base[MaxOff+1] = { 0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD, 0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD, 0x1FFFFFFD, 0x3FFFFFFD, 0x7FFFFFFD }; -static UNUSED_ATTR const U32 OF_bits[MaxOff+1] = { +static UNUSED_ATTR const U8 OF_bits[MaxOff+1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, @@ -75,12 +75,13 @@ static UNUSED_ATTR const U32 ML_base[MaxML+1] = { #define ZSTD_BUILD_FSE_TABLE_WKSP_SIZE (sizeof(S16) * (MaxSeq + 1) + (1u << MaxFSELog) + sizeof(U64)) #define ZSTD_BUILD_FSE_TABLE_WKSP_SIZE_U32 ((ZSTD_BUILD_FSE_TABLE_WKSP_SIZE + sizeof(U32) - 1) / sizeof(U32)) +#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12 typedef struct { ZSTD_seqSymbol LLTable[SEQSYMBOL_TABLE_SIZE(LLFSELog)]; /* Note : Space reserved for FSE Tables */ ZSTD_seqSymbol OFTable[SEQSYMBOL_TABLE_SIZE(OffFSELog)]; /* is also used as temporary workspace while building hufTable during DDict creation */ ZSTD_seqSymbol MLTable[SEQSYMBOL_TABLE_SIZE(MLFSELog)]; /* and therefore must be at least HUF_DECOMPRESS_WORKSPACE_SIZE large */ - HUF_DTable hufTable[HUF_DTABLE_SIZE(HufLog)]; /* can accommodate HUF_decompress4X */ + HUF_DTable hufTable[HUF_DTABLE_SIZE(ZSTD_HUFFDTABLE_CAPACITY_LOG)]; /* can accommodate HUF_decompress4X */ U32 rep[ZSTD_REP_NUM]; U32 workspace[ZSTD_BUILD_FSE_TABLE_WKSP_SIZE_U32]; } ZSTD_entropyDTables_t; @@ -106,6 +107,22 @@ typedef struct { size_t ddictPtrCount; } ZSTD_DDictHashSet; +#ifndef ZSTD_DECODER_INTERNAL_BUFFER +# define ZSTD_DECODER_INTERNAL_BUFFER (1 << 16) +#endif + +#define ZSTD_LBMIN 64 +#define ZSTD_LBMAX (128 << 10) + +/* extra buffer, compensates when dst is not large enough to store litBuffer */ +#define ZSTD_LITBUFFEREXTRASIZE BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX) + +typedef enum { + ZSTD_not_in_dst = 0, /* Stored entirely within litExtraBuffer */ + ZSTD_in_dst = 1, /* Stored entirely within dst (in memory after current output write) */ + ZSTD_split = 2 /* Split between litExtraBuffer and dst */ +} ZSTD_litLocation_e; + struct ZSTD_DCtx_s { const ZSTD_seqSymbol* LLTptr; @@ -136,7 +153,9 @@ struct ZSTD_DCtx_s size_t litSize; size_t rleSize; size_t staticSize; +#if DYNAMIC_BMI2 != 0 int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */ +#endif /* dictionary */ ZSTD_DDict* ddictLocal; @@ -146,6 +165,7 @@ struct ZSTD_DCtx_s ZSTD_dictUses_e dictUses; ZSTD_DDictHashSet* ddictSet; /* Hash set for multiple ddicts */ ZSTD_refMultipleDDicts_e refMultipleDDicts; /* User specified: if == 1, will allow references to multiple DDicts. Default == 0 (disabled) */ + int disableHufAsm; /* streaming */ ZSTD_dStreamStage streamStage; @@ -158,16 +178,21 @@ struct ZSTD_DCtx_s size_t outStart; size_t outEnd; size_t lhSize; +#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) void* legacyContext; U32 previousLegacyVersion; U32 legacyVersion; +#endif U32 hostageByte; int noForwardProgress; ZSTD_bufferMode_e outBufferMode; ZSTD_outBuffer expectedOutBuffer; /* workspace */ - BYTE litBuffer[ZSTD_BLOCKSIZE_MAX + WILDCOPY_OVERLENGTH]; + BYTE* litBuffer; + const BYTE* litBufferEnd; + ZSTD_litLocation_e litBufferLocation; + BYTE litExtraBuffer[ZSTD_LITBUFFEREXTRASIZE + WILDCOPY_OVERLENGTH]; /* literal buffer can be split between storage within dst and within this scratch buffer */ BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX]; size_t oversizedDuration; @@ -183,6 +208,14 @@ struct ZSTD_DCtx_s #endif }; /* typedef'd to ZSTD_DCtx within "zstd.h" */ +MEM_STATIC int ZSTD_DCtx_get_bmi2(const struct ZSTD_DCtx_s *dctx) { +#if DYNAMIC_BMI2 != 0 + return dctx->bmi2; +#else + (void)dctx; + return 0; +#endif +} /*-******************************************************* * Shared internal functions diff --git a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff.h b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff.h similarity index 99% rename from src/dependencies/zstd-1.5.0/lib/deprecated/zbuff.h rename to src/dependencies/zstd-1.5.4/lib/deprecated/zbuff.h index b83ea0f..a968245 100644 --- a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff.h +++ b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_common.c b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_common.c similarity index 94% rename from src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_common.c rename to src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_common.c index e7d01a0..5a2f2db 100644 --- a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_common.c +++ b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_compress.c b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_compress.c similarity index 75% rename from src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_compress.c rename to src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_compress.c index 2e72267..1d86821 100644 --- a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_compress.c +++ b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -15,6 +15,7 @@ ***************************************/ #define ZBUFF_STATIC_LINKING_ONLY #include "zbuff.h" +#include "../common/error_private.h" /*-*********************************************************** @@ -73,13 +74,32 @@ size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc, ZSTD_parameters params, unsigned long long pledgedSrcSize) { if (pledgedSrcSize==0) pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN; /* preserve "0 == unknown" behavior */ - return ZSTD_initCStream_advanced(zbc, dict, dictSize, params, pledgedSrcSize); -} + FORWARD_IF_ERROR(ZSTD_CCtx_reset(zbc, ZSTD_reset_session_only), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setPledgedSrcSize(zbc, pledgedSrcSize), ""); + FORWARD_IF_ERROR(ZSTD_checkCParams(params.cParams), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_windowLog, params.cParams.windowLog), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_hashLog, params.cParams.hashLog), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_chainLog, params.cParams.chainLog), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_searchLog, params.cParams.searchLog), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_minMatch, params.cParams.minMatch), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_targetLength, params.cParams.targetLength), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_strategy, params.cParams.strategy), ""); + + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_contentSizeFlag, params.fParams.contentSizeFlag), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_checksumFlag, params.fParams.checksumFlag), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_dictIDFlag, params.fParams.noDictIDFlag), ""); + + FORWARD_IF_ERROR(ZSTD_CCtx_loadDictionary(zbc, dict, dictSize), ""); + return 0; +} size_t ZBUFF_compressInitDictionary(ZBUFF_CCtx* zbc, const void* dict, size_t dictSize, int compressionLevel) { - return ZSTD_initCStream_usingDict(zbc, dict, dictSize, compressionLevel); + FORWARD_IF_ERROR(ZSTD_CCtx_reset(zbc, ZSTD_reset_session_only), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_setParameter(zbc, ZSTD_c_compressionLevel, compressionLevel), ""); + FORWARD_IF_ERROR(ZSTD_CCtx_loadDictionary(zbc, dict, dictSize), ""); + return 0; } size_t ZBUFF_compressInit(ZBUFF_CCtx* zbc, int compressionLevel) diff --git a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_decompress.c b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_decompress.c similarity index 89% rename from src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_decompress.c rename to src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_decompress.c index d73c0f3..12a66af 100644 --- a/src/dependencies/zstd-1.5.0/lib/deprecated/zbuff_decompress.c +++ b/src/dependencies/zstd-1.5.4/lib/deprecated/zbuff_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -13,6 +13,8 @@ /* ************************************* * Dependencies ***************************************/ +#define ZSTD_DISABLE_DEPRECATE_WARNINGS /* suppress warning on ZSTD_initDStream_usingDict */ +#include "../zstd.h" /* ZSTD_CStream, ZSTD_DStream, ZSTDLIB_API */ #define ZBUFF_STATIC_LINKING_ONLY #include "zbuff.h" diff --git a/src/dependencies/zstd-1.5.0/lib/dictBuilder/cover.c b/src/dependencies/zstd-1.5.4/lib/dictBuilder/cover.c similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/dictBuilder/cover.c rename to src/dependencies/zstd-1.5.4/lib/dictBuilder/cover.c index 8364444..9e5e7d5 100644 --- a/src/dependencies/zstd-1.5.0/lib/dictBuilder/cover.c +++ b/src/dependencies/zstd-1.5.4/lib/dictBuilder/cover.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -34,12 +34,20 @@ #include "../common/pool.h" #include "../common/threading.h" #include "../common/zstd_internal.h" /* includes zstd.h */ +#include "../common/bits.h" /* ZSTD_highbit32 */ #include "../zdict.h" #include "cover.h" /*-************************************* * Constants ***************************************/ +/** +* There are 32bit indexes used to ref samples, so limit samples size to 4GB +* on 64bit builds. +* For 32bit builds we choose 1 GB. +* Most 32bit platforms have 2GB user-mode addressable space and we allocate a large +* contiguous buffer, so 1GB is already a high limit. +*/ #define COVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB)) #define COVER_DEFAULT_SPLITPOINT 1.0 @@ -47,7 +55,7 @@ * Console display ***************************************/ #ifndef LOCALDISPLAYLEVEL -static int g_displayLevel = 2; +static int g_displayLevel = 0; #endif #undef DISPLAY #define DISPLAY(...) \ @@ -534,7 +542,7 @@ static void COVER_ctx_destroy(COVER_ctx_t *ctx) { /** * Prepare a context for dictionary building. - * The context is only dependent on the parameter `d` and can used multiple + * The context is only dependent on the parameter `d` and can be used multiple * times. * Returns 0 on success or error code on error. * The context must be destroyed with `COVER_ctx_destroy()`. @@ -639,7 +647,7 @@ static size_t COVER_ctx_init(COVER_ctx_t *ctx, const void *samplesBuffer, void COVER_warnOnSmallCorpus(size_t maxDictSize, size_t nbDmers, int displayLevel) { - const double ratio = (double)nbDmers / maxDictSize; + const double ratio = (double)nbDmers / (double)maxDictSize; if (ratio >= 10) { return; } @@ -735,7 +743,7 @@ ZDICTLIB_API size_t ZDICT_trainFromBuffer_cover( COVER_map_t activeDmers; parameters.splitPoint = 1.0; /* Initialize global data */ - g_displayLevel = parameters.zParams.notificationLevel; + g_displayLevel = (int)parameters.zParams.notificationLevel; /* Checks */ if (!COVER_checkParameters(parameters, dictBufferCapacity)) { DISPLAYLEVEL(1, "Cover parameters incorrect\n"); @@ -943,9 +951,17 @@ void COVER_best_finish(COVER_best_t *best, ZDICT_cover_params_t parameters, } } +static COVER_dictSelection_t setDictSelection(BYTE* buf, size_t s, size_t csz) +{ + COVER_dictSelection_t ds; + ds.dictContent = buf; + ds.dictSize = s; + ds.totalCompressedSize = csz; + return ds; +} + COVER_dictSelection_t COVER_dictSelectionError(size_t error) { - COVER_dictSelection_t selection = { NULL, 0, error }; - return selection; + return setDictSelection(NULL, 0, error); } unsigned COVER_dictSelectionIsError(COVER_dictSelection_t selection) { @@ -998,9 +1014,8 @@ COVER_dictSelection_t COVER_selectDict(BYTE* customDictContent, size_t dictBuffe } if (params.shrinkDict == 0) { - COVER_dictSelection_t selection = { largestDictbuffer, dictContentSize, totalCompressedSize }; free(candidateDictBuffer); - return selection; + return setDictSelection(largestDictbuffer, dictContentSize, totalCompressedSize); } largestDict = dictContentSize; @@ -1032,20 +1047,16 @@ COVER_dictSelection_t COVER_selectDict(BYTE* customDictContent, size_t dictBuffe return COVER_dictSelectionError(totalCompressedSize); } - if (totalCompressedSize <= largestCompressed * regressionTolerance) { - COVER_dictSelection_t selection = { candidateDictBuffer, dictContentSize, totalCompressedSize }; + if ((double)totalCompressedSize <= (double)largestCompressed * regressionTolerance) { free(largestDictbuffer); - return selection; + return setDictSelection( candidateDictBuffer, dictContentSize, totalCompressedSize ); } dictContentSize *= 2; } dictContentSize = largestDict; totalCompressedSize = largestCompressed; - { - COVER_dictSelection_t selection = { largestDictbuffer, dictContentSize, totalCompressedSize }; - free(candidateDictBuffer); - return selection; - } + free(candidateDictBuffer); + return setDictSelection( largestDictbuffer, dictContentSize, totalCompressedSize ); } /** diff --git a/src/dependencies/zstd-1.5.0/lib/dictBuilder/cover.h b/src/dependencies/zstd-1.5.4/lib/dictBuilder/cover.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/dictBuilder/cover.h rename to src/dependencies/zstd-1.5.4/lib/dictBuilder/cover.h index 1aacddd..252624b 100644 --- a/src/dependencies/zstd-1.5.0/lib/dictBuilder/cover.h +++ b/src/dependencies/zstd-1.5.4/lib/dictBuilder/cover.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/dictBuilder/divsufsort.c b/src/dependencies/zstd-1.5.4/lib/dictBuilder/divsufsort.c similarity index 100% rename from src/dependencies/zstd-1.5.0/lib/dictBuilder/divsufsort.c rename to src/dependencies/zstd-1.5.4/lib/dictBuilder/divsufsort.c diff --git a/src/dependencies/zstd-1.5.0/lib/dictBuilder/divsufsort.h b/src/dependencies/zstd-1.5.4/lib/dictBuilder/divsufsort.h similarity index 100% rename from src/dependencies/zstd-1.5.0/lib/dictBuilder/divsufsort.h rename to src/dependencies/zstd-1.5.4/lib/dictBuilder/divsufsort.h diff --git a/src/dependencies/zstd-1.5.0/lib/dictBuilder/fastcover.c b/src/dependencies/zstd-1.5.4/lib/dictBuilder/fastcover.c similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/dictBuilder/fastcover.c rename to src/dependencies/zstd-1.5.4/lib/dictBuilder/fastcover.c index ed789f9..46bba01 100644 --- a/src/dependencies/zstd-1.5.0/lib/dictBuilder/fastcover.c +++ b/src/dependencies/zstd-1.5.4/lib/dictBuilder/fastcover.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -32,6 +32,13 @@ /*-************************************* * Constants ***************************************/ +/** +* There are 32bit indexes used to ref samples, so limit samples size to 4GB +* on 64bit builds. +* For 32bit builds we choose 1 GB. +* Most 32bit platforms have 2GB user-mode addressable space and we allocate a large +* contiguous buffer, so 1GB is already a high limit. +*/ #define FASTCOVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB)) #define FASTCOVER_MAX_F 31 #define FASTCOVER_MAX_ACCEL 10 @@ -44,7 +51,7 @@ * Console display ***************************************/ #ifndef LOCALDISPLAYLEVEL -static int g_displayLevel = 2; +static int g_displayLevel = 0; #endif #undef DISPLAY #define DISPLAY(...) \ @@ -297,7 +304,7 @@ FASTCOVER_computeFrequency(U32* freqs, const FASTCOVER_ctx_t* ctx) /** * Prepare a context for dictionary building. - * The context is only dependent on the parameter `d` and can used multiple + * The context is only dependent on the parameter `d` and can be used multiple * times. * Returns 0 on success or error code on error. * The context must be destroyed with `FASTCOVER_ctx_destroy()`. @@ -549,7 +556,7 @@ ZDICT_trainFromBuffer_fastCover(void* dictBuffer, size_t dictBufferCapacity, ZDICT_cover_params_t coverParams; FASTCOVER_accel_t accelParams; /* Initialize global data */ - g_displayLevel = parameters.zParams.notificationLevel; + g_displayLevel = (int)parameters.zParams.notificationLevel; /* Assign splitPoint and f if not provided */ parameters.splitPoint = 1.0; parameters.f = parameters.f == 0 ? DEFAULT_F : parameters.f; @@ -632,7 +639,7 @@ ZDICT_optimizeTrainFromBuffer_fastCover( const unsigned accel = parameters->accel == 0 ? DEFAULT_ACCEL : parameters->accel; const unsigned shrinkDict = 0; /* Local variables */ - const int displayLevel = parameters->zParams.notificationLevel; + const int displayLevel = (int)parameters->zParams.notificationLevel; unsigned iteration = 1; unsigned d; unsigned k; @@ -716,7 +723,7 @@ ZDICT_optimizeTrainFromBuffer_fastCover( data->parameters.splitPoint = splitPoint; data->parameters.steps = kSteps; data->parameters.shrinkDict = shrinkDict; - data->parameters.zParams.notificationLevel = g_displayLevel; + data->parameters.zParams.notificationLevel = (unsigned)g_displayLevel; /* Check the parameters */ if (!FASTCOVER_checkParameters(data->parameters, dictBufferCapacity, data->ctx->f, accel)) { diff --git a/src/dependencies/zstd-1.5.0/lib/dictBuilder/zdict.c b/src/dependencies/zstd-1.5.4/lib/dictBuilder/zdict.c similarity index 91% rename from src/dependencies/zstd-1.5.0/lib/dictBuilder/zdict.c rename to src/dependencies/zstd-1.5.4/lib/dictBuilder/zdict.c index 459cbe4..f22e04d 100644 --- a/src/dependencies/zstd-1.5.0/lib/dictBuilder/zdict.c +++ b/src/dependencies/zstd-1.5.4/lib/dictBuilder/zdict.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -44,7 +44,6 @@ #ifndef ZDICT_STATIC_LINKING_ONLY # define ZDICT_STATIC_LINKING_ONLY #endif -#define HUF_STATIC_LINKING_ONLY #include "../common/mem.h" /* read */ #include "../common/fse.h" /* FSE_normalizeCount, FSE_writeNCount */ @@ -54,6 +53,7 @@ #include "../compress/zstd_compress_internal.h" /* ZSTD_loadCEntropy() */ #include "../zdict.h" #include "divsufsort.h" +#include "../common/bits.h" /* ZSTD_NbCommonBytes */ /*-************************************* @@ -130,65 +130,6 @@ size_t ZDICT_getDictHeaderSize(const void* dictBuffer, size_t dictSize) /*-******************************************************** * Dictionary training functions **********************************************************/ -static unsigned ZDICT_NbCommonBytes (size_t val) -{ - if (MEM_isLittleEndian()) { - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) - unsigned long r = 0; - _BitScanForward64( &r, (U64)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_ctzll((U64)val) >> 3); -# else - static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 }; - return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r=0; - _BitScanForward( &r, (U32)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_ctz((U32)val) >> 3); -# else - static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 }; - return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; -# endif - } - } else { /* Big Endian CPU */ - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) - unsigned long r = 0; - _BitScanReverse64( &r, val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_clzll(val) >> 3); -# else - unsigned r; - const unsigned n32 = sizeof(size_t)*4; /* calculate this way due to compiler complaining in 32-bits mode */ - if (!(val>>n32)) { r=4; } else { r=0; val>>=n32; } - if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } - r += (!val); - return r; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r = 0; - _BitScanReverse( &r, (unsigned long)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_clz((U32)val) >> 3); -# else - unsigned r; - if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } - r += (!val); - return r; -# endif - } } -} - - /*! ZDICT_count() : Count the nb of common bytes between 2 pointers. Note : this function presumes end of buffer followed by noisy guard band. @@ -203,7 +144,7 @@ static size_t ZDICT_count(const void* pIn, const void* pMatch) pMatch = (const char*)pMatch+sizeof(size_t); continue; } - pIn = (const char*)pIn+ZDICT_NbCommonBytes(diff); + pIn = (const char*)pIn+ZSTD_NbCommonBytes(diff); return (size_t)((const char*)pIn - pStart); } } @@ -235,7 +176,7 @@ static dictItem ZDICT_analyzePos( U32 savings[LLIMIT] = {0}; const BYTE* b = (const BYTE*)buffer; size_t maxLength = LLIMIT; - size_t pos = suffix[start]; + size_t pos = (size_t)suffix[start]; U32 end = start; dictItem solution; @@ -369,7 +310,7 @@ static dictItem ZDICT_analyzePos( savings[i] = savings[i-1] + (lengthList[i] * (i-3)); DISPLAYLEVEL(4, "Selected dict at position %u, of length %u : saves %u (ratio: %.2f) \n", - (unsigned)pos, (unsigned)maxLength, (unsigned)savings[maxLength], (double)savings[maxLength] / maxLength); + (unsigned)pos, (unsigned)maxLength, (unsigned)savings[maxLength], (double)savings[maxLength] / (double)maxLength); solution.pos = (U32)pos; solution.length = (U32)maxLength; @@ -379,7 +320,7 @@ static dictItem ZDICT_analyzePos( { U32 id; for (id=start; id1) && (table[u-1].savings < elt.savings)) - table[u] = table[u-1], u--; + table[u] = table[u-1], u--; table[u] = elt; return u; } } @@ -442,7 +383,7 @@ static U32 ZDICT_tryMerge(dictItem* table, dictItem elt, U32 eltNbToSkip, const if ((table[u].pos + table[u].length >= elt.pos) && (table[u].pos < elt.pos)) { /* overlap, existing < new */ /* append */ - int const addedLength = (int)eltEnd - (table[u].pos + table[u].length); + int const addedLength = (int)eltEnd - (int)(table[u].pos + table[u].length); table[u].savings += elt.length / 8; /* rough approx bonus */ if (addedLength > 0) { /* otherwise, elt fully included into existing */ table[u].length += addedLength; @@ -582,7 +523,7 @@ static size_t ZDICT_trainBuffer_legacy(dictItem* dictList, U32 dictListSize, if (solution.length==0) { cursor++; continue; } ZDICT_insertDictItem(dictList, dictListSize, solution, buffer); cursor += solution.length; - DISPLAYUPDATE(2, "\r%4.2f %% \r", (double)cursor / bufferSize * 100); + DISPLAYUPDATE(2, "\r%4.2f %% \r", (double)cursor / (double)bufferSize * 100.0); } } _cleanup: @@ -662,8 +603,8 @@ static void ZDICT_countEStats(EStats_ress_t esr, const ZSTD_parameters* params, if (nbSeq >= 2) { /* rep offsets */ const seqDef* const seq = seqStorePtr->sequencesStart; - U32 offset1 = seq[0].offset - 3; - U32 offset2 = seq[1].offset - 3; + U32 offset1 = seq[0].offBase - ZSTD_REP_NUM; + U32 offset2 = seq[1].offBase - ZSTD_REP_NUM; if (offset1 >= MAXREPOFFSET) offset1 = 0; if (offset2 >= MAXREPOFFSET) offset2 = 0; repOffsets[offset1] += 3; @@ -734,6 +675,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize, size_t const totalSrcSize = ZDICT_totalSampleSize(fileSizes, nbFiles); size_t const averageSampleSize = totalSrcSize / (nbFiles + !nbFiles); BYTE* dstPtr = (BYTE*)dstBuffer; + U32 wksp[HUF_CTABLE_WORKSPACE_SIZE_U32]; /* init */ DEBUGLOG(4, "ZDICT_analyzeEntropy"); @@ -766,8 +708,15 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize, pos += fileSizes[u]; } + if (notificationLevel >= 4) { + /* writeStats */ + DISPLAYLEVEL(4, "Offset Code Frequencies : \n"); + for (u=0; u<=offcodeMax; u++) { + DISPLAYLEVEL(4, "%2u :%7u \n", u, offcodeCount[u]); + } } + /* analyze, build stats, starting with literals */ - { size_t maxNbBits = HUF_buildCTable (hufTable, countLit, 255, huffLog); + { size_t maxNbBits = HUF_buildCTable_wksp(hufTable, countLit, 255, huffLog, wksp, sizeof(wksp)); if (HUF_isError(maxNbBits)) { eSize = maxNbBits; DISPLAYLEVEL(1, " HUF_buildCTable error \n"); @@ -776,7 +725,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize, if (maxNbBits==8) { /* not compressible : will fail on HUF_writeCTable() */ DISPLAYLEVEL(2, "warning : pathological dataset : literals are not compressible : samples are noisy or too regular \n"); ZDICT_flatLit(countLit); /* replace distribution by a fake "mostly flat but still compressible" distribution, that HUF_writeCTable() can encode */ - maxNbBits = HUF_buildCTable (hufTable, countLit, 255, huffLog); + maxNbBits = HUF_buildCTable_wksp(hufTable, countLit, 255, huffLog, wksp, sizeof(wksp)); assert(maxNbBits==9); } huffLog = (U32)maxNbBits; @@ -817,7 +766,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize, llLog = (U32)errorCode; /* write result to buffer */ - { size_t const hhSize = HUF_writeCTable(dstPtr, maxDstSize, hufTable, 255, huffLog); + { size_t const hhSize = HUF_writeCTable_wksp(dstPtr, maxDstSize, hufTable, 255, huffLog, wksp, sizeof(wksp)); if (HUF_isError(hhSize)) { eSize = hhSize; DISPLAYLEVEL(1, "HUF_writeCTable error \n"); @@ -872,7 +821,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize, MEM_writeLE32(dstPtr+8, bestRepOffset[2].offset); #else /* at this stage, we don't use the result of "most common first offset", - as the impact of statistics is not properly evaluated */ + * as the impact of statistics is not properly evaluated */ MEM_writeLE32(dstPtr+0, repStartValue[0]); MEM_writeLE32(dstPtr+4, repStartValue[1]); MEM_writeLE32(dstPtr+8, repStartValue[2]); @@ -888,6 +837,17 @@ _cleanup: } +/** + * @returns the maximum repcode value + */ +static U32 ZDICT_maxRep(U32 const reps[ZSTD_REP_NUM]) +{ + U32 maxRep = reps[0]; + int r; + for (r = 1; r < ZSTD_REP_NUM; ++r) + maxRep = MAX(maxRep, reps[r]); + return maxRep; +} size_t ZDICT_finalizeDictionary(void* dictBuffer, size_t dictBufferCapacity, const void* customDictContent, size_t dictContentSize, @@ -899,11 +859,13 @@ size_t ZDICT_finalizeDictionary(void* dictBuffer, size_t dictBufferCapacity, BYTE header[HBUFFSIZE]; int const compressionLevel = (params.compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : params.compressionLevel; U32 const notificationLevel = params.notificationLevel; + /* The final dictionary content must be at least as large as the largest repcode */ + size_t const minContentSize = (size_t)ZDICT_maxRep(repStartValue); + size_t paddingSize; /* check conditions */ DEBUGLOG(4, "ZDICT_finalizeDictionary"); if (dictBufferCapacity < dictContentSize) return ERROR(dstSize_tooSmall); - if (dictContentSize < ZDICT_CONTENTSIZE_MIN) return ERROR(srcSize_wrong); if (dictBufferCapacity < ZDICT_DICTSIZE_MIN) return ERROR(dstSize_tooSmall); /* dictionary header */ @@ -927,12 +889,43 @@ size_t ZDICT_finalizeDictionary(void* dictBuffer, size_t dictBufferCapacity, hSize += eSize; } - /* copy elements in final buffer ; note : src and dst buffer can overlap */ - if (hSize + dictContentSize > dictBufferCapacity) dictContentSize = dictBufferCapacity - hSize; - { size_t const dictSize = hSize + dictContentSize; - char* dictEnd = (char*)dictBuffer + dictSize; - memmove(dictEnd - dictContentSize, customDictContent, dictContentSize); - memcpy(dictBuffer, header, hSize); + /* Shrink the content size if it doesn't fit in the buffer */ + if (hSize + dictContentSize > dictBufferCapacity) { + dictContentSize = dictBufferCapacity - hSize; + } + + /* Pad the dictionary content with zeros if it is too small */ + if (dictContentSize < minContentSize) { + RETURN_ERROR_IF(hSize + minContentSize > dictBufferCapacity, dstSize_tooSmall, + "dictBufferCapacity too small to fit max repcode"); + paddingSize = minContentSize - dictContentSize; + } else { + paddingSize = 0; + } + + { + size_t const dictSize = hSize + paddingSize + dictContentSize; + + /* The dictionary consists of the header, optional padding, and the content. + * The padding comes before the content because the "best" position in the + * dictionary is the last byte. + */ + BYTE* const outDictHeader = (BYTE*)dictBuffer; + BYTE* const outDictPadding = outDictHeader + hSize; + BYTE* const outDictContent = outDictPadding + paddingSize; + + assert(dictSize <= dictBufferCapacity); + assert(outDictContent + dictContentSize == (BYTE*)dictBuffer + dictSize); + + /* First copy the customDictContent into its final location. + * `customDictContent` and `dictBuffer` may overlap, so we must + * do this before any other writes into the output buffer. + * Then copy the header & padding into the output buffer. + */ + memmove(outDictContent, customDictContent, dictContentSize); + memcpy(outDictHeader, header, hSize); + memset(outDictPadding, 0, paddingSize); + return dictSize; } } diff --git a/src/dependencies/zstd-1.5.0/lib/dll/example/Makefile b/src/dependencies/zstd-1.5.4/lib/dll/example/Makefile similarity index 96% rename from src/dependencies/zstd-1.5.0/lib/dll/example/Makefile rename to src/dependencies/zstd-1.5.4/lib/dll/example/Makefile index 03b034d..86cf690 100644 --- a/src/dependencies/zstd-1.5.0/lib/dll/example/Makefile +++ b/src/dependencies/zstd-1.5.4/lib/dll/example/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/dll/example/README.md b/src/dependencies/zstd-1.5.4/lib/dll/example/README.md similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/dll/example/README.md rename to src/dependencies/zstd-1.5.4/lib/dll/example/README.md index 9e30fd5..46aec79 100644 --- a/src/dependencies/zstd-1.5.0/lib/dll/example/README.md +++ b/src/dependencies/zstd-1.5.4/lib/dll/example/README.md @@ -46,7 +46,7 @@ The compiled executable will require ZSTD DLL which is available at `dll\libzstd Open `example\fullbench-dll.sln` to compile `fullbench-dll` that uses a dynamic ZSTD library from the `dll` directory. The solution works with Visual C++ 2010 or newer. When one will open the solution with Visual C++ newer than 2010 -then the solution will upgraded to the current version. +then the solution will be upgraded to the current version. ## Using ZSTD DLL with Visual C++ diff --git a/src/dependencies/zstd-1.5.0/lib/dll/example/build_package.bat b/src/dependencies/zstd-1.5.4/lib/dll/example/build_package.bat similarity index 100% rename from src/dependencies/zstd-1.5.0/lib/dll/example/build_package.bat rename to src/dependencies/zstd-1.5.4/lib/dll/example/build_package.bat diff --git a/src/dependencies/zstd-1.5.0/lib/dll/example/fullbench-dll.sln b/src/dependencies/zstd-1.5.4/lib/dll/example/fullbench-dll.sln similarity index 100% rename from src/dependencies/zstd-1.5.0/lib/dll/example/fullbench-dll.sln rename to src/dependencies/zstd-1.5.4/lib/dll/example/fullbench-dll.sln diff --git a/src/dependencies/zstd-1.5.0/lib/dll/example/fullbench-dll.vcxproj b/src/dependencies/zstd-1.5.4/lib/dll/example/fullbench-dll.vcxproj similarity index 100% rename from src/dependencies/zstd-1.5.0/lib/dll/example/fullbench-dll.vcxproj rename to src/dependencies/zstd-1.5.4/lib/dll/example/fullbench-dll.vcxproj diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_legacy.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_legacy.h similarity index 96% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_legacy.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_legacy.h index a6f1174..dd17325 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_legacy.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_legacy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -242,6 +242,13 @@ MEM_STATIC ZSTD_frameSizeInfo ZSTD_findFrameSizeInfoLegacy(const void *src, size frameSizeInfo.compressedSize = ERROR(srcSize_wrong); frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR; } + /* In all cases, decompressedBound == nbBlocks * ZSTD_BLOCKSIZE_MAX. + * So we can compute nbBlocks without having to change every function. + */ + if (frameSizeInfo.decompressedBound != ZSTD_CONTENTSIZE_ERROR) { + assert((frameSizeInfo.decompressedBound & (ZSTD_BLOCKSIZE_MAX - 1)) == 0); + frameSizeInfo.nbBlocks = (size_t)(frameSizeInfo.decompressedBound / ZSTD_BLOCKSIZE_MAX); + } return frameSizeInfo; } diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v01.c b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v01.c similarity index 95% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v01.c rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v01.c index 7ab5547..1a3aad0 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v01.c +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v01.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -190,28 +190,6 @@ typedef signed long long S64; /**************************************************************** * Memory I/O *****************************************************************/ -/* FSE_FORCE_MEMORY_ACCESS - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets generating assembly depending on alignment. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef FSE_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define FSE_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define FSE_FORCE_MEMORY_ACCESS 1 -# endif -#endif - static unsigned FSE_32bits(void) { @@ -224,24 +202,6 @@ static unsigned FSE_isLittleEndian(void) return one.c[0]; } -#if defined(FSE_FORCE_MEMORY_ACCESS) && (FSE_FORCE_MEMORY_ACCESS==2) - -static U16 FSE_read16(const void* memPtr) { return *(const U16*) memPtr; } -static U32 FSE_read32(const void* memPtr) { return *(const U32*) memPtr; } -static U64 FSE_read64(const void* memPtr) { return *(const U64*) memPtr; } - -#elif defined(FSE_FORCE_MEMORY_ACCESS) && (FSE_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; } __attribute__((packed)) unalign; - -static U16 FSE_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -static U32 FSE_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -static U64 FSE_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -#else - static U16 FSE_read16(const void* memPtr) { U16 val; memcpy(&val, memPtr, sizeof(val)); return val; @@ -257,8 +217,6 @@ static U64 FSE_read64(const void* memPtr) U64 val; memcpy(&val, memPtr, sizeof(val)); return val; } -#endif /* FSE_FORCE_MEMORY_ACCESS */ - static U16 FSE_readLE16(const void* memPtr) { if (FSE_isLittleEndian()) @@ -343,8 +301,7 @@ FORCE_INLINE unsigned FSE_highbit32 (U32 val) { # if defined(_MSC_VER) /* Visual */ unsigned long r; - _BitScanReverse ( &r, val ); - return (unsigned) r; + return _BitScanReverse(&r, val) ? (unsigned)r : 0; # elif defined(__GNUC__) && (GCC_VERSION >= 304) /* GCC Intrinsic */ return __builtin_clz (val) ^ 31; # else /* Software version */ @@ -1194,7 +1151,7 @@ static size_t HUF_decompress (void* dst, size_t maxDstSize, const void* cSrc, si zstd - standard compression library Copyright (C) 2014-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1763,20 +1720,26 @@ static size_t ZSTD_execSequence(BYTE* op, static const int dec32table[] = {0, 1, 2, 1, 4, 4, 4, 4}; /* added */ static const int dec64table[] = {8, 8, 8, 7, 8, 9,10,11}; /* subtracted */ const BYTE* const ostart = op; + BYTE* const oLitEnd = op + sequence.litLength; const size_t litLength = sequence.litLength; BYTE* const endMatch = op + litLength + sequence.matchLength; /* risk : address space overflow (32-bits) */ const BYTE* const litEnd = *litPtr + litLength; - /* check */ + /* checks */ + size_t const seqLength = sequence.litLength + sequence.matchLength; + + if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected); + /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */ + if (sequence.offset > (U32)(oLitEnd - base)) return ERROR(corruption_detected); + if (endMatch > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */ - if (litEnd > litLimit) return ERROR(corruption_detected); - if (sequence.matchLength > (size_t)(*litPtr-op)) return ERROR(dstSize_tooSmall); /* overwrite literal segment */ + if (litEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */ + if (sequence.matchLength > (size_t)(*litPtr-op)) return ERROR(dstSize_tooSmall); /* overwrite literal segment */ /* copy Literals */ - if (((size_t)(*litPtr - op) < 8) || ((size_t)(oend-litEnd) < 8) || (op+litLength > oend-8)) - memmove(op, *litPtr, litLength); /* overwrite risk */ - else - ZSTD_wildcopy(op, *litPtr, litLength); + ZSTD_memmove(op, *litPtr, sequence.litLength); /* note : v0.1 seems to allow scenarios where output or input are close to end of buffer */ + op += litLength; *litPtr = litEnd; /* update for next sequence */ diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v01.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v01.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v01.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v01.h index f777eb6..6ac8769 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v01.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v01.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v02.c b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v02.c similarity index 96% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v02.c rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v02.c index 89fdc71..e09bb4a 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v02.c +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v02.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -28,7 +28,7 @@ low-level memory access routines Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -115,27 +115,6 @@ extern "C" { /**************************************************************** * Memory I/O *****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets generating assembly depending on alignment. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif MEM_STATIC unsigned MEM_32bits(void) { return sizeof(void*)==4; } MEM_STATIC unsigned MEM_64bits(void) { return sizeof(void*)==8; } @@ -146,33 +125,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void) return one.c[0]; } -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; } __attribute__((packed)) unalign; - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - MEM_STATIC U16 MEM_read16(const void* memPtr) { U16 val; memcpy(&val, memPtr, sizeof(val)); return val; @@ -193,9 +145,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value) memcpy(memPtr, &value, sizeof(value)); } -#endif /* MEM_FORCE_MEMORY_ACCESS */ - - MEM_STATIC U16 MEM_readLE16(const void* memPtr) { if (MEM_isLittleEndian()) @@ -272,7 +221,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr) header file (to include) Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -353,9 +302,8 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits); MEM_STATIC unsigned BIT_highbit32 (U32 val) { # if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; + unsigned long r; + return _BitScanReverse(&r, val) ? (unsigned)r : 0; # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ return __builtin_clz (val) ^ 31; # else /* Software version */ @@ -437,7 +385,7 @@ MEM_STATIC size_t BIT_lookBits(BIT_DStream_t* bitD, U32 nbBits) } /*! BIT_lookBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BIT_lookBitsFast(BIT_DStream_t* bitD, U32 nbBits) { const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; @@ -457,7 +405,7 @@ MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, U32 nbBits) } /*!BIT_readBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, U32 nbBits) { size_t value = BIT_lookBitsFast(bitD, nbBits); @@ -514,7 +462,7 @@ MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream) Error codes and messages Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -613,7 +561,7 @@ typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be mor header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -757,7 +705,7 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr) header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -826,7 +774,7 @@ static size_t HUF_decompress4X6 (void* dst, size_t dstSize, const void* cSrc, si Header File Copyright (C) 2014-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -886,7 +834,7 @@ typedef struct ZSTD_CCtx_s ZSTD_CCtx; /* incomplete type */ Header File for static linking only Copyright (C) 2014-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -950,7 +898,7 @@ typedef struct ZSTD_DCtx_s ZSTD_DCtx; FSE : Finite State Entropy coder Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1454,7 +1402,7 @@ static size_t FSE_decompress(void* dst, size_t maxDstSize, const void* cSrc, siz Huff0 : Huffman coder, part of New Generation Entropy library Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2613,7 +2561,7 @@ static size_t HUF_decompress (void* dst, size_t dstSize, const void* cSrc, size_ zstd - standard compression library Copyright (C) 2014-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3118,12 +3066,19 @@ static size_t ZSTD_execSequence(BYTE* op, const BYTE* const litEnd = *litPtr + sequence.litLength; /* checks */ - if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of 8 from oend */ + size_t const seqLength = sequence.litLength + sequence.matchLength; + + if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected); + /* Now we know there are no overflow in literal nor match lengths, can use the pointer check */ + if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); + if (sequence.offset > (U32)(oLitEnd - base)) return ERROR(corruption_detected); + if (oMatchEnd > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */ if (litEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */ /* copy Literals */ - ZSTD_wildcopy(op, *litPtr, sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ + ZSTD_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ op = oLitEnd; *litPtr = litEnd; /* update for next sequence */ diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v02.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v02.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v02.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v02.h index 1b37195..dab0260 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v02.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v02.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v03.c b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v03.c similarity index 96% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v03.c rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v03.c index 5262d51..b0d7f52 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v03.c +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v03.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -29,7 +29,7 @@ low-level memory access routines Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -116,27 +116,6 @@ extern "C" { /**************************************************************** * Memory I/O *****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets generating assembly depending on alignment. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif MEM_STATIC unsigned MEM_32bits(void) { return sizeof(void*)==4; } MEM_STATIC unsigned MEM_64bits(void) { return sizeof(void*)==8; } @@ -147,33 +126,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void) return one.c[0]; } -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; } __attribute__((packed)) unalign; - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - MEM_STATIC U16 MEM_read16(const void* memPtr) { U16 val; memcpy(&val, memPtr, sizeof(val)); return val; @@ -194,10 +146,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value) memcpy(memPtr, &value, sizeof(value)); } - -#endif /* MEM_FORCE_MEMORY_ACCESS */ - - MEM_STATIC U16 MEM_readLE16(const void* memPtr) { if (MEM_isLittleEndian()) @@ -274,7 +222,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr) header file (to include) Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -356,9 +304,8 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits); MEM_STATIC unsigned BIT_highbit32 (U32 val) { # if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; + unsigned long r; + return _BitScanReverse(&r, val) ? (unsigned)r : 0; # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ return __builtin_clz (val) ^ 31; # else /* Software version */ @@ -439,7 +386,7 @@ MEM_STATIC size_t BIT_lookBits(BIT_DStream_t* bitD, U32 nbBits) } /*! BIT_lookBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BIT_lookBitsFast(BIT_DStream_t* bitD, U32 nbBits) { const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; @@ -459,7 +406,7 @@ MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, U32 nbBits) } /*!BIT_readBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, U32 nbBits) { size_t value = BIT_lookBitsFast(bitD, nbBits); @@ -516,7 +463,7 @@ MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream) Error codes and messages Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -615,7 +562,7 @@ typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be mor header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -759,7 +706,7 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr) header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -827,7 +774,7 @@ static size_t HUF_decompress4X4 (void* dst, size_t dstSize, const void* cSrc, si Header File Copyright (C) 2014-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -887,7 +834,7 @@ typedef struct ZSTD_CCtx_s ZSTD_CCtx; /* incomplete type */ Header File for static linking only Copyright (C) 2014-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -951,7 +898,7 @@ typedef struct ZSTD_DCtx_s ZSTD_DCtx; FSE : Finite State Entropy coder Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1455,7 +1402,7 @@ static size_t FSE_decompress(void* dst, size_t maxDstSize, const void* cSrc, siz Huff0 : Huffman coder, part of New Generation Entropy library Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2252,7 +2199,7 @@ static size_t HUF_decompress (void* dst, size_t dstSize, const void* cSrc, size_ zstd - standard compression library Copyright (C) 2014-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2759,18 +2706,24 @@ static size_t ZSTD_execSequence(BYTE* op, const BYTE* const litEnd = *litPtr + sequence.litLength; /* checks */ - if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of 8 from oend */ + size_t const seqLength = sequence.litLength + sequence.matchLength; + + if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected); + /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */ + if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); + if (sequence.offset > (U32)(oLitEnd - base)) return ERROR(corruption_detected); + if (oMatchEnd > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */ if (litEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */ /* copy Literals */ - ZSTD_wildcopy(op, *litPtr, sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ + ZSTD_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ op = oLitEnd; *litPtr = litEnd; /* update for next sequence */ /* copy Match */ - { - const BYTE* match = op - sequence.offset; + { const BYTE* match = op - sequence.offset; /* check */ if (sequence.offset > (size_t)op) return ERROR(corruption_detected); /* address space overflow test (this test seems kept by clang optimizer) */ diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v03.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v03.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v03.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v03.h index 7a00d43..9bf3cce 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v03.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v03.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v04.c b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v04.c similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v04.c rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v04.c index bee1b99..57be832 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v04.c +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v04.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -87,27 +87,6 @@ extern "C" { /**************************************************************** * Memory I/O *****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets generating assembly depending on alignment. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif MEM_STATIC unsigned MEM_32bits(void) { return sizeof(void*)==4; } MEM_STATIC unsigned MEM_64bits(void) { return sizeof(void*)==8; } @@ -118,33 +97,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void) return one.c[0]; } -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; } __attribute__((packed)) unalign; - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - MEM_STATIC U16 MEM_read16(const void* memPtr) { U16 val; memcpy(&val, memPtr, sizeof(val)); return val; @@ -165,9 +117,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value) memcpy(memPtr, &value, sizeof(value)); } -#endif /* MEM_FORCE_MEMORY_ACCESS */ - - MEM_STATIC U16 MEM_readLE16(const void* memPtr) { if (MEM_isLittleEndian()) @@ -545,7 +494,7 @@ If there is an error, the function will return an error code, which can be teste header file (to include) Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -627,9 +576,8 @@ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits); MEM_STATIC unsigned BIT_highbit32 (U32 val) { # if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; + unsigned long r; + return _BitScanReverse(&r, val) ? (unsigned)r : 0; # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ return __builtin_clz (val) ^ 31; # else /* Software version */ @@ -704,7 +652,7 @@ MEM_STATIC size_t BIT_lookBits(BIT_DStream_t* bitD, U32 nbBits) } /*! BIT_lookBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BIT_lookBitsFast(BIT_DStream_t* bitD, U32 nbBits) { const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; @@ -724,7 +672,7 @@ MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, U32 nbBits) } /*!BIT_readBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, U32 nbBits) { size_t value = BIT_lookBitsFast(bitD, nbBits); @@ -785,7 +733,7 @@ MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream) header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -934,7 +882,7 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr) FSE : Finite State Entropy coder Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1440,7 +1388,7 @@ static size_t FSE_decompress(void* dst, size_t maxDstSize, const void* cSrc, siz header file Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1518,7 +1466,7 @@ static unsigned HUF_isError(size_t code); /* tells if a return value i header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1605,7 +1553,7 @@ static size_t HUF_decompress4X4_usingDTable(void* dst, size_t maxDstSize, const Huff0 : Huffman coder, part of New Generation Entropy library Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2405,7 +2353,7 @@ static size_t HUF_decompress (void* dst, size_t dstSize, const void* cSrc, size_ zstd - decompression module fo v0.4 legacy format Copyright (C) 2015-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2880,13 +2828,19 @@ static size_t ZSTD_execSequence(BYTE* op, const BYTE* const litEnd = *litPtr + sequence.litLength; const BYTE* match = oLitEnd - sequence.offset; - /* check */ - if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of 8 from oend */ + /* checks */ + size_t const seqLength = sequence.litLength + sequence.matchLength; + + if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected); + /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */ + if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); + if (oMatchEnd > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */ - if (litEnd > litLimit) return ERROR(corruption_detected); /* risk read beyond lit buffer */ + if (litEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */ /* copy Literals */ - ZSTD_wildcopy(op, *litPtr, sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ + ZSTD_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ op = oLitEnd; *litPtr = litEnd; /* update for next sequence */ @@ -3287,7 +3241,7 @@ static void ZSTD_decompress_insertDictionary(ZSTD_DCtx* ctx, const void* dict, s Buffered version of Zstd compression library Copyright (C) 2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v04.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v04.h similarity index 98% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v04.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v04.h index 66b97ab..640240d 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v04.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v04.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v05.c b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v05.c similarity index 96% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v05.c rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v05.c index eb8966b..93a1169 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v05.c +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v05.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -19,7 +19,7 @@ low-level memory access routines Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -106,27 +106,6 @@ extern "C" { /*-************************************************************** * Memory I/O *****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets depending on alignment. - * In some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif MEM_STATIC unsigned MEM_32bits(void) { return sizeof(void*)==4; } MEM_STATIC unsigned MEM_64bits(void) { return sizeof(void*)==8; } @@ -137,37 +116,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void) return one.c[0]; } -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard, by lying on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } -MEM_STATIC void MEM_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; } -MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(U64*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; size_t st; } __attribute__((packed)) unalign; - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } -MEM_STATIC void MEM_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = value; } -MEM_STATIC void MEM_write64(void* memPtr, U64 value) { ((unalign*)memPtr)->u64 = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - MEM_STATIC U16 MEM_read16(const void* memPtr) { U16 val; memcpy(&val, memPtr, sizeof(val)); return val; @@ -198,9 +146,6 @@ MEM_STATIC void MEM_write64(void* memPtr, U64 value) memcpy(memPtr, &value, sizeof(value)); } -#endif /* MEM_FORCE_MEMORY_ACCESS */ - - MEM_STATIC U16 MEM_readLE16(const void* memPtr) { if (MEM_isLittleEndian()) @@ -265,7 +210,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr) Header File for static linking only Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -289,7 +234,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr) OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net + - zstd homepage : https://facebook.github.io/zstd */ #ifndef ZSTD_STATIC_H #define ZSTD_STATIC_H @@ -401,7 +346,7 @@ size_t ZSTDv05_decompressBlock(ZSTDv05_DCtx* dctx, void* dst, size_t dstCapacity Header File for include Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -488,7 +433,7 @@ static const size_t ZSTDv05_frameHeaderSize_min = 5; #define FSEv05_ENCODING_DYNAMIC 3 -#define HufLog 12 +#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12 #define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */ #define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */) /* for a non-null block */ @@ -556,7 +501,7 @@ typedef struct { header file Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -675,7 +620,7 @@ size_t FSEv05_decompress_usingDTable(void* dst, size_t dstCapacity, const void* header file (to include) Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -756,9 +701,8 @@ MEM_STATIC size_t BITv05_readBitsFast(BITv05_DStream_t* bitD, unsigned nbBits); MEM_STATIC unsigned BITv05_highbit32 (U32 val) { # if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; + unsigned long r; + return _BitScanReverse(&r, val) ? (unsigned)r : 0; # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ return __builtin_clz (val) ^ 31; # else /* Software version */ @@ -830,7 +774,7 @@ MEM_STATIC size_t BITv05_lookBits(BITv05_DStream_t* bitD, U32 nbBits) } /*! BITv05_lookBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BITv05_lookBitsFast(BITv05_DStream_t* bitD, U32 nbBits) { const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; @@ -850,7 +794,7 @@ MEM_STATIC size_t BITv05_readBits(BITv05_DStream_t* bitD, unsigned nbBits) } /*!BITv05_readBitsFast : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BITv05_readBitsFast(BITv05_DStream_t* bitD, unsigned nbBits) { size_t value = BITv05_lookBitsFast(bitD, nbBits); @@ -905,7 +849,7 @@ MEM_STATIC unsigned BITv05_endOfDStream(const BITv05_DStream_t* DStream) header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1055,7 +999,7 @@ MEM_STATIC unsigned FSEv05_endOfDState(const FSEv05_DState_t* DStatePtr) FSEv05 : Finite State Entropy coder Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1541,7 +1485,7 @@ size_t FSEv05_decompress(void* dst, size_t maxDstSize, const void* cSrc, size_t header file Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1614,7 +1558,7 @@ const char* HUFv05_getErrorName(size_t code); /* provides error code string (u header file, for static linking only Copyright (C) 2013-2016, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1706,7 +1650,7 @@ size_t HUFv05_decompress1X4_usingDTable(void* dst, size_t maxDstSize, const void Huff0 : Huffman coder, part of New Generation Entropy library Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2551,7 +2495,7 @@ size_t HUFv05_decompress (void* dst, size_t dstSize, const void* cSrc, size_t cS zstd - standard compression library Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2649,7 +2593,7 @@ struct ZSTDv05_DCtx_s FSEv05_DTable LLTable[FSEv05_DTABLE_SIZE_U32(LLFSEv05Log)]; FSEv05_DTable OffTable[FSEv05_DTABLE_SIZE_U32(OffFSEv05Log)]; FSEv05_DTable MLTable[FSEv05_DTABLE_SIZE_U32(MLFSEv05Log)]; - unsigned hufTableX4[HUFv05_DTABLE_SIZE(HufLog)]; + unsigned hufTableX4[HUFv05_DTABLE_SIZE(ZSTD_HUFFDTABLE_CAPACITY_LOG)]; const void* previousDstEnd; const void* base; const void* vBase; @@ -2677,7 +2621,7 @@ size_t ZSTDv05_decompressBegin(ZSTDv05_DCtx* dctx) dctx->base = NULL; dctx->vBase = NULL; dctx->dictEnd = NULL; - dctx->hufTableX4[0] = HufLog; + dctx->hufTableX4[0] = ZSTD_HUFFDTABLE_CAPACITY_LOG; dctx->flagStaticTables = 0; return 0; } @@ -3238,13 +3182,19 @@ static size_t ZSTDv05_execSequence(BYTE* op, const BYTE* const litEnd = *litPtr + sequence.litLength; const BYTE* match = oLitEnd - sequence.offset; - /* check */ - if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of 8 from oend */ + /* checks */ + size_t const seqLength = sequence.litLength + sequence.matchLength; + + if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected); + /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */ + if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); + if (oMatchEnd > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */ - if (litEnd > litLimit) return ERROR(corruption_detected); /* risk read beyond lit buffer */ + if (litEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */ /* copy Literals */ - ZSTDv05_wildcopy(op, *litPtr, sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ + ZSTDv05_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ op = oLitEnd; *litPtr = litEnd; /* update for next sequence */ @@ -3750,7 +3700,7 @@ size_t ZSTDv05_decompressBegin_usingDict(ZSTDv05_DCtx* dctx, const void* dict, s Buffered version of Zstd compression library Copyright (C) 2015-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v05.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v05.h similarity index 99% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v05.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v05.h index bd423bf..2dcffc9 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v05.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v05.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v06.c b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v06.c similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v06.c rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v06.c index fcb16d4..175f7cc 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v06.c +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v06.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -23,7 +23,7 @@ low-level memory access routines Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -108,27 +108,6 @@ extern "C" { /*-************************************************************** * Memory I/O *****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets depending on alignment. - * In some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; } MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; } @@ -139,33 +118,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void) return one.c[0]; } -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard, by lying on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; size_t st; } __attribute__((packed)) unalign; - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - MEM_STATIC U16 MEM_read16(const void* memPtr) { U16 val; memcpy(&val, memPtr, sizeof(val)); return val; @@ -186,9 +138,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value) memcpy(memPtr, &value, sizeof(value)); } - -#endif /* MEM_FORCE_MEMORY_ACCESS */ - MEM_STATIC U32 MEM_swap32(U32 in) { #if defined(_MSC_VER) /* Visual Studio */ @@ -284,7 +233,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr) Header File for static linking only Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -308,7 +257,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr) OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net + - zstd homepage : https://facebook.github.io/zstd */ #ifndef ZSTDv06_STATIC_H #define ZSTDv06_STATIC_H @@ -415,7 +364,7 @@ ZSTDLIBv06_API size_t ZSTDv06_decompressBlock(ZSTDv06_DCtx* dctx, void* dst, siz Header File for include Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -482,7 +431,7 @@ typedef enum { bt_compressed, bt_raw, bt_rle, bt_end } blockType_t; #define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */ #define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */) /* for a non-null block */ -#define HufLog 12 +#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12 #define IS_HUF 0 #define IS_PCH 1 @@ -622,7 +571,7 @@ void ZSTDv06_seqToCodes(const seqStore_t* seqStorePtr, size_t const nbSeq); Public Prototypes declaration Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -770,7 +719,7 @@ If there is an error, the function will return an error code, which can be teste header file (to include) Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -860,9 +809,8 @@ MEM_STATIC size_t BITv06_readBitsFast(BITv06_DStream_t* bitD, unsigned nbBits); MEM_STATIC unsigned BITv06_highbit32 ( U32 val) { # if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; + unsigned long r; + return _BitScanReverse(&r, val) ? (unsigned)r : 0; # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ return __builtin_clz (val) ^ 31; # else /* Software version */ @@ -932,7 +880,7 @@ MEM_STATIC size_t BITv06_initDStream(BITv06_DStream_t* bitD, const void* srcBuff } /*! BITv06_lookBitsFast() : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BITv06_lookBitsFast(const BITv06_DStream_t* bitD, U32 nbBits) { U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1; @@ -952,7 +900,7 @@ MEM_STATIC size_t BITv06_readBits(BITv06_DStream_t* bitD, U32 nbBits) } /*! BITv06_readBitsFast() : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BITv06_readBitsFast(BITv06_DStream_t* bitD, U32 nbBits) { size_t const value = BITv06_lookBitsFast(bitD, nbBits); @@ -1006,7 +954,7 @@ MEM_STATIC unsigned BITv06_endOfDStream(const BITv06_DStream_t* DStream) header file for static linking (only) Copyright (C) 2013-2015, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1214,7 +1162,7 @@ MEM_STATIC BYTE FSEv06_decodeSymbolFast(FSEv06_DState_t* DStatePtr, BITv06_DStre Common functions of New Generation Entropy library Copyright (C) 2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1359,7 +1307,7 @@ size_t FSEv06_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned FSE : Finite State Entropy decoder Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1683,7 +1631,7 @@ size_t FSEv06_decompress(void* dst, size_t maxDstSize, const void* cSrc, size_t header file Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1753,7 +1701,7 @@ size_t HUFv06_compressBound(size_t size); /**< maximum compressed size */ header file, for static linking only Copyright (C) 2013-2016, Yann Collet - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1935,7 +1883,7 @@ MEM_STATIC size_t HUFv06_readStats(BYTE* huffWeight, size_t hwSize, U32* rankSta Huffman decoder, part of New Generation Entropy library Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2680,7 +2628,7 @@ size_t HUFv06_decompress (void* dst, size_t dstSize, const void* cSrc, size_t cS Common functions of Zstd compression library Copyright (C) 2015-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2704,7 +2652,7 @@ size_t HUFv06_decompress (void* dst, size_t dstSize, const void* cSrc, size_t cS OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net/ + - zstd homepage : https://facebook.github.io/zstd/ */ @@ -2734,7 +2682,7 @@ const char* ZBUFFv06_getErrorName(size_t errorCode) { return ERR_getErrorName(er zstd - standard compression library Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2758,7 +2706,7 @@ const char* ZBUFFv06_getErrorName(size_t errorCode) { return ERR_getErrorName(er OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net + - zstd homepage : https://facebook.github.io/zstd */ /* *************************************************************** @@ -2810,7 +2758,7 @@ struct ZSTDv06_DCtx_s FSEv06_DTable LLTable[FSEv06_DTABLE_SIZE_U32(LLFSELog)]; FSEv06_DTable OffTable[FSEv06_DTABLE_SIZE_U32(OffFSELog)]; FSEv06_DTable MLTable[FSEv06_DTABLE_SIZE_U32(MLFSELog)]; - unsigned hufTableX4[HUFv06_DTABLE_SIZE(HufLog)]; + unsigned hufTableX4[HUFv06_DTABLE_SIZE(ZSTD_HUFFDTABLE_CAPACITY_LOG)]; const void* previousDstEnd; const void* base; const void* vBase; @@ -2838,7 +2786,7 @@ size_t ZSTDv06_decompressBegin(ZSTDv06_DCtx* dctx) dctx->base = NULL; dctx->vBase = NULL; dctx->dictEnd = NULL; - dctx->hufTableX4[0] = HufLog; + dctx->hufTableX4[0] = ZSTD_HUFFDTABLE_CAPACITY_LOG; dctx->flagRepeatTable = 0; return 0; } @@ -3374,13 +3322,19 @@ static size_t ZSTDv06_execSequence(BYTE* op, const BYTE* const iLitEnd = *litPtr + sequence.litLength; const BYTE* match = oLitEnd - sequence.offset; - /* check */ - if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of 8 from oend */ + /* checks */ + size_t const seqLength = sequence.litLength + sequence.matchLength; + + if (seqLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected); + /* Now we know there are no overflow in literal nor match lengths, can use pointer checks */ + if (oLitEnd > oend_8) return ERROR(dstSize_tooSmall); + if (oMatchEnd > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */ - if (iLitEnd > litLimit) return ERROR(corruption_detected); /* over-read beyond lit buffer */ + if (iLitEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */ /* copy Literals */ - ZSTDv06_wildcopy(op, *litPtr, sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ + ZSTDv06_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength); /* note : oLitEnd <= oend-8 : no risk of overwrite beyond oend */ op = oLitEnd; *litPtr = iLitEnd; /* update for next sequence */ @@ -3893,7 +3847,7 @@ size_t ZSTDv06_decompressBegin_usingDict(ZSTDv06_DCtx* dctx, const void* dict, s Buffered version of Zstd compression library Copyright (C) 2015-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -3917,7 +3871,7 @@ size_t ZSTDv06_decompressBegin_usingDict(ZSTDv06_DCtx* dctx, const void* dict, s OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net/ + - zstd homepage : https://facebook.github.io/zstd/ */ @@ -4039,7 +3993,8 @@ size_t ZBUFFv06_decompressContinue(ZBUFFv06_DCtx* zbd, size_t const toLoad = hSize - zbd->lhSize; /* if hSize!=0, hSize > zbd->lhSize */ if (ZSTDv06_isError(hSize)) return hSize; if (toLoad > (size_t)(iend-ip)) { /* not enough input to load full header */ - memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); + if (ip != NULL) + memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); zbd->lhSize += iend-ip; *dstCapacityPtr = 0; return (hSize - zbd->lhSize) + ZSTDv06_blockHeaderSize; /* remaining header bytes + next block header */ diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v06.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v06.h similarity index 99% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v06.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v06.h index 9e32b76..6338910 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v06.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v06.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v07.c b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v07.c similarity index 97% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v07.c rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v07.c index 0d0e466..15dc3ef 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v07.c +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v07.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -184,7 +184,7 @@ ZSTDLIBv07_API size_t ZSTDv07_insertBlock(ZSTDv07_DCtx* dctx, const void* blockS low-level memory access routines Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -268,27 +268,6 @@ extern "C" { /*-************************************************************** * Memory I/O *****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets depending on alignment. - * In some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; } MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; } @@ -299,33 +278,6 @@ MEM_STATIC unsigned MEM_isLittleEndian(void) return one.c[0]; } -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard, by lying on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; size_t st; } __attribute__((packed)) unalign; - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - MEM_STATIC U16 MEM_read16(const void* memPtr) { U16 val; memcpy(&val, memPtr, sizeof(val)); return val; @@ -346,8 +298,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value) memcpy(memPtr, &value, sizeof(value)); } -#endif /* MEM_FORCE_MEMORY_ACCESS */ - MEM_STATIC U32 MEM_swap32(U32 in) { #if defined(_MSC_VER) /* Visual Studio */ @@ -442,7 +392,7 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr) header file (to include) Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -530,9 +480,8 @@ MEM_STATIC size_t BITv07_readBitsFast(BITv07_DStream_t* bitD, unsigned nbBits); MEM_STATIC unsigned BITv07_highbit32 (U32 val) { # if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; + unsigned long r; + return _BitScanReverse(&r, val) ? (unsigned)r : 0; # elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ return __builtin_clz (val) ^ 31; # else /* Software version */ @@ -600,7 +549,7 @@ MEM_STATIC size_t BITv07_initDStream(BITv07_DStream_t* bitD, const void* srcBuff } /*! BITv07_lookBitsFast() : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BITv07_lookBitsFast(const BITv07_DStream_t* bitD, U32 nbBits) { U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1; @@ -620,7 +569,7 @@ MEM_STATIC size_t BITv07_readBits(BITv07_DStream_t* bitD, U32 nbBits) } /*! BITv07_readBitsFast() : -* unsafe version; only works only if nbBits >= 1 */ +* unsafe version; only works if nbBits >= 1 */ MEM_STATIC size_t BITv07_readBitsFast(BITv07_DStream_t* bitD, U32 nbBits) { size_t const value = BITv07_lookBitsFast(bitD, nbBits); @@ -674,7 +623,7 @@ MEM_STATIC unsigned BITv07_endOfDStream(const BITv07_DStream_t* DStream) Public Prototypes declaration Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -982,7 +931,7 @@ MEM_STATIC BYTE FSEv07_decodeSymbolFast(FSEv07_DState_t* DStatePtr, BITv07_DStre header file Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1155,7 +1104,7 @@ size_t HUFv07_decompress1X4_usingDTable(void* dst, size_t maxDstSize, const void Common functions of New Generation Entropy library Copyright (C) 2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1379,7 +1328,7 @@ size_t HUFv07_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats, FSE : Finite State Entropy decoder Copyright (C) 2013-2015, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -1703,7 +1652,7 @@ size_t FSEv07_decompress(void* dst, size_t maxDstSize, const void* cSrc, size_t Huffman decoder, part of New Generation Entropy library Copyright (C) 2013-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2581,7 +2530,7 @@ size_t HUFv07_decompress1X_DCtx (HUFv07_DTable* dctx, void* dst, size_t dstSize, Common functions of Zstd compression library Copyright (C) 2015-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2605,7 +2554,7 @@ size_t HUFv07_decompress1X_DCtx (HUFv07_DTable* dctx, void* dst, size_t dstSize, OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net/ + - zstd homepage : https://facebook.github.io/zstd/ */ @@ -2651,7 +2600,7 @@ static void ZSTDv07_defaultFreeFunction(void* opaque, void* address) Header File for include Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2721,7 +2670,7 @@ typedef enum { bt_compressed, bt_raw, bt_rle, bt_end } blockType_t; #define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */ #define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */) /* for a non-null block */ -#define HufLog 12 +#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12 typedef enum { lbt_huffman, lbt_repeat, lbt_raw, lbt_rle } litBlockType_t; #define LONGNBSEQ 0x7F00 @@ -2858,7 +2807,7 @@ static const ZSTDv07_customMem defaultCustomMem = { ZSTDv07_defaultAllocFunction zstd - standard compression library Copyright (C) 2014-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -2882,7 +2831,7 @@ static const ZSTDv07_customMem defaultCustomMem = { ZSTDv07_defaultAllocFunction OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net + - zstd homepage : https://facebook.github.io/zstd */ /* *************************************************************** @@ -2935,7 +2884,7 @@ struct ZSTDv07_DCtx_s FSEv07_DTable LLTable[FSEv07_DTABLE_SIZE_U32(LLFSELog)]; FSEv07_DTable OffTable[FSEv07_DTABLE_SIZE_U32(OffFSELog)]; FSEv07_DTable MLTable[FSEv07_DTABLE_SIZE_U32(MLFSELog)]; - HUFv07_DTable hufTable[HUFv07_DTABLE_SIZE(HufLog)]; /* can accommodate HUFv07_decompress4X */ + HUFv07_DTable hufTable[HUFv07_DTABLE_SIZE(ZSTD_HUFFDTABLE_CAPACITY_LOG)]; /* can accommodate HUFv07_decompress4X */ const void* previousDstEnd; const void* base; const void* vBase; @@ -2971,7 +2920,7 @@ size_t ZSTDv07_decompressBegin(ZSTDv07_DCtx* dctx) dctx->base = NULL; dctx->vBase = NULL; dctx->dictEnd = NULL; - dctx->hufTable[0] = (HUFv07_DTable)((HufLog)*0x1000001); + dctx->hufTable[0] = (HUFv07_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001); dctx->litEntropy = dctx->fseEntropy = 0; dctx->dictID = 0; { int i; for (i=0; irep[i] = repStartValue[i]; } @@ -3603,11 +3552,14 @@ size_t ZSTDv07_execSequence(BYTE* op, const BYTE* match = oLitEnd - sequence.offset; /* check */ - if ((oLitEnd>oend_w) | (oMatchEnd>oend)) return ERROR(dstSize_tooSmall); /* last match must start at a minimum distance of WILDCOPY_OVERLENGTH from oend */ - if (iLitEnd > litLimit) return ERROR(corruption_detected); /* over-read beyond lit buffer */ + assert(oend >= op); + if (sequence.litLength + WILDCOPY_OVERLENGTH > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + if (sequenceLength > (size_t)(oend - op)) return ERROR(dstSize_tooSmall); + assert(litLimit >= *litPtr); + if (sequence.litLength > (size_t)(litLimit - *litPtr)) return ERROR(corruption_detected);; /* copy Literals */ - ZSTDv07_wildcopy(op, *litPtr, sequence.litLength); /* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */ + ZSTDv07_wildcopy(op, *litPtr, (ptrdiff_t)sequence.litLength); /* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */ op = oLitEnd; *litPtr = iLitEnd; /* update for next sequence */ @@ -3621,7 +3573,7 @@ size_t ZSTDv07_execSequence(BYTE* op, return sequenceLength; } /* span extDict & currentPrefixSegment */ - { size_t const length1 = dictEnd - match; + { size_t const length1 = (size_t)(dictEnd - match); memmove(oLitEnd, match, length1); op = oLitEnd + length1; sequence.matchLength -= length1; @@ -4257,7 +4209,7 @@ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDDict(ZSTDv07_DCtx* dctx, Buffered version of Zstd compression library Copyright (C) 2015-2016, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -4281,7 +4233,7 @@ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDDict(ZSTDv07_DCtx* dctx, OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You can contact the author at : - - zstd homepage : http://www.zstd.net/ + - zstd homepage : https://facebook.github.io/zstd/ */ @@ -4421,7 +4373,8 @@ size_t ZBUFFv07_decompressContinue(ZBUFFv07_DCtx* zbd, if (hSize != 0) { size_t const toLoad = hSize - zbd->lhSize; /* if hSize!=0, hSize > zbd->lhSize */ if (toLoad > (size_t)(iend-ip)) { /* not enough input to load full header */ - memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); + if (ip != NULL) + memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); zbd->lhSize += iend-ip; *dstCapacityPtr = 0; return (hSize - zbd->lhSize) + ZSTDv07_blockHeaderSize; /* remaining header bytes + next block header */ diff --git a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v07.h b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v07.h similarity index 99% rename from src/dependencies/zstd-1.5.0/lib/legacy/zstd_v07.h rename to src/dependencies/zstd-1.5.4/lib/legacy/zstd_v07.h index bc35cfa..1ff3904 100644 --- a/src/dependencies/zstd-1.5.0/lib/legacy/zstd_v07.h +++ b/src/dependencies/zstd-1.5.4/lib/legacy/zstd_v07.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Yann Collet, Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.4/lib/libzstd.mk b/src/dependencies/zstd-1.5.4/lib/libzstd.mk new file mode 100644 index 0000000..5e11d5d --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/libzstd.mk @@ -0,0 +1,214 @@ +# ################################################################ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# You may select, at your option, one of the above-listed licenses. +# ################################################################ + +################################################################## +# Input Variables +################################################################## + +# Zstd lib directory +LIBZSTD ?= ./ + +# ZSTD_LIB_MINIFY is a helper variable that +# configures a bunch of other variables to space-optimized defaults. +ZSTD_LIB_MINIFY ?= 0 + +# Legacy support +ifneq ($(ZSTD_LIB_MINIFY), 0) + ZSTD_LEGACY_SUPPORT ?= 0 +else + ZSTD_LEGACY_SUPPORT ?= 5 +endif +ZSTD_LEGACY_MULTITHREADED_API ?= 0 + +# Build size optimizations +ifneq ($(ZSTD_LIB_MINIFY), 0) + HUF_FORCE_DECOMPRESS_X1 ?= 1 + HUF_FORCE_DECOMPRESS_X2 ?= 0 + ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1 + ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0 + ZSTD_NO_INLINE ?= 1 + ZSTD_STRIP_ERROR_STRINGS ?= 1 +else + HUF_FORCE_DECOMPRESS_X1 ?= 0 + HUF_FORCE_DECOMPRESS_X2 ?= 0 + ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 0 + ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0 + ZSTD_NO_INLINE ?= 0 + ZSTD_STRIP_ERROR_STRINGS ?= 0 +endif + +# Assembly support +ZSTD_NO_ASM ?= 0 + +################################################################## +# libzstd helpers +################################################################## + +VOID ?= /dev/null + +# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/) +NUM_SYMBOL := \# + +# define silent mode as default (verbose mode with V=1 or VERBOSE=1) +$(V)$(VERBOSE).SILENT: + +# When cross-compiling from linux to windows, +# one might need to specify TARGET_SYSTEM as "Windows." +# Building from Fedora fails without it. +# (but Ubuntu and Debian don't need to set anything) +TARGET_SYSTEM ?= $(OS) + +# Version numbers +LIBVER_SRC := $(LIBZSTD)/zstd.h +LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) +LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) +LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) +LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) +LIBVER := $(shell echo $(LIBVER_SCRIPT)) +CCVER := $(shell $(CC) --version) +ZSTD_VERSION?= $(LIBVER) + +ifneq ($(ZSTD_LIB_MINIFY), 0) + HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0) +ifneq ($(HAVE_CC_OZ), 0) + # Some compilers (clang) support an even more space-optimized setting. + CFLAGS += -Oz +else + CFLAGS += -Os +endif + CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \ + -DDYNAMIC_BMI2=0 -DNDEBUG +else + CFLAGS ?= -O3 +endif + +DEBUGLEVEL ?= 0 +CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL) +ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed + CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting +endif +DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ + -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ + -Wstrict-prototypes -Wundef -Wpointer-arith \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls -Wmissing-prototypes -Wc++-compat +CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) +ASFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) $(CFLAGS) +LDFLAGS += $(MOREFLAGS) +FLAGS = $(CPPFLAGS) $(CFLAGS) $(ASFLAGS) $(LDFLAGS) + +ifndef ALREADY_APPENDED_NOEXECSTACK +export ALREADY_APPENDED_NOEXECSTACK := 1 +ifeq ($(shell echo "int main(int argc, char* argv[]) { (void)argc; (void)argv; return 0; }" | $(CC) $(FLAGS) -z noexecstack -x c -Werror - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1) +LDFLAGS += -z noexecstack +endif +ifeq ($(shell echo | $(CC) $(FLAGS) -Wa,--noexecstack -x assembler -Werror -c - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1) +CFLAGS += -Wa,--noexecstack +# CFLAGS are also added to ASFLAGS +else ifeq ($(shell echo | $(CC) $(FLAGS) -Qunused-arguments -Wa,--noexecstack -x assembler -Werror -c - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1) +# See e.g.: https://github.com/android/ndk/issues/171 +CFLAGS += -Qunused-arguments -Wa,--noexecstack +# CFLAGS are also added to ASFLAGS +endif +endif + +ifeq ($(shell echo "int main(int argc, char* argv[]) { (void)argc; (void)argv; return 0; }" | $(CC) $(FLAGS) -z cet-report=error -x c -Werror - -o $(VOID) 2>$(VOID) && echo 1 || echo 0),1) +LDFLAGS += -z cet-report=error +endif + +HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) +GREP_OPTIONS ?= +ifeq ($(HAVE_COLORNEVER), 1) + GREP_OPTIONS += --color=never +endif +GREP = grep $(GREP_OPTIONS) + +ZSTD_COMMON_FILES := $(sort $(wildcard $(LIBZSTD)/common/*.c)) +ZSTD_COMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/compress/*.c)) +ZSTD_DECOMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*.c)) +ZSTD_DICTBUILDER_FILES := $(sort $(wildcard $(LIBZSTD)/dictBuilder/*.c)) +ZSTD_DEPRECATED_FILES := $(sort $(wildcard $(LIBZSTD)/deprecated/*.c)) +ZSTD_LEGACY_FILES := + +ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*_amd64.S)) + +ifneq ($(ZSTD_NO_ASM), 0) + CPPFLAGS += -DZSTD_DISABLE_ASM +else + # Unconditionally add the ASM files they are disabled by + # macros in the .S file. + ZSTD_DECOMPRESS_FILES += $(ZSTD_DECOMPRESS_AMD64_ASM_FILES) +endif + +ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0) + CFLAGS += -DHUF_FORCE_DECOMPRESS_X1 +endif + +ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0) + CFLAGS += -DHUF_FORCE_DECOMPRESS_X2 +endif + +ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT), 0) + CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT +endif + +ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG), 0) + CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG +endif + +ifneq ($(ZSTD_NO_INLINE), 0) + CFLAGS += -DZSTD_NO_INLINE +endif + +ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0) + CFLAGS += -DZSTD_STRIP_ERROR_STRINGS +endif + +ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0) + CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API +endif + +ifneq ($(ZSTD_LEGACY_SUPPORT), 0) +ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0) + ZSTD_LEGACY_FILES += $(shell ls $(LIBZSTD)/legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]') +endif +endif +CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) + +UNAME := $(shell uname) + +ifndef BUILD_DIR +ifeq ($(UNAME), Darwin) + ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0) + HASH ?= md5 + endif +else ifeq ($(UNAME), FreeBSD) + HASH ?= gmd5sum +else ifeq ($(UNAME), NetBSD) + HASH ?= md5 -n +else ifeq ($(UNAME), OpenBSD) + HASH ?= md5 +endif +HASH ?= md5sum + +HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " ) +HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0) +ifeq ($(HAVE_HASH),0) + $(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags) + BUILD_DIR := obj/generic_noconf +endif +endif # BUILD_DIR + +ZSTD_SUBDIR := $(LIBZSTD)/common $(LIBZSTD)/compress $(LIBZSTD)/decompress $(LIBZSTD)/dictBuilder $(LIBZSTD)/legacy $(LIBZSTD)/deprecated +vpath %.c $(ZSTD_SUBDIR) +vpath %.S $(ZSTD_SUBDIR) diff --git a/src/dependencies/zstd-1.5.0/lib/libzstd.pc.in b/src/dependencies/zstd-1.5.4/lib/libzstd.pc.in similarity index 57% rename from src/dependencies/zstd-1.5.0/lib/libzstd.pc.in rename to src/dependencies/zstd-1.5.4/lib/libzstd.pc.in index 8465c97..d5cc027 100644 --- a/src/dependencies/zstd-1.5.0/lib/libzstd.pc.in +++ b/src/dependencies/zstd-1.5.4/lib/libzstd.pc.in @@ -1,6 +1,6 @@ # ZSTD - standard compression algorithm -# Copyright (C) 2014-2016, Yann Collet, Facebook -# BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) +# Copyright (c) Meta Platforms, Inc. and affiliates. +# BSD 2-Clause License (https://opensource.org/licenses/bsd-license.php) prefix=@PREFIX@ exec_prefix=@EXEC_PREFIX@ @@ -9,7 +9,8 @@ libdir=@LIBDIR@ Name: zstd Description: fast lossless compression algorithm library -URL: http://www.zstd.net/ +URL: https://facebook.github.io/zstd/ Version: @VERSION@ Libs: -L${libdir} -lzstd +Libs.private: @LIBS_PRIVATE@ Cflags: -I${includedir} diff --git a/src/dependencies/zstd-1.5.4/lib/module.modulemap b/src/dependencies/zstd-1.5.4/lib/module.modulemap new file mode 100644 index 0000000..eff98df --- /dev/null +++ b/src/dependencies/zstd-1.5.4/lib/module.modulemap @@ -0,0 +1,35 @@ +module libzstd [extern_c] { + header "zstd.h" + export * + config_macros [exhaustive] \ + /* zstd.h */ \ + ZSTD_STATIC_LINKING_ONLY, \ + ZSTDLIB_VISIBILITY, \ + ZSTDLIB_VISIBLE, \ + ZSTDLIB_HIDDEN, \ + ZSTD_DLL_EXPORT, \ + ZSTDLIB_STATIC_API, \ + ZSTD_DISABLE_DEPRECATE_WARNINGS, \ + ZSTD_CLEVEL_DEFAULT, \ + /* zdict.h */ \ + ZDICT_STATIC_LINKING_ONLY, \ + ZDICTLIB_VISIBLE, \ + ZDICTLIB_HIDDEN, \ + ZDICTLIB_VISIBILITY, \ + ZDICTLIB_STATIC_API, \ + ZDICT_DISABLE_DEPRECATE_WARNINGS, \ + /* zstd_errors.h */ \ + ZSTDERRORLIB_VISIBLE, \ + ZSTDERRORLIB_HIDDEN, \ + ZSTDERRORLIB_VISIBILITY + + module dictbuilder [extern_c] { + header "zdict.h" + export * + } + + module errors [extern_c] { + header "zstd_errors.h" + export * + } +} diff --git a/src/dependencies/zstd-1.5.0/lib/zdict.h b/src/dependencies/zstd-1.5.4/lib/zdict.h similarity index 89% rename from src/dependencies/zstd-1.5.0/lib/zdict.h rename to src/dependencies/zstd-1.5.4/lib/zdict.h index 75b05db..2268f94 100644 --- a/src/dependencies/zstd-1.5.0/lib/zdict.h +++ b/src/dependencies/zstd-1.5.4/lib/zdict.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -8,32 +8,43 @@ * You may select, at your option, one of the above-listed licenses. */ -#ifndef DICTBUILDER_H_001 -#define DICTBUILDER_H_001 - #if defined (__cplusplus) extern "C" { #endif +#ifndef ZSTD_ZDICT_H +#define ZSTD_ZDICT_H /*====== Dependencies ======*/ #include /* size_t */ /* ===== ZDICTLIB_API : control library symbols visibility ===== */ -#ifndef ZDICTLIB_VISIBILITY -# if defined(__GNUC__) && (__GNUC__ >= 4) -# define ZDICTLIB_VISIBILITY __attribute__ ((visibility ("default"))) +#ifndef ZDICTLIB_VISIBLE + /* Backwards compatibility with old macro name */ +# ifdef ZDICTLIB_VISIBILITY +# define ZDICTLIB_VISIBLE ZDICTLIB_VISIBILITY +# elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) +# define ZDICTLIB_VISIBLE __attribute__ ((visibility ("default"))) # else -# define ZDICTLIB_VISIBILITY +# define ZDICTLIB_VISIBLE # endif #endif + +#ifndef ZDICTLIB_HIDDEN +# if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) +# define ZDICTLIB_HIDDEN __attribute__ ((visibility ("hidden"))) +# else +# define ZDICTLIB_HIDDEN +# endif +#endif + #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) -# define ZDICTLIB_API __declspec(dllexport) ZDICTLIB_VISIBILITY +# define ZDICTLIB_API __declspec(dllexport) ZDICTLIB_VISIBLE #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) -# define ZDICTLIB_API __declspec(dllimport) ZDICTLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ +# define ZDICTLIB_API __declspec(dllimport) ZDICTLIB_VISIBLE /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ #else -# define ZDICTLIB_API ZDICTLIB_VISIBILITY +# define ZDICTLIB_API ZDICTLIB_VISIBLE #endif /******************************************************************************* @@ -46,7 +57,7 @@ extern "C" { * * Zstd can use dictionaries to improve compression ratio of small data. * Traditionally small files don't compress well because there is very little - * repetion in a single sample, since it is small. But, if you are compressing + * repetition in a single sample, since it is small. But, if you are compressing * many similar files, like a bunch of JSON records that share the same * structure, you can train a dictionary on ahead of time on some samples of * these files. Then, zstd can use the dictionary to find repetitions that are @@ -110,8 +121,8 @@ extern "C" { * The zstd CLI defaults to a 110KB dictionary. You likely don't need a * dictionary larger than that. But, most use cases can get away with a * smaller dictionary. The advanced dictionary builders can automatically - * shrink the dictionary for you, and select a the smallest size that - * doesn't hurt compression ratio too much. See the `shrinkDict` parameter. + * shrink the dictionary for you, and select the smallest size that doesn't + * hurt compression ratio too much. See the `shrinkDict` parameter. * A smaller dictionary can save memory, and potentially speed up * compression. * @@ -132,7 +143,7 @@ extern "C" { * * # Benchmark levels 1-3 without a dictionary * zstd -b1e3 -r /path/to/my/files - * # Benchmark levels 1-3 with a dictioanry + * # Benchmark levels 1-3 with a dictionary * zstd -b1e3 -r /path/to/my/files -D /path/to/my/dictionary * * When should I retrain a dictionary? @@ -201,9 +212,9 @@ ZDICTLIB_API size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCap const size_t* samplesSizes, unsigned nbSamples); typedef struct { - int compressionLevel; /*< optimize for a specific zstd compression level; 0 means default */ - unsigned notificationLevel; /*< Write log to stderr; 0 = none (default); 1 = errors; 2 = progression; 3 = details; 4 = debug; */ - unsigned dictID; /*< force dictID value; 0 means auto mode (32-bits random value) + int compressionLevel; /**< optimize for a specific zstd compression level; 0 means default */ + unsigned notificationLevel; /**< Write log to stderr; 0 = none (default); 1 = errors; 2 = progression; 3 = details; 4 = debug; */ + unsigned dictID; /**< force dictID value; 0 means auto mode (32-bits random value) * NOTE: The zstd format reserves some dictionary IDs for future use. * You may use them in private settings, but be warned that they * may be used by zstd in a public dictionary registry in the future. @@ -237,7 +248,6 @@ typedef struct { * is presumed that the most profitable content is at the end of the dictionary, * since that is the cheapest to reference. * - * `dictContentSize` must be >= ZDICT_CONTENTSIZE_MIN bytes. * `maxDictSize` must be >= max(dictContentSize, ZSTD_DICTSIZE_MIN). * * @return: size of dictionary stored into `dstDictBuffer` (<= `maxDictSize`), @@ -261,9 +271,21 @@ ZDICTLIB_API size_t ZDICT_getDictHeaderSize(const void* dictBuffer, size_t dictS ZDICTLIB_API unsigned ZDICT_isError(size_t errorCode); ZDICTLIB_API const char* ZDICT_getErrorName(size_t errorCode); +#endif /* ZSTD_ZDICT_H */ +#if defined(ZDICT_STATIC_LINKING_ONLY) && !defined(ZSTD_ZDICT_H_STATIC) +#define ZSTD_ZDICT_H_STATIC -#ifdef ZDICT_STATIC_LINKING_ONLY +/* This can be overridden externally to hide static symbols. */ +#ifndef ZDICTLIB_STATIC_API +# if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) +# define ZDICTLIB_STATIC_API __declspec(dllexport) ZDICTLIB_VISIBLE +# elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) +# define ZDICTLIB_STATIC_API __declspec(dllimport) ZDICTLIB_VISIBLE +# else +# define ZDICTLIB_STATIC_API ZDICTLIB_VISIBLE +# endif +#endif /* ==================================================================================== * The definitions in this section are considered experimental. @@ -272,8 +294,9 @@ ZDICTLIB_API const char* ZDICT_getErrorName(size_t errorCode); * Use them only in association with static linking. * ==================================================================================== */ -#define ZDICT_CONTENTSIZE_MIN 128 #define ZDICT_DICTSIZE_MIN 256 +/* Deprecated: Remove in v1.6.0 */ +#define ZDICT_CONTENTSIZE_MIN 128 /*! ZDICT_cover_params_t: * k and d are the only required parameters. @@ -318,7 +341,7 @@ typedef struct { * In general, it's recommended to provide a few thousands samples, though this can vary a lot. * It's recommended that total size of all samples be about ~x100 times the target size of dictionary. */ -ZDICTLIB_API size_t ZDICT_trainFromBuffer_cover( +ZDICTLIB_STATIC_API size_t ZDICT_trainFromBuffer_cover( void *dictBuffer, size_t dictBufferCapacity, const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, ZDICT_cover_params_t parameters); @@ -340,7 +363,7 @@ ZDICTLIB_API size_t ZDICT_trainFromBuffer_cover( * See ZDICT_trainFromBuffer() for details on failure modes. * Note: ZDICT_optimizeTrainFromBuffer_cover() requires about 8 bytes of memory for each input byte and additionally another 5 bytes of memory for each byte of memory for each thread. */ -ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover( +ZDICTLIB_STATIC_API size_t ZDICT_optimizeTrainFromBuffer_cover( void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, ZDICT_cover_params_t* parameters); @@ -361,7 +384,7 @@ ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover( * In general, it's recommended to provide a few thousands samples, though this can vary a lot. * It's recommended that total size of all samples be about ~x100 times the target size of dictionary. */ -ZDICTLIB_API size_t ZDICT_trainFromBuffer_fastCover(void *dictBuffer, +ZDICTLIB_STATIC_API size_t ZDICT_trainFromBuffer_fastCover(void *dictBuffer, size_t dictBufferCapacity, const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, ZDICT_fastCover_params_t parameters); @@ -384,7 +407,7 @@ ZDICTLIB_API size_t ZDICT_trainFromBuffer_fastCover(void *dictBuffer, * See ZDICT_trainFromBuffer() for details on failure modes. * Note: ZDICT_optimizeTrainFromBuffer_fastCover() requires about 6 * 2^f bytes of memory for each thread. */ -ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_fastCover(void* dictBuffer, +ZDICTLIB_STATIC_API size_t ZDICT_optimizeTrainFromBuffer_fastCover(void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, ZDICT_fastCover_params_t* parameters); @@ -409,7 +432,7 @@ typedef struct { * It's recommended that total size of all samples be about ~x100 times the target size of dictionary. * Note: ZDICT_trainFromBuffer_legacy() will send notifications into stderr if instructed to, using notificationLevel>0. */ -ZDICTLIB_API size_t ZDICT_trainFromBuffer_legacy( +ZDICTLIB_STATIC_API size_t ZDICT_trainFromBuffer_legacy( void* dictBuffer, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, ZDICT_legacy_params_t parameters); @@ -421,32 +444,31 @@ ZDICTLIB_API size_t ZDICT_trainFromBuffer_legacy( or _CRT_SECURE_NO_WARNINGS in Visual. Otherwise, it's also possible to manually define ZDICT_DISABLE_DEPRECATE_WARNINGS */ #ifdef ZDICT_DISABLE_DEPRECATE_WARNINGS -# define ZDICT_DEPRECATED(message) ZDICTLIB_API /* disable deprecation warnings */ +# define ZDICT_DEPRECATED(message) /* disable deprecation warnings */ #else # define ZDICT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) # if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ -# define ZDICT_DEPRECATED(message) [[deprecated(message)]] ZDICTLIB_API +# define ZDICT_DEPRECATED(message) [[deprecated(message)]] # elif defined(__clang__) || (ZDICT_GCC_VERSION >= 405) -# define ZDICT_DEPRECATED(message) ZDICTLIB_API __attribute__((deprecated(message))) +# define ZDICT_DEPRECATED(message) __attribute__((deprecated(message))) # elif (ZDICT_GCC_VERSION >= 301) -# define ZDICT_DEPRECATED(message) ZDICTLIB_API __attribute__((deprecated)) +# define ZDICT_DEPRECATED(message) __attribute__((deprecated)) # elif defined(_MSC_VER) -# define ZDICT_DEPRECATED(message) ZDICTLIB_API __declspec(deprecated(message)) +# define ZDICT_DEPRECATED(message) __declspec(deprecated(message)) # else # pragma message("WARNING: You need to implement ZDICT_DEPRECATED for this compiler") -# define ZDICT_DEPRECATED(message) ZDICTLIB_API +# define ZDICT_DEPRECATED(message) # endif #endif /* ZDICT_DISABLE_DEPRECATE_WARNINGS */ ZDICT_DEPRECATED("use ZDICT_finalizeDictionary() instead") +ZDICTLIB_STATIC_API size_t ZDICT_addEntropyTablesFromBuffer(void* dictBuffer, size_t dictContentSize, size_t dictBufferCapacity, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples); -#endif /* ZDICT_STATIC_LINKING_ONLY */ +#endif /* ZSTD_ZDICT_H_STATIC */ #if defined (__cplusplus) } #endif - -#endif /* DICTBUILDER_H_001 */ diff --git a/src/dependencies/zstd-1.5.0/lib/zstd.h b/src/dependencies/zstd-1.5.4/lib/zstd.h similarity index 77% rename from src/dependencies/zstd-1.5.0/lib/zstd.h rename to src/dependencies/zstd-1.5.4/lib/zstd.h index 4651e6c..95aac07 100644 --- a/src/dependencies/zstd-1.5.0/lib/zstd.h +++ b/src/dependencies/zstd-1.5.4/lib/zstd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -14,27 +14,61 @@ extern "C" { #ifndef ZSTD_H_235446 #define ZSTD_H_235446 -/* ====== Dependency ======*/ +/* ====== Dependencies ======*/ #include /* INT_MAX */ #include /* size_t */ /* ===== ZSTDLIB_API : control library symbols visibility ===== */ -#ifndef ZSTDLIB_VISIBILITY -# if defined(__GNUC__) && (__GNUC__ >= 4) -# define ZSTDLIB_VISIBILITY __attribute__ ((visibility ("default"))) +#ifndef ZSTDLIB_VISIBLE + /* Backwards compatibility with old macro name */ +# ifdef ZSTDLIB_VISIBILITY +# define ZSTDLIB_VISIBLE ZSTDLIB_VISIBILITY +# elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) +# define ZSTDLIB_VISIBLE __attribute__ ((visibility ("default"))) # else -# define ZSTDLIB_VISIBILITY +# define ZSTDLIB_VISIBLE # endif #endif -#if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) -# define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBILITY -#elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) -# define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ -#else -# define ZSTDLIB_API ZSTDLIB_VISIBILITY + +#ifndef ZSTDLIB_HIDDEN +# if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) +# define ZSTDLIB_HIDDEN __attribute__ ((visibility ("hidden"))) +# else +# define ZSTDLIB_HIDDEN +# endif #endif +#if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) +# define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBLE +#elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) +# define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBLE /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ +#else +# define ZSTDLIB_API ZSTDLIB_VISIBLE +#endif + +/* Deprecation warnings : + * Should these warnings be a problem, it is generally possible to disable them, + * typically with -Wno-deprecated-declarations for gcc or _CRT_SECURE_NO_WARNINGS in Visual. + * Otherwise, it's also possible to define ZSTD_DISABLE_DEPRECATE_WARNINGS. + */ +#ifdef ZSTD_DISABLE_DEPRECATE_WARNINGS +# define ZSTD_DEPRECATED(message) /* disable deprecation warnings */ +#else +# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ +# define ZSTD_DEPRECATED(message) [[deprecated(message)]] +# elif (defined(GNUC) && (GNUC > 4 || (GNUC == 4 && GNUC_MINOR >= 5))) || defined(__clang__) +# define ZSTD_DEPRECATED(message) __attribute__((deprecated(message))) +# elif defined(__GNUC__) && (__GNUC__ >= 3) +# define ZSTD_DEPRECATED(message) __attribute__((deprecated)) +# elif defined(_MSC_VER) +# define ZSTD_DEPRECATED(message) __declspec(deprecated(message)) +# else +# pragma message("WARNING: You need to implement ZSTD_DEPRECATED for this compiler") +# define ZSTD_DEPRECATED(message) +# endif +#endif /* ZSTD_DISABLE_DEPRECATE_WARNINGS */ + /******************************************************************************* Introduction @@ -72,7 +106,7 @@ extern "C" { /*------ Version ------*/ #define ZSTD_VERSION_MAJOR 1 #define ZSTD_VERSION_MINOR 5 -#define ZSTD_VERSION_RELEASE 0 +#define ZSTD_VERSION_RELEASE 4 #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) /*! ZSTD_versionNumber() : @@ -163,7 +197,9 @@ ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize(const void *src, size_t * "empty", "unknown" and "error" results to the same return value (0), * while ZSTD_getFrameContentSize() gives them separate return values. * @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise. */ -ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); +ZSTD_DEPRECATED("Replaced by ZSTD_getFrameContentSize") +ZSTDLIB_API +unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); /*! ZSTD_findFrameCompressedSize() : Requires v1.4.0+ * `src` should point to the start of a ZSTD frame or skippable frame. @@ -175,8 +211,30 @@ ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize) /*====== Helper functions ======*/ -#define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */ -ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */ +/* ZSTD_compressBound() : + * maximum compressed size in worst case single-pass scenario. + * When invoking `ZSTD_compress()` or any other one-pass compression function, + * it's recommended to provide @dstCapacity >= ZSTD_compressBound(srcSize) + * as it eliminates one potential failure scenario, + * aka not enough room in dst buffer to write the compressed frame. + * Note : ZSTD_compressBound() itself can fail, if @srcSize > ZSTD_MAX_INPUT_SIZE . + * In which case, ZSTD_compressBound() will return an error code + * which can be tested using ZSTD_isError(). + * + * ZSTD_COMPRESSBOUND() : + * same as ZSTD_compressBound(), but as a macro. + * It can be used to produce constants, which can be useful for static allocation, + * for example to size a static array on stack. + * Will produce constant value 0 if srcSize too large. + */ +#define ZSTD_MAX_INPUT_SIZE ((sizeof(size_t)==8) ? 0xFF00FF00FF00FF00LLU : 0xFF00FF00U) +#define ZSTD_COMPRESSBOUND(srcSize) (((size_t)(srcSize) >= ZSTD_MAX_INPUT_SIZE) ? 0 : (srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */ +ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */ +/* ZSTD_isError() : + * Most ZSTD_* functions returning a size_t value can be tested for error, + * using ZSTD_isError(). + * @return 1 if error, 0 otherwise + */ ZSTDLIB_API unsigned ZSTD_isError(size_t code); /*!< tells if a `size_t` function result is an error code */ ZSTDLIB_API const char* ZSTD_getErrorName(size_t code); /*!< provides readable string from an error code */ ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed, requires v1.4.0+ */ @@ -247,7 +305,7 @@ ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, * * It's possible to reset all parameters to "default" using ZSTD_CCtx_reset(). * - * This API supercedes all other "advanced" API entry points in the experimental section. + * This API supersedes all other "advanced" API entry points in the experimental section. * In the future, we expect to remove from experimental API entry points which are redundant with this API. */ @@ -417,8 +475,11 @@ typedef enum { * ZSTD_c_stableOutBuffer * ZSTD_c_blockDelimiters * ZSTD_c_validateSequences - * ZSTD_c_splitBlocks + * ZSTD_c_useBlockSplitter * ZSTD_c_useRowMatchFinder + * ZSTD_c_prefetchCDictTables + * ZSTD_c_enableSeqProducerFallback + * ZSTD_c_maxBlockSize * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. * note : never ever use experimentalParam? names directly; * also, the enums values themselves are unstable and can still change. @@ -437,7 +498,11 @@ typedef enum { ZSTD_c_experimentalParam12=1009, ZSTD_c_experimentalParam13=1010, ZSTD_c_experimentalParam14=1011, - ZSTD_c_experimentalParam15=1012 + ZSTD_c_experimentalParam15=1012, + ZSTD_c_experimentalParam16=1013, + ZSTD_c_experimentalParam17=1014, + ZSTD_c_experimentalParam18=1015, + ZSTD_c_experimentalParam19=1016 } ZSTD_cParameter; typedef struct { @@ -500,7 +565,7 @@ typedef enum { * They will be used to compress next frame. * Resetting session never fails. * - The parameters : changes all parameters back to "default". - * This removes any reference to any dictionary too. + * This also removes any reference to any dictionary or external sequence producer. * Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing) * otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError()) * - Both : similar to resetting the session, followed by resetting parameters. @@ -550,13 +615,15 @@ typedef enum { * ZSTD_d_stableOutBuffer * ZSTD_d_forceIgnoreChecksum * ZSTD_d_refMultipleDDicts + * ZSTD_d_disableHuffmanAssembly * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. * note : never ever use experimentalParam? names directly */ ZSTD_d_experimentalParam1=1000, ZSTD_d_experimentalParam2=1001, ZSTD_d_experimentalParam3=1002, - ZSTD_d_experimentalParam4=1003 + ZSTD_d_experimentalParam4=1003, + ZSTD_d_experimentalParam5=1004 } ZSTD_dParameter; @@ -735,8 +802,6 @@ ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output * This following is a legacy streaming API, available since v1.0+ . * It can be replaced by ZSTD_CCtx_reset() and ZSTD_compressStream2(). * It is redundant, but remains fully supported. - * Streaming in combination with advanced parameters and dictionary compression - * can only be used through the new API. ******************************************************************************/ /*! @@ -745,6 +810,9 @@ ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any) * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); + * + * Note that ZSTD_initCStream() clears any previously set dictionary. Use the new API + * to compress with a dictionary. */ ZSTDLIB_API size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel); /*! @@ -795,13 +863,31 @@ ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream* zds); /* accept NULL pointer /*===== Streaming decompression functions =====*/ -/* This function is redundant with the advanced API and equivalent to: +/*! ZSTD_initDStream() : + * Initialize/reset DStream state for new decompression operation. + * Call before new decompression operation using same DStream. * + * Note : This function is redundant with the advanced API and equivalent to: * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); * ZSTD_DCtx_refDDict(zds, NULL); */ ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream* zds); +/*! ZSTD_decompressStream() : + * Streaming decompression function. + * Call repetitively to consume full input updating it as necessary. + * Function will update both input and output `pos` fields exposing current state via these fields: + * - `input.pos < input.size`, some input remaining and caller should provide remaining input + * on the next call. + * - `output.pos < output.size`, decoder finished and flushed all remaining buffers. + * - `output.pos == output.size`, potentially uncflushed data present in the internal buffers, + * call ZSTD_decompressStream() again to flush remaining data to output. + * Note : with no additional input, amount of data flushed <= ZSTD_BLOCKSIZE_MAX. + * + * @return : 0 when a frame is completely decoded and fully flushed, + * or an error code, which can be tested using ZSTD_isError(), + * or any other value > 0, which means there is some decoding or flushing to do to complete current frame. + */ ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input); ZSTDLIB_API size_t ZSTD_DStreamInSize(void); /*!< recommended size for input buffer */ @@ -920,7 +1006,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict); * If @return == 0, the dictID could not be decoded. * This could for one of the following reasons : * - The frame does not require a dictionary to be decoded (most common case). - * - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information. + * - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden piece of information. * Note : this use case also happens when using a non-conformant dictionary. * - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`). * - This is not a Zstandard frame. @@ -932,7 +1018,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); * Advanced dictionary and prefix API (Requires v1.4.0+) * * This API allows dictionaries to be used with ZSTD_compress2(), - * ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and + * ZSTD_compressStream2(), and ZSTD_decompressDCtx(). Dictionaries are sticky, and * only reset with the context is reset with ZSTD_reset_parameters or * ZSTD_reset_session_and_parameters. Prefixes are single-use. ******************************************************************************/ @@ -944,8 +1030,9 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary, * meaning "return to no-dictionary mode". - * Note 1 : Dictionary is sticky, it will be used for all future compressed frames. - * To return to "no-dictionary" situation, load a NULL dictionary (or reset parameters). + * Note 1 : Dictionary is sticky, it will be used for all future compressed frames, + * until parameters are reset, a new dictionary is loaded, or the dictionary + * is explicitly invalidated by loading a NULL dictionary. * Note 2 : Loading a dictionary involves building tables. * It's also a CPU consuming operation, with non-negligible impact on latency. * Tables are dependent on compression parameters, and for this reason, @@ -958,7 +1045,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize); /*! ZSTD_CCtx_refCDict() : Requires v1.4.0+ - * Reference a prepared dictionary, to be used for all next compressed frames. + * Reference a prepared dictionary, to be used for all future compressed frames. * Note that compression parameters are enforced from within CDict, * and supersede any compression parameter previously set within CCtx. * The parameters ignored are labelled as "superseded-by-cdict" in the ZSTD_cParameter enum docs. @@ -993,9 +1080,9 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize); /*! ZSTD_DCtx_loadDictionary() : Requires v1.4.0+ - * Create an internal DDict from dict buffer, - * to be used to decompress next frames. - * The dictionary remains valid for all future frames, until explicitly invalidated. + * Create an internal DDict from dict buffer, to be used to decompress all future frames. + * The dictionary remains valid for all future frames, until explicitly invalidated, or + * a new dictionary is loaded. * @result : 0, or an error code (which can be tested with ZSTD_isError()). * Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, * meaning "return to no-dictionary mode". @@ -1019,9 +1106,10 @@ ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, s * The memory for the table is allocated on the first call to refDDict, and can be * freed with ZSTD_freeDCtx(). * + * If called with ZSTD_d_refMultipleDDicts disabled (the default), only one dictionary + * will be managed, and referencing a dictionary effectively "discards" any previous one. + * * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Note 1 : Currently, only one dictionary can be managed. - * Referencing a new dictionary effectively "discards" any previous one. * Special: referencing a NULL DDict means "return to no-dictionary mode". * Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx. */ @@ -1073,27 +1161,16 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); #if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY) #define ZSTD_H_ZSTD_STATIC_LINKING_ONLY -/* Deprecation warnings : - * Should these warnings be a problem, it is generally possible to disable them, - * typically with -Wno-deprecated-declarations for gcc or _CRT_SECURE_NO_WARNINGS in Visual. - * Otherwise, it's also possible to define ZSTD_DISABLE_DEPRECATE_WARNINGS. - */ -#ifdef ZSTD_DISABLE_DEPRECATE_WARNINGS -# define ZSTD_DEPRECATED(message) ZSTDLIB_API /* disable deprecation warnings */ -#else -# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ -# define ZSTD_DEPRECATED(message) [[deprecated(message)]] ZSTDLIB_API -# elif (defined(GNUC) && (GNUC > 4 || (GNUC == 4 && GNUC_MINOR >= 5))) || defined(__clang__) -# define ZSTD_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated(message))) -# elif defined(__GNUC__) && (__GNUC__ >= 3) -# define ZSTD_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated)) -# elif defined(_MSC_VER) -# define ZSTD_DEPRECATED(message) ZSTDLIB_API __declspec(deprecated(message)) +/* This can be overridden externally to hide static symbols. */ +#ifndef ZSTDLIB_STATIC_API +# if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) +# define ZSTDLIB_STATIC_API __declspec(dllexport) ZSTDLIB_VISIBLE +# elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) +# define ZSTDLIB_STATIC_API __declspec(dllimport) ZSTDLIB_VISIBLE # else -# pragma message("WARNING: You need to implement ZSTD_DEPRECATED for this compiler") -# define ZSTD_DEPRECATED(message) ZSTDLIB_API +# define ZSTDLIB_STATIC_API ZSTDLIB_VISIBLE # endif -#endif /* ZSTD_DISABLE_DEPRECATE_WARNINGS */ +#endif /**************************************************************************************** * experimental API (static linking only) @@ -1129,6 +1206,7 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); #define ZSTD_TARGETLENGTH_MIN 0 /* note : comparing this constant to an unsigned results in a tautological test */ #define ZSTD_STRATEGY_MIN ZSTD_fast #define ZSTD_STRATEGY_MAX ZSTD_btultra2 +#define ZSTD_BLOCKSIZE_MAX_MIN (1 << 10) /* The minimum valid max blocksize. Maximum blocksizes smaller than this make compressBound() inaccurate. */ #define ZSTD_OVERLAPLOG_MIN 0 @@ -1157,9 +1235,6 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); #define ZSTD_SRCSIZEHINT_MIN 0 #define ZSTD_SRCSIZEHINT_MAX INT_MAX -/* internal */ -#define ZSTD_HASHLOG3_MAX 17 - /* --- Advanced types --- */ @@ -1302,10 +1377,14 @@ typedef enum { } ZSTD_literalCompressionMode_e; typedef enum { - ZSTD_urm_auto = 0, /* Automatically determine whether or not we use row matchfinder */ - ZSTD_urm_disableRowMatchFinder = 1, /* Never use row matchfinder */ - ZSTD_urm_enableRowMatchFinder = 2 /* Always use row matchfinder when applicable */ -} ZSTD_useRowMatchFinderMode_e; + /* Note: This enum controls features which are conditionally beneficial. Zstd typically will make a final + * decision on whether or not to enable the feature (ZSTD_ps_auto), but setting the switch to ZSTD_ps_enable + * or ZSTD_ps_disable allow for a force enable/disable the feature. + */ + ZSTD_ps_auto = 0, /* Let the library automatically determine whether the feature shall be enabled */ + ZSTD_ps_enable = 1, /* Force-enable the feature */ + ZSTD_ps_disable = 2 /* Do not use the feature */ +} ZSTD_paramSwitch_e; /*************************************** * Frame size functions @@ -1332,7 +1411,7 @@ typedef enum { * note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to * read each contained frame header. This is fast as most of the data is skipped, * however it does mean that all frame data must be present and valid. */ -ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize); +ZSTDLIB_STATIC_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize); /*! ZSTD_decompressBound() : * `src` should point to the start of a series of ZSTD encoded and/or skippable frames @@ -1347,41 +1426,97 @@ ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t * note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by: * upper-bound = # blocks * min(128 KB, Window_Size) */ -ZSTDLIB_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize); +ZSTDLIB_STATIC_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize); /*! ZSTD_frameHeaderSize() : * srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX. * @return : size of the Frame Header, * or an error code (if srcSize is too small) */ -ZSTDLIB_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize); +ZSTDLIB_STATIC_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize); + +/*! ZSTD_decompressionMargin() : + * Zstd supports in-place decompression, where the input and output buffers overlap. + * In this case, the output buffer must be at least (Margin + Output_Size) bytes large, + * and the input buffer must be at the end of the output buffer. + * + * _______________________ Output Buffer ________________________ + * | | + * | ____ Input Buffer ____| + * | | | + * v v v + * |---------------------------------------|-----------|----------| + * ^ ^ ^ + * |___________________ Output_Size ___________________|_ Margin _| + * + * NOTE: See also ZSTD_DECOMPRESSION_MARGIN(). + * NOTE: This applies only to single-pass decompression through ZSTD_decompress() or + * ZSTD_decompressDCtx(). + * NOTE: This function supports multi-frame input. + * + * @param src The compressed frame(s) + * @param srcSize The size of the compressed frame(s) + * @returns The decompression margin or an error that can be checked with ZSTD_isError(). + */ +ZSTDLIB_STATIC_API size_t ZSTD_decompressionMargin(const void* src, size_t srcSize); + +/*! ZSTD_DECOMPRESS_MARGIN() : + * Similar to ZSTD_decompressionMargin(), but instead of computing the margin from + * the compressed frame, compute it from the original size and the blockSizeLog. + * See ZSTD_decompressionMargin() for details. + * + * WARNING: This macro does not support multi-frame input, the input must be a single + * zstd frame. If you need that support use the function, or implement it yourself. + * + * @param originalSize The original uncompressed size of the data. + * @param blockSize The block size == MIN(windowSize, ZSTD_BLOCKSIZE_MAX). + * Unless you explicitly set the windowLog smaller than + * ZSTD_BLOCKSIZELOG_MAX you can just use ZSTD_BLOCKSIZE_MAX. + */ +#define ZSTD_DECOMPRESSION_MARGIN(originalSize, blockSize) ((size_t)( \ + ZSTD_FRAMEHEADERSIZE_MAX /* Frame header */ + \ + 4 /* checksum */ + \ + ((originalSize) == 0 ? 0 : 3 * (((originalSize) + (blockSize) - 1) / blockSize)) /* 3 bytes per block */ + \ + (blockSize) /* One block of margin */ \ + )) typedef enum { ZSTD_sf_noBlockDelimiters = 0, /* Representation of ZSTD_Sequence has no block delimiters, sequences only */ ZSTD_sf_explicitBlockDelimiters = 1 /* Representation of ZSTD_Sequence contains explicit block delimiters */ } ZSTD_sequenceFormat_e; +/*! ZSTD_sequenceBound() : + * `srcSize` : size of the input buffer + * @return : upper-bound for the number of sequences that can be generated + * from a buffer of srcSize bytes + * + * note : returns number of sequences - to get bytes, multiply by sizeof(ZSTD_Sequence). + */ +ZSTDLIB_STATIC_API size_t ZSTD_sequenceBound(size_t srcSize); + /*! ZSTD_generateSequences() : - * Generate sequences using ZSTD_compress2, given a source buffer. + * Generate sequences using ZSTD_compress2(), given a source buffer. * * Each block will end with a dummy sequence * with offset == 0, matchLength == 0, and litLength == length of last literals. * litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0) * simply acts as a block delimiter. * - * zc can be used to insert custom compression params. - * This function invokes ZSTD_compress2 + * @zc can be used to insert custom compression params. + * This function invokes ZSTD_compress2(). * * The output of this function can be fed into ZSTD_compressSequences() with CCtx * setting of ZSTD_c_blockDelimiters as ZSTD_sf_explicitBlockDelimiters * @return : number of sequences generated */ -ZSTDLIB_API size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, - size_t outSeqsSize, const void* src, size_t srcSize); +ZSTDLIB_STATIC_API size_t +ZSTD_generateSequences( ZSTD_CCtx* zc, + ZSTD_Sequence* outSeqs, size_t outSeqsSize, + const void* src, size_t srcSize); /*! ZSTD_mergeBlockDelimiters() : * Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals - * by merging them into into the literals of the next sequence. + * by merging them into the literals of the next sequence. * * As such, the final generated result has no explicit representation of block boundaries, * and the final last literals segment is not represented in the sequences. @@ -1390,10 +1525,12 @@ ZSTDLIB_API size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, * setting of ZSTD_c_blockDelimiters as ZSTD_sf_noBlockDelimiters * @return : number of sequences left after merging */ -ZSTDLIB_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize); +ZSTDLIB_STATIC_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize); /*! ZSTD_compressSequences() : - * Compress an array of ZSTD_Sequence, generated from the original source buffer, into dst. + * Compress an array of ZSTD_Sequence, associated with @src buffer, into dst. + * @src contains the entire input (not just the literals). + * If @srcSize > sum(sequence.length), the remaining bytes are considered all literals * If a dictionary is included, then the cctx should reference the dict. (see: ZSTD_CCtx_refCDict(), ZSTD_CCtx_loadDictionary(), etc.) * The entire source is compressed into a single frame. * @@ -1418,17 +1555,18 @@ ZSTDLIB_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t se * Note: Repcodes are, as of now, always re-calculated within this function, so ZSTD_Sequence::rep is unused. * Note 2: Once we integrate ability to ingest repcodes, the explicit block delims mode must respect those repcodes exactly, * and cannot emit an RLE block that disagrees with the repcode history - * @return : final compressed size or a ZSTD error. + * @return : final compressed size, or a ZSTD error code. */ -ZSTDLIB_API size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size_t dstSize, - const ZSTD_Sequence* inSeqs, size_t inSeqsSize, - const void* src, size_t srcSize); +ZSTDLIB_STATIC_API size_t +ZSTD_compressSequences( ZSTD_CCtx* cctx, void* dst, size_t dstSize, + const ZSTD_Sequence* inSeqs, size_t inSeqsSize, + const void* src, size_t srcSize); /*! ZSTD_writeSkippableFrame() : * Generates a zstd skippable frame containing data given by src, and writes it to dst buffer. * - * Skippable frames begin with a a 4-byte magic number. There are 16 possible choices of magic number, + * Skippable frames begin with a 4-byte magic number. There are 16 possible choices of magic number, * ranging from ZSTD_MAGIC_SKIPPABLE_START to ZSTD_MAGIC_SKIPPABLE_START+15. * As such, the parameter magicVariant controls the exact skippable frame magic number variant used, so * the magic number used will be ZSTD_MAGIC_SKIPPABLE_START + magicVariant. @@ -1438,9 +1576,29 @@ ZSTDLIB_API size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size * * @return : number of bytes written or a ZSTD error. */ -ZSTDLIB_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity, +ZSTDLIB_STATIC_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity, const void* src, size_t srcSize, unsigned magicVariant); +/*! ZSTD_readSkippableFrame() : + * Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer. + * + * The parameter magicVariant will receive the magicVariant that was supplied when the frame was written, + * i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested + * in the magicVariant. + * + * Returns an error if destination buffer is not large enough, or if the frame is not skippable. + * + * @return : number of bytes written or a ZSTD error. + */ +ZSTDLIB_API size_t ZSTD_readSkippableFrame(void* dst, size_t dstCapacity, unsigned* magicVariant, + const void* src, size_t srcSize); + +/*! ZSTD_isSkippableFrame() : + * Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame. + */ +ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size); + + /*************************************** * Memory management @@ -1466,13 +1624,16 @@ ZSTDLIB_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity, * and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter(). * Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits. * - * Note 2 : only single-threaded compression is supported. + * Note : only single-threaded compression is supported. * ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1. + * + * Note 2 : ZSTD_estimateCCtxSize* functions are not compatible with the Block-Level Sequence Producer API at this time. + * Size estimates assume that no external sequence producer is registered. */ -ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel); -ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams); -ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params); -ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params); +ZSTDLIB_STATIC_API size_t ZSTD_estimateDCtxSize(void); /*! ZSTD_estimateCStreamSize() : * ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one. @@ -1486,21 +1647,26 @@ ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void); * or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame(); * Note : if streaming is init with function ZSTD_init?Stream_usingDict(), * an internal ?Dict will be created, which additional size is not estimated here. - * In this case, get total size by adding ZSTD_estimate?DictSize */ -ZSTDLIB_API size_t ZSTD_estimateCStreamSize(int compressionLevel); -ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams); -ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params); -ZSTDLIB_API size_t ZSTD_estimateDStreamSize(size_t windowSize); -ZSTDLIB_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize); + * In this case, get total size by adding ZSTD_estimate?DictSize + * Note 2 : only single-threaded compression is supported. + * ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1. + * Note 3 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time. + * Size estimates assume that no external sequence producer is registered. + */ +ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params); +ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t windowSize); +ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize); /*! ZSTD_estimate?DictSize() : * ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict(). * ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced(). * Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller. */ -ZSTDLIB_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel); -ZSTDLIB_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod); -ZSTDLIB_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod); +ZSTDLIB_STATIC_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod); /*! ZSTD_initStatic*() : * Initialize an object using a pre-allocated fixed-size buffer. @@ -1523,20 +1689,20 @@ ZSTDLIB_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e * Limitation 2 : static cctx currently not compatible with multi-threading. * Limitation 3 : static dctx is incompatible with legacy support. */ -ZSTDLIB_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize); -ZSTDLIB_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */ +ZSTDLIB_STATIC_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize); +ZSTDLIB_STATIC_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */ -ZSTDLIB_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize); -ZSTDLIB_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */ +ZSTDLIB_STATIC_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize); +ZSTDLIB_STATIC_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */ -ZSTDLIB_API const ZSTD_CDict* ZSTD_initStaticCDict( +ZSTDLIB_STATIC_API const ZSTD_CDict* ZSTD_initStaticCDict( void* workspace, size_t workspaceSize, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams); -ZSTDLIB_API const ZSTD_DDict* ZSTD_initStaticDDict( +ZSTDLIB_STATIC_API const ZSTD_DDict* ZSTD_initStaticDDict( void* workspace, size_t workspaceSize, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, @@ -1557,44 +1723,44 @@ __attribute__((__unused__)) #endif ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */ -ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem); +ZSTDLIB_STATIC_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem); +ZSTDLIB_STATIC_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem); +ZSTDLIB_STATIC_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem); +ZSTDLIB_STATIC_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize, +ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams, ZSTD_customMem customMem); -/* ! Thread pool : - * These prototypes make it possible to share a thread pool among multiple compression contexts. - * This can limit resources for applications with multiple threads where each one uses - * a threaded compression mode (via ZSTD_c_nbWorkers parameter). - * ZSTD_createThreadPool creates a new thread pool with a given number of threads. - * Note that the lifetime of such pool must exist while being used. - * ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value - * to use an internal thread pool). - * ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer. +/*! Thread pool : + * These prototypes make it possible to share a thread pool among multiple compression contexts. + * This can limit resources for applications with multiple threads where each one uses + * a threaded compression mode (via ZSTD_c_nbWorkers parameter). + * ZSTD_createThreadPool creates a new thread pool with a given number of threads. + * Note that the lifetime of such pool must exist while being used. + * ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value + * to use an internal thread pool). + * ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer. */ typedef struct POOL_ctx_s ZSTD_threadPool; -ZSTDLIB_API ZSTD_threadPool* ZSTD_createThreadPool(size_t numThreads); -ZSTDLIB_API void ZSTD_freeThreadPool (ZSTD_threadPool* pool); /* accept NULL pointer */ -ZSTDLIB_API size_t ZSTD_CCtx_refThreadPool(ZSTD_CCtx* cctx, ZSTD_threadPool* pool); +ZSTDLIB_STATIC_API ZSTD_threadPool* ZSTD_createThreadPool(size_t numThreads); +ZSTDLIB_STATIC_API void ZSTD_freeThreadPool (ZSTD_threadPool* pool); /* accept NULL pointer */ +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refThreadPool(ZSTD_CCtx* cctx, ZSTD_threadPool* pool); /* * This API is temporary and is expected to change or disappear in the future! */ -ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced2( +ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_advanced2( const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, const ZSTD_CCtx_params* cctxParams, ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced( +ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_advanced( const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, @@ -1611,22 +1777,22 @@ ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced( * As a consequence, `dictBuffer` **must** outlive CDict, * and its content must remain unmodified throughout the lifetime of CDict. * note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */ -ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel); +ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel); /*! ZSTD_getCParams() : * @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize. * `estimatedSrcSize` value is optional, select 0 if not known */ -ZSTDLIB_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); +ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); /*! ZSTD_getParams() : * same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`. * All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0 */ -ZSTDLIB_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); +ZSTDLIB_STATIC_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); /*! ZSTD_checkCParams() : * Ensure param values remain within authorized range. * @return 0 on success, or an error code (can be checked with ZSTD_isError()) */ -ZSTDLIB_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params); +ZSTDLIB_STATIC_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params); /*! ZSTD_adjustCParams() : * optimize params for a given `srcSize` and `dictSize`. @@ -1634,24 +1800,33 @@ ZSTDLIB_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params); * `dictSize` must be `0` when there is no dictionary. * cPar can be invalid : all parameters will be clamped within valid range in the @return struct. * This function never fails (wide contract) */ -ZSTDLIB_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize); +ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize); + +/*! ZSTD_CCtx_setCParams() : + * Set all parameters provided within @cparams into the working @cctx. + * Note : if modifying parameters during compression (MT mode only), + * note that changes to the .windowLog parameter will be ignored. + * @return 0 on success, or an error code (can be checked with ZSTD_isError()) */ +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setCParams(ZSTD_CCtx* cctx, ZSTD_compressionParameters cparams); /*! ZSTD_compress_advanced() : * Note : this function is now DEPRECATED. * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters. * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_compress2") +ZSTDLIB_STATIC_API size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize, - ZSTD_parameters params); + void* dst, size_t dstCapacity, + const void* src, size_t srcSize, + const void* dict,size_t dictSize, + ZSTD_parameters params); /*! ZSTD_compress_usingCDict_advanced() : * Note : this function is now DEPRECATED. * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters. * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_compress2 with ZSTD_CCtx_loadDictionary") +ZSTDLIB_STATIC_API size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize, @@ -1662,18 +1837,18 @@ size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx, /*! ZSTD_CCtx_loadDictionary_byReference() : * Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx. * It saves some memory, but also requires that `dict` outlives its usage within `cctx` */ -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize); +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize); /*! ZSTD_CCtx_loadDictionary_advanced() : * Same as ZSTD_CCtx_loadDictionary(), but gives finer control over * how to load the dictionary (by copy ? by reference ?) * and how to interpret it (automatic ? force raw mode ? full mode only ?) */ -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); /*! ZSTD_CCtx_refPrefix_advanced() : * Same as ZSTD_CCtx_refPrefix(), but gives finer control over * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */ -ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); /* === experimental parameters === */ /* these parameters can be used with ZSTD_setParameter() @@ -1712,9 +1887,15 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre * See the comments on that enum for an explanation of the feature. */ #define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4 -/* Controls how the literals are compressed (default is auto). - * The value must be of type ZSTD_literalCompressionMode_e. - * See ZSTD_literalCompressionMode_e enum definition for details. +/* Controlled with ZSTD_paramSwitch_e enum. + * Default is ZSTD_ps_auto. + * Set to ZSTD_ps_disable to never compress literals. + * Set to ZSTD_ps_enable to always compress literals. (Note: uncompressed literals + * may still be emitted if huffman is not beneficial to use.) + * + * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use + * literals compression based on the compression parameters - specifically, + * negative compression levels do not use literal compression. */ #define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5 @@ -1777,7 +1958,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre * * Note that this means that the CDict tables can no longer be copied into the * CCtx, so the dict attachment mode ZSTD_dictForceCopy will no longer be - * useable. The dictionary can only be attached or reloaded. + * usable. The dictionary can only be attached or reloaded. * * In general, you should expect compression to be faster--sometimes very much * so--and CDict creation to be slightly slower. Eventually, we will probably @@ -1789,13 +1970,16 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre * Experimental parameter. * Default is 0 == disabled. Set to 1 to enable. * - * Tells the compressor that the ZSTD_inBuffer will ALWAYS be the same - * between calls, except for the modifications that zstd makes to pos (the - * caller must not modify pos). This is checked by the compressor, and - * compression will fail if it ever changes. This means the only flush - * mode that makes sense is ZSTD_e_end, so zstd will error if ZSTD_e_end - * is not used. The data in the ZSTD_inBuffer in the range [src, src + pos) - * MUST not be modified during compression or you will get data corruption. + * Tells the compressor that input data presented with ZSTD_inBuffer + * will ALWAYS be the same between calls. + * Technically, the @src pointer must never be changed, + * and the @pos field can only be updated by zstd. + * However, it's possible to increase the @size field, + * allowing scenarios where more data can be appended after compressions starts. + * These conditions are checked by the compressor, + * and compression will fail if they are not respected. + * Also, data in the ZSTD_inBuffer within the range [src, src + pos) + * MUST not be modified during compression or it will result in data corruption. * * When this flag is enabled zstd won't allocate an input window buffer, * because the user guarantees it can reference the ZSTD_inBuffer until @@ -1803,18 +1987,15 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre * large enough to fit a block (see ZSTD_c_stableOutBuffer). This will also * avoid the memcpy() from the input buffer to the input window buffer. * - * NOTE: ZSTD_compressStream2() will error if ZSTD_e_end is not used. - * That means this flag cannot be used with ZSTD_compressStream(). - * * NOTE: So long as the ZSTD_inBuffer always points to valid memory, using * this flag is ALWAYS memory safe, and will never access out-of-bounds - * memory. However, compression WILL fail if you violate the preconditions. + * memory. However, compression WILL fail if conditions are not respected. * - * WARNING: The data in the ZSTD_inBuffer in the range [dst, dst + pos) MUST - * not be modified during compression or you will get data corruption. This - * is because zstd needs to reference data in the ZSTD_inBuffer to find + * WARNING: The data in the ZSTD_inBuffer in the range [src, src + pos) MUST + * not be modified during compression or it will result in data corruption. + * This is because zstd needs to reference data in the ZSTD_inBuffer to find * matches. Normally zstd maintains its own window buffer for this purpose, - * but passing this flag tells zstd to use the user provided buffer. + * but passing this flag tells zstd to rely on user provided buffer instead. */ #define ZSTD_c_stableInBuffer ZSTD_c_experimentalParam9 @@ -1859,30 +2040,33 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre * Without validation, providing a sequence that does not conform to the zstd spec will cause * undefined behavior, and may produce a corrupted block. * - * With validation enabled, a if sequence is invalid (see doc/zstd_compression_format.md for + * With validation enabled, if sequence is invalid (see doc/zstd_compression_format.md for * specifics regarding offset/matchlength requirements) then the function will bail out and * return an error. * */ #define ZSTD_c_validateSequences ZSTD_c_experimentalParam12 -/* ZSTD_c_splitBlocks - * Default is 0 == disabled. Set to 1 to enable block splitting. +/* ZSTD_c_useBlockSplitter + * Controlled with ZSTD_paramSwitch_e enum. + * Default is ZSTD_ps_auto. + * Set to ZSTD_ps_disable to never use block splitter. + * Set to ZSTD_ps_enable to always use block splitter. * - * Will attempt to split blocks in order to improve compression ratio at the cost of speed. + * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use + * block splitting based on the compression parameters. */ -#define ZSTD_c_splitBlocks ZSTD_c_experimentalParam13 +#define ZSTD_c_useBlockSplitter ZSTD_c_experimentalParam13 /* ZSTD_c_useRowMatchFinder - * Default is ZSTD_urm_auto. - * Controlled with ZSTD_useRowMatchFinderMode_e enum. + * Controlled with ZSTD_paramSwitch_e enum. + * Default is ZSTD_ps_auto. + * Set to ZSTD_ps_disable to never use row-based matchfinder. + * Set to ZSTD_ps_enable to force usage of row-based matchfinder. * - * By default, in ZSTD_urm_auto, when finalizing the compression parameters, the library - * will decide at runtime whether to use the row-based matchfinder based on support for SIMD - * instructions as well as the windowLog. - * - * Set to ZSTD_urm_disableRowMatchFinder to never use row-based matchfinder. - * Set to ZSTD_urm_enableRowMatchFinder to force usage of row-based matchfinder. + * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use + * the row-based matchfinder based on support for SIMD instructions and the window log. + * Note that this only pertains to compression strategies: greedy, lazy, and lazy2 */ #define ZSTD_c_useRowMatchFinder ZSTD_c_experimentalParam14 @@ -1906,12 +2090,85 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre */ #define ZSTD_c_deterministicRefPrefix ZSTD_c_experimentalParam15 +/* ZSTD_c_prefetchCDictTables + * Controlled with ZSTD_paramSwitch_e enum. Default is ZSTD_ps_auto. + * + * In some situations, zstd uses CDict tables in-place rather than copying them + * into the working context. (See docs on ZSTD_dictAttachPref_e above for details). + * In such situations, compression speed is seriously impacted when CDict tables are + * "cold" (outside CPU cache). This parameter instructs zstd to prefetch CDict tables + * when they are used in-place. + * + * For sufficiently small inputs, the cost of the prefetch will outweigh the benefit. + * For sufficiently large inputs, zstd will by default memcpy() CDict tables + * into the working context, so there is no need to prefetch. This parameter is + * targeted at a middle range of input sizes, where a prefetch is cheap enough to be + * useful but memcpy() is too expensive. The exact range of input sizes where this + * makes sense is best determined by careful experimentation. + * + * Note: for this parameter, ZSTD_ps_auto is currently equivalent to ZSTD_ps_disable, + * but in the future zstd may conditionally enable this feature via an auto-detection + * heuristic for cold CDicts. + * Use ZSTD_ps_disable to opt out of prefetching under any circumstances. + */ +#define ZSTD_c_prefetchCDictTables ZSTD_c_experimentalParam16 + +/* ZSTD_c_enableSeqProducerFallback + * Allowed values are 0 (disable) and 1 (enable). The default setting is 0. + * + * Controls whether zstd will fall back to an internal sequence producer if an + * external sequence producer is registered and returns an error code. This fallback + * is block-by-block: the internal sequence producer will only be called for blocks + * where the external sequence producer returns an error code. Fallback parsing will + * follow any other cParam settings, such as compression level, the same as in a + * normal (fully-internal) compression operation. + * + * The user is strongly encouraged to read the full Block-Level Sequence Producer API + * documentation (below) before setting this parameter. */ +#define ZSTD_c_enableSeqProducerFallback ZSTD_c_experimentalParam17 + +/* ZSTD_c_maxBlockSize + * Allowed values are between 1KB and ZSTD_BLOCKSIZE_MAX (128KB). + * The default is ZSTD_BLOCKSIZE_MAX, and setting to 0 will set to the default. + * + * This parameter can be used to set an upper bound on the blocksize + * that overrides the default ZSTD_BLOCKSIZE_MAX. It cannot be used to set upper + * bounds greater than ZSTD_BLOCKSIZE_MAX or bounds lower than 1KB (will make + * compressBound() innacurate). Only currently meant to be used for testing. + * + */ +#define ZSTD_c_maxBlockSize ZSTD_c_experimentalParam18 + +/* ZSTD_c_searchForExternalRepcodes + * This parameter affects how zstd parses external sequences, such as sequences + * provided through the compressSequences() API or from an external block-level + * sequence producer. + * + * If set to ZSTD_ps_enable, the library will check for repeated offsets in + * external sequences, even if those repcodes are not explicitly indicated in + * the "rep" field. Note that this is the only way to exploit repcode matches + * while using compressSequences() or an external sequence producer, since zstd + * currently ignores the "rep" field of external sequences. + * + * If set to ZSTD_ps_disable, the library will not exploit repeated offsets in + * external sequences, regardless of whether the "rep" field has been set. This + * reduces sequence compression overhead by about 25% while sacrificing some + * compression ratio. + * + * The default value is ZSTD_ps_auto, for which the library will enable/disable + * based on compression level. + * + * Note: for now, this param only has an effect if ZSTD_c_blockDelimiters is + * set to ZSTD_sf_explicitBlockDelimiters. That may change in the future. + */ +#define ZSTD_c_searchForExternalRepcodes ZSTD_c_experimentalParam19 + /*! ZSTD_CCtx_getParameter() : * Get the requested compression parameter value, selected by enum ZSTD_cParameter, * and store it into int* value. * @return : 0, or an error code (which can be tested with ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value); +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value); /*! ZSTD_CCtx_params : @@ -1931,25 +2188,25 @@ ZSTDLIB_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter * This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams() * for static allocation of CCtx for single-threaded compression. */ -ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void); -ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointer */ +ZSTDLIB_STATIC_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void); +ZSTDLIB_STATIC_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointer */ /*! ZSTD_CCtxParams_reset() : * Reset params to default values. */ -ZSTDLIB_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params); +ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params); /*! ZSTD_CCtxParams_init() : * Initializes the compression parameters of cctxParams according to * compression level. All other parameters are reset to their default values. */ -ZSTDLIB_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel); /*! ZSTD_CCtxParams_init_advanced() : * Initializes the compression and frame parameters of cctxParams according to * params. All other parameters are reset to their default values. */ -ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params); +ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params); /*! ZSTD_CCtxParams_setParameter() : Requires v1.4.0+ * Similar to ZSTD_CCtx_setParameter. @@ -1959,14 +2216,14 @@ ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, Z * @result : a code representing success or failure (which can be tested with * ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value); +ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value); /*! ZSTD_CCtxParams_getParameter() : * Similar to ZSTD_CCtx_getParameter. * Get the requested value of one compression parameter, selected by enum ZSTD_cParameter. * @result : 0, or an error code (which can be tested with ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value); +ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value); /*! ZSTD_CCtx_setParametersUsingCCtxParams() : * Apply a set of ZSTD_CCtx_params to the compression context. @@ -1975,7 +2232,7 @@ ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, * if nbWorkers>=1, new parameters will be picked up at next job, * with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated). */ -ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams( +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setParametersUsingCCtxParams( ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params); /*! ZSTD_compressStream2_simpleArgs() : @@ -1984,7 +2241,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams( * This variant might be helpful for binders from dynamic languages * which have troubles handling structures containing memory pointers. */ -ZSTDLIB_API size_t ZSTD_compressStream2_simpleArgs ( +ZSTDLIB_STATIC_API size_t ZSTD_compressStream2_simpleArgs ( ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, size_t* dstPos, const void* src, size_t srcSize, size_t* srcPos, @@ -2000,33 +2257,33 @@ ZSTDLIB_API size_t ZSTD_compressStream2_simpleArgs ( * Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0. * Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled. * Note 3 : Skippable Frame Identifiers are considered valid. */ -ZSTDLIB_API unsigned ZSTD_isFrame(const void* buffer, size_t size); +ZSTDLIB_STATIC_API unsigned ZSTD_isFrame(const void* buffer, size_t size); /*! ZSTD_createDDict_byReference() : * Create a digested dictionary, ready to start decompression operation without startup delay. * Dictionary content is referenced, and therefore stays in dictBuffer. * It is important that dictBuffer outlives DDict, * it must remain read accessible throughout the lifetime of DDict */ -ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize); +ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize); /*! ZSTD_DCtx_loadDictionary_byReference() : * Same as ZSTD_DCtx_loadDictionary(), * but references `dict` content instead of copying it into `dctx`. * This saves memory if `dict` remains around., * However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression. */ -ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); +ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); /*! ZSTD_DCtx_loadDictionary_advanced() : * Same as ZSTD_DCtx_loadDictionary(), * but gives direct control over * how to load the dictionary (by copy ? by reference ?) * and how to interpret it (automatic ? force raw mode ? full mode only ?). */ -ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); +ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); /*! ZSTD_DCtx_refPrefix_advanced() : * Same as ZSTD_DCtx_refPrefix(), but gives finer control over * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */ -ZSTDLIB_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); +ZSTDLIB_STATIC_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); /*! ZSTD_DCtx_setMaxWindowSize() : * Refuses allocating internal buffers for frames requiring a window size larger than provided limit. @@ -2035,14 +2292,14 @@ ZSTDLIB_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* pre * By default, a decompression context accepts all window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) * @return : 0, or an error code (which can be tested using ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize); +ZSTDLIB_STATIC_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize); /*! ZSTD_DCtx_getParameter() : * Get the requested decompression parameter value, selected by enum ZSTD_dParameter, * and store it into int* value. * @return : 0, or an error code (which can be tested with ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value); +ZSTDLIB_STATIC_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value); /* ZSTD_d_format * experimental parameter, @@ -2062,7 +2319,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param * in the range [dst, dst + pos) MUST not be modified during decompression * or you will get data corruption. * - * When this flags is enabled zstd won't allocate an output buffer, because + * When this flag is enabled zstd won't allocate an output buffer, because * it can write directly to the ZSTD_outBuffer, but it will still allocate * an input buffer large enough to fit any compressed block. This will also * avoid the memcpy() from the internal output buffer to the ZSTD_outBuffer. @@ -2115,6 +2372,17 @@ ZSTDLIB_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param */ #define ZSTD_d_refMultipleDDicts ZSTD_d_experimentalParam4 +/* ZSTD_d_disableHuffmanAssembly + * Set to 1 to disable the Huffman assembly implementation. + * The default value is 0, which allows zstd to use the Huffman assembly + * implementation if available. + * + * This parameter can be used to disable Huffman assembly at runtime. + * If you want to disable it at compile time you can define the macro + * ZSTD_DISABLE_ASM. + */ +#define ZSTD_d_disableHuffmanAssembly ZSTD_d_experimentalParam5 + /*! ZSTD_DCtx_setFormat() : * This function is REDUNDANT. Prefer ZSTD_DCtx_setParameter(). @@ -2123,6 +2391,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param * such ZSTD_f_zstd1_magicless for example. * @return : 0, or an error code (which can be tested using ZSTD_isError()). */ ZSTD_DEPRECATED("use ZSTD_DCtx_setParameter() instead") +ZSTDLIB_STATIC_API size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format); /*! ZSTD_decompressStream_simpleArgs() : @@ -2131,7 +2400,7 @@ size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format); * This can be helpful for binders from dynamic languages * which have troubles handling structures containing memory pointers. */ -ZSTDLIB_API size_t ZSTD_decompressStream_simpleArgs ( +ZSTDLIB_STATIC_API size_t ZSTD_decompressStream_simpleArgs ( ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, size_t* dstPos, const void* src, size_t srcSize, size_t* srcPos); @@ -2159,6 +2428,7 @@ ZSTDLIB_API size_t ZSTD_decompressStream_simpleArgs ( * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, int compressionLevel, unsigned long long pledgedSrcSize); @@ -2176,6 +2446,7 @@ size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel); @@ -2196,6 +2467,7 @@ size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, const void* dict, size_t dictSize, ZSTD_parameters params, @@ -2205,11 +2477,12 @@ size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, * This function is DEPRECATED, and equivalent to: * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); * ZSTD_CCtx_refCDict(zcs, cdict); - * + * * note : cdict will just be referenced, and must outlive compression session * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict); /*! ZSTD_initCStream_usingCDict_advanced() : @@ -2228,6 +2501,7 @@ size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict); * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const ZSTD_CDict* cdict, ZSTD_frameParameters fParams, @@ -2252,6 +2526,7 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, * This prototype will generate compilation warnings. */ ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); @@ -2270,7 +2545,7 @@ typedef struct { * Note : (ingested - consumed) is amount of input data buffered internally, not yet compressed. * Aggregates progression inside active worker threads. */ -ZSTDLIB_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx); +ZSTDLIB_STATIC_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx); /*! ZSTD_toFlushNow() : * Tell how many bytes are ready to be flushed immediately. @@ -2285,7 +2560,7 @@ ZSTDLIB_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx * therefore flush speed is limited by production speed of oldest job * irrespective of the speed of concurrent (and newer) jobs. */ -ZSTDLIB_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx); +ZSTDLIB_STATIC_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx); /*===== Advanced Streaming decompression functions =====*/ @@ -2297,9 +2572,9 @@ ZSTDLIB_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx); * ZSTD_DCtx_loadDictionary(zds, dict, dictSize); * * note: no dictionary will be used if dict == NULL or dictSize < 8 - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ -ZSTDLIB_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); +ZSTD_DEPRECATED("use ZSTD_DCtx_reset + ZSTD_DCtx_loadDictionary, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); /*! * This function is deprecated, and is equivalent to: @@ -2308,9 +2583,9 @@ ZSTDLIB_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dic * ZSTD_DCtx_refDDict(zds, ddict); * * note : ddict is referenced, it must outlive decompression session - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ -ZSTDLIB_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict); +ZSTD_DEPRECATED("use ZSTD_DCtx_reset + ZSTD_DCtx_refDDict, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict); /*! * This function is deprecated, and is equivalent to: @@ -2318,9 +2593,9 @@ ZSTDLIB_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDi * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); * * re-use decompression parameters from previous init; saves dictionary loading - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x */ -ZSTDLIB_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); +ZSTD_DEPRECATED("use ZSTD_DCtx_reset, see zstd.h for detailed instructions") +ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); /********************************************************************* @@ -2340,7 +2615,6 @@ ZSTDLIB_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); Start by initializing a context. Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression. - It's also possible to duplicate a reference context which has already been initialized, using ZSTD_copyCCtx() Then, consume your input using ZSTD_compressContinue(). There are some important considerations to keep in mind when using this advanced function : @@ -2362,18 +2636,23 @@ ZSTDLIB_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); */ /*===== Buffer-less streaming compression functions =====*/ -ZSTDLIB_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel); -ZSTDLIB_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel); -ZSTDLIB_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */ -ZSTDLIB_API size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */ +ZSTDLIB_STATIC_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel); +ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */ -ZSTDLIB_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); -ZSTDLIB_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); +ZSTD_DEPRECATED("This function will likely be removed in a future release. It is misleading and has very limited utility.") +ZSTDLIB_STATIC_API +size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */ + +ZSTDLIB_STATIC_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); +ZSTDLIB_STATIC_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); /* The ZSTD_compressBegin_advanced() and ZSTD_compressBegin_usingCDict_advanced() are now DEPRECATED and will generate a compiler warning */ ZSTD_DEPRECATED("use advanced API to access custom parameters") +ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); /**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */ ZSTD_DEPRECATED("use advanced API to access custom parameters") +ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize); /* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */ /** Buffer-less streaming decompression (synchronous mode) @@ -2386,8 +2665,8 @@ size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_ Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough. Data fragment must be large enough to ensure successful decoding. `ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough. - @result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled. - >0 : `srcSize` is too small, please provide at least @result bytes on next attempt. + result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled. + >0 : `srcSize` is too small, please provide at least result bytes on next attempt. errorCode, which can be tested using ZSTD_isError(). It fills a ZSTD_frameHeader structure with important information to correctly decode the frame, @@ -2406,7 +2685,7 @@ size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_ The most memory efficient way is to use a round buffer of sufficient size. Sufficient size is determined by invoking ZSTD_decodingBufferSize_min(), - which can @return an error code if required value is too large for current system (in 32-bits mode). + which can return an error code if required value is too large for current system (in 32-bits mode). In a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one, up to the moment there is not enough room left in the buffer to guarantee decoding another full block, which maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`. @@ -2426,7 +2705,7 @@ size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_ ZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue(). ZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail. - @result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity). + result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity). It can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item. It can also be an error code, which can be tested with ZSTD_isError(). @@ -2458,6 +2737,8 @@ typedef struct { unsigned headerSize; unsigned dictID; unsigned checksumFlag; + unsigned _reserved1; + unsigned _reserved2; } ZSTD_frameHeader; /*! ZSTD_getFrameHeader() : @@ -2465,24 +2746,25 @@ typedef struct { * @return : 0, `zfhPtr` is correctly filled, * >0, `srcSize` is too small, value is wanted `srcSize` amount, * or an error code, which can be tested using ZSTD_isError() */ -ZSTDLIB_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */ +ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */ /*! ZSTD_getFrameHeader_advanced() : * same as ZSTD_getFrameHeader(), * with added capability to select a format (like ZSTD_f_zstd1_magicless) */ -ZSTDLIB_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format); -ZSTDLIB_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize); /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */ +ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format); +ZSTDLIB_STATIC_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize); /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */ -ZSTDLIB_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx); -ZSTDLIB_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); -ZSTDLIB_API size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); +ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx); +ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); +ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); -ZSTDLIB_API size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx); -ZSTDLIB_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); +ZSTDLIB_STATIC_API size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx); +ZSTDLIB_STATIC_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); /* misc */ -ZSTDLIB_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx); +ZSTD_DEPRECATED("This function will likely be removed in the next minor release. It is misleading and has very limited utility.") +ZSTDLIB_STATIC_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx); typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e; -ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); +ZSTDLIB_STATIC_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); @@ -2502,7 +2784,6 @@ ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); - It is necessary to init context before starting + compression : any ZSTD_compressBegin*() variant, including with dictionary + decompression : any ZSTD_decompressBegin*() variant, including with dictionary - + copyCCtx() and copyDCtx() can be used too - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB + If input is larger than a block size, it's necessary to split input data into multiple blocks + For inputs larger than a single block, consider using regular ZSTD_compress() instead. @@ -2519,12 +2800,173 @@ ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); */ /*===== Raw zstd block functions =====*/ -ZSTDLIB_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx); -ZSTDLIB_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); -ZSTDLIB_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); -ZSTDLIB_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */ +ZSTDLIB_STATIC_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx); +ZSTDLIB_STATIC_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); +ZSTDLIB_STATIC_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); +ZSTDLIB_STATIC_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */ +/* ********************* BLOCK-LEVEL SEQUENCE PRODUCER API ********************* + * + * *** OVERVIEW *** + * The Block-Level Sequence Producer API allows users to provide their own custom + * sequence producer which libzstd invokes to process each block. The produced list + * of sequences (literals and matches) is then post-processed by libzstd to produce + * valid compressed blocks. + * + * This block-level offload API is a more granular complement of the existing + * frame-level offload API compressSequences() (introduced in v1.5.1). It offers + * an easier migration story for applications already integrated with libzstd: the + * user application continues to invoke the same compression functions + * ZSTD_compress2() or ZSTD_compressStream2() as usual, and transparently benefits + * from the specific advantages of the external sequence producer. For example, + * the sequence producer could be tuned to take advantage of known characteristics + * of the input, to offer better speed / ratio, or could leverage hardware + * acceleration not available within libzstd itself. + * + * See contrib/externalSequenceProducer for an example program employing the + * Block-Level Sequence Producer API. + * + * *** USAGE *** + * The user is responsible for implementing a function of type + * ZSTD_sequenceProducer_F. For each block, zstd will pass the following + * arguments to the user-provided function: + * + * - sequenceProducerState: a pointer to a user-managed state for the sequence + * producer. + * + * - outSeqs, outSeqsCapacity: an output buffer for the sequence producer. + * outSeqsCapacity is guaranteed >= ZSTD_sequenceBound(srcSize). The memory + * backing outSeqs is managed by the CCtx. + * + * - src, srcSize: an input buffer for the sequence producer to parse. + * srcSize is guaranteed to be <= ZSTD_BLOCKSIZE_MAX. + * + * - dict, dictSize: a history buffer, which may be empty, which the sequence + * producer may reference as it parses the src buffer. Currently, zstd will + * always pass dictSize == 0 into external sequence producers, but this will + * change in the future. + * + * - compressionLevel: a signed integer representing the zstd compression level + * set by the user for the current operation. The sequence producer may choose + * to use this information to change its compression strategy and speed/ratio + * tradeoff. Note: the compression level does not reflect zstd parameters set + * through the advanced API. + * + * - windowSize: a size_t representing the maximum allowed offset for external + * sequences. Note that sequence offsets are sometimes allowed to exceed the + * windowSize if a dictionary is present, see doc/zstd_compression_format.md + * for details. + * + * The user-provided function shall return a size_t representing the number of + * sequences written to outSeqs. This return value will be treated as an error + * code if it is greater than outSeqsCapacity. The return value must be non-zero + * if srcSize is non-zero. The ZSTD_SEQUENCE_PRODUCER_ERROR macro is provided + * for convenience, but any value greater than outSeqsCapacity will be treated as + * an error code. + * + * If the user-provided function does not return an error code, the sequences + * written to outSeqs must be a valid parse of the src buffer. Data corruption may + * occur if the parse is not valid. A parse is defined to be valid if the + * following conditions hold: + * - The sum of matchLengths and literalLengths must equal srcSize. + * - All sequences in the parse, except for the final sequence, must have + * matchLength >= ZSTD_MINMATCH_MIN. The final sequence must have + * matchLength >= ZSTD_MINMATCH_MIN or matchLength == 0. + * - All offsets must respect the windowSize parameter as specified in + * doc/zstd_compression_format.md. + * - If the final sequence has matchLength == 0, it must also have offset == 0. + * + * zstd will only validate these conditions (and fail compression if they do not + * hold) if the ZSTD_c_validateSequences cParam is enabled. Note that sequence + * validation has a performance cost. + * + * If the user-provided function returns an error, zstd will either fall back + * to an internal sequence producer or fail the compression operation. The user can + * choose between the two behaviors by setting the ZSTD_c_enableSeqProducerFallback + * cParam. Fallback compression will follow any other cParam settings, such as + * compression level, the same as in a normal compression operation. + * + * The user shall instruct zstd to use a particular ZSTD_sequenceProducer_F + * function by calling + * ZSTD_registerSequenceProducer(cctx, + * sequenceProducerState, + * sequenceProducer) + * This setting will persist until the next parameter reset of the CCtx. + * + * The sequenceProducerState must be initialized by the user before calling + * ZSTD_registerSequenceProducer(). The user is responsible for destroying the + * sequenceProducerState. + * + * *** LIMITATIONS *** + * This API is compatible with all zstd compression APIs which respect advanced parameters. + * However, there are three limitations: + * + * First, the ZSTD_c_enableLongDistanceMatching cParam is not currently supported. + * COMPRESSION WILL FAIL if it is enabled and the user tries to compress with a block-level + * external sequence producer. + * - Note that ZSTD_c_enableLongDistanceMatching is auto-enabled by default in some + * cases (see its documentation for details). Users must explicitly set + * ZSTD_c_enableLongDistanceMatching to ZSTD_ps_disable in such cases if an external + * sequence producer is registered. + * - As of this writing, ZSTD_c_enableLongDistanceMatching is disabled by default + * whenever ZSTD_c_windowLog < 128MB, but that's subject to change. Users should + * check the docs on ZSTD_c_enableLongDistanceMatching whenever the Block-Level Sequence + * Producer API is used in conjunction with advanced settings (like ZSTD_c_windowLog). + * + * Second, history buffers are not currently supported. Concretely, zstd will always pass + * dictSize == 0 to the external sequence producer (for now). This has two implications: + * - Dictionaries are not currently supported. Compression will *not* fail if the user + * references a dictionary, but the dictionary won't have any effect. + * - Stream history is not currently supported. All advanced compression APIs, including + * streaming APIs, work with external sequence producers, but each block is treated as + * an independent chunk without history from previous blocks. + * + * Third, multi-threading within a single compression is not currently supported. In other words, + * COMPRESSION WILL FAIL if ZSTD_c_nbWorkers > 0 and an external sequence producer is registered. + * Multi-threading across compressions is fine: simply create one CCtx per thread. + * + * Long-term, we plan to overcome all three limitations. There is no technical blocker to + * overcoming them. It is purely a question of engineering effort. + */ + +#define ZSTD_SEQUENCE_PRODUCER_ERROR ((size_t)(-1)) + +typedef size_t ZSTD_sequenceProducer_F ( + void* sequenceProducerState, + ZSTD_Sequence* outSeqs, size_t outSeqsCapacity, + const void* src, size_t srcSize, + const void* dict, size_t dictSize, + int compressionLevel, + size_t windowSize +); + +/*! ZSTD_registerSequenceProducer() : + * Instruct zstd to use a block-level external sequence producer function. + * + * The sequenceProducerState must be initialized by the caller, and the caller is + * responsible for managing its lifetime. This parameter is sticky across + * compressions. It will remain set until the user explicitly resets compression + * parameters. + * + * Sequence producer registration is considered to be an "advanced parameter", + * part of the "advanced API". This means it will only have an effect on compression + * APIs which respect advanced parameters, such as compress2() and compressStream2(). + * Older compression APIs such as compressCCtx(), which predate the introduction of + * "advanced parameters", will ignore any external sequence producer setting. + * + * The sequence producer can be "cleared" by registering a NULL function pointer. This + * removes all limitations described above in the "LIMITATIONS" section of the API docs. + * + * The user is strongly encouraged to read the full API documentation (above) before + * calling this function. */ +ZSTDLIB_STATIC_API void +ZSTD_registerSequenceProducer( + ZSTD_CCtx* cctx, + void* sequenceProducerState, + ZSTD_sequenceProducer_F* sequenceProducer +); + #endif /* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */ #if defined (__cplusplus) diff --git a/src/dependencies/zstd-1.5.0/lib/zstd_errors.h b/src/dependencies/zstd-1.5.4/lib/zstd_errors.h similarity index 74% rename from src/dependencies/zstd-1.5.0/lib/zstd_errors.h rename to src/dependencies/zstd-1.5.4/lib/zstd_errors.h index fa3686b..dc75eee 100644 --- a/src/dependencies/zstd-1.5.0/lib/zstd_errors.h +++ b/src/dependencies/zstd-1.5.4/lib/zstd_errors.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -20,19 +20,31 @@ extern "C" { /* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */ -#ifndef ZSTDERRORLIB_VISIBILITY -# if defined(__GNUC__) && (__GNUC__ >= 4) -# define ZSTDERRORLIB_VISIBILITY __attribute__ ((visibility ("default"))) +#ifndef ZSTDERRORLIB_VISIBLE + /* Backwards compatibility with old macro name */ +# ifdef ZSTDERRORLIB_VISIBILITY +# define ZSTDERRORLIB_VISIBLE ZSTDERRORLIB_VISIBILITY +# elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) +# define ZSTDERRORLIB_VISIBLE __attribute__ ((visibility ("default"))) # else -# define ZSTDERRORLIB_VISIBILITY +# define ZSTDERRORLIB_VISIBLE # endif #endif + +#ifndef ZSTDERRORLIB_HIDDEN +# if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__) +# define ZSTDERRORLIB_HIDDEN __attribute__ ((visibility ("hidden"))) +# else +# define ZSTDERRORLIB_HIDDEN +# endif +#endif + #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) -# define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBILITY +# define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBLE #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) -# define ZSTDERRORLIB_API __declspec(dllimport) ZSTDERRORLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ +# define ZSTDERRORLIB_API __declspec(dllimport) ZSTDERRORLIB_VISIBLE /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ #else -# define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY +# define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBLE #endif /*-********************************************* @@ -58,14 +70,17 @@ typedef enum { ZSTD_error_frameParameter_windowTooLarge = 16, ZSTD_error_corruption_detected = 20, ZSTD_error_checksum_wrong = 22, + ZSTD_error_literals_headerWrong = 24, ZSTD_error_dictionary_corrupted = 30, ZSTD_error_dictionary_wrong = 32, ZSTD_error_dictionaryCreation_failed = 34, ZSTD_error_parameter_unsupported = 40, + ZSTD_error_parameter_combination_unsupported = 41, ZSTD_error_parameter_outOfBound = 42, ZSTD_error_tableLog_tooLarge = 44, ZSTD_error_maxSymbolValue_tooLarge = 46, ZSTD_error_maxSymbolValue_tooSmall = 48, + ZSTD_error_stabilityCondition_notRespected = 50, ZSTD_error_stage_wrong = 60, ZSTD_error_init_missing = 62, ZSTD_error_memory_allocation = 64, @@ -73,11 +88,15 @@ typedef enum { ZSTD_error_dstSize_tooSmall = 70, ZSTD_error_srcSize_wrong = 72, ZSTD_error_dstBuffer_null = 74, + ZSTD_error_noForwardProgress_destFull = 80, + ZSTD_error_noForwardProgress_inputEmpty = 82, /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */ ZSTD_error_frameIndex_tooLarge = 100, ZSTD_error_seekableIO = 102, ZSTD_error_dstBuffer_wrong = 104, ZSTD_error_srcBuffer_wrong = 105, + ZSTD_error_sequenceProducer_failed = 106, + ZSTD_error_externalSequences_invalid = 107, ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */ } ZSTD_ErrorCode; diff --git a/src/dependencies/zstd-1.5.0/programs/.gitignore b/src/dependencies/zstd-1.5.4/programs/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/programs/.gitignore rename to src/dependencies/zstd-1.5.4/programs/.gitignore diff --git a/src/dependencies/zstd-1.5.0/programs/BUCK b/src/dependencies/zstd-1.5.4/programs/BUCK similarity index 100% rename from src/dependencies/zstd-1.5.0/programs/BUCK rename to src/dependencies/zstd-1.5.4/programs/BUCK diff --git a/src/dependencies/zstd-1.5.0/programs/Makefile b/src/dependencies/zstd-1.5.4/programs/Makefile similarity index 68% rename from src/dependencies/zstd-1.5.0/programs/Makefile rename to src/dependencies/zstd-1.5.4/programs/Makefile index 599fb02..fcff41d 100644 --- a/src/dependencies/zstd-1.5.0/programs/Makefile +++ b/src/dependencies/zstd-1.5.4/programs/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -9,7 +9,7 @@ # ########################################################################## # zstd : Command Line Utility, supporting gzip-like arguments # zstd32 : Same as zstd, but forced to compile in 32-bits mode -# zstd_nolegacy : zstd without support of decompression of legacy versions +# zstd-nolegacy : zstd without support of decompression of legacy versions # zstd-small : minimal zstd without dictionary builder and benchmark # zstd-compress : compressor-only version of zstd # zstd-decompress : decompressor-only version of zstd @@ -18,31 +18,9 @@ .PHONY: default default: zstd-release -# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1 -$(V)$(VERBOSE).SILENT: +LIBZSTD := ../lib - -ZSTDDIR := ../lib - -# Version numbers -LIBVER_SRC := $(ZSTDDIR)/zstd.h -LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) -LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) -LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) -LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) -LIBVER := $(shell echo $(LIBVER_SCRIPT)) - -ZSTD_VERSION = $(LIBVER) - -HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) -GREP_OPTIONS ?= -ifeq ($HAVE_COLORNEVER, 1) - GREP_OPTIONS += --color=never -endif -GREP = grep $(GREP_OPTIONS) +include $(LIBZSTD)/libzstd.mk ifeq ($(shell $(CC) -v 2>&1 | $(GREP) -c "gcc version "), 1) ALIGN_LOOP = -falign-loops=32 @@ -50,78 +28,25 @@ else ALIGN_LOOP = endif -DEBUGLEVEL ?= 0 -CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL) -ifeq ($(OS),Windows_NT) # MinGW assumed - CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting -endif -CFLAGS ?= -O3 -DEBUGFLAGS+=-Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef -Wpointer-arith \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls -Wmissing-prototypes -Wc++-compat -CFLAGS += $(DEBUGFLAGS) -CPPFLAGS += $(MOREFLAGS) -LDFLAGS += $(MOREFLAGS) -FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) - -ZSTDLIB_COMMON := $(ZSTDDIR)/common -ZSTDLIB_COMPRESS := $(ZSTDDIR)/compress -ZSTDLIB_DECOMPRESS := $(ZSTDDIR)/decompress -ZDICT_DIR := $(ZSTDDIR)/dictBuilder -ZSTDLEGACY_DIR := $(ZSTDDIR)/legacy - -vpath %.c $(ZSTDLIB_COMMON) $(ZSTDLIB_COMPRESS) $(ZSTDLIB_DECOMPRESS) $(ZDICT_DIR) $(ZSTDLEGACY_DIR) - -ZSTDLIB_COMMON_C := $(wildcard $(ZSTDLIB_COMMON)/*.c) -ZSTDLIB_COMPRESS_C := $(wildcard $(ZSTDLIB_COMPRESS)/*.c) -ZSTDLIB_DECOMPRESS_C := $(wildcard $(ZSTDLIB_DECOMPRESS)/*.c) -ZSTDLIB_CORE_SRC := $(ZSTDLIB_DECOMPRESS_C) $(ZSTDLIB_COMMON_C) $(ZSTDLIB_COMPRESS_C) -ZDICT_SRC := $(wildcard $(ZDICT_DIR)/*.c) - -ZSTD_LEGACY_SUPPORT ?= 5 -ZSTDLEGACY_SRC := -ifneq ($(ZSTD_LEGACY_SUPPORT), 0) -ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0) - ZSTDLEGACY_SRC += $(shell ls $(ZSTDLEGACY_DIR)/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]') -endif -endif +ZSTDLIB_COMMON_SRC := $(sort $(ZSTD_COMMON_FILES)) +ZSTDLIB_COMPRESS_SRC := $(sort $(ZSTD_COMPRESS_FILES)) +ZSTDLIB_DECOMPRESS_SRC := $(sort $(ZSTD_DECOMPRESS_FILES)) +ZSTDLIB_CORE_SRC := $(sort $(ZSTD_DECOMPRESS_FILES) $(ZSTD_COMMON_FILES) $(ZSTD_COMPRESS_FILES)) +ZDICT_SRC := $(sort $(ZSTD_DICTBUILDER_FILES)) +ZSTDLEGACY_SRC := $(sort $(ZSTD_LEGACY_FILES)) # Sort files in alphabetical order for reproducible builds ZSTDLIB_FULL_SRC = $(sort $(ZSTDLIB_CORE_SRC) $(ZSTDLEGACY_SRC) $(ZDICT_SRC)) ZSTDLIB_LOCAL_SRC = $(notdir $(ZSTDLIB_FULL_SRC)) -ZSTDLIB_LOCAL_OBJ := $(ZSTDLIB_LOCAL_SRC:.c=.o) +ZSTDLIB_LOCAL_OBJ0 := $(ZSTDLIB_LOCAL_SRC:.c=.o) +ZSTDLIB_LOCAL_OBJ := $(ZSTDLIB_LOCAL_OBJ0:.S=.o) -ZSTD_CLI_SRC := $(wildcard *.c) +ZSTD_CLI_SRC := $(sort $(wildcard *.c)) ZSTD_CLI_OBJ := $(ZSTD_CLI_SRC:.c=.o) ZSTD_ALL_SRC = $(ZSTDLIB_LOCAL_SRC) $(ZSTD_CLI_SRC) -ZSTD_ALL_OBJ := $(ZSTD_ALL_SRC:.c=.o) - -UNAME := $(shell uname) - -ifndef BUILD_DIR -ifeq ($(UNAME), Darwin) - ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0) - HASH ?= md5 - endif -else ifeq ($(UNAME), FreeBSD) - HASH ?= gmd5sum -else ifeq ($(UNAME), NetBSD) - HASH ?= md5 -n -else ifeq ($(UNAME), OpenBSD) - HASH ?= md5 -endif -HASH ?= md5sum -HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0) - -HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " ") -ifeq ($(HAVE_HASH),0) - $(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags) - BUILD_DIR := obj/generic_noconf -endif -endif # BUILD_DIR +ZSTD_ALL_OBJ0 := $(ZSTD_ALL_SRC:.c=.o) +ZSTD_ALL_OBJ := $(ZSTD_ALL_OBJ0:.S=.o) # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) @@ -137,11 +62,6 @@ else EXT = endif -VOID = /dev/null - -# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/) -NUM_SYMBOL := \# - # thread detection NO_THREAD_MSG := ==> no threads, building without multithreading support HAVE_PTHREAD := $(shell printf '$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c) @@ -156,7 +76,7 @@ endif # zlib detection NO_ZLIB_MSG := ==> no zlib, building zstd without .gz support -HAVE_ZLIB := $(shell printf '$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_zlib.c && $(CC) $(FLAGS) -o have_zlib$(EXT) have_zlib.c -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0; rm have_zlib.c) +HAVE_ZLIB ?= $(shell printf '$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_zlib.c && $(CC) $(FLAGS) -o have_zlib$(EXT) have_zlib.c -lz 2> $(VOID) && rm have_zlib$(EXT) && echo 1 || echo 0; rm have_zlib.c) ifeq ($(HAVE_ZLIB), 1) ZLIB_MSG := ==> building zstd with .gz compression support ZLIBCPP = -DZSTD_GZCOMPRESS -DZSTD_GZDECOMPRESS @@ -167,7 +87,7 @@ endif # lzma detection NO_LZMA_MSG := ==> no liblzma, building zstd without .xz/.lzma support -HAVE_LZMA := $(shell printf '$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_lzma.c && $(CC) $(FLAGS) -o have_lzma$(EXT) have_lzma.c -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0; rm have_lzma.c) +HAVE_LZMA ?= $(shell printf '$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_lzma.c && $(CC) $(FLAGS) -o have_lzma$(EXT) have_lzma.c -llzma 2> $(VOID) && rm have_lzma$(EXT) && echo 1 || echo 0; rm have_lzma.c) ifeq ($(HAVE_LZMA), 1) LZMA_MSG := ==> building zstd with .xz/.lzma compression support LZMACPP = -DZSTD_LZMACOMPRESS -DZSTD_LZMADECOMPRESS @@ -178,7 +98,7 @@ endif # lz4 detection NO_LZ4_MSG := ==> no liblz4, building zstd without .lz4 support -HAVE_LZ4 := $(shell printf '$(NUM_SYMBOL)include \n$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_lz4.c && $(CC) $(FLAGS) -o have_lz4$(EXT) have_lz4.c -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || echo 0; rm have_lz4.c) +HAVE_LZ4 ?= $(shell printf '$(NUM_SYMBOL)include \n$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_lz4.c && $(CC) $(FLAGS) -o have_lz4$(EXT) have_lz4.c -llz4 2> $(VOID) && rm have_lz4$(EXT) && echo 1 || echo 0; rm have_lz4.c) ifeq ($(HAVE_LZ4), 1) LZ4_MSG := ==> building zstd with .lz4 compression support LZ4CPP = -DZSTD_LZ4COMPRESS -DZSTD_LZ4DECOMPRESS @@ -209,10 +129,10 @@ SET_CACHE_DIRECTORY = \ .PHONY: all -all: zstd +all: zstd zstd-compress zstd-decompress zstd-small .PHONY: allVariants -allVariants: zstd zstd-compress zstd-decompress zstd-small zstd-nolegacy zstd-dictBuilder +allVariants: all zstd-frugal zstd-nolegacy zstd-dictBuilder .PHONY: zstd # must always be run zstd : CPPFLAGS += $(THREAD_CPP) $(ZLIBCPP) $(LZMACPP) $(LZ4CPP) @@ -242,8 +162,8 @@ $(BUILD_DIR)/zstd : $(ZSTD_OBJ) $(CC) $(FLAGS) $^ $(LDLIBS) -o $@$(EXT) ifeq ($(HAVE_HASH),1) -SRCBIN_HASH = $(shell cat $(BUILD_DIR)/zstd 2> $(VOID) | $(HASH) | cut -f 1 -d " ") -DSTBIN_HASH = $(shell cat zstd 2> $(VOID) | $(HASH) | cut -f 1 -d " ") +SRCBIN_HASH = $(shell cat $(BUILD_DIR)/zstd$(EXT) 2> $(VOID) | $(HASH) | cut -f 1 -d " ") +DSTBIN_HASH = $(shell cat zstd$(EXT) 2> $(VOID) | $(HASH) | cut -f 1 -d " ") BIN_ISDIFFERENT = $(if $(filter $(SRCBIN_HASH),$(DSTBIN_HASH)),0,1) else BIN_ISDIFFERENT = 1 @@ -251,7 +171,7 @@ endif zstd : $(BUILD_DIR)/zstd if [ $(BIN_ISDIFFERENT) -eq 1 ]; then \ - cp -f $< $@; \ + cp -f $<$(EXT) $@$(EXT); \ echo zstd build completed; \ else \ echo zstd already built; \ @@ -260,11 +180,13 @@ zstd : $(BUILD_DIR)/zstd endif # BUILD_DIR +CLEAN += zstd .PHONY: zstd-release zstd-release: DEBUGFLAGS := -DBACKTRACE_ENABLE=0 zstd-release: DEBUGFLAGS_LD := zstd-release: zstd +CLEAN += zstd32 zstd32 : CPPFLAGS += $(THREAD_CPP) zstd32 : LDFLAGS += $(THREAD_LD) zstd32 : CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) @@ -274,8 +196,10 @@ endif zstd32 : $(ZSTDLIB_FULL_SRC) $(ZSTD_CLI_SRC) $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) -## zstd-nolegacy: same scope as zstd, with just support of legacy formats removed +## zstd-nolegacy: same scope as zstd, with removed support of legacy formats +CLEAN += zstd-nolegacy zstd-nolegacy : LDFLAGS += $(THREAD_LD) $(ZLIBLD) $(LZMALD) $(LZ4LD) $(DEBUGFLAGS_LD) +zstd-nolegacy : CPPFLAGS += -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 zstd-nolegacy : $(ZSTDLIB_CORE_SRC) $(ZDICT_SRC) $(ZSTD_CLI_OBJ) $(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS) @@ -299,7 +223,7 @@ zstd-noxz : zstd ## zstd-dll: zstd executable linked to dynamic library libzstd (must have same version) .PHONY: zstd-dll -zstd-dll : LDFLAGS+= -L$(ZSTDDIR) +zstd-dll : LDFLAGS+= -L$(LIBZSTD) zstd-dll : LDLIBS += -lzstd zstd-dll : ZSTDLIB_LOCAL_SRC = xxhash.c zstd-dll : zstd @@ -307,35 +231,46 @@ zstd-dll : zstd ## zstd-pgo: zstd executable optimized with PGO. .PHONY: zstd-pgo +zstd-pgo : LLVM_PROFDATA?=llvm-profdata +zstd-pgo : PROF_GENERATE_FLAGS=-fprofile-generate $(if $(findstring gcc,$(CC)),-fprofile-dir=.) +zstd-pgo : PROF_USE_FLAGS=-fprofile-use $(if $(findstring gcc,$(CC)),-fprofile-dir=. -Werror=missing-profile -Wno-error=coverage-mismatch) zstd-pgo : - $(MAKE) clean - $(MAKE) zstd MOREFLAGS=-fprofile-generate + $(MAKE) clean HASH_DIR=$(HASH_DIR) + $(MAKE) zstd HASH_DIR=$(HASH_DIR) MOREFLAGS="$(PROF_GENERATE_FLAGS)" ./zstd -b19i1 $(PROFILE_WITH) ./zstd -b16i1 $(PROFILE_WITH) ./zstd -b9i2 $(PROFILE_WITH) ./zstd -b $(PROFILE_WITH) ./zstd -b7i2 $(PROFILE_WITH) ./zstd -b5 $(PROFILE_WITH) - $(RM) zstd *.o - case $(CC) in *clang*) if ! [ -e default.profdata ]; then llvm-profdata merge -output=default.profdata default*.profraw; fi ;; esac - $(MAKE) zstd MOREFLAGS=-fprofile-use +ifndef BUILD_DIR + $(RM) zstd obj/$(HASH_DIR)/zstd obj/$(HASH_DIR)/*.o +else + $(RM) zstd $(BUILD_DIR)/zstd $(BUILD_DIR)/*.o +endif + case $(CC) in *clang*) if ! [ -e default.profdata ]; then $(LLVM_PROFDATA) merge -output=default.profdata default*.profraw; fi ;; esac + $(MAKE) zstd HASH_DIR=$(HASH_DIR) MOREFLAGS="$(PROF_USE_FLAGS)" ## zstd-small: minimal target, supporting only zstd compression and decompression. no bench. no legacy. no other format. -zstd-small: CFLAGS = -Os -s -zstd-frugal zstd-small: $(ZSTDLIB_CORE_SRC) zstdcli.c util.c timefn.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOTRACE $^ -o $@$(EXT) +CLEAN += zstd-small zstd-frugal +zstd-small: CFLAGS = -Os -Wl,-s +zstd-frugal zstd-small: $(ZSTDLIB_CORE_SRC) zstdcli.c util.c timefn.c fileio.c fileio_asyncio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) -zstd-decompress: $(ZSTDLIB_COMMON_C) $(ZSTDLIB_DECOMPRESS_C) zstdcli.c util.c timefn.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOCOMPRESS -DZSTD_NOTRACE $^ -o $@$(EXT) +CLEAN += zstd-decompress +zstd-decompress: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_DECOMPRESS_SRC) zstdcli.c util.c timefn.c fileio.c fileio_asyncio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOCOMPRESS -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) -zstd-compress: $(ZSTDLIB_COMMON_C) $(ZSTDLIB_COMPRESS_C) zstdcli.c util.c timefn.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NODECOMPRESS -DZSTD_NOTRACE $^ -o $@$(EXT) +CLEAN += zstd-compress +zstd-compress: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_COMPRESS_SRC) zstdcli.c util.c timefn.c fileio.c fileio_asyncio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NODECOMPRESS -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) ## zstd-dictBuilder: executable supporting dictionary creation and compression (only) -zstd-dictBuilder: CPPFLAGS += -DZSTD_NOBENCH -DZSTD_NODECOMPRESS -DZSTD_NOTRACE -zstd-dictBuilder: $(ZSTDLIB_COMMON_C) $(ZSTDLIB_COMPRESS_C) $(ZDICT_SRC) zstdcli.c util.c timefn.c fileio.c dibio.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +CLEAN += zstd-dictBuilder +zstd-dictBuilder: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_COMPRESS_SRC) $(ZDICT_SRC) zstdcli.c util.c timefn.c fileio.c fileio_asyncio.c dibio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODECOMPRESS -DZSTD_NOTRACE $^ -o $@$(EXT) +CLEAN += zstdmt zstdmt: zstd ln -sf zstd zstdmt @@ -344,7 +279,7 @@ generate_res: $(RES64_FILE) $(RES32_FILE) ifneq (,$(filter Windows%,$(OS))) RC ?= windres -# http://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable +# https://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable $(RES64_FILE): windres/zstd.rc $(RC) -o $@ -I ../lib -I windres -i $< -O coff -F pe-x86-64 $(RES32_FILE): windres/zstd.rc @@ -353,12 +288,8 @@ endif .PHONY: clean clean: - $(RM) core *.o tmp* result* *.gcda dictionary *.zst \ - zstd$(EXT) zstd32$(EXT) zstd-dll$(EXT) \ - zstd-compress$(EXT) zstd-decompress$(EXT) \ - zstd-small$(EXT) zstd-frugal$(EXT) zstd-nolegacy$(EXT) zstd4$(EXT) \ - zstd-dictBuilder$(EXT) \ - *.gcda default*.profraw default.profdata have_zlib$(EXT) + $(RM) $(CLEAN) core *.o tmp* result* dictionary *.zst \ + *.gcda default*.profraw default.profdata have_zlib $(RM) -r obj/* @echo Cleaning completed @@ -398,6 +329,10 @@ $(BUILD_DIR)/%.o : %.c $(BUILD_DIR)/%.d | $(BUILD_DIR) @echo CC $@ $(COMPILE.c) $(DEPFLAGS) $(BUILD_DIR)/$*.d $(OUTPUT_OPTION) $< +$(BUILD_DIR)/%.o : %.S | $(BUILD_DIR) + @echo AS $@ + $(COMPILE.S) $(OUTPUT_OPTION) $< + MKDIR ?= mkdir $(BUILD_DIR): ; $(MKDIR) -p $@ @@ -411,11 +346,11 @@ include $(wildcard $(DEPFILES)) #----------------------------------------------------------------------------- # make install is validated only for Linux, macOS, BSD, Hurd and Solaris targets #----------------------------------------------------------------------------- -ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku)) +ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX)) HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) EGREP_OPTIONS ?= -ifeq ($HAVE_COLORNEVER, 1) +ifeq ($(HAVE_COLORNEVER), 1) EGREP_OPTIONS += --color=never endif EGREP = egrep $(EGREP_OPTIONS) diff --git a/src/dependencies/zstd-1.5.0/programs/README.md b/src/dependencies/zstd-1.5.4/programs/README.md similarity index 97% rename from src/dependencies/zstd-1.5.0/programs/README.md rename to src/dependencies/zstd-1.5.4/programs/README.md index 7fd7104..1b9f47c 100644 --- a/src/dependencies/zstd-1.5.0/programs/README.md +++ b/src/dependencies/zstd-1.5.4/programs/README.md @@ -156,7 +156,7 @@ Arguments : Advanced arguments : -V : display Version number and exit - -c : force write to standard output, even if it is the console + -c : write to standard output (even if it is the console) -v : verbose mode; specify multiple times to increase verbosity -q : suppress warnings; specify twice to suppress errors too --no-progress : do not display the progress counter @@ -164,6 +164,7 @@ Advanced arguments : --filelist FILE : read list of files to operate upon from FILE --output-dir-flat DIR : processed files are stored into DIR --output-dir-mirror DIR : processed files are stored into DIR respecting original directory structure +--[no-]asyncio : use asynchronous IO (default: enabled) --[no-]check : during compression, add XXH64 integrity checksum to frame (default: enabled). If specified with -d, decompressor will ignore/validate checksums in compressed frame (default: validate). -- : All arguments after "--" are treated as files @@ -172,6 +173,7 @@ Advanced compression arguments : --long[=#]: enable long distance matching with given window log (default: 27) --fast[=#]: switch to very fast compression levels (default: 1) --adapt : dynamically adapt compression level to I/O conditions +--patch-from=FILE : specify the file to be used as a reference point for zstd's diff engine -T# : spawns # compression threads (default: 1, 0==# cores) -B# : select size of each job (default: 0==automatic) --single-thread : use a single thread for both I/O and compression (result slightly different than -T1) @@ -207,7 +209,7 @@ Benchmark arguments : -b# : benchmark file(s), using # compression level (default: 3) -e# : test all compression levels successively from -b# to -e# (default: 1) -i# : minimum evaluation time in seconds (default: 3s) - -B# : cut file into independent blocks of size # (default: no block) + -B# : cut file into independent chunks of size # (default: no chunking) -S : output one benchmark result per input file (default: consolidated result) --priority=rt : set process priority to real-time ``` @@ -274,7 +276,7 @@ compression speed (for lower levels) with minimal change in compression ratio. The below table illustrates this on the [Silesia compression corpus]. -[Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia +[Silesia compression corpus]: https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia | Method | Compression ratio | Compression speed | Decompression speed | |:-------|------------------:|------------------:|---------------------:| diff --git a/src/dependencies/zstd-1.5.0/programs/benchfn.c b/src/dependencies/zstd-1.5.4/programs/benchfn.c similarity index 97% rename from src/dependencies/zstd-1.5.0/programs/benchfn.c rename to src/dependencies/zstd-1.5.4/programs/benchfn.c index 1aadbdd..8e6726f 100644 --- a/src/dependencies/zstd-1.5.0/programs/benchfn.c +++ b/src/dependencies/zstd-1.5.4/programs/benchfn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -229,9 +229,9 @@ BMK_runOutcome_t BMK_benchTimedFn(BMK_timedFnState_t* cont, cont->timeSpent_ns += (unsigned long long)loopDuration_ns; /* estimate nbLoops for next run to last approximately 1 second */ - if (loopDuration_ns > (runBudget_ns / 50)) { + if (loopDuration_ns > ((double)runBudget_ns / 50)) { double const fastestRun_ns = MIN(bestRunTime.nanoSecPerRun, newRunTime.nanoSecPerRun); - cont->nbLoops = (unsigned)(runBudget_ns / fastestRun_ns) + 1; + cont->nbLoops = (unsigned)((double)runBudget_ns / fastestRun_ns) + 1; } else { /* previous run was too short : blindly increase workload by x multiplier */ const unsigned multiplier = 10; @@ -239,7 +239,7 @@ BMK_runOutcome_t BMK_benchTimedFn(BMK_timedFnState_t* cont, cont->nbLoops *= multiplier; } - if(loopDuration_ns < runTimeMin_ns) { + if(loopDuration_ns < (double)runTimeMin_ns) { /* don't report results for which benchmark run time was too small : increased risks of rounding errors */ assert(completed == 0); continue; diff --git a/src/dependencies/zstd-1.5.0/programs/benchfn.h b/src/dependencies/zstd-1.5.4/programs/benchfn.h similarity index 99% rename from src/dependencies/zstd-1.5.0/programs/benchfn.h rename to src/dependencies/zstd-1.5.4/programs/benchfn.h index 590f292..1bd93d1 100644 --- a/src/dependencies/zstd-1.5.0/programs/benchfn.h +++ b/src/dependencies/zstd-1.5.4/programs/benchfn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -123,7 +123,7 @@ BMK_runTime_t BMK_extract_runTime(BMK_runOutcome_t outcome); /* when benchmark failed, it means one invocation of `benchFn` failed. * The failure was detected by `errorFn`, operating on return values of `benchFn`. * Returns the faulty return value. - * note : this function will abort() program execution if benchmark did not failed. + * note : this function will abort() program execution if benchmark did not fail. * always check if benchmark failed first ! */ size_t BMK_extract_errorResult(BMK_runOutcome_t outcome); diff --git a/src/dependencies/zstd-1.5.0/programs/benchzstd.c b/src/dependencies/zstd-1.5.4/programs/benchzstd.c similarity index 92% rename from src/dependencies/zstd-1.5.0/programs/benchzstd.c rename to src/dependencies/zstd-1.5.4/programs/benchzstd.c index 49c0349..a76db5f 100644 --- a/src/dependencies/zstd-1.5.0/programs/benchzstd.c +++ b/src/dependencies/zstd-1.5.4/programs/benchzstd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -13,7 +13,7 @@ * Tuning parameters ****************************************/ #ifndef BMK_TIMETEST_DEFAULT_S /* default minimum time per test */ -#define BMK_TIMETEST_DEFAULT_S 3 +# define BMK_TIMETEST_DEFAULT_S 3 #endif @@ -31,9 +31,14 @@ #include "timefn.h" /* UTIL_time_t */ #include "benchfn.h" #include "../lib/common/mem.h" +#ifndef ZSTD_STATIC_LINKING_ONLY #define ZSTD_STATIC_LINKING_ONLY +#endif #include "../lib/zstd.h" #include "datagen.h" /* RDG_genBuffer */ +#ifndef XXH_INLINE_ALL +#define XXH_INLINE_ALL +#endif #include "../lib/common/xxhash.h" #include "benchzstd.h" #include "../lib/zstd_errors.h" @@ -70,6 +75,8 @@ static const size_t maxMemory = (sizeof(size_t)==4) ? #define DISPLAY(...) { fprintf(stderr, __VA_ARGS__); fflush(NULL); } #define DISPLAYLEVEL(l, ...) if (displayLevel>=l) { DISPLAY(__VA_ARGS__); } /* 0 : no display; 1: errors; 2 : + result + interaction + warnings; 3 : + progression; 4 : + information */ +#define OUTPUT(...) { fprintf(stdout, __VA_ARGS__); fflush(NULL); } +#define OUTPUTLEVEL(l, ...) if (displayLevel>=l) { OUTPUT(__VA_ARGS__); } /* ************************************* @@ -129,7 +136,7 @@ BMK_advancedParams_t BMK_initAdvancedParams(void) { 0, /* ldmHashLog */ 0, /* ldmBuckSizeLog */ 0, /* ldmHashRateLog */ - ZSTD_lcm_auto, /* literalCompressionMode */ + ZSTD_ps_auto, /* literalCompressionMode */ 0 /* useRowMatchFinder */ }; return res; @@ -181,7 +188,7 @@ BMK_initCCtx(ZSTD_CCtx* ctx, CHECK_Z(ZSTD_CCtx_setParameter(ctx, ZSTD_c_minMatch, (int)comprParams->minMatch)); CHECK_Z(ZSTD_CCtx_setParameter(ctx, ZSTD_c_targetLength, (int)comprParams->targetLength)); CHECK_Z(ZSTD_CCtx_setParameter(ctx, ZSTD_c_literalCompressionMode, (int)adv->literalCompressionMode)); - CHECK_Z(ZSTD_CCtx_setParameter(ctx, ZSTD_c_strategy, comprParams->strategy)); + CHECK_Z(ZSTD_CCtx_setParameter(ctx, ZSTD_c_strategy, (int)comprParams->strategy)); CHECK_Z(ZSTD_CCtx_loadDictionary(ctx, dictBuffer, dictBufferSize)); } @@ -320,26 +327,31 @@ BMK_benchMemAdvancedNoAlloc( /* init */ memset(&benchResult, 0, sizeof(benchResult)); if (strlen(displayName)>17) displayName += strlen(displayName) - 17; /* display last 17 characters */ - if (adv->mode == BMK_decodeOnly) { /* benchmark only decompression : source must be already compressed */ + if (adv->mode == BMK_decodeOnly) { + /* benchmark only decompression : source must be already compressed */ const char* srcPtr = (const char*)srcBuffer; U64 totalDSize64 = 0; U32 fileNb; for (fileNb=0; fileNb decodedSize) { /* size_t overflow */ + RETURN_ERROR(32, BMK_benchOutcome_t, "decompressed size is too large for local system"); + } *resultBufferPtr = malloc(decodedSize); if (!(*resultBufferPtr)) { - RETURN_ERROR(33, BMK_benchOutcome_t, "not enough memory"); - } - if (totalDSize64 > decodedSize) { /* size_t overflow */ - free(*resultBufferPtr); - RETURN_ERROR(32, BMK_benchOutcome_t, "original size is too large"); + RETURN_ERROR(33, BMK_benchOutcome_t, "allocation error: not enough memory"); } cSize = srcSize; srcSize = decodedSize; @@ -371,10 +383,7 @@ BMK_benchMemAdvancedNoAlloc( if (adv->mode == BMK_decodeOnly) { cSizes[nbBlocks] = thisBlockSize; benchResult.cSize = thisBlockSize; - } - } - } - } + } } } } /* warming up `compressedBuffer` */ if (adv->mode == BMK_decodeOnly) { @@ -383,6 +392,10 @@ BMK_benchMemAdvancedNoAlloc( RDG_genBuffer(compressedBuffer, maxCompressedSize, 0.10, 0.50, 1); } + if (!UTIL_support_MT_measurements() && adv->nbWorkers > 1) { + OUTPUTLEVEL(2, "Warning : time measurements may be incorrect in multithreading mode... \n") + } + /* Bench */ { U64 const crcOrig = (adv->mode == BMK_decodeOnly) ? 0 : XXH64(srcBuffer, srcSize, 0); # define NB_MARKS 4 @@ -429,20 +442,21 @@ BMK_benchMemAdvancedNoAlloc( dctxprep.dictBuffer = dictBuffer; dctxprep.dictBufferSize = dictBufferSize; - DISPLAYLEVEL(2, "\r%70s\r", ""); /* blank line */ - DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->\r", marks[markNb], displayName, (unsigned)srcSize); + OUTPUTLEVEL(2, "\r%70s\r", ""); /* blank line */ + assert(srcSize < UINT_MAX); + OUTPUTLEVEL(2, "%2s-%-17.17s :%10u -> \r", marks[markNb], displayName, (unsigned)srcSize); while (!(compressionCompleted && decompressionCompleted)) { if (!compressionCompleted) { BMK_runOutcome_t const cOutcome = BMK_benchTimedFn( timeStateCompress, cbp); if (!BMK_isSuccessful_runOutcome(cOutcome)) { - return BMK_benchOutcome_error(); + RETURN_ERROR(30, BMK_benchOutcome_t, "compression error"); } { BMK_runTime_t const cResult = BMK_extract_runTime(cOutcome); cSize = cResult.sumOfReturn; - ratio = (double)srcSize / cSize; + ratio = (double)srcSize / (double)cSize; { BMK_benchResult_t newResult; newResult.cSpeed = (U64)((double)srcSize * TIMELOOP_NANOSEC / cResult.nanoSecPerRun); benchResult.cSize = cSize; @@ -451,11 +465,12 @@ BMK_benchMemAdvancedNoAlloc( } } { int const ratioAccuracy = (ratio < 10.) ? 3 : 2; - DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->%10u (%5.*f),%6.*f MB/s\r", + assert(cSize < UINT_MAX); + OUTPUTLEVEL(2, "%2s-%-17.17s :%10u ->%10u (x%5.*f), %6.*f MB/s \r", marks[markNb], displayName, (unsigned)srcSize, (unsigned)cSize, ratioAccuracy, ratio, - benchResult.cSpeed < (10 MB) ? 2 : 1, (double)benchResult.cSpeed / MB_UNIT); + benchResult.cSpeed < (10 * MB_UNIT) ? 2 : 1, (double)benchResult.cSpeed / MB_UNIT); } compressionCompleted = BMK_isCompleted_TimedFn(timeStateCompress); } @@ -464,7 +479,7 @@ BMK_benchMemAdvancedNoAlloc( BMK_runOutcome_t const dOutcome = BMK_benchTimedFn(timeStateDecompress, dbp); if(!BMK_isSuccessful_runOutcome(dOutcome)) { - return BMK_benchOutcome_error(); + RETURN_ERROR(30, BMK_benchOutcome_t, "decompression error"); } { BMK_runTime_t const dResult = BMK_extract_runTime(dOutcome); @@ -474,11 +489,11 @@ BMK_benchMemAdvancedNoAlloc( } { int const ratioAccuracy = (ratio < 10.) ? 3 : 2; - DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->%10u (%5.*f),%6.*f MB/s ,%6.1f MB/s \r", + OUTPUTLEVEL(2, "%2s-%-17.17s :%10u ->%10u (x%5.*f), %6.*f MB/s, %6.1f MB/s\r", marks[markNb], displayName, (unsigned)srcSize, (unsigned)cSize, ratioAccuracy, ratio, - benchResult.cSpeed < (10 MB) ? 2 : 1, (double)benchResult.cSpeed / MB_UNIT, + benchResult.cSpeed < (10 * MB_UNIT) ? 2 : 1, (double)benchResult.cSpeed / MB_UNIT, (double)benchResult.dSpeed / MB_UNIT); } decompressionCompleted = BMK_isCompleted_TimedFn(timeStateDecompress); @@ -515,7 +530,7 @@ BMK_benchMemAdvancedNoAlloc( DISPLAY("%02X ", ((const BYTE*)srcBuffer)[u+n]); DISPLAY(" \n"); DISPLAY("decode: "); - for (n=lowest; n>0; n++) + for (n=lowest; n>0; n--) DISPLAY("%02X ", resultBuffer[u-n]); DISPLAY(" :%02X: ", resultBuffer[u]); for (n=1; n<3; n++) @@ -535,13 +550,13 @@ BMK_benchMemAdvancedNoAlloc( double const cSpeed = (double)benchResult.cSpeed / MB_UNIT; double const dSpeed = (double)benchResult.dSpeed / MB_UNIT; if (adv->additionalParam) { - DISPLAY("-%-3i%11i (%5.3f) %6.2f MB/s %6.1f MB/s %s (param=%d)\n", cLevel, (int)cSize, ratio, cSpeed, dSpeed, displayName, adv->additionalParam); + OUTPUT("-%-3i%11i (%5.3f) %6.2f MB/s %6.1f MB/s %s (param=%d)\n", cLevel, (int)cSize, ratio, cSpeed, dSpeed, displayName, adv->additionalParam); } else { - DISPLAY("-%-3i%11i (%5.3f) %6.2f MB/s %6.1f MB/s %s\n", cLevel, (int)cSize, ratio, cSpeed, dSpeed, displayName); + OUTPUT("-%-3i%11i (%5.3f) %6.2f MB/s %6.1f MB/s %s\n", cLevel, (int)cSize, ratio, cSpeed, dSpeed, displayName); } } - DISPLAYLEVEL(2, "%2i#\n", cLevel); + OUTPUTLEVEL(2, "%2i#\n", cLevel); } /* Bench */ benchResult.cMem = (1ULL << (comprParams->windowLog)) + ZSTD_sizeof_CCtx(cctx); @@ -588,7 +603,7 @@ BMK_benchOutcome_t BMK_benchMemAdvanced(const void* srcBuffer, size_t srcSize, void* resultBuffer = srcSize ? malloc(srcSize) : NULL; - int allocationincomplete = !srcPtrs || !srcSizes || !cPtrs || + int const allocationincomplete = !srcPtrs || !srcSizes || !cPtrs || !cSizes || !cCapacities || !resPtrs || !resSizes || !timeStateCompress || !timeStateDecompress || !cctx || !dctx || @@ -670,7 +685,7 @@ static BMK_benchOutcome_t BMK_benchCLevel(const void* srcBuffer, size_t benchedS } if (displayLevel == 1 && !adv->additionalParam) /* --quiet mode */ - DISPLAY("bench %s %s: input %u bytes, %u seconds, %u KB blocks\n", + OUTPUT("bench %s %s: input %u bytes, %u seconds, %u KB blocks\n", ZSTD_VERSION_STRING, ZSTD_GIT_COMMIT_STRING, (unsigned)benchedSize, adv->nbSeconds, (unsigned)(adv->blockSize>>10)); @@ -760,7 +775,7 @@ static int BMK_loadFiles(void* buffer, size_t bufferSize, } { FILE* const f = fopen(fileNamesTable[n], "rb"); if (f==NULL) RETURN_ERROR_INT(10, "impossible to open file %s", fileNamesTable[n]); - DISPLAYLEVEL(2, "Loading %s... \r", fileNamesTable[n]); + OUTPUTLEVEL(2, "Loading %s... \r", fileNamesTable[n]); if (fileSize > bufferSize-pos) fileSize = bufferSize-pos, nbFiles=n; /* buffer too small - stop after this file */ { size_t const readSize = fread(((char*)buffer)+pos, 1, (size_t)fileSize, f); if (readSize != (size_t)fileSize) RETURN_ERROR_INT(11, "could not read %s", fileNamesTable[n]); @@ -797,6 +812,10 @@ BMK_benchOutcome_t BMK_benchFilesAdvanced( RETURN_ERROR(15, BMK_benchOutcome_t, "Invalid Compression Level"); } + if (totalSizeToLoad == UTIL_FILESIZE_UNKNOWN) { + RETURN_ERROR(9, BMK_benchOutcome_t, "Error loading files"); + } + fileSizes = (size_t*)calloc(nbFiles, sizeof(size_t)); if (!fileSizes) RETURN_ERROR(12, BMK_benchOutcome_t, "not enough memory for fileSizes"); diff --git a/src/dependencies/zstd-1.5.0/programs/benchzstd.h b/src/dependencies/zstd-1.5.4/programs/benchzstd.h similarity index 98% rename from src/dependencies/zstd-1.5.0/programs/benchzstd.h rename to src/dependencies/zstd-1.5.4/programs/benchzstd.h index 9b40dcc..aa683df 100644 --- a/src/dependencies/zstd-1.5.0/programs/benchzstd.h +++ b/src/dependencies/zstd-1.5.4/programs/benchzstd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -116,7 +116,7 @@ typedef struct { int ldmHashLog; int ldmBucketSizeLog; int ldmHashRateLog; - ZSTD_literalCompressionMode_e literalCompressionMode; + ZSTD_paramSwitch_e literalCompressionMode; int useRowMatchFinder; /* use row-based matchfinder if possible */ } BMK_advancedParams_t; diff --git a/src/dependencies/zstd-1.5.0/programs/datagen.c b/src/dependencies/zstd-1.5.4/programs/datagen.c similarity index 99% rename from src/dependencies/zstd-1.5.0/programs/datagen.c rename to src/dependencies/zstd-1.5.4/programs/datagen.c index 3b4f9e5..ddc690b 100644 --- a/src/dependencies/zstd-1.5.0/programs/datagen.c +++ b/src/dependencies/zstd-1.5.4/programs/datagen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/programs/datagen.h b/src/dependencies/zstd-1.5.4/programs/datagen.h similarity index 95% rename from src/dependencies/zstd-1.5.0/programs/datagen.h rename to src/dependencies/zstd-1.5.4/programs/datagen.h index b76ae2a..ca72700 100644 --- a/src/dependencies/zstd-1.5.0/programs/datagen.h +++ b/src/dependencies/zstd-1.5.4/programs/datagen.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/programs/dibio.c b/src/dependencies/zstd-1.5.4/programs/dibio.c similarity index 58% rename from src/dependencies/zstd-1.5.0/programs/dibio.c rename to src/dependencies/zstd-1.5.4/programs/dibio.c index d6c9f6d..26ebe5c 100644 --- a/src/dependencies/zstd-1.5.0/programs/dibio.c +++ b/src/dependencies/zstd-1.5.4/programs/dibio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -27,11 +27,11 @@ #include /* memset */ #include /* fprintf, fopen, ftello64 */ #include /* errno */ -#include #include "timefn.h" /* UTIL_time_t, UTIL_clockSpanMicro, UTIL_getTime */ +#include "../lib/common/debug.h" /* assert */ #include "../lib/common/mem.h" /* read */ -#include "../lib/common/error_private.h" +#include "../lib/zstd_errors.h" #include "dibio.h" @@ -49,6 +49,7 @@ static const size_t g_maxMemory = (sizeof(size_t) == 4) ? (2 GB - 64 MB) : ((size_t)(512 MB) << sizeof(size_t)); #define NOISELENGTH 32 +#define MAX_SAMPLES_SIZE (2 GB) /* training dataset limited to 2GB */ /*-************************************* @@ -88,6 +89,15 @@ static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER; #undef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) +/** + Returns the size of a file. + If error returns -1. +*/ +static S64 DiB_getFileSize (const char * fileName) +{ + U64 const fileSize = UTIL_getFileSize(fileName); + return (fileSize == UTIL_FILESIZE_UNKNOWN) ? -1 : (S64)fileSize; +} /* ******************************************************** * File related operations @@ -101,47 +111,70 @@ static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER; * *bufferSizePtr is modified, it provides the amount data loaded within buffer. * sampleSizes is filled with the size of each sample. */ -static unsigned DiB_loadFiles(void* buffer, size_t* bufferSizePtr, - size_t* sampleSizes, unsigned sstSize, - const char** fileNamesTable, unsigned nbFiles, size_t targetChunkSize, - unsigned displayLevel) +static int DiB_loadFiles( + void* buffer, size_t* bufferSizePtr, + size_t* sampleSizes, int sstSize, + const char** fileNamesTable, int nbFiles, + size_t targetChunkSize, int displayLevel ) { char* const buff = (char*)buffer; - size_t pos = 0; - unsigned nbLoadedChunks = 0, fileIndex; + size_t totalDataLoaded = 0; + int nbSamplesLoaded = 0; + int fileIndex = 0; + FILE * f = NULL; - for (fileIndex=0; fileIndex *bufferSizePtr-pos) break; - { size_t const readSize = fread(buff+pos, 1, toLoad, f); - if (readSize != toLoad) EXM_THROW(11, "Pb reading %s", fileName); - pos += readSize; - sampleSizes[nbLoadedChunks++] = toLoad; - remainingToLoad -= targetChunkSize; - if (nbLoadedChunks == sstSize) { /* no more space left in sampleSizes table */ - fileIndex = nbFiles; /* stop there */ + assert(targetChunkSize <= SAMPLESIZE_MAX); + + while ( nbSamplesLoaded < sstSize && fileIndex < nbFiles ) { + size_t fileDataLoaded; + S64 const fileSize = DiB_getFileSize(fileNamesTable[fileIndex]); + if (fileSize <= 0) { + /* skip if zero-size or file error */ + ++fileIndex; + continue; + } + + f = fopen( fileNamesTable[fileIndex], "rb"); + if (f == NULL) + EXM_THROW(10, "zstd: dictBuilder: %s %s ", fileNamesTable[fileIndex], strerror(errno)); + DISPLAYUPDATE(2, "Loading %s... \r", fileNamesTable[fileIndex]); + + /* Load the first chunk of data from the file */ + fileDataLoaded = targetChunkSize > 0 ? + (size_t)MIN(fileSize, (S64)targetChunkSize) : + (size_t)MIN(fileSize, SAMPLESIZE_MAX ); + if (totalDataLoaded + fileDataLoaded > *bufferSizePtr) + break; + if (fread( buff+totalDataLoaded, 1, fileDataLoaded, f ) != fileDataLoaded) + EXM_THROW(11, "Pb reading %s", fileNamesTable[fileIndex]); + sampleSizes[nbSamplesLoaded++] = fileDataLoaded; + totalDataLoaded += fileDataLoaded; + + /* If file-chunking is enabled, load the rest of the file as more samples */ + if (targetChunkSize > 0) { + while( (S64)fileDataLoaded < fileSize && nbSamplesLoaded < sstSize ) { + size_t const chunkSize = MIN((size_t)(fileSize-fileDataLoaded), targetChunkSize); + if (totalDataLoaded + chunkSize > *bufferSizePtr) /* buffer is full */ break; - } - if (toLoad < targetChunkSize) { - fseek(f, (long)(targetChunkSize - toLoad), SEEK_CUR); - } } } - fclose(f); + + if (fread( buff+totalDataLoaded, 1, chunkSize, f ) != chunkSize) + EXM_THROW(11, "Pb reading %s", fileNamesTable[fileIndex]); + sampleSizes[nbSamplesLoaded++] = chunkSize; + totalDataLoaded += chunkSize; + fileDataLoaded += chunkSize; + } + } + fileIndex += 1; + fclose(f); f = NULL; } + if (f != NULL) + fclose(f); + DISPLAYLEVEL(2, "\r%79s\r", ""); - *bufferSizePtr = pos; - DISPLAYLEVEL(4, "loaded : %u KB \n", (unsigned)(pos >> 10)) - return nbLoadedChunks; + DISPLAYLEVEL(4, "Loaded %d KB total training data, %d nb samples \n", + (int)(totalDataLoaded / (1 KB)), nbSamplesLoaded ); + *bufferSizePtr = totalDataLoaded; + return nbSamplesLoaded; } #define DiB_rotl32(x,r) ((x << r) | (x >> (32 - r))) @@ -164,7 +197,8 @@ static U32 DiB_rand(U32* src) static void DiB_shuffle(const char** fileNamesTable, unsigned nbFiles) { U32 seed = 0xFD2FB528; unsigned i; - assert(nbFiles >= 1); + if (nbFiles == 0) + return; for (i = nbFiles - 1; i > 0; --i) { unsigned const j = DiB_rand(&seed) % (i + 1); const char* const tmp = fileNamesTable[j]; @@ -223,11 +257,10 @@ static void DiB_saveDict(const char* dictFileName, if (n!=0) EXM_THROW(5, "%s : flush error", dictFileName) } } - typedef struct { - U64 totalSizeToLoad; - unsigned oneSampleTooLarge; - unsigned nbSamples; + S64 totalSizeToLoad; + int nbSamples; + int oneSampleTooLarge; } fileStats; /*! DiB_fileStats() : @@ -235,48 +268,93 @@ typedef struct { * provides the amount of data to be loaded and the resulting nb of samples. * This is useful primarily for allocation purpose => sample buffer, and sample sizes table. */ -static fileStats DiB_fileStats(const char** fileNamesTable, unsigned nbFiles, size_t chunkSize, unsigned displayLevel) +static fileStats DiB_fileStats(const char** fileNamesTable, int nbFiles, size_t chunkSize, int displayLevel) { fileStats fs; - unsigned n; + int n; memset(&fs, 0, sizeof(fs)); + + /* We assume that if chunking is requested, the chunk size is < SAMPLESIZE_MAX */ + assert( chunkSize <= SAMPLESIZE_MAX ); + for (n=0; n 2*SAMPLESIZE_MAX); - fs.nbSamples += nbSamples; + S64 const fileSize = DiB_getFileSize(fileNamesTable[n]); + /* TODO: is there a minimum sample size? What if the file is 1-byte? */ + if (fileSize == 0) { + DISPLAYLEVEL(3, "Sample file '%s' has zero size, skipping...\n", fileNamesTable[n]); + continue; + } + + /* the case where we are breaking up files in sample chunks */ + if (chunkSize > 0) { + /* TODO: is there a minimum sample size? Can we have a 1-byte sample? */ + fs.nbSamples += (int)((fileSize + chunkSize-1) / chunkSize); + fs.totalSizeToLoad += fileSize; + } + else { + /* the case where one file is one sample */ + if (fileSize > SAMPLESIZE_MAX) { + /* flag excessively large sample files */ + fs.oneSampleTooLarge |= (fileSize > 2*SAMPLESIZE_MAX); + + /* Limit to the first SAMPLESIZE_MAX (128kB) of the file */ + DISPLAYLEVEL(3, "Sample file '%s' is too large, limiting to %d KB", + fileNamesTable[n], SAMPLESIZE_MAX / (1 KB)); + } + fs.nbSamples += 1; + fs.totalSizeToLoad += MIN(fileSize, SAMPLESIZE_MAX); + } } - DISPLAYLEVEL(4, "Preparing to load : %u KB \n", (unsigned)(fs.totalSizeToLoad >> 10)); + DISPLAYLEVEL(4, "Found training data %d files, %d KB, %d samples\n", nbFiles, (int)(fs.totalSizeToLoad / (1 KB)), fs.nbSamples); return fs; } - -int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize, - const char** fileNamesTable, unsigned nbFiles, size_t chunkSize, +int DiB_trainFromFiles(const char* dictFileName, size_t maxDictSize, + const char** fileNamesTable, int nbFiles, size_t chunkSize, ZDICT_legacy_params_t* params, ZDICT_cover_params_t* coverParams, - ZDICT_fastCover_params_t* fastCoverParams, int optimize) + ZDICT_fastCover_params_t* fastCoverParams, int optimize, unsigned memLimit) { - unsigned const displayLevel = params ? params->zParams.notificationLevel : - coverParams ? coverParams->zParams.notificationLevel : - fastCoverParams ? fastCoverParams->zParams.notificationLevel : - 0; /* should never happen */ + fileStats fs; + size_t* sampleSizes; /* vector of sample sizes. Each sample can be up to SAMPLESIZE_MAX */ + int nbSamplesLoaded; /* nb of samples effectively loaded in srcBuffer */ + size_t loadedSize; /* total data loaded in srcBuffer for all samples */ + void* srcBuffer /* contiguous buffer with training data/samples */; void* const dictBuffer = malloc(maxDictSize); - fileStats const fs = DiB_fileStats(fileNamesTable, nbFiles, chunkSize, displayLevel); - size_t* const sampleSizes = (size_t*)malloc(fs.nbSamples * sizeof(size_t)); - size_t const memMult = params ? MEMMULT : - coverParams ? COVER_MEMMULT: - FASTCOVER_MEMMULT; - size_t const maxMem = DiB_findMaxMem(fs.totalSizeToLoad * memMult) / memMult; - size_t loadedSize = (size_t) MIN ((unsigned long long)maxMem, fs.totalSizeToLoad); - void* const srcBuffer = malloc(loadedSize+NOISELENGTH); int result = 0; + int const displayLevel = params ? params->zParams.notificationLevel : + coverParams ? coverParams->zParams.notificationLevel : + fastCoverParams ? fastCoverParams->zParams.notificationLevel : 0; + + /* Shuffle input files before we start assessing how much sample datA to load. + The purpose of the shuffle is to pick random samples when the sample + set is larger than what we can load in memory. */ + DISPLAYLEVEL(3, "Shuffling input files\n"); + DiB_shuffle(fileNamesTable, nbFiles); + + /* Figure out how much sample data to load with how many samples */ + fs = DiB_fileStats(fileNamesTable, nbFiles, chunkSize, displayLevel); + + { + int const memMult = params ? MEMMULT : + coverParams ? COVER_MEMMULT: + FASTCOVER_MEMMULT; + size_t const maxMem = DiB_findMaxMem(fs.totalSizeToLoad * memMult) / memMult; + /* Limit the size of the training data to the free memory */ + /* Limit the size of the training data to 2GB */ + /* TODO: there is opportunity to stop DiB_fileStats() early when the data limit is reached */ + loadedSize = (size_t)MIN( MIN((S64)maxMem, fs.totalSizeToLoad), MAX_SAMPLES_SIZE ); + if (memLimit != 0) { + DISPLAYLEVEL(2, "! Warning : setting manual memory limit for dictionary training data at %u MB \n", + (unsigned)(memLimit / (1 MB))); + loadedSize = (size_t)MIN(loadedSize, memLimit); + } + srcBuffer = malloc(loadedSize+NOISELENGTH); + sampleSizes = (size_t*)malloc(fs.nbSamples * sizeof(size_t)); + } + /* Checks */ - if ((!sampleSizes) || (!srcBuffer) || (!dictBuffer)) + if ((fs.nbSamples && !sampleSizes) || (!srcBuffer) || (!dictBuffer)) EXM_THROW(12, "not enough memory for DiB_trainFiles"); /* should not happen */ if (fs.oneSampleTooLarge) { DISPLAYLEVEL(2, "! Warning : some sample(s) are very large \n"); @@ -289,31 +367,32 @@ int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize, DISPLAYLEVEL(2, "! Alternatively, split files into fixed-size blocks representative of samples, with -B# \n"); EXM_THROW(14, "nb of samples too low"); /* we now clearly forbid this case */ } - if (fs.totalSizeToLoad < (unsigned long long)maxDictSize * 8) { + if (fs.totalSizeToLoad < (S64)maxDictSize * 8) { DISPLAYLEVEL(2, "! Warning : data size of samples too small for target dictionary size \n"); DISPLAYLEVEL(2, "! Samples should be about 100x larger than target dictionary size \n"); } /* init */ - if (loadedSize < fs.totalSizeToLoad) - DISPLAYLEVEL(1, "Not enough memory; training on %u MB only...\n", (unsigned)(loadedSize >> 20)); + if ((S64)loadedSize < fs.totalSizeToLoad) + DISPLAYLEVEL(1, "Training samples set too large (%u MB); training on %u MB only...\n", + (unsigned)(fs.totalSizeToLoad / (1 MB)), + (unsigned)(loadedSize / (1 MB))); /* Load input buffer */ - DISPLAYLEVEL(3, "Shuffling input files\n"); - DiB_shuffle(fileNamesTable, nbFiles); + nbSamplesLoaded = DiB_loadFiles( + srcBuffer, &loadedSize, sampleSizes, fs.nbSamples, fileNamesTable, + nbFiles, chunkSize, displayLevel); - DiB_loadFiles(srcBuffer, &loadedSize, sampleSizes, fs.nbSamples, fileNamesTable, nbFiles, chunkSize, displayLevel); - - { size_t dictSize; + { size_t dictSize = ZSTD_error_GENERIC; if (params) { DiB_fillNoise((char*)srcBuffer + loadedSize, NOISELENGTH); /* guard band, for end of buffer condition */ dictSize = ZDICT_trainFromBuffer_legacy(dictBuffer, maxDictSize, - srcBuffer, sampleSizes, fs.nbSamples, + srcBuffer, sampleSizes, nbSamplesLoaded, *params); } else if (coverParams) { if (optimize) { dictSize = ZDICT_optimizeTrainFromBuffer_cover(dictBuffer, maxDictSize, - srcBuffer, sampleSizes, fs.nbSamples, + srcBuffer, sampleSizes, nbSamplesLoaded, coverParams); if (!ZDICT_isError(dictSize)) { unsigned splitPercentage = (unsigned)(coverParams->splitPoint * 100); @@ -322,13 +401,12 @@ int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize, } } else { dictSize = ZDICT_trainFromBuffer_cover(dictBuffer, maxDictSize, srcBuffer, - sampleSizes, fs.nbSamples, *coverParams); + sampleSizes, nbSamplesLoaded, *coverParams); } - } else { - assert(fastCoverParams != NULL); + } else if (fastCoverParams != NULL) { if (optimize) { dictSize = ZDICT_optimizeTrainFromBuffer_fastCover(dictBuffer, maxDictSize, - srcBuffer, sampleSizes, fs.nbSamples, + srcBuffer, sampleSizes, nbSamplesLoaded, fastCoverParams); if (!ZDICT_isError(dictSize)) { unsigned splitPercentage = (unsigned)(fastCoverParams->splitPoint * 100); @@ -338,8 +416,10 @@ int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize, } } else { dictSize = ZDICT_trainFromBuffer_fastCover(dictBuffer, maxDictSize, srcBuffer, - sampleSizes, fs.nbSamples, *fastCoverParams); + sampleSizes, nbSamplesLoaded, *fastCoverParams); } + } else { + assert(0 /* Impossible */); } if (ZDICT_isError(dictSize)) { DISPLAYLEVEL(1, "dictionary training failed : %s \n", ZDICT_getErrorName(dictSize)); /* should not happen */ diff --git a/src/dependencies/zstd-1.5.0/programs/dibio.h b/src/dependencies/zstd-1.5.4/programs/dibio.h similarity index 83% rename from src/dependencies/zstd-1.5.0/programs/dibio.h rename to src/dependencies/zstd-1.5.4/programs/dibio.h index f65ed9b..a96104c 100644 --- a/src/dependencies/zstd-1.5.0/programs/dibio.h +++ b/src/dependencies/zstd-1.5.4/programs/dibio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -31,9 +31,9 @@ `parameters` is optional and can be provided with values set to 0, meaning "default". @return : 0 == ok. Any other : error. */ -int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize, - const char** fileNamesTable, unsigned nbFiles, size_t chunkSize, +int DiB_trainFromFiles(const char* dictFileName, size_t maxDictSize, + const char** fileNamesTable, int nbFiles, size_t chunkSize, ZDICT_legacy_params_t* params, ZDICT_cover_params_t* coverParams, - ZDICT_fastCover_params_t* fastCoverParams, int optimize); + ZDICT_fastCover_params_t* fastCoverParams, int optimize, unsigned memLimit); #endif diff --git a/src/dependencies/zstd-1.5.0/programs/fileio.c b/src/dependencies/zstd-1.5.4/programs/fileio.c similarity index 65% rename from src/dependencies/zstd-1.5.0/programs/fileio.c rename to src/dependencies/zstd-1.5.4/programs/fileio.c index 5693ac3..9a8300c 100644 --- a/src/dependencies/zstd-1.5.0/programs/fileio.c +++ b/src/dependencies/zstd-1.5.4/programs/fileio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -28,6 +28,7 @@ #include /* fprintf, open, fdopen, fread, _fileno, stdin, stdout */ #include /* malloc, free */ #include /* strcmp, strlen */ +#include /* clock_t, to measure process time */ #include /* O_WRONLY */ #include #include /* errno */ @@ -40,8 +41,12 @@ # include #endif -#include "../lib/common/mem.h" /* U32, U64 */ #include "fileio.h" +#include "fileio_asyncio.h" +#include "fileio_common.h" + +FIO_display_prefs_t g_display_prefs = {2, FIO_ps_auto}; +UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER; #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_magicNumber, ZSTD_frameHeaderSize_max */ #include "../lib/zstd.h" @@ -65,6 +70,40 @@ # include #endif +char const* FIO_zlibVersion(void) +{ +#if defined(ZSTD_GZCOMPRESS) || defined(ZSTD_GZDECOMPRESS) + return zlibVersion(); +#else + return "Unsupported"; +#endif +} + +char const* FIO_lz4Version(void) +{ +#if defined(ZSTD_LZ4COMPRESS) || defined(ZSTD_LZ4DECOMPRESS) + /* LZ4_versionString() added in v1.7.3 */ +# if LZ4_VERSION_NUMBER >= 10703 + return LZ4_versionString(); +# else +# define ZSTD_LZ4_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE +# define ZSTD_LZ4_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LZ4_VERSION) + return ZSTD_LZ4_VERSION_STRING; +# endif +#else + return "Unsupported"; +#endif +} + +char const* FIO_lzmaVersion(void) +{ +#if defined(ZSTD_LZMACOMPRESS) || defined(ZSTD_LZMADECOMPRESS) + return lzma_version_string(); +#else + return "Unsupported"; +#endif +} + /*-************************************* * Constants @@ -75,69 +114,17 @@ #define FNSPACE 30 /* Default file permissions 0666 (modulated by umask) */ +/* Temporary restricted file permissions are used when we're going to + * chmod/chown at the end of the operation. */ #if !defined(_WIN32) /* These macros aren't defined on windows. */ #define DEFAULT_FILE_PERMISSIONS (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) +#define TEMPORARY_FILE_PERMISSIONS (S_IRUSR|S_IWUSR) #else #define DEFAULT_FILE_PERMISSIONS (0666) +#define TEMPORARY_FILE_PERMISSIONS (0600) #endif -/*-************************************* -* Macros -***************************************/ -#define KB *(1 <<10) -#define MB *(1 <<20) -#define GB *(1U<<30) -#undef MAX -#define MAX(a,b) ((a)>(b) ? (a) : (b)) - -struct FIO_display_prefs_s { - int displayLevel; /* 0 : no display; 1: errors; 2: + result + interaction + warnings; 3: + progression; 4: + information */ - FIO_progressSetting_e progressSetting; -}; - -static FIO_display_prefs_t g_display_prefs = {2, FIO_ps_auto}; - -#define DISPLAY(...) fprintf(stderr, __VA_ARGS__) -#define DISPLAYOUT(...) fprintf(stdout, __VA_ARGS__) -#define DISPLAYLEVEL(l, ...) { if (g_display_prefs.displayLevel>=l) { DISPLAY(__VA_ARGS__); } } - -static const U64 g_refreshRate = SEC_TO_MICRO / 6; -static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER; - -#define READY_FOR_UPDATE() ((g_display_prefs.progressSetting != FIO_ps_never) && UTIL_clockSpanMicro(g_displayClock) > g_refreshRate) -#define DELAY_NEXT_UPDATE() { g_displayClock = UTIL_getTime(); } -#define DISPLAYUPDATE(l, ...) { \ - if (g_display_prefs.displayLevel>=l && (g_display_prefs.progressSetting != FIO_ps_never)) { \ - if (READY_FOR_UPDATE() || (g_display_prefs.displayLevel>=4)) { \ - DELAY_NEXT_UPDATE(); \ - DISPLAY(__VA_ARGS__); \ - if (g_display_prefs.displayLevel>=4) fflush(stderr); \ - } } } - -#undef MIN /* in case it would be already defined */ -#define MIN(a,b) ((a) < (b) ? (a) : (b)) - - -#define EXM_THROW(error, ...) \ -{ \ - DISPLAYLEVEL(1, "zstd: "); \ - DISPLAYLEVEL(5, "Error defined at %s, line %i : \n", __FILE__, __LINE__); \ - DISPLAYLEVEL(1, "error %i : ", error); \ - DISPLAYLEVEL(1, __VA_ARGS__); \ - DISPLAYLEVEL(1, " \n"); \ - exit(error); \ -} - -#define CHECK_V(v, f) \ - v = f; \ - if (ZSTD_isError(v)) { \ - DISPLAYLEVEL(5, "%s \n", #f); \ - EXM_THROW(11, "%s", ZSTD_getErrorName(v)); \ - } -#define CHECK(f) { size_t err; CHECK_V(err, f); } - - /*-************************************ * Signal (Ctrl-C trapping) **************************************/ @@ -237,7 +224,7 @@ static void ABRThandler(int sig) { } #endif -void FIO_addAbortHandler() +void FIO_addAbortHandler(void) { #if BACKTRACE_ENABLE signal(SIGABRT, ABRThandler); @@ -248,94 +235,6 @@ void FIO_addAbortHandler() #endif } - -/*-************************************************************ -* Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW -***************************************************************/ -#if defined(_MSC_VER) && _MSC_VER >= 1400 -# define LONG_SEEK _fseeki64 -# define LONG_TELL _ftelli64 -#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */ -# define LONG_SEEK fseeko -# define LONG_TELL ftello -#elif defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__) -# define LONG_SEEK fseeko64 -# define LONG_TELL ftello64 -#elif defined(_WIN32) && !defined(__DJGPP__) -# include - static int LONG_SEEK(FILE* file, __int64 offset, int origin) { - LARGE_INTEGER off; - DWORD method; - off.QuadPart = offset; - if (origin == SEEK_END) - method = FILE_END; - else if (origin == SEEK_CUR) - method = FILE_CURRENT; - else - method = FILE_BEGIN; - - if (SetFilePointerEx((HANDLE) _get_osfhandle(_fileno(file)), off, NULL, method)) - return 0; - else - return -1; - } - static __int64 LONG_TELL(FILE* file) { - LARGE_INTEGER off, newOff; - off.QuadPart = 0; - newOff.QuadPart = 0; - SetFilePointerEx((HANDLE) _get_osfhandle(_fileno(file)), off, &newOff, FILE_CURRENT); - return newOff.QuadPart; - } -#else -# define LONG_SEEK fseek -# define LONG_TELL ftell -#endif - - -/*-************************************* -* Parameters: FIO_prefs_t -***************************************/ - -/* typedef'd to FIO_prefs_t within fileio.h */ -struct FIO_prefs_s { - - /* Algorithm preferences */ - FIO_compressionType_t compressionType; - U32 sparseFileSupport; /* 0: no sparse allowed; 1: auto (file yes, stdout no); 2: force sparse */ - int dictIDFlag; - int checksumFlag; - int blockSize; - int overlapLog; - U32 adaptiveMode; - U32 useRowMatchFinder; - int rsyncable; - int minAdaptLevel; - int maxAdaptLevel; - int ldmFlag; - int ldmHashLog; - int ldmMinMatch; - int ldmBucketSizeLog; - int ldmHashRateLog; - size_t streamSrcSize; - size_t targetCBlockSize; - int srcSizeHint; - int testMode; - ZSTD_literalCompressionMode_e literalCompressionMode; - - /* IO preferences */ - U32 removeSrcFile; - U32 overwrite; - - /* Computation resources preferences */ - unsigned memLimit; - int nbWorkers; - - int excludeCompressedFiles; - int patchFromMode; - int contentSize; - int allowBlockDevices; -}; - /*-************************************* * Parameters: FIO_ctx_t ***************************************/ @@ -355,6 +254,18 @@ struct FIO_ctx_s { size_t totalBytesOutput; }; +static int FIO_shouldDisplayFileSummary(FIO_ctx_t const* fCtx) +{ + return fCtx->nbFilesTotal <= 1 || g_display_prefs.displayLevel >= 3; +} + +static int FIO_shouldDisplayMultipleFileSummary(FIO_ctx_t const* fCtx) +{ + int const shouldDisplay = (fCtx->nbFilesProcessed >= 1 && fCtx->nbFilesTotal > 1); + assert(shouldDisplay || FIO_shouldDisplayFileSummary(fCtx) || fCtx->nbFilesProcessed == 0); + return shouldDisplay; +} + /*-************************************* * Parameters: Initialization @@ -392,9 +303,11 @@ FIO_prefs_t* FIO_createPreferences(void) ret->targetCBlockSize = 0; ret->srcSizeHint = 0; ret->testMode = 0; - ret->literalCompressionMode = ZSTD_lcm_auto; + ret->literalCompressionMode = ZSTD_ps_auto; ret->excludeCompressedFiles = 0; ret->allowBlockDevices = 0; + ret->asyncIO = AIO_supported(); + ret->passThrough = -1; return ret; } @@ -443,13 +356,13 @@ void FIO_setCompressionType(FIO_prefs_t* const prefs, FIO_compressionType_t comp void FIO_overwriteMode(FIO_prefs_t* const prefs) { prefs->overwrite = 1; } -void FIO_setSparseWrite(FIO_prefs_t* const prefs, unsigned sparse) { prefs->sparseFileSupport = sparse; } +void FIO_setSparseWrite(FIO_prefs_t* const prefs, int sparse) { prefs->sparseFileSupport = sparse; } void FIO_setDictIDFlag(FIO_prefs_t* const prefs, int dictIDFlag) { prefs->dictIDFlag = dictIDFlag; } void FIO_setChecksumFlag(FIO_prefs_t* const prefs, int checksumFlag) { prefs->checksumFlag = checksumFlag; } -void FIO_setRemoveSrcFile(FIO_prefs_t* const prefs, unsigned flag) { prefs->removeSrcFile = (flag>0); } +void FIO_setRemoveSrcFile(FIO_prefs_t* const prefs, int flag) { prefs->removeSrcFile = (flag!=0); } void FIO_setMemLimit(FIO_prefs_t* const prefs, unsigned memLimit) { prefs->memLimit = memLimit; } @@ -476,7 +389,7 @@ void FIO_setOverlapLog(FIO_prefs_t* const prefs, int overlapLog){ prefs->overlapLog = overlapLog; } -void FIO_setAdaptiveMode(FIO_prefs_t* const prefs, unsigned adapt) { +void FIO_setAdaptiveMode(FIO_prefs_t* const prefs, int adapt) { if ((adapt>0) && (prefs->nbWorkers==0)) EXM_THROW(1, "Adaptive mode is not compatible with single thread mode \n"); prefs->adaptiveMode = adapt; @@ -510,7 +423,7 @@ void FIO_setTestMode(FIO_prefs_t* const prefs, int testMode) { void FIO_setLiteralCompressionMode( FIO_prefs_t* const prefs, - ZSTD_literalCompressionMode_e mode) { + ZSTD_paramSwitch_e mode) { prefs->literalCompressionMode = mode; } @@ -558,6 +471,20 @@ void FIO_setContentSize(FIO_prefs_t* const prefs, int value) prefs->contentSize = value != 0; } +void FIO_setAsyncIOFlag(FIO_prefs_t* const prefs, int value) { +#ifdef ZSTD_MULTITHREAD + prefs->asyncIO = value; +#else + (void) prefs; + (void) value; + DISPLAYLEVEL(2, "Note : asyncio is disabled (lack of multithreading support) \n"); +#endif +} + +void FIO_setPassThroughFlag(FIO_prefs_t* const prefs, int value) { + prefs->passThrough = (value != 0); +} + /* FIO_ctx_t functions */ void FIO_setHasStdoutOutput(FIO_ctx_t* const fCtx, int value) { @@ -608,26 +535,26 @@ static int FIO_removeFile(const char* path) /** FIO_openSrcFile() : * condition : `srcFileName` must be non-NULL. `prefs` may be NULL. * @result : FILE* to `srcFileName`, or NULL if it fails */ -static FILE* FIO_openSrcFile(const FIO_prefs_t* const prefs, const char* srcFileName) +static FILE* FIO_openSrcFile(const FIO_prefs_t* const prefs, const char* srcFileName, stat_t* statbuf) { - stat_t statbuf; int allowBlockDevices = prefs != NULL ? prefs->allowBlockDevices : 0; assert(srcFileName != NULL); + assert(statbuf != NULL); if (!strcmp (srcFileName, stdinmark)) { DISPLAYLEVEL(4,"Using stdin for input \n"); SET_BINARY_MODE(stdin); return stdin; } - if (!UTIL_stat(srcFileName, &statbuf)) { + if (!UTIL_stat(srcFileName, statbuf)) { DISPLAYLEVEL(1, "zstd: can't stat %s : %s -- ignored \n", srcFileName, strerror(errno)); return NULL; } - if (!UTIL_isRegularFileStat(&statbuf) - && !UTIL_isFIFOStat(&statbuf) - && !(allowBlockDevices && UTIL_isBlockDevStat(&statbuf)) + if (!UTIL_isRegularFileStat(statbuf) + && !UTIL_isFIFOStat(statbuf) + && !(allowBlockDevices && UTIL_isBlockDevStat(statbuf)) ) { DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n", srcFileName); @@ -685,7 +612,7 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs, if (!prefs->overwrite) { if (g_display_prefs.displayLevel <= 1) { /* No interaction possible */ - DISPLAY("zstd: %s already exists; not overwritten \n", + DISPLAYLEVEL(1, "zstd: %s already exists; not overwritten \n", dstFileName); return NULL; } @@ -718,6 +645,17 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs, if (f == NULL) { DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno)); } + /* An increased buffer size can provide a significant performance boost on some platforms. + * Note that providing a NULL buf with a size that's not 0 is not defined in ANSI C, but is defined + * in an extension. There are three possibilities here - + * 1. Libc supports the extended version and everything is good. + * 2. Libc ignores the size when buf is NULL, in which case everything will continue as if we didn't + * call `setvbuf`. + * 3. We fail the call and execution continues but a warning message might be shown. + * In all cases due execution continues. For now, I believe that this is a more cost-effective + * solution than managing the buffers allocations ourselves (will require an API change). */ + if(setvbuf(f, NULL, _IOFBF, 1 MB)) + DISPLAYLEVEL(2, "Warning: setvbuf failed for %s\n", dstFileName); return f; } } @@ -728,33 +666,47 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs, * @return : loaded size * if fileName==NULL, returns 0 and a NULL pointer */ -static size_t FIO_createDictBuffer(void** bufferPtr, const char* fileName, FIO_prefs_t* const prefs) +static size_t FIO_createDictBuffer(void** bufferPtr, const char* fileName, FIO_prefs_t* const prefs, stat_t* dictFileStat) { FILE* fileHandle; U64 fileSize; assert(bufferPtr != NULL); + assert(dictFileStat != NULL); *bufferPtr = NULL; if (fileName == NULL) return 0; DISPLAYLEVEL(4,"Loading %s as dictionary \n", fileName); - fileHandle = fopen(fileName, "rb"); - if (fileHandle==NULL) EXM_THROW(31, "%s: %s", fileName, strerror(errno)); - fileSize = UTIL_getFileSize(fileName); + if (!UTIL_stat(fileName, dictFileStat)) { + EXM_THROW(31, "Stat failed on dictionary file %s: %s", fileName, strerror(errno)); + } + + if (!UTIL_isRegularFileStat(dictFileStat)) { + EXM_THROW(32, "Dictionary %s must be a regular file.", fileName); + } + + fileHandle = fopen(fileName, "rb"); + + if (fileHandle == NULL) { + EXM_THROW(33, "Couldn't open dictionary %s: %s", fileName, strerror(errno)); + } + + fileSize = UTIL_getFileSizeStat(dictFileStat); { size_t const dictSizeMax = prefs->patchFromMode ? prefs->memLimit : DICTSIZE_MAX; if (fileSize > dictSizeMax) { - EXM_THROW(32, "Dictionary file %s is too large (> %u bytes)", + EXM_THROW(34, "Dictionary file %s is too large (> %u bytes)", fileName, (unsigned)dictSizeMax); /* avoid extreme cases */ } } *bufferPtr = malloc((size_t)fileSize); if (*bufferPtr==NULL) EXM_THROW(34, "%s", strerror(errno)); { size_t const readSize = fread(*bufferPtr, 1, (size_t)fileSize, fileHandle); - if (readSize != fileSize) + if (readSize != fileSize) { EXM_THROW(35, "Error reading dictionary file %s : %s", fileName, strerror(errno)); + } } fclose(fileHandle); return (size_t)fileSize; @@ -771,7 +723,7 @@ int FIO_checkFilenameCollisions(const char** filenameTable, unsigned nbFiles) { filenameTableSorted = (const char**) malloc(sizeof(char*) * nbFiles); if (!filenameTableSorted) { - DISPLAY("Unable to malloc new str array, not checking for name collisions\n"); + DISPLAYLEVEL(1, "Allocation error during filename collision checking \n"); return 1; } @@ -788,7 +740,7 @@ int FIO_checkFilenameCollisions(const char** filenameTable, unsigned nbFiles) { prevElem = filenameTableSorted[0]; for (u = 1; u < nbFiles; ++u) { if (strcmp(prevElem, filenameTableSorted[u]) == 0) { - DISPLAY("WARNING: Two files have same filename: %s\n", prevElem); + DISPLAYLEVEL(2, "WARNING: Two files have same filename: %s\n", prevElem); } prevElem = filenameTableSorted[u]; } @@ -871,46 +823,89 @@ static void FIO_adjustMemLimitForPatchFromMode(FIO_prefs_t* const prefs, FIO_setMemLimit(prefs, (unsigned)maxSize); } -/* FIO_removeMultiFilesWarning() : +/* FIO_multiFilesConcatWarning() : + * This function handles logic when processing multiple files with -o or -c, displaying the appropriate warnings/prompts. * Returns 1 if the console should abort, 0 if console should proceed. - * This function handles logic when processing multiple files with -o, displaying the appropriate warnings/prompts. * - * If -f is specified, or there is just 1 file, zstd will always proceed as usual. - * If --rm is specified, there will be a prompt asking for user confirmation. - * If -f is specified with --rm, zstd will proceed as usual - * If -q is specified with --rm, zstd will abort pre-emptively - * If neither flag is specified, zstd will prompt the user for confirmation to proceed. - * If --rm is not specified, then zstd will print a warning to the user (which can be silenced with -q). - * However, if the output is stdout, we will always abort rather than displaying the warning prompt. + * If output is stdout or test mode is active, check that `--rm` disabled. + * + * If there is just 1 file to process, zstd will proceed as usual. + * If each file get processed into its own separate destination file, proceed as usual. + * + * When multiple files are processed into a single output, + * display a warning message, then disable --rm if it's set. + * + * If -f is specified or if output is stdout, just proceed. + * If output is set with -o, prompt for confirmation. */ -static int FIO_removeMultiFilesWarning(FIO_ctx_t* const fCtx, const FIO_prefs_t* const prefs, const char* outFileName, int displayLevelCutoff) +static int FIO_multiFilesConcatWarning(const FIO_ctx_t* fCtx, FIO_prefs_t* prefs, const char* outFileName, int displayLevelCutoff) { - int error = 0; - if (fCtx->nbFilesTotal > 1 && !prefs->overwrite) { - if (g_display_prefs.displayLevel <= displayLevelCutoff) { - if (prefs->removeSrcFile) { - DISPLAYLEVEL(1, "zstd: Aborting... not deleting files and processing into dst: %s", outFileName); - error = 1; - } - } else { - if (!strcmp(outFileName, stdoutmark)) { - DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into stdout. "); - } else { - DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into a single output file: %s ", outFileName); - } - DISPLAYLEVEL(2, "\nThe concatenated output CANNOT regenerate the original directory tree. ") - if (prefs->removeSrcFile) { - if (fCtx->hasStdoutOutput) { - DISPLAYLEVEL(1, "\nAborting. Use -f if you really want to delete the files and output to stdout"); - error = 1; - } else { - error = g_display_prefs.displayLevel > displayLevelCutoff && UTIL_requireUserConfirmation("This is a destructive operation. Proceed? (y/n): ", "Aborting...", "yY", fCtx->hasStdinInput); - } - } - } - DISPLAY("\n"); + if (fCtx->hasStdoutOutput) { + if (prefs->removeSrcFile) + /* this should not happen ; hard fail, to protect user's data + * note: this should rather be an assert(), but we want to be certain that user's data will not be wiped out in case it nonetheless happen */ + EXM_THROW(43, "It's not allowed to remove input files when processed output is piped to stdout. " + "This scenario is not supposed to be possible. " + "This is a programming error. File an issue for it to be fixed."); } - return error; + if (prefs->testMode) { + if (prefs->removeSrcFile) + /* this should not happen ; hard fail, to protect user's data + * note: this should rather be an assert(), but we want to be certain that user's data will not be wiped out in case it nonetheless happen */ + EXM_THROW(43, "Test mode shall not remove input files! " + "This scenario is not supposed to be possible. " + "This is a programming error. File an issue for it to be fixed."); + return 0; + } + + if (fCtx->nbFilesTotal == 1) return 0; + assert(fCtx->nbFilesTotal > 1); + + if (!outFileName) return 0; + + if (fCtx->hasStdoutOutput) { + DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into stdout. \n"); + } else { + DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into a single output file: %s \n", outFileName); + } + DISPLAYLEVEL(2, "The concatenated output CANNOT regenerate original file names nor directory structure. \n") + + /* multi-input into single output : --rm is not allowed */ + if (prefs->removeSrcFile) { + DISPLAYLEVEL(2, "Since it's a destructive operation, input files will not be removed. \n"); + prefs->removeSrcFile = 0; + } + + if (fCtx->hasStdoutOutput) return 0; + if (prefs->overwrite) return 0; + + /* multiple files concatenated into single destination file using -o without -f */ + if (g_display_prefs.displayLevel <= displayLevelCutoff) { + /* quiet mode => no prompt => fail automatically */ + DISPLAYLEVEL(1, "Concatenating multiple processed inputs into a single output loses file metadata. \n"); + DISPLAYLEVEL(1, "Aborting. \n"); + return 1; + } + /* normal mode => prompt */ + return UTIL_requireUserConfirmation("Proceed? (y/n): ", "Aborting...", "yY", fCtx->hasStdinInput); +} + +static ZSTD_inBuffer setInBuffer(const void* buf, size_t s, size_t pos) +{ + ZSTD_inBuffer i; + i.src = buf; + i.size = s; + i.pos = pos; + return i; +} + +static ZSTD_outBuffer setOutBuffer(void* buf, size_t s, size_t pos) +{ + ZSTD_outBuffer o; + o.dst = buf; + o.size = s; + o.pos = pos; + return o; } #ifndef ZSTD_NOCOMPRESS @@ -919,16 +914,13 @@ static int FIO_removeMultiFilesWarning(FIO_ctx_t* const fCtx, const FIO_prefs_t* * Compression ************************************************************************/ typedef struct { - FILE* srcFile; - FILE* dstFile; - void* srcBuffer; - size_t srcBufferSize; - void* dstBuffer; - size_t dstBufferSize; void* dictBuffer; size_t dictBufferSize; const char* dictFileName; + stat_t dictFileStat; ZSTD_CStream* cctx; + WritePoolCtx_t *writeCtx; + ReadPoolCtx_t *readCtx; } cRess_t; /** ZSTD_cycleLog() : @@ -960,9 +952,9 @@ static void FIO_adjustParamsForPatchFromMode(FIO_prefs_t* const prefs, if (cParams.strategy >= ZSTD_btopt) { DISPLAYLEVEL(1, "[Optimal parser notes] Consider the following to improve patch size at the cost of speed:\n"); DISPLAYLEVEL(1, "- Use --single-thread mode in the zstd cli\n"); - DISPLAYLEVEL(1, "- Set a larger targetLength (eg. --zstd=targetLength=4096)\n"); - DISPLAYLEVEL(1, "- Set a larger chainLog (eg. --zstd=chainLog=%u)\n", ZSTD_CHAINLOG_MAX); - DISPLAYLEVEL(1, "Also consdier playing around with searchLog and hashLog\n"); + DISPLAYLEVEL(1, "- Set a larger targetLength (e.g. --zstd=targetLength=4096)\n"); + DISPLAYLEVEL(1, "- Set a larger chainLog (e.g. --zstd=chainLog=%u)\n", ZSTD_CHAINLOG_MAX); + DISPLAYLEVEL(1, "Also consider playing around with searchLog and hashLog\n"); } } @@ -977,9 +969,6 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs, if (ress.cctx == NULL) EXM_THROW(30, "allocation error (%s): can't create ZSTD_CCtx", strerror(errno)); - ress.srcBufferSize = ZSTD_CStreamInSize(); - ress.srcBuffer = malloc(ress.srcBufferSize); - ress.dstBufferSize = ZSTD_CStreamOutSize(); /* need to update memLimit before calling createDictBuffer * because of memLimit check inside it */ @@ -987,10 +976,10 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs, unsigned long long const ssSize = (unsigned long long)prefs->streamSrcSize; FIO_adjustParamsForPatchFromMode(prefs, &comprParams, UTIL_getFileSize(dictFileName), ssSize > 0 ? ssSize : maxSrcFileSize, cLevel); } - ress.dstBuffer = malloc(ress.dstBufferSize); - ress.dictBufferSize = FIO_createDictBuffer(&ress.dictBuffer, dictFileName, prefs); /* works with dictFileName==NULL */ - if (!ress.srcBuffer || !ress.dstBuffer) - EXM_THROW(31, "allocation error : not enough memory"); + ress.dictBufferSize = FIO_createDictBuffer(&ress.dictBuffer, dictFileName, prefs, &ress.dictFileStat); /* works with dictFileName==NULL */ + + ress.writeCtx = AIO_WritePool_create(prefs, ZSTD_CStreamOutSize()); + ress.readCtx = AIO_ReadPool_create(prefs, ZSTD_CStreamInSize()); /* Advanced parameters, including dictionary */ if (dictFileName && (ress.dictBuffer==NULL)) @@ -1053,9 +1042,9 @@ static cRess_t FIO_createCResources(FIO_prefs_t* const prefs, static void FIO_freeCResources(const cRess_t* const ress) { - free(ress->srcBuffer); - free(ress->dstBuffer); free(ress->dictBuffer); + AIO_WritePool_free(ress->writeCtx); + AIO_ReadPool_free(ress->readCtx); ZSTD_freeCStream(ress->cctx); /* never fails */ } @@ -1068,6 +1057,7 @@ FIO_compressGzFrame(const cRess_t* ress, /* buffers & handlers are used, but no { unsigned long long inFileSize = 0, outFileSize = 0; z_stream strm; + IOJob_t *writeJob = NULL; if (compressionLevel > Z_BEST_COMPRESSION) compressionLevel = Z_BEST_COMPRESSION; @@ -1078,56 +1068,65 @@ FIO_compressGzFrame(const cRess_t* ress, /* buffers & handlers are used, but no { int const ret = deflateInit2(&strm, compressionLevel, Z_DEFLATED, 15 /* maxWindowLogSize */ + 16 /* gzip only */, - 8, Z_DEFAULT_STRATEGY); /* see http://www.zlib.net/manual.html */ + 8, Z_DEFAULT_STRATEGY); /* see https://www.zlib.net/manual.html */ if (ret != Z_OK) { EXM_THROW(71, "zstd: %s: deflateInit2 error %d \n", srcFileName, ret); } } + writeJob = AIO_WritePool_acquireJob(ress->writeCtx); strm.next_in = 0; strm.avail_in = 0; - strm.next_out = (Bytef*)ress->dstBuffer; - strm.avail_out = (uInt)ress->dstBufferSize; + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = (uInt)writeJob->bufferSize; while (1) { int ret; if (strm.avail_in == 0) { - size_t const inSize = fread(ress->srcBuffer, 1, ress->srcBufferSize, ress->srcFile); - if (inSize == 0) break; - inFileSize += inSize; - strm.next_in = (z_const unsigned char*)ress->srcBuffer; - strm.avail_in = (uInt)inSize; + AIO_ReadPool_fillBuffer(ress->readCtx, ZSTD_CStreamInSize()); + if (ress->readCtx->srcBufferLoaded == 0) break; + inFileSize += ress->readCtx->srcBufferLoaded; + strm.next_in = (z_const unsigned char*)ress->readCtx->srcBuffer; + strm.avail_in = (uInt)ress->readCtx->srcBufferLoaded; } - ret = deflate(&strm, Z_NO_FLUSH); + + { + size_t const availBefore = strm.avail_in; + ret = deflate(&strm, Z_NO_FLUSH); + AIO_ReadPool_consumeBytes(ress->readCtx, availBefore - strm.avail_in); + } + if (ret != Z_OK) EXM_THROW(72, "zstd: %s: deflate error %d \n", srcFileName, ret); - { size_t const cSize = ress->dstBufferSize - strm.avail_out; + { size_t const cSize = writeJob->bufferSize - strm.avail_out; if (cSize) { - if (fwrite(ress->dstBuffer, 1, cSize, ress->dstFile) != cSize) - EXM_THROW(73, "Write error : cannot write to output file : %s ", strerror(errno)); + writeJob->usedBufferSize = cSize; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); outFileSize += cSize; - strm.next_out = (Bytef*)ress->dstBuffer; - strm.avail_out = (uInt)ress->dstBufferSize; - } } + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = (uInt)writeJob->bufferSize; + } } if (srcFileSize == UTIL_FILESIZE_UNKNOWN) { - DISPLAYUPDATE(2, "\rRead : %u MB ==> %.2f%% ", - (unsigned)(inFileSize>>20), - (double)outFileSize/inFileSize*100) + DISPLAYUPDATE_PROGRESS( + "\rRead : %u MB ==> %.2f%% ", + (unsigned)(inFileSize>>20), + (double)outFileSize/(double)inFileSize*100) } else { - DISPLAYUPDATE(2, "\rRead : %u / %u MB ==> %.2f%% ", - (unsigned)(inFileSize>>20), (unsigned)(srcFileSize>>20), - (double)outFileSize/inFileSize*100); + DISPLAYUPDATE_PROGRESS( + "\rRead : %u / %u MB ==> %.2f%% ", + (unsigned)(inFileSize>>20), (unsigned)(srcFileSize>>20), + (double)outFileSize/(double)inFileSize*100); } } while (1) { int const ret = deflate(&strm, Z_FINISH); - { size_t const cSize = ress->dstBufferSize - strm.avail_out; + { size_t const cSize = writeJob->bufferSize - strm.avail_out; if (cSize) { - if (fwrite(ress->dstBuffer, 1, cSize, ress->dstFile) != cSize) - EXM_THROW(75, "Write error : %s ", strerror(errno)); + writeJob->usedBufferSize = cSize; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); outFileSize += cSize; - strm.next_out = (Bytef*)ress->dstBuffer; - strm.avail_out = (uInt)ress->dstBufferSize; - } } + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = (uInt)writeJob->bufferSize; + } } if (ret == Z_STREAM_END) break; if (ret != Z_BUF_ERROR) EXM_THROW(77, "zstd: %s: deflate error %d \n", srcFileName, ret); @@ -1138,6 +1137,8 @@ FIO_compressGzFrame(const cRess_t* ress, /* buffers & handlers are used, but no EXM_THROW(79, "zstd: %s: deflateEnd error %d \n", srcFileName, ret); } } *readsize = inFileSize; + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); return outFileSize; } #endif @@ -1153,6 +1154,7 @@ FIO_compressLzmaFrame(cRess_t* ress, lzma_stream strm = LZMA_STREAM_INIT; lzma_action action = LZMA_RUN; lzma_ret ret; + IOJob_t *writeJob = NULL; if (compressionLevel < 0) compressionLevel = 0; if (compressionLevel > 9) compressionLevel = 9; @@ -1170,46 +1172,55 @@ FIO_compressLzmaFrame(cRess_t* ress, EXM_THROW(83, "zstd: %s: lzma_easy_encoder error %d", srcFileName, ret); } + writeJob =AIO_WritePool_acquireJob(ress->writeCtx); + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = (uInt)writeJob->bufferSize; strm.next_in = 0; strm.avail_in = 0; - strm.next_out = (BYTE*)ress->dstBuffer; - strm.avail_out = ress->dstBufferSize; while (1) { if (strm.avail_in == 0) { - size_t const inSize = fread(ress->srcBuffer, 1, ress->srcBufferSize, ress->srcFile); - if (inSize == 0) action = LZMA_FINISH; + size_t const inSize = AIO_ReadPool_fillBuffer(ress->readCtx, ZSTD_CStreamInSize()); + if (ress->readCtx->srcBufferLoaded == 0) action = LZMA_FINISH; inFileSize += inSize; - strm.next_in = (BYTE const*)ress->srcBuffer; - strm.avail_in = inSize; + strm.next_in = (BYTE const*)ress->readCtx->srcBuffer; + strm.avail_in = ress->readCtx->srcBufferLoaded; + } + + { + size_t const availBefore = strm.avail_in; + ret = lzma_code(&strm, action); + AIO_ReadPool_consumeBytes(ress->readCtx, availBefore - strm.avail_in); } - ret = lzma_code(&strm, action); if (ret != LZMA_OK && ret != LZMA_STREAM_END) EXM_THROW(84, "zstd: %s: lzma_code encoding error %d", srcFileName, ret); - { size_t const compBytes = ress->dstBufferSize - strm.avail_out; + { size_t const compBytes = writeJob->bufferSize - strm.avail_out; if (compBytes) { - if (fwrite(ress->dstBuffer, 1, compBytes, ress->dstFile) != compBytes) - EXM_THROW(85, "Write error : %s", strerror(errno)); + writeJob->usedBufferSize = compBytes; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); outFileSize += compBytes; - strm.next_out = (BYTE*)ress->dstBuffer; - strm.avail_out = ress->dstBufferSize; + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = writeJob->bufferSize; } } if (srcFileSize == UTIL_FILESIZE_UNKNOWN) - DISPLAYUPDATE(2, "\rRead : %u MB ==> %.2f%%", + DISPLAYUPDATE_PROGRESS("\rRead : %u MB ==> %.2f%%", (unsigned)(inFileSize>>20), - (double)outFileSize/inFileSize*100) + (double)outFileSize/(double)inFileSize*100) else - DISPLAYUPDATE(2, "\rRead : %u / %u MB ==> %.2f%%", + DISPLAYUPDATE_PROGRESS("\rRead : %u / %u MB ==> %.2f%%", (unsigned)(inFileSize>>20), (unsigned)(srcFileSize>>20), - (double)outFileSize/inFileSize*100); + (double)outFileSize/(double)inFileSize*100); if (ret == LZMA_STREAM_END) break; } lzma_end(&strm); *readsize = inFileSize; + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); + return outFileSize; } #endif @@ -1235,15 +1246,18 @@ FIO_compressLz4Frame(cRess_t* ress, LZ4F_preferences_t prefs; LZ4F_compressionContext_t ctx; + IOJob_t* writeJob = AIO_WritePool_acquireJob(ress->writeCtx); + LZ4F_errorCode_t const errorCode = LZ4F_createCompressionContext(&ctx, LZ4F_VERSION); if (LZ4F_isError(errorCode)) EXM_THROW(31, "zstd: failed to create lz4 compression context"); memset(&prefs, 0, sizeof(prefs)); - assert(blockSize <= ress->srcBufferSize); + assert(blockSize <= ress->readCtx->base.jobBufferSize); - prefs.autoFlush = 1; + /* autoflush off to mitigate a bug in lz4<=1.9.3 for compression level 12 */ + prefs.autoFlush = 0; prefs.compressionLevel = compressionLevel; prefs.frameInfo.blockMode = LZ4F_blockLinked; prefs.frameInfo.blockSizeID = LZ4F_max64KB; @@ -1251,75 +1265,68 @@ FIO_compressLz4Frame(cRess_t* ress, #if LZ4_VERSION_NUMBER >= 10600 prefs.frameInfo.contentSize = (srcFileSize==UTIL_FILESIZE_UNKNOWN) ? 0 : srcFileSize; #endif - assert(LZ4F_compressBound(blockSize, &prefs) <= ress->dstBufferSize); + assert(LZ4F_compressBound(blockSize, &prefs) <= writeJob->bufferSize); { - size_t readSize; - size_t headerSize = LZ4F_compressBegin(ctx, ress->dstBuffer, ress->dstBufferSize, &prefs); + size_t headerSize = LZ4F_compressBegin(ctx, writeJob->buffer, writeJob->bufferSize, &prefs); if (LZ4F_isError(headerSize)) EXM_THROW(33, "File header generation failed : %s", LZ4F_getErrorName(headerSize)); - if (fwrite(ress->dstBuffer, 1, headerSize, ress->dstFile) != headerSize) - EXM_THROW(34, "Write error : %s (cannot write header)", strerror(errno)); + writeJob->usedBufferSize = headerSize; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); outFileSize += headerSize; /* Read first block */ - readSize = fread(ress->srcBuffer, (size_t)1, (size_t)blockSize, ress->srcFile); - inFileSize += readSize; + inFileSize += AIO_ReadPool_fillBuffer(ress->readCtx, blockSize); /* Main Loop */ - while (readSize>0) { - size_t const outSize = LZ4F_compressUpdate(ctx, - ress->dstBuffer, ress->dstBufferSize, - ress->srcBuffer, readSize, NULL); + while (ress->readCtx->srcBufferLoaded) { + size_t inSize = MIN(blockSize, ress->readCtx->srcBufferLoaded); + size_t const outSize = LZ4F_compressUpdate(ctx, writeJob->buffer, writeJob->bufferSize, + ress->readCtx->srcBuffer, inSize, NULL); if (LZ4F_isError(outSize)) EXM_THROW(35, "zstd: %s: lz4 compression failed : %s", srcFileName, LZ4F_getErrorName(outSize)); outFileSize += outSize; if (srcFileSize == UTIL_FILESIZE_UNKNOWN) { - DISPLAYUPDATE(2, "\rRead : %u MB ==> %.2f%%", + DISPLAYUPDATE_PROGRESS("\rRead : %u MB ==> %.2f%%", (unsigned)(inFileSize>>20), - (double)outFileSize/inFileSize*100) + (double)outFileSize/(double)inFileSize*100) } else { - DISPLAYUPDATE(2, "\rRead : %u / %u MB ==> %.2f%%", + DISPLAYUPDATE_PROGRESS("\rRead : %u / %u MB ==> %.2f%%", (unsigned)(inFileSize>>20), (unsigned)(srcFileSize>>20), - (double)outFileSize/inFileSize*100); + (double)outFileSize/(double)inFileSize*100); } /* Write Block */ - { size_t const sizeCheck = fwrite(ress->dstBuffer, 1, outSize, ress->dstFile); - if (sizeCheck != outSize) - EXM_THROW(36, "Write error : %s", strerror(errno)); - } + writeJob->usedBufferSize = outSize; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); /* Read next block */ - readSize = fread(ress->srcBuffer, (size_t)1, (size_t)blockSize, ress->srcFile); - inFileSize += readSize; + AIO_ReadPool_consumeBytes(ress->readCtx, inSize); + inFileSize += AIO_ReadPool_fillBuffer(ress->readCtx, blockSize); } - if (ferror(ress->srcFile)) EXM_THROW(37, "Error reading %s ", srcFileName); /* End of Stream mark */ - headerSize = LZ4F_compressEnd(ctx, ress->dstBuffer, ress->dstBufferSize, NULL); + headerSize = LZ4F_compressEnd(ctx, writeJob->buffer, writeJob->bufferSize, NULL); if (LZ4F_isError(headerSize)) EXM_THROW(38, "zstd: %s: lz4 end of file generation failed : %s", srcFileName, LZ4F_getErrorName(headerSize)); - { size_t const sizeCheck = fwrite(ress->dstBuffer, 1, headerSize, ress->dstFile); - if (sizeCheck != headerSize) - EXM_THROW(39, "Write error : %s (cannot write end of stream)", - strerror(errno)); - } + writeJob->usedBufferSize = headerSize; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); outFileSize += headerSize; } *readsize = inFileSize; LZ4F_freeCompressionContext(ctx); + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); return outFileSize; } #endif - static unsigned long long FIO_compressZstdFrame(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, @@ -1328,10 +1335,11 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx, int compressionLevel, U64* readsize) { cRess_t const ress = *ressPtr; - FILE* const srcFile = ress.srcFile; - FILE* const dstFile = ress.dstFile; + IOJob_t *writeJob = AIO_WritePool_acquireJob(ressPtr->writeCtx); + U64 compressedfilesize = 0; ZSTD_EndDirective directive = ZSTD_e_continue; + U64 pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN; /* stats */ ZSTD_frameProgression previous_zfp_update = { 0, 0, 0, 0, 0, 0 }; @@ -1342,28 +1350,51 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx, unsigned inputPresented = 0; unsigned inputBlocked = 0; unsigned lastJobID = 0; + UTIL_time_t lastAdaptTime = UTIL_getTime(); + U64 const adaptEveryMicro = REFRESH_RATE; + + UTIL_HumanReadableSize_t const file_hrs = UTIL_makeHumanReadableSize(fileSize); DISPLAYLEVEL(6, "compression using zstd format \n"); /* init */ if (fileSize != UTIL_FILESIZE_UNKNOWN) { + pledgedSrcSize = fileSize; CHECK(ZSTD_CCtx_setPledgedSrcSize(ress.cctx, fileSize)); } else if (prefs->streamSrcSize > 0) { /* unknown source size; use the declared stream size */ + pledgedSrcSize = prefs->streamSrcSize; CHECK( ZSTD_CCtx_setPledgedSrcSize(ress.cctx, prefs->streamSrcSize) ); } + + { + int windowLog; + UTIL_HumanReadableSize_t windowSize; + CHECK(ZSTD_CCtx_getParameter(ress.cctx, ZSTD_c_windowLog, &windowLog)); + if (windowLog == 0) { + if (prefs->ldmFlag) { + /* If long mode is set without a window size libzstd will set this size internally */ + windowLog = ZSTD_WINDOWLOG_LIMIT_DEFAULT; + } else { + const ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, fileSize, 0); + windowLog = (int)cParams.windowLog; + } + } + windowSize = UTIL_makeHumanReadableSize(MAX(1ULL, MIN(1ULL << windowLog, pledgedSrcSize))); + DISPLAYLEVEL(4, "Decompression will require %.*f%s of memory\n", windowSize.precision, windowSize.value, windowSize.suffix); + } (void)srcFileName; /* Main compression loop */ do { size_t stillToFlush; /* Fill input Buffer */ - size_t const inSize = fread(ress.srcBuffer, (size_t)1, ress.srcBufferSize, srcFile); - ZSTD_inBuffer inBuff = { ress.srcBuffer, inSize, 0 }; + size_t const inSize = AIO_ReadPool_fillBuffer(ress.readCtx, ZSTD_CStreamInSize()); + ZSTD_inBuffer inBuff = setInBuffer( ress.readCtx->srcBuffer, ress.readCtx->srcBufferLoaded, 0 ); DISPLAYLEVEL(6, "fread %u bytes from source \n", (unsigned)inSize); *readsize += inSize; - if ((inSize == 0) || (*readsize == fileSize)) + if ((ress.readCtx->srcBufferLoaded == 0) || (*readsize == fileSize)) directive = ZSTD_e_end; stillToFlush = 1; @@ -1371,9 +1402,10 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx, || (directive == ZSTD_e_end && stillToFlush != 0) ) { size_t const oldIPos = inBuff.pos; - ZSTD_outBuffer outBuff = { ress.dstBuffer, ress.dstBufferSize, 0 }; + ZSTD_outBuffer outBuff = setOutBuffer( writeJob->buffer, writeJob->bufferSize, 0 ); size_t const toFlushNow = ZSTD_toFlushNow(ress.cctx); CHECK_V(stillToFlush, ZSTD_compressStream2(ress.cctx, &outBuff, &inBuff, directive)); + AIO_ReadPool_consumeBytes(ress.readCtx, inBuff.pos - oldIPos); /* count stats */ inputPresented++; @@ -1382,148 +1414,155 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx, /* Write compressed stream */ DISPLAYLEVEL(6, "ZSTD_compress_generic(end:%u) => input pos(%u)<=(%u)size ; output generated %u bytes \n", - (unsigned)directive, (unsigned)inBuff.pos, (unsigned)inBuff.size, (unsigned)outBuff.pos); + (unsigned)directive, (unsigned)inBuff.pos, (unsigned)inBuff.size, (unsigned)outBuff.pos); if (outBuff.pos) { - size_t const sizeCheck = fwrite(ress.dstBuffer, 1, outBuff.pos, dstFile); - if (sizeCheck != outBuff.pos) - EXM_THROW(25, "Write error : %s (cannot write compressed block)", - strerror(errno)); + writeJob->usedBufferSize = outBuff.pos; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); compressedfilesize += outBuff.pos; } - /* display notification; and adapt compression level */ - if (READY_FOR_UPDATE()) { + /* adaptive mode : statistics measurement and speed correction */ + if (prefs->adaptiveMode && UTIL_clockSpanMicro(lastAdaptTime) > adaptEveryMicro) { + ZSTD_frameProgression const zfp = ZSTD_getFrameProgression(ress.cctx); + + lastAdaptTime = UTIL_getTime(); + + /* check output speed */ + if (zfp.currentJobID > 1) { /* only possible if nbWorkers >= 1 */ + + unsigned long long newlyProduced = zfp.produced - previous_zfp_update.produced; + unsigned long long newlyFlushed = zfp.flushed - previous_zfp_update.flushed; + assert(zfp.produced >= previous_zfp_update.produced); + assert(prefs->nbWorkers >= 1); + + /* test if compression is blocked + * either because output is slow and all buffers are full + * or because input is slow and no job can start while waiting for at least one buffer to be filled. + * note : exclude starting part, since currentJobID > 1 */ + if ( (zfp.consumed == previous_zfp_update.consumed) /* no data compressed : no data available, or no more buffer to compress to, OR compression is really slow (compression of a single block is slower than update rate)*/ + && (zfp.nbActiveWorkers == 0) /* confirmed : no compression ongoing */ + ) { + DISPLAYLEVEL(6, "all buffers full : compression stopped => slow down \n") + speedChange = slower; + } + + previous_zfp_update = zfp; + + if ( (newlyProduced > (newlyFlushed * 9 / 8)) /* compression produces more data than output can flush (though production can be spiky, due to work unit : (N==4)*block sizes) */ + && (flushWaiting == 0) /* flush speed was never slowed by lack of production, so it's operating at max capacity */ + ) { + DISPLAYLEVEL(6, "compression faster than flush (%llu > %llu), and flushed was never slowed down by lack of production => slow down \n", newlyProduced, newlyFlushed); + speedChange = slower; + } + flushWaiting = 0; + } + + /* course correct only if there is at least one new job completed */ + if (zfp.currentJobID > lastJobID) { + DISPLAYLEVEL(6, "compression level adaptation check \n") + + /* check input speed */ + if (zfp.currentJobID > (unsigned)(prefs->nbWorkers+1)) { /* warm up period, to fill all workers */ + if (inputBlocked <= 0) { + DISPLAYLEVEL(6, "input is never blocked => input is slower than ingestion \n"); + speedChange = slower; + } else if (speedChange == noChange) { + unsigned long long newlyIngested = zfp.ingested - previous_zfp_correction.ingested; + unsigned long long newlyConsumed = zfp.consumed - previous_zfp_correction.consumed; + unsigned long long newlyProduced = zfp.produced - previous_zfp_correction.produced; + unsigned long long newlyFlushed = zfp.flushed - previous_zfp_correction.flushed; + previous_zfp_correction = zfp; + assert(inputPresented > 0); + DISPLAYLEVEL(6, "input blocked %u/%u(%.2f) - ingested:%u vs %u:consumed - flushed:%u vs %u:produced \n", + inputBlocked, inputPresented, (double)inputBlocked/inputPresented*100, + (unsigned)newlyIngested, (unsigned)newlyConsumed, + (unsigned)newlyFlushed, (unsigned)newlyProduced); + if ( (inputBlocked > inputPresented / 8) /* input is waiting often, because input buffers is full : compression or output too slow */ + && (newlyFlushed * 33 / 32 > newlyProduced) /* flush everything that is produced */ + && (newlyIngested * 33 / 32 > newlyConsumed) /* input speed as fast or faster than compression speed */ + ) { + DISPLAYLEVEL(6, "recommend faster as in(%llu) >= (%llu)comp(%llu) <= out(%llu) \n", + newlyIngested, newlyConsumed, newlyProduced, newlyFlushed); + speedChange = faster; + } + } + inputBlocked = 0; + inputPresented = 0; + } + + if (speedChange == slower) { + DISPLAYLEVEL(6, "slower speed , higher compression \n") + compressionLevel ++; + if (compressionLevel > ZSTD_maxCLevel()) compressionLevel = ZSTD_maxCLevel(); + if (compressionLevel > prefs->maxAdaptLevel) compressionLevel = prefs->maxAdaptLevel; + compressionLevel += (compressionLevel == 0); /* skip 0 */ + ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, compressionLevel); + } + if (speedChange == faster) { + DISPLAYLEVEL(6, "faster speed , lighter compression \n") + compressionLevel --; + if (compressionLevel < prefs->minAdaptLevel) compressionLevel = prefs->minAdaptLevel; + compressionLevel -= (compressionLevel == 0); /* skip 0 */ + ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, compressionLevel); + } + speedChange = noChange; + + lastJobID = zfp.currentJobID; + } /* if (zfp.currentJobID > lastJobID) */ + } /* if (prefs->adaptiveMode && UTIL_clockSpanMicro(lastAdaptTime) > adaptEveryMicro) */ + + /* display notification */ + if (SHOULD_DISPLAY_PROGRESS() && READY_FOR_UPDATE()) { ZSTD_frameProgression const zfp = ZSTD_getFrameProgression(ress.cctx); double const cShare = (double)zfp.produced / (double)(zfp.consumed + !zfp.consumed/*avoid div0*/) * 100; + UTIL_HumanReadableSize_t const buffered_hrs = UTIL_makeHumanReadableSize(zfp.ingested - zfp.consumed); + UTIL_HumanReadableSize_t const consumed_hrs = UTIL_makeHumanReadableSize(zfp.consumed); + UTIL_HumanReadableSize_t const produced_hrs = UTIL_makeHumanReadableSize(zfp.produced); + + DELAY_NEXT_UPDATE(); /* display progress notifications */ + DISPLAY_PROGRESS("\r%79s\r", ""); /* Clear out the current displayed line */ if (g_display_prefs.displayLevel >= 3) { - DISPLAYUPDATE(3, "\r(L%i) Buffered :%4u MB - Consumed :%4u MB - Compressed :%4u MB => %.2f%% ", - compressionLevel, - (unsigned)((zfp.ingested - zfp.consumed) >> 20), - (unsigned)(zfp.consumed >> 20), - (unsigned)(zfp.produced >> 20), - cShare ); - } else if (g_display_prefs.displayLevel >= 2 || g_display_prefs.progressSetting == FIO_ps_always) { + /* Verbose progress update */ + DISPLAY_PROGRESS( + "(L%i) Buffered:%5.*f%s - Consumed:%5.*f%s - Compressed:%5.*f%s => %.2f%% ", + compressionLevel, + buffered_hrs.precision, buffered_hrs.value, buffered_hrs.suffix, + consumed_hrs.precision, consumed_hrs.value, consumed_hrs.suffix, + produced_hrs.precision, produced_hrs.value, produced_hrs.suffix, + cShare ); + } else { /* Require level 2 or forcibly displayed progress counter for summarized updates */ - DISPLAYLEVEL(1, "\r%79s\r", ""); /* Clear out the current displayed line */ if (fCtx->nbFilesTotal > 1) { size_t srcFileNameSize = strlen(srcFileName); /* Ensure that the string we print is roughly the same size each time */ if (srcFileNameSize > 18) { const char* truncatedSrcFileName = srcFileName + srcFileNameSize - 15; - DISPLAYLEVEL(1, "Compress: %u/%u files. Current: ...%s ", + DISPLAY_PROGRESS("Compress: %u/%u files. Current: ...%s ", fCtx->currFileIdx+1, fCtx->nbFilesTotal, truncatedSrcFileName); } else { - DISPLAYLEVEL(1, "Compress: %u/%u files. Current: %*s ", + DISPLAY_PROGRESS("Compress: %u/%u files. Current: %*s ", fCtx->currFileIdx+1, fCtx->nbFilesTotal, (int)(18-srcFileNameSize), srcFileName); } } - DISPLAYLEVEL(1, "Read : %2u ", (unsigned)(zfp.consumed >> 20)); + DISPLAY_PROGRESS("Read:%6.*f%4s ", consumed_hrs.precision, consumed_hrs.value, consumed_hrs.suffix); if (fileSize != UTIL_FILESIZE_UNKNOWN) - DISPLAYLEVEL(2, "/ %2u ", (unsigned)(fileSize >> 20)); - DISPLAYLEVEL(1, "MB ==> %2.f%%", cShare); - DELAY_NEXT_UPDATE(); + DISPLAY_PROGRESS("/%6.*f%4s", file_hrs.precision, file_hrs.value, file_hrs.suffix); + DISPLAY_PROGRESS(" ==> %2.f%%", cShare); } - - /* adaptive mode : statistics measurement and speed correction */ - if (prefs->adaptiveMode) { - - /* check output speed */ - if (zfp.currentJobID > 1) { /* only possible if nbWorkers >= 1 */ - - unsigned long long newlyProduced = zfp.produced - previous_zfp_update.produced; - unsigned long long newlyFlushed = zfp.flushed - previous_zfp_update.flushed; - assert(zfp.produced >= previous_zfp_update.produced); - assert(prefs->nbWorkers >= 1); - - /* test if compression is blocked - * either because output is slow and all buffers are full - * or because input is slow and no job can start while waiting for at least one buffer to be filled. - * note : exclude starting part, since currentJobID > 1 */ - if ( (zfp.consumed == previous_zfp_update.consumed) /* no data compressed : no data available, or no more buffer to compress to, OR compression is really slow (compression of a single block is slower than update rate)*/ - && (zfp.nbActiveWorkers == 0) /* confirmed : no compression ongoing */ - ) { - DISPLAYLEVEL(6, "all buffers full : compression stopped => slow down \n") - speedChange = slower; - } - - previous_zfp_update = zfp; - - if ( (newlyProduced > (newlyFlushed * 9 / 8)) /* compression produces more data than output can flush (though production can be spiky, due to work unit : (N==4)*block sizes) */ - && (flushWaiting == 0) /* flush speed was never slowed by lack of production, so it's operating at max capacity */ - ) { - DISPLAYLEVEL(6, "compression faster than flush (%llu > %llu), and flushed was never slowed down by lack of production => slow down \n", newlyProduced, newlyFlushed); - speedChange = slower; - } - flushWaiting = 0; - } - - /* course correct only if there is at least one new job completed */ - if (zfp.currentJobID > lastJobID) { - DISPLAYLEVEL(6, "compression level adaptation check \n") - - /* check input speed */ - if (zfp.currentJobID > (unsigned)(prefs->nbWorkers+1)) { /* warm up period, to fill all workers */ - if (inputBlocked <= 0) { - DISPLAYLEVEL(6, "input is never blocked => input is slower than ingestion \n"); - speedChange = slower; - } else if (speedChange == noChange) { - unsigned long long newlyIngested = zfp.ingested - previous_zfp_correction.ingested; - unsigned long long newlyConsumed = zfp.consumed - previous_zfp_correction.consumed; - unsigned long long newlyProduced = zfp.produced - previous_zfp_correction.produced; - unsigned long long newlyFlushed = zfp.flushed - previous_zfp_correction.flushed; - previous_zfp_correction = zfp; - assert(inputPresented > 0); - DISPLAYLEVEL(6, "input blocked %u/%u(%.2f) - ingested:%u vs %u:consumed - flushed:%u vs %u:produced \n", - inputBlocked, inputPresented, (double)inputBlocked/inputPresented*100, - (unsigned)newlyIngested, (unsigned)newlyConsumed, - (unsigned)newlyFlushed, (unsigned)newlyProduced); - if ( (inputBlocked > inputPresented / 8) /* input is waiting often, because input buffers is full : compression or output too slow */ - && (newlyFlushed * 33 / 32 > newlyProduced) /* flush everything that is produced */ - && (newlyIngested * 33 / 32 > newlyConsumed) /* input speed as fast or faster than compression speed */ - ) { - DISPLAYLEVEL(6, "recommend faster as in(%llu) >= (%llu)comp(%llu) <= out(%llu) \n", - newlyIngested, newlyConsumed, newlyProduced, newlyFlushed); - speedChange = faster; - } - } - inputBlocked = 0; - inputPresented = 0; - } - - if (speedChange == slower) { - DISPLAYLEVEL(6, "slower speed , higher compression \n") - compressionLevel ++; - if (compressionLevel > ZSTD_maxCLevel()) compressionLevel = ZSTD_maxCLevel(); - if (compressionLevel > prefs->maxAdaptLevel) compressionLevel = prefs->maxAdaptLevel; - compressionLevel += (compressionLevel == 0); /* skip 0 */ - ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, compressionLevel); - } - if (speedChange == faster) { - DISPLAYLEVEL(6, "faster speed , lighter compression \n") - compressionLevel --; - if (compressionLevel < prefs->minAdaptLevel) compressionLevel = prefs->minAdaptLevel; - compressionLevel -= (compressionLevel == 0); /* skip 0 */ - ZSTD_CCtx_setParameter(ress.cctx, ZSTD_c_compressionLevel, compressionLevel); - } - speedChange = noChange; - - lastJobID = zfp.currentJobID; - } /* if (zfp.currentJobID > lastJobID) */ - } /* if (g_adaptiveMode) */ - } /* if (READY_FOR_UPDATE()) */ + } /* if (SHOULD_DISPLAY_PROGRESS() && READY_FOR_UPDATE()) */ } /* while ((inBuff.pos != inBuff.size) */ } while (directive != ZSTD_e_end); - if (ferror(srcFile)) { - EXM_THROW(26, "Read error : I/O error"); - } if (fileSize != UTIL_FILESIZE_UNKNOWN && *readsize != fileSize) { EXM_THROW(27, "Read error : Incomplete read : %llu / %llu B", (unsigned long long)*readsize, (unsigned long long)fileSize); } + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ressPtr->writeCtx); + return compressedfilesize; } @@ -1588,20 +1627,22 @@ FIO_compressFilename_internal(FIO_ctx_t* const fCtx, /* Status */ fCtx->totalBytesInput += (size_t)readsize; fCtx->totalBytesOutput += (size_t)compressedfilesize; - DISPLAYLEVEL(2, "\r%79s\r", ""); - if (g_display_prefs.displayLevel >= 2 && - !fCtx->hasStdoutOutput && - (g_display_prefs.displayLevel >= 3 || fCtx->nbFilesTotal <= 1)) { + DISPLAY_PROGRESS("\r%79s\r", ""); + if (FIO_shouldDisplayFileSummary(fCtx)) { + UTIL_HumanReadableSize_t hr_isize = UTIL_makeHumanReadableSize((U64) readsize); + UTIL_HumanReadableSize_t hr_osize = UTIL_makeHumanReadableSize((U64) compressedfilesize); if (readsize == 0) { - DISPLAYLEVEL(2,"%-20s : (%6llu => %6llu bytes, %s) \n", + DISPLAY_SUMMARY("%-20s : (%6.*f%s => %6.*f%s, %s) \n", srcFileName, - (unsigned long long)readsize, (unsigned long long) compressedfilesize, + hr_isize.precision, hr_isize.value, hr_isize.suffix, + hr_osize.precision, hr_osize.value, hr_osize.suffix, dstFileName); } else { - DISPLAYLEVEL(2,"%-20s :%6.2f%% (%6llu => %6llu bytes, %s) \n", + DISPLAY_SUMMARY("%-20s :%6.2f%% (%6.*f%s => %6.*f%s, %s) \n", srcFileName, (double)compressedfilesize / (double)readsize * 100, - (unsigned long long)readsize, (unsigned long long) compressedfilesize, + hr_isize.precision, hr_isize.value, hr_isize.suffix, + hr_osize.precision, hr_osize.value, hr_osize.suffix, dstFileName); } } @@ -1620,7 +1661,7 @@ FIO_compressFilename_internal(FIO_ctx_t* const fCtx, /*! FIO_compressFilename_dstFile() : - * open dstFileName, or pass-through if ress.dstFile != NULL, + * open dstFileName, or pass-through if ress.file != NULL, * then start compression with FIO_compressFilename_internal(). * Manages source removal (--rm) and file permissions transfer. * note : ress.srcFile must be != NULL, @@ -1633,24 +1674,29 @@ static int FIO_compressFilename_dstFile(FIO_ctx_t* const fCtx, cRess_t ress, const char* dstFileName, const char* srcFileName, + const stat_t* srcFileStat, int compressionLevel) { int closeDstFile = 0; int result; - stat_t statbuf; - assert(ress.srcFile != NULL); - if (ress.dstFile == NULL) { - int dstFilePermissions = DEFAULT_FILE_PERMISSIONS; + int transferStat = 0; + FILE *dstFile; + + assert(AIO_ReadPool_getFile(ress.readCtx) != NULL); + if (AIO_WritePool_getFile(ress.writeCtx) == NULL) { + int dstFileInitialPermissions = DEFAULT_FILE_PERMISSIONS; if ( strcmp (srcFileName, stdinmark) - && UTIL_stat(srcFileName, &statbuf) - && UTIL_isRegularFileStat(&statbuf) ) { - dstFilePermissions = statbuf.st_mode; + && strcmp (dstFileName, stdoutmark) + && UTIL_isRegularFileStat(srcFileStat) ) { + transferStat = 1; + dstFileInitialPermissions = TEMPORARY_FILE_PERMISSIONS; } closeDstFile = 1; DISPLAYLEVEL(6, "FIO_compressFilename_dstFile: opening dst: %s \n", dstFileName); - ress.dstFile = FIO_openDstFile(fCtx, prefs, srcFileName, dstFileName, dstFilePermissions); - if (ress.dstFile==NULL) return 1; /* could not open dstFileName */ + dstFile = FIO_openDstFile(fCtx, prefs, srcFileName, dstFileName, dstFileInitialPermissions); + if (dstFile==NULL) return 1; /* could not open dstFileName */ + AIO_WritePool_setFile(ress.writeCtx, dstFile); /* Must only be added after FIO_openDstFile() succeeds. * Otherwise we may delete the destination file if it already exists, * and the user presses Ctrl-C when asked if they wish to overwrite. @@ -1661,16 +1707,16 @@ static int FIO_compressFilename_dstFile(FIO_ctx_t* const fCtx, result = FIO_compressFilename_internal(fCtx, prefs, ress, dstFileName, srcFileName, compressionLevel); if (closeDstFile) { - FILE* const dstFile = ress.dstFile; - ress.dstFile = NULL; - clearHandler(); DISPLAYLEVEL(6, "FIO_compressFilename_dstFile: closing dst: %s \n", dstFileName); - if (fclose(dstFile)) { /* error closing dstFile */ + if (AIO_WritePool_closeFile(ress.writeCtx)) { /* error closing file */ DISPLAYLEVEL(1, "zstd: %s: %s \n", dstFileName, strerror(errno)); result=1; } + if (transferStat) { + UTIL_setFileStat(dstFileName, srcFileStat); + } if ( (result != 0) /* operation failure */ && strcmp(dstFileName, stdoutmark) /* special case : don't remove() stdout */ ) { @@ -1710,18 +1756,27 @@ FIO_compressFilename_srcFile(FIO_ctx_t* const fCtx, int compressionLevel) { int result; + FILE* srcFile; + stat_t srcFileStat; + U64 fileSize = UTIL_FILESIZE_UNKNOWN; DISPLAYLEVEL(6, "FIO_compressFilename_srcFile: %s \n", srcFileName); - /* ensure src is not a directory */ - if (UTIL_isDirectory(srcFileName)) { - DISPLAYLEVEL(1, "zstd: %s is a directory -- ignored \n", srcFileName); - return 1; - } + if (strcmp(srcFileName, stdinmark)) { + if (UTIL_stat(srcFileName, &srcFileStat)) { + /* failure to stat at all is handled during opening */ - /* ensure src is not the same as dict (if present) */ - if (ress.dictFileName != NULL && UTIL_isSameFile(srcFileName, ress.dictFileName)) { - DISPLAYLEVEL(1, "zstd: cannot use %s as an input file and dictionary \n", srcFileName); - return 1; + /* ensure src is not a directory */ + if (UTIL_isDirectoryStat(&srcFileStat)) { + DISPLAYLEVEL(1, "zstd: %s is a directory -- ignored \n", srcFileName); + return 1; + } + + /* ensure src is not the same as dict (if present) */ + if (ress.dictFileName != NULL && UTIL_isSameFileStat(srcFileName, ress.dictFileName, &srcFileStat, &ress.dictFileStat)) { + DISPLAYLEVEL(1, "zstd: cannot use %s as an input file and dictionary \n", srcFileName); + return 1; + } + } } /* Check if "srcFile" is compressed. Only done if --exclude-compressed flag is used @@ -1733,16 +1788,30 @@ FIO_compressFilename_srcFile(FIO_ctx_t* const fCtx, return 0; } - ress.srcFile = FIO_openSrcFile(prefs, srcFileName); - if (ress.srcFile == NULL) return 1; /* srcFile could not be opened */ + srcFile = FIO_openSrcFile(prefs, srcFileName, &srcFileStat); + if (srcFile == NULL) return 1; /* srcFile could not be opened */ - result = FIO_compressFilename_dstFile(fCtx, prefs, ress, dstFileName, srcFileName, compressionLevel); + /* Don't use AsyncIO for small files */ + if (strcmp(srcFileName, stdinmark)) /* Stdin doesn't have stats */ + fileSize = UTIL_getFileSizeStat(&srcFileStat); + if(fileSize != UTIL_FILESIZE_UNKNOWN && fileSize < ZSTD_BLOCKSIZE_MAX * 3) { + AIO_ReadPool_setAsync(ress.readCtx, 0); + AIO_WritePool_setAsync(ress.writeCtx, 0); + } else { + AIO_ReadPool_setAsync(ress.readCtx, 1); + AIO_WritePool_setAsync(ress.writeCtx, 1); + } - fclose(ress.srcFile); - ress.srcFile = NULL; - if ( prefs->removeSrcFile /* --rm */ - && result == 0 /* success */ - && strcmp(srcFileName, stdinmark) /* exception : don't erase stdin */ + AIO_ReadPool_setFile(ress.readCtx, srcFile); + result = FIO_compressFilename_dstFile( + fCtx, prefs, ress, + dstFileName, srcFileName, + &srcFileStat, compressionLevel); + AIO_ReadPool_closeFile(ress.readCtx); + + if ( prefs->removeSrcFile /* --rm */ + && result == 0 /* success */ + && strcmp(srcFileName, stdinmark) /* exception : don't erase stdin */ ) { /* We must clear the handler, since after this point calling it would * delete both the source and destination files. @@ -1754,6 +1823,52 @@ FIO_compressFilename_srcFile(FIO_ctx_t* const fCtx, return result; } +static const char* +checked_index(const char* options[], size_t length, size_t index) { + assert(index < length); + /* Necessary to avoid warnings since -O3 will omit the above `assert` */ + (void) length; + return options[index]; +} + +#define INDEX(options, index) checked_index((options), sizeof(options) / sizeof(char*), (size_t)(index)) + +void FIO_displayCompressionParameters(const FIO_prefs_t* prefs) +{ + static const char* formatOptions[5] = {ZSTD_EXTENSION, GZ_EXTENSION, XZ_EXTENSION, + LZMA_EXTENSION, LZ4_EXTENSION}; + static const char* sparseOptions[3] = {" --no-sparse", "", " --sparse"}; + static const char* checkSumOptions[3] = {" --no-check", "", " --check"}; + static const char* rowMatchFinderOptions[3] = {"", " --no-row-match-finder", " --row-match-finder"}; + static const char* compressLiteralsOptions[3] = {"", " --compress-literals", " --no-compress-literals"}; + + assert(g_display_prefs.displayLevel >= 4); + + DISPLAY("--format=%s", formatOptions[prefs->compressionType]); + DISPLAY("%s", INDEX(sparseOptions, prefs->sparseFileSupport)); + DISPLAY("%s", prefs->dictIDFlag ? "" : " --no-dictID"); + DISPLAY("%s", INDEX(checkSumOptions, prefs->checksumFlag)); + DISPLAY(" --block-size=%d", prefs->blockSize); + if (prefs->adaptiveMode) + DISPLAY(" --adapt=min=%d,max=%d", prefs->minAdaptLevel, prefs->maxAdaptLevel); + DISPLAY("%s", INDEX(rowMatchFinderOptions, prefs->useRowMatchFinder)); + DISPLAY("%s", prefs->rsyncable ? " --rsyncable" : ""); + if (prefs->streamSrcSize) + DISPLAY(" --stream-size=%u", (unsigned) prefs->streamSrcSize); + if (prefs->srcSizeHint) + DISPLAY(" --size-hint=%d", prefs->srcSizeHint); + if (prefs->targetCBlockSize) + DISPLAY(" --target-compressed-block-size=%u", (unsigned) prefs->targetCBlockSize); + DISPLAY("%s", INDEX(compressLiteralsOptions, prefs->literalCompressionMode)); + DISPLAY(" --memory=%u", prefs->memLimit ? prefs->memLimit : 128 MB); + DISPLAY(" --threads=%d", prefs->nbWorkers); + DISPLAY("%s", prefs->excludeCompressedFiles ? " --exclude-compressed" : ""); + DISPLAY(" --%scontent-size", prefs->contentSize ? "" : "no-"); + DISPLAY("\n"); +} + +#undef INDEX + int FIO_compressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, const char* dstFileName, const char* srcFileName, const char* dictFileName, int compressionLevel, ZSTD_compressionParameters comprParams) @@ -1780,6 +1895,11 @@ FIO_determineCompressedName(const char* srcFileName, const char* outDirName, con char* outDirFilename = NULL; size_t sfnSize = strlen(srcFileName); size_t const srcSuffixLen = strlen(suffix); + + if(!strcmp(srcFileName, stdinmark)) { + return stdoutmark; + } + if (outDirName) { outDirFilename = FIO_createFilename_fromOutDir(srcFileName, outDirName, srcSuffixLen); sfnSize = strlen(outDirFilename); @@ -1842,23 +1962,24 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx, /* init */ assert(outFileName != NULL || suffix != NULL); if (outFileName != NULL) { /* output into a single destination (stdout typically) */ - if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) { + FILE *dstFile; + if (FIO_multiFilesConcatWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) { FIO_freeCResources(&ress); return 1; } - ress.dstFile = FIO_openDstFile(fCtx, prefs, NULL, outFileName, DEFAULT_FILE_PERMISSIONS); - if (ress.dstFile == NULL) { /* could not open outFileName */ + dstFile = FIO_openDstFile(fCtx, prefs, NULL, outFileName, DEFAULT_FILE_PERMISSIONS); + if (dstFile == NULL) { /* could not open outFileName */ error = 1; } else { + AIO_WritePool_setFile(ress.writeCtx, dstFile); for (; fCtx->currFileIdx < fCtx->nbFilesTotal; ++fCtx->currFileIdx) { status = FIO_compressFilename_srcFile(fCtx, prefs, ress, outFileName, inFileNamesTable[fCtx->currFileIdx], compressionLevel); if (!status) fCtx->nbFilesProcessed++; error |= status; } - if (fclose(ress.dstFile)) + if (AIO_WritePool_closeFile(ress.writeCtx)) EXM_THROW(29, "Write error (%s) : cannot properly close %s", strerror(errno), outFileName); - ress.dstFile = NULL; } } else { if (outMirroredRootDirName) @@ -1889,11 +2010,23 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx, FIO_checkFilenameCollisions(inFileNamesTable , (unsigned)fCtx->nbFilesTotal); } - if (fCtx->nbFilesProcessed >= 1 && fCtx->nbFilesTotal > 1 && fCtx->totalBytesInput != 0) { - DISPLAYLEVEL(2, "\r%79s\r", ""); - DISPLAYLEVEL(2, "%d files compressed : %.2f%% (%6zu => %6zu bytes)\n", fCtx->nbFilesProcessed, - (double)fCtx->totalBytesOutput/((double)fCtx->totalBytesInput)*100, - fCtx->totalBytesInput, fCtx->totalBytesOutput); + if (FIO_shouldDisplayMultipleFileSummary(fCtx)) { + UTIL_HumanReadableSize_t hr_isize = UTIL_makeHumanReadableSize((U64) fCtx->totalBytesInput); + UTIL_HumanReadableSize_t hr_osize = UTIL_makeHumanReadableSize((U64) fCtx->totalBytesOutput); + + DISPLAY_PROGRESS("\r%79s\r", ""); + if (fCtx->totalBytesInput == 0) { + DISPLAY_SUMMARY("%3d files compressed : (%6.*f%4s => %6.*f%4s)\n", + fCtx->nbFilesProcessed, + hr_isize.precision, hr_isize.value, hr_isize.suffix, + hr_osize.precision, hr_osize.value, hr_osize.suffix); + } else { + DISPLAY_SUMMARY("%3d files compressed : %.2f%% (%6.*f%4s => %6.*f%4s)\n", + fCtx->nbFilesProcessed, + (double)fCtx->totalBytesOutput/((double)fCtx->totalBytesInput)*100, + hr_isize.precision, hr_isize.value, hr_isize.suffix, + hr_osize.precision, hr_osize.value, hr_osize.suffix); + } } FIO_freeCResources(&ress); @@ -1910,13 +2043,9 @@ int FIO_compressMultipleFilenames(FIO_ctx_t* const fCtx, * Decompression ***************************************************************************/ typedef struct { - void* srcBuffer; - size_t srcBufferSize; - size_t srcBufferLoaded; - void* dstBuffer; - size_t dstBufferSize; ZSTD_DStream* dctx; - FILE* dstFile; + WritePoolCtx_t *writeCtx; + ReadPoolCtx_t *readCtx; } dRess_t; static dRess_t FIO_createDResources(FIO_prefs_t* const prefs, const char* dictFileName) @@ -1934,159 +2063,49 @@ static dRess_t FIO_createDResources(FIO_prefs_t* const prefs, const char* dictFi CHECK( ZSTD_DCtx_setMaxWindowSize(ress.dctx, prefs->memLimit) ); CHECK( ZSTD_DCtx_setParameter(ress.dctx, ZSTD_d_forceIgnoreChecksum, !prefs->checksumFlag)); - ress.srcBufferSize = ZSTD_DStreamInSize(); - ress.srcBuffer = malloc(ress.srcBufferSize); - ress.dstBufferSize = ZSTD_DStreamOutSize(); - ress.dstBuffer = malloc(ress.dstBufferSize); - if (!ress.srcBuffer || !ress.dstBuffer) - EXM_THROW(61, "Allocation error : not enough memory"); - /* dictionary */ { void* dictBuffer; - size_t const dictBufferSize = FIO_createDictBuffer(&dictBuffer, dictFileName, prefs); - CHECK( ZSTD_initDStream_usingDict(ress.dctx, dictBuffer, dictBufferSize) ); + stat_t statbuf; + size_t const dictBufferSize = FIO_createDictBuffer(&dictBuffer, dictFileName, prefs, &statbuf); + CHECK( ZSTD_DCtx_reset(ress.dctx, ZSTD_reset_session_only) ); + CHECK( ZSTD_DCtx_loadDictionary(ress.dctx, dictBuffer, dictBufferSize) ); free(dictBuffer); } + ress.writeCtx = AIO_WritePool_create(prefs, ZSTD_DStreamOutSize()); + ress.readCtx = AIO_ReadPool_create(prefs, ZSTD_DStreamInSize()); + return ress; } static void FIO_freeDResources(dRess_t ress) { CHECK( ZSTD_freeDStream(ress.dctx) ); - free(ress.srcBuffer); - free(ress.dstBuffer); + AIO_WritePool_free(ress.writeCtx); + AIO_ReadPool_free(ress.readCtx); } - -/** FIO_fwriteSparse() : -* @return : storedSkips, -* argument for next call to FIO_fwriteSparse() or FIO_fwriteSparseEnd() */ -static unsigned -FIO_fwriteSparse(FILE* file, - const void* buffer, size_t bufferSize, - const FIO_prefs_t* const prefs, - unsigned storedSkips) -{ - const size_t* const bufferT = (const size_t*)buffer; /* Buffer is supposed malloc'ed, hence aligned on size_t */ - size_t bufferSizeT = bufferSize / sizeof(size_t); - const size_t* const bufferTEnd = bufferT + bufferSizeT; - const size_t* ptrT = bufferT; - static const size_t segmentSizeT = (32 KB) / sizeof(size_t); /* check every 32 KB */ - - if (prefs->testMode) return 0; /* do not output anything in test mode */ - - if (!prefs->sparseFileSupport) { /* normal write */ - size_t const sizeCheck = fwrite(buffer, 1, bufferSize, file); - if (sizeCheck != bufferSize) - EXM_THROW(70, "Write error : cannot write decoded block : %s", - strerror(errno)); - return 0; - } - - /* avoid int overflow */ - if (storedSkips > 1 GB) { - if (LONG_SEEK(file, 1 GB, SEEK_CUR) != 0) - EXM_THROW(91, "1 GB skip error (sparse file support)"); - storedSkips -= 1 GB; - } - - while (ptrT < bufferTEnd) { - size_t nb0T; - - /* adjust last segment if < 32 KB */ - size_t seg0SizeT = segmentSizeT; - if (seg0SizeT > bufferSizeT) seg0SizeT = bufferSizeT; - bufferSizeT -= seg0SizeT; - - /* count leading zeroes */ - for (nb0T=0; (nb0T < seg0SizeT) && (ptrT[nb0T] == 0); nb0T++) ; - storedSkips += (unsigned)(nb0T * sizeof(size_t)); - - if (nb0T != seg0SizeT) { /* not all 0s */ - size_t const nbNon0ST = seg0SizeT - nb0T; - /* skip leading zeros */ - if (LONG_SEEK(file, storedSkips, SEEK_CUR) != 0) - EXM_THROW(92, "Sparse skip error ; try --no-sparse"); - storedSkips = 0; - /* write the rest */ - if (fwrite(ptrT + nb0T, sizeof(size_t), nbNon0ST, file) != nbNon0ST) - EXM_THROW(93, "Write error : cannot write decoded block : %s", - strerror(errno)); - } - ptrT += seg0SizeT; - } - - { static size_t const maskT = sizeof(size_t)-1; - if (bufferSize & maskT) { - /* size not multiple of sizeof(size_t) : implies end of block */ - const char* const restStart = (const char*)bufferTEnd; - const char* restPtr = restStart; - const char* const restEnd = (const char*)buffer + bufferSize; - assert(restEnd > restStart && restEnd < restStart + sizeof(size_t)); - for ( ; (restPtr < restEnd) && (*restPtr == 0); restPtr++) ; - storedSkips += (unsigned) (restPtr - restStart); - if (restPtr != restEnd) { - /* not all remaining bytes are 0 */ - size_t const restSize = (size_t)(restEnd - restPtr); - if (LONG_SEEK(file, storedSkips, SEEK_CUR) != 0) - EXM_THROW(92, "Sparse skip error ; try --no-sparse"); - if (fwrite(restPtr, 1, restSize, file) != restSize) - EXM_THROW(95, "Write error : cannot write end of decoded block : %s", - strerror(errno)); - storedSkips = 0; - } } } - - return storedSkips; -} - -static void -FIO_fwriteSparseEnd(const FIO_prefs_t* const prefs, FILE* file, unsigned storedSkips) -{ - if (prefs->testMode) assert(storedSkips == 0); - if (storedSkips>0) { - assert(prefs->sparseFileSupport > 0); /* storedSkips>0 implies sparse support is enabled */ - (void)prefs; /* assert can be disabled, in which case prefs becomes unused */ - if (LONG_SEEK(file, storedSkips-1, SEEK_CUR) != 0) - EXM_THROW(69, "Final skip error (sparse file support)"); - /* last zero must be explicitly written, - * so that skipped ones get implicitly translated as zero by FS */ - { const char lastZeroByte[1] = { 0 }; - if (fwrite(lastZeroByte, 1, 1, file) != 1) - EXM_THROW(69, "Write error : cannot write last zero : %s", strerror(errno)); - } } -} - - /** FIO_passThrough() : just copy input into output, for compatibility with gzip -df mode @return : 0 (no error) */ -static int FIO_passThrough(const FIO_prefs_t* const prefs, - FILE* foutput, FILE* finput, - void* buffer, size_t bufferSize, - size_t alreadyLoaded) +static int FIO_passThrough(dRess_t *ress) { - size_t const blockSize = MIN(64 KB, bufferSize); - size_t readFromInput; - unsigned storedSkips = 0; + size_t const blockSize = MIN(MIN(64 KB, ZSTD_DStreamInSize()), ZSTD_DStreamOutSize()); + IOJob_t *writeJob = AIO_WritePool_acquireJob(ress->writeCtx); + AIO_ReadPool_fillBuffer(ress->readCtx, blockSize); - /* assumption : ress->srcBufferLoaded bytes already loaded and stored within buffer */ - { size_t const sizeCheck = fwrite(buffer, 1, alreadyLoaded, foutput); - if (sizeCheck != alreadyLoaded) { - DISPLAYLEVEL(1, "Pass-through write error : %s\n", strerror(errno)); - return 1; - } } - - do { - readFromInput = fread(buffer, 1, blockSize, finput); - storedSkips = FIO_fwriteSparse(foutput, buffer, readFromInput, prefs, storedSkips); - } while (readFromInput == blockSize); - if (ferror(finput)) { - DISPLAYLEVEL(1, "Pass-through read error : %s\n", strerror(errno)); - return 1; + while(ress->readCtx->srcBufferLoaded) { + size_t writeSize; + writeSize = MIN(blockSize, ress->readCtx->srcBufferLoaded); + assert(writeSize <= writeJob->bufferSize); + memcpy(writeJob->buffer, ress->readCtx->srcBuffer, writeSize); + writeJob->usedBufferSize = writeSize; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); + AIO_ReadPool_consumeBytes(ress->readCtx, writeSize); + AIO_ReadPool_fillBuffer(ress->readCtx, blockSize); } - assert(feof(finput)); - - FIO_fwriteSparseEnd(prefs, foutput, storedSkips); + assert(ress->readCtx->reachedEof); + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); return 0; } @@ -2104,7 +2123,7 @@ FIO_zstdErrorHelp(const FIO_prefs_t* const prefs, return; /* Try to decode the frame header */ - err = ZSTD_getFrameHeader(&header, ress->srcBuffer, ress->srcBufferLoaded); + err = ZSTD_getFrameHeader(&header, ress->readCtx->srcBuffer, ress->readCtx->srcBufferLoaded); if (err == 0) { unsigned long long const windowSize = header.windowSize; unsigned const windowLog = FIO_highbit64(windowSize) + ((windowSize & (windowSize - 1)) != 0); @@ -2127,13 +2146,13 @@ FIO_zstdErrorHelp(const FIO_prefs_t* const prefs, */ #define FIO_ERROR_FRAME_DECODING ((unsigned long long)(-2)) static unsigned long long -FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress, FILE* finput, +FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress, const FIO_prefs_t* const prefs, const char* srcFileName, U64 alreadyDecoded) /* for multi-frames streams */ { U64 frameSize = 0; - U32 storedSkips = 0; + IOJob_t *writeJob = AIO_WritePool_acquireJob(ress->writeCtx); /* display last 20 characters only */ { size_t const srcFileLength = strlen(srcFileName); @@ -2143,67 +2162,60 @@ FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress, FILE* finput, ZSTD_DCtx_reset(ress->dctx, ZSTD_reset_session_only); /* Header loading : ensures ZSTD_getFrameHeader() will succeed */ - { size_t const toDecode = ZSTD_FRAMEHEADERSIZE_MAX; - if (ress->srcBufferLoaded < toDecode) { - size_t const toRead = toDecode - ress->srcBufferLoaded; - void* const startPosition = (char*)ress->srcBuffer + ress->srcBufferLoaded; - ress->srcBufferLoaded += fread(startPosition, 1, toRead, finput); - } } + AIO_ReadPool_fillBuffer(ress->readCtx, ZSTD_FRAMEHEADERSIZE_MAX); /* Main decompression Loop */ while (1) { - ZSTD_inBuffer inBuff = { ress->srcBuffer, ress->srcBufferLoaded, 0 }; - ZSTD_outBuffer outBuff= { ress->dstBuffer, ress->dstBufferSize, 0 }; + ZSTD_inBuffer inBuff = setInBuffer( ress->readCtx->srcBuffer, ress->readCtx->srcBufferLoaded, 0 ); + ZSTD_outBuffer outBuff= setOutBuffer( writeJob->buffer, writeJob->bufferSize, 0 ); size_t const readSizeHint = ZSTD_decompressStream(ress->dctx, &outBuff, &inBuff); + UTIL_HumanReadableSize_t const hrs = UTIL_makeHumanReadableSize(alreadyDecoded+frameSize); if (ZSTD_isError(readSizeHint)) { DISPLAYLEVEL(1, "%s : Decoding error (36) : %s \n", srcFileName, ZSTD_getErrorName(readSizeHint)); FIO_zstdErrorHelp(prefs, ress, readSizeHint, srcFileName); + AIO_WritePool_releaseIoJob(writeJob); return FIO_ERROR_FRAME_DECODING; } /* Write block */ - storedSkips = FIO_fwriteSparse(ress->dstFile, ress->dstBuffer, outBuff.pos, prefs, storedSkips); + writeJob->usedBufferSize = outBuff.pos; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); frameSize += outBuff.pos; - if (!fCtx->hasStdoutOutput || g_display_prefs.progressSetting == FIO_ps_always) { - if (fCtx->nbFilesTotal > 1) { - size_t srcFileNameSize = strlen(srcFileName); - if (srcFileNameSize > 18) { - const char* truncatedSrcFileName = srcFileName + srcFileNameSize - 15; - DISPLAYUPDATE(2, "\rDecompress: %2u/%2u files. Current: ...%s : %u MB... ", - fCtx->currFileIdx+1, fCtx->nbFilesTotal, truncatedSrcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) ); - } else { - DISPLAYUPDATE(2, "\rDecompress: %2u/%2u files. Current: %s : %u MB... ", - fCtx->currFileIdx+1, fCtx->nbFilesTotal, srcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) ); - } + if (fCtx->nbFilesTotal > 1) { + size_t srcFileNameSize = strlen(srcFileName); + if (srcFileNameSize > 18) { + const char* truncatedSrcFileName = srcFileName + srcFileNameSize - 15; + DISPLAYUPDATE_PROGRESS( + "\rDecompress: %2u/%2u files. Current: ...%s : %.*f%s... ", + fCtx->currFileIdx+1, fCtx->nbFilesTotal, truncatedSrcFileName, hrs.precision, hrs.value, hrs.suffix); } else { - DISPLAYUPDATE(2, "\r%-20.20s : %u MB... ", - srcFileName, (unsigned)((alreadyDecoded+frameSize)>>20) ); + DISPLAYUPDATE_PROGRESS("\rDecompress: %2u/%2u files. Current: %s : %.*f%s... ", + fCtx->currFileIdx+1, fCtx->nbFilesTotal, srcFileName, hrs.precision, hrs.value, hrs.suffix); } + } else { + DISPLAYUPDATE_PROGRESS("\r%-20.20s : %.*f%s... ", + srcFileName, hrs.precision, hrs.value, hrs.suffix); } - if (inBuff.pos > 0) { - memmove(ress->srcBuffer, (char*)ress->srcBuffer + inBuff.pos, inBuff.size - inBuff.pos); - ress->srcBufferLoaded -= inBuff.pos; - } + AIO_ReadPool_consumeBytes(ress->readCtx, inBuff.pos); if (readSizeHint == 0) break; /* end of frame */ /* Fill input buffer */ - { size_t const toDecode = MIN(readSizeHint, ress->srcBufferSize); /* support large skippable frames */ - if (ress->srcBufferLoaded < toDecode) { - size_t const toRead = toDecode - ress->srcBufferLoaded; /* > 0 */ - void* const startPosition = (char*)ress->srcBuffer + ress->srcBufferLoaded; - size_t const readSize = fread(startPosition, 1, toRead, finput); + { size_t const toDecode = MIN(readSizeHint, ZSTD_DStreamInSize()); /* support large skippable frames */ + if (ress->readCtx->srcBufferLoaded < toDecode) { + size_t const readSize = AIO_ReadPool_fillBuffer(ress->readCtx, toDecode); if (readSize==0) { DISPLAYLEVEL(1, "%s : Read error (39) : premature end \n", - srcFileName); + srcFileName); + AIO_WritePool_releaseIoJob(writeJob); return FIO_ERROR_FRAME_DECODING; } - ress->srcBufferLoaded += readSize; - } } } + } } } - FIO_fwriteSparseEnd(prefs, ress->dstFile, storedSkips); + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); return frameSize; } @@ -2211,37 +2223,36 @@ FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress, FILE* finput, #ifdef ZSTD_GZDECOMPRESS static unsigned long long -FIO_decompressGzFrame(dRess_t* ress, FILE* srcFile, - const FIO_prefs_t* const prefs, - const char* srcFileName) +FIO_decompressGzFrame(dRess_t* ress, const char* srcFileName) { unsigned long long outFileSize = 0; z_stream strm; int flush = Z_NO_FLUSH; int decodingError = 0; - unsigned storedSkips = 0; + IOJob_t *writeJob = NULL; strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; strm.next_in = 0; strm.avail_in = 0; - /* see http://www.zlib.net/manual.html */ + /* see https://www.zlib.net/manual.html */ if (inflateInit2(&strm, 15 /* maxWindowLogSize */ + 16 /* gzip only */) != Z_OK) return FIO_ERROR_FRAME_DECODING; - strm.next_out = (Bytef*)ress->dstBuffer; - strm.avail_out = (uInt)ress->dstBufferSize; - strm.avail_in = (uInt)ress->srcBufferLoaded; - strm.next_in = (z_const unsigned char*)ress->srcBuffer; + writeJob = AIO_WritePool_acquireJob(ress->writeCtx); + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = (uInt)writeJob->bufferSize; + strm.avail_in = (uInt)ress->readCtx->srcBufferLoaded; + strm.next_in = (z_const unsigned char*)ress->readCtx->srcBuffer; for ( ; ; ) { int ret; if (strm.avail_in == 0) { - ress->srcBufferLoaded = fread(ress->srcBuffer, 1, ress->srcBufferSize, srcFile); - if (ress->srcBufferLoaded == 0) flush = Z_FINISH; - strm.next_in = (z_const unsigned char*)ress->srcBuffer; - strm.avail_in = (uInt)ress->srcBufferLoaded; + AIO_ReadPool_consumeAndRefill(ress->readCtx); + if (ress->readCtx->srcBufferLoaded == 0) flush = Z_FINISH; + strm.next_in = (z_const unsigned char*)ress->readCtx->srcBuffer; + strm.avail_in = (uInt)ress->readCtx->srcBufferLoaded; } ret = inflate(&strm, flush); if (ret == Z_BUF_ERROR) { @@ -2252,35 +2263,34 @@ FIO_decompressGzFrame(dRess_t* ress, FILE* srcFile, DISPLAYLEVEL(1, "zstd: %s: inflate error %d \n", srcFileName, ret); decodingError = 1; break; } - { size_t const decompBytes = ress->dstBufferSize - strm.avail_out; + { size_t const decompBytes = writeJob->bufferSize - strm.avail_out; if (decompBytes) { - storedSkips = FIO_fwriteSparse(ress->dstFile, ress->dstBuffer, decompBytes, prefs, storedSkips); + writeJob->usedBufferSize = decompBytes; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); outFileSize += decompBytes; - strm.next_out = (Bytef*)ress->dstBuffer; - strm.avail_out = (uInt)ress->dstBufferSize; + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = (uInt)writeJob->bufferSize; } } if (ret == Z_STREAM_END) break; } - if (strm.avail_in > 0) - memmove(ress->srcBuffer, strm.next_in, strm.avail_in); - ress->srcBufferLoaded = strm.avail_in; + AIO_ReadPool_consumeBytes(ress->readCtx, ress->readCtx->srcBufferLoaded - strm.avail_in); + if ( (inflateEnd(&strm) != Z_OK) /* release resources ; error detected */ && (decodingError==0) ) { DISPLAYLEVEL(1, "zstd: %s: inflateEnd error \n", srcFileName); decodingError = 1; } - FIO_fwriteSparseEnd(prefs, ress->dstFile, storedSkips); + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); return decodingError ? FIO_ERROR_FRAME_DECODING : outFileSize; } #endif - #ifdef ZSTD_LZMADECOMPRESS static unsigned long long -FIO_decompressLzmaFrame(dRess_t* ress, FILE* srcFile, - const FIO_prefs_t* const prefs, +FIO_decompressLzmaFrame(dRess_t* ress, const char* srcFileName, int plain_lzma) { unsigned long long outFileSize = 0; @@ -2288,7 +2298,7 @@ FIO_decompressLzmaFrame(dRess_t* ress, FILE* srcFile, lzma_action action = LZMA_RUN; lzma_ret initRet; int decodingError = 0; - unsigned storedSkips = 0; + IOJob_t *writeJob = NULL; strm.next_in = 0; strm.avail_in = 0; @@ -2305,18 +2315,19 @@ FIO_decompressLzmaFrame(dRess_t* ress, FILE* srcFile, return FIO_ERROR_FRAME_DECODING; } - strm.next_out = (BYTE*)ress->dstBuffer; - strm.avail_out = ress->dstBufferSize; - strm.next_in = (BYTE const*)ress->srcBuffer; - strm.avail_in = ress->srcBufferLoaded; + writeJob = AIO_WritePool_acquireJob(ress->writeCtx); + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = (uInt)writeJob->bufferSize; + strm.next_in = (BYTE const*)ress->readCtx->srcBuffer; + strm.avail_in = ress->readCtx->srcBufferLoaded; for ( ; ; ) { lzma_ret ret; if (strm.avail_in == 0) { - ress->srcBufferLoaded = fread(ress->srcBuffer, 1, ress->srcBufferSize, srcFile); - if (ress->srcBufferLoaded == 0) action = LZMA_FINISH; - strm.next_in = (BYTE const*)ress->srcBuffer; - strm.avail_in = ress->srcBufferLoaded; + AIO_ReadPool_consumeAndRefill(ress->readCtx); + if (ress->readCtx->srcBufferLoaded == 0) action = LZMA_FINISH; + strm.next_in = (BYTE const*)ress->readCtx->srcBuffer; + strm.avail_in = ress->readCtx->srcBufferLoaded; } ret = lzma_code(&strm, action); @@ -2329,102 +2340,90 @@ FIO_decompressLzmaFrame(dRess_t* ress, FILE* srcFile, srcFileName, ret); decodingError = 1; break; } - { size_t const decompBytes = ress->dstBufferSize - strm.avail_out; + { size_t const decompBytes = writeJob->bufferSize - strm.avail_out; if (decompBytes) { - storedSkips = FIO_fwriteSparse(ress->dstFile, ress->dstBuffer, decompBytes, prefs, storedSkips); + writeJob->usedBufferSize = decompBytes; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); outFileSize += decompBytes; - strm.next_out = (BYTE*)ress->dstBuffer; - strm.avail_out = ress->dstBufferSize; + strm.next_out = (Bytef*)writeJob->buffer; + strm.avail_out = writeJob->bufferSize; } } if (ret == LZMA_STREAM_END) break; } - if (strm.avail_in > 0) - memmove(ress->srcBuffer, strm.next_in, strm.avail_in); - ress->srcBufferLoaded = strm.avail_in; + AIO_ReadPool_consumeBytes(ress->readCtx, ress->readCtx->srcBufferLoaded - strm.avail_in); lzma_end(&strm); - FIO_fwriteSparseEnd(prefs, ress->dstFile, storedSkips); + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); return decodingError ? FIO_ERROR_FRAME_DECODING : outFileSize; } #endif #ifdef ZSTD_LZ4DECOMPRESS static unsigned long long -FIO_decompressLz4Frame(dRess_t* ress, FILE* srcFile, - const FIO_prefs_t* const prefs, - const char* srcFileName) +FIO_decompressLz4Frame(dRess_t* ress, const char* srcFileName) { unsigned long long filesize = 0; - LZ4F_errorCode_t nextToLoad; + LZ4F_errorCode_t nextToLoad = 4; LZ4F_decompressionContext_t dCtx; LZ4F_errorCode_t const errorCode = LZ4F_createDecompressionContext(&dCtx, LZ4F_VERSION); int decodingError = 0; - unsigned storedSkips = 0; + IOJob_t *writeJob = NULL; if (LZ4F_isError(errorCode)) { DISPLAYLEVEL(1, "zstd: failed to create lz4 decompression context \n"); return FIO_ERROR_FRAME_DECODING; } - /* Init feed with magic number (already consumed from FILE* sFile) */ - { size_t inSize = 4; - size_t outSize= 0; - MEM_writeLE32(ress->srcBuffer, LZ4_MAGICNUMBER); - nextToLoad = LZ4F_decompress(dCtx, ress->dstBuffer, &outSize, ress->srcBuffer, &inSize, NULL); - if (LZ4F_isError(nextToLoad)) { - DISPLAYLEVEL(1, "zstd: %s: lz4 header error : %s \n", - srcFileName, LZ4F_getErrorName(nextToLoad)); - LZ4F_freeDecompressionContext(dCtx); - return FIO_ERROR_FRAME_DECODING; - } } + writeJob = AIO_WritePool_acquireJob(ress->writeCtx); /* Main Loop */ for (;nextToLoad;) { - size_t readSize; size_t pos = 0; - size_t decodedBytes = ress->dstBufferSize; + size_t decodedBytes = writeJob->bufferSize; + int fullBufferDecoded = 0; /* Read input */ - if (nextToLoad > ress->srcBufferSize) nextToLoad = ress->srcBufferSize; - readSize = fread(ress->srcBuffer, 1, nextToLoad, srcFile); - if (!readSize) break; /* reached end of file or stream */ + AIO_ReadPool_fillBuffer(ress->readCtx, nextToLoad); + if(!ress->readCtx->srcBufferLoaded) break; /* reached end of file */ - while ((pos < readSize) || (decodedBytes == ress->dstBufferSize)) { /* still to read, or still to flush */ + while ((pos < ress->readCtx->srcBufferLoaded) || fullBufferDecoded) { /* still to read, or still to flush */ /* Decode Input (at least partially) */ - size_t remaining = readSize - pos; - decodedBytes = ress->dstBufferSize; - nextToLoad = LZ4F_decompress(dCtx, ress->dstBuffer, &decodedBytes, (char*)(ress->srcBuffer)+pos, &remaining, NULL); + size_t remaining = ress->readCtx->srcBufferLoaded - pos; + decodedBytes = writeJob->bufferSize; + nextToLoad = LZ4F_decompress(dCtx, writeJob->buffer, &decodedBytes, (char*)(ress->readCtx->srcBuffer)+pos, + &remaining, NULL); if (LZ4F_isError(nextToLoad)) { DISPLAYLEVEL(1, "zstd: %s: lz4 decompression error : %s \n", srcFileName, LZ4F_getErrorName(nextToLoad)); decodingError = 1; nextToLoad = 0; break; } pos += remaining; + assert(pos <= ress->readCtx->srcBufferLoaded); + fullBufferDecoded = decodedBytes == writeJob->bufferSize; /* Write Block */ if (decodedBytes) { - storedSkips = FIO_fwriteSparse(ress->dstFile, ress->dstBuffer, decodedBytes, prefs, storedSkips); + UTIL_HumanReadableSize_t hrs; + writeJob->usedBufferSize = decodedBytes; + AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob); filesize += decodedBytes; - DISPLAYUPDATE(2, "\rDecompressed : %u MB ", (unsigned)(filesize>>20)); + hrs = UTIL_makeHumanReadableSize(filesize); + DISPLAYUPDATE_PROGRESS("\rDecompressed : %.*f%s ", hrs.precision, hrs.value, hrs.suffix); } if (!nextToLoad) break; } + AIO_ReadPool_consumeBytes(ress->readCtx, pos); } - /* can be out because readSize == 0, which could be an fread() error */ - if (ferror(srcFile)) { - DISPLAYLEVEL(1, "zstd: %s: read error \n", srcFileName); - decodingError=1; - } - if (nextToLoad!=0) { DISPLAYLEVEL(1, "zstd: %s: unfinished lz4 stream \n", srcFileName); decodingError=1; } LZ4F_freeDecompressionContext(dCtx); - ress->srcBufferLoaded = 0; /* LZ4F will reach exact frame boundary */ - FIO_fwriteSparseEnd(prefs, ress->dstFile, storedSkips); + AIO_WritePool_releaseIoJob(writeJob); + AIO_WritePool_sparseWriteEnd(ress->writeCtx); return decodingError ? FIO_ERROR_FRAME_DECODING : filesize; } @@ -2439,23 +2438,30 @@ FIO_decompressLz4Frame(dRess_t* ress, FILE* srcFile, * 1 : error */ static int FIO_decompressFrames(FIO_ctx_t* const fCtx, - dRess_t ress, FILE* srcFile, - const FIO_prefs_t* const prefs, - const char* dstFileName, const char* srcFileName) + dRess_t ress, const FIO_prefs_t* const prefs, + const char* dstFileName, const char* srcFileName) { unsigned readSomething = 0; unsigned long long filesize = 0; - assert(srcFile != NULL); + int passThrough = prefs->passThrough; + + if (passThrough == -1) { + /* If pass-through mode is not explicitly enabled or disabled, + * default to the legacy behavior of enabling it if we are writing + * to stdout with the overwrite flag enabled. + */ + passThrough = prefs->overwrite && !strcmp(dstFileName, stdoutmark); + } + assert(passThrough == 0 || passThrough == 1); /* for each frame */ for ( ; ; ) { /* check magic number -> version */ size_t const toRead = 4; - const BYTE* const buf = (const BYTE*)ress.srcBuffer; - if (ress.srcBufferLoaded < toRead) /* load up to 4 bytes for header */ - ress.srcBufferLoaded += fread((char*)ress.srcBuffer + ress.srcBufferLoaded, - (size_t)1, toRead - ress.srcBufferLoaded, srcFile); - if (ress.srcBufferLoaded==0) { + const BYTE* buf; + AIO_ReadPool_fillBuffer(ress.readCtx, toRead); + buf = (const BYTE*)ress.readCtx->srcBuffer; + if (ress.readCtx->srcBufferLoaded==0) { if (readSomething==0) { /* srcFile is empty (which is invalid) */ DISPLAYLEVEL(1, "zstd: %s: unexpected end of file \n", srcFileName); return 1; @@ -2463,17 +2469,20 @@ static int FIO_decompressFrames(FIO_ctx_t* const fCtx, break; /* no more input */ } readSomething = 1; /* there is at least 1 byte in srcFile */ - if (ress.srcBufferLoaded < toRead) { + if (ress.readCtx->srcBufferLoaded < toRead) { /* not enough input to check magic number */ + if (passThrough) { + return FIO_passThrough(&ress); + } DISPLAYLEVEL(1, "zstd: %s: unknown header \n", srcFileName); return 1; } - if (ZSTD_isFrame(buf, ress.srcBufferLoaded)) { - unsigned long long const frameSize = FIO_decompressZstdFrame(fCtx, &ress, srcFile, prefs, srcFileName, filesize); + if (ZSTD_isFrame(buf, ress.readCtx->srcBufferLoaded)) { + unsigned long long const frameSize = FIO_decompressZstdFrame(fCtx, &ress, prefs, srcFileName, filesize); if (frameSize == FIO_ERROR_FRAME_DECODING) return 1; filesize += frameSize; } else if (buf[0] == 31 && buf[1] == 139) { /* gz magic number */ #ifdef ZSTD_GZDECOMPRESS - unsigned long long const frameSize = FIO_decompressGzFrame(&ress, srcFile, prefs, srcFileName); + unsigned long long const frameSize = FIO_decompressGzFrame(&ress, srcFileName); if (frameSize == FIO_ERROR_FRAME_DECODING) return 1; filesize += frameSize; #else @@ -2483,7 +2492,7 @@ static int FIO_decompressFrames(FIO_ctx_t* const fCtx, } else if ((buf[0] == 0xFD && buf[1] == 0x37) /* xz magic number */ || (buf[0] == 0x5D && buf[1] == 0x00)) { /* lzma header (no magic number) */ #ifdef ZSTD_LZMADECOMPRESS - unsigned long long const frameSize = FIO_decompressLzmaFrame(&ress, srcFile, prefs, srcFileName, buf[0] != 0xFD); + unsigned long long const frameSize = FIO_decompressLzmaFrame(&ress, srcFileName, buf[0] != 0xFD); if (frameSize == FIO_ERROR_FRAME_DECODING) return 1; filesize += frameSize; #else @@ -2492,18 +2501,15 @@ static int FIO_decompressFrames(FIO_ctx_t* const fCtx, #endif } else if (MEM_readLE32(buf) == LZ4_MAGICNUMBER) { #ifdef ZSTD_LZ4DECOMPRESS - unsigned long long const frameSize = FIO_decompressLz4Frame(&ress, srcFile, prefs, srcFileName); + unsigned long long const frameSize = FIO_decompressLz4Frame(&ress, srcFileName); if (frameSize == FIO_ERROR_FRAME_DECODING) return 1; filesize += frameSize; #else DISPLAYLEVEL(1, "zstd: %s: lz4 file cannot be uncompressed (zstd compiled without HAVE_LZ4) -- ignored \n", srcFileName); return 1; #endif - } else if ((prefs->overwrite) && !strcmp (dstFileName, stdoutmark)) { /* pass-through mode */ - return FIO_passThrough(prefs, - ress.dstFile, srcFile, - ress.srcBuffer, ress.srcBufferSize, - ress.srcBufferLoaded); + } else if (passThrough) { + return FIO_passThrough(&ress); } else { DISPLAYLEVEL(1, "zstd: %s: unsupported format \n", srcFileName); return 1; @@ -2511,45 +2517,45 @@ static int FIO_decompressFrames(FIO_ctx_t* const fCtx, /* Final Status */ fCtx->totalBytesOutput += (size_t)filesize; - DISPLAYLEVEL(2, "\r%79s\r", ""); - /* No status message in pipe mode (stdin - stdout) or multi-files mode */ - if (g_display_prefs.displayLevel >= 2) { - if (fCtx->nbFilesTotal <= 1 || g_display_prefs.displayLevel >= 3) { - DISPLAYLEVEL(2, "%-20s: %llu bytes \n", srcFileName, filesize); - } - } + DISPLAY_PROGRESS("\r%79s\r", ""); + if (FIO_shouldDisplayFileSummary(fCtx)) + DISPLAY_SUMMARY("%-20s: %llu bytes \n", srcFileName, filesize); return 0; } /** FIO_decompressDstFile() : - open `dstFileName`, - or path-through if ress.dstFile is already != 0, + open `dstFileName`, or pass-through if writeCtx's file is already != 0, then start decompression process (FIO_decompressFrames()). @return : 0 : OK 1 : operation aborted */ static int FIO_decompressDstFile(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, - dRess_t ress, FILE* srcFile, - const char* dstFileName, const char* srcFileName) + dRess_t ress, + const char* dstFileName, + const char* srcFileName, + const stat_t* srcFileStat) { int result; - stat_t statbuf; int releaseDstFile = 0; + int transferStat = 0; - if ((ress.dstFile == NULL) && (prefs->testMode==0)) { + if ((AIO_WritePool_getFile(ress.writeCtx) == NULL) && (prefs->testMode == 0)) { + FILE *dstFile; int dstFilePermissions = DEFAULT_FILE_PERMISSIONS; if ( strcmp(srcFileName, stdinmark) /* special case : don't transfer permissions from stdin */ - && UTIL_stat(srcFileName, &statbuf) - && UTIL_isRegularFileStat(&statbuf) ) { - dstFilePermissions = statbuf.st_mode; + && strcmp(dstFileName, stdoutmark) + && UTIL_isRegularFileStat(srcFileStat) ) { + transferStat = 1; + dstFilePermissions = TEMPORARY_FILE_PERMISSIONS; } releaseDstFile = 1; - ress.dstFile = FIO_openDstFile(fCtx, prefs, srcFileName, dstFileName, dstFilePermissions); - if (ress.dstFile==NULL) return 1; + dstFile = FIO_openDstFile(fCtx, prefs, srcFileName, dstFileName, dstFilePermissions); + if (dstFile==NULL) return 1; + AIO_WritePool_setFile(ress.writeCtx, dstFile); /* Must only be added after FIO_openDstFile() succeeds. * Otherwise we may delete the destination file if it already exists, @@ -2558,17 +2564,19 @@ static int FIO_decompressDstFile(FIO_ctx_t* const fCtx, addHandler(dstFileName); } - result = FIO_decompressFrames(fCtx, ress, srcFile, prefs, dstFileName, srcFileName); + result = FIO_decompressFrames(fCtx, ress, prefs, dstFileName, srcFileName); if (releaseDstFile) { - FILE* const dstFile = ress.dstFile; clearHandler(); - ress.dstFile = NULL; - if (fclose(dstFile)) { + if (AIO_WritePool_closeFile(ress.writeCtx)) { DISPLAYLEVEL(1, "zstd: %s: %s \n", dstFileName, strerror(errno)); result = 1; } + if (transferStat) { + UTIL_setFileStat(dstFileName, srcFileStat); + } + if ( (result != 0) /* operation failure */ && strcmp(dstFileName, stdoutmark) /* special case : don't remove() stdout */ ) { @@ -2588,18 +2596,34 @@ static int FIO_decompressDstFile(FIO_ctx_t* const fCtx, static int FIO_decompressSrcFile(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, dRess_t ress, const char* dstFileName, const char* srcFileName) { FILE* srcFile; + stat_t srcFileStat; int result; + U64 fileSize = UTIL_FILESIZE_UNKNOWN; if (UTIL_isDirectory(srcFileName)) { DISPLAYLEVEL(1, "zstd: %s is a directory -- ignored \n", srcFileName); return 1; } - srcFile = FIO_openSrcFile(prefs, srcFileName); + srcFile = FIO_openSrcFile(prefs, srcFileName, &srcFileStat); if (srcFile==NULL) return 1; - ress.srcBufferLoaded = 0; - result = FIO_decompressDstFile(fCtx, prefs, ress, srcFile, dstFileName, srcFileName); + /* Don't use AsyncIO for small files */ + if (strcmp(srcFileName, stdinmark)) /* Stdin doesn't have stats */ + fileSize = UTIL_getFileSizeStat(&srcFileStat); + if(fileSize != UTIL_FILESIZE_UNKNOWN && fileSize < ZSTD_BLOCKSIZE_MAX * 3) { + AIO_ReadPool_setAsync(ress.readCtx, 0); + AIO_WritePool_setAsync(ress.writeCtx, 0); + } else { + AIO_ReadPool_setAsync(ress.readCtx, 1); + AIO_WritePool_setAsync(ress.writeCtx, 1); + } + + AIO_ReadPool_setFile(ress.readCtx, srcFile); + + result = FIO_decompressDstFile(fCtx, prefs, ress, dstFileName, srcFileName, &srcFileStat); + + AIO_ReadPool_setFile(ress.readCtx, NULL); /* Close file */ if (fclose(srcFile)) { @@ -2688,6 +2712,11 @@ FIO_determineDstName(const char* srcFileName, const char* outDirName) size_t srcSuffixLen; const char* const srcSuffix = strrchr(srcFileName, '.'); + + if(!strcmp(srcFileName, stdinmark)) { + return stdoutmark; + } + if (srcSuffix == NULL) { DISPLAYLEVEL(1, "zstd: %s: unknown suffix (%s expected). " @@ -2769,20 +2798,21 @@ FIO_decompressMultipleFilenames(FIO_ctx_t* const fCtx, dRess_t ress = FIO_createDResources(prefs, dictFileName); if (outFileName) { - if (FIO_removeMultiFilesWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) { + if (FIO_multiFilesConcatWarning(fCtx, prefs, outFileName, 1 /* displayLevelCutoff */)) { FIO_freeDResources(ress); return 1; } if (!prefs->testMode) { - ress.dstFile = FIO_openDstFile(fCtx, prefs, NULL, outFileName, DEFAULT_FILE_PERMISSIONS); - if (ress.dstFile == 0) EXM_THROW(19, "cannot open %s", outFileName); + FILE* dstFile = FIO_openDstFile(fCtx, prefs, NULL, outFileName, DEFAULT_FILE_PERMISSIONS); + if (dstFile == 0) EXM_THROW(19, "cannot open %s", outFileName); + AIO_WritePool_setFile(ress.writeCtx, dstFile); } for (; fCtx->currFileIdx < fCtx->nbFilesTotal; fCtx->currFileIdx++) { status = FIO_decompressSrcFile(fCtx, prefs, ress, outFileName, srcNamesTable[fCtx->currFileIdx]); if (!status) fCtx->nbFilesProcessed++; error |= status; } - if ((!prefs->testMode) && (fclose(ress.dstFile))) + if ((!prefs->testMode) && (AIO_WritePool_closeFile(ress.writeCtx))) EXM_THROW(72, "Write error : %s : cannot properly close output file", strerror(errno)); } else { @@ -2812,8 +2842,11 @@ FIO_decompressMultipleFilenames(FIO_ctx_t* const fCtx, FIO_checkFilenameCollisions(srcNamesTable , (unsigned)fCtx->nbFilesTotal); } - if (fCtx->nbFilesProcessed >= 1 && fCtx->nbFilesTotal > 1 && fCtx->totalBytesOutput != 0) - DISPLAYLEVEL(2, "%d files decompressed : %6zu bytes total \n", fCtx->nbFilesProcessed, fCtx->totalBytesOutput); + if (FIO_shouldDisplayMultipleFileSummary(fCtx)) { + DISPLAY_PROGRESS("\r%79s\r", ""); + DISPLAY_SUMMARY("%d files decompressed : %6llu bytes total \n", + fCtx->nbFilesProcessed, (unsigned long long)fCtx->totalBytesOutput); + } FIO_freeDResources(ress); return error; @@ -2831,7 +2864,9 @@ typedef struct { int numSkippableFrames; int decompUnavailable; int usesCheck; + BYTE checksum[4]; U32 nbFiles; + unsigned dictID; } fileInfo_t; typedef enum { @@ -2839,7 +2874,7 @@ typedef enum { info_frame_error=1, info_not_zstd=2, info_file_error=3, - info_truncated_input=4, + info_truncated_input=4 } InfoError; #define ERROR_IF(c,n,...) { \ @@ -2886,6 +2921,12 @@ FIO_analyzeFrames(fileInfo_t* info, FILE* const srcFile) } ERROR_IF(ZSTD_getFrameHeader(&header, headerBuffer, numBytesRead) != 0, info_frame_error, "Error: could not decode frame header"); + if (info->dictID != 0 && info->dictID != header.dictID) { + DISPLAY("WARNING: File contains multiple frames with different dictionary IDs. Showing dictID 0 instead"); + info->dictID = 0; + } else { + info->dictID = header.dictID; + } info->windowSize = header.windowSize; /* move to the end of the frame header */ { size_t const headerSize = ZSTD_frameHeaderSize(headerBuffer, numBytesRead); @@ -2918,8 +2959,8 @@ FIO_analyzeFrames(fileInfo_t* info, FILE* const srcFile) int const contentChecksumFlag = (frameHeaderDescriptor & (1 << 2)) >> 2; if (contentChecksumFlag) { info->usesCheck = 1; - ERROR_IF(fseek(srcFile, 4, SEEK_CUR) != 0, - info_frame_error, "Error: could not skip past checksum"); + ERROR_IF(fread(info->checksum, 1, 4, srcFile) != 4, + info_frame_error, "Error: could not read checksum"); } } info->numActualFrames++; } @@ -2945,10 +2986,11 @@ static InfoError getFileInfo_fileConfirmed(fileInfo_t* info, const char* inFileName) { InfoError status; - FILE* const srcFile = FIO_openSrcFile(NULL, inFileName); + stat_t srcFileStat; + FILE* const srcFile = FIO_openSrcFile(NULL, inFileName, &srcFileStat); ERROR_IF(srcFile == NULL, info_file_error, "Error: could not open source file %s", inFileName); - info->compressedSize = UTIL_getFileSize(inFileName); + info->compressedSize = UTIL_getFileSizeStat(&srcFileStat); status = FIO_analyzeFrames(info, srcFile); fclose(srcFile); @@ -2973,25 +3015,24 @@ getFileInfo(fileInfo_t* info, const char* srcFileName) static void displayInfo(const char* inFileName, const fileInfo_t* info, int displayLevel) { - unsigned const unit = info->compressedSize < (1 MB) ? (1 KB) : (1 MB); - const char* const unitStr = info->compressedSize < (1 MB) ? "KB" : "MB"; - double const windowSizeUnit = (double)info->windowSize / unit; - double const compressedSizeUnit = (double)info->compressedSize / unit; - double const decompressedSizeUnit = (double)info->decompressedSize / unit; + UTIL_HumanReadableSize_t const window_hrs = UTIL_makeHumanReadableSize(info->windowSize); + UTIL_HumanReadableSize_t const compressed_hrs = UTIL_makeHumanReadableSize(info->compressedSize); + UTIL_HumanReadableSize_t const decompressed_hrs = UTIL_makeHumanReadableSize(info->decompressedSize); double const ratio = (info->compressedSize == 0) ? 0 : ((double)info->decompressedSize)/(double)info->compressedSize; const char* const checkString = (info->usesCheck ? "XXH64" : "None"); if (displayLevel <= 2) { if (!info->decompUnavailable) { - DISPLAYOUT("%6d %5d %7.2f %2s %9.2f %2s %5.3f %5s %s\n", + DISPLAYOUT("%6d %5d %6.*f%4s %8.*f%4s %5.3f %5s %s\n", info->numSkippableFrames + info->numActualFrames, info->numSkippableFrames, - compressedSizeUnit, unitStr, decompressedSizeUnit, unitStr, + compressed_hrs.precision, compressed_hrs.value, compressed_hrs.suffix, + decompressed_hrs.precision, decompressed_hrs.value, decompressed_hrs.suffix, ratio, checkString, inFileName); } else { - DISPLAYOUT("%6d %5d %7.2f %2s %5s %s\n", + DISPLAYOUT("%6d %5d %6.*f%4s %5s %s\n", info->numSkippableFrames + info->numActualFrames, info->numSkippableFrames, - compressedSizeUnit, unitStr, + compressed_hrs.precision, compressed_hrs.value, compressed_hrs.suffix, checkString, inFileName); } } else { @@ -2999,19 +3040,29 @@ displayInfo(const char* inFileName, const fileInfo_t* info, int displayLevel) DISPLAYOUT("# Zstandard Frames: %d\n", info->numActualFrames); if (info->numSkippableFrames) DISPLAYOUT("# Skippable Frames: %d\n", info->numSkippableFrames); - DISPLAYOUT("Window Size: %.2f %2s (%llu B)\n", - windowSizeUnit, unitStr, + DISPLAYOUT("DictID: %u\n", info->dictID); + DISPLAYOUT("Window Size: %.*f%s (%llu B)\n", + window_hrs.precision, window_hrs.value, window_hrs.suffix, (unsigned long long)info->windowSize); - DISPLAYOUT("Compressed Size: %.2f %2s (%llu B)\n", - compressedSizeUnit, unitStr, + DISPLAYOUT("Compressed Size: %.*f%s (%llu B)\n", + compressed_hrs.precision, compressed_hrs.value, compressed_hrs.suffix, (unsigned long long)info->compressedSize); if (!info->decompUnavailable) { - DISPLAYOUT("Decompressed Size: %.2f %2s (%llu B)\n", - decompressedSizeUnit, unitStr, + DISPLAYOUT("Decompressed Size: %.*f%s (%llu B)\n", + decompressed_hrs.precision, decompressed_hrs.value, decompressed_hrs.suffix, (unsigned long long)info->decompressedSize); DISPLAYOUT("Ratio: %.4f\n", ratio); } - DISPLAYOUT("Check: %s\n", checkString); + + if (info->usesCheck && info->numActualFrames == 1) { + DISPLAYOUT("Check: %s %02x%02x%02x%02x\n", checkString, + info->checksum[3], info->checksum[2], + info->checksum[1], info->checksum[0] + ); + } else { + DISPLAYOUT("Check: %s\n", checkString); + } + DISPLAYOUT("\n"); } } @@ -3075,7 +3126,7 @@ int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int dis } } if (numFiles == 0) { - if (!IS_CONSOLE(stdin)) { + if (!UTIL_isConsole(stdin)) { DISPLAYLEVEL(1, "zstd: --list does not support reading from standard input \n"); } DISPLAYLEVEL(1, "No files given \n"); @@ -3095,24 +3146,23 @@ int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int dis error |= FIO_listFile(&total, filenameTable[u], displayLevel); } } if (numFiles > 1 && displayLevel <= 2) { /* display total */ - unsigned const unit = total.compressedSize < (1 MB) ? (1 KB) : (1 MB); - const char* const unitStr = total.compressedSize < (1 MB) ? "KB" : "MB"; - double const compressedSizeUnit = (double)total.compressedSize / unit; - double const decompressedSizeUnit = (double)total.decompressedSize / unit; + UTIL_HumanReadableSize_t const compressed_hrs = UTIL_makeHumanReadableSize(total.compressedSize); + UTIL_HumanReadableSize_t const decompressed_hrs = UTIL_makeHumanReadableSize(total.decompressedSize); double const ratio = (total.compressedSize == 0) ? 0 : ((double)total.decompressedSize)/(double)total.compressedSize; const char* const checkString = (total.usesCheck ? "XXH64" : ""); DISPLAYOUT("----------------------------------------------------------------- \n"); if (total.decompUnavailable) { - DISPLAYOUT("%6d %5d %7.2f %2s %5s %u files\n", + DISPLAYOUT("%6d %5d %6.*f%4s %5s %u files\n", total.numSkippableFrames + total.numActualFrames, total.numSkippableFrames, - compressedSizeUnit, unitStr, + compressed_hrs.precision, compressed_hrs.value, compressed_hrs.suffix, checkString, (unsigned)total.nbFiles); } else { - DISPLAYOUT("%6d %5d %7.2f %2s %9.2f %2s %5.3f %5s %u files\n", + DISPLAYOUT("%6d %5d %6.*f%4s %8.*f%4s %5.3f %5s %u files\n", total.numSkippableFrames + total.numActualFrames, total.numSkippableFrames, - compressedSizeUnit, unitStr, decompressedSizeUnit, unitStr, + compressed_hrs.precision, compressed_hrs.value, compressed_hrs.suffix, + decompressed_hrs.precision, decompressed_hrs.value, decompressed_hrs.suffix, ratio, checkString, (unsigned)total.nbFiles); } } return error; diff --git a/src/dependencies/zstd-1.5.0/programs/fileio.h b/src/dependencies/zstd-1.5.4/programs/fileio.h similarity index 90% rename from src/dependencies/zstd-1.5.0/programs/fileio.h rename to src/dependencies/zstd-1.5.4/programs/fileio.h index 9d97ec8..291d4d4 100644 --- a/src/dependencies/zstd-1.5.0/programs/fileio.h +++ b/src/dependencies/zstd-1.5.4/programs/fileio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -12,6 +12,8 @@ #ifndef FILEIO_H_23981798732 #define FILEIO_H_23981798732 +#include "fileio_types.h" +#include "util.h" /* FileNamesTable */ #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */ #include "../lib/zstd.h" /* ZSTD_* */ @@ -53,10 +55,6 @@ extern "C" { /*-************************************* * Types ***************************************/ -typedef enum { FIO_zstdCompression, FIO_gzipCompression, FIO_xzCompression, FIO_lzmaCompression, FIO_lz4Compression } FIO_compressionType_t; - -typedef struct FIO_prefs_s FIO_prefs_t; - FIO_prefs_t* FIO_createPreferences(void); void FIO_freePreferences(FIO_prefs_t* const prefs); @@ -66,9 +64,6 @@ typedef struct FIO_ctx_s FIO_ctx_t; FIO_ctx_t* FIO_createContext(void); void FIO_freeContext(FIO_ctx_t* const fCtx); -typedef struct FIO_display_prefs_s FIO_display_prefs_t; - -typedef enum { FIO_ps_auto, FIO_ps_never, FIO_ps_always } FIO_progressSetting_e; /*-************************************* * Parameters @@ -76,7 +71,7 @@ typedef enum { FIO_ps_auto, FIO_ps_never, FIO_ps_always } FIO_progressSetting_e; /* FIO_prefs_t functions */ void FIO_setCompressionType(FIO_prefs_t* const prefs, FIO_compressionType_t compressionType); void FIO_overwriteMode(FIO_prefs_t* const prefs); -void FIO_setAdaptiveMode(FIO_prefs_t* const prefs, unsigned adapt); +void FIO_setAdaptiveMode(FIO_prefs_t* const prefs, int adapt); void FIO_setAdaptMin(FIO_prefs_t* const prefs, int minCLevel); void FIO_setAdaptMax(FIO_prefs_t* const prefs, int maxCLevel); void FIO_setUseRowMatchFinder(FIO_prefs_t* const prefs, int useRowMatchFinder); @@ -91,8 +86,8 @@ void FIO_setLdmMinMatch(FIO_prefs_t* const prefs, int ldmMinMatch); void FIO_setMemLimit(FIO_prefs_t* const prefs, unsigned memLimit); void FIO_setNbWorkers(FIO_prefs_t* const prefs, int nbWorkers); void FIO_setOverlapLog(FIO_prefs_t* const prefs, int overlapLog); -void FIO_setRemoveSrcFile(FIO_prefs_t* const prefs, unsigned flag); -void FIO_setSparseWrite(FIO_prefs_t* const prefs, unsigned sparse); /**< 0: no sparse; 1: disable on stdout; 2: always enabled */ +void FIO_setRemoveSrcFile(FIO_prefs_t* const prefs, int flag); +void FIO_setSparseWrite(FIO_prefs_t* const prefs, int sparse); /**< 0: no sparse; 1: disable on stdout; 2: always enabled */ void FIO_setRsyncable(FIO_prefs_t* const prefs, int rsyncable); void FIO_setStreamSrcSize(FIO_prefs_t* const prefs, size_t streamSrcSize); void FIO_setTargetCBlockSize(FIO_prefs_t* const prefs, size_t targetCBlockSize); @@ -100,7 +95,7 @@ void FIO_setSrcSizeHint(FIO_prefs_t* const prefs, size_t srcSizeHint); void FIO_setTestMode(FIO_prefs_t* const prefs, int testMode); void FIO_setLiteralCompressionMode( FIO_prefs_t* const prefs, - ZSTD_literalCompressionMode_e mode); + ZSTD_paramSwitch_e mode); void FIO_setProgressSetting(FIO_progressSetting_e progressSetting); void FIO_setNotificationLevel(int level); @@ -108,6 +103,9 @@ void FIO_setExcludeCompressedFile(FIO_prefs_t* const prefs, int excludeCompresse void FIO_setAllowBlockDevices(FIO_prefs_t* const prefs, int allowBlockDevices); void FIO_setPatchFromMode(FIO_prefs_t* const prefs, int value); void FIO_setContentSize(FIO_prefs_t* const prefs, int value); +void FIO_displayCompressionParameters(const FIO_prefs_t* prefs); +void FIO_setAsyncIOFlag(FIO_prefs_t* const prefs, int value); +void FIO_setPassThroughFlag(FIO_prefs_t* const prefs, int value); /* FIO_ctx_t functions */ void FIO_setNbFilesTotal(FIO_ctx_t* const fCtx, int value); @@ -170,6 +168,9 @@ int FIO_checkFilenameCollisions(const char** filenameTable, unsigned nbFiles); /* custom crash signal handler */ void FIO_addAbortHandler(void); +char const* FIO_zlibVersion(void); +char const* FIO_lz4Version(void); +char const* FIO_lzmaVersion(void); #if defined (__cplusplus) diff --git a/src/dependencies/zstd-1.5.4/programs/fileio_asyncio.c b/src/dependencies/zstd-1.5.4/programs/fileio_asyncio.c new file mode 100644 index 0000000..fe9cca9 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/fileio_asyncio.c @@ -0,0 +1,663 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#include "platform.h" +#include /* fprintf, open, fdopen, fread, _fileno, stdin, stdout */ +#include /* malloc, free */ +#include +#include /* errno */ + +#if defined (_MSC_VER) +# include +# include +#endif + +#include "fileio_asyncio.h" +#include "fileio_common.h" + +/* ********************************************************************** + * Sparse write + ************************************************************************/ + +/** AIO_fwriteSparse() : +* @return : storedSkips, +* argument for next call to AIO_fwriteSparse() or AIO_fwriteSparseEnd() */ +static unsigned +AIO_fwriteSparse(FILE* file, + const void* buffer, size_t bufferSize, + const FIO_prefs_t* const prefs, + unsigned storedSkips) +{ + const size_t* const bufferT = (const size_t*)buffer; /* Buffer is supposed malloc'ed, hence aligned on size_t */ + size_t bufferSizeT = bufferSize / sizeof(size_t); + const size_t* const bufferTEnd = bufferT + bufferSizeT; + const size_t* ptrT = bufferT; + static const size_t segmentSizeT = (32 KB) / sizeof(size_t); /* check every 32 KB */ + + if (prefs->testMode) return 0; /* do not output anything in test mode */ + + if (!prefs->sparseFileSupport) { /* normal write */ + size_t const sizeCheck = fwrite(buffer, 1, bufferSize, file); + if (sizeCheck != bufferSize) + EXM_THROW(70, "Write error : cannot write block : %s", + strerror(errno)); + return 0; + } + + /* avoid int overflow */ + if (storedSkips > 1 GB) { + if (LONG_SEEK(file, 1 GB, SEEK_CUR) != 0) + EXM_THROW(91, "1 GB skip error (sparse file support)"); + storedSkips -= 1 GB; + } + + while (ptrT < bufferTEnd) { + size_t nb0T; + + /* adjust last segment if < 32 KB */ + size_t seg0SizeT = segmentSizeT; + if (seg0SizeT > bufferSizeT) seg0SizeT = bufferSizeT; + bufferSizeT -= seg0SizeT; + + /* count leading zeroes */ + for (nb0T=0; (nb0T < seg0SizeT) && (ptrT[nb0T] == 0); nb0T++) ; + storedSkips += (unsigned)(nb0T * sizeof(size_t)); + + if (nb0T != seg0SizeT) { /* not all 0s */ + size_t const nbNon0ST = seg0SizeT - nb0T; + /* skip leading zeros */ + if (LONG_SEEK(file, storedSkips, SEEK_CUR) != 0) + EXM_THROW(92, "Sparse skip error ; try --no-sparse"); + storedSkips = 0; + /* write the rest */ + if (fwrite(ptrT + nb0T, sizeof(size_t), nbNon0ST, file) != nbNon0ST) + EXM_THROW(93, "Write error : cannot write block : %s", + strerror(errno)); + } + ptrT += seg0SizeT; + } + + { static size_t const maskT = sizeof(size_t)-1; + if (bufferSize & maskT) { + /* size not multiple of sizeof(size_t) : implies end of block */ + const char* const restStart = (const char*)bufferTEnd; + const char* restPtr = restStart; + const char* const restEnd = (const char*)buffer + bufferSize; + assert(restEnd > restStart && restEnd < restStart + sizeof(size_t)); + for ( ; (restPtr < restEnd) && (*restPtr == 0); restPtr++) ; + storedSkips += (unsigned) (restPtr - restStart); + if (restPtr != restEnd) { + /* not all remaining bytes are 0 */ + size_t const restSize = (size_t)(restEnd - restPtr); + if (LONG_SEEK(file, storedSkips, SEEK_CUR) != 0) + EXM_THROW(92, "Sparse skip error ; try --no-sparse"); + if (fwrite(restPtr, 1, restSize, file) != restSize) + EXM_THROW(95, "Write error : cannot write end of decoded block : %s", + strerror(errno)); + storedSkips = 0; + } } } + + return storedSkips; +} + +static void +AIO_fwriteSparseEnd(const FIO_prefs_t* const prefs, FILE* file, unsigned storedSkips) +{ + if (prefs->testMode) assert(storedSkips == 0); + if (storedSkips>0) { + assert(prefs->sparseFileSupport > 0); /* storedSkips>0 implies sparse support is enabled */ + (void)prefs; /* assert can be disabled, in which case prefs becomes unused */ + if (LONG_SEEK(file, storedSkips-1, SEEK_CUR) != 0) + EXM_THROW(69, "Final skip error (sparse file support)"); + /* last zero must be explicitly written, + * so that skipped ones get implicitly translated as zero by FS */ + { const char lastZeroByte[1] = { 0 }; + if (fwrite(lastZeroByte, 1, 1, file) != 1) + EXM_THROW(69, "Write error : cannot write last zero : %s", strerror(errno)); + } } +} + + +/* ********************************************************************** + * AsyncIO functionality + ************************************************************************/ + +/* AIO_supported: + * Returns 1 if AsyncIO is supported on the system, 0 otherwise. */ +int AIO_supported(void) { +#ifdef ZSTD_MULTITHREAD + return 1; +#else + return 0; +#endif +} + +/* *********************************** + * Generic IoPool implementation + *************************************/ + +static IOJob_t *AIO_IOPool_createIoJob(IOPoolCtx_t *ctx, size_t bufferSize) { + IOJob_t* const job = (IOJob_t*) malloc(sizeof(IOJob_t)); + void* const buffer = malloc(bufferSize); + if(!job || !buffer) + EXM_THROW(101, "Allocation error : not enough memory"); + job->buffer = buffer; + job->bufferSize = bufferSize; + job->usedBufferSize = 0; + job->file = NULL; + job->ctx = ctx; + job->offset = 0; + return job; +} + + +/* AIO_IOPool_createThreadPool: + * Creates a thread pool and a mutex for threaded IO pool. + * Displays warning if asyncio is requested but MT isn't available. */ +static void AIO_IOPool_createThreadPool(IOPoolCtx_t* ctx, const FIO_prefs_t* prefs) { + ctx->threadPool = NULL; + ctx->threadPoolActive = 0; + if(prefs->asyncIO) { + if (ZSTD_pthread_mutex_init(&ctx->ioJobsMutex, NULL)) + EXM_THROW(102,"Failed creating ioJobsMutex mutex"); + /* We want MAX_IO_JOBS-2 queue items because we need to always have 1 free buffer to + * decompress into and 1 buffer that's actively written to disk and owned by the writing thread. */ + assert(MAX_IO_JOBS >= 2); + ctx->threadPool = POOL_create(1, MAX_IO_JOBS - 2); + ctx->threadPoolActive = 1; + if (!ctx->threadPool) + EXM_THROW(104, "Failed creating I/O thread pool"); + } +} + +/* AIO_IOPool_init: + * Allocates and sets and a new I/O thread pool including its included availableJobs. */ +static void AIO_IOPool_init(IOPoolCtx_t* ctx, const FIO_prefs_t* prefs, POOL_function poolFunction, size_t bufferSize) { + int i; + AIO_IOPool_createThreadPool(ctx, prefs); + ctx->prefs = prefs; + ctx->poolFunction = poolFunction; + ctx->totalIoJobs = ctx->threadPool ? MAX_IO_JOBS : 2; + ctx->availableJobsCount = ctx->totalIoJobs; + for(i=0; i < ctx->availableJobsCount; i++) { + ctx->availableJobs[i] = AIO_IOPool_createIoJob(ctx, bufferSize); + } + ctx->jobBufferSize = bufferSize; + ctx->file = NULL; +} + + +/* AIO_IOPool_threadPoolActive: + * Check if current operation uses thread pool. + * Note that in some cases we have a thread pool initialized but choose not to use it. */ +static int AIO_IOPool_threadPoolActive(IOPoolCtx_t* ctx) { + return ctx->threadPool && ctx->threadPoolActive; +} + + +/* AIO_IOPool_lockJobsMutex: + * Locks the IO jobs mutex if threading is active */ +static void AIO_IOPool_lockJobsMutex(IOPoolCtx_t* ctx) { + if(AIO_IOPool_threadPoolActive(ctx)) + ZSTD_pthread_mutex_lock(&ctx->ioJobsMutex); +} + +/* AIO_IOPool_unlockJobsMutex: + * Unlocks the IO jobs mutex if threading is active */ +static void AIO_IOPool_unlockJobsMutex(IOPoolCtx_t* ctx) { + if(AIO_IOPool_threadPoolActive(ctx)) + ZSTD_pthread_mutex_unlock(&ctx->ioJobsMutex); +} + +/* AIO_IOPool_releaseIoJob: + * Releases an acquired job back to the pool. Doesn't execute the job. */ +static void AIO_IOPool_releaseIoJob(IOJob_t* job) { + IOPoolCtx_t* const ctx = (IOPoolCtx_t *) job->ctx; + AIO_IOPool_lockJobsMutex(ctx); + assert(ctx->availableJobsCount < ctx->totalIoJobs); + ctx->availableJobs[ctx->availableJobsCount++] = job; + AIO_IOPool_unlockJobsMutex(ctx); +} + +/* AIO_IOPool_join: + * Waits for all tasks in the pool to finish executing. */ +static void AIO_IOPool_join(IOPoolCtx_t* ctx) { + if(AIO_IOPool_threadPoolActive(ctx)) + POOL_joinJobs(ctx->threadPool); +} + +/* AIO_IOPool_setThreaded: + * Allows (de)activating threaded mode, to be used when the expected overhead + * of threading costs more than the expected gains. */ +static void AIO_IOPool_setThreaded(IOPoolCtx_t* ctx, int threaded) { + assert(threaded == 0 || threaded == 1); + assert(ctx != NULL); + if(ctx->threadPoolActive != threaded) { + AIO_IOPool_join(ctx); + ctx->threadPoolActive = threaded; + } +} + +/* AIO_IOPool_free: + * Release a previously allocated IO thread pool. Makes sure all tasks are done and released. */ +static void AIO_IOPool_destroy(IOPoolCtx_t* ctx) { + int i; + if(ctx->threadPool) { + /* Make sure we finish all tasks and then free the resources */ + AIO_IOPool_join(ctx); + /* Make sure we are not leaking availableJobs */ + assert(ctx->availableJobsCount == ctx->totalIoJobs); + POOL_free(ctx->threadPool); + ZSTD_pthread_mutex_destroy(&ctx->ioJobsMutex); + } + assert(ctx->file == NULL); + for(i=0; iavailableJobsCount; i++) { + IOJob_t* job = (IOJob_t*) ctx->availableJobs[i]; + free(job->buffer); + free(job); + } +} + +/* AIO_IOPool_acquireJob: + * Returns an available io job to be used for a future io. */ +static IOJob_t* AIO_IOPool_acquireJob(IOPoolCtx_t* ctx) { + IOJob_t *job; + assert(ctx->file != NULL || ctx->prefs->testMode); + AIO_IOPool_lockJobsMutex(ctx); + assert(ctx->availableJobsCount > 0); + job = (IOJob_t*) ctx->availableJobs[--ctx->availableJobsCount]; + AIO_IOPool_unlockJobsMutex(ctx); + job->usedBufferSize = 0; + job->file = ctx->file; + job->offset = 0; + return job; +} + + +/* AIO_IOPool_setFile: + * Sets the destination file for future files in the pool. + * Requires completion of all queued jobs and release of all otherwise acquired jobs. */ +static void AIO_IOPool_setFile(IOPoolCtx_t* ctx, FILE* file) { + assert(ctx!=NULL); + AIO_IOPool_join(ctx); + assert(ctx->availableJobsCount == ctx->totalIoJobs); + ctx->file = file; +} + +static FILE* AIO_IOPool_getFile(const IOPoolCtx_t* ctx) { + return ctx->file; +} + +/* AIO_IOPool_enqueueJob: + * Enqueues an io job for execution. + * The queued job shouldn't be used directly after queueing it. */ +static void AIO_IOPool_enqueueJob(IOJob_t* job) { + IOPoolCtx_t* const ctx = (IOPoolCtx_t *)job->ctx; + if(AIO_IOPool_threadPoolActive(ctx)) + POOL_add(ctx->threadPool, ctx->poolFunction, job); + else + ctx->poolFunction(job); +} + +/* *********************************** + * WritePool implementation + *************************************/ + +/* AIO_WritePool_acquireJob: + * Returns an available write job to be used for a future write. */ +IOJob_t* AIO_WritePool_acquireJob(WritePoolCtx_t* ctx) { + return AIO_IOPool_acquireJob(&ctx->base); +} + +/* AIO_WritePool_enqueueAndReacquireWriteJob: + * Queues a write job for execution and acquires a new one. + * After execution `job`'s pointed value would change to the newly acquired job. + * Make sure to set `usedBufferSize` to the wanted length before call. + * The queued job shouldn't be used directly after queueing it. */ +void AIO_WritePool_enqueueAndReacquireWriteJob(IOJob_t **job) { + AIO_IOPool_enqueueJob(*job); + *job = AIO_IOPool_acquireJob((IOPoolCtx_t *)(*job)->ctx); +} + +/* AIO_WritePool_sparseWriteEnd: + * Ends sparse writes to the current file. + * Blocks on completion of all current write jobs before executing. */ +void AIO_WritePool_sparseWriteEnd(WritePoolCtx_t* ctx) { + assert(ctx != NULL); + AIO_IOPool_join(&ctx->base); + AIO_fwriteSparseEnd(ctx->base.prefs, ctx->base.file, ctx->storedSkips); + ctx->storedSkips = 0; +} + +/* AIO_WritePool_setFile: + * Sets the destination file for future writes in the pool. + * Requires completion of all queues write jobs and release of all otherwise acquired jobs. + * Also requires ending of sparse write if a previous file was used in sparse mode. */ +void AIO_WritePool_setFile(WritePoolCtx_t* ctx, FILE* file) { + AIO_IOPool_setFile(&ctx->base, file); + assert(ctx->storedSkips == 0); +} + +/* AIO_WritePool_getFile: + * Returns the file the writePool is currently set to write to. */ +FILE* AIO_WritePool_getFile(const WritePoolCtx_t* ctx) { + return AIO_IOPool_getFile(&ctx->base); +} + +/* AIO_WritePool_releaseIoJob: + * Releases an acquired job back to the pool. Doesn't execute the job. */ +void AIO_WritePool_releaseIoJob(IOJob_t* job) { + AIO_IOPool_releaseIoJob(job); +} + +/* AIO_WritePool_closeFile: + * Ends sparse write and closes the writePool's current file and sets the file to NULL. + * Requires completion of all queues write jobs and release of all otherwise acquired jobs. */ +int AIO_WritePool_closeFile(WritePoolCtx_t* ctx) { + FILE* const dstFile = ctx->base.file; + assert(dstFile!=NULL || ctx->base.prefs->testMode!=0); + AIO_WritePool_sparseWriteEnd(ctx); + AIO_IOPool_setFile(&ctx->base, NULL); + return fclose(dstFile); +} + +/* AIO_WritePool_executeWriteJob: + * Executes a write job synchronously. Can be used as a function for a thread pool. */ +static void AIO_WritePool_executeWriteJob(void* opaque){ + IOJob_t* const job = (IOJob_t*) opaque; + WritePoolCtx_t* const ctx = (WritePoolCtx_t*) job->ctx; + ctx->storedSkips = AIO_fwriteSparse(job->file, job->buffer, job->usedBufferSize, ctx->base.prefs, ctx->storedSkips); + AIO_IOPool_releaseIoJob(job); +} + +/* AIO_WritePool_create: + * Allocates and sets and a new write pool including its included jobs. */ +WritePoolCtx_t* AIO_WritePool_create(const FIO_prefs_t* prefs, size_t bufferSize) { + WritePoolCtx_t* const ctx = (WritePoolCtx_t*) malloc(sizeof(WritePoolCtx_t)); + if(!ctx) EXM_THROW(100, "Allocation error : not enough memory"); + AIO_IOPool_init(&ctx->base, prefs, AIO_WritePool_executeWriteJob, bufferSize); + ctx->storedSkips = 0; + return ctx; +} + +/* AIO_WritePool_free: + * Frees and releases a writePool and its resources. Closes destination file if needs to. */ +void AIO_WritePool_free(WritePoolCtx_t* ctx) { + /* Make sure we finish all tasks and then free the resources */ + if(AIO_WritePool_getFile(ctx)) + AIO_WritePool_closeFile(ctx); + AIO_IOPool_destroy(&ctx->base); + assert(ctx->storedSkips==0); + free(ctx); +} + +/* AIO_WritePool_setAsync: + * Allows (de)activating async mode, to be used when the expected overhead + * of asyncio costs more than the expected gains. */ +void AIO_WritePool_setAsync(WritePoolCtx_t* ctx, int async) { + AIO_IOPool_setThreaded(&ctx->base, async); +} + + +/* *********************************** + * ReadPool implementation + *************************************/ +static void AIO_ReadPool_releaseAllCompletedJobs(ReadPoolCtx_t* ctx) { + int i; + for(i=0; icompletedJobsCount; i++) { + IOJob_t* job = (IOJob_t*) ctx->completedJobs[i]; + AIO_IOPool_releaseIoJob(job); + } + ctx->completedJobsCount = 0; +} + +static void AIO_ReadPool_addJobToCompleted(IOJob_t* job) { + ReadPoolCtx_t* const ctx = (ReadPoolCtx_t *)job->ctx; + AIO_IOPool_lockJobsMutex(&ctx->base); + assert(ctx->completedJobsCount < MAX_IO_JOBS); + ctx->completedJobs[ctx->completedJobsCount++] = job; + if(AIO_IOPool_threadPoolActive(&ctx->base)) { + ZSTD_pthread_cond_signal(&ctx->jobCompletedCond); + } + AIO_IOPool_unlockJobsMutex(&ctx->base); +} + +/* AIO_ReadPool_findNextWaitingOffsetCompletedJob_locked: + * Looks through the completed jobs for a job matching the waitingOnOffset and returns it, + * if job wasn't found returns NULL. + * IMPORTANT: assumes ioJobsMutex is locked. */ +static IOJob_t* AIO_ReadPool_findNextWaitingOffsetCompletedJob_locked(ReadPoolCtx_t* ctx) { + IOJob_t *job = NULL; + int i; + /* This implementation goes through all completed jobs and looks for the one matching the next offset. + * While not strictly needed for a single threaded reader implementation (as in such a case we could expect + * reads to be completed in order) this implementation was chosen as it better fits other asyncio + * interfaces (such as io_uring) that do not provide promises regarding order of completion. */ + for (i=0; icompletedJobsCount; i++) { + job = (IOJob_t *) ctx->completedJobs[i]; + if (job->offset == ctx->waitingOnOffset) { + ctx->completedJobs[i] = ctx->completedJobs[--ctx->completedJobsCount]; + return job; + } + } + return NULL; +} + +/* AIO_ReadPool_numReadsInFlight: + * Returns the number of IO read jobs currently in flight. */ +static size_t AIO_ReadPool_numReadsInFlight(ReadPoolCtx_t* ctx) { + const size_t jobsHeld = (ctx->currentJobHeld==NULL ? 0 : 1); + return ctx->base.totalIoJobs - (ctx->base.availableJobsCount + ctx->completedJobsCount + jobsHeld); +} + +/* AIO_ReadPool_getNextCompletedJob: + * Returns a completed IOJob_t for the next read in line based on waitingOnOffset and advances waitingOnOffset. + * Would block. */ +static IOJob_t* AIO_ReadPool_getNextCompletedJob(ReadPoolCtx_t* ctx) { + IOJob_t *job = NULL; + AIO_IOPool_lockJobsMutex(&ctx->base); + + job = AIO_ReadPool_findNextWaitingOffsetCompletedJob_locked(ctx); + + /* As long as we didn't find the job matching the next read, and we have some reads in flight continue waiting */ + while (!job && (AIO_ReadPool_numReadsInFlight(ctx) > 0)) { + assert(ctx->base.threadPool != NULL); /* we shouldn't be here if we work in sync mode */ + ZSTD_pthread_cond_wait(&ctx->jobCompletedCond, &ctx->base.ioJobsMutex); + job = AIO_ReadPool_findNextWaitingOffsetCompletedJob_locked(ctx); + } + + if(job) { + assert(job->offset == ctx->waitingOnOffset); + ctx->waitingOnOffset += job->usedBufferSize; + } + + AIO_IOPool_unlockJobsMutex(&ctx->base); + return job; +} + + +/* AIO_ReadPool_executeReadJob: + * Executes a read job synchronously. Can be used as a function for a thread pool. */ +static void AIO_ReadPool_executeReadJob(void* opaque){ + IOJob_t* const job = (IOJob_t*) opaque; + ReadPoolCtx_t* const ctx = (ReadPoolCtx_t *)job->ctx; + if(ctx->reachedEof) { + job->usedBufferSize = 0; + AIO_ReadPool_addJobToCompleted(job); + return; + } + job->usedBufferSize = fread(job->buffer, 1, job->bufferSize, job->file); + if(job->usedBufferSize < job->bufferSize) { + if(ferror(job->file)) { + EXM_THROW(37, "Read error"); + } else if(feof(job->file)) { + ctx->reachedEof = 1; + } else { + EXM_THROW(37, "Unexpected short read"); + } + } + AIO_ReadPool_addJobToCompleted(job); +} + +static void AIO_ReadPool_enqueueRead(ReadPoolCtx_t* ctx) { + IOJob_t* const job = AIO_IOPool_acquireJob(&ctx->base); + job->offset = ctx->nextReadOffset; + ctx->nextReadOffset += job->bufferSize; + AIO_IOPool_enqueueJob(job); +} + +static void AIO_ReadPool_startReading(ReadPoolCtx_t* ctx) { + int i; + for (i = 0; i < ctx->base.availableJobsCount; i++) { + AIO_ReadPool_enqueueRead(ctx); + } +} + +/* AIO_ReadPool_setFile: + * Sets the source file for future read in the pool. Initiates reading immediately if file is not NULL. + * Waits for all current enqueued tasks to complete if a previous file was set. */ +void AIO_ReadPool_setFile(ReadPoolCtx_t* ctx, FILE* file) { + assert(ctx!=NULL); + AIO_IOPool_join(&ctx->base); + AIO_ReadPool_releaseAllCompletedJobs(ctx); + if (ctx->currentJobHeld) { + AIO_IOPool_releaseIoJob((IOJob_t *)ctx->currentJobHeld); + ctx->currentJobHeld = NULL; + } + AIO_IOPool_setFile(&ctx->base, file); + ctx->nextReadOffset = 0; + ctx->waitingOnOffset = 0; + ctx->srcBuffer = ctx->coalesceBuffer; + ctx->srcBufferLoaded = 0; + ctx->reachedEof = 0; + if(file != NULL) + AIO_ReadPool_startReading(ctx); +} + +/* AIO_ReadPool_create: + * Allocates and sets and a new readPool including its included jobs. + * bufferSize should be set to the maximal buffer we want to read at a time, will also be used + * as our basic read size. */ +ReadPoolCtx_t* AIO_ReadPool_create(const FIO_prefs_t* prefs, size_t bufferSize) { + ReadPoolCtx_t* const ctx = (ReadPoolCtx_t*) malloc(sizeof(ReadPoolCtx_t)); + if(!ctx) EXM_THROW(100, "Allocation error : not enough memory"); + AIO_IOPool_init(&ctx->base, prefs, AIO_ReadPool_executeReadJob, bufferSize); + + ctx->coalesceBuffer = (U8*) malloc(bufferSize * 2); + ctx->srcBuffer = ctx->coalesceBuffer; + ctx->srcBufferLoaded = 0; + ctx->completedJobsCount = 0; + ctx->currentJobHeld = NULL; + + if(ctx->base.threadPool) + if (ZSTD_pthread_cond_init(&ctx->jobCompletedCond, NULL)) + EXM_THROW(103,"Failed creating jobCompletedCond cond"); + + return ctx; +} + +/* AIO_ReadPool_free: + * Frees and releases a readPool and its resources. Closes source file. */ +void AIO_ReadPool_free(ReadPoolCtx_t* ctx) { + if(AIO_ReadPool_getFile(ctx)) + AIO_ReadPool_closeFile(ctx); + if(ctx->base.threadPool) + ZSTD_pthread_cond_destroy(&ctx->jobCompletedCond); + AIO_IOPool_destroy(&ctx->base); + free(ctx->coalesceBuffer); + free(ctx); +} + +/* AIO_ReadPool_consumeBytes: + * Consumes byes from srcBuffer's beginning and updates srcBufferLoaded accordingly. */ +void AIO_ReadPool_consumeBytes(ReadPoolCtx_t* ctx, size_t n) { + assert(n <= ctx->srcBufferLoaded); + ctx->srcBufferLoaded -= n; + ctx->srcBuffer += n; +} + +/* AIO_ReadPool_releaseCurrentlyHeldAndGetNext: + * Release the current held job and get the next one, returns NULL if no next job available. */ +static IOJob_t* AIO_ReadPool_releaseCurrentHeldAndGetNext(ReadPoolCtx_t* ctx) { + if (ctx->currentJobHeld) { + AIO_IOPool_releaseIoJob((IOJob_t *)ctx->currentJobHeld); + ctx->currentJobHeld = NULL; + AIO_ReadPool_enqueueRead(ctx); + } + ctx->currentJobHeld = AIO_ReadPool_getNextCompletedJob(ctx); + return (IOJob_t*) ctx->currentJobHeld; +} + +/* AIO_ReadPool_fillBuffer: + * Tries to fill the buffer with at least n or jobBufferSize bytes (whichever is smaller). + * Returns if srcBuffer has at least the expected number of bytes loaded or if we've reached the end of the file. + * Return value is the number of bytes added to the buffer. + * Note that srcBuffer might have up to 2 times jobBufferSize bytes. */ +size_t AIO_ReadPool_fillBuffer(ReadPoolCtx_t* ctx, size_t n) { + IOJob_t *job; + int useCoalesce = 0; + if(n > ctx->base.jobBufferSize) + n = ctx->base.jobBufferSize; + + /* We are good, don't read anything */ + if (ctx->srcBufferLoaded >= n) + return 0; + + /* We still have bytes loaded, but not enough to satisfy caller. We need to get the next job + * and coalesce the remaining bytes with the next job's buffer */ + if (ctx->srcBufferLoaded > 0) { + useCoalesce = 1; + memcpy(ctx->coalesceBuffer, ctx->srcBuffer, ctx->srcBufferLoaded); + ctx->srcBuffer = ctx->coalesceBuffer; + } + + /* Read the next chunk */ + job = AIO_ReadPool_releaseCurrentHeldAndGetNext(ctx); + if(!job) + return 0; + if(useCoalesce) { + assert(ctx->srcBufferLoaded + job->usedBufferSize <= 2*ctx->base.jobBufferSize); + memcpy(ctx->coalesceBuffer + ctx->srcBufferLoaded, job->buffer, job->usedBufferSize); + ctx->srcBufferLoaded += job->usedBufferSize; + } + else { + ctx->srcBuffer = (U8 *) job->buffer; + ctx->srcBufferLoaded = job->usedBufferSize; + } + return job->usedBufferSize; +} + +/* AIO_ReadPool_consumeAndRefill: + * Consumes the current buffer and refills it with bufferSize bytes. */ +size_t AIO_ReadPool_consumeAndRefill(ReadPoolCtx_t* ctx) { + AIO_ReadPool_consumeBytes(ctx, ctx->srcBufferLoaded); + return AIO_ReadPool_fillBuffer(ctx, ctx->base.jobBufferSize); +} + +/* AIO_ReadPool_getFile: + * Returns the current file set for the read pool. */ +FILE* AIO_ReadPool_getFile(const ReadPoolCtx_t* ctx) { + return AIO_IOPool_getFile(&ctx->base); +} + +/* AIO_ReadPool_closeFile: + * Closes the current set file. Waits for all current enqueued tasks to complete and resets state. */ +int AIO_ReadPool_closeFile(ReadPoolCtx_t* ctx) { + FILE* const file = AIO_ReadPool_getFile(ctx); + AIO_ReadPool_setFile(ctx, NULL); + return fclose(file); +} + +/* AIO_ReadPool_setAsync: + * Allows (de)activating async mode, to be used when the expected overhead + * of asyncio costs more than the expected gains. */ +void AIO_ReadPool_setAsync(ReadPoolCtx_t* ctx, int async) { + AIO_IOPool_setThreaded(&ctx->base, async); +} diff --git a/src/dependencies/zstd-1.5.4/programs/fileio_asyncio.h b/src/dependencies/zstd-1.5.4/programs/fileio_asyncio.h new file mode 100644 index 0000000..feb25a3 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/fileio_asyncio.h @@ -0,0 +1,203 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + + /* + * FileIO AsyncIO exposes read/write IO pools that allow doing IO asynchronously. + * Current implementation relies on having one thread that reads and one that + * writes. + * Each IO pool supports up to `MAX_IO_JOBS` that can be enqueued for work, but + * are performed serially by the appropriate worker thread. + * Most systems exposes better primitives to perform asynchronous IO, such as + * io_uring on newer linux systems. The API is built in such a way that in the + * future we could replace the threads with better solutions when available. + */ + +#ifndef ZSTD_FILEIO_ASYNCIO_H +#define ZSTD_FILEIO_ASYNCIO_H + +#if defined (__cplusplus) +extern "C" { +#endif + +#include "../lib/common/mem.h" /* U32, U64 */ +#include "fileio_types.h" +#include "platform.h" +#include "util.h" +#include "../lib/common/pool.h" +#include "../lib/common/threading.h" + +#define MAX_IO_JOBS (10) + +typedef struct { + /* These struct fields should be set only on creation and not changed afterwards */ + POOL_ctx* threadPool; + int threadPoolActive; + int totalIoJobs; + const FIO_prefs_t* prefs; + POOL_function poolFunction; + + /* Controls the file we currently write to, make changes only by using provided utility functions */ + FILE* file; + + /* The jobs and availableJobsCount fields are accessed by both the main and worker threads and should + * only be mutated after locking the mutex */ + ZSTD_pthread_mutex_t ioJobsMutex; + void* availableJobs[MAX_IO_JOBS]; + int availableJobsCount; + size_t jobBufferSize; +} IOPoolCtx_t; + +typedef struct { + IOPoolCtx_t base; + + /* State regarding the currently read file */ + int reachedEof; + U64 nextReadOffset; + U64 waitingOnOffset; + + /* We may hold an IOJob object as needed if we actively expose its buffer. */ + void *currentJobHeld; + + /* Coalesce buffer is used to join two buffers in case where we need to read more bytes than left in + * the first of them. Shouldn't be accessed from outside ot utility functions. */ + U8 *coalesceBuffer; + + /* Read buffer can be used by consumer code, take care when copying this pointer aside as it might + * change when consuming / refilling buffer. */ + U8 *srcBuffer; + size_t srcBufferLoaded; + + /* We need to know what tasks completed so we can use their buffers when their time comes. + * Should only be accessed after locking base.ioJobsMutex . */ + void* completedJobs[MAX_IO_JOBS]; + int completedJobsCount; + ZSTD_pthread_cond_t jobCompletedCond; +} ReadPoolCtx_t; + +typedef struct { + IOPoolCtx_t base; + unsigned storedSkips; +} WritePoolCtx_t; + +typedef struct { + /* These fields are automatically set and shouldn't be changed by non WritePool code. */ + void *ctx; + FILE* file; + void *buffer; + size_t bufferSize; + + /* This field should be changed before a job is queued for execution and should contain the number + * of bytes to write from the buffer. */ + size_t usedBufferSize; + U64 offset; +} IOJob_t; + +/* AIO_supported: + * Returns 1 if AsyncIO is supported on the system, 0 otherwise. */ +int AIO_supported(void); + + +/* AIO_WritePool_releaseIoJob: + * Releases an acquired job back to the pool. Doesn't execute the job. */ +void AIO_WritePool_releaseIoJob(IOJob_t *job); + +/* AIO_WritePool_acquireJob: + * Returns an available write job to be used for a future write. */ +IOJob_t* AIO_WritePool_acquireJob(WritePoolCtx_t *ctx); + +/* AIO_WritePool_enqueueAndReacquireWriteJob: + * Enqueues a write job for execution and acquires a new one. + * After execution `job`'s pointed value would change to the newly acquired job. + * Make sure to set `usedBufferSize` to the wanted length before call. + * The queued job shouldn't be used directly after queueing it. */ +void AIO_WritePool_enqueueAndReacquireWriteJob(IOJob_t **job); + +/* AIO_WritePool_sparseWriteEnd: + * Ends sparse writes to the current file. + * Blocks on completion of all current write jobs before executing. */ +void AIO_WritePool_sparseWriteEnd(WritePoolCtx_t *ctx); + +/* AIO_WritePool_setFile: + * Sets the destination file for future writes in the pool. + * Requires completion of all queues write jobs and release of all otherwise acquired jobs. + * Also requires ending of sparse write if a previous file was used in sparse mode. */ +void AIO_WritePool_setFile(WritePoolCtx_t *ctx, FILE* file); + +/* AIO_WritePool_getFile: + * Returns the file the writePool is currently set to write to. */ +FILE* AIO_WritePool_getFile(const WritePoolCtx_t* ctx); + +/* AIO_WritePool_closeFile: + * Ends sparse write and closes the writePool's current file and sets the file to NULL. + * Requires completion of all queues write jobs and release of all otherwise acquired jobs. */ +int AIO_WritePool_closeFile(WritePoolCtx_t *ctx); + +/* AIO_WritePool_create: + * Allocates and sets and a new write pool including its included jobs. + * bufferSize should be set to the maximal buffer we want to write to at a time. */ +WritePoolCtx_t* AIO_WritePool_create(const FIO_prefs_t* prefs, size_t bufferSize); + +/* AIO_WritePool_free: + * Frees and releases a writePool and its resources. Closes destination file. */ +void AIO_WritePool_free(WritePoolCtx_t* ctx); + +/* AIO_WritePool_setAsync: + * Allows (de)activating async mode, to be used when the expected overhead + * of asyncio costs more than the expected gains. */ +void AIO_WritePool_setAsync(WritePoolCtx_t* ctx, int async); + +/* AIO_ReadPool_create: + * Allocates and sets and a new readPool including its included jobs. + * bufferSize should be set to the maximal buffer we want to read at a time, will also be used + * as our basic read size. */ +ReadPoolCtx_t* AIO_ReadPool_create(const FIO_prefs_t* prefs, size_t bufferSize); + +/* AIO_ReadPool_free: + * Frees and releases a readPool and its resources. Closes source file. */ +void AIO_ReadPool_free(ReadPoolCtx_t* ctx); + +/* AIO_ReadPool_setAsync: + * Allows (de)activating async mode, to be used when the expected overhead + * of asyncio costs more than the expected gains. */ +void AIO_ReadPool_setAsync(ReadPoolCtx_t* ctx, int async); + +/* AIO_ReadPool_consumeBytes: + * Consumes byes from srcBuffer's beginning and updates srcBufferLoaded accordingly. */ +void AIO_ReadPool_consumeBytes(ReadPoolCtx_t *ctx, size_t n); + +/* AIO_ReadPool_fillBuffer: + * Makes sure buffer has at least n bytes loaded (as long as n is not bigger than the initialized bufferSize). + * Returns if srcBuffer has at least n bytes loaded or if we've reached the end of the file. + * Return value is the number of bytes added to the buffer. + * Note that srcBuffer might have up to 2 times bufferSize bytes. */ +size_t AIO_ReadPool_fillBuffer(ReadPoolCtx_t *ctx, size_t n); + +/* AIO_ReadPool_consumeAndRefill: + * Consumes the current buffer and refills it with bufferSize bytes. */ +size_t AIO_ReadPool_consumeAndRefill(ReadPoolCtx_t *ctx); + +/* AIO_ReadPool_setFile: + * Sets the source file for future read in the pool. Initiates reading immediately if file is not NULL. + * Waits for all current enqueued tasks to complete if a previous file was set. */ +void AIO_ReadPool_setFile(ReadPoolCtx_t *ctx, FILE* file); + +/* AIO_ReadPool_getFile: + * Returns the current file set for the read pool. */ +FILE* AIO_ReadPool_getFile(const ReadPoolCtx_t *ctx); + +/* AIO_ReadPool_closeFile: + * Closes the current set file. Waits for all current enqueued tasks to complete and resets state. */ +int AIO_ReadPool_closeFile(ReadPoolCtx_t *ctx); + +#if defined (__cplusplus) +} +#endif + +#endif /* ZSTD_FILEIO_ASYNCIO_H */ diff --git a/src/dependencies/zstd-1.5.4/programs/fileio_common.h b/src/dependencies/zstd-1.5.4/programs/fileio_common.h new file mode 100644 index 0000000..55491b8 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/fileio_common.h @@ -0,0 +1,125 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef ZSTD_FILEIO_COMMON_H +#define ZSTD_FILEIO_COMMON_H + +#if defined (__cplusplus) +extern "C" { +#endif + +#include "../lib/common/mem.h" /* U32, U64 */ +#include "fileio_types.h" +#include "platform.h" +#include "timefn.h" /* UTIL_getTime, UTIL_clockSpanMicro */ + +/*-************************************* +* Macros +***************************************/ +#define KB *(1 <<10) +#define MB *(1 <<20) +#define GB *(1U<<30) +#undef MAX +#define MAX(a,b) ((a)>(b) ? (a) : (b)) + +extern FIO_display_prefs_t g_display_prefs; + +#define DISPLAY(...) fprintf(stderr, __VA_ARGS__) +#define DISPLAYOUT(...) fprintf(stdout, __VA_ARGS__) +#define DISPLAYLEVEL(l, ...) { if (g_display_prefs.displayLevel>=l) { DISPLAY(__VA_ARGS__); } } + +extern UTIL_time_t g_displayClock; + +#define REFRESH_RATE ((U64)(SEC_TO_MICRO / 6)) +#define READY_FOR_UPDATE() (UTIL_clockSpanMicro(g_displayClock) > REFRESH_RATE || g_display_prefs.displayLevel >= 4) +#define DELAY_NEXT_UPDATE() { g_displayClock = UTIL_getTime(); } +#define DISPLAYUPDATE(l, ...) { \ + if (g_display_prefs.displayLevel>=l && (g_display_prefs.progressSetting != FIO_ps_never)) { \ + if (READY_FOR_UPDATE()) { \ + DELAY_NEXT_UPDATE(); \ + DISPLAY(__VA_ARGS__); \ + if (g_display_prefs.displayLevel>=4) fflush(stderr); \ + } } } + +#define SHOULD_DISPLAY_SUMMARY() \ + (g_display_prefs.displayLevel >= 2 || g_display_prefs.progressSetting == FIO_ps_always) +#define SHOULD_DISPLAY_PROGRESS() \ + (g_display_prefs.progressSetting != FIO_ps_never && SHOULD_DISPLAY_SUMMARY()) +#define DISPLAY_PROGRESS(...) { if (SHOULD_DISPLAY_PROGRESS()) { DISPLAYLEVEL(1, __VA_ARGS__); }} +#define DISPLAYUPDATE_PROGRESS(...) { if (SHOULD_DISPLAY_PROGRESS()) { DISPLAYUPDATE(1, __VA_ARGS__); }} +#define DISPLAY_SUMMARY(...) { if (SHOULD_DISPLAY_SUMMARY()) { DISPLAYLEVEL(1, __VA_ARGS__); } } + +#undef MIN /* in case it would be already defined */ +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + + +#define EXM_THROW(error, ...) \ +{ \ + DISPLAYLEVEL(1, "zstd: "); \ + DISPLAYLEVEL(5, "Error defined at %s, line %i : \n", __FILE__, __LINE__); \ + DISPLAYLEVEL(1, "error %i : ", error); \ + DISPLAYLEVEL(1, __VA_ARGS__); \ + DISPLAYLEVEL(1, " \n"); \ + exit(error); \ +} + +#define CHECK_V(v, f) \ + v = f; \ + if (ZSTD_isError(v)) { \ + DISPLAYLEVEL(5, "%s \n", #f); \ + EXM_THROW(11, "%s", ZSTD_getErrorName(v)); \ + } +#define CHECK(f) { size_t err; CHECK_V(err, f); } + + +/* Avoid fseek()'s 2GiB barrier with MSVC, macOS, *BSD, MinGW */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define LONG_SEEK _fseeki64 +# define LONG_TELL _ftelli64 +#elif !defined(__64BIT__) && (PLATFORM_POSIX_VERSION >= 200112L) /* No point defining Large file for 64 bit */ +# define LONG_SEEK fseeko +# define LONG_TELL ftello +#elif defined(__MINGW32__) && !defined(__STRICT_ANSI__) && !defined(__NO_MINGW_LFS) && defined(__MSVCRT__) +# define LONG_SEEK fseeko64 +# define LONG_TELL ftello64 +#elif defined(_WIN32) && !defined(__DJGPP__) +# include + static int LONG_SEEK(FILE* file, __int64 offset, int origin) { + LARGE_INTEGER off; + DWORD method; + off.QuadPart = offset; + if (origin == SEEK_END) + method = FILE_END; + else if (origin == SEEK_CUR) + method = FILE_CURRENT; + else + method = FILE_BEGIN; + + if (SetFilePointerEx((HANDLE) _get_osfhandle(_fileno(file)), off, NULL, method)) + return 0; + else + return -1; + } + static __int64 LONG_TELL(FILE* file) { + LARGE_INTEGER off, newOff; + off.QuadPart = 0; + newOff.QuadPart = 0; + SetFilePointerEx((HANDLE) _get_osfhandle(_fileno(file)), off, &newOff, FILE_CURRENT); + return newOff.QuadPart; + } +#else +# define LONG_SEEK fseek +# define LONG_TELL ftell +#endif + +#if defined (__cplusplus) +} +#endif +#endif /* ZSTD_FILEIO_COMMON_H */ diff --git a/src/dependencies/zstd-1.5.4/programs/fileio_types.h b/src/dependencies/zstd-1.5.4/programs/fileio_types.h new file mode 100644 index 0000000..c1f42f1 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/fileio_types.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef FILEIO_TYPES_HEADER +#define FILEIO_TYPES_HEADER + +#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressionParameters */ +#include "../lib/zstd.h" /* ZSTD_* */ + +/*-************************************* +* Parameters: FIO_prefs_t +***************************************/ + +typedef struct FIO_display_prefs_s FIO_display_prefs_t; + +typedef enum { FIO_ps_auto, FIO_ps_never, FIO_ps_always } FIO_progressSetting_e; + +struct FIO_display_prefs_s { + int displayLevel; /* 0 : no display; 1: errors; 2: + result + interaction + warnings; 3: + progression; 4: + information */ + FIO_progressSetting_e progressSetting; +}; + + +typedef enum { FIO_zstdCompression, FIO_gzipCompression, FIO_xzCompression, FIO_lzmaCompression, FIO_lz4Compression } FIO_compressionType_t; + +typedef struct FIO_prefs_s { + + /* Algorithm preferences */ + FIO_compressionType_t compressionType; + int sparseFileSupport; /* 0: no sparse allowed; 1: auto (file yes, stdout no); 2: force sparse */ + int dictIDFlag; + int checksumFlag; + int blockSize; + int overlapLog; + int adaptiveMode; + int useRowMatchFinder; + int rsyncable; + int minAdaptLevel; + int maxAdaptLevel; + int ldmFlag; + int ldmHashLog; + int ldmMinMatch; + int ldmBucketSizeLog; + int ldmHashRateLog; + size_t streamSrcSize; + size_t targetCBlockSize; + int srcSizeHint; + int testMode; + ZSTD_paramSwitch_e literalCompressionMode; + + /* IO preferences */ + int removeSrcFile; + int overwrite; + int asyncIO; + + /* Computation resources preferences */ + unsigned memLimit; + int nbWorkers; + + int excludeCompressedFiles; + int patchFromMode; + int contentSize; + int allowBlockDevices; + int passThrough; +} FIO_prefs_t; + +#endif /* FILEIO_TYPES_HEADER */ diff --git a/src/dependencies/zstd-1.5.0/programs/platform.h b/src/dependencies/zstd-1.5.4/programs/platform.h similarity index 93% rename from src/dependencies/zstd-1.5.0/programs/platform.h rename to src/dependencies/zstd-1.5.4/programs/platform.h index b858e3b..18a3587 100644 --- a/src/dependencies/zstd-1.5.0/programs/platform.h +++ b/src/dependencies/zstd-1.5.4/programs/platform.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -33,7 +33,7 @@ extern "C" { /* ************************************** * Detect 64-bit OS -* http://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros +* https://nadeausoftware.com/articles/2012/02/c_c_tip_how_detect_processor_type_using_compiler_predefined_macros ****************************************/ #if defined __ia64 || defined _M_IA64 /* Intel Itanium */ \ || defined __powerpc64__ || defined __ppc64__ || defined __PPC64__ /* POWER 64-bit */ \ @@ -80,7 +80,7 @@ extern "C" { * note: it's better to use unistd.h's _POSIX_VERSION whenever possible */ # define PLATFORM_POSIX_VERSION 200112L -/* try to determine posix version through official unistd.h's _POSIX_VERSION (http://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html). +/* try to determine posix version through official unistd.h's _POSIX_VERSION (https://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html). * note : there is no simple way to know in advance if is present or not on target system, * Posix specification mandates its presence and its content, but target system must respect this spec. * It's necessary to _not_ #include whenever target OS is not unix-like @@ -127,6 +127,10 @@ extern "C" { /*-********************************************* * Detect if isatty() and fileno() are available +* +* Note: Use UTIL_isConsole() for the zstd CLI +* instead, as it allows faking is console for +* testing. ************************************************/ #if (defined(__linux__) && (PLATFORM_POSIX_VERSION > 1)) \ || (PLATFORM_POSIX_VERSION >= 200112L) \ @@ -192,13 +196,13 @@ static __inline int IS_CONSOLE(FILE* stdStream) { #ifndef ZSTD_SETPRIORITY_SUPPORT - /* mandates presence of and support for setpriority() : http://man7.org/linux/man-pages/man2/setpriority.2.html */ + /* mandates presence of and support for setpriority() : https://man7.org/linux/man-pages/man2/setpriority.2.html */ # define ZSTD_SETPRIORITY_SUPPORT (PLATFORM_POSIX_VERSION >= 200112L) #endif #ifndef ZSTD_NANOSLEEP_SUPPORT - /* mandates support of nanosleep() within : http://man7.org/linux/man-pages/man2/nanosleep.2.html */ + /* mandates support of nanosleep() within : https://man7.org/linux/man-pages/man2/nanosleep.2.html */ # if (defined(__linux__) && (PLATFORM_POSIX_VERSION >= 199309L)) \ || (PLATFORM_POSIX_VERSION >= 200112L) # define ZSTD_NANOSLEEP_SUPPORT 1 diff --git a/src/dependencies/zstd-1.5.4/programs/timefn.c b/src/dependencies/zstd-1.5.4/programs/timefn.c new file mode 100644 index 0000000..f941e57 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/timefn.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + + +/* === Dependencies === */ + +#include "timefn.h" +#include "platform.h" /* set _POSIX_C_SOURCE */ +#include /* CLOCK_MONOTONIC, TIME_UTC */ + +/*-**************************************** +* Time functions +******************************************/ + +#if defined(_WIN32) /* Windows */ + +#include /* LARGE_INTEGER */ +#include /* abort */ +#include /* perror */ + +UTIL_time_t UTIL_getTime(void) +{ + static LARGE_INTEGER ticksPerSecond; + static int init = 0; + if (!init) { + if (!QueryPerformanceFrequency(&ticksPerSecond)) { + perror("timefn::QueryPerformanceFrequency"); + abort(); + } + init = 1; + } + { UTIL_time_t r; + LARGE_INTEGER x; + QueryPerformanceCounter(&x); + r.t = (PTime)(x.QuadPart * 1000000000ULL / ticksPerSecond.QuadPart); + return r; + } +} + + +#elif defined(__APPLE__) && defined(__MACH__) + +#include /* mach_timebase_info_data_t, mach_timebase_info, mach_absolute_time */ + +UTIL_time_t UTIL_getTime(void) +{ + static mach_timebase_info_data_t rate; + static int init = 0; + if (!init) { + mach_timebase_info(&rate); + init = 1; + } + { UTIL_time_t r; + r.t = mach_absolute_time() * (PTime)rate.numer / (PTime)rate.denom; + return r; + } +} + +/* POSIX.1-2001 (optional) */ +#elif defined(CLOCK_MONOTONIC) + +#include /* abort */ +#include /* perror */ + +UTIL_time_t UTIL_getTime(void) +{ + /* time must be initialized, othersize it may fail msan test. + * No good reason, likely a limitation of timespec_get() for some target */ + struct timespec time = { 0, 0 }; + if (clock_gettime(CLOCK_MONOTONIC, &time) != 0) { + perror("timefn::clock_gettime(CLOCK_MONOTONIC)"); + abort(); + } + { UTIL_time_t r; + r.t = (PTime)time.tv_sec * 1000000000ULL + (PTime)time.tv_nsec; + return r; + } +} + + +/* C11 requires support of timespec_get(). + * However, FreeBSD 11 claims C11 compliance while lacking timespec_get(). + * Double confirm timespec_get() support by checking the definition of TIME_UTC. + * However, some versions of Android manage to simultanously define TIME_UTC + * and lack timespec_get() support... */ +#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \ + && defined(TIME_UTC) && !defined(__ANDROID__) + +#include /* abort */ +#include /* perror */ + +UTIL_time_t UTIL_getTime(void) +{ + /* time must be initialized, othersize it may fail msan test. + * No good reason, likely a limitation of timespec_get() for some target */ + struct timespec time = { 0, 0 }; + if (timespec_get(&time, TIME_UTC) != TIME_UTC) { + perror("timefn::timespec_get(TIME_UTC)"); + abort(); + } + { UTIL_time_t r; + r.t = (PTime)time.tv_sec * 1000000000ULL + (PTime)time.tv_nsec; + return r; + } +} + + +#else /* relies on standard C90 (note : clock_t produces wrong measurements for multi-threaded workloads) */ + +UTIL_time_t UTIL_getTime(void) +{ + UTIL_time_t r; + r.t = (PTime)clock() * 1000000000ULL / CLOCKS_PER_SEC; + return r; +} + +#define TIME_MT_MEASUREMENTS_NOT_SUPPORTED + +#endif + +/* ==== Common functions, valid for all time API ==== */ + +PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd) +{ + return clockEnd.t - clockStart.t; +} + +PTime UTIL_getSpanTimeMicro(UTIL_time_t begin, UTIL_time_t end) +{ + return UTIL_getSpanTimeNano(begin, end) / 1000ULL; +} + +PTime UTIL_clockSpanMicro(UTIL_time_t clockStart ) +{ + UTIL_time_t const clockEnd = UTIL_getTime(); + return UTIL_getSpanTimeMicro(clockStart, clockEnd); +} + +PTime UTIL_clockSpanNano(UTIL_time_t clockStart ) +{ + UTIL_time_t const clockEnd = UTIL_getTime(); + return UTIL_getSpanTimeNano(clockStart, clockEnd); +} + +void UTIL_waitForNextTick(void) +{ + UTIL_time_t const clockStart = UTIL_getTime(); + UTIL_time_t clockEnd; + do { + clockEnd = UTIL_getTime(); + } while (UTIL_getSpanTimeNano(clockStart, clockEnd) == 0); +} + +int UTIL_support_MT_measurements(void) +{ +# if defined(TIME_MT_MEASUREMENTS_NOT_SUPPORTED) + return 0; +# else + return 1; +# endif +} diff --git a/src/dependencies/zstd-1.5.0/programs/timefn.h b/src/dependencies/zstd-1.5.4/programs/timefn.h similarity index 54% rename from src/dependencies/zstd-1.5.0/programs/timefn.h rename to src/dependencies/zstd-1.5.4/programs/timefn.h index 3fcd78a..b814ff8 100644 --- a/src/dependencies/zstd-1.5.0/programs/timefn.h +++ b/src/dependencies/zstd-1.5.4/programs/timefn.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -16,70 +16,51 @@ extern "C" { #endif -/*-**************************************** -* Dependencies -******************************************/ -#include /* clock_t, clock, CLOCKS_PER_SEC */ - - /*-**************************************** -* Local Types +* Types ******************************************/ #if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) # if defined(_AIX) # include # else -# include /* intptr_t */ +# include /* uint64_t */ # endif typedef uint64_t PTime; /* Precise Time */ #else typedef unsigned long long PTime; /* does not support compilers without long long support */ #endif +/* UTIL_time_t contains a nanosecond time counter. + * The absolute value is not meaningful. + * It's only valid to compute the difference between 2 measurements. */ +typedef struct { PTime t; } UTIL_time_t; +#define UTIL_TIME_INITIALIZER { 0 } /*-**************************************** * Time functions ******************************************/ -#if defined(_WIN32) /* Windows */ - - #include /* LARGE_INTEGER */ - typedef LARGE_INTEGER UTIL_time_t; - #define UTIL_TIME_INITIALIZER { { 0, 0 } } - -#elif defined(__APPLE__) && defined(__MACH__) - - #include - typedef PTime UTIL_time_t; - #define UTIL_TIME_INITIALIZER 0 - -/* C11 requires timespec_get, but FreeBSD 11 lacks it, while still claiming C11 compliance. - Android also lacks it but does define TIME_UTC. */ -#elif (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */) \ - && defined(TIME_UTC) && !defined(__ANDROID__) - - typedef struct timespec UTIL_time_t; - #define UTIL_TIME_INITIALIZER { 0, 0 } - -#else /* relies on standard C90 (note : clock_t measurements can be wrong when using multi-threading) */ - - typedef clock_t UTIL_time_t; - #define UTIL_TIME_INITIALIZER 0 - -#endif - UTIL_time_t UTIL_getTime(void); -PTime UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd); -PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd); -#define SEC_TO_MICRO ((PTime)1000000) -PTime UTIL_clockSpanMicro(UTIL_time_t clockStart); +/* Timer resolution can be low on some platforms. + * To improve accuracy, it's recommended to wait for a new tick + * before starting benchmark measurements */ +void UTIL_waitForNextTick(void); +/* tells if timefn will return correct time measurements + * in presence of multi-threaded workload. + * note : this is not the case if only C90 clock_t measurements are available */ +int UTIL_support_MT_measurements(void); + +PTime UTIL_getSpanTimeNano(UTIL_time_t clockStart, UTIL_time_t clockEnd); PTime UTIL_clockSpanNano(UTIL_time_t clockStart); -void UTIL_waitForNextTick(void); +PTime UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd); +PTime UTIL_clockSpanMicro(UTIL_time_t clockStart); + +#define SEC_TO_MICRO ((PTime)1000000) /* nb of microseconds in a second */ #if defined (__cplusplus) diff --git a/src/dependencies/zstd-1.5.0/programs/util.c b/src/dependencies/zstd-1.5.4/programs/util.c similarity index 73% rename from src/dependencies/zstd-1.5.0/programs/util.c rename to src/dependencies/zstd-1.5.4/programs/util.c index 8d190c6..e017772 100644 --- a/src/dependencies/zstd-1.5.0/programs/util.c +++ b/src/dependencies/zstd-1.5.4/programs/util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -66,6 +66,27 @@ extern "C" { #define UTIL_DISPLAY(...) fprintf(stderr, __VA_ARGS__) #define UTIL_DISPLAYLEVEL(l, ...) { if (g_utilDisplayLevel>=l) { UTIL_DISPLAY(__VA_ARGS__); } } +static int g_traceDepth = 0; +int g_traceFileStat = 0; + +#define UTIL_TRACE_CALL(...) \ + { \ + if (g_traceFileStat) { \ + UTIL_DISPLAY("Trace:FileStat: %*s> ", g_traceDepth, ""); \ + UTIL_DISPLAY(__VA_ARGS__); \ + UTIL_DISPLAY("\n"); \ + ++g_traceDepth; \ + } \ + } + +#define UTIL_TRACE_RET(ret) \ + { \ + if (g_traceFileStat) { \ + --g_traceDepth; \ + UTIL_DISPLAY("Trace:FileStat: %*s< %d\n", g_traceDepth, "", (ret)); \ + } \ + } + /* A modified version of realloc(). * If UTIL_realloc() fails the original block is freed. */ @@ -100,7 +121,7 @@ int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, ch = getchar(); result = 0; if (strchr(acceptableLetters, ch) == NULL) { - UTIL_DISPLAY("%s", abortMsg); + UTIL_DISPLAY("%s \n", abortMsg); result = 1; } /* flush the rest */ @@ -121,21 +142,34 @@ int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, * Functions ***************************************/ +void UTIL_traceFileStat(void) +{ + g_traceFileStat = 1; +} + int UTIL_stat(const char* filename, stat_t* statbuf) { + int ret; + UTIL_TRACE_CALL("UTIL_stat(%s)", filename); #if defined(_MSC_VER) - return !_stat64(filename, statbuf); + ret = !_stat64(filename, statbuf); #elif defined(__MINGW32__) && defined (__MSVCRT__) - return !_stati64(filename, statbuf); + ret = !_stati64(filename, statbuf); #else - return !stat(filename, statbuf); + ret = !stat(filename, statbuf); #endif + UTIL_TRACE_RET(ret); + return ret; } int UTIL_isRegularFile(const char* infilename) { stat_t statbuf; - return UTIL_stat(infilename, &statbuf) && UTIL_isRegularFileStat(&statbuf); + int ret; + UTIL_TRACE_CALL("UTIL_isRegularFile(%s)", infilename); + ret = UTIL_stat(infilename, &statbuf) && UTIL_isRegularFileStat(&statbuf); + UTIL_TRACE_RET(ret); + return ret; } int UTIL_isRegularFileStat(const stat_t* statbuf) @@ -151,23 +185,32 @@ int UTIL_isRegularFileStat(const stat_t* statbuf) int UTIL_chmod(char const* filename, const stat_t* statbuf, mode_t permissions) { stat_t localStatBuf; + UTIL_TRACE_CALL("UTIL_chmod(%s, %#4o)", filename, (unsigned)permissions); if (statbuf == NULL) { - if (!UTIL_stat(filename, &localStatBuf)) return 0; + if (!UTIL_stat(filename, &localStatBuf)) { + UTIL_TRACE_RET(0); + return 0; + } statbuf = &localStatBuf; } - if (!UTIL_isRegularFileStat(statbuf)) return 0; /* pretend success, but don't change anything */ - return chmod(filename, permissions); + if (!UTIL_isRegularFileStat(statbuf)) { + UTIL_TRACE_RET(0); + return 0; /* pretend success, but don't change anything */ + } + UTIL_TRACE_CALL("chmod"); + { + int const ret = chmod(filename, permissions); + UTIL_TRACE_RET(ret); + UTIL_TRACE_RET(ret); + return ret; + } } -int UTIL_setFileStat(const char *filename, const stat_t *statbuf) +/* set access and modification times */ +int UTIL_utime(const char* filename, const stat_t *statbuf) { - int res = 0; - - stat_t curStatBuf; - if (!UTIL_stat(filename, &curStatBuf) || !UTIL_isRegularFileStat(&curStatBuf)) - return -1; - - /* set access and modification times */ + int ret; + UTIL_TRACE_CALL("UTIL_utime(%s)", filename); /* We check that st_mtime is a macro here in order to give us confidence * that struct stat has a struct timespec st_mtim member. We need this * check because there are some platforms that claim to be POSIX 2008 @@ -177,40 +220,79 @@ int UTIL_setFileStat(const char *filename, const stat_t *statbuf) /* (atime, mtime) */ struct timespec timebuf[2] = { {0, UTIME_NOW} }; timebuf[1] = statbuf->st_mtim; - res += utimensat(AT_FDCWD, filename, timebuf, 0); + ret = utimensat(AT_FDCWD, filename, timebuf, 0); } #else { struct utimbuf timebuf; timebuf.actime = time(NULL); timebuf.modtime = statbuf->st_mtime; - res += utime(filename, &timebuf); + ret = utime(filename, &timebuf); } #endif + errno = 0; + UTIL_TRACE_RET(ret); + return ret; +} + +int UTIL_setFileStat(const char *filename, const stat_t *statbuf) +{ + int res = 0; + stat_t curStatBuf; + UTIL_TRACE_CALL("UTIL_setFileStat(%s)", filename); + + if (!UTIL_stat(filename, &curStatBuf) || !UTIL_isRegularFileStat(&curStatBuf)) { + UTIL_TRACE_RET(-1); + return -1; + } + + /* set access and modification times */ + res += UTIL_utime(filename, statbuf); + + /* Mimic gzip's behavior: + * + * "Change the group first, then the permissions, then the owner. + * That way, the permissions will be correct on systems that allow + * users to give away files, without introducing a security hole. + * Security depends on permissions not containing the setuid or + * setgid bits." */ #if !defined(_WIN32) - res += chown(filename, statbuf->st_uid, statbuf->st_gid); /* Copy ownership */ + res += chown(filename, -1, statbuf->st_gid); /* Apply group ownership */ #endif - res += UTIL_chmod(filename, &curStatBuf, statbuf->st_mode & 07777); /* Copy file permissions */ + res += UTIL_chmod(filename, &curStatBuf, statbuf->st_mode & 0777); /* Copy file permissions */ + +#if !defined(_WIN32) + res += chown(filename, statbuf->st_uid, -1); /* Apply user ownership */ +#endif errno = 0; + UTIL_TRACE_RET(-res); return -res; /* number of errors is returned */ } int UTIL_isDirectory(const char* infilename) { stat_t statbuf; - return UTIL_stat(infilename, &statbuf) && UTIL_isDirectoryStat(&statbuf); + int ret; + UTIL_TRACE_CALL("UTIL_isDirectory(%s)", infilename); + ret = UTIL_stat(infilename, &statbuf) && UTIL_isDirectoryStat(&statbuf); + UTIL_TRACE_RET(ret); + return ret; } int UTIL_isDirectoryStat(const stat_t* statbuf) { + int ret; + UTIL_TRACE_CALL("UTIL_isDirectoryStat()"); #if defined(_MSC_VER) - return (statbuf->st_mode & _S_IFDIR) != 0; + ret = (statbuf->st_mode & _S_IFDIR) != 0; #else - return S_ISDIR(statbuf->st_mode) != 0; + ret = S_ISDIR(statbuf->st_mode) != 0; #endif + UTIL_TRACE_RET(ret); + return ret; } int UTIL_compareStr(const void *p1, const void *p2) { @@ -219,33 +301,68 @@ int UTIL_compareStr(const void *p1, const void *p2) { int UTIL_isSameFile(const char* fName1, const char* fName2) { + int ret; assert(fName1 != NULL); assert(fName2 != NULL); + UTIL_TRACE_CALL("UTIL_isSameFile(%s, %s)", fName1, fName2); #if defined(_MSC_VER) || defined(_WIN32) /* note : Visual does not support file identification by inode. * inode does not work on Windows, even with a posix layer, like msys2. * The following work-around is limited to detecting exact name repetition only, * aka `filename` is considered different from `subdir/../filename` */ - return !strcmp(fName1, fName2); + ret = !strcmp(fName1, fName2); #else { stat_t file1Stat; stat_t file2Stat; - return UTIL_stat(fName1, &file1Stat) + ret = UTIL_stat(fName1, &file1Stat) && UTIL_stat(fName2, &file2Stat) - && (file1Stat.st_dev == file2Stat.st_dev) - && (file1Stat.st_ino == file2Stat.st_ino); + && UTIL_isSameFileStat(fName1, fName2, &file1Stat, &file2Stat); } #endif + UTIL_TRACE_RET(ret); + return ret; +} + +int UTIL_isSameFileStat( + const char* fName1, const char* fName2, + const stat_t* file1Stat, const stat_t* file2Stat) +{ + int ret; + assert(fName1 != NULL); assert(fName2 != NULL); + UTIL_TRACE_CALL("UTIL_isSameFileStat(%s, %s)", fName1, fName2); +#if defined(_MSC_VER) || defined(_WIN32) + /* note : Visual does not support file identification by inode. + * inode does not work on Windows, even with a posix layer, like msys2. + * The following work-around is limited to detecting exact name repetition only, + * aka `filename` is considered different from `subdir/../filename` */ + (void)file1Stat; + (void)file2Stat; + ret = !strcmp(fName1, fName2); +#else + { + ret = (file1Stat->st_dev == file2Stat->st_dev) + && (file1Stat->st_ino == file2Stat->st_ino); + } +#endif + UTIL_TRACE_RET(ret); + return ret; } /* UTIL_isFIFO : distinguish named pipes */ int UTIL_isFIFO(const char* infilename) { + UTIL_TRACE_CALL("UTIL_isFIFO(%s)", infilename); /* macro guards, as defined in : https://linux.die.net/man/2/lstat */ #if PLATFORM_POSIX_VERSION >= 200112L - stat_t statbuf; - if (UTIL_stat(infilename, &statbuf) && UTIL_isFIFOStat(&statbuf)) return 1; + { + stat_t statbuf; + if (UTIL_stat(infilename, &statbuf) && UTIL_isFIFOStat(&statbuf)) { + UTIL_TRACE_RET(1); + return 1; + } + } #endif (void)infilename; + UTIL_TRACE_RET(0); return 0; } @@ -273,21 +390,69 @@ int UTIL_isBlockDevStat(const stat_t* statbuf) int UTIL_isLink(const char* infilename) { + UTIL_TRACE_CALL("UTIL_isLink(%s)", infilename); /* macro guards, as defined in : https://linux.die.net/man/2/lstat */ #if PLATFORM_POSIX_VERSION >= 200112L - stat_t statbuf; - int const r = lstat(infilename, &statbuf); - if (!r && S_ISLNK(statbuf.st_mode)) return 1; + { + stat_t statbuf; + int const r = lstat(infilename, &statbuf); + if (!r && S_ISLNK(statbuf.st_mode)) { + UTIL_TRACE_RET(1); + return 1; + } + } #endif (void)infilename; + UTIL_TRACE_RET(0); return 0; } +static int g_fakeStdinIsConsole = 0; +static int g_fakeStderrIsConsole = 0; +static int g_fakeStdoutIsConsole = 0; + +int UTIL_isConsole(FILE* file) +{ + int ret; + UTIL_TRACE_CALL("UTIL_isConsole(%d)", fileno(file)); + if (file == stdin && g_fakeStdinIsConsole) + ret = 1; + else if (file == stderr && g_fakeStderrIsConsole) + ret = 1; + else if (file == stdout && g_fakeStdoutIsConsole) + ret = 1; + else + ret = IS_CONSOLE(file); + UTIL_TRACE_RET(ret); + return ret; +} + +void UTIL_fakeStdinIsConsole(void) +{ + g_fakeStdinIsConsole = 1; +} +void UTIL_fakeStdoutIsConsole(void) +{ + g_fakeStdoutIsConsole = 1; +} +void UTIL_fakeStderrIsConsole(void) +{ + g_fakeStderrIsConsole = 1; +} + U64 UTIL_getFileSize(const char* infilename) { stat_t statbuf; - if (!UTIL_stat(infilename, &statbuf)) return UTIL_FILESIZE_UNKNOWN; - return UTIL_getFileSizeStat(&statbuf); + UTIL_TRACE_CALL("UTIL_getFileSize(%s)", infilename); + if (!UTIL_stat(infilename, &statbuf)) { + UTIL_TRACE_RET(-1); + return UTIL_FILESIZE_UNKNOWN; + } + { + U64 const size = UTIL_getFileSizeStat(&statbuf); + UTIL_TRACE_RET((int)size); + return size; + } } U64 UTIL_getFileSizeStat(const stat_t* statbuf) @@ -303,16 +468,77 @@ U64 UTIL_getFileSizeStat(const stat_t* statbuf) return (U64)statbuf->st_size; } +UTIL_HumanReadableSize_t UTIL_makeHumanReadableSize(U64 size) +{ + UTIL_HumanReadableSize_t hrs; + + if (g_utilDisplayLevel > 3) { + /* In verbose mode, do not scale sizes down, except in the case of + * values that exceed the integral precision of a double. */ + if (size >= (1ull << 53)) { + hrs.value = (double)size / (1ull << 20); + hrs.suffix = " MiB"; + /* At worst, a double representation of a maximal size will be + * accurate to better than tens of kilobytes. */ + hrs.precision = 2; + } else { + hrs.value = (double)size; + hrs.suffix = " B"; + hrs.precision = 0; + } + } else { + /* In regular mode, scale sizes down and use suffixes. */ + if (size >= (1ull << 60)) { + hrs.value = (double)size / (1ull << 60); + hrs.suffix = " EiB"; + } else if (size >= (1ull << 50)) { + hrs.value = (double)size / (1ull << 50); + hrs.suffix = " PiB"; + } else if (size >= (1ull << 40)) { + hrs.value = (double)size / (1ull << 40); + hrs.suffix = " TiB"; + } else if (size >= (1ull << 30)) { + hrs.value = (double)size / (1ull << 30); + hrs.suffix = " GiB"; + } else if (size >= (1ull << 20)) { + hrs.value = (double)size / (1ull << 20); + hrs.suffix = " MiB"; + } else if (size >= (1ull << 10)) { + hrs.value = (double)size / (1ull << 10); + hrs.suffix = " KiB"; + } else { + hrs.value = (double)size; + hrs.suffix = " B"; + } + + if (hrs.value >= 100 || (U64)hrs.value == size) { + hrs.precision = 0; + } else if (hrs.value >= 10) { + hrs.precision = 1; + } else if (hrs.value > 1) { + hrs.precision = 2; + } else { + hrs.precision = 3; + } + } + + return hrs; +} U64 UTIL_getTotalFileSize(const char* const * fileNamesTable, unsigned nbFiles) { U64 total = 0; unsigned n; + UTIL_TRACE_CALL("UTIL_getTotalFileSize(%u)", nbFiles); for (n=0; ntableSize; i++) { + if(!strcmp(table->fileNames[i], name)) { + return (int)i; + } + } + return -1; +} + void UTIL_refFilename(FileNamesTable* fnt, const char* filename) { assert(fnt->tableSize < fnt->tableCapacity); @@ -498,7 +734,7 @@ UTIL_mergeFileNamesTable(FileNamesTable* table1, FileNamesTable* table2) for( idx2=0 ; (idx2 < table2->tableSize) && table2->fileNames[idx2] && (pos < newTotalTableSize) ; ++idx2, ++newTableIdx) { size_t const curLen = strlen(table2->fileNames[idx2]); memcpy(buf+pos, table2->fileNames[idx2], curLen); - assert(newTableIdx <= newTable->tableSize); + assert(newTableIdx < newTable->tableSize); newTable->fileNames[newTableIdx] = buf+pos; pos += curLen+1; } } @@ -622,8 +858,11 @@ static int UTIL_prepareFileList(const char *dirName, ptrdiff_t newListSize = (*bufEnd - *bufStart) + LIST_SIZE_INCREASE; assert(newListSize >= 0); *bufStart = (char*)UTIL_realloc(*bufStart, (size_t)newListSize); - *bufEnd = *bufStart + newListSize; - if (*bufStart == NULL) { free(path); closedir(dir); return 0; } + if (*bufStart != NULL) { + *bufEnd = *bufStart + newListSize; + } else { + free(path); closedir(dir); return 0; + } } if (*bufStart + *pos + pathLength < *bufEnd) { memcpy(*bufStart + *pos, path, pathLength + 1); /* with final \0 */ @@ -809,30 +1048,30 @@ static const char * trimPath(const char *pathname) static char* mallocAndJoin2Dir(const char *dir1, const char *dir2) { - const size_t dir1Size = strlen(dir1); - const size_t dir2Size = strlen(dir2); - char *outDirBuffer, *buffer, trailingChar; - assert(dir1 != NULL && dir2 != NULL); - outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); - CONTROL(outDirBuffer != NULL); + { const size_t dir1Size = strlen(dir1); + const size_t dir2Size = strlen(dir2); + char *outDirBuffer, *buffer; - memcpy(outDirBuffer, dir1, dir1Size); - outDirBuffer[dir1Size] = '\0'; + outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); + CONTROL(outDirBuffer != NULL); + + memcpy(outDirBuffer, dir1, dir1Size); + outDirBuffer[dir1Size] = '\0'; + + if (dir2[0] == '.') + return outDirBuffer; + + buffer = outDirBuffer + dir1Size; + if (dir1Size > 0 && *(buffer - 1) != PATH_SEP) { + *buffer = PATH_SEP; + buffer++; + } + memcpy(buffer, dir2, dir2Size); + buffer[dir2Size] = '\0'; - if (dir2[0] == '.') return outDirBuffer; - - buffer = outDirBuffer + dir1Size; - trailingChar = *(buffer - 1); - if (trailingChar != PATH_SEP) { - *buffer = PATH_SEP; - buffer++; } - memcpy(buffer, dir2, dir2Size); - buffer[dir2Size] = '\0'; - - return outDirBuffer; } /* this function will return NULL if input srcFileName is not valid name for mirrored output path */ @@ -931,15 +1170,15 @@ makeUniqueMirroredDestDirs(char** srcDirNames, unsigned nbFile, const char* outD char* prevDirName = srcDirNames[i - 1]; char* currDirName = srcDirNames[i]; - /* note: we alwasy compare trimmed path, i.e.: + /* note: we always compare trimmed path, i.e.: * src dir of "./foo" and "/foo" will be both saved into: * "outDirName/foo/" */ if (!firstIsParentOrSameDirOfSecond(trimPath(prevDirName), trimPath(currDirName))) uniqueDirNr++; - /* we need maintain original src dir name instead of trimmed - * dir, so we can retrive the original src dir's mode_t */ + /* we need to maintain original src dir name instead of trimmed + * dir, so we can retrieve the original src dir's mode_t */ uniqueDirNames[uniqueDirNr - 1] = currDirName; } @@ -1048,7 +1287,7 @@ FileNamesTable* UTIL_createFNT_fromROTable(const char** filenames, size_t nbFile /*-**************************************** -* count the number of physical cores +* count the number of cores ******************************************/ #if defined(_WIN32) || defined(WIN32) @@ -1057,10 +1296,26 @@ FileNamesTable* UTIL_createFNT_fromROTable(const char** filenames, size_t nbFile typedef BOOL(WINAPI* LPFN_GLPI)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD); -int UTIL_countPhysicalCores(void) +DWORD CountSetBits(ULONG_PTR bitMask) { - static int numPhysicalCores = 0; - if (numPhysicalCores != 0) return numPhysicalCores; + DWORD LSHIFT = sizeof(ULONG_PTR)*8 - 1; + DWORD bitSetCount = 0; + ULONG_PTR bitTest = (ULONG_PTR)1 << LSHIFT; + DWORD i; + + for (i = 0; i <= LSHIFT; ++i) + { + bitSetCount += ((bitMask & bitTest)?1:0); + bitTest/=2; + } + + return bitSetCount; +} + +int UTIL_countCores(int logical) +{ + static int numCores = 0; + if (numCores != 0) return numCores; { LPFN_GLPI glpi; BOOL done = FALSE; @@ -1106,7 +1361,10 @@ int UTIL_countPhysicalCores(void) while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) { if (ptr->Relationship == RelationProcessorCore) { - numPhysicalCores++; + if (logical) + numCores += CountSetBits(ptr->ProcessorMask); + else + numCores++; } ptr++; @@ -1115,17 +1373,17 @@ int UTIL_countPhysicalCores(void) free(buffer); - return numPhysicalCores; + return numCores; } failed: /* try to fall back on GetSystemInfo */ { SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); - numPhysicalCores = sysinfo.dwNumberOfProcessors; - if (numPhysicalCores == 0) numPhysicalCores = 1; /* just in case */ + numCores = sysinfo.dwNumberOfProcessors; + if (numCores == 0) numCores = 1; /* just in case */ } - return numPhysicalCores; + return numCores; } #elif defined(__APPLE__) @@ -1134,24 +1392,24 @@ failed: /* Use apple-provided syscall * see: man 3 sysctl */ -int UTIL_countPhysicalCores(void) +int UTIL_countCores(int logical) { - static S32 numPhysicalCores = 0; /* apple specifies int32_t */ - if (numPhysicalCores != 0) return numPhysicalCores; + static S32 numCores = 0; /* apple specifies int32_t */ + if (numCores != 0) return numCores; { size_t size = sizeof(S32); - int const ret = sysctlbyname("hw.physicalcpu", &numPhysicalCores, &size, NULL, 0); + int const ret = sysctlbyname(logical ? "hw.logicalcpu" : "hw.physicalcpu", &numCores, &size, NULL, 0); if (ret != 0) { if (errno == ENOENT) { /* entry not present, fall back on 1 */ - numPhysicalCores = 1; + numCores = 1; } else { - perror("zstd: can't get number of physical cpus"); + perror("zstd: can't get number of cpus"); exit(1); } } - return numPhysicalCores; + return numCores; } } @@ -1160,16 +1418,16 @@ int UTIL_countPhysicalCores(void) /* parse /proc/cpuinfo * siblings / cpu cores should give hyperthreading ratio * otherwise fall back on sysconf */ -int UTIL_countPhysicalCores(void) +int UTIL_countCores(int logical) { - static int numPhysicalCores = 0; + static int numCores = 0; - if (numPhysicalCores != 0) return numPhysicalCores; + if (numCores != 0) return numCores; - numPhysicalCores = (int)sysconf(_SC_NPROCESSORS_ONLN); - if (numPhysicalCores == -1) { + numCores = (int)sysconf(_SC_NPROCESSORS_ONLN); + if (numCores == -1) { /* value not queryable, fall back on 1 */ - return numPhysicalCores = 1; + return numCores = 1; } /* try to determine if there's hyperthreading */ @@ -1183,7 +1441,7 @@ int UTIL_countPhysicalCores(void) if (cpuinfo == NULL) { /* fall back on the sysconf value */ - return numPhysicalCores; + return numCores; } /* assume the cpu cores/siblings values will be constant across all @@ -1216,13 +1474,13 @@ int UTIL_countPhysicalCores(void) ratio = siblings / cpu_cores; } - if (ratio && numPhysicalCores > ratio) { - numPhysicalCores = numPhysicalCores / ratio; + if (ratio && numCores > ratio && !logical) { + numCores = numCores / ratio; } failed: fclose(cpuinfo); - return numPhysicalCores; + return numCores; } } @@ -1233,59 +1491,90 @@ failed: /* Use physical core sysctl when available * see: man 4 smp, man 3 sysctl */ -int UTIL_countPhysicalCores(void) +int UTIL_countCores(int logical) { - static int numPhysicalCores = 0; /* freebsd sysctl is native int sized */ - if (numPhysicalCores != 0) return numPhysicalCores; + static int numCores = 0; /* freebsd sysctl is native int sized */ +#if __FreeBSD_version >= 1300008 + static int perCore = 1; +#endif + if (numCores != 0) return numCores; #if __FreeBSD_version >= 1300008 - { size_t size = sizeof(numPhysicalCores); - int ret = sysctlbyname("kern.smp.cores", &numPhysicalCores, &size, NULL, 0); - if (ret == 0) return numPhysicalCores; + { size_t size = sizeof(numCores); + int ret = sysctlbyname("kern.smp.cores", &numCores, &size, NULL, 0); + if (ret == 0) { + if (logical) { + ret = sysctlbyname("kern.smp.threads_per_core", &perCore, &size, NULL, 0); + /* default to physical cores if logical cannot be read */ + if (ret == 0) + numCores *= perCore; + } + + return numCores; + } if (errno != ENOENT) { - perror("zstd: can't get number of physical cpus"); + perror("zstd: can't get number of cpus"); exit(1); } /* sysctl not present, fall through to older sysconf method */ } +#else + /* suppress unused parameter warning */ + (void) logical; #endif - numPhysicalCores = (int)sysconf(_SC_NPROCESSORS_ONLN); - if (numPhysicalCores == -1) { + numCores = (int)sysconf(_SC_NPROCESSORS_ONLN); + if (numCores == -1) { /* value not queryable, fall back on 1 */ - numPhysicalCores = 1; + numCores = 1; } - return numPhysicalCores; + return numCores; } #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__CYGWIN__) /* Use POSIX sysconf * see: man 3 sysconf */ -int UTIL_countPhysicalCores(void) +int UTIL_countCores(int logical) { - static int numPhysicalCores = 0; + static int numCores = 0; - if (numPhysicalCores != 0) return numPhysicalCores; + /* suppress unused parameter warning */ + (void)logical; - numPhysicalCores = (int)sysconf(_SC_NPROCESSORS_ONLN); - if (numPhysicalCores == -1) { + if (numCores != 0) return numCores; + + numCores = (int)sysconf(_SC_NPROCESSORS_ONLN); + if (numCores == -1) { /* value not queryable, fall back on 1 */ - return numPhysicalCores = 1; + return numCores = 1; } - return numPhysicalCores; + return numCores; } #else -int UTIL_countPhysicalCores(void) +int UTIL_countCores(int logical) { + /* suppress unused parameter warning */ + (void)logical; + /* assume 1 */ return 1; } #endif +int UTIL_countPhysicalCores(void) +{ + return UTIL_countCores(0); +} + +int UTIL_countLogicalCores(void) +{ + return UTIL_countCores(1); +} + #if defined (__cplusplus) } #endif diff --git a/src/dependencies/zstd-1.5.0/programs/util.h b/src/dependencies/zstd-1.5.4/programs/util.h similarity index 85% rename from src/dependencies/zstd-1.5.0/programs/util.h rename to src/dependencies/zstd-1.5.4/programs/util.h index 24cce44..4ec5413 100644 --- a/src/dependencies/zstd-1.5.0/programs/util.h +++ b/src/dependencies/zstd-1.5.4/programs/util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -64,7 +64,7 @@ extern "C" { # define SET_REALTIME_PRIORITY /* disabled */ # endif -#else /* unknown non-unix operating systen */ +#else /* unknown non-unix operating system */ # define UTIL_sleep(s) /* disabled */ # define UTIL_sleepMilli(milli) /* disabled */ # define SET_REALTIME_PRIORITY /* disabled */ @@ -122,6 +122,7 @@ int UTIL_requireUserConfirmation(const char* prompt, const char* abortMsg, const #define STRDUP(s) strdup(s) #endif + /** * Calls platform's equivalent of stat() on filename and writes info to statbuf. * Returns success (1) or failure (0). @@ -135,6 +136,14 @@ int UTIL_stat(const char* filename, stat_t* statbuf); */ int UTIL_setFileStat(const char* filename, const stat_t* statbuf); +/** + * Set atime to now and mtime to the st_mtim in statbuf. + * + * Directly wraps utime() or utimensat(). Returns -1 on error. + * Does not validate filename is valid. + */ +int UTIL_utime(const char* filename, const stat_t *statbuf); + /* * These helpers operate on a pre-populated stat_t, i.e., the result of * calling one of the above functions. @@ -162,14 +171,51 @@ int UTIL_chmod(char const* filename, const stat_t* statbuf, mode_t permissions); int UTIL_isRegularFile(const char* infilename); int UTIL_isDirectory(const char* infilename); int UTIL_isSameFile(const char* file1, const char* file2); +int UTIL_isSameFileStat(const char* file1, const char* file2, const stat_t* file1Stat, const stat_t* file2Stat); int UTIL_isCompressedFile(const char* infilename, const char *extensionList[]); int UTIL_isLink(const char* infilename); int UTIL_isFIFO(const char* infilename); +/** + * Returns with the given file descriptor is a console. + * Allows faking whether stdin/stdout/stderr is a console + * using UTIL_fake*IsConsole(). + */ +int UTIL_isConsole(FILE* file); + +/** + * Pretends that stdin/stdout/stderr is a console for testing. + */ +void UTIL_fakeStdinIsConsole(void); +void UTIL_fakeStdoutIsConsole(void); +void UTIL_fakeStderrIsConsole(void); + +/** + * Emit traces for functions that read, or modify file metadata. + */ +void UTIL_traceFileStat(void); + #define UTIL_FILESIZE_UNKNOWN ((U64)(-1)) U64 UTIL_getFileSize(const char* infilename); U64 UTIL_getTotalFileSize(const char* const * fileNamesTable, unsigned nbFiles); +/** + * Take @size in bytes, + * prepare the components to pretty-print it in a scaled way. + * The components in the returned struct should be passed in + * precision, value, suffix order to a "%.*f%s" format string. + * Output policy is sensible to @g_utilDisplayLevel, + * for verbose mode (@g_utilDisplayLevel >= 4), + * does not scale down. + */ +typedef struct { + double value; + int precision; + const char* suffix; +} UTIL_HumanReadableSize_t; + +UTIL_HumanReadableSize_t UTIL_makeHumanReadableSize(U64 size); + int UTIL_compareStr(const void *p1, const void *p2); const char* UTIL_getFileExtension(const char* infilename); void UTIL_mirrorSourceFilesDirectories(const char** fileNamesTable, unsigned int nbFiles, const char *outDirName); @@ -222,7 +268,6 @@ UTIL_mergeFileNamesTable(FileNamesTable* table1, FileNamesTable* table2); /*! UTIL_expandFNT() : * read names from @fnt, and expand those corresponding to directories * update @fnt, now containing only file names, - * @return : 0 in case of success, 1 if error * note : in case of error, @fnt[0] is NULL */ void UTIL_expandFNT(FileNamesTable** fnt, int followLinks); @@ -243,6 +288,11 @@ UTIL_createFNT_fromROTable(const char** filenames, size_t nbFilenames); */ FileNamesTable* UTIL_allocateFileNamesTable(size_t tableSize); +/*! UTIL_searchFileNamesTable() : + * Searched through entries in FileNamesTable for a specific name. + * @return : index of entry if found or -1 if not found + */ +int UTIL_searchFileNamesTable(FileNamesTable* table, char const* name); /*! UTIL_refFilename() : * Add a reference to read-only name into @fnt table. @@ -275,13 +325,19 @@ void UTIL_refFilename(FileNamesTable* fnt, const char* filename); FileNamesTable* UTIL_createExpandedFNT(const char* const* filenames, size_t nbFilenames, int followLinks); +#if defined(_WIN32) || defined(WIN32) +DWORD CountSetBits(ULONG_PTR bitMask); +#endif /*-**************************************** * System ******************************************/ +int UTIL_countCores(int logical); + int UTIL_countPhysicalCores(void); +int UTIL_countLogicalCores(void); #if defined (__cplusplus) } diff --git a/src/dependencies/zstd-1.5.0/programs/windres/verrsrc.h b/src/dependencies/zstd-1.5.4/programs/windres/verrsrc.h similarity index 91% rename from src/dependencies/zstd-1.5.0/programs/windres/verrsrc.h rename to src/dependencies/zstd-1.5.4/programs/windres/verrsrc.h index c1b60e9..61b1f3d 100644 --- a/src/dependencies/zstd-1.5.0/programs/windres/verrsrc.h +++ b/src/dependencies/zstd-1.5.4/programs/windres/verrsrc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/programs/windres/zstd.rc b/src/dependencies/zstd-1.5.4/programs/windres/zstd.rc similarity index 88% rename from src/dependencies/zstd-1.5.0/programs/windres/zstd.rc rename to src/dependencies/zstd-1.5.4/programs/windres/zstd.rc index f5e4047..a2118c2 100644 --- a/src/dependencies/zstd-1.5.0/programs/windres/zstd.rc +++ b/src/dependencies/zstd-1.5.4/programs/windres/zstd.rc @@ -32,11 +32,11 @@ BEGIN BEGIN BLOCK "040904B0" BEGIN - VALUE "CompanyName", "Yann Collet, Facebook, Inc." + VALUE "CompanyName", "Meta Platforms, Inc." VALUE "FileDescription", "Zstandard - Fast and efficient compression algorithm" VALUE "FileVersion", ZSTD_VERSION_STRING VALUE "InternalName", "zstd.exe" - VALUE "LegalCopyright", "Copyright (c) 2013-present, Yann Collet, Facebook, Inc." + VALUE "LegalCopyright", "Copyright (c) Meta Platforms, Inc. and affiliates." VALUE "OriginalFilename", "zstd.exe" VALUE "ProductName", "Zstandard" VALUE "ProductVersion", ZSTD_VERSION_STRING diff --git a/src/dependencies/zstd-1.5.0/programs/windres/zstd32.res b/src/dependencies/zstd-1.5.4/programs/windres/zstd32.res similarity index 100% rename from src/dependencies/zstd-1.5.0/programs/windres/zstd32.res rename to src/dependencies/zstd-1.5.4/programs/windres/zstd32.res diff --git a/src/dependencies/zstd-1.5.0/programs/windres/zstd64.res b/src/dependencies/zstd-1.5.4/programs/windres/zstd64.res similarity index 100% rename from src/dependencies/zstd-1.5.0/programs/windres/zstd64.res rename to src/dependencies/zstd-1.5.4/programs/windres/zstd64.res diff --git a/src/dependencies/zstd-1.5.0/programs/zstd.1 b/src/dependencies/zstd-1.5.4/programs/zstd.1 similarity index 51% rename from src/dependencies/zstd-1.5.0/programs/zstd.1 rename to src/dependencies/zstd-1.5.4/programs/zstd.1 index 861f938..edc128f 100644 --- a/src/dependencies/zstd-1.5.0/programs/zstd.1 +++ b/src/dependencies/zstd-1.5.4/programs/zstd.1 @@ -1,491 +1,381 @@ -. -.TH "ZSTD" "1" "May 2021" "zstd 1.5.0" "User Commands" -. +.TH "ZSTD" "1" "February 2023" "zstd 1.5.4" "User Commands" .SH "NAME" \fBzstd\fR \- zstd, zstdmt, unzstd, zstdcat \- Compress or decompress \.zst files -. .SH "SYNOPSIS" -\fBzstd\fR [\fIOPTIONS\fR] [\-|\fIINPUT\-FILE\fR] [\-o \fIOUTPUT\-FILE\fR] -. +.TS +allbox; +\fBzstd\fR [\fIOPTIONS\fR] [\- \fIINPUT\-FILE\fR] [\-o \fIOUTPUT\-FILE\fR] +.TE .P \fBzstdmt\fR is equivalent to \fBzstd \-T0\fR -. .P \fBunzstd\fR is equivalent to \fBzstd \-d\fR -. .P \fBzstdcat\fR is equivalent to \fBzstd \-dcf\fR -. .SH "DESCRIPTION" -\fBzstd\fR is a fast lossless compression algorithm and data compression tool, with command line syntax similar to \fBgzip (1)\fR and \fBxz (1)\fR\. It is based on the \fBLZ77\fR family, with further FSE & huff0 entropy stages\. \fBzstd\fR offers highly configurable compression speed, with fast modes at > 200 MB/s per core, and strong modes nearing lzma compression ratios\. It also features a very fast decoder, with speeds > 500 MB/s per core\. -. +\fBzstd\fR is a fast lossless compression algorithm and data compression tool, with command line syntax similar to \fBgzip\fR(1) and \fBxz\fR(1)\. It is based on the \fBLZ77\fR family, with further FSE & huff0 entropy stages\. \fBzstd\fR offers highly configurable compression speed, from fast modes at > 200 MB/s per core, to strong modes with excellent compression ratios\. It also features a very fast decoder, with speeds > 500 MB/s per core\. .P -\fBzstd\fR command line syntax is generally similar to gzip, but features the following differences : -. -.IP "\(bu" 4 +\fBzstd\fR command line syntax is generally similar to gzip, but features the following differences: +.IP "\[ci]" 4 Source files are preserved by default\. It\'s possible to remove them automatically by using the \fB\-\-rm\fR command\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 When compressing a single file, \fBzstd\fR displays progress notifications and result summary by default\. Use \fB\-q\fR to turn them off\. -. -.IP "\(bu" 4 -\fBzstd\fR does not accept input from console, but it properly accepts \fBstdin\fR when it\'s not the console\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fBzstd\fR displays a short help page when command line is an error\. Use \fB\-q\fR to turn it off\. -. +.IP "\[ci]" 4 +\fBzstd\fR does not accept input from console, though it does accept \fBstdin\fR when it\'s not the console\. +.IP "\[ci]" 4 +\fBzstd\fR does not store the input\'s filename or attributes, only its contents\. .IP "" 0 -. .P -\fBzstd\fR compresses or decompresses each \fIfile\fR according to the selected operation mode\. If no \fIfiles\fR are given or \fIfile\fR is \fB\-\fR, \fBzstd\fR reads from standard input and writes the processed data to standard output\. \fBzstd\fR will refuse to write compressed data to standard output if it is a terminal : it will display an error message and skip the \fIfile\fR\. Similarly, \fBzstd\fR will refuse to read compressed data from standard input if it is a terminal\. -. +\fBzstd\fR processes each \fIfile\fR according to the selected operation mode\. If no \fIfiles\fR are given or \fIfile\fR is \fB\-\fR, \fBzstd\fR reads from standard input and writes the processed data to standard output\. \fBzstd\fR will refuse to write compressed data to standard output if it is a terminal: it will display an error message and skip the file\. Similarly, \fBzstd\fR will refuse to read compressed data from standard input if it is a terminal\. .P Unless \fB\-\-stdout\fR or \fB\-o\fR is specified, \fIfiles\fR are written to a new file whose name is derived from the source \fIfile\fR name: -. -.IP "\(bu" 4 +.IP "\[ci]" 4 When compressing, the suffix \fB\.zst\fR is appended to the source filename to get the target filename\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 When decompressing, the \fB\.zst\fR suffix is removed from the source filename to get the target filename -. .IP "" 0 -. -.SS "Concatenation with \.zst files" -It is possible to concatenate \fB\.zst\fR files as is\. \fBzstd\fR will decompress such files as if they were a single \fB\.zst\fR file\. -. +.SS "Concatenation with \.zst Files" +It is possible to concatenate multiple \fB\.zst\fR files\. \fBzstd\fR will decompress such agglomerated file as if it was a single \fB\.zst\fR file\. .SH "OPTIONS" -. -.SS "Integer suffixes and special values" +.SS "Integer Suffixes and Special Values" In most places where an integer argument is expected, an optional suffix is supported to easily indicate large integers\. There must be no space between the integer and the suffix\. -. .TP \fBKiB\fR -Multiply the integer by 1,024 (2^10)\. \fBKi\fR, \fBK\fR, and \fBKB\fR are accepted as synonyms for \fBKiB\fR\. -. +Multiply the integer by 1,024 (2\e^10)\. \fBKi\fR, \fBK\fR, and \fBKB\fR are accepted as synonyms for \fBKiB\fR\. .TP \fBMiB\fR -Multiply the integer by 1,048,576 (2^20)\. \fBMi\fR, \fBM\fR, and \fBMB\fR are accepted as synonyms for \fBMiB\fR\. -. -.SS "Operation mode" +Multiply the integer by 1,048,576 (2\e^20)\. \fBMi\fR, \fBM\fR, and \fBMB\fR are accepted as synonyms for \fBMiB\fR\. +.SS "Operation Mode" If multiple operation mode options are given, the last one takes effect\. -. .TP \fB\-z\fR, \fB\-\-compress\fR Compress\. This is the default operation mode when no operation mode option is specified and no other operation mode is implied from the command name (for example, \fBunzstd\fR implies \fB\-\-decompress\fR)\. -. .TP \fB\-d\fR, \fB\-\-decompress\fR, \fB\-\-uncompress\fR Decompress\. -. .TP \fB\-t\fR, \fB\-\-test\fR -Test the integrity of compressed \fIfiles\fR\. This option is equivalent to \fB\-\-decompress \-\-stdout\fR except that the decompressed data is discarded instead of being written to standard output\. No files are created or removed\. -. +Test the integrity of compressed \fIfiles\fR\. This option is equivalent to \fB\-\-decompress \-\-stdout > /dev/null\fR, decompressed data is discarded and checksummed for errors\. No files are created or removed\. .TP \fB\-b#\fR -Benchmark file(s) using compression level # -. +Benchmark file(s) using compression level \fI#\fR\. See \fIBENCHMARK\fR below for a description of this operation\. .TP -\fB\-\-train FILEs\fR -Use FILEs as a training set to create a dictionary\. The training set should contain a lot of small files (> 100)\. -. +\fB\-\-train FILES\fR +Use \fIFILES\fR as a training set to create a dictionary\. The training set should contain a lot of small files (> 100)\. See \fIDICTIONARY BUILDER\fR below for a description of this operation\. .TP \fB\-l\fR, \fB\-\-list\fR -Display information related to a zstd compressed file, such as size, ratio, and checksum\. Some of these fields may not be available\. This command can be augmented with the \fB\-v\fR modifier\. -. -.SS "Operation modifiers" -. -.IP "\(bu" 4 -\fB\-#\fR: \fB#\fR compression level [1\-19] (default: 3) -. -.IP "\(bu" 4 +Display information related to a zstd compressed file, such as size, ratio, and checksum\. Some of these fields may not be available\. This command\'s output can be augmented with the \fB\-v\fR modifier\. +.SS "Operation Modifiers" +.IP "\[ci]" 4 +\fB\-#\fR: selects \fB#\fR compression level [1\-19] (default: 3) +.IP "\[ci]" 4 \fB\-\-ultra\fR: unlocks high compression levels 20+ (maximum 22), using a lot more memory\. Note that decompression will also require more memory when using these levels\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-fast[=#]\fR: switch to ultra\-fast compression levels\. If \fB=#\fR is not present, it defaults to \fB1\fR\. The higher the value, the faster the compression speed, at the cost of some compression ratio\. This setting overwrites compression level if one was set previously\. Similarly, if a compression level is set after \fB\-\-fast\fR, it overrides it\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-T#\fR, \fB\-\-threads=#\fR: Compress using \fB#\fR working threads (default: 1)\. If \fB#\fR is 0, attempt to detect and use the number of physical CPU cores\. In all cases, the nb of threads is capped to \fBZSTDMT_NBWORKERS_MAX\fR, which is either 64 in 32\-bit mode, or 256 for 64\-bit environments\. This modifier does nothing if \fBzstd\fR is compiled without multithread support\. -. -.IP "\(bu" 4 -\fB\-\-single\-thread\fR: Does not spawn a thread for compression, use a single thread for both I/O and compression\. In this mode, compression is serialized with I/O, which is slightly slower\. (This is different from \fB\-T1\fR, which spawns 1 compression thread in parallel of I/O)\. This mode is the only one available when multithread support is disabled\. Single\-thread mode features lower memory usage\. Final compressed result is slightly different from \fB\-T1\fR\. -. -.IP "\(bu" 4 -\fB\-\-adapt[=min=#,max=#]\fR : \fBzstd\fR will dynamically adapt compression level to perceived I/O conditions\. Compression level adaptation can be observed live by using command \fB\-v\fR\. Adaptation can be constrained between supplied \fBmin\fR and \fBmax\fR levels\. The feature works when combined with multi\-threading and \fB\-\-long\fR mode\. It does not work with \fB\-\-single\-thread\fR\. It sets window size to 8 MB by default (can be changed manually, see \fBwlog\fR)\. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible\. \fInote\fR : at the time of this writing, \fB\-\-adapt\fR can remain stuck at low speed when combined with multiple worker threads (>=2)\. -. -.IP "\(bu" 4 -\fB\-\-long[=#]\fR: enables long distance matching with \fB#\fR \fBwindowLog\fR, if not \fB#\fR is not present it defaults to \fB27\fR\. This increases the window size (\fBwindowLog\fR) and memory usage for both the compressor and decompressor\. This setting is designed to improve the compression ratio for files with long matches at a large distance\. -. +.IP "\[ci]" 4 +\fB\-\-single\-thread\fR: Use a single thread for both I/O and compression\. As compression is serialized with I/O, this can be slightly slower\. Single\-thread mode features significantly lower memory usage, which can be useful for systems with limited amount of memory, such as 32\-bit systems\. +.IP +Note 1: this mode is the only available one when multithread support is disabled\. +.IP +Note 2: this mode is different from \fB\-T1\fR, which spawns 1 compression thread in parallel with I/O\. Final compressed result is also slightly different from \fB\-T1\fR\. +.IP "\[ci]" 4 +\fB\-\-auto\-threads={physical,logical} (default: physical)\fR: When using a default amount of threads via \fB\-T0\fR, choose the default based on the number of detected physical or logical cores\. +.IP "\[ci]" 4 +\fB\-\-adapt[=min=#,max=#]\fR: \fBzstd\fR will dynamically adapt compression level to perceived I/O conditions\. Compression level adaptation can be observed live by using command \fB\-v\fR\. Adaptation can be constrained between supplied \fBmin\fR and \fBmax\fR levels\. The feature works when combined with multi\-threading and \fB\-\-long\fR mode\. It does not work with \fB\-\-single\-thread\fR\. It sets window size to 8 MiB by default (can be changed manually, see \fBwlog\fR)\. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible\. +.IP +\fINote\fR: at the time of this writing, \fB\-\-adapt\fR can remain stuck at low speed when combined with multiple worker threads (>=2)\. +.IP "\[ci]" 4 +\fB\-\-long[=#]\fR: enables long distance matching with \fB#\fR \fBwindowLog\fR, if \fB#\fR is not present it defaults to \fB27\fR\. This increases the window size (\fBwindowLog\fR) and memory usage for both the compressor and decompressor\. This setting is designed to improve the compression ratio for files with long matches at a large distance\. .IP Note: If \fBwindowLog\fR is set to larger than 27, \fB\-\-long=windowLog\fR or \fB\-\-memory=windowSize\fR needs to be passed to the decompressor\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-D DICT\fR: use \fBDICT\fR as Dictionary to compress or decompress FILE(s) -. -.IP "\(bu" 4 -\fB\-\-patch\-from FILE\fR: Specify the file to be used as a reference point for zstd\'s diff engine\. This is effectively dictionary compression with some convenient parameter selection, namely that windowSize > srcSize\. -. +.IP "\[ci]" 4 +\fB\-\-patch\-from FILE\fR: Specify the file to be used as a reference point for zstd\'s diff engine\. This is effectively dictionary compression with some convenient parameter selection, namely that \fIwindowSize\fR > \fIsrcSize\fR\. .IP -Note: cannot use both this and \-D together Note: \fB\-\-long\fR mode will be automatically activated if chainLog < fileLog (fileLog being the windowLog required to cover the whole file)\. You can also manually force it\. Node: for all levels, you can use \-\-patch\-from in \-\-single\-thread mode to improve compression ratio at the cost of speed Note: for level 19, you can get increased compression ratio at the cost of speed by specifying \fB\-\-zstd=targetLength=\fR to be something large (i\.e 4096), and by setting a large \fB\-\-zstd=chainLog=\fR -. -.IP "\(bu" 4 -\fB\-\-rsyncable\fR : \fBzstd\fR will periodically synchronize the compression state to make the compressed file more rsync\-friendly\. There is a negligible impact to compression ratio, and the faster compression levels will see a small compression speed hit\. This feature does not work with \fB\-\-single\-thread\fR\. You probably don\'t want to use it with long range mode, since it will decrease the effectiveness of the synchronization points, but your milage may vary\. -. -.IP "\(bu" 4 +Note: cannot use both this and \fB\-D\fR together\. +.IP +Note: \fB\-\-long\fR mode will be automatically activated if \fIchainLog\fR < \fIfileLog\fR (\fIfileLog\fR being the \fIwindowLog\fR required to cover the whole file)\. You can also manually force it\. +.IP +Note: for all levels, you can use \fB\-\-patch\-from\fR in \fB\-\-single\-thread\fR mode to improve compression ratio at the cost of speed\. +.IP +Note: for level 19, you can get increased compression ratio at the cost of speed by specifying \fB\-\-zstd=targetLength=\fR to be something large (i\.e\. 4096), and by setting a large \fB\-\-zstd=chainLog=\fR\. +.IP "\[ci]" 4 +\fB\-\-rsyncable\fR: \fBzstd\fR will periodically synchronize the compression state to make the compressed file more rsync\-friendly\. There is a negligible impact to compression ratio, and the faster compression levels will see a small compression speed hit\. This feature does not work with \fB\-\-single\-thread\fR\. You probably don\'t want to use it with long range mode, since it will decrease the effectiveness of the synchronization points, but your mileage may vary\. +.IP "\[ci]" 4 \fB\-C\fR, \fB\-\-[no\-]check\fR: add integrity check computed from uncompressed data (default: enabled) -. -.IP "\(bu" 4 -\fB\-\-[no\-]content\-size\fR: enable / disable whether or not the original size of the file is placed in the header of the compressed file\. The default option is \-\-content\-size (meaning that the original size will be placed in the header)\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-\-[no\-]content\-size\fR: enable / disable whether or not the original size of the file is placed in the header of the compressed file\. The default option is \fB\-\-content\-size\fR (meaning that the original size will be placed in the header)\. +.IP "\[ci]" 4 \fB\-\-no\-dictID\fR: do not store dictionary ID within frame header (dictionary compression)\. The decoder will have to rely on implicit knowledge about which dictionary to use, it won\'t be able to check if it\'s correct\. -. -.IP "\(bu" 4 -\fB\-M#\fR, \fB\-\-memory=#\fR: Set a memory usage limit\. By default, Zstandard uses 128 MB for decompression as the maximum amount of memory the decompressor is allowed to use, but you can override this manually if need be in either direction (ie\. you can increase or decrease it)\. -. +.IP "\[ci]" 4 +\fB\-M#\fR, \fB\-\-memory=#\fR: Set a memory usage limit\. By default, \fBzstd\fR uses 128 MiB for decompression as the maximum amount of memory the decompressor is allowed to use, but you can override this manually if need be in either direction (i\.e\. you can increase or decrease it)\. .IP -This is also used during compression when using with \-\-patch\-from=\. In this case, this parameter overrides that maximum size allowed for a dictionary\. (128 MB)\. -. -.IP "\(bu" 4 -\fB\-\-stream\-size=#\fR : Sets the pledged source size of input coming from a stream\. This value must be exact, as it will be included in the produced frame header\. Incorrect stream sizes will cause an error\. This information will be used to better optimize compression parameters, resulting in better and potentially faster compression, especially for smaller source sizes\. -. -.IP "\(bu" 4 +This is also used during compression when using with \fB\-\-patch\-from=\fR\. In this case, this parameter overrides that maximum size allowed for a dictionary\. (128 MiB)\. +.IP +Additionally, this can be used to limit memory for dictionary training\. This parameter overrides the default limit of 2 GiB\. zstd will load training samples up to the memory limit and ignore the rest\. +.IP "\[ci]" 4 +\fB\-\-stream\-size=#\fR: Sets the pledged source size of input coming from a stream\. This value must be exact, as it will be included in the produced frame header\. Incorrect stream sizes will cause an error\. This information will be used to better optimize compression parameters, resulting in better and potentially faster compression, especially for smaller source sizes\. +.IP "\[ci]" 4 \fB\-\-size\-hint=#\fR: When handling input from a stream, \fBzstd\fR must guess how large the source size will be when optimizing compression parameters\. If the stream size is relatively small, this guess may be a poor one, resulting in a higher compression ratio than expected\. This feature allows for controlling the guess when needed\. Exact guesses result in better compression ratios\. Overestimates result in slightly degraded compression ratios, while underestimates may result in significant degradation\. -. -.IP "\(bu" 4 -\fB\-o FILE\fR: save result into \fBFILE\fR -. -.IP "\(bu" 4 -\fB\-f\fR, \fB\-\-force\fR: disable input and output checks\. Allows overwriting existing files, input from console, output to stdout, operating on links, block devices, etc\. -. -.IP "\(bu" 4 -\fB\-c\fR, \fB\-\-stdout\fR: force write to standard output, even if it is the console -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-o FILE\fR: save result into \fBFILE\fR\. +.IP "\[ci]" 4 +\fB\-f\fR, \fB\-\-force\fR: disable input and output checks\. Allows overwriting existing files, input from console, output to stdout, operating on links, block devices, etc\. During decompression and when the output destination is stdout, pass\-through unrecognized formats as\-is\. +.IP "\[ci]" 4 +\fB\-c\fR, \fB\-\-stdout\fR: write to standard output (even if it is the console); keep original files unchanged\. +.IP "\[ci]" 4 \fB\-\-[no\-]sparse\fR: enable / disable sparse FS support, to make files with many zeroes smaller on disk\. Creating sparse files may save disk space and speed up decompression by reducing the amount of disk I/O\. default: enabled when output is into a file, and disabled when output is stdout\. This setting overrides default and can force sparse mode over stdout\. -. -.IP "\(bu" 4 -\fB\-\-rm\fR: remove source file(s) after successful compression or decompression\. If used in combination with \-o, will trigger a confirmation prompt (which can be silenced with \-f), as this is a destructive operation\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-\-[no\-]pass\-through\fR enable / disable passing through uncompressed files as\-is\. During decompression when pass\-through is enabled, unrecognized formats will be copied as\-is from the input to the output\. By default, pass\-through will occur when the output destination is stdout and the force (\fB\-f\fR) option is set\. +.IP "\[ci]" 4 +\fB\-\-rm\fR: remove source file(s) after successful compression or decompression\. This command is silently ignored if output is \fBstdout\fR\. If used in combination with \fB\-o\fR, triggers a confirmation prompt (which can be silenced with \fB\-f\fR), as this is a destructive operation\. +.IP "\[ci]" 4 \fB\-k\fR, \fB\-\-keep\fR: keep source file(s) after successful compression or decompression\. This is the default behavior\. -. -.IP "\(bu" 4 -\fB\-r\fR: operate recursively on directories -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-r\fR: operate recursively on directories\. It selects all files in the named directory and all its subdirectories\. This can be useful both to reduce command line typing, and to circumvent shell expansion limitations, when there are a lot of files and naming breaks the maximum size of a command line\. +.IP "\[ci]" 4 \fB\-\-filelist FILE\fR read a list of files to process as content from \fBFILE\fR\. Format is compatible with \fBls\fR output, with one file per line\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-output\-dir\-flat DIR\fR: resulting files are stored into target \fBDIR\fR directory, instead of same directory as origin file\. Be aware that this command can introduce name collision issues, if multiple files, from different directories, end up having the same name\. Collision resolution ensures first file with a given name will be present in \fBDIR\fR, while in combination with \fB\-f\fR, the last file will be present instead\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-output\-dir\-mirror DIR\fR: similar to \fB\-\-output\-dir\-flat\fR, the output files are stored underneath target \fBDIR\fR directory, but this option will replicate input directory hierarchy into output \fBDIR\fR\. -. .IP If input directory contains "\.\.", the files in this directory will be ignored\. If input directory is an absolute directory (i\.e\. "/var/tmp/abc"), it will be stored into the "output\-dir/var/tmp/abc"\. If there are multiple input files or directories, name collision resolution will follow the same rules as \fB\-\-output\-dir\-flat\fR\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-format=FORMAT\fR: compress and decompress in other formats\. If compiled with support, zstd can compress to or decompress from other compression algorithm formats\. Possibly available options are \fBzstd\fR, \fBgzip\fR, \fBxz\fR, \fBlzma\fR, and \fBlz4\fR\. If no such format is provided, \fBzstd\fR is the default\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-h\fR/\fB\-H\fR, \fB\-\-help\fR: display help/long help and exit -. -.IP "\(bu" 4 -\fB\-V\fR, \fB\-\-version\fR: display version number and exit\. Advanced : \fB\-vV\fR also displays supported formats\. \fB\-vvV\fR also displays POSIX support\. \fB\-q\fR will only display the version number, suitable for machine reading\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-V\fR, \fB\-\-version\fR: display version number and exit\. Advanced: \fB\-vV\fR also displays supported formats\. \fB\-vvV\fR also displays POSIX support\. \fB\-q\fR will only display the version number, suitable for machine reading\. +.IP "\[ci]" 4 \fB\-v\fR, \fB\-\-verbose\fR: verbose mode, display more information -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-q\fR, \fB\-\-quiet\fR: suppress warnings, interactivity, and notifications\. specify twice to suppress errors too\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-no\-progress\fR: do not display the progress bar, but keep all other messages\. -. -.IP "\(bu" 4 -\fB\-\-show\-default\-cparams\fR: Shows the default compression parameters that will be used for a particular src file\. If the provided src file is not a regular file (eg\. named pipe), the cli will just output the default parameters\. That is, the parameters that are used when the src size is unknown\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-\-show\-default\-cparams\fR: shows the default compression parameters that will be used for a particular input file, based on the provided compression level and the input size\. If the provided file is not a regular file (e\.g\. a pipe), this flag will output the parameters used for inputs of unknown size\. +.IP "\[ci]" 4 \fB\-\-\fR: All arguments after \fB\-\-\fR are treated as files -. .IP "" 0 -. -.SS "Restricted usage of Environment Variables" -Using environment variables to set parameters has security implications\. Therefore, this avenue is intentionally restricted\. Only \fBZSTD_CLEVEL\fR and \fBZSTD_NBTHREADS\fR are currently supported\. They set the compression level and number of threads to use during compression, respectively\. -. +.SS "gzip Operation Modifiers" +When invoked via a \fBgzip\fR symlink, \fBzstd\fR will support further options that intend to mimic the \fBgzip\fR behavior: +.TP +\fB\-n\fR, \fB\-\-no\-name\fR +do not store the original filename and timestamps when compressing a file\. This is the default behavior and hence a no\-op\. +.TP +\fB\-\-best\fR +alias to the option \fB\-9\fR\. +.SS "Environment Variables" +Employing environment variables to set parameters has security implications\. Therefore, this avenue is intentionally limited\. Only \fBZSTD_CLEVEL\fR and \fBZSTD_NBTHREADS\fR are currently supported\. They set the compression level and number of threads to use during compression, respectively\. .P \fBZSTD_CLEVEL\fR can be used to set the level between 1 and 19 (the "normal" range)\. If the value of \fBZSTD_CLEVEL\fR is not a valid integer, it will be ignored with a warning message\. \fBZSTD_CLEVEL\fR just replaces the default compression level (\fB3\fR)\. -. .P \fBZSTD_NBTHREADS\fR can be used to set the number of threads \fBzstd\fR will attempt to use during compression\. If the value of \fBZSTD_NBTHREADS\fR is not a valid unsigned integer, it will be ignored with a warning message\. \fBZSTD_NBTHREADS\fR has a default value of (\fB1\fR), and is capped at ZSTDMT_NBWORKERS_MAX==200\. \fBzstd\fR must be compiled with multithread support for this to have any effect\. -. .P They can both be overridden by corresponding command line arguments: \fB\-#\fR for compression level and \fB\-T#\fR for number of compression threads\. -. .SH "DICTIONARY BUILDER" -\fBzstd\fR offers \fIdictionary\fR compression, which greatly improves efficiency on small files and messages\. It\'s possible to train \fBzstd\fR with a set of samples, the result of which is saved into a file called a \fBdictionary\fR\. Then during compression and decompression, reference the same dictionary, using command \fB\-D dictionaryFileName\fR\. Compression of small files similar to the sample set will be greatly improved\. -. +\fBzstd\fR offers \fIdictionary\fR compression, which greatly improves efficiency on small files and messages\. It\'s possible to train \fBzstd\fR with a set of samples, the result of which is saved into a file called a \fBdictionary\fR\. Then, during compression and decompression, reference the same dictionary, using command \fB\-D dictionaryFileName\fR\. Compression of small files similar to the sample set will be greatly improved\. .TP \fB\-\-train FILEs\fR -Use FILEs as training set to create a dictionary\. The training set should contain a lot of small files (> 100), and weight typically 100x the target dictionary size (for example, 10 MB for a 100 KB dictionary)\. -. +Use FILEs as training set to create a dictionary\. The training set should ideally contain a lot of samples (> 100), and weight typically 100x the target dictionary size (for example, ~10 MB for a 100 KB dictionary)\. \fB\-\-train\fR can be combined with \fB\-r\fR to indicate a directory rather than listing all the files, which can be useful to circumvent shell expansion limits\. .IP -Supports multithreading if \fBzstd\fR is compiled with threading support\. Additional parameters can be specified with \fB\-\-train\-fastcover\fR\. The legacy dictionary builder can be accessed with \fB\-\-train\-legacy\fR\. The cover dictionary builder can be accessed with \fB\-\-train\-cover\fR\. Equivalent to \fB\-\-train\-fastcover=d=8,steps=4\fR\. -. +Since dictionary compression is mostly effective for small files, the expectation is that the training set will only contain small files\. In the case where some samples happen to be large, only the first 128 KiB of these samples will be used for training\. +.IP +\fB\-\-train\fR supports multithreading if \fBzstd\fR is compiled with threading support (default)\. Additional advanced parameters can be specified with \fB\-\-train\-fastcover\fR\. The legacy dictionary builder can be accessed with \fB\-\-train\-legacy\fR\. The slower cover dictionary builder can be accessed with \fB\-\-train\-cover\fR\. Default \fB\-\-train\fR is equivalent to \fB\-\-train\-fastcover=d=8,steps=4\fR\. .TP -\fB\-o file\fR -Dictionary saved into \fBfile\fR (default name: dictionary)\. -. +\fB\-o FILE\fR +Dictionary saved into \fBFILE\fR (default name: dictionary)\. .TP \fB\-\-maxdict=#\fR -Limit dictionary to specified size (default: 112640)\. -. +Limit dictionary to specified size (default: 112640 bytes)\. As usual, quantities are expressed in bytes by default, and it\'s possible to employ suffixes (like \fBKB\fR or \fBMB\fR) to specify larger values\. .TP \fB\-#\fR Use \fB#\fR compression level during training (optional)\. Will generate statistics more tuned for selected compression level, resulting in a \fIsmall\fR compression ratio improvement for this level\. -. .TP \fB\-B#\fR -Split input files in blocks of size # (default: no split) -. +Split input files into blocks of size # (default: no split) +.TP +\fB\-M#\fR, \fB\-\-memory=#\fR +Limit the amount of sample data loaded for training (default: 2 GB)\. Note that the default (2 GB) is also the maximum\. This parameter can be useful in situations where the training set size is not well controlled and could be potentially very large\. Since speed of the training process is directly correlated to the size of the training sample set, a smaller sample set leads to faster training\. +.IP +In situations where the training set is larger than maximum memory, the CLI will randomly select samples among the available ones, up to the maximum allowed memory budget\. This is meant to improve dictionary relevance by mitigating the potential impact of clustering, such as selecting only files from the beginning of a list sorted by modification date, or sorted by alphabetical order\. The randomization process is deterministic, so training of the same list of files with the same parameters will lead to the creation of the same dictionary\. .TP \fB\-\-dictID=#\fR -A dictionary ID is a locally unique ID that a decoder can use to verify it is using the right dictionary\. By default, zstd will create a 4\-bytes random number ID\. It\'s possible to give a precise number instead\. Short numbers have an advantage : an ID < 256 will only need 1 byte in the compressed frame header, and an ID < 65536 will only need 2 bytes\. This compares favorably to 4 bytes default\. However, it\'s up to the dictionary manager to not assign twice the same ID to 2 different dictionaries\. -. +A dictionary ID is a locally unique ID\. The decoder will use this value to verify it is using the right dictionary\. By default, zstd will create a 4\-bytes random number ID\. It\'s possible to provide an explicit number ID instead\. It\'s up to the dictionary manager to not assign twice the same ID to 2 different dictionaries\. Note that short numbers have an advantage: an ID < 256 will only need 1 byte in the compressed frame header, and an ID < 65536 will only need 2 bytes\. This compares favorably to 4 bytes default\. +.IP +Note that RFC8878 reserves IDs less than 32768 and greater than or equal to 2\e^31, so they should not be used in public\. .TP \fB\-\-train\-cover[=k#,d=#,steps=#,split=#,shrink[=#]]\fR Select parameters for the default dictionary builder algorithm named cover\. If \fId\fR is not specified, then it tries \fId\fR = 6 and \fId\fR = 8\. If \fIk\fR is not specified, then it tries \fIsteps\fR values in the range [50, 2000]\. If \fIsteps\fR is not specified, then the default value of 40 is used\. If \fIsplit\fR is not specified or split <= 0, then the default value of 100 is used\. Requires that \fId\fR <= \fIk\fR\. If \fIshrink\fR flag is not used, then the default value for \fIshrinkDict\fR of 0 is used\. If \fIshrink\fR is not specified, then the default value for \fIshrinkDictMaxRegression\fR of 1 is used\. -. .IP Selects segments of size \fIk\fR with highest score to put in the dictionary\. The score of a segment is computed by the sum of the frequencies of all the subsegments of size \fId\fR\. Generally \fId\fR should be in the range [6, 8], occasionally up to 16, but the algorithm will run faster with d <= \fI8\fR\. Good values for \fIk\fR vary widely based on the input data, but a safe range is [2 * \fId\fR, 2000]\. If \fIsplit\fR is 100, all input samples are used for both training and testing to find optimal \fId\fR and \fIk\fR to build dictionary\. Supports multithreading if \fBzstd\fR is compiled with threading support\. Having \fIshrink\fR enabled takes a truncated dictionary of minimum size and doubles in size until compression ratio of the truncated dictionary is at most \fIshrinkDictMaxRegression%\fR worse than the compression ratio of the largest dictionary\. -. .IP Examples: -. .IP \fBzstd \-\-train\-cover FILEs\fR -. .IP \fBzstd \-\-train\-cover=k=50,d=8 FILEs\fR -. .IP \fBzstd \-\-train\-cover=d=8,steps=500 FILEs\fR -. .IP \fBzstd \-\-train\-cover=k=50 FILEs\fR -. .IP \fBzstd \-\-train\-cover=k=50,split=60 FILEs\fR -. .IP \fBzstd \-\-train\-cover=shrink FILEs\fR -. .IP \fBzstd \-\-train\-cover=shrink=2 FILEs\fR -. .TP \fB\-\-train\-fastcover[=k#,d=#,f=#,steps=#,split=#,accel=#]\fR Same as cover but with extra parameters \fIf\fR and \fIaccel\fR and different default value of split If \fIsplit\fR is not specified, then it tries \fIsplit\fR = 75\. If \fIf\fR is not specified, then it tries \fIf\fR = 20\. Requires that 0 < \fIf\fR < 32\. If \fIaccel\fR is not specified, then it tries \fIaccel\fR = 1\. Requires that 0 < \fIaccel\fR <= 10\. Requires that \fId\fR = 6 or \fId\fR = 8\. -. .IP \fIf\fR is log of size of array that keeps track of frequency of subsegments of size \fId\fR\. The subsegment is hashed to an index in the range [0,2^\fIf\fR \- 1]\. It is possible that 2 different subsegments are hashed to the same index, and they are considered as the same subsegment when computing frequency\. Using a higher \fIf\fR reduces collision but takes longer\. -. .IP Examples: -. .IP \fBzstd \-\-train\-fastcover FILEs\fR -. .IP \fBzstd \-\-train\-fastcover=d=8,f=15,accel=2 FILEs\fR -. .TP \fB\-\-train\-legacy[=selectivity=#]\fR -Use legacy dictionary builder algorithm with the given dictionary \fIselectivity\fR (default: 9)\. The smaller the \fIselectivity\fR value, the denser the dictionary, improving its efficiency but reducing its possible maximum size\. \fB\-\-train\-legacy=s=#\fR is also accepted\. -. +Use legacy dictionary builder algorithm with the given dictionary \fIselectivity\fR (default: 9)\. The smaller the \fIselectivity\fR value, the denser the dictionary, improving its efficiency but reducing its achievable maximum size\. \fB\-\-train\-legacy=s=#\fR is also accepted\. .IP Examples: -. .IP \fBzstd \-\-train\-legacy FILEs\fR -. .IP \fBzstd \-\-train\-legacy=selectivity=8 FILEs\fR -. .SH "BENCHMARK" -. .TP \fB\-b#\fR benchmark file(s) using compression level # -. .TP \fB\-e#\fR benchmark file(s) using multiple compression levels, from \fB\-b#\fR to \fB\-e#\fR (inclusive) -. .TP \fB\-i#\fR minimum evaluation time, in seconds (default: 3s), benchmark mode only -. .TP \fB\-B#\fR, \fB\-\-block\-size=#\fR -cut file(s) into independent blocks of size # (default: no block) -. +cut file(s) into independent chunks of size # (default: no chunking) .TP \fB\-\-priority=rt\fR set process priority to real\-time -. .P -\fBOutput Format:\fR CompressionLevel#Filename : IntputSize \-> OutputSize (CompressionRatio), CompressionSpeed, DecompressionSpeed -. +\fBOutput Format:\fR CompressionLevel#Filename: InputSize \-> OutputSize (CompressionRatio), CompressionSpeed, DecompressionSpeed .P \fBMethodology:\fR For both compression and decompression speed, the entire input is compressed/decompressed in\-memory to measure speed\. A run lasts at least 1 sec, so when files are small, they are compressed/decompressed several times per run, in order to improve measurement accuracy\. -. .SH "ADVANCED COMPRESSION OPTIONS" -. -.SS "\-B#:" -Select the size of each compression job\. This parameter is only available when multi\-threading is enabled\. Each compression job is run in parallel, so this value indirectly impacts the nb of active threads\. Default job size varies depending on compression level (generally \fB4 * windowSize\fR)\. \fB\-B#\fR makes it possible to manually select a custom size\. Note that job size must respect a minimum value which is enforced transparently\. This minimum is either 512 KB, or \fBoverlapSize\fR, whichever is largest\. Different job sizes will lead to (slightly) different compressed frames\. -. +### \-B#: Specify the size of each compression job\. This parameter is only available when multi\-threading is enabled\. Each compression job is run in parallel, so this value indirectly impacts the nb of active threads\. Default job size varies depending on compression level (generally \fB4 * windowSize\fR)\. \fB\-B#\fR makes it possible to manually select a custom size\. Note that job size must respect a minimum value which is enforced transparently\. This minimum is either 512 KB, or \fBoverlapSize\fR, whichever is largest\. Different job sizes will lead to non\-identical compressed frames\. .SS "\-\-zstd[=options]:" -\fBzstd\fR provides 22 predefined compression levels\. The selected or default predefined compression level can be changed with advanced compression options\. The \fIoptions\fR are provided as a comma\-separated list\. You may specify only the options you want to change and the rest will be taken from the selected or default compression level\. The list of available \fIoptions\fR: -. +\fBzstd\fR provides 22 predefined regular compression levels plus the fast levels\. This compression level is translated internally into a number of specific parameters that actually control the behavior of the compressor\. (You can see the result of this translation with \fB\-\-show\-default\-cparams\fR\.) These specific parameters can be overridden with advanced compression options\. The \fIoptions\fR are provided as a comma\-separated list\. You may specify only the options you want to change and the rest will be taken from the selected or default compression level\. The list of available \fIoptions\fR: .TP \fBstrategy\fR=\fIstrat\fR, \fBstrat\fR=\fIstrat\fR Specify a strategy used by a match finder\. -. .IP -There are 9 strategies numbered from 1 to 9, from faster to stronger: 1=ZSTD_fast, 2=ZSTD_dfast, 3=ZSTD_greedy, 4=ZSTD_lazy, 5=ZSTD_lazy2, 6=ZSTD_btlazy2, 7=ZSTD_btopt, 8=ZSTD_btultra, 9=ZSTD_btultra2\. -. +There are 9 strategies numbered from 1 to 9, from fastest to strongest: 1=\fBZSTD_fast\fR, 2=\fBZSTD_dfast\fR, 3=\fBZSTD_greedy\fR, 4=\fBZSTD_lazy\fR, 5=\fBZSTD_lazy2\fR, 6=\fBZSTD_btlazy2\fR, 7=\fBZSTD_btopt\fR, 8=\fBZSTD_btultra\fR, 9=\fBZSTD_btultra2\fR\. .TP \fBwindowLog\fR=\fIwlog\fR, \fBwlog\fR=\fIwlog\fR Specify the maximum number of bits for a match distance\. -. .IP The higher number of increases the chance to find a match which usually improves compression ratio\. It also increases memory requirements for the compressor and decompressor\. The minimum \fIwlog\fR is 10 (1 KiB) and the maximum is 30 (1 GiB) on 32\-bit platforms and 31 (2 GiB) on 64\-bit platforms\. -. .IP Note: If \fBwindowLog\fR is set to larger than 27, \fB\-\-long=windowLog\fR or \fB\-\-memory=windowSize\fR needs to be passed to the decompressor\. -. .TP \fBhashLog\fR=\fIhlog\fR, \fBhlog\fR=\fIhlog\fR Specify the maximum number of bits for a hash table\. -. .IP -Bigger hash tables cause less collisions which usually makes compression faster, but requires more memory during compression\. -. +Bigger hash tables cause fewer collisions which usually makes compression faster, but requires more memory during compression\. .IP -The minimum \fIhlog\fR is 6 (64 B) and the maximum is 30 (1 GiB)\. -. +The minimum \fIhlog\fR is 6 (64 entries / 256 B) and the maximum is 30 (1B entries / 4 GiB)\. .TP \fBchainLog\fR=\fIclog\fR, \fBclog\fR=\fIclog\fR -Specify the maximum number of bits for a hash chain or a binary tree\. -. +Specify the maximum number of bits for the secondary search structure, whose form depends on the selected \fBstrategy\fR\. .IP -Higher numbers of bits increases the chance to find a match which usually improves compression ratio\. It also slows down compression speed and increases memory requirements for compression\. This option is ignored for the ZSTD_fast strategy\. -. +Higher numbers of bits increases the chance to find a match which usually improves compression ratio\. It also slows down compression speed and increases memory requirements for compression\. This option is ignored for the \fBZSTD_fast\fR \fBstrategy\fR, which only has the primary hash table\. .IP -The minimum \fIclog\fR is 6 (64 B) and the maximum is 29 (524 Mib) on 32\-bit platforms and 30 (1 Gib) on 64\-bit platforms\. -. +The minimum \fIclog\fR is 6 (64 entries / 256 B) and the maximum is 29 (512M entries / 2 GiB) on 32\-bit platforms and 30 (1B entries / 4 GiB) on 64\-bit platforms\. .TP \fBsearchLog\fR=\fIslog\fR, \fBslog\fR=\fIslog\fR Specify the maximum number of searches in a hash chain or a binary tree using logarithmic scale\. -. .IP More searches increases the chance to find a match which usually increases compression ratio but decreases compression speed\. -. .IP The minimum \fIslog\fR is 1 and the maximum is \'windowLog\' \- 1\. -. .TP \fBminMatch\fR=\fImml\fR, \fBmml\fR=\fImml\fR Specify the minimum searched length of a match in a hash table\. -. .IP Larger search lengths usually decrease compression ratio but improve decompression speed\. -. .IP The minimum \fImml\fR is 3 and the maximum is 7\. -. .TP \fBtargetLength\fR=\fItlen\fR, \fBtlen\fR=\fItlen\fR The impact of this field vary depending on selected strategy\. -. .IP -For ZSTD_btopt, ZSTD_btultra and ZSTD_btultra2, it specifies the minimum match length that causes match finder to stop searching\. A larger \fBtargetLength\fR usually improves compression ratio but decreases compression speed\. t For ZSTD_fast, it triggers ultra\-fast mode when > 0\. The value represents the amount of data skipped between match sampling\. Impact is reversed : a larger \fBtargetLength\fR increases compression speed but decreases compression ratio\. -. +For \fBZSTD_btopt\fR, \fBZSTD_btultra\fR and \fBZSTD_btultra2\fR, it specifies the minimum match length that causes match finder to stop searching\. A larger \fBtargetLength\fR usually improves compression ratio but decreases compression speed\. +.IP +For \fBZSTD_fast\fR, it triggers ultra\-fast mode when > 0\. The value represents the amount of data skipped between match sampling\. Impact is reversed: a larger \fBtargetLength\fR increases compression speed but decreases compression ratio\. .IP For all other strategies, this field has no impact\. -. .IP -The minimum \fItlen\fR is 0 and the maximum is 128 Kib\. -. +The minimum \fItlen\fR is 0 and the maximum is 128 KiB\. .TP \fBoverlapLog\fR=\fIovlog\fR, \fBovlog\fR=\fIovlog\fR Determine \fBoverlapSize\fR, amount of data reloaded from previous job\. This parameter is only available when multithreading is enabled\. Reloading more data improves compression ratio, but decreases speed\. -. .IP -The minimum \fIovlog\fR is 0, and the maximum is 9\. 1 means "no overlap", hence completely independent jobs\. 9 means "full overlap", meaning up to \fBwindowSize\fR is reloaded from previous job\. Reducing \fIovlog\fR by 1 reduces the reloaded amount by a factor 2\. For example, 8 means "windowSize/2", and 6 means "windowSize/8"\. Value 0 is special and means "default" : \fIovlog\fR is automatically determined by \fBzstd\fR\. In which case, \fIovlog\fR will range from 6 to 9, depending on selected \fIstrat\fR\. -. +The minimum \fIovlog\fR is 0, and the maximum is 9\. 1 means "no overlap", hence completely independent jobs\. 9 means "full overlap", meaning up to \fBwindowSize\fR is reloaded from previous job\. Reducing \fIovlog\fR by 1 reduces the reloaded amount by a factor 2\. For example, 8 means "windowSize/2", and 6 means "windowSize/8"\. Value 0 is special and means "default": \fIovlog\fR is automatically determined by \fBzstd\fR\. In which case, \fIovlog\fR will range from 6 to 9, depending on selected \fIstrat\fR\. .TP \fBldmHashLog\fR=\fIlhlog\fR, \fBlhlog\fR=\fIlhlog\fR Specify the maximum size for a hash table used for long distance matching\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Bigger hash tables usually improve compression ratio at the expense of more memory during compression and a decrease in compression speed\. -. .IP The minimum \fIlhlog\fR is 6 and the maximum is 30 (default: 20)\. -. .TP \fBldmMinMatch\fR=\fIlmml\fR, \fBlmml\fR=\fIlmml\fR Specify the minimum searched length of a match for long distance matching\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Larger/very small values usually decrease compression ratio\. -. .IP The minimum \fIlmml\fR is 4 and the maximum is 4096 (default: 64)\. -. .TP \fBldmBucketSizeLog\fR=\fIlblog\fR, \fBlblog\fR=\fIlblog\fR Specify the size of each bucket for the hash table used for long distance matching\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Larger bucket sizes improve collision resolution but decrease compression speed\. -. .IP The minimum \fIlblog\fR is 1 and the maximum is 8 (default: 3)\. -. .TP \fBldmHashRateLog\fR=\fIlhrlog\fR, \fBlhrlog\fR=\fIlhrlog\fR Specify the frequency of inserting entries into the long distance matching hash table\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Larger values will improve compression speed\. Deviating far from the default value will likely result in a decrease in compression ratio\. -. .IP The default value is \fBwlog \- lhlog\fR\. -. .SS "Example" The following parameters sets advanced compression options to something similar to predefined level 19 for files bigger than 256 KB: -. .P \fB\-\-zstd\fR=wlog=23,clog=23,hlog=22,slog=6,mml=3,tlen=48,strat=6 -. +.SH "SEE ALSO" +\fBzstdgrep\fR(1), \fBzstdless\fR(1), \fBgzip\fR(1), \fBxz\fR(1) +.P +The \fIzstandard\fR format is specified in Y\. Collet, "Zstandard Compression and the \'application/zstd\' Media Type", https://www\.ietf\.org/rfc/rfc8878\.txt, Internet RFC 8878 (February 2021)\. .SH "BUGS" Report bugs at: https://github\.com/facebook/zstd/issues -. .SH "AUTHOR" Yann Collet diff --git a/src/dependencies/zstd-1.5.0/programs/zstd.1.md b/src/dependencies/zstd-1.5.4/programs/zstd.1.md similarity index 66% rename from src/dependencies/zstd-1.5.0/programs/zstd.1.md rename to src/dependencies/zstd-1.5.4/programs/zstd.1.md index ae50928..3b7f24f 100644 --- a/src/dependencies/zstd-1.5.0/programs/zstd.1.md +++ b/src/dependencies/zstd-1.5.4/programs/zstd.1.md @@ -4,7 +4,7 @@ zstd(1) -- zstd, zstdmt, unzstd, zstdcat - Compress or decompress .zst files SYNOPSIS -------- -`zstd` [*OPTIONS*] [-|_INPUT-FILE_] [-o _OUTPUT-FILE_] +`zstd` [] [-|] [-o ] `zstdmt` is equivalent to `zstd -T0` @@ -16,32 +16,32 @@ SYNOPSIS DESCRIPTION ----------- `zstd` is a fast lossless compression algorithm and data compression tool, -with command line syntax similar to `gzip (1)` and `xz (1)`. +with command line syntax similar to `gzip`(1) and `xz`(1). It is based on the **LZ77** family, with further FSE & huff0 entropy stages. `zstd` offers highly configurable compression speed, -with fast modes at > 200 MB/s per core, -and strong modes nearing lzma compression ratios. +from fast modes at > 200 MB/s per core, +to strong modes with excellent compression ratios. It also features a very fast decoder, with speeds > 500 MB/s per core. `zstd` command line syntax is generally similar to gzip, -but features the following differences : +but features the following differences: - Source files are preserved by default. It's possible to remove them automatically by using the `--rm` command. - When compressing a single file, `zstd` displays progress notifications and result summary by default. Use `-q` to turn them off. - - `zstd` does not accept input from console, - but it properly accepts `stdin` when it's not the console. - `zstd` displays a short help page when command line is an error. Use `-q` to turn it off. + - `zstd` does not accept input from console, + though it does accept `stdin` when it's not the console. + - `zstd` does not store the input's filename or attributes, only its contents. -`zstd` compresses or decompresses each _file_ according to the selected -operation mode. +`zstd` processes each _file_ according to the selected operation mode. If no _files_ are given or _file_ is `-`, `zstd` reads from standard input and writes the processed data to standard output. `zstd` will refuse to write compressed data to standard output -if it is a terminal : it will display an error message and skip the _file_. +if it is a terminal: it will display an error message and skip the file. Similarly, `zstd` will refuse to read compressed data from standard input if it is a terminal. @@ -53,14 +53,15 @@ whose name is derived from the source _file_ name: * When decompressing, the `.zst` suffix is removed from the source filename to get the target filename -### Concatenation with .zst files -It is possible to concatenate `.zst` files as is. -`zstd` will decompress such files as if they were a single `.zst` file. +### Concatenation with .zst Files +It is possible to concatenate multiple `.zst` files. `zstd` will decompress +such agglomerated file as if it was a single `.zst` file. OPTIONS ------- -### Integer suffixes and special values +### Integer Suffixes and Special Values + In most places where an integer argument is expected, an optional suffix is supported to easily indicate large integers. There must be no space between the integer and the suffix. @@ -72,7 +73,8 @@ There must be no space between the integer and the suffix. Multiply the integer by 1,048,576 (2\^20). `Mi`, `M`, and `MB` are accepted as synonyms for `MiB`. -### Operation mode +### Operation Mode + If multiple operation mode options are given, the last one takes effect. @@ -85,23 +87,25 @@ the last one takes effect. Decompress. * `-t`, `--test`: Test the integrity of compressed _files_. - This option is equivalent to `--decompress --stdout` except that the - decompressed data is discarded instead of being written to standard output. + This option is equivalent to `--decompress --stdout > /dev/null`, + decompressed data is discarded and checksummed for errors. No files are created or removed. * `-b#`: - Benchmark file(s) using compression level # -* `--train FILEs`: - Use FILEs as a training set to create a dictionary. + Benchmark file(s) using compression level _#_. + See _BENCHMARK_ below for a description of this operation. +* `--train FILES`: + Use _FILES_ as a training set to create a dictionary. The training set should contain a lot of small files (> 100). + See _DICTIONARY BUILDER_ below for a description of this operation. * `-l`, `--list`: Display information related to a zstd compressed file, such as size, ratio, and checksum. Some of these fields may not be available. - This command can be augmented with the `-v` modifier. + This command's output can be augmented with the `-v` modifier. -### Operation modifiers +### Operation Modifiers * `-#`: - `#` compression level \[1-19] (default: 3) + selects `#` compression level \[1-19\] (default: 3) * `--ultra`: unlocks high compression levels 20+ (maximum 22), using a lot more memory. Note that decompression will also require more memory when using these levels. @@ -119,24 +123,31 @@ the last one takes effect. which is either 64 in 32-bit mode, or 256 for 64-bit environments. This modifier does nothing if `zstd` is compiled without multithread support. * `--single-thread`: - Does not spawn a thread for compression, use a single thread for both I/O and compression. - In this mode, compression is serialized with I/O, which is slightly slower. - (This is different from `-T1`, which spawns 1 compression thread in parallel of I/O). - This mode is the only one available when multithread support is disabled. - Single-thread mode features lower memory usage. - Final compressed result is slightly different from `-T1`. -* `--adapt[=min=#,max=#]` : + Use a single thread for both I/O and compression. + As compression is serialized with I/O, this can be slightly slower. + Single-thread mode features significantly lower memory usage, + which can be useful for systems with limited amount of memory, such as 32-bit systems. + + Note 1: this mode is the only available one when multithread support is disabled. + + Note 2: this mode is different from `-T1`, which spawns 1 compression thread in parallel with I/O. + Final compressed result is also slightly different from `-T1`. +* `--auto-threads={physical,logical} (default: physical)`: + When using a default amount of threads via `-T0`, choose the default based on the number + of detected physical or logical cores. +* `--adapt[=min=#,max=#]`: `zstd` will dynamically adapt compression level to perceived I/O conditions. Compression level adaptation can be observed live by using command `-v`. Adaptation can be constrained between supplied `min` and `max` levels. The feature works when combined with multi-threading and `--long` mode. It does not work with `--single-thread`. - It sets window size to 8 MB by default (can be changed manually, see `wlog`). + It sets window size to 8 MiB by default (can be changed manually, see `wlog`). Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible. - _note_ : at the time of this writing, `--adapt` can remain stuck at low speed + + _Note_: at the time of this writing, `--adapt` can remain stuck at low speed when combined with multiple worker threads (>=2). * `--long[=#]`: - enables long distance matching with `#` `windowLog`, if not `#` is not + enables long distance matching with `#` `windowLog`, if `#` is not present it defaults to `27`. This increases the window size (`windowLog`) and memory usage for both the compressor and decompressor. @@ -150,44 +161,51 @@ the last one takes effect. * `--patch-from FILE`: Specify the file to be used as a reference point for zstd's diff engine. This is effectively dictionary compression with some convenient parameter - selection, namely that windowSize > srcSize. + selection, namely that _windowSize_ > _srcSize_. - Note: cannot use both this and -D together - Note: `--long` mode will be automatically activated if chainLog < fileLog - (fileLog being the windowLog required to cover the whole file). You + Note: cannot use both this and `-D` together. + + Note: `--long` mode will be automatically activated if _chainLog_ < _fileLog_ + (_fileLog_ being the _windowLog_ required to cover the whole file). You can also manually force it. - Node: for all levels, you can use --patch-from in --single-thread mode - to improve compression ratio at the cost of speed + + Note: for all levels, you can use `--patch-from` in `--single-thread` mode + to improve compression ratio at the cost of speed. + Note: for level 19, you can get increased compression ratio at the cost of speed by specifying `--zstd=targetLength=` to be something large - (i.e 4096), and by setting a large `--zstd=chainLog=` -* `--rsyncable` : + (i.e. 4096), and by setting a large `--zstd=chainLog=`. +* `--rsyncable`: `zstd` will periodically synchronize the compression state to make the compressed file more rsync-friendly. There is a negligible impact to compression ratio, and the faster compression levels will see a small compression speed hit. This feature does not work with `--single-thread`. You probably don't want to use it with long range mode, since it will decrease the effectiveness of - the synchronization points, but your milage may vary. + the synchronization points, but your mileage may vary. * `-C`, `--[no-]check`: add integrity check computed from uncompressed data (default: enabled) * `--[no-]content-size`: enable / disable whether or not the original size of the file is placed in the header of the compressed file. The default option is - --content-size (meaning that the original size will be placed in the header). + `--content-size` (meaning that the original size will be placed in the header). * `--no-dictID`: do not store dictionary ID within frame header (dictionary compression). The decoder will have to rely on implicit knowledge about which dictionary to use, it won't be able to check if it's correct. * `-M#`, `--memory=#`: - Set a memory usage limit. By default, Zstandard uses 128 MB for decompression + Set a memory usage limit. By default, `zstd` uses 128 MiB for decompression as the maximum amount of memory the decompressor is allowed to use, but you can - override this manually if need be in either direction (ie. you can increase or + override this manually if need be in either direction (i.e. you can increase or decrease it). - This is also used during compression when using with --patch-from=. In this case, - this parameter overrides that maximum size allowed for a dictionary. (128 MB). -* `--stream-size=#` : + This is also used during compression when using with `--patch-from=`. In this case, + this parameter overrides that maximum size allowed for a dictionary. (128 MiB). + + Additionally, this can be used to limit memory for dictionary training. This parameter + overrides the default limit of 2 GiB. zstd will load training samples up to the memory limit + and ignore the rest. +* `--stream-size=#`: Sets the pledged source size of input coming from a stream. This value must be exact, as it will be included in the produced frame header. Incorrect stream sizes will cause an error. This information will be used to better optimize compression parameters, resulting in @@ -200,12 +218,14 @@ the last one takes effect. Exact guesses result in better compression ratios. Overestimates result in slightly degraded compression ratios, while underestimates may result in significant degradation. * `-o FILE`: - save result into `FILE` + save result into `FILE`. * `-f`, `--force`: disable input and output checks. Allows overwriting existing files, input from console, output to stdout, operating on links, block devices, etc. + During decompression and when the output destination is stdout, pass-through + unrecognized formats as-is. * `-c`, `--stdout`: - force write to standard output, even if it is the console + write to standard output (even if it is the console); keep original files unchanged. * `--[no-]sparse`: enable / disable sparse FS support, to make files with many zeroes smaller on disk. @@ -214,14 +234,26 @@ the last one takes effect. default: enabled when output is into a file, and disabled when output is stdout. This setting overrides default and can force sparse mode over stdout. +* `--[no-]pass-through` + enable / disable passing through uncompressed files as-is. During + decompression when pass-through is enabled, unrecognized formats will be + copied as-is from the input to the output. By default, pass-through will + occur when the output destination is stdout and the force (`-f`) option is + set. * `--rm`: - remove source file(s) after successful compression or decompression. If used in combination with - -o, will trigger a confirmation prompt (which can be silenced with -f), as this is a destructive operation. + remove source file(s) after successful compression or decompression. + This command is silently ignored if output is `stdout`. + If used in combination with `-o`, + triggers a confirmation prompt (which can be silenced with `-f`), as this is a destructive operation. * `-k`, `--keep`: keep source file(s) after successful compression or decompression. This is the default behavior. * `-r`: - operate recursively on directories + operate recursively on directories. + It selects all files in the named directory and all its subdirectories. + This can be useful both to reduce command line typing, + and to circumvent shell expansion limitations, + when there are a lot of files and naming breaks the maximum size of a command line. * `--filelist FILE` read a list of files to process as content from `FILE`. Format is compatible with `ls` output, with one file per line. @@ -251,7 +283,7 @@ the last one takes effect. display help/long help and exit * `-V`, `--version`: display version number and exit. - Advanced : `-vV` also displays supported formats. + Advanced: `-vV` also displays supported formats. `-vvV` also displays POSIX support. `-q` will only display the version number, suitable for machine reading. * `-v`, `--verbose`: @@ -262,17 +294,27 @@ the last one takes effect. * `--no-progress`: do not display the progress bar, but keep all other messages. * `--show-default-cparams`: - Shows the default compression parameters that will be used for a - particular src file. If the provided src file is not a regular file - (eg. named pipe), the cli will just output the default parameters. - That is, the parameters that are used when the src size is unknown. + shows the default compression parameters that will be used for a particular input file, based on the provided compression level and the input size. + If the provided file is not a regular file (e.g. a pipe), this flag will output the parameters used for inputs of unknown size. * `--`: All arguments after `--` are treated as files -### Restricted usage of Environment Variables -Using environment variables to set parameters has security implications. -Therefore, this avenue is intentionally restricted. +### gzip Operation Modifiers +When invoked via a `gzip` symlink, `zstd` will support further +options that intend to mimic the `gzip` behavior: + +* `-n`, `--no-name`: + do not store the original filename and timestamps when compressing + a file. This is the default behavior and hence a no-op. +* `--best`: + alias to the option `-9`. + + +### Environment Variables + +Employing environment variables to set parameters has security implications. +Therefore, this avenue is intentionally limited. Only `ZSTD_CLEVEL` and `ZSTD_NBTHREADS` are currently supported. They set the compression level and number of threads to use during compression, respectively. @@ -282,8 +324,8 @@ If the value of `ZSTD_CLEVEL` is not a valid integer, it will be ignored with a `ZSTD_NBTHREADS` can be used to set the number of threads `zstd` will attempt to use during compression. If the value of `ZSTD_NBTHREADS` is not a valid unsigned integer, it will be ignored with a warning message. -`ZSTD_NBTHREADS` has a default value of (`1`), and is capped at ZSTDMT_NBWORKERS_MAX==200. `zstd` must be -compiled with multithread support for this to have any effect. +`ZSTD_NBTHREADS` has a default value of (`1`), and is capped at ZSTDMT_NBWORKERS_MAX==200. +`zstd` must be compiled with multithread support for this to have any effect. They can both be overridden by corresponding command line arguments: `-#` for compression level and `-T#` for number of compression threads. @@ -295,41 +337,76 @@ DICTIONARY BUILDER which greatly improves efficiency on small files and messages. It's possible to train `zstd` with a set of samples, the result of which is saved into a file called a `dictionary`. -Then during compression and decompression, reference the same dictionary, +Then, during compression and decompression, reference the same dictionary, using command `-D dictionaryFileName`. Compression of small files similar to the sample set will be greatly improved. * `--train FILEs`: Use FILEs as training set to create a dictionary. - The training set should contain a lot of small files (> 100), + The training set should ideally contain a lot of samples (> 100), and weight typically 100x the target dictionary size - (for example, 10 MB for a 100 KB dictionary). + (for example, ~10 MB for a 100 KB dictionary). + `--train` can be combined with `-r` to indicate a directory rather than listing all the files, + which can be useful to circumvent shell expansion limits. - Supports multithreading if `zstd` is compiled with threading support. - Additional parameters can be specified with `--train-fastcover`. + Since dictionary compression is mostly effective for small files, + the expectation is that the training set will only contain small files. + In the case where some samples happen to be large, + only the first 128 KiB of these samples will be used for training. + + `--train` supports multithreading if `zstd` is compiled with threading support (default). + Additional advanced parameters can be specified with `--train-fastcover`. The legacy dictionary builder can be accessed with `--train-legacy`. - The cover dictionary builder can be accessed with `--train-cover`. - Equivalent to `--train-fastcover=d=8,steps=4`. -* `-o file`: - Dictionary saved into `file` (default name: dictionary). + The slower cover dictionary builder can be accessed with `--train-cover`. + Default `--train` is equivalent to `--train-fastcover=d=8,steps=4`. + +* `-o FILE`: + Dictionary saved into `FILE` (default name: dictionary). * `--maxdict=#`: - Limit dictionary to specified size (default: 112640). + Limit dictionary to specified size (default: 112640 bytes). + As usual, quantities are expressed in bytes by default, + and it's possible to employ suffixes (like `KB` or `MB`) + to specify larger values. * `-#`: Use `#` compression level during training (optional). Will generate statistics more tuned for selected compression level, resulting in a _small_ compression ratio improvement for this level. * `-B#`: - Split input files in blocks of size # (default: no split) + Split input files into blocks of size # (default: no split) +* `-M#`, `--memory=#`: + Limit the amount of sample data loaded for training (default: 2 GB). + Note that the default (2 GB) is also the maximum. + This parameter can be useful in situations where the training set size + is not well controlled and could be potentially very large. + Since speed of the training process is directly correlated to + the size of the training sample set, + a smaller sample set leads to faster training. + + In situations where the training set is larger than maximum memory, + the CLI will randomly select samples among the available ones, + up to the maximum allowed memory budget. + This is meant to improve dictionary relevance + by mitigating the potential impact of clustering, + such as selecting only files from the beginning of a list + sorted by modification date, or sorted by alphabetical order. + The randomization process is deterministic, so + training of the same list of files with the same parameters + will lead to the creation of the same dictionary. + * `--dictID=#`: - A dictionary ID is a locally unique ID that a decoder can use to verify it is - using the right dictionary. + A dictionary ID is a locally unique ID. + The decoder will use this value to verify it is using the right dictionary. By default, zstd will create a 4-bytes random number ID. - It's possible to give a precise number instead. - Short numbers have an advantage : an ID < 256 will only need 1 byte in the - compressed frame header, and an ID < 65536 will only need 2 bytes. - This compares favorably to 4 bytes default. - However, it's up to the dictionary manager to not assign twice the same ID to + It's possible to provide an explicit number ID instead. + It's up to the dictionary manager to not assign twice the same ID to 2 different dictionaries. + Note that short numbers have an advantage: + an ID < 256 will only need 1 byte in the compressed frame header, + and an ID < 65536 will only need 2 bytes. + This compares favorably to 4 bytes default. + + Note that RFC8878 reserves IDs less than 32768 and greater than or equal to 2\^31, so they should not be used in public. + * `--train-cover[=k#,d=#,steps=#,split=#,shrink[=#]]`: Select parameters for the default dictionary builder algorithm named cover. If _d_ is not specified, then it tries _d_ = 6 and _d_ = 8. @@ -394,7 +471,7 @@ Compression of small files similar to the sample set will be greatly improved. Use legacy dictionary builder algorithm with the given dictionary _selectivity_ (default: 9). The smaller the _selectivity_ value, the denser the dictionary, - improving its efficiency but reducing its possible maximum size. + improving its efficiency but reducing its achievable maximum size. `--train-legacy=s=#` is also accepted. Examples: @@ -414,30 +491,31 @@ BENCHMARK * `-i#`: minimum evaluation time, in seconds (default: 3s), benchmark mode only * `-B#`, `--block-size=#`: - cut file(s) into independent blocks of size # (default: no block) + cut file(s) into independent chunks of size # (default: no chunking) * `--priority=rt`: set process priority to real-time -**Output Format:** CompressionLevel#Filename : IntputSize -> OutputSize (CompressionRatio), CompressionSpeed, DecompressionSpeed +**Output Format:** CompressionLevel#Filename: InputSize -> OutputSize (CompressionRatio), CompressionSpeed, DecompressionSpeed **Methodology:** For both compression and decompression speed, the entire input is compressed/decompressed in-memory to measure speed. A run lasts at least 1 sec, so when files are small, they are compressed/decompressed several times per run, in order to improve measurement accuracy. ADVANCED COMPRESSION OPTIONS ---------------------------- ### -B#: -Select the size of each compression job. +Specify the size of each compression job. This parameter is only available when multi-threading is enabled. Each compression job is run in parallel, so this value indirectly impacts the nb of active threads. Default job size varies depending on compression level (generally `4 * windowSize`). `-B#` makes it possible to manually select a custom size. Note that job size must respect a minimum value which is enforced transparently. This minimum is either 512 KB, or `overlapSize`, whichever is largest. -Different job sizes will lead to (slightly) different compressed frames. +Different job sizes will lead to non-identical compressed frames. ### --zstd[=options]: -`zstd` provides 22 predefined compression levels. -The selected or default predefined compression level can be changed with -advanced compression options. +`zstd` provides 22 predefined regular compression levels plus the fast levels. +This compression level is translated internally into a number of specific parameters that actually control the behavior of the compressor. +(You can see the result of this translation with `--show-default-cparams`.) +These specific parameters can be overridden with advanced compression options. The _options_ are provided as a comma-separated list. You may specify only the options you want to change and the rest will be taken from the selected or default compression level. @@ -446,10 +524,10 @@ The list of available _options_: - `strategy`=_strat_, `strat`=_strat_: Specify a strategy used by a match finder. - There are 9 strategies numbered from 1 to 9, from faster to stronger: - 1=ZSTD\_fast, 2=ZSTD\_dfast, 3=ZSTD\_greedy, - 4=ZSTD\_lazy, 5=ZSTD\_lazy2, 6=ZSTD\_btlazy2, - 7=ZSTD\_btopt, 8=ZSTD\_btultra, 9=ZSTD\_btultra2. + There are 9 strategies numbered from 1 to 9, from fastest to strongest: + 1=`ZSTD_fast`, 2=`ZSTD_dfast`, 3=`ZSTD_greedy`, + 4=`ZSTD_lazy`, 5=`ZSTD_lazy2`, 6=`ZSTD_btlazy2`, + 7=`ZSTD_btopt`, 8=`ZSTD_btultra`, 9=`ZSTD_btultra2`. - `windowLog`=_wlog_, `wlog`=_wlog_: Specify the maximum number of bits for a match distance. @@ -466,22 +544,23 @@ The list of available _options_: - `hashLog`=_hlog_, `hlog`=_hlog_: Specify the maximum number of bits for a hash table. - Bigger hash tables cause less collisions which usually makes compression + Bigger hash tables cause fewer collisions which usually makes compression faster, but requires more memory during compression. - The minimum _hlog_ is 6 (64 B) and the maximum is 30 (1 GiB). + The minimum _hlog_ is 6 (64 entries / 256 B) and the maximum is 30 (1B entries / 4 GiB). - `chainLog`=_clog_, `clog`=_clog_: - Specify the maximum number of bits for a hash chain or a binary tree. + Specify the maximum number of bits for the secondary search structure, + whose form depends on the selected `strategy`. Higher numbers of bits increases the chance to find a match which usually improves compression ratio. It also slows down compression speed and increases memory requirements for compression. - This option is ignored for the ZSTD_fast strategy. + This option is ignored for the `ZSTD_fast` `strategy`, which only has the primary hash table. - The minimum _clog_ is 6 (64 B) and the maximum is 29 (524 Mib) on 32-bit platforms - and 30 (1 Gib) on 64-bit platforms. + The minimum _clog_ is 6 (64 entries / 256 B) and the maximum is 29 (512M entries / 2 GiB) on 32-bit platforms + and 30 (1B entries / 4 GiB) on 64-bit platforms. - `searchLog`=_slog_, `slog`=_slog_: Specify the maximum number of searches in a hash chain or a binary tree @@ -503,19 +582,19 @@ The list of available _options_: - `targetLength`=_tlen_, `tlen`=_tlen_: The impact of this field vary depending on selected strategy. - For ZSTD\_btopt, ZSTD\_btultra and ZSTD\_btultra2, it specifies + For `ZSTD_btopt`, `ZSTD_btultra` and `ZSTD_btultra2`, it specifies the minimum match length that causes match finder to stop searching. A larger `targetLength` usually improves compression ratio but decreases compression speed. -t - For ZSTD\_fast, it triggers ultra-fast mode when > 0. + + For `ZSTD_fast`, it triggers ultra-fast mode when > 0. The value represents the amount of data skipped between match sampling. - Impact is reversed : a larger `targetLength` increases compression speed + Impact is reversed: a larger `targetLength` increases compression speed but decreases compression ratio. For all other strategies, this field has no impact. - The minimum _tlen_ is 0 and the maximum is 128 Kib. + The minimum _tlen_ is 0 and the maximum is 128 KiB. - `overlapLog`=_ovlog_, `ovlog`=_ovlog_: Determine `overlapSize`, amount of data reloaded from previous job. @@ -527,7 +606,7 @@ t 9 means "full overlap", meaning up to `windowSize` is reloaded from previous job. Reducing _ovlog_ by 1 reduces the reloaded amount by a factor 2. For example, 8 means "windowSize/2", and 6 means "windowSize/8". - Value 0 is special and means "default" : _ovlog_ is automatically determined by `zstd`. + Value 0 is special and means "default": _ovlog_ is automatically determined by `zstd`. In which case, _ovlog_ will range from 6 to 9, depending on selected _strat_. - `ldmHashLog`=_lhlog_, `lhlog`=_lhlog_: @@ -577,6 +656,11 @@ similar to predefined level 19 for files bigger than 256 KB: `--zstd`=wlog=23,clog=23,hlog=22,slog=6,mml=3,tlen=48,strat=6 +SEE ALSO +-------- +`zstdgrep`(1), `zstdless`(1), `gzip`(1), `xz`(1) + +The format is specified in Y. Collet, "Zstandard Compression and the 'application/zstd' Media Type", https://www.ietf.org/rfc/rfc8878.txt, Internet RFC 8878 (February 2021). BUGS ---- diff --git a/src/dependencies/zstd-1.5.0/programs/zstdcli.c b/src/dependencies/zstd-1.5.4/programs/zstdcli.c similarity index 67% rename from src/dependencies/zstd-1.5.0/programs/zstdcli.c rename to src/dependencies/zstd-1.5.4/programs/zstdcli.c index 239aaf4..93f75e2 100644 --- a/src/dependencies/zstd-1.5.0/programs/zstdcli.c +++ b/src/dependencies/zstd-1.5.4/programs/zstdcli.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -27,8 +27,8 @@ /*-************************************ * Dependencies **************************************/ -#include "platform.h" /* IS_CONSOLE, PLATFORM_POSIX_VERSION */ -#include "util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList */ +#include "platform.h" /* PLATFORM_POSIX_VERSION */ +#include "util.h" /* UTIL_HAS_CREATEFILELIST, UTIL_createFileList, UTIL_isConsole */ #include /* getenv */ #include /* strcmp, strlen */ #include /* fprintf(), stdin, stdout, stderr */ @@ -46,17 +46,18 @@ # include "zstdcli_trace.h" #endif #include "../lib/zstd.h" /* ZSTD_VERSION_STRING, ZSTD_minCLevel, ZSTD_maxCLevel */ +#include "fileio_asyncio.h" /*-************************************ * Constants **************************************/ -#define COMPRESSOR_NAME "zstd command line interface" +#define COMPRESSOR_NAME "Zstandard CLI" #ifndef ZSTD_VERSION # define ZSTD_VERSION "v" ZSTD_VERSION_STRING #endif #define AUTHOR "Yann Collet" -#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s ***\n", COMPRESSOR_NAME, (int)(sizeof(size_t)*8), ZSTD_VERSION, AUTHOR +#define WELCOME_MESSAGE "*** %s (%i-bit) %s, by %s ***\n", COMPRESSOR_NAME, (int)(sizeof(size_t)*8), ZSTD_VERSION, AUTHOR #define ZSTD_ZSTDMT "zstdmt" #define ZSTD_UNZSTD "unzstd" @@ -124,6 +125,15 @@ static void checkLibVersion(void) } +/*! exeNameMatch() : + @return : a non-zero value if exeName matches test, excluding the extension + */ +static int exeNameMatch(const char* exeName, const char* test) +{ + return !strncmp(exeName, test, strlen(test)) && + (exeName[strlen(test)] == '\0' || exeName[strlen(test)] == '.'); +} + /*-************************************ * Command Line **************************************/ @@ -133,141 +143,174 @@ static void checkLibVersion(void) */ static void usage(FILE* f, const char* programName) { - DISPLAY_F(f, "Usage : \n"); - DISPLAY_F(f, " %s [args] [FILE(s)] [-o file] \n", programName); + DISPLAY_F(f, "Compress or decompress the INPUT file(s); reads from STDIN if INPUT is `-` or not provided.\n\n"); + DISPLAY_F(f, "Usage: %s [OPTIONS...] [INPUT... | -] [-o OUTPUT]\n\n", programName); + DISPLAY_F(f, "Options:\n"); + DISPLAY_F(f, " -o OUTPUT Write output to a single file, OUTPUT.\n"); + DISPLAY_F(f, " -k, --keep Preserve INPUT file(s). [Default] \n"); + DISPLAY_F(f, " --rm Remove INPUT file(s) after successful (de)compression.\n"); +#ifdef ZSTD_GZCOMPRESS + if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */ + DISPLAY_F(f, " -n, --no-name Do not store original filename when compressing.\n\n"); + } +#endif DISPLAY_F(f, "\n"); - DISPLAY_F(f, "FILE : a filename \n"); - DISPLAY_F(f, " with no FILE, or when FILE is - , read standard input\n"); - DISPLAY_F(f, "Arguments : \n"); #ifndef ZSTD_NOCOMPRESS - DISPLAY_F(f, " -# : # compression level (1-%d, default: %d) \n", ZSTDCLI_CLEVEL_MAX, ZSTDCLI_CLEVEL_DEFAULT); + DISPLAY_F(f, " -# Desired compression level, where `#` is a number between 1 and %d;\n", ZSTDCLI_CLEVEL_MAX); + DISPLAY_F(f, " lower numbers provide faster compression, higher numbers yield\n"); + DISPLAY_F(f, " better compression ratios. [Default: %d]\n\n", ZSTDCLI_CLEVEL_DEFAULT); #endif #ifndef ZSTD_NODECOMPRESS - DISPLAY_F(f, " -d : decompression \n"); + DISPLAY_F(f, " -d, --decompress Perform decompression.\n"); #endif - DISPLAY_F(f, " -D DICT: use DICT as Dictionary for compression or decompression \n"); - DISPLAY_F(f, " -o file: result stored into `file` (only 1 output file) \n"); - DISPLAY_F(f, " -f : disable input and output checks. Allows overwriting existing files,\n"); - DISPLAY_F(f, " input from console, output to stdout, operating on links,\n"); - DISPLAY_F(f, " block devices, etc.\n"); - DISPLAY_F(f, "--rm : remove source file(s) after successful de/compression \n"); - DISPLAY_F(f, " -k : preserve source file(s) (default) \n"); - DISPLAY_F(f, " -h/-H : display help/long help and exit \n"); + DISPLAY_F(f, " -D DICT Use DICT as the dictionary for compression or decompression.\n\n"); + DISPLAY_F(f, " -f, --force Disable input and output checks. Allows overwriting existing files,\n"); + DISPLAY_F(f, " receiving input from the console, printing ouput to STDOUT, and\n"); + DISPLAY_F(f, " operating on links, block devices, etc. Unrecognized formats will be\n"); + DISPLAY_F(f, " passed-through through as-is.\n\n"); + + DISPLAY_F(f, " -h Display short usage and exit.\n"); + DISPLAY_F(f, " -H, --help Display full help and exit.\n"); + DISPLAY_F(f, " -V, --version Display the program version and exit.\n"); + DISPLAY_F(f, "\n"); } static void usage_advanced(const char* programName) { DISPLAYOUT(WELCOME_MESSAGE); + DISPLAYOUT("\n"); usage(stdout, programName); - DISPLAYOUT( "\n"); - DISPLAYOUT( "Advanced arguments : \n"); - DISPLAYOUT( " -V : display Version number and exit \n"); + DISPLAYOUT("Advanced options:\n"); + DISPLAYOUT(" -c, --stdout Write to STDOUT (even if it is a console) and keep the INPUT file(s).\n\n"); - DISPLAYOUT( " -c : force write to standard output, even if it is the console \n"); - - DISPLAYOUT( " -v : verbose mode; specify multiple times to increase verbosity \n"); - DISPLAYOUT( " -q : suppress warnings; specify twice to suppress errors too \n"); - DISPLAYOUT( "--[no-]progress : forcibly display, or never display the progress counter.\n"); - DISPLAYOUT( " note: any (de)compressed output to terminal will mix with progress counter text. \n"); + DISPLAYOUT(" -v, --verbose Enable verbose output; pass multiple times to increase verbosity.\n"); + DISPLAYOUT(" -q, --quiet Suppress warnings; pass twice to suppress errors.\n"); +#ifndef ZSTD_NOTRACE + DISPLAYOUT(" --trace LOG Log tracing information to LOG.\n"); +#endif + DISPLAYOUT("\n"); + DISPLAYOUT(" --[no-]progress Forcibly show/hide the progress counter. NOTE: Any (de)compressed\n"); + DISPLAYOUT(" output to terminal will mix with progress counter text.\n\n"); #ifdef UTIL_HAS_CREATEFILELIST - DISPLAYOUT( " -r : operate recursively on directories \n"); - DISPLAYOUT( "--filelist FILE : read list of files to operate upon from FILE \n"); - DISPLAYOUT( "--output-dir-flat DIR : processed files are stored into DIR \n"); + DISPLAYOUT(" -r Operate recursively on directories.\n"); + DISPLAYOUT(" --filelist LIST Read a list of files to operate on from LIST.\n"); + DISPLAYOUT(" --output-dir-flat DIR Store processed files in DIR.\n"); #endif #ifdef UTIL_HAS_MIRRORFILELIST - DISPLAYOUT( "--output-dir-mirror DIR : processed files are stored into DIR respecting original directory structure \n"); + DISPLAYOUT(" --output-dir-mirror DIR Store processed files in DIR, respecting original directory structure.\n"); #endif + if (AIO_supported()) + DISPLAYOUT(" --[no-]asyncio Use asynchronous IO. [Default: Enabled]\n"); - + DISPLAYOUT("\n"); #ifndef ZSTD_NOCOMPRESS - DISPLAYOUT( "--[no-]check : during compression, add XXH64 integrity checksum to frame (default: enabled)"); + DISPLAYOUT(" --[no-]check Add XXH64 integrity checksums during compression. [Default: Add, Validate]\n"); #ifndef ZSTD_NODECOMPRESS - DISPLAYOUT( ". If specified with -d, decompressor will ignore/validate checksums in compressed frame (default: validate)."); + DISPLAYOUT(" If `-d` is present, ignore/validate checksums during decompression.\n"); #endif #else #ifdef ZSTD_NOCOMPRESS - DISPLAYOUT( "--[no-]check : during decompression, ignore/validate checksums in compressed frame (default: validate)."); + DISPLAYOUT(" --[no-]check Ignore/validate checksums during decompression. [Default: Validate]"); #endif #endif /* ZSTD_NOCOMPRESS */ -#ifndef ZSTD_NOTRACE - DISPLAYOUT( "\n"); - DISPLAYOUT( "--trace FILE : log tracing information to FILE."); -#endif - DISPLAYOUT( "\n"); - - DISPLAYOUT( "-- : All arguments after \"--\" are treated as files \n"); + DISPLAYOUT("\n"); + DISPLAYOUT(" -- Treat remaining arguments after `--` as files.\n"); #ifndef ZSTD_NOCOMPRESS - DISPLAYOUT( "\n"); - DISPLAYOUT( "Advanced compression arguments : \n"); - DISPLAYOUT( "--ultra : enable levels beyond %i, up to %i (requires more memory) \n", ZSTDCLI_CLEVEL_MAX, ZSTD_maxCLevel()); - DISPLAYOUT( "--long[=#]: enable long distance matching with given window log (default: %u) \n", g_defaultMaxWindowLog); - DISPLAYOUT( "--fast[=#]: switch to very fast compression levels (default: %u) \n", 1); - DISPLAYOUT( "--adapt : dynamically adapt compression level to I/O conditions \n"); - DISPLAYOUT( "--[no-]row-match-finder : force enable/disable usage of fast row-based matchfinder for greedy, lazy, and lazy2 strategies \n"); -# ifdef ZSTD_MULTITHREAD - DISPLAYOUT( " -T# : spawns # compression threads (default: 1, 0==# cores) \n"); - DISPLAYOUT( " -B# : select size of each job (default: 0==automatic) \n"); - DISPLAYOUT( "--single-thread : use a single thread for both I/O and compression (result slightly different than -T1) \n"); - DISPLAYOUT( "--rsyncable : compress using a rsync-friendly method (-B sets block size) \n"); -# endif - DISPLAYOUT( "--exclude-compressed: only compress files that are not already compressed \n"); - DISPLAYOUT( "--stream-size=# : specify size of streaming input from `stdin` \n"); - DISPLAYOUT( "--size-hint=# optimize compression parameters for streaming input of approximately this size \n"); - DISPLAYOUT( "--target-compressed-block-size=# : generate compressed block of approximately targeted size \n"); - DISPLAYOUT( "--no-dictID : don't write dictID into header (dictionary compression only) \n"); - DISPLAYOUT( "--[no-]compress-literals : force (un)compressed literals \n"); - - DISPLAYOUT( "--format=zstd : compress files to the .zst format (default) \n"); + DISPLAYOUT("\n"); + DISPLAYOUT("Advanced compression options:\n"); + DISPLAYOUT(" --ultra Enable levels beyond %i, up to %i; requires more memory.\n", ZSTDCLI_CLEVEL_MAX, ZSTD_maxCLevel()); + DISPLAYOUT(" --fast[=#] Use to very fast compression levels. [Default: %u]\n", 1); #ifdef ZSTD_GZCOMPRESS - DISPLAYOUT( "--format=gzip : compress files to the .gz format \n"); + if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */ + DISPLAYOUT(" --best Compatibility alias for `-9`.\n"); + } +#endif + DISPLAYOUT(" --adapt Dynamically adapt compression level to I/O conditions.\n"); + DISPLAYOUT(" --long[=#] Enable long distance matching with window log #. [Default: %u]\n", g_defaultMaxWindowLog); + DISPLAYOUT(" --patch-from=REF Use REF as the reference point for Zstandard's diff engine. \n\n"); +# ifdef ZSTD_MULTITHREAD + DISPLAYOUT(" -T# Spawn # compression threads. [Default: 1; pass 0 for core count.]\n"); + DISPLAYOUT(" --single-thread Share a single thread for I/O and compression (slightly different than `-T1`).\n"); + DISPLAYOUT(" --auto-threads={physical|logical}\n"); + DISPLAYOUT(" Use physical/logical cores when using `-T0`. [Default: Physical]\n\n"); + DISPLAYOUT(" -B# Set job size to #. [Default: 0 (automatic)]\n"); + DISPLAYOUT(" --rsyncable Compress using a rsync-friendly method (`-B` sets block size). \n"); + DISPLAYOUT("\n"); +# endif + DISPLAYOUT(" --exclude-compressed Only compress files that are not already compressed.\n\n"); + + DISPLAYOUT(" --stream-size=# Specify size of streaming input from STDIN.\n"); + DISPLAYOUT(" --size-hint=# Optimize compression parameters for streaming input of approximately size #.\n"); + DISPLAYOUT(" --target-compressed-block-size=#\n"); + DISPLAYOUT(" Generate compressed blocks of approximately # size.\n\n"); + DISPLAYOUT(" --no-dictID Don't write `dictID` into the header (dictionary compression only).\n"); + DISPLAYOUT(" --[no-]compress-literals Force (un)compressed literals.\n"); + DISPLAYOUT(" --[no-]row-match-finder Explicitly enable/disable the fast, row-based matchfinder for\n"); + DISPLAYOUT(" the 'greedy', 'lazy', and 'lazy2' strategies.\n"); + + DISPLAYOUT("\n"); + DISPLAYOUT(" --format=zstd Compress files to the `.zst` format. [Default]\n"); +#ifdef ZSTD_GZCOMPRESS + DISPLAYOUT(" --format=gzip Compress files to the `.gz` format.\n"); #endif #ifdef ZSTD_LZMACOMPRESS - DISPLAYOUT( "--format=xz : compress files to the .xz format \n"); - DISPLAYOUT( "--format=lzma : compress files to the .lzma format \n"); + DISPLAYOUT(" --format=xz Compress files to the `.xz` format.\n"); + DISPLAYOUT(" --format=lzma Compress files to the `.lzma` format.\n"); #endif #ifdef ZSTD_LZ4COMPRESS - DISPLAYOUT( "--format=lz4 : compress files to the .lz4 format \n"); + DISPLAYOUT( " --format=lz4 Compress files to the `.lz4` format.\n"); #endif #endif /* !ZSTD_NOCOMPRESS */ #ifndef ZSTD_NODECOMPRESS - DISPLAYOUT( "\n"); - DISPLAYOUT( "Advanced decompression arguments : \n"); - DISPLAYOUT( " -l : print information about zstd compressed files \n"); - DISPLAYOUT( "--test : test compressed file integrity \n"); - DISPLAYOUT( " -M# : Set a memory usage limit for decompression \n"); + DISPLAYOUT("\n"); + DISPLAYOUT("Advanced decompression options:\n"); + DISPLAYOUT(" -l Print information about Zstandard-compressed files.\n"); + DISPLAYOUT(" --test Test compressed file integrity.\n"); + DISPLAYOUT(" -M# Set the memory usage limit to # megabytes.\n"); # if ZSTD_SPARSE_DEFAULT - DISPLAYOUT( "--[no-]sparse : sparse mode (default: enabled on file, disabled on stdout) \n"); + DISPLAYOUT(" --[no-]sparse Enable sparse mode. [Default: Enabled for files, disabled for STDOUT.]\n"); # else - DISPLAYOUT( "--[no-]sparse : sparse mode (default: disabled) \n"); + DISPLAYOUT(" --[no-]sparse Enable sparse mode. [Default: Disabled]\n"); # endif + { + char const* passThroughDefault = "Disabled"; + if (exeNameMatch(programName, ZSTD_CAT) || + exeNameMatch(programName, ZSTD_ZCAT) || + exeNameMatch(programName, ZSTD_GZCAT)) { + passThroughDefault = "Enabled"; + } + DISPLAYOUT(" --[no-]pass-through Pass through uncompressed files as-is. [Default: %s]\n", passThroughDefault); + } #endif /* ZSTD_NODECOMPRESS */ #ifndef ZSTD_NODICT - DISPLAYOUT( "\n"); - DISPLAYOUT( "Dictionary builder : \n"); - DISPLAYOUT( "--train ## : create a dictionary from a training set of files \n"); - DISPLAYOUT( "--train-cover[=k=#,d=#,steps=#,split=#,shrink[=#]] : use the cover algorithm with optional args \n"); - DISPLAYOUT( "--train-fastcover[=k=#,d=#,f=#,steps=#,split=#,accel=#,shrink[=#]] : use the fast cover algorithm with optional args \n"); - DISPLAYOUT( "--train-legacy[=s=#] : use the legacy algorithm with selectivity (default: %u) \n", g_defaultSelectivityLevel); - DISPLAYOUT( " -o DICT : DICT is dictionary name (default: %s) \n", g_defaultDictName); - DISPLAYOUT( "--maxdict=# : limit dictionary to specified size (default: %u) \n", g_defaultMaxDictSize); - DISPLAYOUT( "--dictID=# : force dictionary ID to specified value (default: random) \n"); + DISPLAYOUT("\n"); + DISPLAYOUT("Dictionary builder:\n"); + DISPLAYOUT(" --train Create a dictionary from a training set of files.\n\n"); + DISPLAYOUT(" --train-cover[=k=#,d=#,steps=#,split=#,shrink[=#]]\n"); + DISPLAYOUT(" Use the cover algorithm (with optional arguments).\n"); + DISPLAYOUT(" --train-fastcover[=k=#,d=#,f=#,steps=#,split=#,accel=#,shrink[=#]]\n"); + DISPLAYOUT(" Use the fast cover algorithm (with optional arguments).\n\n"); + DISPLAYOUT(" --train-legacy[=s=#] Use the legacy algorithm with selectivity #. [Default: %u]\n", g_defaultSelectivityLevel); + DISPLAYOUT(" -o NAME Use NAME as dictionary name. [Default: %s]\n", g_defaultDictName); + DISPLAYOUT(" --maxdict=# Limit dictionary to specified size #. [Default: %u]\n", g_defaultMaxDictSize); + DISPLAYOUT(" --dictID=# Force dictionary ID to #. [Default: Random]\n"); #endif #ifndef ZSTD_NOBENCH - DISPLAYOUT( "\n"); - DISPLAYOUT( "Benchmark arguments : \n"); - DISPLAYOUT( " -b# : benchmark file(s), using # compression level (default: %d) \n", ZSTDCLI_CLEVEL_DEFAULT); - DISPLAYOUT( " -e# : test all compression levels successively from -b# to -e# (default: 1) \n"); - DISPLAYOUT( " -i# : minimum evaluation time in seconds (default: 3s) \n"); - DISPLAYOUT( " -B# : cut file into independent blocks of size # (default: no block) \n"); - DISPLAYOUT( " -S : output one benchmark result per input file (default: consolidated result) \n"); - DISPLAYOUT( "--priority=rt : set process priority to real-time \n"); + DISPLAYOUT("\n"); + DISPLAYOUT("Benchmark options:\n"); + DISPLAYOUT(" -b# Perform benchmarking with compression level #. [Default: %d]\n", ZSTDCLI_CLEVEL_DEFAULT); + DISPLAYOUT(" -e# Test all compression levels up to #; starting level is `-b#`. [Default: 1]\n"); + DISPLAYOUT(" -i# Set the minimum evaluation to time # seconds. [Default: 3]\n"); + DISPLAYOUT(" -B# Cut file into independent chunks of size #. [Default: No chunking]\n"); + DISPLAYOUT(" -S Output one benchmark result per input file. [Default: Consolidated result]\n"); + DISPLAYOUT(" --priority=rt Set process priority to real-time.\n"); #endif } @@ -294,18 +337,9 @@ static const char* lastNameFromPath(const char* path) return name; } -/*! exeNameMatch() : - @return : a non-zero value if exeName matches test, excluding the extension - */ -static int exeNameMatch(const char* exeName, const char* test) -{ - return !strncmp(exeName, test, strlen(test)) && - (exeName[strlen(test)] == '\0' || exeName[strlen(test)] == '.'); -} - static void errorOut(const char* msg) { - DISPLAY("%s \n", msg); exit(1); + DISPLAYLEVEL(1, "%s \n", msg); exit(1); } /*! readU32FromCharChecked() : @@ -353,6 +387,23 @@ static unsigned readU32FromChar(const char** stringPtr) { return result; } +/*! readIntFromChar() : + * @return : signed integer value read from input in `char` format. + * allows and interprets K, KB, KiB, M, MB and MiB suffix. + * Will also modify `*stringPtr`, advancing it to position where it stopped reading. + * Note : function will exit() program if digit sequence overflows */ +static int readIntFromChar(const char** stringPtr) { + static const char errorMsg[] = "error: numeric value overflows 32-bit int"; + int sign = 1; + unsigned result; + if (**stringPtr=='-') { + (*stringPtr)++; + sign = -1; + } + if (readU32FromCharChecked(stringPtr, &result)) { errorOut(errorMsg); } + return (int) result * sign; +} + /*! readSizeTFromCharChecked() : * @return 0 if success, and store the result in *value. * allows and interprets K, KB, KiB, M, MB and MiB suffix. @@ -546,8 +597,8 @@ static ZDICT_fastCover_params_t defaultFastCoverParams(void) static unsigned parseAdaptParameters(const char* stringPtr, int* adaptMinPtr, int* adaptMaxPtr) { for ( ; ;) { - if (longCommandWArg(&stringPtr, "min=")) { *adaptMinPtr = (int)readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; } - if (longCommandWArg(&stringPtr, "max=")) { *adaptMaxPtr = (int)readU32FromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; } + if (longCommandWArg(&stringPtr, "min=")) { *adaptMinPtr = readIntFromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; } + if (longCommandWArg(&stringPtr, "max=")) { *adaptMaxPtr = readIntFromChar(&stringPtr); if (stringPtr[0]==',') { stringPtr++; continue; } else break; } DISPLAYLEVEL(4, "invalid compression parameter \n"); return 0; } @@ -615,6 +666,11 @@ static void printVersion(void) #endif DISPLAYOUT("\n"); if (g_displayLevel >= 4) { + /* library versions */ + DISPLAYOUT("zlib version %s\n", FIO_zlibVersion()); + DISPLAYOUT("lz4 version %s\n", FIO_lz4Version()); + DISPLAYOUT("lzma version %s\n", FIO_lzmaVersion()); + /* posix support */ #ifdef _POSIX_C_SOURCE DISPLAYOUT("_POSIX_C_SOURCE defined: %ldL\n", (long) _POSIX_C_SOURCE); @@ -628,6 +684,48 @@ static void printVersion(void) } } } +#define ZSTD_NB_STRATEGIES 9 +static const char* ZSTD_strategyMap[ZSTD_NB_STRATEGIES + 1] = { "", "ZSTD_fast", + "ZSTD_dfast", "ZSTD_greedy", "ZSTD_lazy", "ZSTD_lazy2", "ZSTD_btlazy2", + "ZSTD_btopt", "ZSTD_btultra", "ZSTD_btultra2"}; + +#ifndef ZSTD_NOCOMPRESS + +static void printDefaultCParams(const char* filename, const char* dictFileName, int cLevel) { + unsigned long long fileSize = UTIL_getFileSize(filename); + const size_t dictSize = dictFileName != NULL ? (size_t)UTIL_getFileSize(dictFileName) : 0; + const ZSTD_compressionParameters cParams = ZSTD_getCParams(cLevel, fileSize, dictSize); + if (fileSize != UTIL_FILESIZE_UNKNOWN) DISPLAY("%s (%u bytes)\n", filename, (unsigned)fileSize); + else DISPLAY("%s (src size unknown)\n", filename); + DISPLAY(" - windowLog : %u\n", cParams.windowLog); + DISPLAY(" - chainLog : %u\n", cParams.chainLog); + DISPLAY(" - hashLog : %u\n", cParams.hashLog); + DISPLAY(" - searchLog : %u\n", cParams.searchLog); + DISPLAY(" - minMatch : %u\n", cParams.minMatch); + DISPLAY(" - targetLength : %u\n", cParams.targetLength); + assert(cParams.strategy < ZSTD_NB_STRATEGIES + 1); + DISPLAY(" - strategy : %s (%u)\n", ZSTD_strategyMap[(int)cParams.strategy], (unsigned)cParams.strategy); +} + +static void printActualCParams(const char* filename, const char* dictFileName, int cLevel, const ZSTD_compressionParameters* cParams) { + unsigned long long fileSize = UTIL_getFileSize(filename); + const size_t dictSize = dictFileName != NULL ? (size_t)UTIL_getFileSize(dictFileName) : 0; + ZSTD_compressionParameters actualCParams = ZSTD_getCParams(cLevel, fileSize, dictSize); + assert(g_displayLevel >= 4); + actualCParams.windowLog = cParams->windowLog == 0 ? actualCParams.windowLog : cParams->windowLog; + actualCParams.chainLog = cParams->chainLog == 0 ? actualCParams.chainLog : cParams->chainLog; + actualCParams.hashLog = cParams->hashLog == 0 ? actualCParams.hashLog : cParams->hashLog; + actualCParams.searchLog = cParams->searchLog == 0 ? actualCParams.searchLog : cParams->searchLog; + actualCParams.minMatch = cParams->minMatch == 0 ? actualCParams.minMatch : cParams->minMatch; + actualCParams.targetLength = cParams->targetLength == 0 ? actualCParams.targetLength : cParams->targetLength; + actualCParams.strategy = cParams->strategy == 0 ? actualCParams.strategy : cParams->strategy; + DISPLAY("--zstd=wlog=%d,clog=%d,hlog=%d,slog=%d,mml=%d,tlen=%d,strat=%d\n", + actualCParams.windowLog, actualCParams.chainLog, actualCParams.hashLog, actualCParams.searchLog, + actualCParams.minMatch, actualCParams.targetLength, actualCParams.strategy); +} + +#endif + /* Environment variables for parameter setting */ #define ENV_CLEVEL "ZSTD_CLEVEL" #define ENV_NBTHREADS "ZSTD_NBTHREADS" /* takes lower precedence than directly specifying -T# in the CLI */ @@ -688,13 +786,13 @@ static unsigned init_nbThreads(void) { } else { \ argNb++; \ if (argNb >= argCount) { \ - DISPLAY("error: missing command argument \n"); \ + DISPLAYLEVEL(1, "error: missing command argument \n"); \ CLEAN_RETURN(1); \ } \ ptr = argv[argNb]; \ assert(ptr != NULL); \ if (ptr[0]=='-') { \ - DISPLAY("error: command cannot be separated from its argument by another command \n"); \ + DISPLAYLEVEL(1, "error: command cannot be separated from its argument by another command \n"); \ CLEAN_RETURN(1); \ } } } @@ -702,12 +800,19 @@ static unsigned init_nbThreads(void) { const char* __nb; \ NEXT_FIELD(__nb); \ val32 = readU32FromChar(&__nb); \ + if(*__nb != 0) { \ + errorOut("error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed"); \ + } \ } -#define ZSTD_NB_STRATEGIES 9 -static const char* ZSTD_strategyMap[ZSTD_NB_STRATEGIES + 1] = { "", "ZSTD_fast", - "ZSTD_dfast", "ZSTD_greedy", "ZSTD_lazy", "ZSTD_lazy2", "ZSTD_btlazy2", - "ZSTD_btopt", "ZSTD_btultra", "ZSTD_btultra2"}; +#define NEXT_TSIZE(valTsize) { \ + const char* __nb; \ + NEXT_FIELD(__nb); \ + valTsize = readSizeTFromChar(&__nb); \ + if(*__nb != 0) { \ + errorOut("error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed"); \ + } \ +} typedef enum { zom_compress, zom_decompress, zom_test, zom_bench, zom_train, zom_list } zstd_operation_mode; @@ -722,7 +827,7 @@ typedef enum { zom_compress, zom_decompress, zom_test, zom_bench, zom_train, zom # define MAXCLEVEL ZSTD_maxCLevel() #endif -int main(int const argCount, const char* argv[]) +int main(int argCount, const char* argv[]) { int argNb, followLinks = 0, @@ -732,9 +837,7 @@ int main(int const argCount, const char* argv[]) hasStdout = 0, ldmFlag = 0, main_pause = 0, - nbWorkers = 0, adapt = 0, - useRowMatchFinder = 0, adaptMin = MINCLEVEL, adaptMax = MAXCLEVEL, rsyncable = 0, @@ -743,15 +846,21 @@ int main(int const argCount, const char* argv[]) separateFiles = 0, setRealTimePrio = 0, singleThread = 0, + defaultLogicalCores = 0, showDefaultCParams = 0, ultra=0, - contentSize=1; + contentSize=1, + removeSrcFile=0; + ZSTD_paramSwitch_e useRowMatchFinder = ZSTD_ps_auto; + FIO_compressionType_t cType = FIO_zstdCompression; + unsigned nbWorkers = 0; double compressibility = 0.5; unsigned bench_nbSeconds = 3; /* would be better if this value was synchronized from bench */ size_t blockSize = 0; FIO_prefs_t* const prefs = FIO_createPreferences(); FIO_ctx_t* const fCtx = FIO_createContext(); + FIO_progressSetting_e progress = FIO_ps_auto; zstd_operation_mode operation = zom_compress; ZSTD_compressionParameters compressionParams; int cLevel = init_cLevel(); @@ -772,6 +881,7 @@ int main(int const argCount, const char* argv[]) size_t streamSrcSize = 0; size_t targetCBlockSize = 0; size_t srcSizeHint = 0; + size_t nbInputFileNames = 0; int dictCLevel = g_defaultDictCLevel; unsigned dictSelect = g_defaultSelectivityLevel; #ifndef ZSTD_NODICT @@ -782,7 +892,7 @@ int main(int const argCount, const char* argv[]) #ifndef ZSTD_NOBENCH BMK_advancedParams_t benchParams = BMK_initAdvancedParams(); #endif - ZSTD_literalCompressionMode_e literalCompressionMode = ZSTD_lcm_auto; + ZSTD_paramSwitch_e literalCompressionMode = ZSTD_ps_auto; /* init */ @@ -790,7 +900,7 @@ int main(int const argCount, const char* argv[]) (void)recursive; (void)cLevelLast; /* not used when ZSTD_NOBENCH set */ (void)memLimit; assert(argCount >= 1); - if ((filenames==NULL) || (file_of_names==NULL)) { DISPLAY("zstd: allocation error \n"); exit(1); } + if ((filenames==NULL) || (file_of_names==NULL)) { DISPLAYLEVEL(1, "zstd: allocation error \n"); exit(1); } programName = lastNameFromPath(programName); #ifdef ZSTD_MULTITHREAD nbWorkers = init_nbThreads(); @@ -799,17 +909,20 @@ int main(int const argCount, const char* argv[]) /* preset behaviors */ if (exeNameMatch(programName, ZSTD_ZSTDMT)) nbWorkers=0, singleThread=0; if (exeNameMatch(programName, ZSTD_UNZSTD)) operation=zom_decompress; - if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; outFileName=stdoutmark; g_displayLevel=1; } /* supports multiple formats */ - if (exeNameMatch(programName, ZSTD_ZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; outFileName=stdoutmark; g_displayLevel=1; } /* behave like zcat, also supports multiple formats */ - if (exeNameMatch(programName, ZSTD_GZ)) { suffix = GZ_EXTENSION; FIO_setCompressionType(prefs, FIO_gzipCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like gzip */ - if (exeNameMatch(programName, ZSTD_GUNZIP)) { operation=zom_decompress; FIO_setRemoveSrcFile(prefs, 1); } /* behave like gunzip, also supports multiple formats */ - if (exeNameMatch(programName, ZSTD_GZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; outFileName=stdoutmark; g_displayLevel=1; } /* behave like gzcat, also supports multiple formats */ - if (exeNameMatch(programName, ZSTD_LZMA)) { suffix = LZMA_EXTENSION; FIO_setCompressionType(prefs, FIO_lzmaCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like lzma */ - if (exeNameMatch(programName, ZSTD_UNLZMA)) { operation=zom_decompress; FIO_setCompressionType(prefs, FIO_lzmaCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like unlzma, also supports multiple formats */ - if (exeNameMatch(programName, ZSTD_XZ)) { suffix = XZ_EXTENSION; FIO_setCompressionType(prefs, FIO_xzCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like xz */ - if (exeNameMatch(programName, ZSTD_UNXZ)) { operation=zom_decompress; FIO_setCompressionType(prefs, FIO_xzCompression); FIO_setRemoveSrcFile(prefs, 1); } /* behave like unxz, also supports multiple formats */ - if (exeNameMatch(programName, ZSTD_LZ4)) { suffix = LZ4_EXTENSION; FIO_setCompressionType(prefs, FIO_lz4Compression); } /* behave like lz4 */ - if (exeNameMatch(programName, ZSTD_UNLZ4)) { operation=zom_decompress; FIO_setCompressionType(prefs, FIO_lz4Compression); } /* behave like unlz4, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_CAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; FIO_setPassThroughFlag(prefs, 1); outFileName=stdoutmark; g_displayLevel=1; } /* supports multiple formats */ + if (exeNameMatch(programName, ZSTD_ZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; FIO_setPassThroughFlag(prefs, 1); outFileName=stdoutmark; g_displayLevel=1; } /* behave like zcat, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */ + suffix = GZ_EXTENSION; cType = FIO_gzipCompression; removeSrcFile=1; + dictCLevel = cLevel = 6; /* gzip default is -6 */ + } + if (exeNameMatch(programName, ZSTD_GUNZIP)) { operation=zom_decompress; removeSrcFile=1; } /* behave like gunzip, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_GZCAT)) { operation=zom_decompress; FIO_overwriteMode(prefs); forceStdout=1; followLinks=1; FIO_setPassThroughFlag(prefs, 1); outFileName=stdoutmark; g_displayLevel=1; } /* behave like gzcat, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_LZMA)) { suffix = LZMA_EXTENSION; cType = FIO_lzmaCompression; removeSrcFile=1; } /* behave like lzma */ + if (exeNameMatch(programName, ZSTD_UNLZMA)) { operation=zom_decompress; cType = FIO_lzmaCompression; removeSrcFile=1; } /* behave like unlzma, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_XZ)) { suffix = XZ_EXTENSION; cType = FIO_xzCompression; removeSrcFile=1; } /* behave like xz */ + if (exeNameMatch(programName, ZSTD_UNXZ)) { operation=zom_decompress; cType = FIO_xzCompression; removeSrcFile=1; } /* behave like unxz, also supports multiple formats */ + if (exeNameMatch(programName, ZSTD_LZ4)) { suffix = LZ4_EXTENSION; cType = FIO_lz4Compression; } /* behave like lz4 */ + if (exeNameMatch(programName, ZSTD_UNLZ4)) { operation=zom_decompress; cType = FIO_lz4Compression; } /* behave like unlz4, also supports multiple formats */ memset(&compressionParams, 0, sizeof(compressionParams)); /* init crash handler */ @@ -846,43 +959,55 @@ int main(int const argCount, const char* argv[]) if (!strcmp(argument, "--help")) { usage_advanced(programName); CLEAN_RETURN(0); } if (!strcmp(argument, "--verbose")) { g_displayLevel++; continue; } if (!strcmp(argument, "--quiet")) { g_displayLevel--; continue; } - if (!strcmp(argument, "--stdout")) { forceStdout=1; outFileName=stdoutmark; g_displayLevel-=(g_displayLevel==2); continue; } + if (!strcmp(argument, "--stdout")) { forceStdout=1; outFileName=stdoutmark; removeSrcFile=0; continue; } if (!strcmp(argument, "--ultra")) { ultra=1; continue; } if (!strcmp(argument, "--check")) { FIO_setChecksumFlag(prefs, 2); continue; } if (!strcmp(argument, "--no-check")) { FIO_setChecksumFlag(prefs, 0); continue; } if (!strcmp(argument, "--sparse")) { FIO_setSparseWrite(prefs, 2); continue; } if (!strcmp(argument, "--no-sparse")) { FIO_setSparseWrite(prefs, 0); continue; } + if (!strcmp(argument, "--pass-through")) { FIO_setPassThroughFlag(prefs, 1); continue; } + if (!strcmp(argument, "--no-pass-through")) { FIO_setPassThroughFlag(prefs, 0); continue; } if (!strcmp(argument, "--test")) { operation=zom_test; continue; } + if (!strcmp(argument, "--asyncio")) { FIO_setAsyncIOFlag(prefs, 1); continue;} + if (!strcmp(argument, "--no-asyncio")) { FIO_setAsyncIOFlag(prefs, 0); continue;} if (!strcmp(argument, "--train")) { operation=zom_train; if (outFileName==NULL) outFileName=g_defaultDictName; continue; } if (!strcmp(argument, "--no-dictID")) { FIO_setDictIDFlag(prefs, 0); continue; } - if (!strcmp(argument, "--keep")) { FIO_setRemoveSrcFile(prefs, 0); continue; } - if (!strcmp(argument, "--rm")) { FIO_setRemoveSrcFile(prefs, 1); continue; } + if (!strcmp(argument, "--keep")) { removeSrcFile=0; continue; } + if (!strcmp(argument, "--rm")) { removeSrcFile=1; continue; } if (!strcmp(argument, "--priority=rt")) { setRealTimePrio = 1; continue; } if (!strcmp(argument, "--show-default-cparams")) { showDefaultCParams = 1; continue; } if (!strcmp(argument, "--content-size")) { contentSize = 1; continue; } if (!strcmp(argument, "--no-content-size")) { contentSize = 0; continue; } if (!strcmp(argument, "--adapt")) { adapt = 1; continue; } - if (!strcmp(argument, "--no-row-match-finder")) { useRowMatchFinder = 1; continue; } - if (!strcmp(argument, "--row-match-finder")) { useRowMatchFinder = 2; continue; } + if (!strcmp(argument, "--no-row-match-finder")) { useRowMatchFinder = ZSTD_ps_disable; continue; } + if (!strcmp(argument, "--row-match-finder")) { useRowMatchFinder = ZSTD_ps_enable; continue; } if (longCommandWArg(&argument, "--adapt=")) { adapt = 1; if (!parseAdaptParameters(argument, &adaptMin, &adaptMax)) { badusage(programName); CLEAN_RETURN(1); } continue; } if (!strcmp(argument, "--single-thread")) { nbWorkers = 0; singleThread = 1; continue; } - if (!strcmp(argument, "--format=zstd")) { suffix = ZSTD_EXTENSION; FIO_setCompressionType(prefs, FIO_zstdCompression); continue; } + if (!strcmp(argument, "--format=zstd")) { suffix = ZSTD_EXTENSION; cType = FIO_zstdCompression; continue; } #ifdef ZSTD_GZCOMPRESS - if (!strcmp(argument, "--format=gzip")) { suffix = GZ_EXTENSION; FIO_setCompressionType(prefs, FIO_gzipCompression); continue; } + if (!strcmp(argument, "--format=gzip")) { suffix = GZ_EXTENSION; cType = FIO_gzipCompression; continue; } + if (exeNameMatch(programName, ZSTD_GZ)) { /* behave like gzip */ + if (!strcmp(argument, "--best")) { dictCLevel = cLevel = 9; continue; } + if (!strcmp(argument, "--no-name")) { /* ignore for now */; continue; } + } #endif #ifdef ZSTD_LZMACOMPRESS - if (!strcmp(argument, "--format=lzma")) { suffix = LZMA_EXTENSION; FIO_setCompressionType(prefs, FIO_lzmaCompression); continue; } - if (!strcmp(argument, "--format=xz")) { suffix = XZ_EXTENSION; FIO_setCompressionType(prefs, FIO_xzCompression); continue; } + if (!strcmp(argument, "--format=lzma")) { suffix = LZMA_EXTENSION; cType = FIO_lzmaCompression; continue; } + if (!strcmp(argument, "--format=xz")) { suffix = XZ_EXTENSION; cType = FIO_xzCompression; continue; } #endif #ifdef ZSTD_LZ4COMPRESS - if (!strcmp(argument, "--format=lz4")) { suffix = LZ4_EXTENSION; FIO_setCompressionType(prefs, FIO_lz4Compression); continue; } + if (!strcmp(argument, "--format=lz4")) { suffix = LZ4_EXTENSION; cType = FIO_lz4Compression; continue; } #endif if (!strcmp(argument, "--rsyncable")) { rsyncable = 1; continue; } - if (!strcmp(argument, "--compress-literals")) { literalCompressionMode = ZSTD_lcm_huffman; continue; } - if (!strcmp(argument, "--no-compress-literals")) { literalCompressionMode = ZSTD_lcm_uncompressed; continue; } - if (!strcmp(argument, "--no-progress")) { FIO_setProgressSetting(FIO_ps_never); continue; } - if (!strcmp(argument, "--progress")) { FIO_setProgressSetting(FIO_ps_always); continue; } + if (!strcmp(argument, "--compress-literals")) { literalCompressionMode = ZSTD_ps_enable; continue; } + if (!strcmp(argument, "--no-compress-literals")) { literalCompressionMode = ZSTD_ps_disable; continue; } + if (!strcmp(argument, "--no-progress")) { progress = FIO_ps_never; continue; } + if (!strcmp(argument, "--progress")) { progress = FIO_ps_always; continue; } if (!strcmp(argument, "--exclude-compressed")) { FIO_setExcludeCompressedFile(prefs, 1); continue; } + if (!strcmp(argument, "--fake-stdin-is-console")) { UTIL_fakeStdinIsConsole(); continue; } + if (!strcmp(argument, "--fake-stdout-is-console")) { UTIL_fakeStdoutIsConsole(); continue; } + if (!strcmp(argument, "--fake-stderr-is-console")) { UTIL_fakeStderrIsConsole(); continue; } + if (!strcmp(argument, "--trace-file-stat")) { UTIL_traceFileStat(); continue; } /* long commands with arguments */ #ifndef ZSTD_NODICT @@ -924,16 +1049,37 @@ int main(int const argCount, const char* argv[]) if (longCommandWArg(&argument, "--memlimit")) { NEXT_UINT32(memLimit); continue; } if (longCommandWArg(&argument, "--memory")) { NEXT_UINT32(memLimit); continue; } if (longCommandWArg(&argument, "--memlimit-decompress")) { NEXT_UINT32(memLimit); continue; } - if (longCommandWArg(&argument, "--block-size=")) { blockSize = readSizeTFromChar(&argument); continue; } + if (longCommandWArg(&argument, "--block-size")) { NEXT_TSIZE(blockSize); continue; } if (longCommandWArg(&argument, "--maxdict")) { NEXT_UINT32(maxDictSize); continue; } if (longCommandWArg(&argument, "--dictID")) { NEXT_UINT32(dictID); continue; } - if (longCommandWArg(&argument, "--zstd=")) { if (!parseCompressionParameters(argument, &compressionParams)) { badusage(programName); CLEAN_RETURN(1); } continue; } - if (longCommandWArg(&argument, "--stream-size=")) { streamSrcSize = readSizeTFromChar(&argument); continue; } - if (longCommandWArg(&argument, "--target-compressed-block-size=")) { targetCBlockSize = readSizeTFromChar(&argument); continue; } - if (longCommandWArg(&argument, "--size-hint=")) { srcSizeHint = readSizeTFromChar(&argument); continue; } - if (longCommandWArg(&argument, "--output-dir-flat")) { NEXT_FIELD(outDirName); continue; } + if (longCommandWArg(&argument, "--zstd=")) { if (!parseCompressionParameters(argument, &compressionParams)) { badusage(programName); CLEAN_RETURN(1); } ; cType = FIO_zstdCompression; continue; } + if (longCommandWArg(&argument, "--stream-size")) { NEXT_TSIZE(streamSrcSize); continue; } + if (longCommandWArg(&argument, "--target-compressed-block-size")) { NEXT_TSIZE(targetCBlockSize); continue; } + if (longCommandWArg(&argument, "--size-hint")) { NEXT_TSIZE(srcSizeHint); continue; } + if (longCommandWArg(&argument, "--output-dir-flat")) { + NEXT_FIELD(outDirName); + if (strlen(outDirName) == 0) { + DISPLAYLEVEL(1, "error: output dir cannot be empty string (did you mean to pass '.' instead?)\n"); + CLEAN_RETURN(1); + } + continue; + } + if (longCommandWArg(&argument, "--auto-threads")) { + const char* threadDefault = NULL; + NEXT_FIELD(threadDefault); + if (strcmp(threadDefault, "logical") == 0) + defaultLogicalCores = 1; + continue; + } #ifdef UTIL_HAS_MIRRORFILELIST - if (longCommandWArg(&argument, "--output-dir-mirror")) { NEXT_FIELD(outMirroredDirName); continue; } + if (longCommandWArg(&argument, "--output-dir-mirror")) { + NEXT_FIELD(outMirroredDirName); + if (strlen(outMirroredDirName) == 0) { + DISPLAYLEVEL(1, "error: output dir cannot be empty string (did you mean to pass '.' instead?)\n"); + CLEAN_RETURN(1); + } + continue; + } #endif #ifndef ZSTD_NOTRACE if (longCommandWArg(&argument, "--trace")) { char const* traceFile; NEXT_FIELD(traceFile); TRACE_enable(traceFile); continue; } @@ -950,6 +1096,8 @@ int main(int const argCount, const char* argv[]) /* Invalid character following --long */ badusage(programName); CLEAN_RETURN(1); + } else { + ldmWindowLog = g_defaultMaxWindowLog; } /* Only set windowLog if not already set by --zstd */ if (compressionParams.windowLog == 0) @@ -1007,8 +1155,8 @@ int main(int const argCount, const char* argv[]) { /* Display help */ case 'V': printVersion(); CLEAN_RETURN(0); /* Version Only */ - case 'H': - case 'h': usage_advanced(programName); CLEAN_RETURN(0); + case 'H': usage_advanced(programName); CLEAN_RETURN(0); + case 'h': usage(stdout, programName); CLEAN_RETURN(0); /* Compress */ case 'z': operation=zom_compress; argument++; break; @@ -1022,7 +1170,10 @@ int main(int const argCount, const char* argv[]) operation=zom_decompress; argument++; break; /* Force stdout, even if stdout==console */ - case 'c': forceStdout=1; outFileName=stdoutmark; argument++; break; + case 'c': forceStdout=1; outFileName=stdoutmark; removeSrcFile=0; argument++; break; + + /* do not store filename - gzip compatibility - nothing to do */ + case 'n': argument++; break; /* Use file content as dictionary */ case 'D': argument++; NEXT_FIELD(dictFileName); break; @@ -1037,7 +1188,7 @@ int main(int const argCount, const char* argv[]) case 'q': g_displayLevel--; argument++; break; /* keep source file (default) */ - case 'k': FIO_setRemoveSrcFile(prefs, 0); argument++; break; + case 'k': removeSrcFile=0; argument++; break; /* Checksum */ case 'C': FIO_setChecksumFlag(prefs, 2); argument++; break; @@ -1096,7 +1247,7 @@ int main(int const argCount, const char* argv[]) /* nb of threads (hidden option) */ case 'T': argument++; - nbWorkers = (int)readU32FromChar(&argument); + nbWorkers = readU32FromChar(&argument); break; /* Dictionary Selection level */ @@ -1136,17 +1287,26 @@ int main(int const argCount, const char* argv[]) DISPLAYLEVEL(3, WELCOME_MESSAGE); #ifdef ZSTD_MULTITHREAD + if ((operation==zom_decompress) && (!singleThread) && (nbWorkers > 1)) { + DISPLAYLEVEL(2, "Warning : decompression does not support multi-threading\n"); + } if ((nbWorkers==0) && (!singleThread)) { /* automatically set # workers based on # of reported cpus */ - nbWorkers = UTIL_countPhysicalCores(); - DISPLAYLEVEL(3, "Note: %d physical core(s) detected \n", nbWorkers); + if (defaultLogicalCores) { + nbWorkers = (unsigned)UTIL_countLogicalCores(); + DISPLAYLEVEL(3, "Note: %d logical core(s) detected \n", nbWorkers); + } else { + nbWorkers = (unsigned)UTIL_countPhysicalCores(); + DISPLAYLEVEL(3, "Note: %d physical core(s) detected \n", nbWorkers); + } } #else - (void)singleThread; (void)nbWorkers; + (void)singleThread; (void)nbWorkers; (void)defaultLogicalCores; #endif -#ifdef UTIL_HAS_CREATEFILELIST g_utilDisplayLevel = g_displayLevel; + +#ifdef UTIL_HAS_CREATEFILELIST if (!followLinks) { unsigned u, fileNamesNb; unsigned const nbFilenames = (unsigned)filenames->tableSize; @@ -1177,6 +1337,8 @@ int main(int const argCount, const char* argv[]) } } + nbInputFileNames = filenames->tableSize; /* saving number of input files */ + if (recursive) { /* at this stage, filenameTable is a list of paths, which can contain both files and directories */ UTIL_expandFNT(&filenames, followLinks); } @@ -1189,7 +1351,7 @@ int main(int const argCount, const char* argv[]) int const ret = FIO_listMultipleFiles((unsigned)filenames->tableSize, filenames->fileNames, g_displayLevel); CLEAN_RETURN(ret); #else - DISPLAY("file information is not supported \n"); + DISPLAYLEVEL(1, "file information is not supported \n"); CLEAN_RETURN(1); #endif } @@ -1197,14 +1359,18 @@ int main(int const argCount, const char* argv[]) /* Check if benchmark is selected */ if (operation==zom_bench) { #ifndef ZSTD_NOBENCH + if (cType != FIO_zstdCompression) { + DISPLAYLEVEL(1, "benchmark mode is only compatible with zstd format \n"); + CLEAN_RETURN(1); + } benchParams.blockSize = blockSize; - benchParams.nbWorkers = nbWorkers; + benchParams.nbWorkers = (int)nbWorkers; benchParams.realTime = (unsigned)setRealTimePrio; benchParams.nbSeconds = bench_nbSeconds; benchParams.ldmFlag = ldmFlag; benchParams.ldmMinMatch = (int)g_ldmMinMatch; benchParams.ldmHashLog = (int)g_ldmHashLog; - benchParams.useRowMatchFinder = useRowMatchFinder; + benchParams.useRowMatchFinder = (int)useRowMatchFinder; if (g_ldmBucketSizeLog != LDM_PARAM_DEFAULT) { benchParams.ldmBucketSizeLog = (int)g_ldmBucketSizeLog; } @@ -1225,15 +1391,18 @@ int main(int const argCount, const char* argv[]) int c; DISPLAYLEVEL(3, "Benchmarking %s \n", filenames->fileNames[i]); for(c = cLevel; c <= cLevelLast; c++) { - BMK_benchFilesAdvanced(&filenames->fileNames[i], 1, dictFileName, c, &compressionParams, g_displayLevel, &benchParams); + BMK_benchOutcome_t const bo = BMK_benchFilesAdvanced(&filenames->fileNames[i], 1, dictFileName, c, &compressionParams, g_displayLevel, &benchParams); + if (!BMK_isSuccessful_benchOutcome(bo)) return 1; } } } else { for(; cLevel <= cLevelLast; cLevel++) { - BMK_benchFilesAdvanced(filenames->fileNames, (unsigned)filenames->tableSize, dictFileName, cLevel, &compressionParams, g_displayLevel, &benchParams); + BMK_benchOutcome_t const bo = BMK_benchFilesAdvanced(filenames->fileNames, (unsigned)filenames->tableSize, dictFileName, cLevel, &compressionParams, g_displayLevel, &benchParams); + if (!BMK_isSuccessful_benchOutcome(bo)) return 1; } } } else { for(; cLevel <= cLevelLast; cLevel++) { - BMK_syntheticTest(cLevel, compressibility, &compressionParams, g_displayLevel, &benchParams); + BMK_benchOutcome_t const bo = BMK_syntheticTest(cLevel, compressibility, &compressionParams, g_displayLevel, &benchParams); + if (!BMK_isSuccessful_benchOutcome(bo)) return 1; } } #else @@ -1253,18 +1422,18 @@ int main(int const argCount, const char* argv[]) int const optimize = !coverParams.k || !coverParams.d; coverParams.nbThreads = (unsigned)nbWorkers; coverParams.zParams = zParams; - operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (unsigned)filenames->tableSize, blockSize, NULL, &coverParams, NULL, optimize); + operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (int)filenames->tableSize, blockSize, NULL, &coverParams, NULL, optimize, memLimit); } else if (dict == fastCover) { int const optimize = !fastCoverParams.k || !fastCoverParams.d; fastCoverParams.nbThreads = (unsigned)nbWorkers; fastCoverParams.zParams = zParams; - operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (unsigned)filenames->tableSize, blockSize, NULL, NULL, &fastCoverParams, optimize); + operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (int)filenames->tableSize, blockSize, NULL, NULL, &fastCoverParams, optimize, memLimit); } else { ZDICT_legacy_params_t dictParams; memset(&dictParams, 0, sizeof(dictParams)); dictParams.selectivityLevel = dictSelect; dictParams.zParams = zParams; - operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (unsigned)filenames->tableSize, blockSize, &dictParams, NULL, NULL, 0); + operationResult = DiB_trainFromFiles(outFileName, maxDictSize, filenames->fileNames, (int)filenames->tableSize, blockSize, &dictParams, NULL, NULL, 0, memLimit); } #else (void)dictCLevel; (void)dictSelect; (void)dictID; (void)maxDictSize; /* not used when ZSTD_NODICT set */ @@ -1275,24 +1444,34 @@ int main(int const argCount, const char* argv[]) } #ifndef ZSTD_NODECOMPRESS - if (operation==zom_test) { FIO_setTestMode(prefs, 1); outFileName=nulmark; FIO_setRemoveSrcFile(prefs, 0); } /* test mode */ + if (operation==zom_test) { FIO_setTestMode(prefs, 1); outFileName=nulmark; removeSrcFile=0; } /* test mode */ #endif /* No input filename ==> use stdin and stdout */ - if (filenames->tableSize == 0) UTIL_refFilename(filenames, stdinmark); - if (!strcmp(filenames->fileNames[0], stdinmark) && !outFileName) + if (filenames->tableSize == 0) { + /* It is possible that the input + was a number of empty directories. In this case + stdin and stdout should not be used */ + if (nbInputFileNames > 0 ){ + DISPLAYLEVEL(1, "please provide correct input file(s) or non-empty directories -- ignored \n"); + CLEAN_RETURN(0); + } + UTIL_refFilename(filenames, stdinmark); + } + + if (filenames->tableSize == 1 && !strcmp(filenames->fileNames[0], stdinmark) && !outFileName) outFileName = stdoutmark; /* when input is stdin, default output is stdout */ /* Check if input/output defined as console; trigger an error in this case */ if (!forceStdin - && !strcmp(filenames->fileNames[0], stdinmark) - && IS_CONSOLE(stdin) ) { + && (UTIL_searchFileNamesTable(filenames, stdinmark) != -1) + && UTIL_isConsole(stdin) ) { DISPLAYLEVEL(1, "stdin is a console, aborting\n"); CLEAN_RETURN(1); } - if ( outFileName && !strcmp(outFileName, stdoutmark) - && IS_CONSOLE(stdout) - && !strcmp(filenames->fileNames[0], stdinmark) + if ( (!outFileName || !strcmp(outFileName, stdoutmark)) + && UTIL_isConsole(stdout) + && (UTIL_searchFileNamesTable(filenames, stdinmark) != -1) && !forceStdout && operation!=zom_decompress ) { DISPLAYLEVEL(1, "stdout is a console, aborting\n"); @@ -1310,26 +1489,36 @@ int main(int const argCount, const char* argv[]) if (showDefaultCParams) { if (operation == zom_decompress) { - DISPLAY("error : can't use --show-default-cparams in decomrpession mode \n"); + DISPLAYLEVEL(1, "error : can't use --show-default-cparams in decompression mode \n"); CLEAN_RETURN(1); } } if (dictFileName != NULL && patchFromDictFileName != NULL) { - DISPLAY("error : can't use -D and --patch-from=# at the same time \n"); + DISPLAYLEVEL(1, "error : can't use -D and --patch-from=# at the same time \n"); CLEAN_RETURN(1); } if (patchFromDictFileName != NULL && filenames->tableSize > 1) { - DISPLAY("error : can't use --patch-from=# on multiple files \n"); + DISPLAYLEVEL(1, "error : can't use --patch-from=# on multiple files \n"); CLEAN_RETURN(1); } - /* No status message in pipe mode (stdin - stdout) */ + /* No status message by default when output is stdout */ hasStdout = outFileName && !strcmp(outFileName,stdoutmark); - if (hasStdout && (g_displayLevel==2)) g_displayLevel=1; + /* when stderr is not the console, do not pollute it with progress updates (unless requested) */ + if (!UTIL_isConsole(stderr) && (progress!=FIO_ps_always)) progress=FIO_ps_never; + FIO_setProgressSetting(progress); + + /* don't remove source files when output is stdout */; + if (hasStdout && removeSrcFile) { + DISPLAYLEVEL(3, "Note: src files are not removed when output is stdout \n"); + removeSrcFile = 0; + } + FIO_setRemoveSrcFile(prefs, removeSrcFile); + /* IO Stream/File */ FIO_setHasStdoutOutput(fCtx, hasStdout); FIO_setNbFilesTotal(fCtx, (int)filenames->tableSize); @@ -1348,8 +1537,9 @@ int main(int const argCount, const char* argv[]) FIO_setMemLimit(prefs, memLimit); if (operation==zom_compress) { #ifndef ZSTD_NOCOMPRESS + FIO_setCompressionType(prefs, cType); FIO_setContentSize(prefs, contentSize); - FIO_setNbWorkers(prefs, nbWorkers); + FIO_setNbWorkers(prefs, (int)nbWorkers); FIO_setBlockSize(prefs, (int)blockSize); if (g_overlapLog!=OVERLAP_LOG_DEFAULT) FIO_setOverlapLog(prefs, (int)g_overlapLog); FIO_setLdmFlag(prefs, (unsigned)ldmFlag); @@ -1357,8 +1547,8 @@ int main(int const argCount, const char* argv[]) FIO_setLdmMinMatch(prefs, (int)g_ldmMinMatch); if (g_ldmBucketSizeLog != LDM_PARAM_DEFAULT) FIO_setLdmBucketSizeLog(prefs, (int)g_ldmBucketSizeLog); if (g_ldmHashRateLog != LDM_PARAM_DEFAULT) FIO_setLdmHashRateLog(prefs, (int)g_ldmHashRateLog); - FIO_setAdaptiveMode(prefs, (unsigned)adapt); - FIO_setUseRowMatchFinder(prefs, useRowMatchFinder); + FIO_setAdaptiveMode(prefs, adapt); + FIO_setUseRowMatchFinder(prefs, (int)useRowMatchFinder); FIO_setAdaptMin(prefs, adaptMin); FIO_setAdaptMax(prefs, adaptMax); FIO_setRsyncable(prefs, rsyncable); @@ -1366,6 +1556,7 @@ int main(int const argCount, const char* argv[]) FIO_setTargetCBlockSize(prefs, targetCBlockSize); FIO_setSrcSizeHint(prefs, srcSizeHint); FIO_setLiteralCompressionMode(prefs, literalCompressionMode); + FIO_setSparseWrite(prefs, 0); if (adaptMin > cLevel) cLevel = adaptMin; if (adaptMax < cLevel) cLevel = adaptMax; @@ -1374,32 +1565,29 @@ int main(int const argCount, const char* argv[]) assert(ZSTD_NB_STRATEGIES == strategyBounds.upperBound); (void)strategyBounds; } - if (showDefaultCParams) { + if (showDefaultCParams || g_displayLevel >= 4) { size_t fileNb; for (fileNb = 0; fileNb < (size_t)filenames->tableSize; fileNb++) { - unsigned long long fileSize = UTIL_getFileSize(filenames->fileNames[fileNb]); - const size_t dictSize = dictFileName != NULL ? (size_t)UTIL_getFileSize(dictFileName) : 0; - const ZSTD_compressionParameters cParams = ZSTD_getCParams(cLevel, fileSize, dictSize); - if (fileSize != UTIL_FILESIZE_UNKNOWN) DISPLAY("%s (%u bytes)\n", filenames->fileNames[fileNb], (unsigned)fileSize); - else DISPLAY("%s (src size unknown)\n", filenames->fileNames[fileNb]); - DISPLAY(" - windowLog : %u\n", cParams.windowLog); - DISPLAY(" - chainLog : %u\n", cParams.chainLog); - DISPLAY(" - hashLog : %u\n", cParams.hashLog); - DISPLAY(" - searchLog : %u\n", cParams.searchLog); - DISPLAY(" - minMatch : %u\n", cParams.minMatch); - DISPLAY(" - targetLength : %u\n", cParams.targetLength); - assert(cParams.strategy < ZSTD_NB_STRATEGIES + 1); - DISPLAY(" - strategy : %s (%u)\n", ZSTD_strategyMap[(int)cParams.strategy], (unsigned)cParams.strategy); + if (showDefaultCParams) + printDefaultCParams(filenames->fileNames[fileNb], dictFileName, cLevel); + if (g_displayLevel >= 4) + printActualCParams(filenames->fileNames[fileNb], dictFileName, cLevel, &compressionParams); } } + if (g_displayLevel >= 4) + FIO_displayCompressionParameters(prefs); if ((filenames->tableSize==1) && outFileName) operationResult = FIO_compressFilename(fCtx, prefs, outFileName, filenames->fileNames[0], dictFileName, cLevel, compressionParams); else operationResult = FIO_compressMultipleFilenames(fCtx, prefs, filenames->fileNames, outMirroredDirName, outDirName, outFileName, suffix, dictFileName, cLevel, compressionParams); #else - (void)contentSize; (void)suffix; (void)adapt; (void)rsyncable; (void)ultra; (void)cLevel; (void)ldmFlag; (void)literalCompressionMode; (void)targetCBlockSize; (void)streamSrcSize; (void)srcSizeHint; (void)ZSTD_strategyMap; (void)useRowMatchFinder; /* not used when ZSTD_NOCOMPRESS set */ - DISPLAY("Compression not supported \n"); + /* these variables are only used when compression mode is enabled */ + (void)contentSize; (void)suffix; (void)adapt; (void)rsyncable; + (void)ultra; (void)cLevel; (void)ldmFlag; (void)literalCompressionMode; + (void)targetCBlockSize; (void)streamSrcSize; (void)srcSizeHint; + (void)ZSTD_strategyMap; (void)useRowMatchFinder; (void)cType; + DISPLAYLEVEL(1, "Compression not supported \n"); #endif } else { /* decompression or test */ #ifndef ZSTD_NODECOMPRESS @@ -1409,7 +1597,7 @@ int main(int const argCount, const char* argv[]) operationResult = FIO_decompressMultipleFilenames(fCtx, prefs, filenames->fileNames, outMirroredDirName, outDirName, outFileName, dictFileName); } #else - DISPLAY("Decompression not supported \n"); + DISPLAYLEVEL(1, "Decompression not supported \n"); #endif } diff --git a/src/dependencies/zstd-1.5.0/programs/zstdcli_trace.c b/src/dependencies/zstd-1.5.4/programs/zstdcli_trace.c similarity index 98% rename from src/dependencies/zstd-1.5.0/programs/zstdcli_trace.c rename to src/dependencies/zstd-1.5.4/programs/zstdcli_trace.c index b3b977f..35075a5 100644 --- a/src/dependencies/zstd-1.5.0/programs/zstdcli_trace.c +++ b/src/dependencies/zstd-1.5.4/programs/zstdcli_trace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/programs/zstdcli_trace.h b/src/dependencies/zstd-1.5.4/programs/zstdcli_trace.h similarity index 91% rename from src/dependencies/zstd-1.5.0/programs/zstdcli_trace.h rename to src/dependencies/zstd-1.5.4/programs/zstdcli_trace.h index 38c27dc..9c135d3 100644 --- a/src/dependencies/zstd-1.5.0/programs/zstdcli_trace.h +++ b/src/dependencies/zstd-1.5.4/programs/zstdcli_trace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/programs/zstdgrep b/src/dependencies/zstd-1.5.4/programs/zstdgrep similarity index 100% rename from src/dependencies/zstd-1.5.0/programs/zstdgrep rename to src/dependencies/zstd-1.5.4/programs/zstdgrep diff --git a/src/dependencies/zstd-1.5.4/programs/zstdgrep.1 b/src/dependencies/zstd-1.5.4/programs/zstdgrep.1 new file mode 100644 index 0000000..77d29b4 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/zstdgrep.1 @@ -0,0 +1,17 @@ +.TH "ZSTDGREP" "1" "February 2023" "zstd 1.5.4" "User Commands" +.SH "NAME" +\fBzstdgrep\fR \- print lines matching a pattern in zstandard\-compressed files +.SH "SYNOPSIS" +\fBzstdgrep\fR [\fIgrep\-flags\fR] [\-\-] \fIpattern\fR [\fIfiles\fR \|\.\|\.\|\.] +.SH "DESCRIPTION" +\fBzstdgrep\fR runs \fBgrep\fR(1) on files, or \fBstdin\fR if no files argument is given, after decompressing them with \fBzstdcat\fR(1)\. +.P +The \fIgrep\-flags\fR and \fIpattern\fR arguments are passed on to \fBgrep\fR(1)\. If an \fB\-e\fR flag is found in the \fIgrep\-flags\fR, \fBzstdgrep\fR will not look for a \fIpattern\fR argument\. +.P +Note that modern \fBgrep\fR alternatives such as \fBripgrep\fR (\fBrg\fR(1)) support \fBzstd\fR\-compressed files out of the box, and can prove better alternatives than \fBzstdgrep\fR notably for unsupported complex pattern searches\. Note though that such alternatives may also feature some minor command line differences\. +.SH "EXIT STATUS" +In case of missing arguments or missing pattern, 1 will be returned, otherwise 0\. +.SH "SEE ALSO" +\fBzstd\fR(1) +.SH "AUTHORS" +Thomas Klausner \fIwiz@NetBSD\.org\fR diff --git a/src/dependencies/zstd-1.5.4/programs/zstdgrep.1.md b/src/dependencies/zstd-1.5.4/programs/zstdgrep.1.md new file mode 100644 index 0000000..6370a81 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/zstdgrep.1.md @@ -0,0 +1,30 @@ +zstdgrep(1) -- print lines matching a pattern in zstandard-compressed files +============================================================================ + +SYNOPSIS +-------- + +`zstdgrep` [] [--] [ ...] + + +DESCRIPTION +----------- +`zstdgrep` runs `grep`(1) on files, or `stdin` if no files argument is given, after decompressing them with `zstdcat`(1). + +The and arguments are passed on to `grep`(1). If an `-e` flag is found in the , `zstdgrep` will not look for a argument. + +Note that modern `grep` alternatives such as `ripgrep` (`rg`(1)) support `zstd`-compressed files out of the box, +and can prove better alternatives than `zstdgrep` notably for unsupported complex pattern searches. +Note though that such alternatives may also feature some minor command line differences. + +EXIT STATUS +----------- +In case of missing arguments or missing pattern, 1 will be returned, otherwise 0. + +SEE ALSO +-------- +`zstd`(1) + +AUTHORS +------- +Thomas Klausner diff --git a/src/dependencies/zstd-1.5.4/programs/zstdless b/src/dependencies/zstd-1.5.4/programs/zstdless new file mode 100755 index 0000000..17726a4 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/zstdless @@ -0,0 +1,8 @@ +#!/bin/sh + +zstd=${ZSTD:-zstd} + +# TODO: Address quirks and bugs tied to old versions of less, provide a mechanism to pass flags directly to zstd + +export LESSOPEN="|-${zstd} -cdfq %s" +exec less "$@" diff --git a/src/dependencies/zstd-1.5.4/programs/zstdless.1 b/src/dependencies/zstd-1.5.4/programs/zstdless.1 new file mode 100644 index 0000000..6c82b9c --- /dev/null +++ b/src/dependencies/zstd-1.5.4/programs/zstdless.1 @@ -0,0 +1,9 @@ +.TH "ZSTDLESS" "1" "February 2023" "zstd 1.5.4" "User Commands" +.SH "NAME" +\fBzstdless\fR \- view zstandard\-compressed files +.SH "SYNOPSIS" +\fBzstdless\fR [\fIflags\fR] [\fIfile\fR \|\.\|\.\|\.] +.SH "DESCRIPTION" +\fBzstdless\fR runs \fBless\fR(1) on files or stdin, if no \fIfile\fR argument is given, after decompressing them with \fBzstdcat\fR(1)\. +.SH "SEE ALSO" +\fBzstd\fR(1) diff --git a/src/dependencies/zstd-1.5.0/programs/zstdless.1.md b/src/dependencies/zstd-1.5.4/programs/zstdless.1.md similarity index 53% rename from src/dependencies/zstd-1.5.0/programs/zstdless.1.md rename to src/dependencies/zstd-1.5.4/programs/zstdless.1.md index d91d48a..67c1c76 100644 --- a/src/dependencies/zstd-1.5.0/programs/zstdless.1.md +++ b/src/dependencies/zstd-1.5.4/programs/zstdless.1.md @@ -4,13 +4,13 @@ zstdless(1) -- view zstandard-compressed files SYNOPSIS -------- -`zstdless` [*flags*] [_file_ ...] +`zstdless` [] [ ...] DESCRIPTION ----------- -`zstdless` runs `less (1)` on files or stdin, if no files argument is given, after decompressing them with `zstdcat (1)`. +`zstdless` runs `less`(1) on files or stdin, if no argument is given, after decompressing them with `zstdcat`(1). SEE ALSO -------- -`zstd (1)` +`zstd`(1) diff --git a/src/dependencies/zstd-1.5.0/tests/.gitignore b/src/dependencies/zstd-1.5.4/tests/.gitignore similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/.gitignore rename to src/dependencies/zstd-1.5.4/tests/.gitignore index 9a6939a..fcb865d 100644 --- a/src/dependencies/zstd-1.5.0/tests/.gitignore +++ b/src/dependencies/zstd-1.5.4/tests/.gitignore @@ -12,6 +12,7 @@ zstreamtest zstreamtest32 zstreamtest_asan zstreamtest_tsan +zstreamtest_ubsan zstreamtest-dll datagen paramgrill diff --git a/src/dependencies/zstd-1.5.0/tests/DEPRECATED-test-zstd-speed.py b/src/dependencies/zstd-1.5.4/tests/DEPRECATED-test-zstd-speed.py similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/DEPRECATED-test-zstd-speed.py rename to src/dependencies/zstd-1.5.4/tests/DEPRECATED-test-zstd-speed.py index 665e0a7..71d75b8 100755 --- a/src/dependencies/zstd-1.5.0/tests/DEPRECATED-test-zstd-speed.py +++ b/src/dependencies/zstd-1.5.4/tests/DEPRECATED-test-zstd-speed.py @@ -2,7 +2,7 @@ # THIS BENCHMARK IS BEING REPLACED BY automated-bencmarking.py # ################################################################ -# Copyright (c) Przemyslaw Skibinski, Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/Makefile b/src/dependencies/zstd-1.5.4/tests/Makefile similarity index 80% rename from src/dependencies/zstd-1.5.0/tests/Makefile rename to src/dependencies/zstd-1.5.4/tests/Makefile index 8555300..3eed19e 100644 --- a/src/dependencies/zstd-1.5.0/tests/Makefile +++ b/src/dependencies/zstd-1.5.4/tests/Makefile @@ -1,5 +1,6 @@ + # ################################################################ -# Copyright (c) Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -19,46 +20,43 @@ # zstreamtest32: Same as zstreamtest, but forced to compile in 32-bits mode # ########################################################################## -ZSTDDIR = ../lib +LIBZSTD = ../lib + +ZSTD_LEGACY_SUPPORT ?= 0 + +DEBUGLEVEL ?= 2 +export DEBUGLEVEL # transmit value to sub-makefiles + +include $(LIBZSTD)/libzstd.mk + +ZSTDDIR = $(LIBZSTD) PRGDIR = ../programs PYTHON ?= python3 TESTARTEFACT := versionsTest -DEBUGLEVEL ?= 2 -export DEBUGLEVEL # transmit value to sub-makefiles -DEBUGFLAGS = -g -DDEBUGLEVEL=$(DEBUGLEVEL) +DEBUGFLAGS += -g -Wno-c++-compat CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) \ - -DZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY=1 -ifeq ($(OS),Windows_NT) # MinGW assumed -CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting -endif -CFLAGS ?= -O3 -CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls -Wmissing-prototypes -Wno-deprecated-declarations -CFLAGS += $(DEBUGFLAGS) -CPPFLAGS += $(MOREFLAGS) + -DZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY=1 - -ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c -ZSTDCOMP_FILES := $(ZSTDDIR)/compress/*.c -ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/*.c +ZSTDCOMMON_FILES := $(sort $(ZSTD_COMMON_FILES)) +ZSTDCOMP_FILES := $(sort $(ZSTD_COMPRESS_FILES)) +ZSTDDECOMP_FILES := $(sort $(ZSTD_DECOMPRESS_FILES)) ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) -ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c +ZDICT_FILES := $(sort $(ZSTD_DICTBUILDER_FILES)) -ZSTD_F1 := $(wildcard $(ZSTD_FILES)) +ZSTD_F1 := $(sort $(wildcard $(ZSTD_FILES))) ZSTD_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdm_,$(ZSTD_F1)) ZSTD_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdc_,$(ZSTD_OBJ1)) ZSTD_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdd_,$(ZSTD_OBJ2)) -ZSTD_OBJECTS := $(ZSTD_OBJ3:.c=.o) +ZSTD_OBJ4 := $(ZSTD_OBJ3:.c=.o) +ZSTD_OBJECTS := $(ZSTD_OBJ4:.S=.o) ZSTDMT_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdmt_m_,$(ZSTD_F1)) ZSTDMT_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdmt_c_,$(ZSTDMT_OBJ1)) ZSTDMT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2)) -ZSTDMT_OBJECTS := $(ZSTDMT_OBJ3:.c=.o) +ZSTDMT_OBJ4 := $(ZSTDMT_OBJ3:.c=.o) +ZSTDMT_OBJECTS := $(ZSTDMT_OBJ4:.S=.o) # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) @@ -119,6 +117,9 @@ zstdc_%.o : $(ZSTDDIR)/compress/%.c zstdd_%.o : $(ZSTDDIR)/decompress/%.c $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ +zstdd_%.o : $(ZSTDDIR)/decompress/%.S + $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ + zstdmt%.o : CPPFLAGS += $(MULTITHREAD_CPP) zstdmt_m_%.o : $(ZSTDDIR)/common/%.c @@ -130,14 +131,20 @@ zstdmt_c_%.o : $(ZSTDDIR)/compress/%.c zstdmt_d_%.o : $(ZSTDDIR)/decompress/%.c $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ +zstdmt_d_%.o : $(ZSTDDIR)/decompress/%.S + $(CC) -c $(CPPFLAGS) $(ASFLAGS) $< -o $@ + +FULLBENCHS := fullbench fullbench32 +CLEAN += $(FULLBENCHS) fullbench32: CPPFLAGS += -m32 -fullbench fullbench32 : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations -fullbench fullbench32 : LDFLAGS += $(MULTITHREAD_LD) -fullbench fullbench32 : DEBUGFLAGS = -DNDEBUG # turn off assert() for speed measurements -fullbench fullbench32 : $(ZSTD_FILES) -fullbench fullbench32 : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c +$(FULLBENCHS) : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations +$(FULLBENCHS) : LDFLAGS += $(MULTITHREAD_LD) +$(FULLBENCHS) : DEBUGFLAGS = -DNDEBUG # turn off assert() for speed measurements +$(FULLBENCHS) : $(ZSTD_FILES) +$(FULLBENCHS) : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c fullbench.c $(LINK.c) $^ -o $@$(EXT) +CLEAN += fullbench-lib fullbench-lib : CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ fullbench-lib : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(ZSTDDIR)/libzstd.a fullbench.c $(LINK.c) $^ -o $@$(EXT) @@ -147,6 +154,7 @@ fullbench-dll: $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/benchfn.c $(PRGDIR # $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(ZSTDDIR)/dll/libzstd.dll $(LINK.c) $^ $(LDLIBS) -o $@$(EXT) +CLEAN += fuzzer fuzzer32 fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations fuzzer : LDFLAGS += $(MULTITHREAD_LD) fuzzer : $(ZSTDMT_OBJECTS) @@ -160,7 +168,8 @@ fuzzer32 : $(ZSTD_FILES) fuzzer-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c fuzzer.c $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT) -ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c +CLEAN += zstreamtest zstreamtest32 +ZSTREAM_LOCAL_FILES := $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c seqgen.c zstreamtest.c external_matchfinder.c ZSTREAM_PROPER_FILES := $(ZDICT_FILES) $(ZSTREAM_LOCAL_FILES) ZSTREAMFILES := $(ZSTD_FILES) $(ZSTREAM_PROPER_FILES) zstreamtest32 : CFLAGS += -m32 @@ -171,42 +180,58 @@ zstreamtest32 : $(ZSTREAMFILES) zstreamtest zstreamtest32 : $(LINK.c) $^ -o $@$(EXT) +CLEAN += zstreamtest_asan zstreamtest_asan : CFLAGS += -fsanitize=address zstreamtest_asan : $(ZSTREAMFILES) $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) +CLEAN += zstreamtest_tsan zstreamtest_tsan : CFLAGS += -fsanitize=thread zstreamtest_tsan : $(ZSTREAMFILES) $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) +CLEAN += zstreamtest_ubsan +zstreamtest_ubsan : CFLAGS += -fsanitize=undefined +zstreamtest_ubsan : $(ZSTREAMFILES) + $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) + # note : broken : requires symbols unavailable from dynamic library zstreamtest-dll : $(ZSTDDIR)/common/xxhash.c # xxh symbols not exposed from dll zstreamtest-dll : $(ZSTREAM_LOCAL_FILES) $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT) +CLEAN += paramgrill paramgrill : DEBUGFLAGS = # turn off debug for speed measurements paramgrill : LDLIBS += -lm paramgrill : $(ZSTD_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/benchfn.c $(PRGDIR)/benchzstd.c $(PRGDIR)/datagen.c paramgrill.c +CLEAN += datagen datagen : $(PRGDIR)/datagen.c datagencli.c $(LINK.c) $^ -o $@$(EXT) +CLEAN += roundTripCrash roundTripCrash: CFLAGS += $(MULTITHREAD) roundTripCrash : $(ZSTD_OBJECTS) roundTripCrash.c +CLEAN += longmatch longmatch : $(ZSTD_OBJECTS) longmatch.c +CLEAN += bigdict bigdict: CFLAGS += $(MULTITHREAD) bigdict: $(ZSTDMT_OBJECTS) $(PRGDIR)/datagen.c bigdict.c +CLEAN += invalidDictionaries invalidDictionaries : $(ZSTD_OBJECTS) invalidDictionaries.c -legacy : CPPFLAGS += -I$(ZSTDDIR)/legacy -DZSTD_LEGACY_SUPPORT=4 -legacy : $(ZSTD_FILES) $(wildcard $(ZSTDDIR)/legacy/*.c) legacy.c +CLEAN += legacy +legacy : CPPFLAGS += -I$(ZSTDDIR)/legacy -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=4 +legacy : $(ZSTD_FILES) $(sort $(wildcard $(ZSTDDIR)/legacy/*.c)) legacy.c +CLEAN += decodecorpus decodecorpus : LDLIBS += -lm decodecorpus : $(filter-out zstdc_zstd_compress.o, $(ZSTD_OBJECTS)) $(ZDICT_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c decodecorpus.c +CLEAN += poolTests poolTests : $(PRGDIR)/util.c $(PRGDIR)/timefn.c poolTests.c $(ZSTDDIR)/common/pool.c $(ZSTDDIR)/common/threading.c $(ZSTDDIR)/common/zstd_common.c $(ZSTDDIR)/common/error_private.c $(LINK.c) $(MULTITHREAD) $^ -o $@$(EXT) @@ -218,7 +243,8 @@ versionsTest: clean automated_benchmarking: clean $(PYTHON) automated_benchmarking.py -# make checkTag +# make checkTag : check that release tag corresponds to release version +CLEAN += checkTag checkTag.o : $(ZSTDDIR)/zstd.h .PHONY: clean @@ -227,28 +253,22 @@ clean: $(MAKE) -C $(PRGDIR) clean $(RM) -fR $(TESTARTEFACT) $(RM) -rf tmp* # some test directories are named tmp* - $(RM) core *.o *.tmp result* *.gcda dictionary *.zst \ + $(RM) $(CLEAN) core *.o *.tmp result* *.gcda dictionary *.zst \ $(PRGDIR)/zstd$(EXT) $(PRGDIR)/zstd32$(EXT) \ - fullbench$(EXT) fullbench32$(EXT) \ - fullbench-lib$(EXT) fullbench-dll$(EXT) \ - fuzzer$(EXT) fuzzer32$(EXT) \ - fuzzer-dll$(EXT) zstreamtest-dll$(EXT) \ - zstreamtest$(EXT) zstreamtest32$(EXT) \ - datagen$(EXT) paramgrill$(EXT) roundTripCrash$(EXT) longmatch$(EXT) \ - symbols$(EXT) invalidDictionaries$(EXT) legacy$(EXT) poolTests$(EXT) \ - decodecorpus$(EXT) checkTag$(EXT) bigdict$(EXT) + fullbench-dll$(EXT) fuzzer-dll$(EXT) zstreamtest-dll$(EXT) @echo Cleaning completed #---------------------------------------------------------------------------------- -# valgrind tests are validated only for some posix platforms +# valgrind tests validated only for some posix platforms #---------------------------------------------------------------------------------- UNAME := $(shell uname) -ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS)) +ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX)) HOST_OS = POSIX -valgrindTest: VALGRIND = valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 -valgrindTest: zstd datagen fuzzer fullbench +.PHONY: test-valgrind +test-valgrind: VALGRIND = valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 +test-valgrind: zstd datagen fuzzer fullbench @echo "\n ---- valgrind tests : memory analyzer ----" $(VALGRIND) ./datagen -g50M > $(VOID) $(VALGRIND) $(PRGDIR)/zstd ; if [ $$? -eq 0 ] ; then echo "zstd without argument should have failed"; false; fi @@ -257,13 +277,12 @@ valgrindTest: zstd datagen fuzzer fullbench ./datagen -g2930KB | $(VALGRIND) $(PRGDIR)/zstd -5 -vf - -o tmp $(VALGRIND) $(PRGDIR)/zstd -vdf tmp -c > $(VOID) ./datagen -g64MB | $(VALGRIND) $(PRGDIR)/zstd -vf - -c > $(VOID) - @rm tmp + $(RM) tmp $(VALGRIND) ./fuzzer -T1mn -t1 $(VALGRIND) ./fullbench -i1 endif - ifneq (,$(filter MINGW% MSYS%,$(UNAME))) HOST_OS = MSYS endif @@ -294,7 +313,7 @@ check: shortest fuzztest: test-fuzzer test-zstream test-decodecorpus .PHONY: test -test: test-zstd test-fullbench test-fuzzer test-zstream test-invalidDictionaries test-legacy test-decodecorpus +test: test-zstd test-fullbench test-fuzzer test-zstream test-invalidDictionaries test-legacy test-decodecorpus test-cli-tests ifeq ($(QEMU_SYS),) test: test-pool endif @@ -303,9 +322,9 @@ endif test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32 .PHONY: test-all -test-all: test test32 valgrindTest test-decodecorpus-cli +test-all: test test32 test-decodecorpus-cli -.PHONY: test-zstd test-zstd32 test-zstd-nolegacy test-zstdgrep +.PHONY: test-zstd test-zstd32 test-zstd-nolegacy test-zstd: ZSTD = $(PRGDIR)/zstd test-zstd: zstd @@ -319,29 +338,42 @@ test-zstd test-zstd32 test-zstd-nolegacy: datagen file $(ZSTD) EXE_PREFIX="$(QEMU_SYS)" ZSTD_BIN="$(ZSTD)" DATAGEN_BIN=./datagen ./playTests.sh $(ZSTDRTTEST) +.PHONY: test-cli-tests +test-cli-tests: ZSTD = $(PRGDIR)/zstd +test-cli-tests: zstd datagen + file $(ZSTD) + ./cli-tests/run.py --exec-prefix="$(QEMU_SYS)" --zstd="$(ZSTD)" --datagen=./datagen + +.PHONY: test-fullbench test-fullbench: fullbench datagen $(QEMU_SYS) ./fullbench -i1 $(QEMU_SYS) ./fullbench -i1 -P0 +.PHONY: test-fullbench32 test-fullbench32: fullbench32 datagen $(QEMU_SYS) ./fullbench32 -i1 $(QEMU_SYS) ./fullbench32 -i1 -P0 +.PHONY: test-fuzzer test-fuzzer: fuzzer $(QEMU_SYS) ./fuzzer -v $(FUZZERTEST) $(FUZZER_FLAGS) +# Note : this test presumes `fuzzer` will be built +.PHONY: test-fuzzer-stackmode test-fuzzer-stackmode: MOREFLAGS += -DZSTD_HEAPMODE=0 test-fuzzer-stackmode: test-fuzzer +.PHONY: test-fuzzer32 test-fuzzer32: fuzzer32 $(QEMU_SYS) ./fuzzer32 -v $(FUZZERTEST) $(FUZZER_FLAGS) +.PHONY: test-zstream test-zstream: zstreamtest $(QEMU_SYS) ./zstreamtest -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) $(QEMU_SYS) ./zstreamtest --newapi -t1 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) test-zstream32: zstreamtest32 - $(QEMU_SYS) ./zstreamtest32 $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) + $(QEMU_SYS) ./zstreamtest32 -v $(ZSTREAM_TESTTIME) $(FUZZER_FLAGS) test-longmatch: longmatch $(QEMU_SYS) ./longmatch diff --git a/src/dependencies/zstd-1.5.0/tests/README.md b/src/dependencies/zstd-1.5.4/tests/README.md similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/README.md rename to src/dependencies/zstd-1.5.4/tests/README.md index cd255e9..2cf0e76 100644 --- a/src/dependencies/zstd-1.5.0/tests/README.md +++ b/src/dependencies/zstd-1.5.4/tests/README.md @@ -45,7 +45,7 @@ optional arguments: -h, --help show this help message and exit --directory DIRECTORY directory with files to benchmark - --levels LEVELS levels to test eg ('1,2,3') + --levels LEVELS levels to test e.g. ('1,2,3') --iterations ITERATIONS number of benchmark iterations to run --emails EMAILS email addresses of people who will be alerted upon @@ -56,7 +56,7 @@ optional arguments: --mode MODE 'fastmode', 'onetime', 'current', or 'continuous' (see README.md for details) --dict DICT filename of dictionary to use (when set, this - dictioanry will be used to compress the files provided + dictionary will be used to compress the files provided inside --directory) ``` @@ -70,7 +70,7 @@ After `sleepTime` (an optional parameter, default 300 seconds) seconds the scrip If a new commit is found it is compiled and a speed benchmark for this commit is performed. The results of the speed benchmark are compared to the previous results. If compression or decompression speed for one of zstd levels is lower than `lowerLimit` (an optional parameter, default 0.98) the speed benchmark is restarted. -If second results are also lower than `lowerLimit` the warning e-mail is send to recipients from the list (the `emails` parameter). +If second results are also lower than `lowerLimit` the warning e-mail is sent to recipients from the list (the `emails` parameter). Additional remarks: - To be sure that speed results are accurate the script should be run on a "stable" target system with no other jobs running in parallel @@ -168,7 +168,7 @@ Full list of arguments can use all --zstd parameter names and 'cParams' as a shorthand for all parameters used in ZSTD_compressionParameters (Default: display all params available) -P# : generated sample compressibility (when no file is provided) - -t# : Caps runtime of operation in seconds (default : 99999 seconds (about 27 hours )) + -t# : Caps runtime of operation in seconds (default: 99999 seconds (about 27 hours)) -v : Prints Benchmarking output -D : Next argument dictionary file -s : Benchmark all files separately diff --git a/src/dependencies/zstd-1.5.0/tests/automated_benchmarking.py b/src/dependencies/zstd-1.5.4/tests/automated_benchmarking.py similarity index 95% rename from src/dependencies/zstd-1.5.0/tests/automated_benchmarking.py rename to src/dependencies/zstd-1.5.4/tests/automated_benchmarking.py index 458bda4..153e7db 100644 --- a/src/dependencies/zstd-1.5.0/tests/automated_benchmarking.py +++ b/src/dependencies/zstd-1.5.4/tests/automated_benchmarking.py @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -87,7 +87,7 @@ def clone_and_build(build): git clone {github_url} zstd-{user}-{sha} && cd zstd-{user}-{sha} && {checkout_command} - make && + make -j && cd ../ """.format( user=build["user"], @@ -100,7 +100,7 @@ def clone_and_build(build): ) return "zstd-{user}-{sha}/zstd".format(user=build["user"], sha=build["hash"]) else: - os.system("cd ../ && make && cd tests") + os.system("cd ../ && make -j && cd tests") return "../zstd" @@ -112,9 +112,9 @@ def parse_benchmark_output(output): def benchmark_single(executable, level, filename): return parse_benchmark_output(( subprocess.run( - [executable, "-qb{}".format(level), filename], stderr=subprocess.PIPE + [executable, "-qb{}".format(level), filename], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) - .stderr.decode("utf-8") + .stdout.decode("utf-8") .split(" ") )) @@ -145,7 +145,7 @@ def benchmark(build, filenames, levels, iterations): def benchmark_dictionary_single(executable, filenames_directory, dictionary_filename, level, iterations): cspeeds, dspeeds = [], [] for _ in range(iterations): - output = subprocess.run([executable, "-qb{}".format(level), "-D", dictionary_filename, "-r", filenames_directory], stderr=subprocess.PIPE).stderr.decode("utf-8").split(" ") + output = subprocess.run([executable, "-qb{}".format(level), "-D", dictionary_filename, "-r", filenames_directory], stdout=subprocess.PIPE).stdout.decode("utf-8").split(" ") cspeed, dspeed = parse_benchmark_output(output) cspeeds.append(cspeed) dspeeds.append(dspeed) @@ -291,12 +291,12 @@ if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--directory", help="directory with files to benchmark", default="golden-compression") - parser.add_argument("--levels", help="levels to test eg ('1,2,3')", default="1") + parser.add_argument("--levels", help="levels to test e.g. ('1,2,3')", default="1") parser.add_argument("--iterations", help="number of benchmark iterations to run", default="1") parser.add_argument("--emails", help="email addresses of people who will be alerted upon regression. Only for continuous mode", default=None) parser.add_argument("--frequency", help="specifies the number of seconds to wait before each successive check for new PRs in continuous mode", default=DEFAULT_MAX_API_CALL_FREQUENCY_SEC) parser.add_argument("--mode", help="'fastmode', 'onetime', 'current', or 'continuous' (see README.md for details)", default="current") - parser.add_argument("--dict", help="filename of dictionary to use (when set, this dictioanry will be used to compress the files provided inside --directory)", default=None) + parser.add_argument("--dict", help="filename of dictionary to use (when set, this dictionary will be used to compress the files provided inside --directory)", default=None) args = parser.parse_args() filenames = args.directory diff --git a/src/dependencies/zstd-1.5.0/tests/bigdict.c b/src/dependencies/zstd-1.5.4/tests/bigdict.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/bigdict.c rename to src/dependencies/zstd-1.5.4/tests/bigdict.c index fb08925..ff2bb2d 100644 --- a/src/dependencies/zstd-1.5.0/tests/bigdict.c +++ b/src/dependencies/zstd-1.5.4/tests/bigdict.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/checkTag.c b/src/dependencies/zstd-1.5.4/tests/checkTag.c similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/checkTag.c rename to src/dependencies/zstd-1.5.4/tests/checkTag.c index f6c5e97..26871ed 100644 --- a/src/dependencies/zstd-1.5.0/tests/checkTag.c +++ b/src/dependencies/zstd-1.5.4/tests/checkTag.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.4/tests/check_size.py b/src/dependencies/zstd-1.5.4/tests/check_size.py new file mode 100755 index 0000000..028b0a9 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/check_size.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# ################################################################ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# You may select, at your option, one of the above-listed licenses. +# ################################################################ + +import os +import subprocess +import sys + +if len(sys.argv) != 3: + print(f"Usage: {sys.argv[0]} FILE SIZE_LIMIT") + sys.exit(1) + +file = sys.argv[1] +limit = int(sys.argv[2]) + +if not os.path.exists(file): + print(f"{file} does not exist") + sys.exit(1) + +size = os.path.getsize(file) + +if size > limit: + print(f"file {file} is {size} bytes, which is greater than the limit of {limit} bytes") + sys.exit(1) diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/.gitignore b/src/dependencies/zstd-1.5.4/tests/cli-tests/.gitignore new file mode 100644 index 0000000..0ad01b2 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/.gitignore @@ -0,0 +1,6 @@ +!bin/ +!datagen +!zstdcat + +scratch/ +bin/symlinks diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/README.md b/src/dependencies/zstd-1.5.4/tests/cli-tests/README.md new file mode 100644 index 0000000..7ca07c3 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/README.md @@ -0,0 +1,258 @@ +# CLI tests + +The CLI tests are focused on testing the zstd CLI. +They are intended to be simple tests that the CLI and arguments work as advertised. +They are not intended to test the library, only the code in `programs/`. +The library will get incidental coverage, but if you find yourself trying to trigger a specific condition in the library, this is the wrong tool. + +## Test runner usage + +The test runner `run.py` will run tests against the in-tree build of `zstd` and `datagen` by default. Which means that `zstd` and `datagen` must be built. + +The `zstd` binary used can be passed with `--zstd /path/to/zstd`. +Additionally, to run `zstd` through a tool like `valgrind` or `qemu`, set the `--exec-prefix 'valgrind -q'` flag. + +Similarly, the `--datagen`, and `--zstdgrep` flags can be set to specify +the paths to their respective binaries. However, these tools do not use +the `EXEC_PREFIX`. + +Each test executes in its own scratch directory under `scratch/test/name`. E.g. `scratch/basic/help.sh/`. Normally these directories are removed after the test executes. However, the `--preserve` flag will preserve these directories after execution, and save the tests exit code, stdout, and stderr in the scratch directory to `exit`, `stderr`, and `stdout` respectively. This can be useful for debugging/editing a test and updating the expected output. + +### Running all the tests + +By default the test runner `run.py` will run all the tests, and report the results. + +Examples: + +``` +./run.py +./run.py --preserve +./run.py --zstd ../../build/programs/zstd --datagen ../../build/tests/datagen +``` + +### Running specific tests + +A set of test names can be passed to the test runner `run.py` to only execute those tests. +This can be useful for writing or debugging a test, especially with `--preserve`. + +The test name can either be the path to the test file, or the test name, which is the path relative to the test directory. + +Examples: + +``` +./run.py basic/help.sh +./run.py --preserve basic/help.sh basic/version.sh +./run.py --preserve --verbose basic/help.sh +``` + +### Updating exact output + +If a test is failing because a `.stderr.exact` or `.stdout.exact` no longer matches, you can re-run the tests with `--set-exact-output` and the correct output will be written. + +Example: +``` +./run.py --set-exact-output +./run.py basic/help.sh --set-exact-output +``` + +## Writing a test + +Test cases are arbitrary executables, and can be written in any language, but are generally shell scripts. +After the script executes, the exit code, stderr, and stdout are compared against the expectations. + +Each test is run in a clean directory that the test can use for intermediate files. This directory will be cleaned up at the end of the test, unless `--preserve` is passed to the test runner. Additionally, the `setup` script can prepare the directory before the test runs. + +### Calling zstd, utilities, and environment variables + +The `$PATH` for tests is prepended with the `bin/` sub-directory, which contains helper scripts for ease of testing. +The `zstd` binary will call the zstd binary specified by `run.py` with the correct `$EXEC_PREFIX`. +Similarly, `datagen`, `unzstd`, `zstdgrep`, `zstdcat`, etc, are provided. + +Helper utilities like `cmp_size`, `println`, and `die` are provided here too. See their scripts for details. + +Common shell script libraries are provided under `common/`, with helper variables and functions. They can be sourced with `source "$COMMON/library.sh`. + +Lastly, environment variables are provided for testing, which can be listed when calling `run.py` with `--verbose`. +They are generally used by the helper scripts in `bin/` to coordinate everything. + +### Basic test case + +When executing your `$TEST` executable, by default the exit code is expected to be `0`. However, you can provide an alternate expected exit code in a `$TEST.exit` file. + +When executing your `$TEST` executable, by default the expected stderr and stdout are empty. However, you can override the default by providing one of three files: + +* `$TEST.{stdout,stderr}.exact` +* `$TEST.{stdout,stderr}.glob` +* `$TEST.{stdout,stderr}.ignore` + +If you provide a `.exact` file, the output is expected to exactly match, byte-for-byte. + +If you provide a `.glob` file, the output is expected to match the expected file, where each line is interpreted as a glob syntax. Additionally, a line containing only `...` matches all lines until the next expected line matches. + +If you provide a `.ignore` file, the output is ignored. + +#### Passing examples + +All these examples pass. + +Exit 1, and change the expectation to be 1. + +``` +exit-1.sh +--- +#!/bin/sh +exit 1 +--- + +exit-1.sh.exit +--- +1 +--- +``` + +Check the stdout output exactly matches. + +``` +echo.sh +--- +#!/bin/sh +echo "hello world" +--- + +echo.sh.stdout.exact +--- +hello world +--- +``` + +Check the stderr output using a glob. + +``` +random.sh +--- +#!/bin/sh +head -c 10 < /dev/urandom | xxd >&2 +--- + +random.sh.stderr.glob +--- +00000000: * * * * * * +``` + +Multiple lines can be matched with ... + +``` +random-num-lines.sh +--- +#!/bin/sh +echo hello +seq 0 $RANDOM +echo world +--- + +random-num-lines.sh.stdout.glob +--- +hello +0 +... +world +--- +``` + +#### Failing examples + +Exit code is expected to be 0, but is 1. + +``` +exit-1.sh +--- +#!/bin/sh +exit 1 +--- +``` + +Stdout is expected to be empty, but isn't. + +``` +echo.sh +--- +#!/bin/sh +echo hello world +``` + +Stderr is expected to be hello but is world. + +``` +hello.sh +--- +#!/bin/sh +echo world >&2 +--- + +hello.sh.stderr.exact +--- +hello +--- +``` + +### Setup & teardown scripts + +Finally, test writing can be eased with setup and teardown scripts. +Each directory in the test directory is a test-suite consisting of all tests within that directory (but not sub-directories). +This test suite can come with 4 scripts to help test writing: + +* `setup_once` +* `teardown_once` +* `setup` +* `teardown` + +The `setup_once` and `teardown_once` are run once before and after all the tests in the suite respectively. +They operate in the scratch directory for the test suite, which is the parent directory of each scratch directory for each test case. +They can do work that is shared between tests to improve test efficiency. +For example, the `dictionaries/setup_once` script builds several dictionaries, for use in the `dictionaries` tests. + +The `setup` and `teardown` scripts run before and after each test case respectively, in the test case's scratch directory. +These scripts can do work that is shared between test cases to make tests more succinct. +For example, the `dictionaries/setup` script copies the dictionaries built by the `dictionaries/setup_once` script into the test's scratch directory, to make them easier to use, and make sure they aren't accidentally modified. + +#### Examples + +``` +basic/setup +--- +#!/bin/sh +# Create some files for testing with +datagen > file +datagen > file0 +datagen > file1 +--- + +basic/test.sh +--- +#!/bin/sh +zstd file file0 file1 +--- + +dictionaries/setup_once +--- +#!/bin/sh +set -e + +mkdir files/ dicts/ +for i in $(seq 10); do + datagen -g1000 > files/$i +done + +zstd --train -r files/ -o dicts/0 +--- + +dictionaries/setup +--- +#!/bin/sh + +# Runs in the test case's scratch directory. +# The test suite's scratch directory that +# `setup_once` operates in is the parent directory. +cp -r ../files ../dicts . +--- +``` diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/help.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/help.sh new file mode 100755 index 0000000..927c3ff --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/help.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +println "+ zstd -h" +zstd -h +println "+ zstd -H" +zstd -H +println "+ zstd --help" +zstd --help diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/help.sh.stdout.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/help.sh.stdout.glob new file mode 100644 index 0000000..5580dc6 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/help.sh.stdout.glob @@ -0,0 +1,34 @@ ++ zstd -h +Compress or decompress the INPUT file(s); reads from STDIN if INPUT is `-` or not provided. + +Usage: zstd *OPTIONS...* *INPUT... | -* *-o OUTPUT* + +Options: + -o OUTPUT Write output to a single file, OUTPUT. + -k, --keep Preserve INPUT file(s). *Default* + --rm Remove INPUT file(s) after successful (de)compression. + + -# Desired compression level, where `#` is a number between 1 and 19; + lower numbers provide faster compression, higher numbers yield + better compression ratios. *Default: 3* + + -d, --decompress Perform decompression. + -D DICT Use DICT as the dictionary for compression or decompression. + + -f, --force Disable input and output checks. Allows overwriting existing files, + receiving input from the console, printing ouput to STDOUT, and + operating on links, block devices, etc. Unrecognized formats will be + passed-through through as-is. + + -h Display short usage and exit. + -H, --help Display full help and exit. + -V, --version Display the program version and exit. + ++ zstd -H +... +Advanced options: +... ++ zstd --help +... +Advanced options: +... diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh new file mode 100755 index 0000000..88d734d --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +echo "some data" > file + +println "+ zstd --memory=32LB file" +zstd --memory=32LB file && die "Should not allow bogus suffix" +println "+ zstd --memory=32LiB file" +zstd --memory=32LiB file && die "Should not allow bogus suffix" +println "+ zstd --memory=32A file" +zstd --memory=32A file && die "Should not allow bogus suffix" +println "+ zstd --memory=32r82347dn83 file" +zstd --memory=32r82347dn83 file && die "Should not allow bogus suffix" +println "+ zstd --memory=32asbdf file" +zstd --memory=32asbdf file && die "Should not allow bogus suffix" +println "+ zstd --memory=hello file" +zstd --memory=hello file && die "Should not allow non-numeric parameter" +println "+ zstd --memory=1 file" +zstd -q --memory=1 file && die "Should allow numeric parameter without suffix" +rm file.zst +println "+ zstd --memory=1K file" +zstd -q --memory=1K file && die "Should allow numeric parameter with expected suffix" +rm file.zst +println "+ zstd --memory=1KB file" +zstd -q --memory=1KB file && die "Should allow numeric parameter with expected suffix" +rm file.zst +println "+ zstd --memory=1KiB file" +zstd -q --memory=1KiB file && die "Should allow numeric parameter with expected suffix" +rm file.zst +println "+ zstd --memory=1M file" +zstd -q --memory=1M file && die "Should allow numeric parameter with expected suffix" +rm file.zst +println "+ zstd --memory=1MB file" +zstd -q --memory=1MB file && die "Should allow numeric parameter with expected suffix" +rm file.zst +println "+ zstd --memory=1MiB file" +zstd -q --memory=1MiB file && die "Should allow numeric parameter with expected suffix" +rm file.zst + +rm file +exit 0 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh.stderr.exact new file mode 100644 index 0000000..3785b0f --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh.stderr.exact @@ -0,0 +1,13 @@ +error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed +error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed +error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed +error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed +error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed +error: only numeric values with optional suffixes K, KB, KiB, M, MB, MiB are allowed +Should allow numeric parameter without suffix +Should allow numeric parameter with expected suffix +Should allow numeric parameter with expected suffix +Should allow numeric parameter with expected suffix +Should allow numeric parameter with expected suffix +Should allow numeric parameter with expected suffix +Should allow numeric parameter with expected suffix diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh.stdout.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh.stdout.exact new file mode 100644 index 0000000..1821648 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/memlimit.sh.stdout.exact @@ -0,0 +1,13 @@ ++ zstd --memory=32LB file ++ zstd --memory=32LiB file ++ zstd --memory=32A file ++ zstd --memory=32r82347dn83 file ++ zstd --memory=32asbdf file ++ zstd --memory=hello file ++ zstd --memory=1 file ++ zstd --memory=1K file ++ zstd --memory=1KB file ++ zstd --memory=1KiB file ++ zstd --memory=1M file ++ zstd --memory=1MB file ++ zstd --memory=1MiB file diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh new file mode 100755 index 0000000..a8819d2 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +println "+ zstd -r * --output-dir-mirror=\"\"" +zstd -r * --output-dir-mirror="" && die "Should not allow empty output dir!" +println "+ zstd -r * --output-dir-flat=\"\"" +zstd -r * --output-dir-flat="" && die "Should not allow empty output dir!" +exit 0 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh.stderr.exact new file mode 100644 index 0000000..e12b504 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh.stderr.exact @@ -0,0 +1,2 @@ +error: output dir cannot be empty string (did you mean to pass '.' instead?) +error: output dir cannot be empty string (did you mean to pass '.' instead?) diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh.stdout.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh.stdout.exact new file mode 100644 index 0000000..1e478cd --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/output_dir.sh.stdout.exact @@ -0,0 +1,2 @@ ++ zstd -r * --output-dir-mirror="" ++ zstd -r * --output-dir-flat="" diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/version.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/version.sh new file mode 100755 index 0000000..f75eaa8 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/version.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +zstd -V +zstd --version diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/version.sh.stdout.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/version.sh.stdout.glob new file mode 100644 index 0000000..4cc9fb9 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/basic/version.sh.stdout.glob @@ -0,0 +1,2 @@ +*** Zstandard CLI (*-bit) v1.*.*, by Yann Collet *** +*** Zstandard CLI (*-bit) v1.*.*, by Yann Collet *** diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/cmp_size b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/cmp_size new file mode 100755 index 0000000..8e4bef8 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/cmp_size @@ -0,0 +1,44 @@ +#!/bin/sh + +set -e + +usage() +{ + printf "USAGE:\n\t$0 [-eq|-ne|-lt|-le|-gt|-ge] FILE1 FILE2\n" +} + +help() +{ + printf "Small utility to compare file sizes without printing them with set -x.\n\n" + usage +} + +case "$1" in + -h) help; exit 0 ;; + --help) help; exit 0 ;; +esac + +if ! test -f $2; then + printf "FILE1='%b' is not a file\n\n" "$2" + usage + exit 1 +fi + +if ! test -f $3; then + printf "FILE2='%b' is not a file\n\n" "$3" + usage + exit 1 +fi + + +size1=$(wc -c < $2) +size2=$(wc -c < $3) + +case "$1" in + -eq) [ "$size1" -eq "$size2" ] ;; + -ne) [ "$size1" -ne "$size2" ] ;; + -lt) [ "$size1" -lt "$size2" ] ;; + -le) [ "$size1" -le "$size2" ] ;; + -gt) [ "$size1" -gt "$size2" ] ;; + -ge) [ "$size1" -ge "$size2" ] ;; +esac diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/datagen b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/datagen new file mode 100755 index 0000000..8c60cbc --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/datagen @@ -0,0 +1,3 @@ +#!/bin/sh + +"$DATAGEN_BIN" $@ diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/die b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/die new file mode 100755 index 0000000..8633bc9 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/die @@ -0,0 +1,4 @@ +#!/bin/sh + +println "${*}" 1>&2 +exit 1 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/println b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/println new file mode 100755 index 0000000..494eb18 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/println @@ -0,0 +1,2 @@ +#!/bin/sh +printf '%b\n' "${*}" diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/unzstd b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/unzstd new file mode 100755 index 0000000..7a40aec --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/unzstd @@ -0,0 +1,9 @@ +#!/bin/sh + +zstdname=$(basename $0) + +if [ -z "$EXEC_PREFIX" ]; then + "$ZSTD_SYMLINK_DIR/$zstdname" $@ +else + $EXEC_PREFIX "$ZSTD_SYMLINK_DIR/$zstdname" $@ +fi diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstd b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstd new file mode 100755 index 0000000..7a40aec --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstd @@ -0,0 +1,9 @@ +#!/bin/sh + +zstdname=$(basename $0) + +if [ -z "$EXEC_PREFIX" ]; then + "$ZSTD_SYMLINK_DIR/$zstdname" $@ +else + $EXEC_PREFIX "$ZSTD_SYMLINK_DIR/$zstdname" $@ +fi diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdcat b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdcat new file mode 100755 index 0000000..7a40aec --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdcat @@ -0,0 +1,9 @@ +#!/bin/sh + +zstdname=$(basename $0) + +if [ -z "$EXEC_PREFIX" ]; then + "$ZSTD_SYMLINK_DIR/$zstdname" $@ +else + $EXEC_PREFIX "$ZSTD_SYMLINK_DIR/$zstdname" $@ +fi diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdgrep b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdgrep new file mode 100755 index 0000000..8821ebb --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdgrep @@ -0,0 +1,2 @@ +#!/bin/sh +"$ZSTDGREP_BIN" $@ diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdless b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdless new file mode 100755 index 0000000..d1d6f82 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/bin/zstdless @@ -0,0 +1,2 @@ +#!/bin/sh +"$ZSTDLESS_BIN" $@ diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/setup b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/setup new file mode 100755 index 0000000..3009bd5 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/setup @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +echo "1234" > file +zstd file diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh new file mode 100755 index 0000000..6cd68b7 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +println "+ good path" +zstdgrep "1234" file file.zst +println "+ bad path" +zstdgrep "1234" bad.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.exit b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.exit new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.exit @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.stderr.exact new file mode 100644 index 0000000..f147f28 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.stderr.exact @@ -0,0 +1 @@ +zstd: can't stat bad.zst : No such file or directory -- ignored diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.stdout.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.stdout.glob new file mode 100644 index 0000000..96d4fa2 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdgrep.sh.stdout.glob @@ -0,0 +1,4 @@ ++ good path +file:1234 +file.zst:1234 ++ bad path diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh new file mode 100755 index 0000000..a0697bd --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +println "+ good path" +zstdless file.zst +println "+ pass parameters" +zstdless -N file.zst # This parameter does not produce line #s when piped, but still serves to test that the flag went to less and not zstd +println "+ bad path" +zstdless bad.zst >&2 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh.stderr.exact new file mode 100644 index 0000000..5a726f1 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh.stderr.exact @@ -0,0 +1,2 @@ +zstd: can't stat bad.zst : No such file or directory -- ignored +bad.zst: No such file or directory diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh.stdout.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh.stdout.glob new file mode 100644 index 0000000..2784ddd --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/cltools/zstdless.sh.stdout.glob @@ -0,0 +1,5 @@ ++ good path +1234 ++ pass parameters +1234 ++ bad path diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/common/format.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/format.sh new file mode 100644 index 0000000..e574e97 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/format.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +. "$COMMON/platform.sh" + +zstd_supports_format() +{ + zstd -h | grep > $INTOVOID -- "--format=$1" +} + +format_extension() +{ + if [ "$1" = "zstd" ]; then + printf "zst" + elif [ "$1" = "gzip" ]; then + printf "gz" + else + printf "$1" + fi +} diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/common/mtime.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/mtime.sh new file mode 100644 index 0000000..344074d --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/mtime.sh @@ -0,0 +1,13 @@ +. "$COMMON/platform.sh" + +MTIME="stat -c %Y" +case "$UNAME" in + Darwin | FreeBSD | OpenBSD | NetBSD) MTIME="stat -f %m" ;; +esac + +assertSameMTime() { + MT1=$($MTIME "$1") + MT2=$($MTIME "$2") + echo MTIME $MT1 $MT2 + [ "$MT1" = "$MT2" ] || die "mtime on $1 doesn't match mtime on $2 ($MT1 != $MT2)" +} diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/common/permissions.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/permissions.sh new file mode 100644 index 0000000..6bce1f0 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/permissions.sh @@ -0,0 +1,18 @@ +. "$COMMON/platform.sh" + +GET_PERMS="stat -c %a" +case "$UNAME" in + Darwin | FreeBSD | OpenBSD | NetBSD) GET_PERMS="stat -f %Lp" ;; +esac + +assertFilePermissions() { + STAT1=$($GET_PERMS "$1") + STAT2=$2 + [ "$STAT1" = "$STAT2" ] || die "permissions on $1 don't match expected ($STAT1 != $STAT2)" +} + +assertSamePermissions() { + STAT1=$($GET_PERMS "$1") + STAT2=$($GET_PERMS "$2") + [ "$STAT1" = "$STAT2" ] || die "permissions on $1 don't match those on $2 ($STAT1 != $STAT2)" +} diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/common/platform.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/platform.sh new file mode 100644 index 0000000..6eb45ea --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/common/platform.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +UNAME=$(uname) + +isWindows=false +INTOVOID="/dev/null" +case "$UNAME" in + GNU) DEVDEVICE="/dev/random" ;; + *) DEVDEVICE="/dev/zero" ;; +esac +case "$OS" in + Windows*) + isWindows=true + INTOVOID="NUL" + DEVDEVICE="NUL" + ;; +esac + +case "$UNAME" in + Darwin) MD5SUM="md5 -r" ;; + FreeBSD) MD5SUM="gmd5sum" ;; + NetBSD) MD5SUM="md5 -n" ;; + OpenBSD) MD5SUM="md5" ;; + *) MD5SUM="md5sum" ;; +esac + +DIFF="diff" +case "$UNAME" in + SunOS) DIFF="gdiff" ;; +esac + +if echo hello | zstd -v -T2 2>&1 > $INTOVOID | grep -q 'multi-threading is disabled' +then + hasMT="" +else + hasMT="true" +fi diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/adapt.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/adapt.sh new file mode 100755 index 0000000..30b9afa --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/adapt.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# Test --adapt +zstd -f file --adapt -c | zstd -t + +datagen -g100M > file100M + +# Pick parameters to force fast adaptation, even on slow systems +zstd --adapt -vvvv -19 --zstd=wlog=10 file100M -o /dev/null 2>&1 | grep -q "faster speed , lighter compression" + +# Adaption still happens with --no-progress +zstd --no-progress --adapt -vvvv -19 --zstd=wlog=10 file100M -o /dev/null 2>&1 | grep -q "faster speed , lighter compression" diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/basic.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/basic.sh new file mode 100755 index 0000000..b6e2aa0 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/basic.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +# Uncomment the set -v line for debugging +# set -v + +# Test compression flags and check that they work +zstd file ; zstd -t file.zst +zstd -f file ; zstd -t file.zst +zstd -f -z file ; zstd -t file.zst +zstd -f -k file ; zstd -t file.zst +zstd -f -C file ; zstd -t file.zst +zstd -f --check file ; zstd -t file.zst +zstd -f --no-check file ; zstd -t file.zst +zstd -f -- file ; zstd -t file.zst + +# Test output file compression +zstd -o file-out.zst ; zstd -t file-out.zst +zstd -fo file-out.zst; zstd -t file-out.zst + +# Test compression to stdout +zstd -c file | zstd -t +zstd --stdout file | zstd -t +println bob | zstd | zstd -t + +# Test keeping input file when compressing to stdout in gzip mode +$ZSTD_SYMLINK_DIR/gzip -c file | zstd -t ; test -f file +$ZSTD_SYMLINK_DIR/gzip --stdout file | zstd -t ; test -f file + +# Test --rm +cp file file-rm +zstd --rm file-rm; zstd -t file-rm.zst +test ! -f file-rm diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/compress-literals.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/compress-literals.sh new file mode 100755 index 0000000..573481a --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/compress-literals.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +# Test --[no-]compress-literals +zstd file --no-compress-literals -1 -c | zstd -t +zstd file --no-compress-literals -19 -c | zstd -t +zstd file --no-compress-literals --fast=1 -c | zstd -t +zstd file --compress-literals -1 -c | zstd -t +zstd file --compress-literals --fast=1 -c | zstd -t diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/format.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/format.sh new file mode 100755 index 0000000..192fa2c --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/format.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. "$COMMON/format.sh" + +set -e + +# Test --format +zstd --format=zstd file -f +zstd -t file.zst +for format in "gzip" "lz4" "xz" "lzma"; do + if zstd_supports_format $format; then + zstd --format=$format file + zstd -t file.$(format_extension $format) + zstd -c --format=$format file | zstd -t --format=$format + fi +done diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/golden.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/golden.sh new file mode 100755 index 0000000..85dd3fd --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/golden.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +GOLDEN_DIR="$ZSTD_REPO_DIR/tests/golden-compression/" +cp -r "$GOLDEN_DIR" golden/ + +zstd -rf golden/ --output-dir-mirror golden-compressed/ +zstd -r -t golden-compressed/ + +zstd --target-compressed-block-size=1024 -rf golden/ --output-dir-mirror golden-compressed/ +zstd -r -t golden-compressed/ diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/gzip-compat.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/gzip-compat.sh new file mode 100755 index 0000000..bb72e05 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/gzip-compat.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +# Uncomment the set -v line for debugging +# set -v + +# Test gzip specific compression option +$ZSTD_SYMLINK_DIR/gzip --fast file ; $ZSTD_SYMLINK_DIR/gzip -d file.gz +$ZSTD_SYMLINK_DIR/gzip --best file ; $ZSTD_SYMLINK_DIR/gzip -d file.gz + +# Test -n / --no-name: do not embed original filename in archive +$ZSTD_SYMLINK_DIR/gzip -n file ; grep -qv file file.gz ; $ZSTD_SYMLINK_DIR/gzip -d file.gz +$ZSTD_SYMLINK_DIR/gzip --no-name file ; grep -qv file file.gz ; $ZSTD_SYMLINK_DIR/gzip -d file.gz +$ZSTD_SYMLINK_DIR/gzip -c --no-name file | grep -qv file diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/levels.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/levels.sh new file mode 100755 index 0000000..cc2700a --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/levels.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +set -e +set -v + +datagen > file + +# Compress with various levels and ensure that their sizes are ordered +zstd --fast=10 file -o file-f10.zst -q +zstd --fast=1 file -o file-f1.zst -q +zstd -1 file -o file-1.zst -q +zstd -19 file -o file-19.zst -q + +zstd -t file-f10.zst file-f1.zst file-1.zst file-19.zst + +cmp_size -lt file-19.zst file-1.zst +cmp_size -lt file-1.zst file-f1.zst +cmp_size -lt file-f1.zst file-f10.zst + +# Test default levels +zstd --fast file -f -q +cmp file.zst file-f1.zst || die "--fast is not level -1" + +zstd -0 file -o file-0.zst -q +zstd -f file -q +cmp file.zst file-0.zst || die "Level 0 is not the default level" + +# Test level clamping +zstd -99 file -o file-99.zst -q +cmp file-19.zst file-99.zst || die "Level 99 is clamped to 19" +zstd --fast=200000 file -c | zstd -t + +zstd -5000000000 -f file && die "Level too large, must fail" ||: +zstd --fast=5000000000 -f file && die "Level too large, must fail" ||: + +# Test setting a level through the environment variable +ZSTD_CLEVEL=-10 zstd file -o file-f10-env.zst -q +ZSTD_CLEVEL=1 zstd file -o file-1-env.zst -q +ZSTD_CLEVEL=+19 zstd file -o file-19-env.zst -q +ZSTD_CLEVEL=+99 zstd file -o file-99-env.zst -q + +cmp file-f10.zst file-f10-env.zst || die "Environment variable failed to set level" +cmp file-1.zst file-1-env.zst || die "Environment variable failed to set level" +cmp file-19.zst file-19-env.zst || die "Environment variable failed to set level" +cmp file-99.zst file-99-env.zst || die "Environment variable failed to set level" + +# Test invalid environment clevel is the default level +zstd -f file -q +ZSTD_CLEVEL=- zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +ZSTD_CLEVEL=+ zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +ZSTD_CLEVEL=a zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +ZSTD_CLEVEL=-a zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +ZSTD_CLEVEL=+a zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +ZSTD_CLEVEL=3a7 zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +ZSTD_CLEVEL=5000000000 zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst + +# Test environment clevel is overridden by command line +ZSTD_CLEVEL=10 zstd -f file -1 -o file-1-env.zst -q +ZSTD_CLEVEL=10 zstd -f file --fast=1 -o file-f1-env.zst -q + +cmp file-1.zst file-1-env.zst || die "Environment variable not overridden" +cmp file-f1.zst file-f1-env.zst || die "Environment variable not overridden" diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/levels.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/levels.sh.stderr.exact new file mode 100644 index 0000000..c8fb79c --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/levels.sh.stderr.exact @@ -0,0 +1,69 @@ + +datagen > file + +# Compress with various levels and ensure that their sizes are ordered +zstd --fast=10 file -o file-f10.zst -q +zstd --fast=1 file -o file-f1.zst -q +zstd -1 file -o file-1.zst -q +zstd -19 file -o file-19.zst -q + +zstd -t file-f10.zst file-f1.zst file-1.zst file-19.zst +4 files decompressed : 262148 bytes total + +cmp_size -lt file-19.zst file-1.zst +cmp_size -lt file-1.zst file-f1.zst +cmp_size -lt file-f1.zst file-f10.zst + +# Test default levels +zstd --fast file -f -q +cmp file.zst file-f1.zst || die "--fast is not level -1" + +zstd -0 file -o file-0.zst -q +zstd -f file -q +cmp file.zst file-0.zst || die "Level 0 is not the default level" + +# Test level clamping +zstd -99 file -o file-99.zst -q +cmp file-19.zst file-99.zst || die "Level 99 is clamped to 19" +zstd --fast=200000 file -c | zstd -t +/*stdin*\ : 65537 bytes + +zstd -5000000000 -f file && die "Level too large, must fail" ||: +error: numeric value overflows 32-bit unsigned int +zstd --fast=5000000000 -f file && die "Level too large, must fail" ||: +error: numeric value overflows 32-bit unsigned int + +# Test setting a level through the environment variable +ZSTD_CLEVEL=-10 zstd file -o file-f10-env.zst -q +ZSTD_CLEVEL=1 zstd file -o file-1-env.zst -q +ZSTD_CLEVEL=+19 zstd file -o file-19-env.zst -q +ZSTD_CLEVEL=+99 zstd file -o file-99-env.zst -q + +cmp file-f10.zst file-f10-env.zst || die "Environment variable failed to set level" +cmp file-1.zst file-1-env.zst || die "Environment variable failed to set level" +cmp file-19.zst file-19-env.zst || die "Environment variable failed to set level" +cmp file-99.zst file-99-env.zst || die "Environment variable failed to set level" + +# Test invalid environment clevel is the default level +zstd -f file -q +ZSTD_CLEVEL=- zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +Ignore environment variable setting ZSTD_CLEVEL=-: not a valid integer value +ZSTD_CLEVEL=+ zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +Ignore environment variable setting ZSTD_CLEVEL=+: not a valid integer value +ZSTD_CLEVEL=a zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +Ignore environment variable setting ZSTD_CLEVEL=a: not a valid integer value +ZSTD_CLEVEL=-a zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +Ignore environment variable setting ZSTD_CLEVEL=-a: not a valid integer value +ZSTD_CLEVEL=+a zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +Ignore environment variable setting ZSTD_CLEVEL=+a: not a valid integer value +ZSTD_CLEVEL=3a7 zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +Ignore environment variable setting ZSTD_CLEVEL=3a7: not a valid integer value +ZSTD_CLEVEL=5000000000 zstd -f file -o file-env.zst -q ; cmp file.zst file-env.zst +Ignore environment variable setting ZSTD_CLEVEL=5000000000: numeric value too large + +# Test environment clevel is overridden by command line +ZSTD_CLEVEL=10 zstd -f file -1 -o file-1-env.zst -q +ZSTD_CLEVEL=10 zstd -f file --fast=1 -o file-f1-env.zst -q + +cmp file-1.zst file-1-env.zst || die "Environment variable not overridden" +cmp file-f1.zst file-f1-env.zst || die "Environment variable not overridden" diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/long-distance-matcher.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/long-distance-matcher.sh new file mode 100755 index 0000000..8f2c61b --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/long-distance-matcher.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +# Test --long +zstd -f file --long ; zstd -t file.zst +zstd -f file --long=20; zstd -t file.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multi-threaded.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multi-threaded.sh new file mode 100755 index 0000000..17a5eb5 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multi-threaded.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +# Test multi-threaded flags +zstd --single-thread file -f -q ; zstd -t file.zst +zstd -T2 -f file -q ; zstd -t file.zst +zstd --rsyncable -f file -q ; zstd -t file.zst +zstd -T0 -f file -q ; zstd -t file.zst +zstd -T0 --auto-threads=logical -f file -q ; zstd -t file.zst +zstd -T0 --auto-threads=physical -f file -q ; zstd -t file.zst + +# multi-thread decompression warning test +zstd -T0 -f file -q ; zstd -t file.zst; zstd -T0 -d file.zst -o file3 +zstd -T0 -f file -q ; zstd -t file.zst; zstd -T2 -d file.zst -o file4 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multi-threaded.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multi-threaded.sh.stderr.exact new file mode 100644 index 0000000..11daff6 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multi-threaded.sh.stderr.exact @@ -0,0 +1,11 @@ +file.zst : 65537 bytes +file.zst : 65537 bytes +file.zst : 65537 bytes +file.zst : 65537 bytes +file.zst : 65537 bytes +file.zst : 65537 bytes +file.zst : 65537 bytes +file.zst : 65537 bytes +file.zst : 65537 bytes +Warning : decompression does not support multi-threading +file.zst : 65537 bytes diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multiple-files.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multiple-files.sh new file mode 100755 index 0000000..aeb74cf --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multiple-files.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +# setup +echo "file1" > file1 +echo "file2" > file2 + +echo "Test zstd ./file1 - file2" +rm -f ./file*.zst +echo "stdin" | zstd ./file1 - ./file2 | zstd -d +cat file1.zst | zstd -d +cat file2.zst | zstd -d + +echo "Test zstd -d ./file1.zst - file2.zst" +rm ./file1 ./file2 +echo "stdin" | zstd - | zstd -d ./file1.zst - file2.zst +cat file1 +cat file2 + +echo "zstd -d ./file1.zst - file2.zst -c" +echo "stdin" | zstd | zstd -d ./file1.zst - file2.zst -c diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multiple-files.sh.stdout.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multiple-files.sh.stdout.exact new file mode 100644 index 0000000..aad61d6 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/multiple-files.sh.stdout.exact @@ -0,0 +1,12 @@ +Test zstd ./file1 - file2 +stdin +file1 +file2 +Test zstd -d ./file1.zst - file2.zst +stdin +file1 +file2 +zstd -d ./file1.zst - file2.zst -c +file1 +stdin +file2 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/row-match-finder.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/row-match-finder.sh new file mode 100755 index 0000000..5b36017 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/row-match-finder.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +# Test --[no-]row-match-finder +zstd file -7f --row-match-finder +zstd file -7f --no-row-match-finder diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/setup b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/setup new file mode 100755 index 0000000..96e2309 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/setup @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +datagen > file +datagen > file0 +datagen > file1 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/stream-size.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/stream-size.sh new file mode 100755 index 0000000..7344769 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/stream-size.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +# Test stream size & hint +datagen -g7654 | zstd --stream-size=7654 | zstd -t +datagen -g7654 | zstd --size-hint=7000 | zstd -t diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh new file mode 100755 index 0000000..88ee11a --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +. "$COMMON/platform.sh" + +zstd < file -vv -19 -o file.19.zst +zstd -vv -l file.19.zst + +zstd < file -vv -19 --long -o file.19.long.zst +zstd -vv -l file.19.long.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh.stderr.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh.stderr.glob new file mode 100644 index 0000000..1353471 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh.stderr.glob @@ -0,0 +1,5 @@ +... +*wlog=23* +... +*wlog=27* +... diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh.stdout.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh.stdout.glob new file mode 100644 index 0000000..19913a1 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/verbose-wlog.sh.stdout.glob @@ -0,0 +1,5 @@ +... +*Window Size: 8388608 B* +... +*Window Size: 134217728 B* +... diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh new file mode 100755 index 0000000..3b5e6fe --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh @@ -0,0 +1,9 @@ +#!/bin/sh +datagen -g1G > file +zstd --long=31 -1 --single-thread --no-content-size -f file +zstd -l -v file.zst + +# We want to ignore stderr (its outputting "*** zstd command line interface +# 64-bits v1.5.3, by Yann Collet ***") + +rm file file.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh.stderr.ignore b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh.stderr.ignore new file mode 100644 index 0000000..e69de29 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh.stdout.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh.stdout.glob new file mode 100644 index 0000000..313d216 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/compression/window-resize.sh.stdout.glob @@ -0,0 +1,3 @@ +... +Window Size: 1.000 GiB (1073741824 B) +... diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/golden.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/golden.sh new file mode 100755 index 0000000..36919e6 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/golden.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +GOLDEN_DIR="$ZSTD_REPO_DIR/tests/golden-decompression/" + +zstd -r -t "$GOLDEN_DIR" diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh new file mode 100755 index 0000000..2cab463 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +set -e + +. "$COMMON/platform.sh" + +echo "" > 1 +echo "2" > 2 +echo "23" > 3 +echo "234" > 4 +echo "some data" > file + +println "+ passthrough enabled" + +zstd file + +# Test short files +zstd -dc --pass-through 1 2 3 4 + +# Test *cat symlinks +zstdcat file +"$ZSTD_SYMLINK_DIR/zcat" file +"$ZSTD_SYMLINK_DIR/gzcat" file + +# Test multiple files with mix of compressed & not +zstdcat file file.zst +zstdcat file.zst file + +# Test --pass-through +zstd -dc --pass-through file +zstd -d --pass-through file -o pass-through-file + +# Test legacy implicit passthrough with -fc +zstd -dcf file +zstd -dcf file file.zst +zstd -df < file +zstd -dcf < file file.zst - +zstd -dcf < file.zst file - + +$DIFF file pass-through-file + +println "+ passthrough disabled" + +# Test *cat +zstdcat --no-pass-through file && die "should fail" +"$ZSTD_SYMLINK_DIR/zcat" --no-pass-through file && die "should fail" +"$ZSTD_SYMLINK_DIR/gzcat" --no-pass-through file && die "should fail" +# Test zstd without implicit passthrough +zstd -d file -o no-pass-through-file && die "should fail" +zstd -d < file && die "should fail" + +# Test legacy implicit passthrough with -fc +zstd --no-pass-through -dcf file && die "should fail" +zstd --no-pass-through -dcf file file.zst && die "should fail" +zstd --no-pass-through -df < file && die "should fail" +zstd --no-pass-through -dcf < file file.zst - && die "should fail" +zstd --no-pass-through -dcf < file.zst file - && die "should fail" ||: diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh.stderr.exact new file mode 100644 index 0000000..62f96ae --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh.stderr.exact @@ -0,0 +1,11 @@ +file :230.00% ( 10 B => 23 B, file.zst) +zstd: file: unsupported format +zstd: file: unsupported format +zstd: file: unsupported format +zstd: file: unsupported format +zstd: /*stdin*\: unsupported format +zstd: file: unsupported format +zstd: file: unsupported format +zstd: /*stdin*\: unsupported format +zstd: /*stdin*\: unsupported format +zstd: file: unsupported format diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh.stdout.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh.stdout.exact new file mode 100644 index 0000000..b0d494c --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/decompression/pass-through.sh.stdout.exact @@ -0,0 +1,25 @@ ++ passthrough enabled + +2 +23 +234 +some data +some data +some data +some data +some data +some data +some data +some data +some data +some data +some data +some data +some data +some data +some data +some data ++ passthrough disabled +some data +some data +some data diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/empty-input.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/empty-input.sh new file mode 100755 index 0000000..b500bfe --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/empty-input.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +for i in $(seq 50); do + datagen -s$i > file$i +done +touch empty + +set -v +zstd -q --train empty file* diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/empty-input.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/empty-input.sh.stderr.exact new file mode 100644 index 0000000..2747e76 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/empty-input.sh.stderr.exact @@ -0,0 +1 @@ +zstd -q --train empty file* diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh new file mode 100755 index 0000000..416b837 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh @@ -0,0 +1,3 @@ +#!/bin/sh +set -v +zstd --train diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh.exit b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh.exit new file mode 100644 index 0000000..8351c19 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh.exit @@ -0,0 +1 @@ +14 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh.stderr.exact new file mode 100644 index 0000000..d7b3ea0 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dict-builder/no-inputs.sh.stderr.exact @@ -0,0 +1,5 @@ +zstd --train +! Warning : nb of samples too low for proper processing ! +! Please provide _one file per sample_. +! Alternatively, split files into fixed-size blocks representative of samples, with -B# +Error 14 : nb of samples too low diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/dictionary-mismatch.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/dictionary-mismatch.sh new file mode 100755 index 0000000..885cac2 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/dictionary-mismatch.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +. "$COMMON/platform.sh" + +set -e + +if [ false ]; then + for seed in $(seq 100); do + datagen -g1000 -s$seed > file$seed + done + + zstd --train -r . -o dict0 -qq + + for seed in $(seq 101 200); do + datagen -g1000 -s$seed > file$seed + done + + zstd --train -r . -o dict1 -qq + + [ "$($MD5SUM < dict0)" != "$($MD5SUM < dict1)" ] || die "dictionaries must not match" + + datagen -g1000 -s0 > file0 +fi + +set -v +zstd files/0 -D dicts/0 -q +zstd -t files/0.zst -D dicts/0 +zstd -t files/0.zst -D dicts/1 && die "Must fail" ||: +zstd -t files/0.zst && die "Must fail" ||: diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/dictionary-mismatch.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/dictionary-mismatch.sh.stderr.exact new file mode 100644 index 0000000..8896763 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/dictionary-mismatch.sh.stderr.exact @@ -0,0 +1,7 @@ +zstd files/0 -D dicts/0 -q +zstd -t files/0.zst -D dicts/0 +files/0.zst : 1000 bytes +zstd -t files/0.zst -D dicts/1 && die "Must fail" ||: +files/0.zst : Decoding error (36) : Dictionary mismatch +zstd -t files/0.zst && die "Must fail" ||: +files/0.zst : Decoding error (36) : Dictionary mismatch diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/golden.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/golden.sh new file mode 100755 index 0000000..85da2ee --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/golden.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +GOLDEN_COMP_DIR="$ZSTD_REPO_DIR/tests/golden-compression/" +GOLDEN_DICT_DIR="$ZSTD_REPO_DIR/tests/golden-dictionaries/" + +zstd -D "$GOLDEN_DICT_DIR/http-dict-missing-symbols" "$GOLDEN_COMP_DIR/http" -o http.zst +zstd -D "$GOLDEN_DICT_DIR/http-dict-missing-symbols" -t http.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/setup b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/setup new file mode 100755 index 0000000..616c73e --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/setup @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +cp -r ../files . +cp -r ../dicts . diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/setup_once b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/setup_once new file mode 100755 index 0000000..1241c57 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/dictionaries/setup_once @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +. "$COMMON/platform.sh" + + +mkdir files/ dicts/ + +for seed in $(seq 50); do + datagen -g1000 -s$seed > files/$seed +done + +zstd --train -r files -o dicts/0 -qq + +for seed in $(seq 51 100); do + datagen -g1000 -s$seed > files/$seed +done + +zstd --train -r files -o dicts/1 -qq + +cmp dicts/0 dicts/1 && die "dictionaries must not match!" + +datagen -g1000 > files/0 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-file.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-file.sh new file mode 100755 index 0000000..c5f5900 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-file.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +datagen > file +chmod 642 file + +zstd file -q --trace-file-stat -o file.zst +zstd -tq file.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-file.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-file.sh.stderr.exact new file mode 100644 index 0000000..a1ad09e --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-file.sh.stderr.exact @@ -0,0 +1,42 @@ +Trace:FileStat: > UTIL_isLink(file) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_getFileSize(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: < 65537 +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isDirectoryStat() +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isSameFile(file, file.zst) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file.zst) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file.zst) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_getFileSize(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: < 65537 +Trace:FileStat: > UTIL_setFileStat(file.zst) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_utime(file.zst) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_chmod(file.zst, 0642) +Trace:FileStat: > chmod +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: < 0 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-stdout.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-stdout.sh new file mode 100755 index 0000000..99ebfc4 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-stdout.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +datagen > file + +zstd file -cq --trace-file-stat > file.zst +zstd -tq file.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-stdout.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-stdout.sh.stderr.exact new file mode 100644 index 0000000..7c690d2 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-file-to-stdout.sh.stderr.exact @@ -0,0 +1,24 @@ +Trace:FileStat: > UTIL_isLink(file) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(1) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_getFileSize(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: < 65537 +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isDirectoryStat() +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isRegularFile(/*stdout*\) +Trace:FileStat: > UTIL_stat(/*stdout*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_getFileSize(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: < 65537 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-file.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-file.sh new file mode 100755 index 0000000..8379461 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-file.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +datagen > file + +zstd < file -q --trace-file-stat -o file.zst +zstd -tq file.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-file.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-file.sh.stderr.exact new file mode 100644 index 0000000..00afd97 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-file.sh.stderr.exact @@ -0,0 +1,24 @@ +Trace:FileStat: > UTIL_isConsole(0) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_getFileSize(/*stdin*\) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < -1 +Trace:FileStat: > UTIL_isSameFile(/*stdin*\, file.zst) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file.zst) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file.zst) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_getFileSize(/*stdin*\) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < -1 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh new file mode 100755 index 0000000..64f4b03 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +datagen > file + +zstd < file -cq --trace-file-stat > file.zst +zstd -tq file.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh.stderr.exact new file mode 100644 index 0000000..8bf05e6 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/compress-stdin-to-stdout.sh.stderr.exact @@ -0,0 +1,18 @@ +Trace:FileStat: > UTIL_isConsole(0) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(1) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_getFileSize(/*stdin*\) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < -1 +Trace:FileStat: > UTIL_isRegularFile(/*stdout*\) +Trace:FileStat: > UTIL_stat(/*stdout*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_getFileSize(/*stdin*\) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < -1 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-file.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-file.sh new file mode 100755 index 0000000..9e68f8f --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-file.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +datagen | zstd -q > file.zst +chmod 642 file.zst + +zstd -dq --trace-file-stat file.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-file.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-file.sh.stderr.exact new file mode 100644 index 0000000..d264c63 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-file.sh.stderr.exact @@ -0,0 +1,38 @@ +Trace:FileStat: > UTIL_isLink(file.zst) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(1) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isDirectory(file.zst) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isDirectoryStat() +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isSameFile(file.zst, file) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_setFileStat(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_utime(file) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_chmod(file, 0642) +Trace:FileStat: > chmod +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: < 0 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-stdout.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-stdout.sh new file mode 100755 index 0000000..518c2a9 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-stdout.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +datagen | zstd -q > file.zst + +zstd -dcq --trace-file-stat file.zst > file diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-stdout.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-stdout.sh.stderr.exact new file mode 100644 index 0000000..7fe6dda --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-file-to-stdout.sh.stderr.exact @@ -0,0 +1,18 @@ +Trace:FileStat: > UTIL_isLink(file.zst) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(1) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isDirectory(file.zst) +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isDirectoryStat() +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_stat(file.zst) +Trace:FileStat: < 1 +Trace:FileStat: > UTIL_isRegularFile(/*stdout*\) +Trace:FileStat: > UTIL_stat(/*stdout*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-file.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-file.sh new file mode 100755 index 0000000..135d755 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-file.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +datagen | zstd -q > file.zst + +zstd -dcq --trace-file-stat < file.zst -o file diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-file.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-file.sh.stderr.exact new file mode 100644 index 0000000..749fd39 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-file.sh.stderr.exact @@ -0,0 +1,20 @@ +Trace:FileStat: > UTIL_isConsole(0) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isDirectory(/*stdin*\) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isSameFile(/*stdin*\, file) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(file) +Trace:FileStat: > UTIL_stat(file) +Trace:FileStat: < 1 +Trace:FileStat: < 1 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh new file mode 100755 index 0000000..495f07b --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +datagen | zstd -q > file.zst + +zstd -dcq --trace-file-stat < file.zst > file diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh.stderr.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh.stderr.exact new file mode 100644 index 0000000..e36cb9d --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh.stderr.exact @@ -0,0 +1,14 @@ +Trace:FileStat: > UTIL_isConsole(0) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(1) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isConsole(2) +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isDirectory(/*stdin*\) +Trace:FileStat: > UTIL_stat(/*stdin*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 +Trace:FileStat: > UTIL_isRegularFile(/*stdout*\) +Trace:FileStat: > UTIL_stat(/*stdout*\) +Trace:FileStat: < 0 +Trace:FileStat: < 0 diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/no-progress.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/no-progress.sh new file mode 100755 index 0000000..708878f --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/no-progress.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +#!/bin/sh + +. "$COMMON/platform.sh" + +set -e + +echo hello > hello +echo world > world + +zstd -q hello world + +println >&2 "Tests cases where progress information should not be printed" + +for args in \ + "" \ + "--fake-stderr-is-console -q" \ + "--fake-stderr-is-console -qq --progress" \ + "--no-progress --fake-stderr-is-console" \ + "--no-progress --fake-stderr-is-console -v" +do + println >&2 "args = $args" + println >&2 "compress file to file" + zstd $args -f hello + println >&2 "compress pipe to pipe" + zstd $args < hello > $INTOVOID + println >&2 "compress pipe to file" + zstd $args < hello -fo hello.zst + println >&2 "compress file to pipe" + zstd $args hello -c > $INTOVOID + println >&2 "compress 2 files" + zstd $args -f hello world + + println >&2 "decompress file to file" + zstd $args -d -f hello.zst + println >&2 "decompress pipe to pipe" + zstd $args -d < hello.zst > $INTOVOID + println >&2 "decompress pipe to file" + zstd $args -d < hello.zst -fo hello + println >&2 "decompress file to pipe" + zstd $args -d hello.zst -c > $INTOVOID + println >&2 "decompress 2 files" + zstd $args -d -f hello.zst world.zst + println >&2 "" +done diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/no-progress.sh.stderr.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/no-progress.sh.stderr.glob new file mode 100644 index 0000000..d0f9112 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/no-progress.sh.stderr.glob @@ -0,0 +1,96 @@ +Tests cases where progress information should not be printed +args = +compress file to file +hello*hello.zst* +compress pipe to pipe +compress pipe to file +*stdin*hello.zst* +compress file to pipe +compress 2 files +2 files compressed* +decompress file to file +hello.zst* +decompress pipe to pipe +decompress pipe to file +*stdin* +decompress file to pipe +decompress 2 files +2 files decompressed* + +args = --fake-stderr-is-console -q +compress file to file +compress pipe to pipe +compress pipe to file +compress file to pipe +compress 2 files +decompress file to file +decompress pipe to pipe +decompress pipe to file +decompress file to pipe +decompress 2 files + +args = --fake-stderr-is-console -qq --progress +compress file to file +compress pipe to pipe +compress pipe to file +compress file to pipe +compress 2 files +decompress file to file +decompress pipe to pipe +decompress pipe to file +decompress file to pipe +decompress 2 files + +args = --no-progress --fake-stderr-is-console +compress file to file +hello*hello.zst* +compress pipe to pipe +compress pipe to file +*stdin*hello.zst* +compress file to pipe +compress 2 files +2 files compressed* +decompress file to file +hello.zst* +decompress pipe to pipe +decompress pipe to file +*stdin* +decompress file to pipe +decompress 2 files +2 files decompressed* + +args = --no-progress --fake-stderr-is-console -v +compress file to file +*Zstandard CLI* +hello*hello.zst* +compress pipe to pipe +*Zstandard CLI* +*stdin*stdout* +compress pipe to file +*Zstandard CLI* +*stdin*hello.zst* +compress file to pipe +*Zstandard CLI* +*hello*stdout* +compress 2 files +*Zstandard CLI* +*hello*hello.zst* +*world*world.zst* +2 files compressed* +decompress file to file +*Zstandard CLI* +hello.zst* +decompress pipe to pipe +*Zstandard CLI* +*stdin* +decompress pipe to file +*Zstandard CLI* +*stdin* +decompress file to pipe +*Zstandard CLI* +hello.zst* +decompress 2 files +*Zstandard CLI* +hello.zst* +world.zst* +2 files decompressed* diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/progress.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/progress.sh new file mode 100755 index 0000000..eb46499 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/progress.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +. "$COMMON/platform.sh" + +set -e + +println >&2 "Tests cases where progress information should be printed" + +echo hello > hello +echo world > world + +zstd -q hello world + +for args in \ + "--progress" \ + "--fake-stderr-is-console" \ + "--progress --fake-stderr-is-console -q"; do + println >&2 "args = $args" + println >&2 "compress file to file" + zstd $args -f hello + println >&2 "compress pipe to pipe" + zstd $args < hello > $INTOVOID + println >&2 "compress pipe to file" + zstd $args < hello -fo hello.zst + println >&2 "compress file to pipe" + zstd $args hello -c > $INTOVOID + println >&2 "compress 2 files" + zstd $args -f hello world + + println >&2 "decompress file to file" + zstd $args -d -f hello.zst + println >&2 "decompress pipe to pipe" + zstd $args -d < hello.zst > $INTOVOID + println >&2 "decompress pipe to file" + zstd $args -d < hello.zst -fo hello + println >&2 "decompress file to pipe" + zstd $args -d hello.zst -c > $INTOVOID + println >&2 "decompress 2 files" + zstd $args -d -f hello.zst world.zst + println >&2 "" +done diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/progress.sh.stderr.glob b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/progress.sh.stderr.glob new file mode 100644 index 0000000..ca620d3 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/progress/progress.sh.stderr.glob @@ -0,0 +1,62 @@ +Tests cases where progress information should be printed +args = --progress +compress file to file +*Read:*hello*hello.zst* +compress pipe to pipe +*Read:*stdin*stdout* +compress pipe to file +*Read:*stdin*hello.zst* +compress file to pipe +*Read:*hello*stdout* +compress 2 files +*Read*2 files compressed* +decompress file to file +*hello.zst*hello.zst* +decompress pipe to pipe +*stdin*stdin* +decompress pipe to file +*stdin*stdin* +decompress file to pipe +*hello.zst*hello.zst* +decompress 2 files +*hello.zst*2 files decompressed* + +args = --fake-stderr-is-console +compress file to file +*Read:*hello*hello.zst* +compress pipe to pipe +compress pipe to file +*Read:*stdin*hello.zst* +compress file to pipe +compress 2 files +*Read*2 files compressed* +decompress file to file +*hello.zst*hello.zst* +decompress pipe to pipe +decompress pipe to file +*stdin*stdin* +decompress file to pipe +decompress 2 files +*hello.zst*2 files decompressed* + +args = --progress --fake-stderr-is-console -q +compress file to file +*Read:*hello*hello.zst* +compress pipe to pipe +*Read:*stdin*stdout* +compress pipe to file +*Read:*stdin*hello.zst* +compress file to pipe +*Read:*hello*stdout* +compress 2 files +*Read*2 files compressed* +decompress file to file +*hello.zst*hello.zst* +decompress pipe to pipe +*stdin*stdin* +decompress pipe to file +*stdin*stdin* +decompress file to pipe +*hello.zst*hello.zst* +decompress 2 files +*hello.zst*2 files decompressed* diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/run.py b/src/dependencies/zstd-1.5.4/tests/cli-tests/run.py new file mode 100755 index 0000000..45af512 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/run.py @@ -0,0 +1,738 @@ +#!/usr/bin/env python3 +# ################################################################ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# You may select, at your option, one of the above-listed licenses. +# ########################################################################## + +import argparse +import contextlib +import copy +import fnmatch +import os +import shutil +import subprocess +import sys +import tempfile +import typing + + +ZSTD_SYMLINKS = [ + "zstd", + "zstdmt", + "unzstd", + "zstdcat", + "zcat", + "gzip", + "gunzip", + "gzcat", + "lzma", + "unlzma", + "xz", + "unxz", + "lz4", + "unlz4", +] + + +EXCLUDED_DIRS = { + "bin", + "common", + "scratch", +} + + +EXCLUDED_BASENAMES = { + "setup", + "setup_once", + "teardown", + "teardown_once", + "README.md", + "run.py", + ".gitignore", +} + +EXCLUDED_SUFFIXES = [ + ".exact", + ".glob", + ".ignore", + ".exit", +] + + +def exclude_dir(dirname: str) -> bool: + """ + Should files under the directory :dirname: be excluded from the test runner? + """ + if dirname in EXCLUDED_DIRS: + return True + return False + + +def exclude_file(filename: str) -> bool: + """Should the file :filename: be excluded from the test runner?""" + if filename in EXCLUDED_BASENAMES: + return True + for suffix in EXCLUDED_SUFFIXES: + if filename.endswith(suffix): + return True + return False + +def read_file(filename: str) -> bytes: + """Reads the file :filename: and returns the contents as bytes.""" + with open(filename, "rb") as f: + return f.read() + + +def diff(a: bytes, b: bytes) -> str: + """Returns a diff between two different byte-strings :a: and :b:.""" + assert a != b + with tempfile.NamedTemporaryFile("wb") as fa: + fa.write(a) + fa.flush() + with tempfile.NamedTemporaryFile("wb") as fb: + fb.write(b) + fb.flush() + + diff_bytes = subprocess.run(["diff", fa.name, fb.name], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).stdout + return diff_bytes.decode("utf8") + + +def pop_line(data: bytes) -> typing.Tuple[typing.Optional[bytes], bytes]: + """ + Pop the first line from :data: and returns the first line and the remainder + of the data as a tuple. If :data: is empty, returns :(None, data):. Otherwise + the first line always ends in a :\n:, even if it is the last line and :data: + doesn't end in :\n:. + """ + NEWLINE = b"\n"[0] + + if data == b'': + return (None, data) + + newline_idx = data.find(b"\n") + if newline_idx == -1: + end_idx = len(data) + else: + end_idx = newline_idx + 1 + + line = data[:end_idx] + data = data[end_idx:] + + assert len(line) != 0 + if line[-1] != NEWLINE: + line += NEWLINE + + return (line, data) + + +def glob_line_matches(actual: bytes, expect: bytes) -> bool: + """ + Does the `actual` line match the expected glob line `expect`? + """ + return fnmatch.fnmatchcase(actual.strip(), expect.strip()) + + +def glob_diff(actual: bytes, expect: bytes) -> bytes: + """ + Returns None if the :actual: content matches the expected glob :expect:, + otherwise returns the diff bytes. + """ + diff = b'' + actual_line, actual = pop_line(actual) + expect_line, expect = pop_line(expect) + while True: + # Handle end of file conditions - allow extra newlines + while expect_line is None and actual_line == b"\n": + actual_line, actual = pop_line(actual) + while actual_line is None and expect_line == b"\n": + expect_line, expect = pop_line(expect) + + if expect_line is None and actual_line is None: + if diff == b'': + return None + return diff + elif expect_line is None: + diff += b"---\n" + while actual_line != None: + diff += b"> " + diff += actual_line + actual_line, actual = pop_line(actual) + return diff + elif actual_line is None: + diff += b"---\n" + while expect_line != None: + diff += b"< " + diff += expect_line + expect_line, expect = pop_line(expect) + return diff + + assert expect_line is not None + assert actual_line is not None + + if expect_line == b'...\n': + next_expect_line, expect = pop_line(expect) + if next_expect_line is None: + if diff == b'': + return None + return diff + while not glob_line_matches(actual_line, next_expect_line): + actual_line, actual = pop_line(actual) + if actual_line is None: + diff += b"---\n" + diff += b"< " + diff += next_expect_line + return diff + expect_line = next_expect_line + continue + + if not glob_line_matches(actual_line, expect_line): + diff += b'---\n' + diff += b'< ' + expect_line + diff += b'> ' + actual_line + + actual_line, actual = pop_line(actual) + expect_line, expect = pop_line(expect) + + +class Options: + """Options configuring how to run a :TestCase:.""" + def __init__( + self, + env: typing.Dict[str, str], + timeout: typing.Optional[int], + verbose: bool, + preserve: bool, + scratch_dir: str, + test_dir: str, + set_exact_output: bool, + ) -> None: + self.env = env + self.timeout = timeout + self.verbose = verbose + self.preserve = preserve + self.scratch_dir = scratch_dir + self.test_dir = test_dir + self.set_exact_output = set_exact_output + + +class TestCase: + """ + Logic and state related to running a single test case. + + 1. Initialize the test case. + 2. Launch the test case with :TestCase.launch():. + This will start the test execution in a subprocess, but + not wait for completion. So you could launch multiple test + cases in parallel. This will now print any test output. + 3. Analyze the results with :TestCase.analyze():. This will + join the test subprocess, check the results against the + expectations, and print the results to stdout. + + :TestCase.run(): is also provided which combines the launch & analyze + steps for single-threaded use-cases. + + All other methods, prefixed with _, are private helper functions. + """ + def __init__(self, test_filename: str, options: Options) -> None: + """ + Initialize the :TestCase: for the test located in :test_filename: + with the given :options:. + """ + self._opts = options + self._test_file = test_filename + self._test_name = os.path.normpath( + os.path.relpath(test_filename, start=self._opts.test_dir) + ) + self._success = {} + self._message = {} + self._test_stdin = None + self._scratch_dir = os.path.abspath(os.path.join(self._opts.scratch_dir, self._test_name)) + + @property + def name(self) -> str: + """Returns the unique name for the test.""" + return self._test_name + + def launch(self) -> None: + """ + Launch the test case as a subprocess, but do not block on completion. + This allows users to run multiple tests in parallel. Results aren't yet + printed out. + """ + self._launch_test() + + def analyze(self) -> bool: + """ + Must be called after :TestCase.launch():. Joins the test subprocess and + checks the results against expectations. Finally prints the results to + stdout and returns the success. + """ + self._join_test() + self._check_exit() + self._check_stderr() + self._check_stdout() + self._analyze_results() + return self._succeeded + + def run(self) -> bool: + """Shorthand for combining both :TestCase.launch(): and :TestCase.analyze():.""" + self.launch() + return self.analyze() + + def _log(self, *args, **kwargs) -> None: + """Logs test output.""" + print(file=sys.stdout, *args, **kwargs) + + def _vlog(self, *args, **kwargs) -> None: + """Logs verbose test output.""" + if self._opts.verbose: + print(file=sys.stdout, *args, **kwargs) + + def _test_environment(self) -> typing.Dict[str, str]: + """ + Returns the environment to be used for the + test subprocess. + """ + # We want to omit ZSTD cli flags so tests will be consistent across environments + env = {k: v for k, v in os.environ.items() if not k.startswith("ZSTD")} + for k, v in self._opts.env.items(): + self._vlog(f"${k}='{v}'") + env[k] = v + return env + + def _launch_test(self) -> None: + """Launch the test subprocess, but do not join it.""" + args = [os.path.abspath(self._test_file)] + stdin_name = f"{self._test_file}.stdin" + if os.path.exists(stdin_name): + self._test_stdin = open(stdin_name, "rb") + stdin = self._test_stdin + else: + stdin = subprocess.DEVNULL + cwd = self._scratch_dir + env = self._test_environment() + self._test_process = subprocess.Popen( + args=args, + stdin=stdin, + cwd=cwd, + env=env, + stderr=subprocess.PIPE, + stdout=subprocess.PIPE + ) + + def _join_test(self) -> None: + """Join the test process and save stderr, stdout, and the exit code.""" + (stdout, stderr) = self._test_process.communicate(timeout=self._opts.timeout) + self._output = {} + self._output["stdout"] = stdout + self._output["stderr"] = stderr + self._exit_code = self._test_process.returncode + self._test_process = None + if self._test_stdin is not None: + self._test_stdin.close() + self._test_stdin = None + + def _check_output_exact(self, out_name: str, expected: bytes, exact_name: str) -> None: + """ + Check the output named :out_name: for an exact match against the :expected: content. + Saves the success and message. + """ + check_name = f"check_{out_name}" + actual = self._output[out_name] + if actual == expected: + self._success[check_name] = True + self._message[check_name] = f"{out_name} matches!" + else: + self._success[check_name] = False + self._message[check_name] = f"{out_name} does not match!\n> diff expected actual\n{diff(expected, actual)}" + + if self._opts.set_exact_output: + with open(exact_name, "wb") as f: + f.write(actual) + + def _check_output_glob(self, out_name: str, expected: bytes) -> None: + """ + Check the output named :out_name: for a glob match against the :expected: glob. + Saves the success and message. + """ + check_name = f"check_{out_name}" + actual = self._output[out_name] + diff = glob_diff(actual, expected) + if diff is None: + self._success[check_name] = True + self._message[check_name] = f"{out_name} matches!" + else: + utf8_diff = diff.decode('utf8') + self._success[check_name] = False + self._message[check_name] = f"{out_name} does not match!\n> diff expected actual\n{utf8_diff}" + + def _check_output(self, out_name: str) -> None: + """ + Checks the output named :out_name: for a match against the expectation. + We check for a .exact, .glob, and a .ignore file. If none are found we + expect that the output should be empty. + + If :Options.preserve: was set then we save the scratch directory and + save the stderr, stdout, and exit code to the scratch directory for + debugging. + """ + if self._opts.preserve: + # Save the output to the scratch directory + actual_name = os.path.join(self._scratch_dir, f"{out_name}") + with open(actual_name, "wb") as f: + f.write(self._output[out_name]) + + exact_name = f"{self._test_file}.{out_name}.exact" + glob_name = f"{self._test_file}.{out_name}.glob" + ignore_name = f"{self._test_file}.{out_name}.ignore" + + if os.path.exists(exact_name): + return self._check_output_exact(out_name, read_file(exact_name), exact_name) + elif os.path.exists(glob_name): + return self._check_output_glob(out_name, read_file(glob_name)) + else: + check_name = f"check_{out_name}" + self._success[check_name] = True + self._message[check_name] = f"{out_name} ignored!" + + def _check_stderr(self) -> None: + """Checks the stderr output against the expectation.""" + self._check_output("stderr") + + def _check_stdout(self) -> None: + """Checks the stdout output against the expectation.""" + self._check_output("stdout") + + def _check_exit(self) -> None: + """ + Checks the exit code against expectations. If a .exit file + exists, we expect that the exit code matches the contents. + Otherwise we expect the exit code to be zero. + + If :Options.preserve: is set we save the exit code to the + scratch directory under the filename "exit". + """ + if self._opts.preserve: + exit_name = os.path.join(self._scratch_dir, "exit") + with open(exit_name, "w") as f: + f.write(str(self._exit_code) + "\n") + exit_name = f"{self._test_file}.exit" + if os.path.exists(exit_name): + exit_code: int = int(read_file(exit_name)) + else: + exit_code: int = 0 + if exit_code == self._exit_code: + self._success["check_exit"] = True + self._message["check_exit"] = "Exit code matches!" + else: + self._success["check_exit"] = False + self._message["check_exit"] = f"Exit code mismatch! Expected {exit_code} but got {self._exit_code}" + + def _analyze_results(self) -> None: + """ + After all tests have been checked, collect all the successes + and messages, and print the results to stdout. + """ + STATUS = {True: "PASS", False: "FAIL"} + checks = sorted(self._success.keys()) + self._succeeded = all(self._success.values()) + self._log(f"{STATUS[self._succeeded]}: {self._test_name}") + + if not self._succeeded or self._opts.verbose: + for check in checks: + if self._opts.verbose or not self._success[check]: + self._log(f"{STATUS[self._success[check]]}: {self._test_name}.{check}") + self._log(self._message[check]) + + self._log("----------------------------------------") + + +class TestSuite: + """ + Setup & teardown test suite & cases. + This class is intended to be used as a context manager. + + TODO: Make setup/teardown failure emit messages, not throw exceptions. + """ + def __init__(self, test_directory: str, options: Options) -> None: + self._opts = options + self._test_dir = os.path.abspath(test_directory) + rel_test_dir = os.path.relpath(test_directory, start=self._opts.test_dir) + assert not rel_test_dir.startswith(os.path.sep) + self._scratch_dir = os.path.normpath(os.path.join(self._opts.scratch_dir, rel_test_dir)) + + def __enter__(self) -> 'TestSuite': + self._setup_once() + return self + + def __exit__(self, _exc_type, _exc_value, _traceback) -> None: + self._teardown_once() + + @contextlib.contextmanager + def test_case(self, test_basename: str) -> TestCase: + """ + Context manager for a test case in the test suite. + Pass the basename of the test relative to the :test_directory:. + """ + assert os.path.dirname(test_basename) == "" + try: + self._setup(test_basename) + test_filename = os.path.join(self._test_dir, test_basename) + yield TestCase(test_filename, self._opts) + finally: + self._teardown(test_basename) + + def _remove_scratch_dir(self, dir: str) -> None: + """Helper to remove a scratch directory with sanity checks""" + assert "scratch" in dir + assert dir.startswith(self._scratch_dir) + assert os.path.exists(dir) + shutil.rmtree(dir) + + def _setup_once(self) -> None: + if os.path.exists(self._scratch_dir): + self._remove_scratch_dir(self._scratch_dir) + os.makedirs(self._scratch_dir) + setup_script = os.path.join(self._test_dir, "setup_once") + if os.path.exists(setup_script): + self._run_script(setup_script, cwd=self._scratch_dir) + + def _teardown_once(self) -> None: + assert os.path.exists(self._scratch_dir) + teardown_script = os.path.join(self._test_dir, "teardown_once") + if os.path.exists(teardown_script): + self._run_script(teardown_script, cwd=self._scratch_dir) + if not self._opts.preserve: + self._remove_scratch_dir(self._scratch_dir) + + def _setup(self, test_basename: str) -> None: + test_scratch_dir = os.path.join(self._scratch_dir, test_basename) + assert not os.path.exists(test_scratch_dir) + os.makedirs(test_scratch_dir) + setup_script = os.path.join(self._test_dir, "setup") + if os.path.exists(setup_script): + self._run_script(setup_script, cwd=test_scratch_dir) + + def _teardown(self, test_basename: str) -> None: + test_scratch_dir = os.path.join(self._scratch_dir, test_basename) + assert os.path.exists(test_scratch_dir) + teardown_script = os.path.join(self._test_dir, "teardown") + if os.path.exists(teardown_script): + self._run_script(teardown_script, cwd=test_scratch_dir) + if not self._opts.preserve: + self._remove_scratch_dir(test_scratch_dir) + + def _run_script(self, script: str, cwd: str) -> None: + env = copy.copy(os.environ) + for k, v in self._opts.env.items(): + env[k] = v + try: + subprocess.run( + args=[script], + stdin=subprocess.DEVNULL, + capture_output=True, + cwd=cwd, + env=env, + check=True, + ) + except subprocess.CalledProcessError as e: + print(f"{script} failed with exit code {e.returncode}!") + print(f"stderr:\n{e.stderr}") + print(f"stdout:\n{e.stdout}") + raise + +TestSuites = typing.Dict[str, typing.List[str]] + +def get_all_tests(options: Options) -> TestSuites: + """ + Find all the test in the test directory and return the test suites. + """ + test_suites = {} + for root, dirs, files in os.walk(options.test_dir, topdown=True): + dirs[:] = [d for d in dirs if not exclude_dir(d)] + test_cases = [] + for file in files: + if not exclude_file(file): + test_cases.append(file) + assert root == os.path.normpath(root) + test_suites[root] = test_cases + return test_suites + + +def resolve_listed_tests( + tests: typing.List[str], options: Options +) -> TestSuites: + """ + Resolve the list of tests passed on the command line into their + respective test suites. Tests can either be paths, or test names + relative to the test directory. + """ + test_suites = {} + for test in tests: + if not os.path.exists(test): + test = os.path.join(options.test_dir, test) + if not os.path.exists(test): + raise RuntimeError(f"Test {test} does not exist!") + + test = os.path.normpath(os.path.abspath(test)) + assert test.startswith(options.test_dir) + test_suite = os.path.dirname(test) + test_case = os.path.basename(test) + test_suites.setdefault(test_suite, []).append(test_case) + + return test_suites + +def run_tests(test_suites: TestSuites, options: Options) -> bool: + """ + Runs all the test in the :test_suites: with the given :options:. + Prints the results to stdout. + """ + tests = {} + for test_dir, test_files in test_suites.items(): + with TestSuite(test_dir, options) as test_suite: + test_files = sorted(set(test_files)) + for test_file in test_files: + with test_suite.test_case(test_file) as test_case: + tests[test_case.name] = test_case.run() + + successes = 0 + for test, status in tests.items(): + if status: + successes += 1 + else: + print(f"FAIL: {test}") + if successes == len(tests): + print(f"PASSED all {len(tests)} tests!") + return True + else: + print(f"FAILED {len(tests) - successes} / {len(tests)} tests!") + return False + + +def setup_zstd_symlink_dir(zstd_symlink_dir: str, zstd: str) -> None: + assert os.path.join("bin", "symlinks") in zstd_symlink_dir + if not os.path.exists(zstd_symlink_dir): + os.makedirs(zstd_symlink_dir) + for symlink in ZSTD_SYMLINKS: + path = os.path.join(zstd_symlink_dir, symlink) + if os.path.exists(path): + os.remove(path) + os.symlink(zstd, path) + +if __name__ == "__main__": + CLI_TEST_DIR = os.path.dirname(sys.argv[0]) + REPO_DIR = os.path.join(CLI_TEST_DIR, "..", "..") + PROGRAMS_DIR = os.path.join(REPO_DIR, "programs") + TESTS_DIR = os.path.join(REPO_DIR, "tests") + ZSTD_PATH = os.path.join(PROGRAMS_DIR, "zstd") + ZSTDGREP_PATH = os.path.join(PROGRAMS_DIR, "zstdgrep") + ZSTDLESS_PATH = os.path.join(PROGRAMS_DIR, "zstdless") + DATAGEN_PATH = os.path.join(TESTS_DIR, "datagen") + + parser = argparse.ArgumentParser( + ( + "Runs the zstd CLI tests. Exits nonzero on failure. Default arguments are\n" + "generally correct. Pass --preserve to preserve test output for debugging,\n" + "and --verbose to get verbose test output.\n" + ) + ) + parser.add_argument( + "--preserve", + action="store_true", + help="Preserve the scratch directory TEST_DIR/scratch/ for debugging purposes." + ) + parser.add_argument("--verbose", action="store_true", help="Verbose test output.") + parser.add_argument("--timeout", default=60, type=int, help="Test case timeout in seconds. Set to 0 to disable timeouts.") + parser.add_argument( + "--exec-prefix", + default=None, + help="Sets the EXEC_PREFIX environment variable. Prefix to invocations of the zstd CLI." + ) + parser.add_argument( + "--zstd", + default=ZSTD_PATH, + help="Sets the ZSTD_BIN environment variable. Path of the zstd CLI." + ) + parser.add_argument( + "--zstdgrep", + default=ZSTDGREP_PATH, + help="Sets the ZSTDGREP_BIN environment variable. Path of the zstdgrep CLI." + ) + parser.add_argument( + "--zstdless", + default=ZSTDLESS_PATH, + help="Sets the ZSTDLESS_BIN environment variable. Path of the zstdless CLI." + ) + parser.add_argument( + "--datagen", + default=DATAGEN_PATH, + help="Sets the DATAGEN_BIN environment variable. Path to the datagen CLI." + ) + parser.add_argument( + "--test-dir", + default=CLI_TEST_DIR, + help=( + "Runs the tests under this directory. " + "Adds TEST_DIR/bin/ to path. " + "Scratch directory located in TEST_DIR/scratch/." + ) + ) + parser.add_argument( + "--set-exact-output", + action="store_true", + help="Set stderr.exact and stdout.exact for all failing tests, unless .ignore or .glob already exists" + ) + parser.add_argument( + "tests", + nargs="*", + help="Run only these test cases. Can either be paths or test names relative to TEST_DIR/" + ) + args = parser.parse_args() + + if args.timeout <= 0: + args.timeout = None + + args.test_dir = os.path.normpath(os.path.abspath(args.test_dir)) + bin_dir = os.path.abspath(os.path.join(args.test_dir, "bin")) + zstd_symlink_dir = os.path.join(bin_dir, "symlinks") + scratch_dir = os.path.join(args.test_dir, "scratch") + + setup_zstd_symlink_dir(zstd_symlink_dir, os.path.abspath(args.zstd)) + + env = {} + if args.exec_prefix is not None: + env["EXEC_PREFIX"] = args.exec_prefix + env["ZSTD_SYMLINK_DIR"] = zstd_symlink_dir + env["ZSTD_REPO_DIR"] = os.path.abspath(REPO_DIR) + env["DATAGEN_BIN"] = os.path.abspath(args.datagen) + env["ZSTDGREP_BIN"] = os.path.abspath(args.zstdgrep) + env["ZSTDLESS_BIN"] = os.path.abspath(args.zstdless) + env["COMMON"] = os.path.abspath(os.path.join(args.test_dir, "common")) + env["PATH"] = bin_dir + ":" + os.getenv("PATH", "") + env["LC_ALL"] = "C" + + opts = Options( + env=env, + timeout=args.timeout, + verbose=args.verbose, + preserve=args.preserve, + test_dir=args.test_dir, + scratch_dir=scratch_dir, + set_exact_output=args.set_exact_output, + ) + + if len(args.tests) == 0: + tests = get_all_tests(opts) + else: + tests = resolve_listed_tests(args.tests, opts) + + success = run_tests(tests, opts) + if success: + sys.exit(0) + else: + sys.exit(1) diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/setup b/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/setup new file mode 100755 index 0000000..cf391ed --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/setup @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +println "hello" > hello +println "world" > world +zstd hello world diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/zstdcat.sh b/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/zstdcat.sh new file mode 100755 index 0000000..74ec063 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/zstdcat.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Test zstdcat symlink in bin/ +zstdcat hello.zst +zstdcat hello.zst world +zstdcat hello world.zst +zstdcat hello.zst world.zst + +# Test local zstdcat symlink +ln -s $(which zstd) ./zstdcat +./zstdcat hello.zst diff --git a/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/zstdcat.sh.stdout.exact b/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/zstdcat.sh.stdout.exact new file mode 100644 index 0000000..3205b05 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/cli-tests/zstd-symlinks/zstdcat.sh.stdout.exact @@ -0,0 +1,8 @@ +hello +hello +world +hello +world +hello +world +hello diff --git a/src/dependencies/zstd-1.5.0/tests/datagencli.c b/src/dependencies/zstd-1.5.4/tests/datagencli.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/datagencli.c rename to src/dependencies/zstd-1.5.4/tests/datagencli.c index ecc05f9..09ec5e9 100644 --- a/src/dependencies/zstd-1.5.0/tests/datagencli.c +++ b/src/dependencies/zstd-1.5.4/tests/datagencli.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -124,7 +124,7 @@ int main(int argc, const char** argv) DISPLAYLEVEL(3, "Seed = %u \n", (unsigned)seed); RDG_genStdout(size, (double)probaU32/100, litProba, seed); - DISPLAYLEVEL(1, "\n"); + DISPLAYLEVEL(3, "\n"); return 0; } diff --git a/src/dependencies/zstd-1.5.0/tests/decodecorpus.c b/src/dependencies/zstd-1.5.4/tests/decodecorpus.c similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/decodecorpus.c rename to src/dependencies/zstd-1.5.4/tests/decodecorpus.c index fa6a2d6..148088a 100644 --- a/src/dependencies/zstd-1.5.0/tests/decodecorpus.c +++ b/src/dependencies/zstd-1.5.4/tests/decodecorpus.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -14,6 +14,7 @@ #include #include #include +#include /* time(), for seed random initialization */ #include "util.h" #include "timefn.h" /* UTIL_clockSpanMicro, SEC_TO_MICRO, UTIL_TIME_INITIALIZER */ @@ -24,21 +25,13 @@ #include "zdict.h" /* Direct access to internal compression functions is required */ -#include "zstd_compress.c" +#include "compress/zstd_compress.c" /* ZSTD_resetSeqStore, ZSTD_storeSeq, *_TO_OFFBASE, HIST_countFast_wksp, HIST_isError */ #define XXH_STATIC_LINKING_ONLY #include "xxhash.h" /* XXH64 */ -#ifndef MIN - #define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -#ifndef MAX_PATH - #ifdef PATH_MAX - #define MAX_PATH PATH_MAX - #else - #define MAX_PATH 256 - #endif +#if !(defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)) +# define inline /* disable */ #endif /*-************************************ @@ -70,6 +63,7 @@ static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER; } \ } while (0) + /*-******************************************************* * Random function *********************************************************/ @@ -136,7 +130,7 @@ static void RAND_genDist(U32* seed, BYTE* dist, double weight) BYTE step = (BYTE) ((RAND(seed) % 256) | 1); /* force it to be odd so it's relatively prime to 256 */ while (i < DISTSIZE) { - size_t states = ((size_t)(weight * statesLeft)) + 1; + size_t states = ((size_t)(weight * (double)statesLeft)) + 1; size_t j; for (j = 0; j < states && i < DISTSIZE; j++, i++) { dist[i] = symb; @@ -165,7 +159,7 @@ static double RAND_exp(U32* seed, double mean) /*-******************************************************* * Constants and Structs *********************************************************/ -const char *BLOCK_TYPES[] = {"raw", "rle", "compressed"}; +const char* BLOCK_TYPES[] = {"raw", "rle", "compressed"}; #define MAX_DECOMPRESSED_SIZE_LOG 20 #define MAX_DECOMPRESSED_SIZE (1ULL << MAX_DECOMPRESSED_SIZE_LOG) @@ -175,6 +169,14 @@ const char *BLOCK_TYPES[] = {"raw", "rle", "compressed"}; #define MIN_SEQ_LEN (3) #define MAX_NB_SEQ ((ZSTD_BLOCKSIZE_MAX + MIN_SEQ_LEN - 1) / MIN_SEQ_LEN) +#ifndef MAX_PATH + #ifdef PATH_MAX + #define MAX_PATH PATH_MAX + #else + #define MAX_PATH 256 + #endif +#endif + BYTE CONTENT_BUFFER[MAX_DECOMPRESSED_SIZE]; BYTE FRAME_BUFFER[MAX_DECOMPRESSED_SIZE * 2]; BYTE LITERAL_BUFFER[ZSTD_BLOCKSIZE_MAX]; @@ -185,7 +187,7 @@ BYTE SEQUENCE_LLCODE[ZSTD_BLOCKSIZE_MAX]; BYTE SEQUENCE_MLCODE[ZSTD_BLOCKSIZE_MAX]; BYTE SEQUENCE_OFCODE[ZSTD_BLOCKSIZE_MAX]; -unsigned WKSP[HUF_WORKSPACE_SIZE_U32]; +U64 WKSP[HUF_WORKSPACE_SIZE_U64]; typedef struct { size_t contentSize; /* 0 means unknown (unless contentSize == windowSize == 0) */ @@ -199,7 +201,7 @@ typedef struct { int hufInit; /* the distribution used in the previous block for repeat mode */ BYTE hufDist[DISTSIZE]; - HUF_CElt hufTable [256]; + HUF_CElt hufTable [HUF_CTABLE_SIZE_ST(255)]; int fseInit; FSE_CTable offcodeCTable [FSE_CTABLE_SIZE_U32(OffFSELog, MaxOff)]; @@ -240,6 +242,10 @@ typedef enum { gt_block, /* generate compressed blocks without block/frame headers */ } genType_e; +#ifndef MIN + #define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + /*-******************************************************* * Global variables (set from command line) *********************************************************/ @@ -454,7 +460,7 @@ static size_t writeHufHeader(U32* seed, HUF_CElt* hufTable, void* dst, size_t ds } /* Write table description header */ - { size_t const hSize = HUF_writeCTable (op, dstSize, hufTable, maxSymbolValue, huffLog); + { size_t const hSize = HUF_writeCTable_wksp (op, dstSize, hufTable, maxSymbolValue, huffLog, WKSP, sizeof(WKSP)); if (hSize + 12 >= srcSize) return 0; /* not useful to try compression */ op += hSize; } @@ -558,10 +564,10 @@ static size_t writeLiteralsBlockCompressed(U32* seed, frame_t* frame, size_t con sizeFormat == 0 ? HUF_compress1X_usingCTable( op, opend - op, LITERAL_BUFFER, litSize, - frame->stats.hufTable) + frame->stats.hufTable, /* flags */ 0) : HUF_compress4X_usingCTable( op, opend - op, LITERAL_BUFFER, litSize, - frame->stats.hufTable); + frame->stats.hufTable, /* flags */ 0); CHECKERR(compressedSize); /* this only occurs when it could not compress or similar */ } while (compressedSize <= 0); @@ -633,17 +639,16 @@ static inline void initSeqStore(seqStore_t *seqStore) { } /* Randomly generate sequence commands */ -static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore, - size_t contentSize, size_t literalsSize, dictInfo info) +static U32 +generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore, + size_t contentSize, size_t literalsSize, dictInfo info) { /* The total length of all the matches */ size_t const remainingMatch = contentSize - literalsSize; size_t excessMatch = 0; U32 numSequences = 0; - U32 i; - const BYTE* literals = LITERAL_BUFFER; BYTE* srcPtr = frame->src; @@ -663,16 +668,16 @@ static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore, * ensure nice numbers */ U32 matchLen = MIN_SEQ_LEN + - ROUND(RAND_exp(seed, excessMatch / (double)(numSequences - i))); + ROUND(RAND_exp(seed, (double)excessMatch / (double)(numSequences - i))); U32 literalLen = (RAND(seed) & 7) ? ROUND(RAND_exp(seed, - literalsSize / + (double)literalsSize / (double)(numSequences - i))) : 0; /* actual offset, code to send, and point to copy up to when shifting * codes in the repeat offsets history */ - U32 offset, offsetCode, repIndex; + U32 offset, offBase, repIndex; /* bounds checks */ matchLen = (U32) MIN(matchLen, excessMatch + MIN_SEQ_LEN); @@ -703,32 +708,31 @@ static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore, lenPastStart = MIN(lenPastStart+MIN_SEQ_LEN, (U32)info.dictContentSize); offset = (U32)((BYTE*)srcPtr - (BYTE*)frame->srcStart) + lenPastStart; } - { - U32 const matchLenBound = MIN(frame->header.windowSize, lenPastStart); + { U32 const matchLenBound = MIN(frame->header.windowSize, lenPastStart); matchLen = MIN(matchLen, matchLenBound); } } } - offsetCode = offset + ZSTD_REP_MOVE; + offBase = OFFSET_TO_OFFBASE(offset); repIndex = 2; } else { /* do a repeat offset */ - offsetCode = RAND(seed) % 3; + U32 const randomRepIndex = RAND(seed) % 3; + offBase = REPCODE_TO_OFFBASE(randomRepIndex + 1); /* expects values between 1 & 3 */ if (literalLen > 0) { - offset = frame->stats.rep[offsetCode]; - repIndex = offsetCode; + offset = frame->stats.rep[randomRepIndex]; + repIndex = randomRepIndex; } else { - /* special case */ - offset = offsetCode == 2 ? frame->stats.rep[0] - 1 - : frame->stats.rep[offsetCode + 1]; - repIndex = MIN(2, offsetCode + 1); + /* special case : literalLen == 0 */ + offset = randomRepIndex == 2 ? frame->stats.rep[0] - 1 + : frame->stats.rep[randomRepIndex + 1]; + repIndex = MIN(2, randomRepIndex + 1); } } } while (((!info.useDict) && (offset > (size_t)((BYTE*)srcPtr - (BYTE*)frame->srcStart))) || offset == 0); - { + { BYTE* const dictEnd = info.dictContent + info.dictContentSize; size_t j; - BYTE* const dictEnd = info.dictContent + info.dictContentSize; for (j = 0; j < matchLen; j++) { if ((U32)((BYTE*)srcPtr - (BYTE*)frame->srcStart) < offset) { /* copy from dictionary instead of literals */ @@ -739,8 +743,7 @@ static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore, *srcPtr = *(srcPtr-offset); } srcPtr++; - } - } + } } { int r; for (r = repIndex; r > 0; r--) { @@ -754,12 +757,12 @@ static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore, DISPLAYLEVEL(7, " srcPos: %8u seqNb: %3u", (unsigned)((BYTE*)srcPtr - (BYTE*)frame->srcStart), (unsigned)i); DISPLAYLEVEL(6, "\n"); - if (offsetCode < 3) { + if (OFFBASE_IS_REPCODE(offBase)) { /* expects sumtype numeric representation of ZSTD_storeSeq() */ DISPLAYLEVEL(7, " repeat offset: %d\n", (int)repIndex); } /* use libzstd sequence handling */ ZSTD_storeSeq(seqStore, literalLen, literals, literals + literalLen, - offsetCode, matchLen - MINMATCH); + offBase, matchLen); literalsSize -= literalLen; excessMatch -= (matchLen - MIN_SEQ_LEN); @@ -768,8 +771,8 @@ static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore, memcpy(srcPtr, literals, literalsSize); srcPtr += literalsSize; - DISPLAYLEVEL(6, " excess literals: %5u", (unsigned)literalsSize); - DISPLAYLEVEL(7, " srcPos: %8u", (unsigned)((BYTE*)srcPtr - (BYTE*)frame->srcStart)); + DISPLAYLEVEL(6, " excess literals: %5u ", (unsigned)literalsSize); + DISPLAYLEVEL(7, "srcPos: %8u ", (unsigned)((BYTE*)srcPtr - (BYTE*)frame->srcStart)); DISPLAYLEVEL(6, "\n"); return numSequences; @@ -949,9 +952,9 @@ static size_t writeSequences(U32* seed, frame_t* frame, seqStore_t* seqStorePtr, FSE_initCState2(&stateLitLength, CTable_LitLength, llCodeTable[nbSeq-1]); BIT_addBits(&blockStream, sequences[nbSeq-1].litLength, LL_bits[llCodeTable[nbSeq-1]]); if (MEM_32bits()) BIT_flushBits(&blockStream); - BIT_addBits(&blockStream, sequences[nbSeq-1].matchLength, ML_bits[mlCodeTable[nbSeq-1]]); + BIT_addBits(&blockStream, sequences[nbSeq-1].mlBase, ML_bits[mlCodeTable[nbSeq-1]]); if (MEM_32bits()) BIT_flushBits(&blockStream); - BIT_addBits(&blockStream, sequences[nbSeq-1].offset, ofCodeTable[nbSeq-1]); + BIT_addBits(&blockStream, sequences[nbSeq-1].offBase, ofCodeTable[nbSeq-1]); BIT_flushBits(&blockStream); { size_t n; @@ -971,9 +974,9 @@ static size_t writeSequences(U32* seed, frame_t* frame, seqStore_t* seqStorePtr, BIT_flushBits(&blockStream); /* (7)*/ BIT_addBits(&blockStream, sequences[n].litLength, llBits); if (MEM_32bits() && ((llBits+mlBits)>24)) BIT_flushBits(&blockStream); - BIT_addBits(&blockStream, sequences[n].matchLength, mlBits); + BIT_addBits(&blockStream, sequences[n].mlBase, mlBits); if (MEM_32bits()) BIT_flushBits(&blockStream); /* (7)*/ - BIT_addBits(&blockStream, sequences[n].offset, ofBits); /* 31 */ + BIT_addBits(&blockStream, sequences[n].offBase, ofBits); /* 31 */ BIT_flushBits(&blockStream); /* (7)*/ } } diff --git a/src/dependencies/zstd-1.5.0/tests/dict-files/zero-weight-dict b/src/dependencies/zstd-1.5.4/tests/dict-files/zero-weight-dict similarity index 100% rename from src/dependencies/zstd-1.5.0/tests/dict-files/zero-weight-dict rename to src/dependencies/zstd-1.5.4/tests/dict-files/zero-weight-dict diff --git a/src/dependencies/zstd-1.5.4/tests/external_matchfinder.c b/src/dependencies/zstd-1.5.4/tests/external_matchfinder.c new file mode 100644 index 0000000..76ad411 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/external_matchfinder.c @@ -0,0 +1,140 @@ +/* + * Copyright (c) Yann Collet, Meta Platforms, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#include "external_matchfinder.h" +#include +#include "zstd_compress_internal.h" + +#define HSIZE 1024 +static U32 const HLOG = 10; +static U32 const MLS = 4; +static U32 const BADIDX = 0xffffffff; + +static size_t simpleSequenceProducer( + void* sequenceProducerState, + ZSTD_Sequence* outSeqs, size_t outSeqsCapacity, + const void* src, size_t srcSize, + const void* dict, size_t dictSize, + int compressionLevel, + size_t windowSize +) { + const BYTE* const istart = (const BYTE*)src; + const BYTE* const iend = istart + srcSize; + const BYTE* ip = istart; + const BYTE* anchor = istart; + size_t seqCount = 0; + U32 hashTable[HSIZE]; + + (void)sequenceProducerState; + (void)dict; + (void)dictSize; + (void)outSeqsCapacity; + (void)compressionLevel; + + { int i; + for (i=0; i < HSIZE; i++) { + hashTable[i] = BADIDX; + } } + + while (ip + MLS < iend) { + size_t const hash = ZSTD_hashPtr(ip, HLOG, MLS); + U32 const matchIndex = hashTable[hash]; + hashTable[hash] = (U32)(ip - istart); + + if (matchIndex != BADIDX) { + const BYTE* const match = istart + matchIndex; + U32 const matchLen = (U32)ZSTD_count(ip, match, iend); + if (matchLen >= ZSTD_MINMATCH_MIN) { + U32 const litLen = (U32)(ip - anchor); + U32 const offset = (U32)(ip - match); + ZSTD_Sequence const seq = { + offset, litLen, matchLen, 0 + }; + + /* Note: it's crucial to stay within the window size! */ + if (offset <= windowSize) { + outSeqs[seqCount++] = seq; + ip += matchLen; + anchor = ip; + continue; + } + } + } + + ip++; + } + + { ZSTD_Sequence const finalSeq = { + 0, (U32)(iend - anchor), 0, 0 + }; + outSeqs[seqCount++] = finalSeq; + } + + return seqCount; +} + +size_t zstreamSequenceProducer( + void* sequenceProducerState, + ZSTD_Sequence* outSeqs, size_t outSeqsCapacity, + const void* src, size_t srcSize, + const void* dict, size_t dictSize, + int compressionLevel, + size_t windowSize +) { + EMF_testCase const testCase = *((EMF_testCase*)sequenceProducerState); + memset(outSeqs, 0, outSeqsCapacity); + + switch (testCase) { + case EMF_ZERO_SEQS: + return 0; + case EMF_ONE_BIG_SEQ: + outSeqs[0].offset = 0; + outSeqs[0].matchLength = 0; + outSeqs[0].litLength = (U32)(srcSize); + return 1; + case EMF_LOTS_OF_SEQS: + return simpleSequenceProducer( + sequenceProducerState, + outSeqs, outSeqsCapacity, + src, srcSize, + dict, dictSize, + compressionLevel, + windowSize + ); + case EMF_INVALID_OFFSET: + outSeqs[0].offset = 1 << 20; + outSeqs[0].matchLength = 4; + outSeqs[0].litLength = (U32)(srcSize - 4); + return 1; + case EMF_INVALID_MATCHLEN: + outSeqs[0].offset = 1; + outSeqs[0].matchLength = (U32)(srcSize); + outSeqs[0].litLength = 1; + return 1; + case EMF_INVALID_LITLEN: + outSeqs[0].offset = 0; + outSeqs[0].matchLength = 0; + outSeqs[0].litLength = (U32)(srcSize + 1); + return 1; + case EMF_INVALID_LAST_LITS: + outSeqs[0].offset = 1; + outSeqs[0].matchLength = 1; + outSeqs[0].litLength = 1; + outSeqs[1].offset = 0; + outSeqs[1].matchLength = 0; + outSeqs[1].litLength = (U32)(srcSize - 1); + return 2; + case EMF_SMALL_ERROR: + return outSeqsCapacity + 1; + case EMF_BIG_ERROR: + default: + return ZSTD_SEQUENCE_PRODUCER_ERROR; + } +} diff --git a/src/dependencies/zstd-1.5.4/tests/external_matchfinder.h b/src/dependencies/zstd-1.5.4/tests/external_matchfinder.h new file mode 100644 index 0000000..e38dc25 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/external_matchfinder.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) Yann Collet, Meta Platforms, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +#ifndef EXTERNAL_MATCHFINDER +#define EXTERNAL_MATCHFINDER + +#define ZSTD_STATIC_LINKING_ONLY +#include "zstd.h" + +/* See external_matchfinder.c for details on each test case */ +typedef enum { + EMF_ZERO_SEQS = 0, + EMF_ONE_BIG_SEQ = 1, + EMF_LOTS_OF_SEQS = 2, + EMF_BIG_ERROR = 3, + EMF_SMALL_ERROR = 4, + EMF_INVALID_OFFSET = 5, + EMF_INVALID_MATCHLEN = 6, + EMF_INVALID_LITLEN = 7, + EMF_INVALID_LAST_LITS = 8 +} EMF_testCase; + +size_t zstreamSequenceProducer( + void* sequenceProducerState, + ZSTD_Sequence* outSeqs, size_t outSeqsCapacity, + const void* src, size_t srcSize, + const void* dict, size_t dictSize, + int compressionLevel, + size_t windowSize +); + +#endif /* EXTERNAL_MATCHFINDER */ diff --git a/src/dependencies/zstd-1.5.0/tests/fullbench.c b/src/dependencies/zstd-1.5.4/tests/fullbench.c similarity index 95% rename from src/dependencies/zstd-1.5.0/tests/fullbench.c rename to src/dependencies/zstd-1.5.4/tests/fullbench.c index a71117e..3a72d89 100644 --- a/src/dependencies/zstd-1.5.0/tests/fullbench.c +++ b/src/dependencies/zstd-1.5.4/tests/fullbench.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -108,7 +108,25 @@ local_ZSTD_compress(const void* src, size_t srcSize, p.fParams = f; p.cParams = *(ZSTD_compressionParameters*)payload; return ZSTD_compress_advanced (g_zcc, dst, dstSize, src, srcSize, NULL ,0, p); - //return ZSTD_compress(dst, dstSize, src, srcSize, cLevel); +} + +static size_t +local_ZSTD_compress_freshCCtx(const void* src, size_t srcSize, + void* dst, size_t dstSize, + void* payload) +{ + ZSTD_parameters p; + ZSTD_frameParameters f = { 1 /* contentSizeHeader*/, 0, 0 }; + p.fParams = f; + p.cParams = *(ZSTD_compressionParameters*)payload; + if (g_zcc != NULL) ZSTD_freeCCtx(g_zcc); + g_zcc = ZSTD_createCCtx(); + assert(g_zcc != NULL); + { size_t const r = ZSTD_compress_advanced (g_zcc, dst, dstSize, src, srcSize, NULL ,0, p); + ZSTD_freeCCtx(g_zcc); + g_zcc = NULL; + return r; + } } static size_t g_cSize = 0; @@ -123,11 +141,15 @@ static size_t local_ZSTD_decompress(const void* src, size_t srcSize, static ZSTD_DCtx* g_zdc = NULL; #ifndef ZSTD_DLL_IMPORT -extern size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* ctx, const void* src, size_t srcSize); +typedef enum { + not_streaming = 0, + is_streaming = 1 +} streaming_operation; +extern size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* ctx, const void* src, size_t srcSize, void* dst, size_t dstCapacity, const streaming_operation streaming); static size_t local_ZSTD_decodeLiteralsBlock(const void* src, size_t srcSize, void* dst, size_t dstSize, void* buff2) { (void)src; (void)srcSize; (void)dst; (void)dstSize; - return ZSTD_decodeLiteralsBlock(g_zdc, buff2, g_cSize); + return ZSTD_decodeLiteralsBlock(g_zdc, buff2, g_cSize, dst, dstSize, not_streaming); } static size_t local_ZSTD_decodeSeqHeaders(const void* src, size_t srcSize, void* dst, size_t dstSize, void* buff2) @@ -149,6 +171,7 @@ FORCE_NOINLINE size_t ZSTD_decodeLiteralsHeader(ZSTD_DCtx* dctx, void const* src size_t lhSize, litSize, litCSize; U32 const lhlCode = (istart[0] >> 2) & 3; U32 const lhc = MEM_readLE32(istart); + int const flags = ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0; switch(lhlCode) { case 0: case 1: default: /* note : default is impossible, since lhlCode into [0..3] */ @@ -173,16 +196,16 @@ FORCE_NOINLINE size_t ZSTD_decodeLiteralsHeader(ZSTD_DCtx* dctx, void const* src RETURN_ERROR_IF(litSize > ZSTD_BLOCKSIZE_MAX, corruption_detected, ""); RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected, ""); #ifndef HUF_FORCE_DECOMPRESS_X2 - return HUF_readDTableX1_wksp_bmi2( + return HUF_readDTableX1_wksp( dctx->entropy.hufTable, istart+lhSize, litCSize, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + flags); #else return HUF_readDTableX2_wksp( dctx->entropy.hufTable, istart+lhSize, litCSize, - dctx->workspace, sizeof(dctx->workspace)); + dctx->workspace, sizeof(dctx->workspace), flags); #endif } } @@ -226,14 +249,15 @@ local_ZSTD_compressStream_freshCCtx(const void* src, size_t srcSize, void* dst, size_t dstCapacity, void* payload) { - ZSTD_CCtx* const cctx = ZSTD_createCCtx(); - size_t r; - assert(cctx != NULL); + if (g_cstream != NULL) ZSTD_freeCCtx(g_cstream); + g_cstream = ZSTD_createCCtx(); + assert(g_cstream != NULL); - r = local_ZSTD_compressStream(src, srcSize, dst, dstCapacity, payload); - - ZSTD_freeCCtx(cctx); - return r; + { size_t const r = local_ZSTD_compressStream(src, srcSize, dst, dstCapacity, payload); + ZSTD_freeCCtx(g_cstream); + g_cstream = NULL; + return r; + } } static size_t @@ -426,6 +450,9 @@ static int benchMem(unsigned benchNb, case 2: benchFunction = local_ZSTD_decompress; benchName = "decompress"; break; + case 3: + benchFunction = local_ZSTD_compress_freshCCtx; benchName = "compress_freshCCtx"; + break; #ifndef ZSTD_DLL_IMPORT case 11: benchFunction = local_ZSTD_compressContinue; benchName = "compressContinue"; @@ -504,7 +531,6 @@ static int benchMem(unsigned benchNb, ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_targetLength, (int)cparams.targetLength); ZSTD_CCtx_setParameter(g_zcc, ZSTD_c_strategy, cparams.strategy); - ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_compressionLevel, cLevel); ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_windowLog, (int)cparams.windowLog); ZSTD_CCtx_setParameter(g_cstream, ZSTD_c_hashLog, (int)cparams.hashLog); @@ -523,6 +549,9 @@ static int benchMem(unsigned benchNb, case 2: g_cSize = ZSTD_compress(dstBuff2, dstBuffSize, src, srcSize, cLevel); break; + case 3: + payload = &cparams; + break; #ifndef ZSTD_DLL_IMPORT case 11: payload = &cparams; @@ -577,7 +606,7 @@ static int benchMem(unsigned benchNb, ip += ZSTD_blockHeaderSize; /* skip block header */ ZSTD_decompressBegin(g_zdc); CONTROL(iend > ip); - ip += ZSTD_decodeLiteralsBlock(g_zdc, ip, (size_t)(iend-ip)); /* skip literal segment */ + ip += ZSTD_decodeLiteralsBlock(g_zdc, ip, (size_t)(iend-ip), dstBuff, dstBuffSize, not_streaming); /* skip literal segment */ g_cSize = (size_t)(iend-ip); memcpy(dstBuff2, ip, g_cSize); /* copy rest of block (it starts by SeqHeader) */ srcSize = srcSize > 128 KB ? 128 KB : srcSize; /* speed relative to block */ diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/.gitignore b/src/dependencies/zstd-1.5.4/tests/fuzz/.gitignore similarity index 93% rename from src/dependencies/zstd-1.5.0/tests/fuzz/.gitignore rename to src/dependencies/zstd-1.5.4/tests/fuzz/.gitignore index 93d935a..28f2b8d 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/.gitignore +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/.gitignore @@ -17,6 +17,8 @@ decompress_dstSize_tooSmall fse_read_ncount sequence_compression_api seekable_roundtrip +huf_decompress +huf_round_trip fuzz-*.log rt_lib_* d_lib_* diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/Makefile b/src/dependencies/zstd-1.5.4/tests/fuzz/Makefile similarity index 80% rename from src/dependencies/zstd-1.5.0/tests/fuzz/Makefile rename to src/dependencies/zstd-1.5.4/tests/fuzz/Makefile index ccb574b..bbb262a 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/Makefile +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -12,6 +12,7 @@ CFLAGS ?= -O3 CXXFLAGS ?= -O3 CPPFLAGS ?= +ASFLAGS ?= LDFLAGS ?= ARFLAGS ?= LIB_FUZZING_ENGINE ?= libregression.a @@ -23,20 +24,32 @@ else endif CORPORA_URL_PREFIX:=https://github.com/facebook/zstd/releases/download/fuzz-corpora/ +LIBZSTD = ../../lib +DEBUGLEVEL ?= 2 +ZSTD_LEGACY_SUPPORT ?= 1 + +include $(LIBZSTD)/libzstd.mk + ZSTDDIR = ../../lib PRGDIR = ../../programs CONTRIBDIR = ../../contrib +# TODO(embg) make it possible to plug in an arbitrary matchfinder as a .o file +MATCHFINDER_DIR = $(CONTRIBDIR)/externalSequenceProducer +MATCHFINDER_SRC = $(MATCHFINDER_DIR)/sequence_producer.c + FUZZ_CPPFLAGS := -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(ZSTDDIR)/legacy \ - -I$(CONTRIBDIR)/seekable_format -I$(PRGDIR) -DZSTD_MULTITHREAD -DZSTD_LEGACY_SUPPORT=1 $(CPPFLAGS) + -I$(CONTRIBDIR)/seekable_format -I$(PRGDIR) -I$(MATCHFINDER_DIR) \ + -DZSTD_MULTITHREAD -DZSTD_LEGACY_SUPPORT=1 $(CPPFLAGS) FUZZ_EXTRA_FLAGS := -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ -Wstrict-prototypes -Wundef \ -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls \ + -Wredundant-decls -Wno-deprecated-declarations \ -g -fno-omit-frame-pointer FUZZ_CFLAGS := $(FUZZ_EXTRA_FLAGS) $(CFLAGS) +FUZZ_ASFLAGS := $(FUZZ_EXTRA_FLAGS) $(ASFLAGS) FUZZ_CXXFLAGS := $(FUZZ_EXTRA_FLAGS) -std=c++11 $(CXXFLAGS) FUZZ_LDFLAGS := -pthread $(LDFLAGS) FUZZ_ARFLAGS := $(ARFLAGS) @@ -50,19 +63,20 @@ FUZZ_SRC := $(PRGDIR)/util.c ./fuzz_helpers.c ./zstd_helpers.c ./fuzz_data_produ SEEKABLE_HEADERS = $(CONTRIBDIR)/seekable_format/zstd_seekable.h SEEKABLE_OBJS = $(CONTRIBDIR)/seekable_format/zstdseek_compress.c $(CONTRIBDIR)/seekable_format/zstdseek_decompress.c -ZSTDCOMMON_SRC := $(ZSTDDIR)/common/*.c -ZSTDCOMP_SRC := $(ZSTDDIR)/compress/*.c -ZSTDDECOMP_SRC := $(ZSTDDIR)/decompress/*.c -ZSTDDICT_SRC := $(ZSTDDIR)/dictBuilder/*.c -ZSTDLEGACY_SRC := $(ZSTDDIR)/legacy/*.c +ZSTDCOMMON_SRC := $(ZSTD_COMMON_FILES) +ZSTDCOMP_SRC := $(ZSTD_COMPRESS_FILES) +ZSTDDECOMP_SRC := $(ZSTD_DECOMPRESS_FILES) +ZSTDDICT_SRC := $(ZSTD_DICTBUILDER_FILES) +ZSTDLEGACY_SRC := $(ZSTD_LEGACY_FILES) FUZZ_SRC := \ $(FUZZ_SRC) \ $(ZSTDDECOMP_SRC) \ $(ZSTDCOMMON_SRC) \ $(ZSTDCOMP_SRC) \ $(ZSTDDICT_SRC) \ - $(ZSTDLEGACY_SRC) -FUZZ_SRC := $(wildcard $(FUZZ_SRC)) + $(ZSTDLEGACY_SRC) \ + $(MATCHFINDER_SRC) +FUZZ_SRC := $(sort $(wildcard $(FUZZ_SRC))) FUZZ_D_OBJ1 := $(subst $(ZSTDDIR)/common/,d_lib_common_,$(FUZZ_SRC)) FUZZ_D_OBJ2 := $(subst $(ZSTDDIR)/compress/,d_lib_compress_,$(FUZZ_D_OBJ1)) @@ -70,8 +84,10 @@ FUZZ_D_OBJ3 := $(subst $(ZSTDDIR)/decompress/,d_lib_decompress_,$(FUZZ_D_OBJ2)) FUZZ_D_OBJ4 := $(subst $(ZSTDDIR)/dictBuilder/,d_lib_dictBuilder_,$(FUZZ_D_OBJ3)) FUZZ_D_OBJ5 := $(subst $(ZSTDDIR)/legacy/,d_lib_legacy_,$(FUZZ_D_OBJ4)) FUZZ_D_OBJ6 := $(subst $(PRGDIR)/,d_prg_,$(FUZZ_D_OBJ5)) -FUZZ_D_OBJ7 := $(subst $\./,d_fuzz_,$(FUZZ_D_OBJ6)) -FUZZ_DECOMPRESS_OBJ := $(FUZZ_D_OBJ7:.c=.o) +FUZZ_D_OBJ7 := $(subst $(MATCHFINDER_DIR)/,d_matchfinder_,$(FUZZ_D_OBJ6)) +FUZZ_D_OBJ8 := $(subst $\./,d_fuzz_,$(FUZZ_D_OBJ7)) +FUZZ_D_OBJ9 := $(FUZZ_D_OBJ8:.c=.o) +FUZZ_DECOMPRESS_OBJ := $(FUZZ_D_OBJ9:.S=.o) FUZZ_RT_OBJ1 := $(subst $(ZSTDDIR)/common/,rt_lib_common_,$(FUZZ_SRC)) FUZZ_RT_OBJ2 := $(subst $(ZSTDDIR)/compress/,rt_lib_compress_,$(FUZZ_RT_OBJ1)) @@ -79,8 +95,10 @@ FUZZ_RT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,rt_lib_decompress_,$(FUZZ_RT_OBJ2 FUZZ_RT_OBJ4 := $(subst $(ZSTDDIR)/dictBuilder/,rt_lib_dictBuilder_,$(FUZZ_RT_OBJ3)) FUZZ_RT_OBJ5 := $(subst $(ZSTDDIR)/legacy/,rt_lib_legacy_,$(FUZZ_RT_OBJ4)) FUZZ_RT_OBJ6 := $(subst $(PRGDIR)/,rt_prg_,$(FUZZ_RT_OBJ5)) -FUZZ_RT_OBJ7 := $(subst $\./,rt_fuzz_,$(FUZZ_RT_OBJ6)) -FUZZ_ROUND_TRIP_OBJ := $(FUZZ_RT_OBJ7:.c=.o) +FUZZ_RT_OBJ7 := $(subst $(MATCHFINDER_DIR)/,rt_matchfinder_,$(FUZZ_RT_OBJ6)) +FUZZ_RT_OBJ8 := $(subst $\./,rt_fuzz_,$(FUZZ_RT_OBJ7)) +FUZZ_RT_OBJ9 := $(FUZZ_RT_OBJ8:.c=.o) +FUZZ_ROUND_TRIP_OBJ := $(FUZZ_RT_OBJ9:.S=.o) .PHONY: default all clean cleanall @@ -103,7 +121,9 @@ FUZZ_TARGETS := \ decompress_dstSize_tooSmall \ fse_read_ncount \ sequence_compression_api \ - seekable_roundtrip + seekable_roundtrip \ + huf_round_trip \ + huf_decompress all: libregression.a $(FUZZ_TARGETS) @@ -116,6 +136,9 @@ rt_lib_compress_%.o: $(ZSTDDIR)/compress/%.c rt_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ +rt_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.S + $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_ASFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ + rt_lib_dictBuilder_%.o: $(ZSTDDIR)/dictBuilder/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ @@ -128,6 +151,9 @@ rt_prg_%.o: $(PRGDIR)/%.c rt_fuzz_%.o: %.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ +rt_matchfinder_%.o: $(MATCHFINDER_DIR)/%.c + $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ + d_lib_common_%.o: $(ZSTDDIR)/common/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ @@ -137,6 +163,9 @@ d_lib_compress_%.o: $(ZSTDDIR)/compress/%.c d_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ +d_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.S + $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_ASFLAGS) $< -c -o $@ + d_lib_dictBuilder_%.o: $(ZSTDDIR)/dictBuilder/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ @@ -149,6 +178,9 @@ d_prg_%.o: $(PRGDIR)/%.c d_fuzz_%.o: %.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ +d_matchfinder_%.o: $(MATCHFINDER_DIR)/%.c + $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ + simple_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_simple_round_trip.o $(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_simple_round_trip.o $(LIB_FUZZING_ENGINE) -o $@ @@ -200,6 +232,12 @@ sequence_compression_api: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_sequenc seekable_roundtrip: $(FUZZ_HEADERS) $(SEEKABLE_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) $(SEEKABLE_OBJS) rt_fuzz_seekable_roundtrip.o $(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) $(SEEKABLE_OBJS) rt_fuzz_seekable_roundtrip.o $(LIB_FUZZING_ENGINE) -o $@ +huf_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_huf_round_trip.o + $(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_huf_round_trip.o $(LIB_FUZZING_ENGINE) -o $@ + +huf_decompress: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_huf_decompress.o + $(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_huf_decompress.o $(LIB_FUZZING_ENGINE) -o $@ + libregression.a: $(FUZZ_HEADERS) $(PRGDIR)/util.h $(PRGDIR)/util.c d_fuzz_regression_driver.o $(AR) $(FUZZ_ARFLAGS) $@ d_fuzz_regression_driver.o diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/README.md b/src/dependencies/zstd-1.5.4/tests/fuzz/README.md similarity index 83% rename from src/dependencies/zstd-1.5.0/tests/fuzz/README.md rename to src/dependencies/zstd-1.5.4/tests/fuzz/README.md index 71afa40..4ff7fe3 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/README.md +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/README.md @@ -50,6 +50,20 @@ See the help of the relevant command for options. Flags not parsed by `fuzz.py` are passed to the fuzzing engine. The command used to run the fuzzer is printed for debugging. +Here's a helpful command to fuzz each target across all cores, +stopping only if a bug is found: +``` +for target in $(./fuzz.py list); do + ./fuzz.py libfuzzer $target -jobs=10 -workers=10 -max_total_time=1000 || break; +done +``` +Alternatively, you can fuzz all targets in parallel, using one core per target: +``` +python3 ./fuzz.py list | xargs -P$(python3 ./fuzz.py list | wc -l) -I__ sh -c "python3 ./fuzz.py libfuzzer __ 2>&1 | tee __.log" +``` +Either way, to double-check that no crashes were found, run `ls corpora/*crash`. +If any crashes were found, you can use the hashes to reproduce them. + ## LibFuzzer ``` diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/block_decompress.c b/src/dependencies/zstd-1.5.4/tests/fuzz/block_decompress.c similarity index 95% rename from src/dependencies/zstd-1.5.0/tests/fuzz/block_decompress.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/block_decompress.c index bdbf769..e4767b3 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/block_decompress.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/block_decompress.c @@ -1,5 +1,5 @@ /** - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/block_round_trip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/block_round_trip.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/fuzz/block_round_trip.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/block_round_trip.c index 46a84c7..54012a1 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/block_round_trip.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/block_round_trip.c @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/decompress_dstSize_tooSmall.c b/src/dependencies/zstd-1.5.4/tests/fuzz/decompress_dstSize_tooSmall.c similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/fuzz/decompress_dstSize_tooSmall.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/decompress_dstSize_tooSmall.c index 3f7607b..8ad3ea1 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/decompress_dstSize_tooSmall.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/decompress_dstSize_tooSmall.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_decompress.c b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_decompress.c similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_decompress.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_decompress.c index 33c58c8..8dea3e5 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_decompress.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_loader.c b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_loader.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_loader.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_loader.c index 5b60bc4..1ac2274 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_loader.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_loader.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_round_trip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_round_trip.c similarity index 74% rename from src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_round_trip.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_round_trip.c index 7bff4bd..6dd78c3 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_round_trip.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_round_trip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -42,8 +42,23 @@ static size_t roundTripTest(void *result, size_t resultCapacity, src, srcSize, dict.buff, dict.size, cLevel); + FUZZ_ZASSERT(cSize); + // Compress a second time and check for determinism + { + size_t const cSize0 = cSize; + XXH64_hash_t const hash0 = XXH64(compressed, cSize, 0); + cSize = ZSTD_compress_usingDict(cctx, + compressed, compressedCapacity, + src, srcSize, + dict.buff, dict.size, + cLevel); + FUZZ_ASSERT(cSize == cSize0); + FUZZ_ASSERT(XXH64(compressed, cSize, 0) == hash0); + } } else { + size_t remainingBytes; dictContentType = FUZZ_dataProducer_uint32Range(producer, 0, 2); + remainingBytes = FUZZ_dataProducer_remainingBytes(producer); FUZZ_setRandomParameters(cctx, srcSize, producer); /* Disable checksum so we can use sizes smaller than compress bound. */ FUZZ_ZASSERT(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 0)); @@ -51,14 +66,29 @@ static size_t roundTripTest(void *result, size_t resultCapacity, FUZZ_ZASSERT(ZSTD_CCtx_refPrefix_advanced( cctx, dict.buff, dict.size, dictContentType)); - else + else FUZZ_ZASSERT(ZSTD_CCtx_loadDictionary_advanced( cctx, dict.buff, dict.size, (ZSTD_dictLoadMethod_e)FUZZ_dataProducer_uint32Range(producer, 0, 1), dictContentType)); cSize = ZSTD_compress2(cctx, compressed, compressedCapacity, src, srcSize); + FUZZ_ZASSERT(cSize); + // Compress a second time and check for determinism + { + size_t const cSize0 = cSize; + XXH64_hash_t const hash0 = XXH64(compressed, cSize, 0); + FUZZ_dataProducer_rollBack(producer, remainingBytes); + FUZZ_setRandomParameters(cctx, srcSize, producer); + FUZZ_ZASSERT(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 0)); + if (refPrefix) + FUZZ_ZASSERT(ZSTD_CCtx_refPrefix_advanced( + cctx, dict.buff, dict.size, + dictContentType)); + cSize = ZSTD_compress2(cctx, compressed, compressedCapacity, src, srcSize); + FUZZ_ASSERT(cSize == cSize0); + FUZZ_ASSERT(XXH64(compressed, cSize, 0) == hash0); + } } - FUZZ_ZASSERT(cSize); if (refPrefix) FUZZ_ZASSERT(ZSTD_DCtx_refPrefix_advanced( dctx, dict.buff, dict.size, diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_stream_round_trip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_stream_round_trip.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_stream_round_trip.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_stream_round_trip.c index 9af712f..3ebbd84 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/dictionary_stream_round_trip.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/dictionary_stream_round_trip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/fse_read_ncount.c b/src/dependencies/zstd-1.5.4/tests/fuzz/fse_read_ncount.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/fuzz/fse_read_ncount.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/fse_read_ncount.c index c323860..29e1944 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/fse_read_ncount.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/fse_read_ncount.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz.h b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz.h similarity index 90% rename from src/dependencies/zstd-1.5.0/tests/fuzz/fuzz.h rename to src/dependencies/zstd-1.5.4/tests/fuzz/fuzz.h index 810daa2..d1e439f 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz.h +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -26,8 +26,7 @@ * @param MEM_FORCE_MEMORY_ACCESS: * This flag controls how the zstd library accesses unaligned memory. * It can be undefined, or 0 through 2. If it is undefined, it selects - * the method to use based on the compiler. If testing with UBSAN set - * MEM_FORCE_MEMORY_ACCESS=0 to use the standard compliant method. + * the method to use based on the compiler. * @param FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION * This is the canonical flag to enable deterministic builds for fuzzing. * Changes to zstd for fuzzing are gated behind this define. diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz.py b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz.py similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/fuzz/fuzz.py rename to src/dependencies/zstd-1.5.4/tests/fuzz/fuzz.py index d8dfa77..03ffeee 100755 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz.py +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -63,6 +63,8 @@ TARGET_INFO = { 'fse_read_ncount': TargetInfo(InputType.RAW_DATA), 'sequence_compression_api': TargetInfo(InputType.RAW_DATA), 'seekable_roundtrip': TargetInfo(InputType.RAW_DATA), + 'huf_round_trip': TargetInfo(InputType.RAW_DATA), + 'huf_decompress': TargetInfo(InputType.RAW_DATA), } TARGETS = list(TARGET_INFO.keys()) ALL_TARGETS = TARGETS + ['all'] @@ -634,7 +636,7 @@ def regression(args): try: description = """ Runs one or more regression tests. - The fuzzer should have been built with with + The fuzzer should have been built with LIB_FUZZING_ENGINE='libregression.a'. Takes input from CORPORA. """ diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_data_producer.c b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_data_producer.c similarity index 91% rename from src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_data_producer.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_data_producer.c index beb0155..a93e8ba 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_data_producer.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_data_producer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -66,6 +66,12 @@ size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer){ return producer->size; } +void FUZZ_dataProducer_rollBack(FUZZ_dataProducer_t *producer, size_t remainingBytes) +{ + FUZZ_ASSERT(remainingBytes >= producer->size); + producer->size = remainingBytes; +} + int FUZZ_dataProducer_empty(FUZZ_dataProducer_t *producer) { return producer->size == 0; } diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_data_producer.h b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_data_producer.h similarity index 91% rename from src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_data_producer.h rename to src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_data_producer.h index 045aaff..8ca501f 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_data_producer.h +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_data_producer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -49,6 +49,9 @@ int32_t FUZZ_dataProducer_int32Range(FUZZ_dataProducer_t *producer, /* Returns the size of the remaining bytes of data in the producer */ size_t FUZZ_dataProducer_remainingBytes(FUZZ_dataProducer_t *producer); +/* Rolls back the data producer state to have remainingBytes remaining */ +void FUZZ_dataProducer_rollBack(FUZZ_dataProducer_t *producer, size_t remainingBytes); + /* Returns true if the data producer is out of bytes */ int FUZZ_dataProducer_empty(FUZZ_dataProducer_t *producer); diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_helpers.c b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_helpers.c similarity index 93% rename from src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_helpers.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_helpers.c index 61c0deb..1b6ad97 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_helpers.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_helpers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_helpers.h b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_helpers.h similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_helpers.h rename to src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_helpers.h index c180478..aaf4c1d 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/fuzz_helpers.h +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/fuzz_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.4/tests/fuzz/huf_decompress.c b/src/dependencies/zstd-1.5.4/tests/fuzz/huf_decompress.c new file mode 100644 index 0000000..fcd4b1a --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/huf_decompress.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +/** + * This fuzz target performs a zstd round-trip test (compress & decompress), + * compares the result with the original, and calls abort() on corruption. + */ + +#include +#include +#include +#include +#include "common/cpu.h" +#include "common/huf.h" +#include "fuzz_helpers.h" +#include "fuzz_data_producer.h" + +int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) +{ + FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(src, size); + /* Select random parameters: #streams, X1 or X2 decoding, bmi2 */ + int const streams = FUZZ_dataProducer_int32Range(producer, 0, 1); + int const symbols = FUZZ_dataProducer_int32Range(producer, 0, 1); + int const flags = 0 + | (ZSTD_cpuid_bmi2(ZSTD_cpuid()) && FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_bmi2 : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_optimalDepth : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_preferRepeat : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_suspectUncompressible : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_disableAsm : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_disableFast : 0); + /* Select a random cBufSize - it may be too small */ + size_t const dBufSize = FUZZ_dataProducer_uint32Range(producer, 0, 8 * size + 500); + size_t const maxTableLog = FUZZ_dataProducer_uint32Range(producer, 1, HUF_TABLELOG_MAX); + HUF_DTable* dt = (HUF_DTable*)FUZZ_malloc(HUF_DTABLE_SIZE(maxTableLog) * sizeof(HUF_DTable)); + size_t const wkspSize = HUF_WORKSPACE_SIZE; + void* wksp = FUZZ_malloc(wkspSize); + void* dBuf = FUZZ_malloc(dBufSize); + dt[0] = maxTableLog * 0x01000001; + size = FUZZ_dataProducer_remainingBytes(producer); + + if (symbols == 0) { + size_t const err = HUF_readDTableX1_wksp(dt, src, size, wksp, wkspSize, flags); + if (ZSTD_isError(err)) + goto _out; + } else { + size_t const err = HUF_readDTableX2_wksp(dt, src, size, wksp, wkspSize, flags); + if (ZSTD_isError(err)) + goto _out; + } + if (streams == 0) + HUF_decompress1X_usingDTable(dBuf, dBufSize, src, size, dt, flags); + else + HUF_decompress4X_usingDTable(dBuf, dBufSize, src, size, dt, flags); + +_out: + free(dt); + free(wksp); + free(dBuf); + FUZZ_dataProducer_free(producer); + return 0; +} diff --git a/src/dependencies/zstd-1.5.4/tests/fuzz/huf_round_trip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/huf_round_trip.c new file mode 100644 index 0000000..4d0f8de --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/huf_round_trip.c @@ -0,0 +1,137 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +/** + * This fuzz target performs a zstd round-trip test (compress & decompress), + * compares the result with the original, and calls abort() on corruption. + */ + +#include +#include +#include +#include +#include "common/cpu.h" +#include "compress/hist.h" +#include "common/huf.h" +#include "fuzz_helpers.h" +#include "fuzz_data_producer.h" +#include "common/bits.h" + +static size_t adjustTableLog(size_t tableLog, size_t maxSymbol) +{ + size_t const alphabetSize = maxSymbol + 1; + size_t minTableLog = ZSTD_highbit32(alphabetSize) + 1; + if ((alphabetSize & (alphabetSize - 1)) != 0) { + ++minTableLog; + } + assert(minTableLog <= 9); + if (tableLog < minTableLog) + return minTableLog; + else + return tableLog; +} + +int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) +{ + FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(src, size); + /* Select random parameters: #streams, X1 or X2 decoding, bmi2 */ + int const streams = FUZZ_dataProducer_int32Range(producer, 0, 1); + int const symbols = FUZZ_dataProducer_int32Range(producer, 0, 1); + int const flags = 0 + | (ZSTD_cpuid_bmi2(ZSTD_cpuid()) && FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_bmi2 : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_optimalDepth : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_preferRepeat : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_suspectUncompressible : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_disableAsm : 0) + | (FUZZ_dataProducer_int32Range(producer, 0, 1) ? HUF_flags_disableFast : 0); + /* Select a random cBufSize - it may be too small */ + size_t const cBufSize = FUZZ_dataProducer_uint32Range(producer, 0, 4 * size); + /* Select a random tableLog - we'll adjust it up later */ + size_t tableLog = FUZZ_dataProducer_uint32Range(producer, 1, 12); + size_t const kMaxSize = 256 * 1024; + size = FUZZ_dataProducer_remainingBytes(producer); + if (size > kMaxSize) + size = kMaxSize; + + if (size <= 1) { + FUZZ_dataProducer_free(producer); + return 0; + } + + uint32_t maxSymbol = 255; + + U32 count[256]; + size_t const mostFrequent = HIST_count(count, &maxSymbol, src, size); + FUZZ_ZASSERT(mostFrequent); + if (mostFrequent == size) { + /* RLE */ + FUZZ_dataProducer_free(producer); + return 0; + + } + FUZZ_ASSERT(maxSymbol <= 255); + tableLog = adjustTableLog(tableLog, maxSymbol); + + size_t const wkspSize = HUF_WORKSPACE_SIZE; + void* wksp = FUZZ_malloc(wkspSize); + void* rBuf = FUZZ_malloc(size); + void* cBuf = FUZZ_malloc(cBufSize); + HUF_CElt* ct = (HUF_CElt*)FUZZ_malloc(HUF_CTABLE_SIZE(maxSymbol)); + HUF_DTable* dt = (HUF_DTable*)FUZZ_malloc(HUF_DTABLE_SIZE(tableLog) * sizeof(HUF_DTable)); + dt[0] = tableLog * 0x01000001; + + tableLog = HUF_optimalTableLog(tableLog, size, maxSymbol, wksp, wkspSize, ct, count, flags); + FUZZ_ASSERT(tableLog <= 12); + tableLog = HUF_buildCTable_wksp(ct, count, maxSymbol, tableLog, wksp, wkspSize); + FUZZ_ZASSERT(tableLog); + size_t const tableSize = HUF_writeCTable_wksp(cBuf, cBufSize, ct, maxSymbol, tableLog, wksp, wkspSize); + if (ERR_isError(tableSize)) { + /* Errors on uncompressible data or cBufSize too small */ + goto _out; + } + FUZZ_ZASSERT(tableSize); + if (symbols == 0) { + FUZZ_ZASSERT(HUF_readDTableX1_wksp(dt, cBuf, tableSize, wksp, wkspSize, flags)); + } else { + size_t const ret = HUF_readDTableX2_wksp(dt, cBuf, tableSize, wksp, wkspSize, flags); + if (ERR_getErrorCode(ret) == ZSTD_error_tableLog_tooLarge) { + FUZZ_ZASSERT(HUF_readDTableX1_wksp(dt, cBuf, tableSize, wksp, wkspSize, flags)); + } else { + FUZZ_ZASSERT(ret); + } + } + + size_t cSize; + size_t rSize; + if (streams == 0) { + cSize = HUF_compress1X_usingCTable(cBuf, cBufSize, src, size, ct, flags); + FUZZ_ZASSERT(cSize); + if (cSize != 0) + rSize = HUF_decompress1X_usingDTable(rBuf, size, cBuf, cSize, dt, flags); + } else { + cSize = HUF_compress4X_usingCTable(cBuf, cBufSize, src, size, ct, flags); + FUZZ_ZASSERT(cSize); + if (cSize != 0) + rSize = HUF_decompress4X_usingDTable(rBuf, size, cBuf, cSize, dt, flags); + } + if (cSize != 0) { + FUZZ_ZASSERT(rSize); + FUZZ_ASSERT_MSG(rSize == size, "Incorrect regenerated size"); + FUZZ_ASSERT_MSG(!FUZZ_memcmp(src, rBuf, size), "Corruption!"); + } +_out: + free(rBuf); + free(cBuf); + free(ct); + free(dt); + free(wksp); + FUZZ_dataProducer_free(producer); + return 0; +} diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/raw_dictionary_round_trip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/raw_dictionary_round_trip.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/fuzz/raw_dictionary_round_trip.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/raw_dictionary_round_trip.c index 0e65176..7ceab2b 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/raw_dictionary_round_trip.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/raw_dictionary_round_trip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/regression_driver.c b/src/dependencies/zstd-1.5.4/tests/fuzz/regression_driver.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/fuzz/regression_driver.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/regression_driver.c index e6d2dec..550c65d 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/regression_driver.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/regression_driver.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/seekable_roundtrip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/seekable_roundtrip.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/fuzz/seekable_roundtrip.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/seekable_roundtrip.c index dcdcaae..6f0aa28 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/seekable_roundtrip.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/seekable_roundtrip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.4/tests/fuzz/sequence_compression_api.c b/src/dependencies/zstd-1.5.4/tests/fuzz/sequence_compression_api.c new file mode 100644 index 0000000..9d3f0a1 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/sequence_compression_api.c @@ -0,0 +1,377 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +/** + * This fuzz target performs a zstd round-trip test by generating an arbitrary + * array of sequences, generating the associated source buffer, calling + * ZSTD_compressSequences(), and then decompresses and compares the result with + * the original generated source buffer. + */ + +#define ZSTD_STATIC_LINKING_ONLY + +#include +#include +#include +#include +#include +#include "fuzz_helpers.h" +#include "zstd_helpers.h" +#include "fuzz_data_producer.h" + +static ZSTD_CCtx* cctx = NULL; +static ZSTD_DCtx* dctx = NULL; +static void* literalsBuffer = NULL; +static void* generatedSrc = NULL; +static ZSTD_Sequence* generatedSequences = NULL; + +static void* dictBuffer = NULL; +static ZSTD_CDict* cdict = NULL; +static ZSTD_DDict* ddict = NULL; + +#define ZSTD_FUZZ_GENERATED_SRC_MAXSIZE (1 << 20) /* Allow up to 1MB generated data */ +#define ZSTD_FUZZ_GENERATED_LITERALS_SIZE (1 << 20) /* Fixed size 1MB literals buffer */ +#define ZSTD_FUZZ_MATCHLENGTH_MAXSIZE (1 << 18) /* Allow up to 256KB matches */ +#define ZSTD_FUZZ_GENERATED_DICT_MAXSIZE (1 << ZSTD_WINDOWLOG_MAX_32) /* Allow up to 1 << ZSTD_WINDOWLOG_MAX_32 dictionary */ +#define ZSTD_FUZZ_MAX_NBSEQ (1 << 17) /* Maximum of 128K sequences */ + +/* Deterministic random number generator */ +#define FUZZ_RDG_rotl32(x,r) ((x << r) | (x >> (32 - r))) +static uint32_t FUZZ_RDG_rand(uint32_t* src) +{ + static const uint32_t prime1 = 2654435761U; + static const uint32_t prime2 = 2246822519U; + uint32_t rand32 = *src; + rand32 *= prime1; + rand32 ^= prime2; + rand32 = FUZZ_RDG_rotl32(rand32, 13); + *src = rand32; + return rand32 >> 5; +} + +/* Make a pseudorandom string - this simple function exists to avoid + * taking a dependency on datagen.h to have RDG_genBuffer(). + */ +static char* generatePseudoRandomString(char* str, size_t size, FUZZ_dataProducer_t* producer) { + const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567890!@#$^&*()_"; + uint32_t seed = FUZZ_dataProducer_uint32(producer); + if (size) { + for (size_t n = 0; n < size; n++) { + int key = FUZZ_RDG_rand(&seed) % (int) (sizeof charset - 1); + str[n] = charset[key]; + } + } + return str; +} + +/* Returns size of source buffer */ +static size_t decodeSequences(void* dst, size_t nbSequences, + size_t literalsSize, + const void* dict, size_t dictSize, + ZSTD_sequenceFormat_e mode) +{ + const uint8_t* litPtr = literalsBuffer; + const uint8_t* const litBegin = literalsBuffer; + const uint8_t* const litEnd = litBegin + literalsSize; + const uint8_t* dictPtr = dict; + uint8_t* op = dst; + const uint8_t* const oend = (uint8_t*)dst + ZSTD_FUZZ_GENERATED_SRC_MAXSIZE; + size_t generatedSrcBufferSize = 0; + size_t bytesWritten = 0; + + for (size_t i = 0; i < nbSequences; ++i) { + /* block boundary */ + if (generatedSequences[i].offset == 0) + FUZZ_ASSERT(generatedSequences[i].matchLength == 0); + + if (litPtr + generatedSequences[i].litLength > litEnd) { + litPtr = litBegin; + } + memcpy(op, litPtr, generatedSequences[i].litLength); + bytesWritten += generatedSequences[i].litLength; + op += generatedSequences[i].litLength; + litPtr += generatedSequences[i].litLength; + + /* Copy over the match */ + { size_t matchLength = generatedSequences[i].matchLength; + size_t j = 0; + size_t k = 0; + if (dictSize != 0) { + if (generatedSequences[i].offset > bytesWritten) { /* Offset goes into the dictionary */ + size_t dictOffset = generatedSequences[i].offset - bytesWritten; + size_t matchInDict = MIN(matchLength, dictOffset); + for (; k < matchInDict; ++k) { + op[k] = dictPtr[dictSize - dictOffset + k]; + } + matchLength -= matchInDict; + op += matchInDict; + } + } + for (; j < matchLength; ++j) { + op[j] = op[j - generatedSequences[i].offset]; + } + op += j; + FUZZ_ASSERT(generatedSequences[i].matchLength == j + k); + bytesWritten += generatedSequences[i].matchLength; + } + } + generatedSrcBufferSize = bytesWritten; + FUZZ_ASSERT(litPtr <= litEnd); + if (mode == ZSTD_sf_noBlockDelimiters) { + const uint32_t lastLLSize = (uint32_t)(litEnd - litPtr); + if (lastLLSize <= oend - op) { + memcpy(op, litPtr, lastLLSize); + generatedSrcBufferSize += lastLLSize; + } } + return generatedSrcBufferSize; +} + +/* Returns nb sequences generated + * Note : random sequences are always valid in ZSTD_sf_noBlockDelimiters mode. + * However, it can fail with ZSTD_sf_explicitBlockDelimiters, + * due to potential lack of space in + */ +static size_t generateRandomSequences(FUZZ_dataProducer_t* producer, + size_t literalsSizeLimit, size_t dictSize, + size_t windowLog, ZSTD_sequenceFormat_e mode) +{ + const uint32_t repCode = 0; /* not used by sequence ingestion api */ + size_t windowSize = 1ULL << windowLog; + size_t blockSizeMax = MIN(ZSTD_BLOCKSIZE_MAX, windowSize); + uint32_t matchLengthMax = ZSTD_FUZZ_MATCHLENGTH_MAXSIZE; + uint32_t bytesGenerated = 0; + uint32_t nbSeqGenerated = 0; + uint32_t isFirstSequence = 1; + uint32_t blockSize = 0; + + if (mode == ZSTD_sf_explicitBlockDelimiters) { + /* ensure that no sequence can be larger than one block */ + literalsSizeLimit = MIN(literalsSizeLimit, blockSizeMax/2); + matchLengthMax = MIN(matchLengthMax, blockSizeMax/2); + } + + while ( nbSeqGenerated < ZSTD_FUZZ_MAX_NBSEQ - 3 /* extra room for explicit delimiters */ + && bytesGenerated < ZSTD_FUZZ_GENERATED_SRC_MAXSIZE + && !FUZZ_dataProducer_empty(producer)) { + uint32_t matchLength; + uint32_t matchBound = matchLengthMax; + uint32_t offset; + uint32_t offsetBound; + const uint32_t minLitLength = (isFirstSequence && (dictSize == 0)); + const uint32_t litLength = FUZZ_dataProducer_uint32Range(producer, minLitLength, (uint32_t)literalsSizeLimit); + bytesGenerated += litLength; + if (bytesGenerated > ZSTD_FUZZ_GENERATED_SRC_MAXSIZE) { + break; + } + offsetBound = (bytesGenerated > windowSize) ? windowSize : bytesGenerated + (uint32_t)dictSize; + offset = FUZZ_dataProducer_uint32Range(producer, 1, offsetBound); + if (dictSize > 0 && bytesGenerated <= windowSize) { + /* Prevent match length from being such that it would be associated with an offset too large + * from the decoder's perspective. If not possible (match would be too small), + * then reduce the offset if necessary. + */ + const size_t bytesToReachWindowSize = windowSize - bytesGenerated; + if (bytesToReachWindowSize < ZSTD_MINMATCH_MIN) { + const uint32_t newOffsetBound = offsetBound > windowSize ? windowSize : offsetBound; + offset = FUZZ_dataProducer_uint32Range(producer, 1, newOffsetBound); + } else { + matchBound = MIN(matchLengthMax, (uint32_t)bytesToReachWindowSize); + } + } + matchLength = FUZZ_dataProducer_uint32Range(producer, ZSTD_MINMATCH_MIN, matchBound); + bytesGenerated += matchLength; + if (bytesGenerated > ZSTD_FUZZ_GENERATED_SRC_MAXSIZE) { + break; + } + { ZSTD_Sequence seq = {offset, litLength, matchLength, repCode}; + const uint32_t lastLits = FUZZ_dataProducer_uint32Range(producer, 0, litLength); + #define SPLITPROB 6000 + #define SPLITMARK 5234 + const int split = (FUZZ_dataProducer_uint32Range(producer, 0, SPLITPROB) == SPLITMARK); + if (mode == ZSTD_sf_explicitBlockDelimiters) { + const size_t seqSize = seq.litLength + seq.matchLength; + if (blockSize + seqSize > blockSizeMax) { /* reaching limit : must end block now */ + const ZSTD_Sequence endBlock = {0, 0, 0, 0}; + generatedSequences[nbSeqGenerated++] = endBlock; + blockSize = seqSize; + } + if (split) { + const ZSTD_Sequence endBlock = {0, lastLits, 0, 0}; + generatedSequences[nbSeqGenerated++] = endBlock; + assert(lastLits <= seq.litLength); + seq.litLength -= lastLits; + blockSize = seqSize - lastLits; + } else { + blockSize += seqSize; + } + } + generatedSequences[nbSeqGenerated++] = seq; + isFirstSequence = 0; + } + } + + if (mode == ZSTD_sf_explicitBlockDelimiters) { + /* always end sequences with a block delimiter */ + const ZSTD_Sequence endBlock = {0, 0, 0, 0}; + assert(nbSeqGenerated < ZSTD_FUZZ_MAX_NBSEQ); + generatedSequences[nbSeqGenerated++] = endBlock; + } + return nbSeqGenerated; +} + +static size_t roundTripTest(void* result, size_t resultCapacity, + void* compressed, size_t compressedCapacity, + const void* src, size_t srcSize, + const ZSTD_Sequence* seqs, size_t seqSize, + unsigned hasDict, + ZSTD_sequenceFormat_e mode) +{ + size_t cSize; + size_t dSize; + + if (hasDict) { + FUZZ_ZASSERT(ZSTD_CCtx_refCDict(cctx, cdict)); + FUZZ_ZASSERT(ZSTD_DCtx_refDDict(dctx, ddict)); + } + + cSize = ZSTD_compressSequences(cctx, compressed, compressedCapacity, + seqs, seqSize, + src, srcSize); + if ( (ZSTD_getErrorCode(cSize) == ZSTD_error_dstSize_tooSmall) + && (mode == ZSTD_sf_explicitBlockDelimiters) ) { + /* Valid scenario : in explicit delimiter mode, + * it might be possible for the compressed size to outgrow dstCapacity. + * In which case, it's still a valid fuzzer scenario, + * but no roundtrip shall be possible */ + return 0; + } + /* round-trip */ + FUZZ_ZASSERT(cSize); + dSize = ZSTD_decompressDCtx(dctx, result, resultCapacity, compressed, cSize); + FUZZ_ZASSERT(dSize); + FUZZ_ASSERT_MSG(dSize == srcSize, "Incorrect regenerated size"); + FUZZ_ASSERT_MSG(!FUZZ_memcmp(src, result, srcSize), "Corruption!"); + return dSize; +} + +int LLVMFuzzerTestOneInput(const uint8_t* src, size_t size) +{ + void* rBuf; + size_t rBufSize; + void* cBuf; + size_t cBufSize; + size_t generatedSrcSize; + size_t nbSequences; + size_t dictSize = 0; + unsigned hasDict; + unsigned wLog; + int cLevel; + ZSTD_sequenceFormat_e mode; + + FUZZ_dataProducer_t* const producer = FUZZ_dataProducer_create(src, size); + FUZZ_ASSERT(producer); + + if (!cctx) { + cctx = ZSTD_createCCtx(); + FUZZ_ASSERT(cctx); + } + if (!dctx) { + dctx = ZSTD_createDCtx(); + FUZZ_ASSERT(dctx); + } + + /* Generate window log first so we don't generate offsets too large */ + wLog = FUZZ_dataProducer_uint32Range(producer, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX); + cLevel = FUZZ_dataProducer_int32Range(producer, -3, 22); + mode = (ZSTD_sequenceFormat_e)FUZZ_dataProducer_int32Range(producer, 0, 1); + + ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 0); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, cLevel); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, wLog); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, ZSTD_MINMATCH_MIN); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_validateSequences, 1); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, mode); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_forceAttachDict, ZSTD_dictForceAttach); + + if (!literalsBuffer) { + literalsBuffer = FUZZ_malloc(ZSTD_FUZZ_GENERATED_LITERALS_SIZE); + FUZZ_ASSERT(literalsBuffer); + literalsBuffer = generatePseudoRandomString(literalsBuffer, ZSTD_FUZZ_GENERATED_LITERALS_SIZE, producer); + } + + if (!dictBuffer) { /* Generate global dictionary buffer */ + ZSTD_compressionParameters cParams; + + /* Generate a large dictionary buffer */ + dictBuffer = calloc(ZSTD_FUZZ_GENERATED_DICT_MAXSIZE, 1); + FUZZ_ASSERT(dictBuffer); + + /* Create global cdict and ddict */ + cParams = ZSTD_getCParams(1, ZSTD_FUZZ_GENERATED_SRC_MAXSIZE, ZSTD_FUZZ_GENERATED_DICT_MAXSIZE); + cParams.minMatch = ZSTD_MINMATCH_MIN; + cParams.hashLog = ZSTD_HASHLOG_MIN; + cParams.chainLog = ZSTD_CHAINLOG_MIN; + + cdict = ZSTD_createCDict_advanced(dictBuffer, ZSTD_FUZZ_GENERATED_DICT_MAXSIZE, ZSTD_dlm_byRef, ZSTD_dct_rawContent, cParams, ZSTD_defaultCMem); + ddict = ZSTD_createDDict_advanced(dictBuffer, ZSTD_FUZZ_GENERATED_DICT_MAXSIZE, ZSTD_dlm_byRef, ZSTD_dct_rawContent, ZSTD_defaultCMem); + FUZZ_ASSERT(cdict); + FUZZ_ASSERT(ddict); + } + + FUZZ_ASSERT(cdict); + FUZZ_ASSERT(ddict); + + hasDict = FUZZ_dataProducer_uint32Range(producer, 0, 1); + if (hasDict) { + dictSize = ZSTD_FUZZ_GENERATED_DICT_MAXSIZE; + } + + if (!generatedSequences) { + generatedSequences = FUZZ_malloc(sizeof(ZSTD_Sequence)*ZSTD_FUZZ_MAX_NBSEQ); + } + if (!generatedSrc) { + generatedSrc = FUZZ_malloc(ZSTD_FUZZ_GENERATED_SRC_MAXSIZE); + } + + nbSequences = generateRandomSequences(producer, ZSTD_FUZZ_GENERATED_LITERALS_SIZE, dictSize, wLog, mode); + generatedSrcSize = decodeSequences(generatedSrc, nbSequences, ZSTD_FUZZ_GENERATED_LITERALS_SIZE, dictBuffer, dictSize, mode); + + /* Note : in explicit block delimiters mode, + * the fuzzer might generate a lot of small blocks. + * In which case, the final compressed size might be > ZSTD_compressBound(). + * This is still a valid scenario fuzzer though, which makes it possible to check under-sized dstCapacity. + * The test just doesn't roundtrip. */ + cBufSize = ZSTD_compressBound(generatedSrcSize); + cBuf = FUZZ_malloc(cBufSize); + + rBufSize = generatedSrcSize; + rBuf = FUZZ_malloc(rBufSize); + + { const size_t result = roundTripTest(rBuf, rBufSize, + cBuf, cBufSize, + generatedSrc, generatedSrcSize, + generatedSequences, nbSequences, + hasDict, mode); + FUZZ_ASSERT(result <= generatedSrcSize); /* can be 0 when no round-trip */ + } + + free(rBuf); + free(cBuf); + FUZZ_dataProducer_free(producer); +#ifndef STATEFUL_FUZZING + ZSTD_freeCCtx(cctx); cctx = NULL; + ZSTD_freeDCtx(dctx); dctx = NULL; + free(generatedSequences); generatedSequences = NULL; + free(generatedSrc); generatedSrc = NULL; + free(literalsBuffer); literalsBuffer = NULL; +#endif + return 0; +} diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/simple_compress.c b/src/dependencies/zstd-1.5.4/tests/fuzz/simple_compress.c similarity index 92% rename from src/dependencies/zstd-1.5.0/tests/fuzz/simple_compress.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/simple_compress.c index 3716d0d..c9fea22 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/simple_compress.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/simple_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -9,7 +9,7 @@ */ /** - * This fuzz target attempts to comprss the fuzzed data with the simple + * This fuzz target attempts to compress the fuzzed data with the simple * compression function with an output buffer that may be too small to * ensure that the compressor never crashes. */ diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/simple_decompress.c b/src/dependencies/zstd-1.5.4/tests/fuzz/simple_decompress.c similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/fuzz/simple_decompress.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/simple_decompress.c index dfff11c..ce5f9f0 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/simple_decompress.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/simple_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/simple_round_trip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/simple_round_trip.c similarity index 59% rename from src/dependencies/zstd-1.5.0/tests/fuzz/simple_round_trip.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/simple_round_trip.c index c9fac26..c2c69d9 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/simple_round_trip.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/simple_round_trip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -26,6 +26,23 @@ static ZSTD_CCtx *cctx = NULL; static ZSTD_DCtx *dctx = NULL; +static size_t getDecompressionMargin(void const* compressed, size_t cSize, size_t srcSize, int hasSmallBlocks) +{ + size_t margin = ZSTD_decompressionMargin(compressed, cSize); + if (!hasSmallBlocks) { + /* The macro should be correct in this case, but it may be smaller + * because of e.g. block splitting, so take the smaller of the two. + */ + ZSTD_frameHeader zfh; + size_t marginM; + FUZZ_ZASSERT(ZSTD_getFrameHeader(&zfh, compressed, cSize)); + marginM = ZSTD_DECOMPRESSION_MARGIN(srcSize, zfh.blockSizeMax); + if (marginM < margin) + margin = marginM; + } + return margin; +} + static size_t roundTripTest(void *result, size_t resultCapacity, void *compressed, size_t compressedCapacity, const void *src, size_t srcSize, @@ -35,18 +52,57 @@ static size_t roundTripTest(void *result, size_t resultCapacity, size_t dSize; int targetCBlockSize = 0; if (FUZZ_dataProducer_uint32Range(producer, 0, 1)) { + size_t const remainingBytes = FUZZ_dataProducer_remainingBytes(producer); FUZZ_setRandomParameters(cctx, srcSize, producer); cSize = ZSTD_compress2(cctx, compressed, compressedCapacity, src, srcSize); + FUZZ_ZASSERT(cSize); FUZZ_ZASSERT(ZSTD_CCtx_getParameter(cctx, ZSTD_c_targetCBlockSize, &targetCBlockSize)); + // Compress a second time and check for determinism + { + size_t const cSize0 = cSize; + XXH64_hash_t const hash0 = XXH64(compressed, cSize, 0); + FUZZ_dataProducer_rollBack(producer, remainingBytes); + FUZZ_setRandomParameters(cctx, srcSize, producer); + cSize = ZSTD_compress2(cctx, compressed, compressedCapacity, src, srcSize); + FUZZ_ASSERT(cSize == cSize0); + FUZZ_ASSERT(XXH64(compressed, cSize, 0) == hash0); + } } else { - int const cLevel = FUZZ_dataProducer_int32Range(producer, kMinClevel, kMaxClevel); - + int const cLevel = FUZZ_dataProducer_int32Range(producer, kMinClevel, kMaxClevel); cSize = ZSTD_compressCCtx( cctx, compressed, compressedCapacity, src, srcSize, cLevel); + FUZZ_ZASSERT(cSize); + // Compress a second time and check for determinism + { + size_t const cSize0 = cSize; + XXH64_hash_t const hash0 = XXH64(compressed, cSize, 0); + cSize = ZSTD_compressCCtx( + cctx, compressed, compressedCapacity, src, srcSize, cLevel); + FUZZ_ASSERT(cSize == cSize0); + FUZZ_ASSERT(XXH64(compressed, cSize, 0) == hash0); + } } - FUZZ_ZASSERT(cSize); dSize = ZSTD_decompressDCtx(dctx, result, resultCapacity, compressed, cSize); FUZZ_ZASSERT(dSize); + FUZZ_ASSERT_MSG(dSize == srcSize, "Incorrect regenerated size"); + FUZZ_ASSERT_MSG(!FUZZ_memcmp(src, result, dSize), "Corruption!"); + + { + size_t margin = getDecompressionMargin(compressed, cSize, srcSize, targetCBlockSize); + size_t const outputSize = srcSize + margin; + char* const output = (char*)FUZZ_malloc(outputSize); + char* const input = output + outputSize - cSize; + FUZZ_ASSERT(outputSize >= cSize); + memcpy(input, compressed, cSize); + + dSize = ZSTD_decompressDCtx(dctx, output, outputSize, input, cSize); + FUZZ_ZASSERT(dSize); + FUZZ_ASSERT_MSG(dSize == srcSize, "Incorrect regenerated size"); + FUZZ_ASSERT_MSG(!FUZZ_memcmp(src, output, srcSize), "Corruption!"); + + free(output); + } + /* When superblock is enabled make sure we don't expand the block more than expected. * NOTE: This test is currently disabled because superblock mode can arbitrarily * expand the block in the worst case. Once superblock mode has been improved we can @@ -100,13 +156,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) FUZZ_ASSERT(dctx); } - { - size_t const result = - roundTripTest(rBuf, rBufSize, cBuf, cBufSize, src, size, producer); - FUZZ_ZASSERT(result); - FUZZ_ASSERT_MSG(result == size, "Incorrect regenerated size"); - FUZZ_ASSERT_MSG(!FUZZ_memcmp(src, rBuf, size), "Corruption!"); - } + roundTripTest(rBuf, rBufSize, cBuf, cBufSize, src, size, producer); free(rBuf); free(cBuf); FUZZ_dataProducer_free(producer); diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/stream_decompress.c b/src/dependencies/zstd-1.5.4/tests/fuzz/stream_decompress.c similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/fuzz/stream_decompress.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/stream_decompress.c index e0cdd34..0254d06 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/stream_decompress.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/stream_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -99,14 +99,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) while (size > 0) { ZSTD_inBuffer in = makeInBuffer(&src, &size, producer); - while (in.pos != in.size) { + do { + size_t const rc = ZSTD_decompressStream(dstream, &out, &in); + if (ZSTD_isError(rc)) goto error; if (out.pos == out.size) { if (stableOutBuffer) goto error; out = makeOutBuffer(producer, buf, bufSize); } - size_t const rc = ZSTD_decompressStream(dstream, &out, &in); - if (ZSTD_isError(rc)) goto error; - } + } while (in.pos != in.size); } error: diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/stream_round_trip.c b/src/dependencies/zstd-1.5.4/tests/fuzz/stream_round_trip.c similarity index 87% rename from src/dependencies/zstd-1.5.0/tests/fuzz/stream_round_trip.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/stream_round_trip.c index 719eac4..fae9ccb 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/stream_round_trip.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/stream_round_trip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -166,6 +166,24 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) FUZZ_ZASSERT(rSize); FUZZ_ASSERT_MSG(rSize == size, "Incorrect regenerated size"); FUZZ_ASSERT_MSG(!FUZZ_memcmp(src, rBuf, size), "Corruption!"); + + /* Test in-place decompression (note the macro doesn't work in this case) */ + { + size_t const margin = ZSTD_decompressionMargin(cBuf, cSize); + size_t const outputSize = size + margin; + char* const output = (char*)FUZZ_malloc(outputSize); + char* const input = output + outputSize - cSize; + size_t dSize; + FUZZ_ASSERT(outputSize >= cSize); + memcpy(input, cBuf, cSize); + + dSize = ZSTD_decompressDCtx(dctx, output, outputSize, input, cSize); + FUZZ_ZASSERT(dSize); + FUZZ_ASSERT_MSG(dSize == size, "Incorrect regenerated size"); + FUZZ_ASSERT_MSG(!FUZZ_memcmp(src, output, size), "Corruption!"); + + free(output); + } } FUZZ_dataProducer_free(producer); diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/zstd_frame_info.c b/src/dependencies/zstd-1.5.4/tests/fuzz/zstd_frame_info.c similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/fuzz/zstd_frame_info.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/zstd_frame_info.c index 9ce645d..95dbdd4 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/zstd_frame_info.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/zstd_frame_info.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/zstd_helpers.c b/src/dependencies/zstd-1.5.4/tests/fuzz/zstd_helpers.c similarity index 75% rename from src/dependencies/zstd-1.5.0/tests/fuzz/zstd_helpers.c rename to src/dependencies/zstd-1.5.4/tests/fuzz/zstd_helpers.c index 4d889de..411b639 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/zstd_helpers.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/zstd_helpers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -17,6 +17,7 @@ #include "fuzz_helpers.h" #include "zstd.h" #include "zdict.h" +#include "sequence_producer.h" const int kMinClevel = -3; const int kMaxClevel = 19; @@ -26,9 +27,14 @@ static void set(ZSTD_CCtx *cctx, ZSTD_cParameter param, int value) FUZZ_ZASSERT(ZSTD_CCtx_setParameter(cctx, param, value)); } +static unsigned produceParamValue(unsigned min, unsigned max, + FUZZ_dataProducer_t *producer) { + return FUZZ_dataProducer_uint32Range(producer, min, max); +} + static void setRand(ZSTD_CCtx *cctx, ZSTD_cParameter param, unsigned min, unsigned max, FUZZ_dataProducer_t *producer) { - unsigned const value = FUZZ_dataProducer_uint32Range(producer, min, max); + unsigned const value = produceParamValue(min, max, producer); set(cctx, param, value); } @@ -65,6 +71,17 @@ ZSTD_parameters FUZZ_randomParams(size_t srcSize, FUZZ_dataProducer_t *producer) return params; } +static void setSequenceProducerParams(ZSTD_CCtx *cctx, FUZZ_dataProducer_t *producer) { + ZSTD_registerSequenceProducer( + cctx, + NULL, + simpleSequenceProducer + ); + setRand(cctx, ZSTD_c_enableSeqProducerFallback, 0, 1, producer); + FUZZ_ZASSERT(ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 0)); + FUZZ_ZASSERT(ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_disable)); +} + void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, FUZZ_dataProducer_t *producer) { ZSTD_compressionParameters cParams = FUZZ_randomCParams(srcSize, producer); @@ -80,7 +97,7 @@ void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, FUZZ_dataProducer setRand(cctx, ZSTD_c_checksumFlag, 0, 1, producer); setRand(cctx, ZSTD_c_dictIDFlag, 0, 1, producer); /* Select long distance matching parameters */ - setRand(cctx, ZSTD_c_enableLongDistanceMatching, 0, 1, producer); + setRand(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_auto, ZSTD_ps_disable, producer); setRand(cctx, ZSTD_c_ldmHashLog, ZSTD_HASHLOG_MIN, 16, producer); setRand(cctx, ZSTD_c_ldmMinMatch, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX, producer); @@ -89,21 +106,42 @@ void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, FUZZ_dataProducer setRand(cctx, ZSTD_c_ldmHashRateLog, ZSTD_LDM_HASHRATELOG_MIN, ZSTD_LDM_HASHRATELOG_MAX, producer); /* Set misc parameters */ +#ifndef ZSTD_MULTITHREAD + // To reproduce with or without ZSTD_MULTITHREAD, we are going to use + // the same amount of entropy. + unsigned const nbWorkers_value = produceParamValue(0, 2, producer); + unsigned const rsyncable_value = produceParamValue(0, 1, producer); + (void)nbWorkers_value; + (void)rsyncable_value; + set(cctx, ZSTD_c_nbWorkers, 0); + set(cctx, ZSTD_c_rsyncable, 0); +#else setRand(cctx, ZSTD_c_nbWorkers, 0, 2, producer); setRand(cctx, ZSTD_c_rsyncable, 0, 1, producer); +#endif setRand(cctx, ZSTD_c_useRowMatchFinder, 0, 2, producer); setRand(cctx, ZSTD_c_enableDedicatedDictSearch, 0, 1, producer); setRand(cctx, ZSTD_c_forceMaxWindow, 0, 1, producer); setRand(cctx, ZSTD_c_literalCompressionMode, 0, 2, producer); setRand(cctx, ZSTD_c_forceAttachDict, 0, 2, producer); - setRand(cctx, ZSTD_c_splitBlocks, 0, 1, producer); + setRand(cctx, ZSTD_c_useBlockSplitter, 0, 2, producer); setRand(cctx, ZSTD_c_deterministicRefPrefix, 0, 1, producer); + setRand(cctx, ZSTD_c_prefetchCDictTables, 0, 2, producer); + setRand(cctx, ZSTD_c_maxBlockSize, ZSTD_BLOCKSIZE_MAX_MIN, ZSTD_BLOCKSIZE_MAX, producer); + setRand(cctx, ZSTD_c_validateSequences, 0, 1, producer); + setRand(cctx, ZSTD_c_searchForExternalRepcodes, 0, 2, producer); if (FUZZ_dataProducer_uint32Range(producer, 0, 1) == 0) { setRand(cctx, ZSTD_c_srcSizeHint, ZSTD_SRCSIZEHINT_MIN, 2 * srcSize, producer); } if (FUZZ_dataProducer_uint32Range(producer, 0, 1) == 0) { setRand(cctx, ZSTD_c_targetCBlockSize, ZSTD_TARGETCBLOCKSIZE_MIN, ZSTD_TARGETCBLOCKSIZE_MAX, producer); } + + if (FUZZ_dataProducer_uint32Range(producer, 0, 10) == 1) { + setSequenceProducerParams(cctx, producer); + } else { + ZSTD_registerSequenceProducer(cctx, NULL, NULL); + } } FUZZ_dict_t FUZZ_train(void const* src, size_t srcSize, FUZZ_dataProducer_t *producer) @@ -123,7 +161,7 @@ FUZZ_dict_t FUZZ_train(void const* src, size_t srcSize, FUZZ_dataProducer_t *pro size_t const offset = FUZZ_dataProducer_uint32Range(producer, 0, MAX(srcSize, 1) - 1); size_t const limit = MIN(srcSize - offset, remaining); size_t const toCopy = MIN(limit, remaining / (nbSamples - sample)); - memcpy(samples + pos, src + offset, toCopy); + memcpy(samples + pos, (const char*)src + offset, toCopy); pos += toCopy; samplesSizes[sample] = toCopy; } diff --git a/src/dependencies/zstd-1.5.0/tests/fuzz/zstd_helpers.h b/src/dependencies/zstd-1.5.4/tests/fuzz/zstd_helpers.h similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/fuzz/zstd_helpers.h rename to src/dependencies/zstd-1.5.4/tests/fuzz/zstd_helpers.h index 7813884..a4cfe32 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzz/zstd_helpers.h +++ b/src/dependencies/zstd-1.5.4/tests/fuzz/zstd_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -17,6 +17,7 @@ #define ZSTD_STATIC_LINKING_ONLY #include "zstd.h" +#include "zstd_errors.h" #include "fuzz_data_producer.h" #include diff --git a/src/dependencies/zstd-1.5.0/tests/fuzzer.c b/src/dependencies/zstd-1.5.4/tests/fuzzer.c similarity index 84% rename from src/dependencies/zstd-1.5.0/tests/fuzzer.c rename to src/dependencies/zstd-1.5.4/tests/fuzzer.c index 1ea6521..fc78c7f 100644 --- a/src/dependencies/zstd-1.5.0/tests/fuzzer.c +++ b/src/dependencies/zstd-1.5.4/tests/fuzzer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -25,7 +25,8 @@ #include /* free */ #include /* fgets, sscanf */ #include /* strcmp */ -#undef NDEBUG +#include /* time(), time_t */ +#undef NDEBUG /* always enable assert() */ #include #define ZSTD_STATIC_LINKING_ONLY /* ZSTD_compressContinue, ZSTD_compressBlock */ #include "debug.h" /* DEBUG_STATIC_ASSERT */ @@ -42,7 +43,7 @@ #include "util.h" #include "timefn.h" /* SEC_TO_MICRO, UTIL_time_t, UTIL_TIME_INITIALIZER, UTIL_clockSpanMicro, UTIL_getTime */ /* must be included after util.h, due to ERROR macro redefinition issue on Visual Studio */ -#include "zstd_internal.h" /* ZSTD_WORKSPACETOOLARGE_MAXDURATION, ZSTD_WORKSPACETOOLARGE_FACTOR, KB, MB */ +#include "zstd_internal.h" /* ZSTD_WORKSPACETOOLARGE_MAXDURATION, ZSTD_WORKSPACETOOLARGE_FACTOR, KB, MB */ #include "threading.h" /* ZSTD_pthread_create, ZSTD_pthread_join */ @@ -82,8 +83,8 @@ static UTIL_time_t g_displayClock = UTIL_TIME_INITIALIZER; void FUZ_bug976(void); void FUZ_bug976(void) { /* these constants shall not depend on MIN() macro */ - assert(ZSTD_HASHLOG_MAX < 31); - assert(ZSTD_CHAINLOG_MAX < 31); + DEBUG_STATIC_ASSERT(ZSTD_HASHLOG_MAX < 31); + DEBUG_STATIC_ASSERT(ZSTD_CHAINLOG_MAX < 31); } @@ -118,23 +119,24 @@ static U32 FUZ_highbit32(U32 v32) /*============================================= * Test macros =============================================*/ -#define CHECK_Z(f) { \ - size_t const err = f; \ - if (ZSTD_isError(err)) { \ - DISPLAY("Error => %s : %s ", \ - #f, ZSTD_getErrorName(err)); \ - exit(1); \ +#define CHECK(fn) { if(!(fn)) { DISPLAYLEVEL(1, "Error : test (%s) failed \n", #fn); exit(1); } } + +#define CHECK_Z(f) { \ + size_t const err = f; \ + if (ZSTD_isError(err)) { \ + DISPLAY("Error => %s : %s ", \ + #f, ZSTD_getErrorName(err)); \ + exit(1); \ } } -#define CHECK_VAR(var, fn) var = fn; if (ZSTD_isError(var)) { DISPLAYLEVEL(1, "%s : fails : %s \n", #fn, ZSTD_getErrorName(var)); goto _output_error; } +#define CHECK_VAR(var, fn) var = fn; if (ZSTD_isError(var)) { DISPLAYLEVEL(1, "%s : fails : %s \n", #fn, ZSTD_getErrorName(var)); exit(1); } #define CHECK_NEWV(var, fn) size_t const CHECK_VAR(var, fn) -#define CHECK(fn) { CHECK_NEWV(err, fn); } #define CHECKPLUS(var, fn, more) { CHECK_NEWV(var, fn); more; } #define CHECK_OP(op, lhs, rhs) { \ if (!((lhs) op (rhs))) { \ DISPLAY("Error L%u => FAILED %s %s %s ", __LINE__, #lhs, #op, #rhs); \ - goto _output_error; \ + exit(1); \ } \ } #define CHECK_EQ(lhs, rhs) CHECK_OP(==, lhs, rhs) @@ -338,6 +340,7 @@ static void FUZ_decodeSequences(BYTE* dst, ZSTD_Sequence* seqs, size_t seqsSize, } #ifdef ZSTD_MULTITHREAD + typedef struct { ZSTD_CCtx* cctx; ZSTD_threadPool* pool; @@ -429,8 +432,8 @@ static int threadPoolTests(void) { ZSTD_pthread_create(&t1, NULL, threadPoolTests_compressionJob, &p1); ZSTD_pthread_create(&t2, NULL, threadPoolTests_compressionJob, &p2); - ZSTD_pthread_join(t1, NULL); - ZSTD_pthread_join(t2, NULL); + ZSTD_pthread_join(t1); + ZSTD_pthread_join(t2); assert(!memcmp(decodedBuffer, decodedBuffer2, CNBuffSize)); free(decodedBuffer2); @@ -461,6 +464,101 @@ _output_error: * Unit tests =============================================*/ +static void test_compressBound(unsigned tnb) +{ + DISPLAYLEVEL(3, "test%3u : compressBound : ", tnb); + + /* check ZSTD_compressBound == ZSTD_COMPRESSBOUND + * for a large range of known valid values */ + DEBUG_STATIC_ASSERT(sizeof(size_t) >= 4); + { int s; + for (s=0; s<30; s++) { + size_t const w = (size_t)1 << s; + CHECK_EQ(ZSTD_compressBound(w), ZSTD_COMPRESSBOUND(w)); + } } + + /* Ensure error if srcSize too big */ + { size_t const w = ZSTD_MAX_INPUT_SIZE + 1; + CHECK(ZSTD_isError(ZSTD_compressBound(w))); /* must fail */ + CHECK_EQ(ZSTD_COMPRESSBOUND(w), 0); + } + + DISPLAYLEVEL(3, "OK \n"); +} + +static void test_decompressBound(unsigned tnb) +{ + DISPLAYLEVEL(3, "test%3u : decompressBound : ", tnb); + + /* Simple compression, with size : should provide size; */ + { const char example[] = "abcd"; + char cBuffer[ZSTD_COMPRESSBOUND(sizeof(example))]; + size_t const cSize = ZSTD_compress(cBuffer, sizeof(cBuffer), example, sizeof(example), 0); + CHECK_Z(cSize); + CHECK_EQ(ZSTD_decompressBound(cBuffer, cSize), (unsigned long long)sizeof(example)); + } + + /* Simple small compression without size : should provide 1 block size */ + { char cBuffer[ZSTD_COMPRESSBOUND(0)]; + ZSTD_outBuffer out = { cBuffer, sizeof(cBuffer), 0 }; + ZSTD_inBuffer in = { NULL, 0, 0 }; + ZSTD_CCtx* const cctx = ZSTD_createCCtx(); + assert(cctx); + CHECK_Z( ZSTD_initCStream(cctx, 0) ); + CHECK_Z( ZSTD_compressStream(cctx, &out, &in) ); + CHECK_EQ( ZSTD_endStream(cctx, &out), 0 ); + CHECK_EQ( ZSTD_decompressBound(cBuffer, out.pos), ZSTD_BLOCKSIZE_MAX ); + ZSTD_freeCCtx(cctx); + } + + /* Attempt to overflow 32-bit intermediate multiplication result + * This requires dBound >= 4 GB, aka 2^32. + * This requires 2^32 / 2^17 = 2^15 blocks + * => create 2^15 blocks (can be empty, or just 1 byte). */ + { const char input[] = "a"; + size_t const nbBlocks = (1 << 15) + 1; + size_t blockNb; + size_t const outCapacity = 1 << 18; /* large margin */ + char* const outBuffer = malloc (outCapacity); + ZSTD_outBuffer out = { outBuffer, outCapacity, 0 }; + ZSTD_CCtx* const cctx = ZSTD_createCCtx(); + assert(cctx); + assert(outBuffer); + CHECK_Z( ZSTD_initCStream(cctx, 0) ); + for (blockNb=0; blockNb 0x100000000LLU /* 4 GB */ ); + ZSTD_freeCCtx(cctx); + free(outBuffer); + } + + DISPLAYLEVEL(3, "OK \n"); +} + +static void test_setCParams(unsigned tnb) +{ + ZSTD_CCtx* const cctx = ZSTD_createCCtx(); + ZSTD_compressionParameters cparams; + assert(cctx); + + DISPLAYLEVEL(3, "test%3u : ZSTD_CCtx_setCParams : ", tnb); + + /* valid cparams */ + cparams = ZSTD_getCParams(1, 0, 0); + CHECK_Z(ZSTD_CCtx_setCParams(cctx, cparams)); + + /* invalid cparams (must fail) */ + cparams.windowLog = 99; + CHECK(ZSTD_isError(ZSTD_CCtx_setCParams(cctx, cparams))); + + free(cctx); + DISPLAYLEVEL(3, "OK \n"); +} + static int basicUnitTests(U32 const seed, double compressibility) { size_t const CNBuffSize = 5 MB; @@ -507,6 +605,12 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "%u (OK) \n", vn); } + test_compressBound(testNb++); + + test_decompressBound(testNb++); + + test_setCParams(testNb++); + DISPLAYLEVEL(3, "test%3u : ZSTD_adjustCParams : ", testNb++); { ZSTD_compressionParameters params; @@ -580,6 +684,17 @@ static int basicUnitTests(U32 const seed, double compressibility) if (r != CNBuffSize) goto _output_error; } DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : decompress %u bytes with Huffman assembly disabled : ", testNb++, (unsigned)CNBuffSize); + { + ZSTD_DCtx* dctx = ZSTD_createDCtx(); + size_t r; + CHECK_Z(ZSTD_DCtx_setParameter(dctx, ZSTD_d_disableHuffmanAssembly, 1)); + r = ZSTD_decompress(decodedBuffer, CNBuffSize, compressedBuffer, cSize); + if (r != CNBuffSize || memcmp(decodedBuffer, CNBuffer, CNBuffSize)) goto _output_error; + ZSTD_freeDCtx(dctx); + } + DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : check decompressed result : ", testNb++); { size_t u; for (u=0; u 10 * refPrefixLdmComrpessedSize); - /* make sure the ldm comrpessed size is less than 1% of original */ - assert((double)refPrefixLdmComrpessedSize / (double)size < 0.01); + assert(refPrefixCompressedSize > 10 * refPrefixLdmCompressedSize); + /* make sure the ldm compressed size is less than 1% of original */ + assert((double)refPrefixLdmCompressedSize / (double)size < 0.01); ZSTD_freeDCtx(dctx); ZSTD_freeCCtx(cctx); @@ -1117,6 +1232,60 @@ static int basicUnitTests(U32 const seed, double compressibility) } DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : in-place decompression : ", testNb++); + cSize = ZSTD_compress(compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize, -ZSTD_BLOCKSIZE_MAX); + CHECK_Z(cSize); + CHECK_LT(CNBuffSize, cSize); + { + size_t const margin = ZSTD_decompressionMargin(compressedBuffer, cSize); + size_t const outputSize = (CNBuffSize + margin); + char* output = malloc(outputSize); + char* input = output + outputSize - cSize; + CHECK_LT(cSize, CNBuffSize + margin); + CHECK(output != NULL); + CHECK_Z(margin); + CHECK(margin <= ZSTD_DECOMPRESSION_MARGIN(CNBuffSize, ZSTD_BLOCKSIZE_MAX)); + memcpy(input, compressedBuffer, cSize); + + { + size_t const dSize = ZSTD_decompress(output, outputSize, input, cSize); + CHECK_Z(dSize); + CHECK_EQ(dSize, CNBuffSize); + } + CHECK(!memcmp(output, CNBuffer, CNBuffSize)); + free(output); + } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : in-place decompression with 2 frames : ", testNb++); + cSize = ZSTD_compress(compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize / 3, -ZSTD_BLOCKSIZE_MAX); + CHECK_Z(cSize); + { + size_t const cSize2 = ZSTD_compress((char*)compressedBuffer + cSize, compressedBufferSize - cSize, (char const*)CNBuffer + (CNBuffSize / 3), CNBuffSize / 3, -ZSTD_BLOCKSIZE_MAX); + CHECK_Z(cSize2); + cSize += cSize2; + } + { + size_t const srcSize = (CNBuffSize / 3) * 2; + size_t const margin = ZSTD_decompressionMargin(compressedBuffer, cSize); + size_t const outputSize = (CNBuffSize + margin); + char* output = malloc(outputSize); + char* input = output + outputSize - cSize; + CHECK_LT(cSize, CNBuffSize + margin); + CHECK(output != NULL); + CHECK_Z(margin); + memcpy(input, compressedBuffer, cSize); + + { + size_t const dSize = ZSTD_decompress(output, outputSize, input, cSize); + CHECK_Z(dSize); + CHECK_EQ(dSize, srcSize); + } + CHECK(!memcmp(output, CNBuffer, srcSize)); + free(output); + } + DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3d: superblock uncompressible data, too many nocompress superblocks : ", testNb++); { ZSTD_CCtx* const cctx = ZSTD_createCCtx(); @@ -1206,7 +1375,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : compress a NULL input with each level : ", testNb++); { int level = -1; - ZSTD_CCtx* cctx = ZSTD_createCCtx(); + ZSTD_CCtx* const cctx = ZSTD_createCCtx(); if (!cctx) goto _output_error; for (level = -1; level <= ZSTD_maxCLevel(); ++level) { CHECK_Z( ZSTD_compress(compressedBuffer, compressedBufferSize, NULL, 0, level) ); @@ -1528,7 +1697,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : resize context to full CCtx size : ", testNb++); staticCCtx = ZSTD_initStaticCStream(staticCCtxBuffer, staticCCtxSize); - DISPLAYLEVEL(4, "staticCCtxBuffer = %p, staticCCtx = %p , ", staticCCtxBuffer, staticCCtx); + DISPLAYLEVEL(4, "staticCCtxBuffer = %p, staticCCtx = %p , ", staticCCtxBuffer, (void*)staticCCtx); if (staticCCtx == NULL) goto _output_error; DISPLAYLEVEL(3, "OK \n"); @@ -1579,7 +1748,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : init CCtx for small level %u (should work again) : ", testNb++, 1); - CHECK( ZSTD_compressBegin(staticCCtx, 1) ); + CHECK_Z( ZSTD_compressBegin(staticCCtx, 1) ); DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : use CStream on CCtx-sized static context (should fail) : ", testNb++); @@ -1622,6 +1791,94 @@ static int basicUnitTests(U32 const seed, double compressibility) if (!ZSTD_isError(r)) goto _output_error; } DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : test estimation functions with default cctx params : ", testNb++); + { + // Test ZSTD_estimateCCtxSize_usingCCtxParams + { + ZSTD_CCtx_params* params = ZSTD_createCCtxParams(); + size_t const cctxSizeDefault = ZSTD_estimateCCtxSize_usingCCtxParams(params); + staticCCtx = ZSTD_initStaticCCtx(staticCCtxBuffer, cctxSizeDefault); + CHECK_VAR(cSize, ZSTD_compressCCtx(staticCCtx, + compressedBuffer, compressedBufferSize, + CNBuffer, CNBuffSize, 3)); + + { + size_t const r = ZSTD_decompressDCtx(staticDCtx, + decodedBuffer, CNBuffSize, + compressedBuffer, cSize); + if (r != CNBuffSize) goto _output_error; + if (memcmp(decodedBuffer, CNBuffer, CNBuffSize)) goto _output_error; + } + ZSTD_freeCCtxParams(params); + } + + // Test ZSTD_estimateCStreamSize_usingCCtxParams + { + ZSTD_CCtx_params* params = ZSTD_createCCtxParams(); + size_t const cctxSizeDefault = ZSTD_estimateCStreamSize_usingCCtxParams(params); + staticCCtx = ZSTD_initStaticCCtx(staticCCtxBuffer, cctxSizeDefault); + CHECK_VAR(cSize, ZSTD_compressCCtx(staticCCtx, + compressedBuffer, compressedBufferSize, + CNBuffer, CNBuffSize, 3) ); + + { + size_t const r = ZSTD_decompressDCtx(staticDCtx, + decodedBuffer, CNBuffSize, + compressedBuffer, cSize); + if (r != CNBuffSize) goto _output_error; + if (memcmp(decodedBuffer, CNBuffer, CNBuffSize)) goto _output_error; + } + ZSTD_freeCCtxParams(params); + } + } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : test estimation functions with maxBlockSize = 0 : ", testNb++); + { + // Test ZSTD_estimateCCtxSize_usingCCtxParams + { + ZSTD_CCtx_params* params = ZSTD_createCCtxParams(); + size_t cctxSizeDefault; + CHECK_Z(ZSTD_CCtxParams_setParameter(params, ZSTD_c_maxBlockSize, 0)); + cctxSizeDefault = ZSTD_estimateCCtxSize_usingCCtxParams(params); + staticCCtx = ZSTD_initStaticCCtx(staticCCtxBuffer, cctxSizeDefault); + CHECK_VAR(cSize, ZSTD_compressCCtx(staticCCtx, + compressedBuffer, compressedBufferSize, + CNBuffer, CNBuffSize, 3) ); + + { + size_t const r = ZSTD_decompressDCtx(staticDCtx, + decodedBuffer, CNBuffSize, + compressedBuffer, cSize); + if (r != CNBuffSize) goto _output_error; + if (memcmp(decodedBuffer, CNBuffer, CNBuffSize)) goto _output_error; + } + ZSTD_freeCCtxParams(params); + } + + // Test ZSTD_estimateCStreamSize_usingCCtxParams + { + ZSTD_CCtx_params* params = ZSTD_createCCtxParams(); + size_t cctxSizeDefault; + CHECK_Z(ZSTD_CCtxParams_setParameter(params, ZSTD_c_maxBlockSize, 0)); + cctxSizeDefault = ZSTD_estimateCStreamSize_usingCCtxParams(params); + staticCCtx = ZSTD_initStaticCCtx(staticCCtxBuffer, cctxSizeDefault); + CHECK_VAR(cSize, ZSTD_compressCCtx(staticCCtx, + compressedBuffer, compressedBufferSize, + CNBuffer, CNBuffSize, 3) ); + + { + size_t const r = ZSTD_decompressDCtx(staticDCtx, + decodedBuffer, CNBuffSize, + compressedBuffer, cSize); + if (r != CNBuffSize) goto _output_error; + if (memcmp(decodedBuffer, CNBuffer, CNBuffSize)) goto _output_error; + } + ZSTD_freeCCtxParams(params); + } + } + DISPLAYLEVEL(3, "OK \n"); } free(staticCCtxBuffer); free(staticDCtxBuffer); @@ -1647,8 +1904,8 @@ static int basicUnitTests(U32 const seed, double compressibility) testResult = 1; goto _end; } - CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_nbWorkers, 2) ); - CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_compressionLevel, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_nbWorkers, 2) ); + CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_compressionLevel, 1) ); DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3u : compress %u bytes with 2 threads : ", testNb++, (unsigned)CNBuffSize); @@ -1678,9 +1935,9 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : compress -T2 with checksum : ", testNb++); - CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_checksumFlag, 1) ); - CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_contentSizeFlag, 1) ); - CHECK( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_overlapLog, 3) ); + CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_checksumFlag, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_contentSizeFlag, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(mtctx, ZSTD_c_overlapLog, 3) ); CHECK_VAR(cSize, ZSTD_compress2(mtctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize) ); @@ -1699,11 +1956,11 @@ static int basicUnitTests(U32 const seed, double compressibility) ZSTD_DCtx* const dctx = ZSTD_createDCtx(); char out[32]; if (cctx == NULL || dctx == NULL) goto _output_error; - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_contentSizeFlag, 0) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_contentSizeFlag, 0) ); CHECK_VAR(cSize, ZSTD_compress2(cctx, out, sizeof(out), NULL, 0) ); DISPLAYLEVEL(3, "OK (%u bytes)\n", (unsigned)cSize); - CHECK( ZSTD_DCtx_setParameter(dctx, ZSTD_d_windowLogMax, 10) ); + CHECK_Z( ZSTD_DCtx_setParameter(dctx, ZSTD_d_windowLogMax, 10) ); { char const* outPtr = out; ZSTD_inBuffer inBuffer = { outPtr, cSize, 0 }; ZSTD_outBuffer outBuffer = { NULL, 0, 0 }; @@ -1718,9 +1975,9 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : compress with block splitting : ", testNb++) { ZSTD_CCtx* cctx = ZSTD_createCCtx(); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_splitBlocks, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_useBlockSplitter, ZSTD_ps_enable) ); cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); - CHECK(cSize); + CHECK_Z(cSize); ZSTD_freeCCtx(cctx); } DISPLAYLEVEL(3, "OK \n"); @@ -1728,13 +1985,13 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : compress -T2 with/without literals compression : ", testNb++) { ZSTD_CCtx* cctx = ZSTD_createCCtx(); size_t cSize1, cSize2; - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) ); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 2) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 2) ); cSize1 = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); - CHECK(cSize1); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_literalCompressionMode, ZSTD_lcm_uncompressed) ); + CHECK_Z(cSize1); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_literalCompressionMode, ZSTD_ps_disable) ); cSize2 = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); - CHECK(cSize2); + CHECK_Z(cSize2); CHECK_LT(cSize1, cSize2); ZSTD_freeCCtx(cctx); } @@ -1745,10 +2002,10 @@ static int basicUnitTests(U32 const seed, double compressibility) /* Set rsyncable and don't give the ZSTD_compressBound(CNBuffSize) so * ZSTDMT is forced to not take the shortcut. */ - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) ); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 1) ); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_rsyncable, 1) ); - CHECK( ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize - 1, CNBuffer, CNBuffSize) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_rsyncable, 1) ); + CHECK_Z( ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize - 1, CNBuffer, CNBuffSize) ); ZSTD_freeCCtx(cctx); } DISPLAYLEVEL(3, "OK \n"); @@ -1758,22 +2015,22 @@ static int basicUnitTests(U32 const seed, double compressibility) int const jobSize = 512 KB; int value; /* Check that the overlap log and job size are unset. */ - CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) ); + CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) ); CHECK_EQ(value, 0); - CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) ); + CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) ); CHECK_EQ(value, 0); /* Set and check the overlap log and job size. */ - CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_overlapLog, 5) ); - CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_jobSize, jobSize) ); - CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) ); + CHECK_Z( ZSTD_CCtxParams_setParameter(params, ZSTD_c_overlapLog, 5) ); + CHECK_Z( ZSTD_CCtxParams_setParameter(params, ZSTD_c_jobSize, jobSize) ); + CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) ); CHECK_EQ(value, 5); - CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) ); + CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) ); CHECK_EQ(value, jobSize); /* Set the number of workers and check the overlap log and job size. */ - CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_nbWorkers, 2) ); - CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) ); + CHECK_Z( ZSTD_CCtxParams_setParameter(params, ZSTD_c_nbWorkers, 2) ); + CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) ); CHECK_EQ(value, 5); - CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) ); + CHECK_Z( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) ); CHECK_EQ(value, jobSize); ZSTD_freeCCtxParams(params); } @@ -1830,6 +2087,47 @@ static int basicUnitTests(U32 const seed, double compressibility) if (memcmp(decodedBuffer, CNBuffer, CNBuffSize / 2) != 0) goto _output_error; DISPLAYLEVEL(3, "OK \n"); + /* Simple API skippable frame test */ + DISPLAYLEVEL(3, "test%3i : read/write a skippable frame : ", testNb++); + { U32 i; + unsigned readMagic; + unsigned long long receivedSize; + size_t skippableSize; + const U32 skipLen = 129 KB; + char* const skipBuff = (char*)malloc(skipLen); + assert(skipBuff != NULL); + for (i = 0; i < skipLen; i++) + skipBuff[i] = (char) ((seed + i) % 256); + skippableSize = ZSTD_writeSkippableFrame( + compressedBuffer, compressedBufferSize, + skipBuff, skipLen, seed % 15); + CHECK_Z(skippableSize); + CHECK_EQ(1, ZSTD_isSkippableFrame(compressedBuffer, skippableSize)); + receivedSize = ZSTD_readSkippableFrame(decodedBuffer, CNBuffSize, &readMagic, compressedBuffer, skippableSize); + CHECK_EQ(skippableSize, receivedSize + ZSTD_SKIPPABLEHEADERSIZE); + CHECK_EQ(seed % 15, readMagic); + if (memcmp(decodedBuffer, skipBuff, skipLen) != 0) goto _output_error; + + free(skipBuff); + } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : read/write an empty skippable frame : ", testNb++); + { + unsigned readMagic; + unsigned long long receivedSize; + size_t skippableSize; + skippableSize = ZSTD_writeSkippableFrame( + compressedBuffer, compressedBufferSize, + CNBuffer, 0, seed % 15); + CHECK_EQ(ZSTD_SKIPPABLEHEADERSIZE, skippableSize); + CHECK_EQ(1, ZSTD_isSkippableFrame(compressedBuffer, skippableSize)); + receivedSize = ZSTD_readSkippableFrame(NULL, 0, &readMagic, compressedBuffer, skippableSize); + CHECK_EQ(skippableSize, receivedSize + ZSTD_SKIPPABLEHEADERSIZE); + CHECK_EQ(seed % 15, readMagic); + } + DISPLAYLEVEL(3, "OK \n"); + /* Dictionary and CCtx Duplication tests */ { ZSTD_CCtx* const ctxOrig = ZSTD_createCCtx(); ZSTD_CCtx* const ctxDuplicated = ZSTD_createCCtx(); @@ -1843,8 +2141,8 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : load dictionary into context : ", testNb++); - CHECK( ZSTD_compressBegin_usingDict(ctxOrig, CNBuffer, dictSize, 2) ); - CHECK( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, 0) ); /* Begin_usingDict implies unknown srcSize, so match that */ + CHECK_Z( ZSTD_compressBegin_usingDict(ctxOrig, CNBuffer, dictSize, 2) ); + CHECK_Z( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, 0) ); /* Begin_usingDict implies unknown srcSize, so match that */ DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : compress with flat dictionary : ", testNb++); @@ -1904,8 +2202,8 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : check content size on duplicated context : ", testNb++); { size_t const testSize = CNBuffSize / 3; - CHECK( ZSTD_compressBegin(ctxOrig, ZSTD_defaultCLevel()) ); - CHECK( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, testSize) ); + CHECK_Z( ZSTD_compressBegin(ctxOrig, ZSTD_defaultCLevel()) ); + CHECK_Z( ZSTD_copyCCtx(ctxDuplicated, ctxOrig, testSize) ); CHECK_VAR(cSize, ZSTD_compressEnd(ctxDuplicated, compressedBuffer, ZSTD_compressBound(testSize), (const char*)CNBuffer + dictSize, testSize) ); @@ -1915,29 +2213,37 @@ static int basicUnitTests(U32 const seed, double compressibility) } } DISPLAYLEVEL(3, "OK \n"); + /* Note : these tests should be replaced by proper regression tests, + * but existing ones do not focus on small data + dictionary + all levels. + */ if ((int)(compressibility * 100 + 0.1) == FUZ_compressibility_default) { /* test only valid with known input */ size_t const flatdictSize = 22 KB; size_t const contentSize = 9 KB; const void* const dict = (const char*)CNBuffer; const void* const contentStart = (const char*)dict + flatdictSize; /* These upper bounds are generally within a few bytes of the compressed size */ - size_t const target_nodict_cSize[22+1] = { 3840, 3770, 3870, 3830, 3770, - 3770, 3770, 3770, 3750, 3750, - 3742, 3670, 3670, 3660, 3660, - 3660, 3660, 3660, 3660, 3660, - 3660, 3660, 3660 }; - size_t const target_wdict_cSize[22+1] = { 2830, 2890, 2890, 2820, 2940, + size_t target_nodict_cSize[22+1] = { 3840, 3770, 3870, 3830, 3770, + 3770, 3770, 3770, 3750, 3750, + 3742, 3675, 3674, 3665, 3664, + 3663, 3662, 3661, 3660, 3660, + 3660, 3660, 3660 }; + size_t const target_wdict_cSize[22+1] = { 2830, 2896, 2893, 2820, 2940, 2950, 2950, 2925, 2900, 2891, - 2910, 2910, 2910, 2770, 2760, - 2750, 2750, 2750, 2750, 2750, - 2750, 2750, 2750 }; + 2910, 2910, 2910, 2780, 2775, + 2765, 2760, 2755, 2754, 2753, + 2753, 2753, 2753 }; int l = 1; int const maxLevel = ZSTD_maxCLevel(); + /* clevels with strategies that support rowhash on small inputs */ + int rowLevel = 4; + int const rowLevelEnd = 8; DISPLAYLEVEL(3, "test%3i : flat-dictionary efficiency test : \n", testNb++); assert(maxLevel == 22); RDG_genBuffer(CNBuffer, flatdictSize + contentSize, compressibility, 0., seed); - DISPLAYLEVEL(4, "content hash : %016llx; dict hash : %016llx \n", XXH64(contentStart, contentSize, 0), XXH64(dict, flatdictSize, 0)); + DISPLAYLEVEL(4, "content hash : %016llx; dict hash : %016llx \n", + (unsigned long long)XXH64(contentStart, contentSize, 0), + (unsigned long long)XXH64(dict, flatdictSize, 0)); for ( ; l <= maxLevel; l++) { size_t const nodict_cSize = ZSTD_compress(compressedBuffer, compressedBufferSize, @@ -1964,6 +2270,27 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(4, "level %i with dictionary : max expected %u >= reached %u \n", l, (unsigned)target_wdict_cSize[l], (unsigned)wdict_cSize); } + /* Compression with ZSTD_compress2 and row match finder force enabled. + * Give some slack for force-enabled row matchfinder since we're on a small input (9KB) + */ + for ( ; rowLevel <= rowLevelEnd; ++rowLevel) target_nodict_cSize[rowLevel] += 5; + for (l=1 ; l <= maxLevel; l++) { + ZSTD_CCtx* const cctx = ZSTD_createCCtx(); + size_t nodict_cSize; + ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, l); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_useRowMatchFinder, ZSTD_ps_enable); + nodict_cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, + contentStart, contentSize); + if (nodict_cSize > target_nodict_cSize[l]) { + DISPLAYLEVEL(1, "error : compression with compress2 at level %i worse than expected (%u > %u) \n", + l, (unsigned)nodict_cSize, (unsigned)target_nodict_cSize[l]); + ZSTD_freeCCtx(cctx); + goto _output_error; + } + DISPLAYLEVEL(4, "level %i with compress2 : max expected %u >= reached %u \n", + l, (unsigned)target_nodict_cSize[l], (unsigned)nodict_cSize); + ZSTD_freeCCtx(cctx); + } /* Dict compression with DMS */ for ( l=1 ; l <= maxLevel; l++) { size_t wdict_cSize; @@ -1971,6 +2298,7 @@ static int basicUnitTests(U32 const seed, double compressibility) CHECK_Z( ZSTD_CCtx_setParameter(ctxOrig, ZSTD_c_compressionLevel, l) ); CHECK_Z( ZSTD_CCtx_setParameter(ctxOrig, ZSTD_c_enableDedicatedDictSearch, 0) ); CHECK_Z( ZSTD_CCtx_setParameter(ctxOrig, ZSTD_c_forceAttachDict, ZSTD_dictForceAttach) ); + CHECK_Z( ZSTD_CCtx_setParameter(ctxOrig, ZSTD_c_prefetchCDictTables, seed % 3) ); wdict_cSize = ZSTD_compress2(ctxOrig, compressedBuffer, compressedBufferSize, contentStart, contentSize); if (wdict_cSize > target_wdict_cSize[l]) { DISPLAYLEVEL(1, "error : compression with dictionary and compress2 at level %i worse than expected (%u > %u) \n", @@ -2275,6 +2603,27 @@ static int basicUnitTests(U32 const seed, double compressibility) } DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3d : bufferless api with cdict : ", testNb++); + { ZSTD_CDict* const cdict = ZSTD_createCDict(dictBuffer, dictSize, 1); + ZSTD_DCtx* const dctx = ZSTD_createDCtx(); + ZSTD_frameParameters const fParams = { 0, 1, 0 }; + size_t cBlockSize; + cSize = 0; + CHECK_Z(ZSTD_compressBegin_usingCDict_advanced(cctx, cdict, fParams, ZSTD_CONTENTSIZE_UNKNOWN)); + cBlockSize = ZSTD_compressContinue(cctx, (char*)compressedBuffer + cSize, compressedBufferSize - cSize, CNBuffer, 1000); + CHECK_Z(cBlockSize); + cSize += cBlockSize; + cBlockSize = ZSTD_compressEnd(cctx, (char*)compressedBuffer + cSize, compressedBufferSize - cSize, (char const*)CNBuffer + 2000, 1000); + CHECK_Z(cBlockSize); + cSize += cBlockSize; + + CHECK_Z(ZSTD_decompress_usingDict(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize, dictBuffer, dictSize)); + + ZSTD_freeCDict(cdict); + ZSTD_freeDCtx(dctx); + } + DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : Building cdict w/ ZSTD_dct_fullDict on a good dictionary : ", testNb++); { ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, CNBuffSize, dictSize); ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_fullDict, cParams, ZSTD_defaultCMem); @@ -2470,7 +2819,7 @@ static int basicUnitTests(U32 const seed, double compressibility) ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters); CHECK_Z( ZSTD_DCtx_loadDictionary(dctx, dictBuffer, dictSize) ); CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) ); - /* The dictionary should presist across calls. */ + /* The dictionary should persist across calls. */ CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) ); /* When we reset the context the dictionary is cleared. */ ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters); @@ -2489,7 +2838,7 @@ static int basicUnitTests(U32 const seed, double compressibility) ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters); CHECK_Z( ZSTD_DCtx_refDDict(dctx, ddict) ); CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) ); - /* The ddict should presist across calls. */ + /* The ddict should persist across calls. */ CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) ); /* When we reset the context the ddict is cleared. */ ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters); @@ -2515,6 +2864,90 @@ static int basicUnitTests(U32 const seed, double compressibility) } DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : ZSTD_fast attach dictionary with hashLog = 25 and chainLog = 25 : ", testNb++); + { + ZSTD_CCtx_params* cctxParams = ZSTD_createCCtxParams(); + ZSTD_customMem customMem = {NULL, NULL, NULL}; + ZSTD_DCtx* dctx = ZSTD_createDCtx(); + ZSTD_CDict* cdict; + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_strategy, ZSTD_fast)); + /* Set windowLog to 25 so hash/chain logs don't get sized down */ + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_windowLog, 25)); + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_hashLog, 25)); + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_chainLog, 25)); + /* Set srcSizeHint to 2^25 so hash/chain logs don't get sized down */ + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_srcSizeHint, 1u << 25)); + cdict = ZSTD_createCDict_advanced2(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto, cctxParams, customMem); + CHECK_Z(ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_forceAttachDict, ZSTD_dictForceAttach)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1)); + CHECK_Z(ZSTD_CCtx_refCDict(cctx, cdict)); + cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); + CHECK_Z(cSize); + CHECK_Z(ZSTD_decompress_usingDict(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize, dictBuffer, dictSize)); + ZSTD_freeCDict(cdict); + ZSTD_freeDCtx(dctx); + ZSTD_freeCCtxParams(cctxParams); + } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : ZSTD_dfast attach dictionary with hashLog = 25 and chainLog = 25 : ", testNb++); + { + ZSTD_CCtx_params* cctxParams = ZSTD_createCCtxParams(); + ZSTD_customMem customMem = {NULL, NULL, NULL}; + ZSTD_DCtx* dctx = ZSTD_createDCtx(); + ZSTD_CDict* cdict; + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_strategy, ZSTD_dfast)); + /* Set windowLog to 25 so hash/chain logs don't get sized down */ + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_windowLog, 25)); + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_hashLog, 25)); + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_chainLog, 25)); + /* Set srcSizeHint to 2^25 so hash/chain logs don't get sized down */ + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_srcSizeHint, 1u << 25)); + cdict = ZSTD_createCDict_advanced2(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto, cctxParams, customMem); + CHECK_Z(ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_forceAttachDict, ZSTD_dictForceAttach)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1)); + CHECK_Z(ZSTD_CCtx_refCDict(cctx, cdict)); + cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); + CHECK_Z(cSize); + CHECK_Z(ZSTD_decompress_usingDict(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize, dictBuffer, dictSize)); + ZSTD_freeCDict(cdict); + ZSTD_freeDCtx(dctx); + ZSTD_freeCCtxParams(cctxParams); + } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : ZSTD_lazy attach dictionary with hashLog = 29 and searchLog = 4 : ", testNb++); + if (MEM_64bits()) { + ZSTD_CCtx_params* cctxParams = ZSTD_createCCtxParams(); + ZSTD_customMem customMem = {NULL, NULL, NULL}; + ZSTD_DCtx* dctx = ZSTD_createDCtx(); + ZSTD_CDict* cdict; + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_strategy, ZSTD_lazy)); + /* Force enable row based match finder, and disable dedicated dict search. */ + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_useRowMatchFinder, ZSTD_ps_enable)); + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_enableDedicatedDictSearch, 0)); + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_searchLog, 4)); + /* Set windowLog to 29 so hash/chain logs don't get sized down */ + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_windowLog, 29)); + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_hashLog, 29)); + /* Set srcSizeHint to 2^29 so hash/chain logs don't get sized down */ + CHECK_Z(ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_srcSizeHint, 1u << 29)); + cdict = ZSTD_createCDict_advanced2(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto, cctxParams, customMem); + CHECK_Z(ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_forceAttachDict, ZSTD_dictForceAttach)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1)); + CHECK_Z(ZSTD_CCtx_refCDict(cctx, cdict)); + cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); + CHECK_Z(cSize); + CHECK_Z(ZSTD_decompress_usingDict(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize, dictBuffer, dictSize)); + ZSTD_freeCDict(cdict); + ZSTD_freeDCtx(dctx); + ZSTD_freeCCtxParams(cctxParams); + } + DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : Dictionary with non-default repcodes : ", testNb++); { U32 u; for (u=0; u %u bytes)\n", (unsigned)inputSize, (unsigned)result); @@ -2785,7 +3218,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : get dParameter bounds ", testNb++); { ZSTD_bounds const bounds = ZSTD_dParam_getBounds(ZSTD_d_windowLogMax); - CHECK(bounds.error); + CHECK_Z(bounds.error); } DISPLAYLEVEL(3, "OK \n"); @@ -2819,7 +3252,7 @@ static int basicUnitTests(U32 const seed, double compressibility) /* basic block compression */ DISPLAYLEVEL(3, "test%3i : magic-less format test : ", testNb++); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) ); { ZSTD_inBuffer in = { CNBuffer, inputSize, 0 }; ZSTD_outBuffer out = { compressedBuffer, ZSTD_compressBound(inputSize), 0 }; size_t const result = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end); @@ -2837,7 +3270,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : decompress of magic-less frame : ", testNb++); ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters); - CHECK( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) ); + CHECK_Z( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) ); { ZSTD_frameHeader zfh; size_t const zfhrt = ZSTD_getFrameHeader_advanced(&zfh, compressedBuffer, cSize, ZSTD_f_zstd1_magicless); if (zfhrt != 0) goto _output_error; @@ -2859,7 +3292,7 @@ static int basicUnitTests(U32 const seed, double compressibility) /* basic block compression */ DISPLAYLEVEL(3, "test%3i : empty magic-less format test : ", testNb++); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_format, ZSTD_f_zstd1_magicless) ); { ZSTD_inBuffer in = { CNBuffer, 0, 0 }; ZSTD_outBuffer out = { compressedBuffer, ZSTD_compressBound(0), 0 }; size_t const result = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end); @@ -2871,7 +3304,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : decompress of empty magic-less frame : ", testNb++); ZSTD_DCtx_reset(dctx, ZSTD_reset_session_and_parameters); - CHECK( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) ); + CHECK_Z( ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, ZSTD_f_zstd1_magicless) ); /* one shot */ { size_t const result = ZSTD_decompressDCtx(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize); if (result != 0) goto _output_error; @@ -2906,13 +3339,13 @@ static int basicUnitTests(U32 const seed, double compressibility) int check; if (ZSTD_isError(bounds.error)) continue; - CHECK(ZSTD_DCtx_getParameter(dctx, dParam, &value1)); + CHECK_Z(ZSTD_DCtx_getParameter(dctx, dParam, &value1)); value2 = (value1 != bounds.lowerBound) ? bounds.lowerBound : bounds.upperBound; - CHECK(ZSTD_DCtx_setParameter(dctx, dParam, value2)); - CHECK(ZSTD_DCtx_getParameter(dctx, dParam, &check)); + CHECK_Z(ZSTD_DCtx_setParameter(dctx, dParam, value2)); + CHECK_Z(ZSTD_DCtx_getParameter(dctx, dParam, &check)); if (check != value2) goto _output_error; - CHECK(ZSTD_DCtx_reset(dctx, ZSTD_reset_parameters)); - CHECK(ZSTD_DCtx_getParameter(dctx, dParam, &check)); + CHECK_Z(ZSTD_DCtx_reset(dctx, ZSTD_reset_parameters)); + CHECK_Z(ZSTD_DCtx_getParameter(dctx, dParam, &check)); if (check != value1) goto _output_error; } ZSTD_freeDCtx(dctx); @@ -2929,21 +3362,21 @@ static int basicUnitTests(U32 const seed, double compressibility) /* basic block compression */ DISPLAYLEVEL(3, "test%3i : Block compression test : ", testNb++); - CHECK( ZSTD_compressBegin(cctx, 5) ); - CHECK( ZSTD_getBlockSize(cctx) >= blockSize); + CHECK_Z( ZSTD_compressBegin(cctx, 5) ); + CHECK_Z( ZSTD_getBlockSize(cctx) >= blockSize); CHECK_VAR(cSize, ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), CNBuffer, blockSize) ); DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : Block decompression test : ", testNb++); - CHECK( ZSTD_decompressBegin(dctx) ); + CHECK_Z( ZSTD_decompressBegin(dctx) ); { CHECK_NEWV(r, ZSTD_decompressBlock(dctx, decodedBuffer, CNBuffSize, compressedBuffer, cSize) ); if (r != blockSize) goto _output_error; } DISPLAYLEVEL(3, "OK \n"); /* very long stream of block compression */ DISPLAYLEVEL(3, "test%3i : Huge block streaming compression test : ", testNb++); - CHECK( ZSTD_compressBegin(cctx, -199) ); /* we just want to quickly overflow internal U32 index */ - CHECK( ZSTD_getBlockSize(cctx) >= blockSize); + CHECK_Z( ZSTD_compressBegin(cctx, -199) ); /* we just want to quickly overflow internal U32 index */ + CHECK_Z( ZSTD_getBlockSize(cctx) >= blockSize); { U64 const toCompress = 5000000000ULL; /* > 4 GB */ U64 compressed = 0; while (compressed < toCompress) { @@ -2956,7 +3389,7 @@ static int basicUnitTests(U32 const seed, double compressibility) /* dictionary block compression */ DISPLAYLEVEL(3, "test%3i : Dictionary Block compression test : ", testNb++); - CHECK( ZSTD_compressBegin_usingDict(cctx, CNBuffer, dictSize, 5) ); + CHECK_Z( ZSTD_compressBegin_usingDict(cctx, CNBuffer, dictSize, 5) ); CHECK_VAR(cSize, ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize, blockSize)); RDG_genBuffer((char*)CNBuffer+dictSize+blockSize, blockSize, 0.0, 0.0, seed); /* create a non-compressible second block */ { CHECK_NEWV(r, ZSTD_compressBlock(cctx, (char*)compressedBuffer+cSize, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize+blockSize, blockSize) ); /* for cctx history consistency */ @@ -2967,7 +3400,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : Dictionary Block decompression test : ", testNb++); - CHECK( ZSTD_decompressBegin_usingDict(dctx, CNBuffer, dictSize) ); + CHECK_Z( ZSTD_decompressBegin_usingDict(dctx, CNBuffer, dictSize) ); { CHECK_NEWV( r, ZSTD_decompressBlock(dctx, decodedBuffer, blockSize, compressedBuffer, cSize) ); if (r != blockSize) { DISPLAYLEVEL(1, "ZSTD_decompressBlock() with _usingDict() fails : %u, instead of %u expected \n", (unsigned)r, (unsigned)blockSize); @@ -2986,8 +3419,8 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : Block compression with CDict : ", testNb++); { ZSTD_CDict* const cdict = ZSTD_createCDict(CNBuffer, dictSize, 3); if (cdict==NULL) goto _output_error; - CHECK( ZSTD_compressBegin_usingCDict(cctx, cdict) ); - CHECK( ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize, blockSize) ); + CHECK_Z( ZSTD_compressBegin_usingCDict(cctx, cdict) ); + CHECK_Z( ZSTD_compressBlock(cctx, compressedBuffer, ZSTD_compressBound(blockSize), (char*)CNBuffer+dictSize, blockSize) ); ZSTD_freeCDict(cdict); } DISPLAYLEVEL(3, "OK \n"); @@ -3044,18 +3477,17 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : ZSTD_getSequences followed by ZSTD_compressSequences : ", testNb++); { - size_t srcSize = 500 KB; - BYTE* src = (BYTE*)CNBuffer; - BYTE* dst = (BYTE*)compressedBuffer; - size_t dstSize = ZSTD_compressBound(srcSize); - size_t decompressSize = srcSize; - char* decompressBuffer = (char*)malloc(decompressSize); + const size_t srcSize = 500 KB; + const BYTE* const src = (BYTE*)CNBuffer; + BYTE* const dst = (BYTE*)compressedBuffer; + const size_t dstCapacity = ZSTD_compressBound(srcSize); + const size_t decompressSize = srcSize; + char* const decompressBuffer = (char*)malloc(decompressSize); size_t compressedSize; - size_t dSize; - ZSTD_CCtx* cctx = ZSTD_createCCtx(); - ZSTD_Sequence* seqs = (ZSTD_Sequence*)malloc(srcSize * sizeof(ZSTD_Sequence)); - size_t seqsSize; + ZSTD_CCtx* const cctx = ZSTD_createCCtx(); + ZSTD_Sequence* const seqs = (ZSTD_Sequence*)malloc(srcSize * sizeof(ZSTD_Sequence)); + size_t nbSeqs; if (seqs == NULL) goto _output_error; assert(cctx != NULL); @@ -3063,36 +3495,37 @@ static int basicUnitTests(U32 const seed, double compressibility) /* Populate src with random data */ RDG_genBuffer(CNBuffer, srcSize, compressibility, 0., seed); - /* Test with block delimiters roundtrip */ - seqsSize = ZSTD_generateSequences(cctx, seqs, srcSize, src, srcSize); + /* Roundtrip Test with block delimiters generated by ZSTD_generateSequences() */ + nbSeqs = ZSTD_generateSequences(cctx, seqs, srcSize, src, srcSize); ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_explicitBlockDelimiters); - compressedSize = ZSTD_compressSequences(cctx, dst, dstSize, seqs, seqsSize, src, srcSize); + compressedSize = ZSTD_compressSequences(cctx, dst, dstCapacity, seqs, nbSeqs, src, srcSize); if (ZSTD_isError(compressedSize)) { DISPLAY("Error in sequence compression with block delims\n"); goto _output_error; } - dSize = ZSTD_decompress(decompressBuffer, decompressSize, dst, compressedSize); - if (ZSTD_isError(dSize)) { - DISPLAY("Error in sequence compression roundtrip with block delims\n"); - goto _output_error; - } + { size_t const dSize = ZSTD_decompress(decompressBuffer, decompressSize, dst, compressedSize); + if (ZSTD_isError(dSize)) { + DISPLAY("Error in sequence compression roundtrip with block delims\n"); + goto _output_error; + } } assert(!memcmp(decompressBuffer, src, srcSize)); - /* Test with no block delimiters roundtrip */ - seqsSize = ZSTD_mergeBlockDelimiters(seqs, seqsSize); - ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_noBlockDelimiters); - compressedSize = ZSTD_compressSequences(cctx, dst, dstSize, seqs, seqsSize, src, srcSize); + /* Roundtrip Test with no block delimiters */ + { size_t const nbSeqsAfterMerge = ZSTD_mergeBlockDelimiters(seqs, nbSeqs); + ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_noBlockDelimiters); + compressedSize = ZSTD_compressSequences(cctx, dst, dstCapacity, seqs, nbSeqsAfterMerge, src, srcSize); + } if (ZSTD_isError(compressedSize)) { DISPLAY("Error in sequence compression with no block delims\n"); goto _output_error; } - dSize = ZSTD_decompress(decompressBuffer, decompressSize, dst, compressedSize); - if (ZSTD_isError(dSize)) { - DISPLAY("Error in sequence compression roundtrip with no block delims\n"); - goto _output_error; - } + { size_t const dSize = ZSTD_decompress(decompressBuffer, decompressSize, dst, compressedSize); + if (ZSTD_isError(dSize)) { + DISPLAY("Error in sequence compression roundtrip with no block delims\n"); + goto _output_error; + } } assert(!memcmp(decompressBuffer, src, srcSize)); ZSTD_freeCCtx(cctx); @@ -3156,7 +3589,7 @@ static int basicUnitTests(U32 const seed, double compressibility) size_t const bound = ZSTD_compressBound(_3BYTESTESTLENGTH); size_t nbSeq = 1; while (nbSeq <= maxNbSeq) { - CHECK(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, nbSeq * 3, 19)); + CHECK_Z(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, nbSeq * 3, 19)); /* Check every sequence for the first 100, then skip more rapidly. */ if (nbSeq < 100) { ++nbSeq; @@ -3185,7 +3618,7 @@ static int basicUnitTests(U32 const seed, double compressibility) size_t const bound = ZSTD_compressBound(CNBuffSize); size_t size = 1; while (size <= CNBuffSize) { - CHECK(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, size, 3)); + CHECK_Z(ZSTD_compressCCtx(cctx, compressedBuffer, bound, CNBuffer, size, 3)); /* Check every size for the first 100, then skip more rapidly. */ if (size < 100) { ++size; @@ -3213,15 +3646,14 @@ static int basicUnitTests(U32 const seed, double compressibility) { U32 u; for (u = 0; u < CNBuffSize; ++u) { ((BYTE*)CNBuffer)[u] = 255 - ((BYTE*)CNBuffer)[u]; - } - } + } } { /* Compress the data */ size_t const inputSize = 500; size_t const outputSize = ZSTD_compressBound(inputSize); void* const outputBuffer = malloc(outputSize); ZSTD_CCtx* const cctx = ZSTD_createCCtx(); if (!outputBuffer || !cctx) goto _output_error; - CHECK(ZSTD_compress_usingDict(cctx, outputBuffer, outputSize, CNBuffer, inputSize, dictBuffer, dictSize, 1)); + CHECK_Z(ZSTD_compress_usingDict(cctx, outputBuffer, outputSize, CNBuffer, inputSize, dictBuffer, dictSize, 1)); free(outputBuffer); ZSTD_freeCCtx(cctx); } @@ -3289,6 +3721,91 @@ static int basicUnitTests(U32 const seed, double compressibility) FSE_normalizeCount(norm, tableLog, count, nbSeq, maxSymbolValue, /* useLowProbCount */ 1); } DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : testing FSE_writeNCount() PR#2779: ", testNb++); + { + size_t const outBufSize = 9; + short const count[11] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 9, 18}; + unsigned const tableLog = 5; + unsigned const maxSymbolValue = 10; + BYTE* outBuf = (BYTE*)malloc(outBufSize*sizeof(BYTE)); + + /* Ensure that this write doesn't write out of bounds, and that + * FSE_writeNCount_generic() is *not* called with writeIsSafe == 1. + */ + FSE_writeNCount(outBuf, outBufSize, count, maxSymbolValue, tableLog); + free(outBuf); + } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : testing bitwise intrinsics PR#3045: ", testNb++); + { + U32 seed_copy = seed; /* need non-const seed to avoid compiler warning for FUZ_rand(&seed) */ + U32 rand32 = FUZ_rand(&seed_copy); + U64 rand64 = ((U64)FUZ_rand(&seed_copy) << 32) | FUZ_rand(&seed_copy); + U32 lowbit_only_32 = 1; + U64 lowbit_only_64 = 1; + U32 highbit_only_32 = (U32)1 << 31; + U64 highbit_only_64 = (U64)1 << 63; + U32 i; + if (rand32 == 0) rand32 = 1; /* CLZ and CTZ are undefined on 0 */ + if (rand64 == 0) rand64 = 1; /* CLZ and CTZ are undefined on 0 */ + + /* Test ZSTD_countTrailingZeros32 */ + CHECK_EQ(ZSTD_countTrailingZeros32(lowbit_only_32), 0u); + CHECK_EQ(ZSTD_countTrailingZeros32(highbit_only_32), 31u); + CHECK_EQ(ZSTD_countTrailingZeros32(rand32), ZSTD_countTrailingZeros32_fallback(rand32)); + + /* Test ZSTD_countLeadingZeros32 */ + CHECK_EQ(ZSTD_countLeadingZeros32(lowbit_only_32), 31u); + CHECK_EQ(ZSTD_countLeadingZeros32(highbit_only_32), 0u); + CHECK_EQ(ZSTD_countLeadingZeros32(rand32), ZSTD_countLeadingZeros32_fallback(rand32)); + + /* Test ZSTD_countTrailingZeros64 */ + CHECK_EQ(ZSTD_countTrailingZeros64(lowbit_only_64), 0u); + CHECK_EQ(ZSTD_countTrailingZeros64(highbit_only_64), 63u); + + /* Test ZSTD_countLeadingZeros64 */ + CHECK_EQ(ZSTD_countLeadingZeros64(lowbit_only_64), 63u); + CHECK_EQ(ZSTD_countLeadingZeros64(highbit_only_64), 0u); + + /* Test ZSTD_highbit32 */ + CHECK_EQ(ZSTD_highbit32(lowbit_only_32), 0u); + CHECK_EQ(ZSTD_highbit32(highbit_only_32), 31u); + + /* Test ZSTD_NbCommonBytes */ + if (MEM_isLittleEndian()) { + if (MEM_64bits()) { + CHECK_EQ(ZSTD_NbCommonBytes(lowbit_only_32), 0u); + CHECK_EQ(ZSTD_NbCommonBytes(highbit_only_32), 3u); + } else { + CHECK_EQ(ZSTD_NbCommonBytes(lowbit_only_32), 0u); + CHECK_EQ(ZSTD_NbCommonBytes(highbit_only_32), 3u); + } + } else { + if (MEM_64bits()) { + CHECK_EQ(ZSTD_NbCommonBytes(lowbit_only_32), 7u); + CHECK_EQ(ZSTD_NbCommonBytes(highbit_only_32), 4u); + } else { + CHECK_EQ(ZSTD_NbCommonBytes(lowbit_only_32), 3u); + CHECK_EQ(ZSTD_NbCommonBytes(highbit_only_32), 0u); + } + } + + /* Test MEM_ intrinsics */ + CHECK_EQ(MEM_swap32(rand32), MEM_swap32_fallback(rand32)); + CHECK_EQ(MEM_swap64(rand64), MEM_swap64_fallback(rand64)); + + /* Test fallbacks vs intrinsics on a range of small integers */ + for (i=1; i <= 1000; i++) { + CHECK_EQ(MEM_swap32(i), MEM_swap32_fallback(i)); + CHECK_EQ(MEM_swap64((U64)i), MEM_swap64_fallback((U64)i)); + CHECK_EQ(ZSTD_countTrailingZeros32(i), ZSTD_countTrailingZeros32_fallback(i)); + CHECK_EQ(ZSTD_countLeadingZeros32(i), ZSTD_countLeadingZeros32_fallback(i)); + } + } + DISPLAYLEVEL(3, "OK \n"); + #ifdef ZSTD_MULTITHREAD DISPLAYLEVEL(3, "test%3i : passing wrong full dict should fail on compressStream2 refPrefix ", testNb++); { ZSTD_CCtx* cctx = ZSTD_createCCtx(); @@ -3337,7 +3854,7 @@ static int basicUnitTests(U32 const seed, double compressibility) /* Enable MT, LDM, and use refPrefix() for a small dict */ CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 2)); - CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, 1)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_enable)); CHECK_Z(ZSTD_CCtx_refPrefix(cctx, dict, dictSize)); CHECK_Z(ZSTD_compress2(cctx, dst, dstSize, src, srcSize)); @@ -3407,11 +3924,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "error! l: %d dict: %zu srcSize: %zu cctx size cpar: %zu, cctx size level: %zu\n", level, dictSize, srcSize, cctxSizeUsingCParams, cctxSizeUsingLevel); goto _output_error; - } - } - } - } - } + } } } } } DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : thread pool API tests : \n", testNb++) @@ -3477,7 +3990,7 @@ static int longUnitTests(U32 const seed, double compressibility) while (approxIndex <= (maxIndex / 4) * 3) { CHECK_Z(ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_flush)); approxIndex += in.pos; - CHECK(in.pos == in.size); + CHECK_Z(in.pos == in.size); in.pos = 0; out.pos = 0; } @@ -3503,7 +4016,7 @@ static int longUnitTests(U32 const seed, double compressibility) while (approxIndex <= maxIndex) { CHECK_Z(ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_flush)); approxIndex += in.pos; - CHECK(in.pos == in.size); + CHECK_Z(in.pos == in.size); in.pos = 0; out.pos = 0; } @@ -3527,8 +4040,7 @@ static int longUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "longtest%3i : testing ldm no regressions in size for opt parser : ", testNb++); - { - size_t cSizeLdm; + { size_t cSizeLdm; size_t cSizeNoLdm; ZSTD_CCtx* const cctx = ZSTD_createCCtx(); @@ -3536,7 +4048,7 @@ static int longUnitTests(U32 const seed, double compressibility) /* Enable checksum to verify round trip. */ CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1)); - CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, 1)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_enable)); CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 19)); /* Round trip once with ldm. */ @@ -3546,7 +4058,7 @@ static int longUnitTests(U32 const seed, double compressibility) ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1)); - CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, 0)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_disable)); CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, 19)); /* Round trip once without ldm. */ @@ -3587,7 +4099,7 @@ static int longUnitTests(U32 const seed, double compressibility) RDG_genBuffer(dict, dictSize, 0.5, 0.5, seed); RDG_genBuffer(CNBuffer, CNBuffSize, 0.6, 0.6, seed); - CHECK(cctx_params != NULL); + CHECK_Z(cctx_params != NULL); for (dictSize = CNBuffSize; dictSize; dictSize = dictSize >> 3) { DISPLAYLEVEL(3, "\n Testing with dictSize %u ", (U32)dictSize); @@ -3606,7 +4118,7 @@ static int longUnitTests(U32 const seed, double compressibility) CHECK(cdict != NULL); CHECK_Z(ZSTD_CCtx_refCDict(cctx, cdict)); - CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_forceAttachDict, attachPref)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_forceAttachDict, (int)attachPref)); cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); CHECK_Z(cSize); @@ -3630,11 +4142,6 @@ _end: free(compressedBuffer); free(decodedBuffer); return testResult; - -_output_error: - testResult = 1; - DISPLAY("Error detected in Unit tests ! \n"); - goto _end; } @@ -3887,9 +4394,9 @@ static int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, U32 const DISPLAYLEVEL(5, "fuzzer t%u: Bufferless streaming compression test \n", testNb); { U32 const testLog = FUZ_rand(&lseed) % maxSrcLog; U32 const dictLog = FUZ_rand(&lseed) % maxSrcLog; - int const cLevel = (FUZ_rand(&lseed) % - (ZSTD_maxCLevel() - - (MAX(testLog, dictLog) / cLevelLimiter))) + + int const cLevel = (int)(FUZ_rand(&lseed) % + ((U32)ZSTD_maxCLevel() - + (MAX(testLog, dictLog) / (U32)cLevelLimiter))) + 1; maxTestSize = FUZ_rLogLength(&lseed, testLog); if (maxTestSize >= dstBufferSize) maxTestSize = dstBufferSize-1; @@ -3985,7 +4492,7 @@ _cleanup: free(cBuffer); free(dstBuffer); free(mirrorBuffer); - return result; + return (int)result; _output_error: result = 1; @@ -4022,7 +4529,7 @@ static unsigned readU32FromChar(const char** stringPtr) { unsigned result = 0; while ((**stringPtr >='0') && (**stringPtr <='9')) - result *= 10, result += **stringPtr - '0', (*stringPtr)++ ; + result *= 10, result += (unsigned)(**stringPtr - '0'), (*stringPtr)++ ; if ((**stringPtr=='K') || (**stringPtr=='M')) { result <<= 10; if (**stringPtr=='M') result <<= 10; @@ -4164,7 +4671,7 @@ int main(int argc, const char** argv) } } if (!result) - result = fuzzerTests(seed, nbTests, testNb, maxDuration, ((double)proba) / 100, bigTests); + result = fuzzerTests(seed, (unsigned)nbTests, (unsigned)testNb, maxDuration, ((double)proba) / 100, bigTests); if (mainPause) { int unused; DISPLAY("Press Enter \n"); diff --git a/src/dependencies/zstd-1.5.0/tests/golden-compression/http b/src/dependencies/zstd-1.5.4/tests/golden-compression/http similarity index 100% rename from src/dependencies/zstd-1.5.0/tests/golden-compression/http rename to src/dependencies/zstd-1.5.4/tests/golden-compression/http diff --git a/src/dependencies/zstd-1.5.0/tests/golden-compression/huffman-compressed-larger b/src/dependencies/zstd-1.5.4/tests/golden-compression/huffman-compressed-larger similarity index 100% rename from src/dependencies/zstd-1.5.0/tests/golden-compression/huffman-compressed-larger rename to src/dependencies/zstd-1.5.4/tests/golden-compression/huffman-compressed-larger diff --git a/src/dependencies/zstd-1.5.4/tests/golden-compression/large-literal-and-match-lengths b/src/dependencies/zstd-1.5.4/tests/golden-compression/large-literal-and-match-lengths new file mode 100644 index 0000000..fb63c32 Binary files /dev/null and b/src/dependencies/zstd-1.5.4/tests/golden-compression/large-literal-and-match-lengths differ diff --git a/src/dependencies/zstd-1.5.0/tests/golden-dictionaries/http-dict-missing-symbols b/src/dependencies/zstd-1.5.4/tests/golden-dictionaries/http-dict-missing-symbols similarity index 100% rename from src/dependencies/zstd-1.5.0/tests/golden-dictionaries/http-dict-missing-symbols rename to src/dependencies/zstd-1.5.4/tests/golden-dictionaries/http-dict-missing-symbols diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/Makefile b/src/dependencies/zstd-1.5.4/tests/gzip/Makefile similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/gzip/Makefile rename to src/dependencies/zstd-1.5.4/tests/gzip/Makefile index a50350f..cca3109 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/Makefile +++ b/src/dependencies/zstd-1.5.4/tests/gzip/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/gzip-env.sh b/src/dependencies/zstd-1.5.4/tests/gzip/gzip-env.sh similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/gzip/gzip-env.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/gzip-env.sh index 120e52d..4570e81 100755 --- a/src/dependencies/zstd-1.5.0/tests/gzip/gzip-env.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/gzip-env.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/helin-segv.sh b/src/dependencies/zstd-1.5.4/tests/gzip/helin-segv.sh similarity index 93% rename from src/dependencies/zstd-1.5.0/tests/gzip/helin-segv.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/helin-segv.sh index f182c80..b400c24 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/helin-segv.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/helin-segv.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/help-version.sh b/src/dependencies/zstd-1.5.4/tests/gzip/help-version.sh similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/gzip/help-version.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/help-version.sh index ee0c19f..fcda1c3 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/help-version.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/help-version.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Ensure that $SHELL is set to *some* value and exported. # This is required for dircolors, which would fail e.g., when diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/hufts-segv.gz b/src/dependencies/zstd-1.5.4/tests/gzip/hufts-segv.gz similarity index 100% rename from src/dependencies/zstd-1.5.0/tests/gzip/hufts-segv.gz rename to src/dependencies/zstd-1.5.4/tests/gzip/hufts-segv.gz diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/hufts.sh b/src/dependencies/zstd-1.5.4/tests/gzip/hufts.sh similarity index 93% rename from src/dependencies/zstd-1.5.0/tests/gzip/hufts.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/hufts.sh index 9b9576c..49c3695 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/hufts.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/hufts.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/init.cfg b/src/dependencies/zstd-1.5.4/tests/gzip/init.cfg similarity index 100% rename from src/dependencies/zstd-1.5.0/tests/gzip/init.cfg rename to src/dependencies/zstd-1.5.4/tests/gzip/init.cfg diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/init.sh b/src/dependencies/zstd-1.5.4/tests/gzip/init.sh similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/gzip/init.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/init.sh index 97e4e4b..ebd8410 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/init.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/init.sh @@ -13,7 +13,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Using this file in a test # ========================= diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/keep.sh b/src/dependencies/zstd-1.5.4/tests/gzip/keep.sh similarity index 95% rename from src/dependencies/zstd-1.5.0/tests/gzip/keep.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/keep.sh index ab9a218..f87b1a4 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/keep.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/keep.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/list.sh b/src/dependencies/zstd-1.5.4/tests/gzip/list.sh similarity index 92% rename from src/dependencies/zstd-1.5.0/tests/gzip/list.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/list.sh index 75912e1..e218d75 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/list.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/list.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/memcpy-abuse.sh b/src/dependencies/zstd-1.5.4/tests/gzip/memcpy-abuse.sh similarity index 93% rename from src/dependencies/zstd-1.5.0/tests/gzip/memcpy-abuse.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/memcpy-abuse.sh index 7d5c056..1478890 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/memcpy-abuse.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/memcpy-abuse.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/mixed.sh b/src/dependencies/zstd-1.5.4/tests/gzip/mixed.sh similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/gzip/mixed.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/mixed.sh index 383a54f..b47f4a5 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/mixed.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/mixed.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/null-suffix-clobber.sh b/src/dependencies/zstd-1.5.4/tests/gzip/null-suffix-clobber.sh similarity index 93% rename from src/dependencies/zstd-1.5.0/tests/gzip/null-suffix-clobber.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/null-suffix-clobber.sh index 0efd0e3..5acfb32 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/null-suffix-clobber.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/null-suffix-clobber.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/stdin.sh b/src/dependencies/zstd-1.5.4/tests/gzip/stdin.sh similarity index 92% rename from src/dependencies/zstd-1.5.0/tests/gzip/stdin.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/stdin.sh index eef4cd8..d697ab8 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/stdin.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/stdin.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/test-driver.sh b/src/dependencies/zstd-1.5.4/tests/gzip/test-driver.sh similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/gzip/test-driver.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/test-driver.sh index 649c084..0529cc8 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/test-driver.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/test-driver.sh @@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/trailing-nul.sh b/src/dependencies/zstd-1.5.4/tests/gzip/trailing-nul.sh similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/gzip/trailing-nul.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/trailing-nul.sh index 7b15d5e..b33b98f 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/trailing-nul.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/trailing-nul.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/unpack-invalid.sh b/src/dependencies/zstd-1.5.4/tests/gzip/unpack-invalid.sh similarity index 95% rename from src/dependencies/zstd-1.5.0/tests/gzip/unpack-invalid.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/unpack-invalid.sh index fe8384d..ceda5ff 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/unpack-invalid.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/unpack-invalid.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/z-suffix.sh b/src/dependencies/zstd-1.5.4/tests/gzip/z-suffix.sh similarity index 92% rename from src/dependencies/zstd-1.5.0/tests/gzip/z-suffix.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/z-suffix.sh index a870a54..c0bf509 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/z-suffix.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/z-suffix.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/zdiff.sh b/src/dependencies/zstd-1.5.4/tests/gzip/zdiff.sh similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/gzip/zdiff.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/zdiff.sh index d62a846..6e99b66 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/zdiff.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/zdiff.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/zgrep-context.sh b/src/dependencies/zstd-1.5.4/tests/gzip/zgrep-context.sh similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/gzip/zgrep-context.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/zgrep-context.sh index c8648b7..d213426 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/zgrep-context.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/zgrep-context.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/zgrep-f.sh b/src/dependencies/zstd-1.5.4/tests/gzip/zgrep-f.sh similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/gzip/zgrep-f.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/zgrep-f.sh index d0cf27f..1e73ed2 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/zgrep-f.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/zgrep-f.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/zgrep-signal.sh b/src/dependencies/zstd-1.5.4/tests/gzip/zgrep-signal.sh similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/gzip/zgrep-signal.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/zgrep-signal.sh index a8c5388..dd8442c 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/zgrep-signal.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/zgrep-signal.sh @@ -15,7 +15,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/gzip/znew-k.sh b/src/dependencies/zstd-1.5.4/tests/gzip/znew-k.sh similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/gzip/znew-k.sh rename to src/dependencies/zstd-1.5.4/tests/gzip/znew-k.sh index 6c239e2..5cf99ed 100644 --- a/src/dependencies/zstd-1.5.0/tests/gzip/znew-k.sh +++ b/src/dependencies/zstd-1.5.4/tests/gzip/znew-k.sh @@ -14,7 +14,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # limit so don't run it by default. . "${srcdir=.}/init.sh"; path_prepend_ . diff --git a/src/dependencies/zstd-1.5.0/tests/invalidDictionaries.c b/src/dependencies/zstd-1.5.4/tests/invalidDictionaries.c similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/invalidDictionaries.c rename to src/dependencies/zstd-1.5.4/tests/invalidDictionaries.c index b71f741..66caa9e 100644 --- a/src/dependencies/zstd-1.5.0/tests/invalidDictionaries.c +++ b/src/dependencies/zstd-1.5.4/tests/invalidDictionaries.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/legacy.c b/src/dependencies/zstd-1.5.4/tests/legacy.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/legacy.c rename to src/dependencies/zstd-1.5.4/tests/legacy.c index ac4938f..3be3864 100644 --- a/src/dependencies/zstd-1.5.0/tests/legacy.c +++ b/src/dependencies/zstd-1.5.4/tests/legacy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/libzstd_partial_builds.sh b/src/dependencies/zstd-1.5.4/tests/libzstd_builds.sh similarity index 92% rename from src/dependencies/zstd-1.5.0/tests/libzstd_partial_builds.sh rename to src/dependencies/zstd-1.5.4/tests/libzstd_builds.sh index 05dad8f..f9e1e76 100755 --- a/src/dependencies/zstd-1.5.0/tests/libzstd_partial_builds.sh +++ b/src/dependencies/zstd-1.5.4/tests/libzstd_builds.sh @@ -23,14 +23,19 @@ mustBeAbsent() { # default compilation : all features enabled - no zbuff $ECHO "testing default library compilation" -CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID +CFLAGS= make -C $DIR/../lib libzstd libzstd.a > $INTOVOID nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog isPresent "zstd_compress.o" isPresent "zstd_decompress.o" isPresent "zdict.o" isPresent "zstd_v07.o" mustBeAbsent "zbuff_compress.o" -$RM $DIR/../lib/libzstd.a tmplog +$RM tmplog + +# Check that the exec-stack bit isn't set +readelf -lW $DIR/../lib/libzstd.so | $GREP "GNU_STACK" > tmplog +mustBeAbsent "RWE" +$RM $DIR/../lib/libzstd.a $DIR/../lib/libzstd.so* tmplog # compression disabled => also disable zdict $ECHO "testing with compression disabled" diff --git a/src/dependencies/zstd-1.5.0/tests/longmatch.c b/src/dependencies/zstd-1.5.4/tests/longmatch.c similarity index 77% rename from src/dependencies/zstd-1.5.0/tests/longmatch.c rename to src/dependencies/zstd-1.5.4/tests/longmatch.c index a171c0e..547b261 100644 --- a/src/dependencies/zstd-1.5.0/tests/longmatch.c +++ b/src/dependencies/zstd-1.5.4/tests/longmatch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -36,27 +36,27 @@ compress(ZSTD_CStream *ctx, ZSTD_outBuffer out, const void *data, size_t size) int main(int argc, const char** argv) { ZSTD_CStream* ctx; - ZSTD_parameters params; - size_t rc; - unsigned windowLog; + unsigned windowLog = 18; (void)argc; (void)argv; /* Create stream */ - ctx = ZSTD_createCStream(); + ctx = ZSTD_createCCtx(); if (!ctx) { return 1; } /* Set parameters */ - memset(¶ms, 0, sizeof(params)); - params.cParams.windowLog = 18; - params.cParams.chainLog = 13; - params.cParams.hashLog = 14; - params.cParams.searchLog = 1; - params.cParams.minMatch = 7; - params.cParams.targetLength = 16; - params.cParams.strategy = ZSTD_fast; - windowLog = params.cParams.windowLog; - /* Initialize stream */ - rc = ZSTD_initCStream_advanced(ctx, NULL, 0, params, 0); - if (ZSTD_isError(rc)) { return 2; } + if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_windowLog, windowLog))) + return 2; + if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_chainLog, 13))) + return 2; + if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_hashLog, 14))) + return 2; + if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_searchLog, 1))) + return 2; + if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_minMatch, 7))) + return 2; + if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_targetLength, 16))) + return 2; + if (ZSTD_isError(ZSTD_CCtx_setParameter(ctx, ZSTD_c_strategy, ZSTD_fast))) + return 2; { U64 compressed = 0; const U64 toCompress = ((U64)1) << 33; @@ -97,5 +97,6 @@ int main(int argc, const char** argv) free(srcBuffer); free(dstBuffer); } + ZSTD_freeCCtx(ctx); return 0; } diff --git a/src/dependencies/zstd-1.5.0/tests/paramgrill.c b/src/dependencies/zstd-1.5.4/tests/paramgrill.c similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/paramgrill.c rename to src/dependencies/zstd-1.5.4/tests/paramgrill.c index a0cfa58..8971c65 100644 --- a/src/dependencies/zstd-1.5.0/tests/paramgrill.c +++ b/src/dependencies/zstd-1.5.4/tests/paramgrill.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -555,7 +555,7 @@ static int feasible(const BMK_benchResult_t results, const constraint_t target) } /* hill climbing value for part 1 */ -/* Scoring here is a linear reward for all set constraints normalized between 0 to 1 +/* Scoring here is a linear reward for all set constraints normalized between 0 and 1 * (with 0 at 0 and 1 being fully fulfilling the constraint), summed with a logarithmic * bonus to exceeding the constraint value. We also give linear ratio for compression ratio. * The constant factors are experimental. @@ -566,10 +566,10 @@ resultScore(const BMK_benchResult_t res, const size_t srcSize, const constraint_ double cs = 0., ds = 0., rt, cm = 0.; const double r1 = 1, r2 = 0.1, rtr = 0.5; double ret; - if(target.cSpeed) { cs = res.cSpeed / (double)target.cSpeed; } - if(target.dSpeed) { ds = res.dSpeed / (double)target.dSpeed; } - if(target.cMem != (U32)-1) { cm = (double)target.cMem / res.cMem; } - rt = ((double)srcSize / res.cSize); + if(target.cSpeed) { cs = (double)res.cSpeed / (double)target.cSpeed; } + if(target.dSpeed) { ds = (double)res.dSpeed / (double)target.dSpeed; } + if(target.cMem != (U32)-1) { cm = (double)target.cMem / (double)res.cMem; } + rt = ((double)srcSize / (double)res.cSize); ret = (MIN(1, cs) + MIN(1, ds) + MIN(1, cm))*r1 + rt * rtr + (MAX(0, log(cs))+ MAX(0, log(ds))+ MAX(0, log(cm))) * r2; @@ -581,8 +581,8 @@ resultScore(const BMK_benchResult_t res, const size_t srcSize, const constraint_ static double resultDistLvl(const BMK_benchResult_t result1, const BMK_benchResult_t lvlRes) { - double normalizedCSpeedGain1 = ((double)result1.cSpeed / lvlRes.cSpeed) - 1; - double normalizedRatioGain1 = ((double)lvlRes.cSize / result1.cSize) - 1; + double normalizedCSpeedGain1 = ((double)result1.cSpeed / (double)lvlRes.cSpeed) - 1; + double normalizedRatioGain1 = ((double)lvlRes.cSize / (double)result1.cSize) - 1; if(normalizedRatioGain1 < 0 || normalizedCSpeedGain1 < 0) { return 0.0; } @@ -854,7 +854,7 @@ BMK_displayOneResult(FILE* f, winnerInfo_t res, const size_t srcSize) } { double const ratio = res.result.cSize ? - (double)srcSize / res.result.cSize : 0; + (double)srcSize / (double)res.result.cSize : 0; double const cSpeedMBps = (double)res.result.cSpeed / MB_UNIT; double const dSpeedMBps = (double)res.result.dSpeed / MB_UNIT; @@ -937,7 +937,7 @@ BMK_printWinnerOpt(FILE* f, const U32 cLevel, const BMK_benchResult_t result, co } fprintf(f, "================================\n"); fprintf(f, "Level Bounds: R: > %.3f AND C: < %.1f MB/s \n\n", - (double)srcSize / g_lvltarget.cSize, (double)g_lvltarget.cSpeed / MB_UNIT); + (double)srcSize / (double)g_lvltarget.cSize, (double)g_lvltarget.cSpeed / MB_UNIT); fprintf(f, "Overall Winner: \n"); @@ -977,7 +977,7 @@ BMK_print_cLevelEntry(FILE* f, const int cLevel, } /* print comment */ { double const ratio = result.cSize ? - (double)srcSize / result.cSize : 0; + (double)srcSize / (double)result.cSize : 0; double const cSpeedMBps = (double)result.cSpeed / MB_UNIT; double const dSpeedMBps = (double)result.dSpeed / MB_UNIT; @@ -1726,19 +1726,19 @@ static int allBench(BMK_benchResult_t* resultPtr, /* calculate uncertainty in compression / decompression runs */ if (benchres.cSpeed) { - U64 const loopDurationC = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed); + double const loopDurationC = (double)(((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.cSpeed); uncertaintyConstantC = ((loopDurationC + (double)(2 * g_clockGranularity))/loopDurationC); } if (benchres.dSpeed) { - U64 const loopDurationD = (((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed); + double const loopDurationD = (double)(((U64)buf.srcSize * TIMELOOP_NANOSEC) / benchres.dSpeed); uncertaintyConstantD = ((loopDurationD + (double)(2 * g_clockGranularity))/loopDurationD); } /* optimistic assumption of benchres */ { BMK_benchResult_t resultMax = benchres; - resultMax.cSpeed = (unsigned long long)(resultMax.cSpeed * uncertaintyConstantC * VARIANCE); - resultMax.dSpeed = (unsigned long long)(resultMax.dSpeed * uncertaintyConstantD * VARIANCE); + resultMax.cSpeed = (unsigned long long)((double)resultMax.cSpeed * uncertaintyConstantC * VARIANCE); + resultMax.dSpeed = (unsigned long long)((double)resultMax.dSpeed * uncertaintyConstantD * VARIANCE); /* disregard infeasible results in feas mode */ /* disregard if resultMax < winner in infeas mode */ @@ -1850,8 +1850,8 @@ static int BMK_seed(winnerInfo_t* winners, if ((double)testResult.cSize <= ((double)winners[cLevel].result.cSize * (1. + (0.02 / cLevel))) ) { /* Validate solution is "good enough" */ - double W_ratio = (double)buf.srcSize / testResult.cSize; - double O_ratio = (double)buf.srcSize / winners[cLevel].result.cSize; + double W_ratio = (double)buf.srcSize / (double)testResult.cSize; + double O_ratio = (double)buf.srcSize / (double)winners[cLevel].result.cSize; double W_ratioNote = log (W_ratio); double O_ratioNote = log (O_ratio); size_t W_DMemUsed = (1 << params.vals[wlog_ind]) + (16 KB); @@ -1864,11 +1864,11 @@ static int BMK_seed(winnerInfo_t* winners, double W_CMemUsed_note = W_ratioNote * ( 50 + 13*cLevel) - log((double)W_CMemUsed); double O_CMemUsed_note = O_ratioNote * ( 50 + 13*cLevel) - log((double)O_CMemUsed); - double W_CSpeed_note = W_ratioNote * (double)( 30 + 10*cLevel) + log(testResult.cSpeed); - double O_CSpeed_note = O_ratioNote * (double)( 30 + 10*cLevel) + log(winners[cLevel].result.cSpeed); + double W_CSpeed_note = W_ratioNote * (double)( 30 + 10*cLevel) + log((double)testResult.cSpeed); + double O_CSpeed_note = O_ratioNote * (double)( 30 + 10*cLevel) + log((double)winners[cLevel].result.cSpeed); - double W_DSpeed_note = W_ratioNote * (double)( 20 + 2*cLevel) + log(testResult.dSpeed); - double O_DSpeed_note = O_ratioNote * (double)( 20 + 2*cLevel) + log(winners[cLevel].result.dSpeed); + double W_DSpeed_note = W_ratioNote * (double)( 20 + 2*cLevel) + log((double)testResult.dSpeed); + double O_DSpeed_note = O_ratioNote * (double)( 20 + 2*cLevel) + log((double)winners[cLevel].result.dSpeed); if (W_DMemUsed_note < O_DMemUsed_note) { /* uses too much Decompression memory for too little benefit */ @@ -2652,7 +2652,7 @@ static int usage_advanced(void) (unsigned)g_timeLimit_s, (double)g_timeLimit_s / 3600); DISPLAY( " -v : Prints Benchmarking output\n"); DISPLAY( " -D : Next argument dictionary file\n"); - DISPLAY( " -s : Seperate Files\n"); + DISPLAY( " -s : Separate Files\n"); return 0; } @@ -2707,7 +2707,7 @@ int main(int argc, const char** argv) const char* dictFileName = NULL; U32 main_pause = 0; int cLevelOpt = 0, cLevelRun = 0; - int seperateFiles = 0; + int separateFiles = 0; double compressibility = COMPRESSIBILITY_DEFAULT; U32 memoTableLog = PARAM_UNSET; constraint_t target = { 0, 0, (U32)-1 }; @@ -2895,7 +2895,7 @@ int main(int argc, const char** argv) case 's': argument++; - seperateFiles = 1; + separateFiles = 1; break; case 'q': @@ -2940,7 +2940,7 @@ int main(int argc, const char** argv) result = benchSample(compressibility, cLevelRun); } } else { - if(seperateFiles) { + if(separateFiles) { for(i = 0; i < argc - filenamesStart; i++) { if (g_optimizer) { result = optimizeForSize(argv+filenamesStart + i, 1, dictFileName, target, paramTarget, cLevelOpt, cLevelRun, memoTableLog); diff --git a/src/dependencies/zstd-1.5.0/tests/playTests.sh b/src/dependencies/zstd-1.5.4/tests/playTests.sh similarity index 86% rename from src/dependencies/zstd-1.5.0/tests/playTests.sh rename to src/dependencies/zstd-1.5.4/tests/playTests.sh index fa748c0..5f595f6 100755 --- a/src/dependencies/zstd-1.5.0/tests/playTests.sh +++ b/src/dependencies/zstd-1.5.4/tests/playTests.sh @@ -2,6 +2,10 @@ set -e +unset ZSTD_CLEVEL +unset ZSTD_NBTHREADS + + die() { println "$@" 1>&2 exit 1 @@ -88,7 +92,6 @@ SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) PRGDIR="$SCRIPT_DIR/../programs" TESTDIR="$SCRIPT_DIR/../tests" UNAME=$(uname) -ZSTDGREP="$PRGDIR/zstdgrep" detectedTerminal=false if [ -t 0 ] && [ -t 1 ] @@ -124,6 +127,13 @@ case "$UNAME" in Darwin | FreeBSD | OpenBSD | NetBSD) MTIME="stat -f %m" ;; esac +assertSameMTime() { + MT1=$($MTIME "$1") + MT2=$($MTIME "$2") + echo MTIME $MT1 $MT2 + [ "$MT1" = "$MT2" ] || die "mtime on $1 doesn't match mtime on $2 ($MT1 != $MT2)" +} + GET_PERMS="stat -c %a" case "$UNAME" in Darwin | FreeBSD | OpenBSD | NetBSD) GET_PERMS="stat -f %Lp" ;; @@ -159,10 +169,11 @@ if [ -z "${DATAGEN_BIN}" ]; then DATAGEN_BIN="$TESTDIR/datagen" fi -ZSTD_BIN="$EXE_PREFIX$ZSTD_BIN" +# Why was this line here ? Generates a strange ZSTD_BIN when EXE_PREFIX is non empty +# ZSTD_BIN="$EXE_PREFIX$ZSTD_BIN" # assertions -[ -n "$ZSTD_BIN" ] || die "zstd not found at $ZSTD_BIN! \n Please define ZSTD_BIN pointing to the zstd binary. You might also consider rebuilding zstd follwing the instructions in README.md" +[ -n "$ZSTD_BIN" ] || die "zstd not found at $ZSTD_BIN! \n Please define ZSTD_BIN pointing to the zstd binary. You might also consider rebuilding zstd following the instructions in README.md" [ -n "$DATAGEN_BIN" ] || die "datagen not found at $DATAGEN_BIN! \n Please define DATAGEN_BIN pointing to the datagen binary. You might also consider rebuilding zstd tests following the instructions in README.md. " println "\nStarting playTests.sh isWindows=$isWindows EXE_PREFIX='$EXE_PREFIX' ZSTD_BIN='$ZSTD_BIN' DATAGEN_BIN='$DATAGEN_BIN'" @@ -174,12 +185,19 @@ else fi +zstd -vvV println "\n===> simple tests " datagen > tmp +zstd -h +zstd -H +zstd -V println "test : basic compression " zstd -f tmp # trivial compression case, creates tmp.zst +zstd -f -z tmp +zstd -f -k tmp +zstd -f -C tmp println "test : basic decompression" zstd -df tmp.zst # trivial decompression case (overwrites tmp) println "test : too large compression level => auto-fix" @@ -194,6 +212,7 @@ zstd -c --fast=0 tmp > $INTOVOID && die "--fast must not accept value 0" println "test : too large numeric argument" zstd --fast=9999999999 -f tmp && die "should have refused numeric value" println "test : set compression level with environment variable ZSTD_CLEVEL" + ZSTD_CLEVEL=12 zstd -f tmp # positive compression level ZSTD_CLEVEL=-12 zstd -f tmp # negative compression level ZSTD_CLEVEL=+12 zstd -f tmp # valid: verbose '+' sign @@ -205,6 +224,11 @@ ZSTD_CLEVEL=3a7 zstd -f tmp # malformed env var, warn and revert to default sett ZSTD_CLEVEL=50000000000 zstd -f tmp # numeric value too large, warn and revert to default setting println "test : override ZSTD_CLEVEL with command line option" ZSTD_CLEVEL=12 zstd --fast=3 -f tmp # overridden by command line option + +# temporary envvar changes in the above tests would actually persist in macos /bin/sh +unset ZSTD_CLEVEL + + println "test : compress to stdout" zstd tmp -c > tmpCompressed zstd tmp --stdout > tmpCompressed # long command format @@ -244,10 +268,13 @@ zstd -dc - < tmp.zst > $INTOVOID zstd -d < tmp.zst > $INTOVOID # implicit stdout when stdin is used zstd -d - < tmp.zst > $INTOVOID println "test : impose memory limitation (must fail)" -zstd -d -f tmp.zst -M2K -c > $INTOVOID && die "decompression needs more memory than allowed" -zstd -d -f tmp.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command -zstd -d -f tmp.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command -zstd -d -f tmp.zst --memlimit-decompress=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command +datagen -g500K > tmplimit +zstd -f tmplimit +zstd -d -f tmplimit.zst -M2K -c > $INTOVOID && die "decompression needs more memory than allowed" +zstd -d -f tmplimit.zst --memlimit=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command +zstd -d -f tmplimit.zst --memory=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command +zstd -d -f tmplimit.zst --memlimit-decompress=2K -c > $INTOVOID && die "decompression needs more memory than allowed" # long command +rm -f tmplimit tmplimit.zst println "test : overwrite protection" zstd -q tmp && die "overwrite check failed!" println "test : force overwrite" @@ -263,6 +290,10 @@ zstd -q -f tmpro println "test: --no-progress flag" zstd tmpro -c --no-progress | zstd -d -f -o "$INTOVOID" --no-progress zstd tmpro -cv --no-progress | zstd -dv -f -o "$INTOVOID" --no-progress +println "test: --progress flag" +zstd tmpro -c | zstd -d -f -o "$INTOVOID" --progress 2>&1 | grep -E "[A-Za-z0-9._ ]+: [0-9]+ bytes" +zstd tmpro -c | zstd -d -f -q -o "$INTOVOID" --progress 2>&1 | grep -E "[A-Za-z0-9._ ]+: [0-9]+ bytes" +zstd tmpro -c | zstd -d -f -v -o "$INTOVOID" 2>&1 | grep -E "[A-Za-z0-9._ ]+: [0-9]+ bytes" rm -f tmpro tmpro.zst println "test: overwrite input file (must fail)" zstd tmp -fo tmp && die "zstd compression overwrote the input file" @@ -286,16 +317,12 @@ zstd -d -f tmp_corrupt.zst --no-check zstd -d -f tmp_corrupt.zst --check --no-check # final flag overrides zstd -d -f tmp.zst --no-check -println "\n===> zstdgrep tests" -ln -sf "$ZSTD_BIN" zstdcat -rm -f tmp_grep -echo "1234" > tmp_grep -zstd -f tmp_grep -lines=$(ZCAT=./zstdcat "$ZSTDGREP" 2>&1 "1234" tmp_grep tmp_grep.zst | wc -l) -test 2 -eq $lines -ZCAT=./zstdcat "$ZSTDGREP" 2>&1 "1234" tmp_grep_bad.zst && die "Should have failed" -ZCAT=./zstdcat "$ZSTDGREP" 2>&1 "1234" tmp_grep_bad.zst | grep "No such file or directory" || true -rm -f tmp_grep* +if [ "$isWindows" = false ] && [ "$UNAME" != "AIX" ]; then + if [ -n "$(which readelf)" ]; then + println "test: check if binary has executable stack (#2963)" + readelf -lW "$ZSTD_BIN" | grep 'GNU_STACK .* RW ' || die "zstd binary has executable stack!" + fi +fi println "\n===> --exclude-compressed flag" rm -rf precompressedFilterTestDir @@ -325,6 +352,7 @@ zstd --long --rm -r precompressedFilterTestDir # Files should get compressed again without the --exclude-compressed flag. test -f precompressedFilterTestDir/input.5.zst.zst test -f precompressedFilterTestDir/input.6.zst.zst +rm -rf precompressedFilterTestDir println "Test completed" @@ -338,8 +366,8 @@ zstd < tmpPrompt -o tmpPrompt.zst -f # should successfully overwrite with -f zstd -q -d -f tmpPrompt.zst -o tmpPromptRegenerated $DIFF tmpPromptRegenerated tmpPrompt # the first 'y' character should not be swallowed -echo 'yes' | zstd tmpPrompt -o tmpPrompt.zst # accept piped "y" input to force overwrite when using files -echo 'yes' | zstd < tmpPrompt -o tmpPrompt.zst && die "should have aborted immediately and failed to overwrite" +echo 'yes' | zstd tmpPrompt -v -o tmpPrompt.zst # accept piped "y" input to force overwrite when using files +echo 'yes' | zstd < tmpPrompt -v -o tmpPrompt.zst && die "should have aborted immediately and failed to overwrite" zstd tmpPrompt - < tmpPrompt -o tmpPromp.zst --rm && die "should have aborted immediately and failed to remove" println "Test completed" @@ -349,18 +377,45 @@ println "\n===> recursive mode test " # combination of -r with empty list of input file zstd -c -r < tmp > tmp.zst +# combination of -r with empty folder +mkdir -p tmpEmptyDir +zstd -r tmpEmptyDir +rm -rf tmpEmptyDir + println "\n===> file removal" zstd -f --rm tmp test ! -f tmp # tmp should no longer be present zstd -f -d --rm tmp.zst -test ! -f tmp.zst # tmp.zst should no longer be present +test ! -f tmp.zst # tmp.zst should no longer be present +println "test: --rm is disabled when output is stdout" +test -f tmp +zstd --rm tmp -c > $INTOVOID +test -f tmp # tmp shall still be there +zstd -f --rm tmp -c > $INTOVOID +test -f tmp # tmp shall still be there +zstd -f tmp -c > $INTOVOID --rm +test -f tmp # tmp shall still be there +println "test: --rm is disabled when multiple inputs are concatenated into a single output" +cp tmp tmp2 +zstd --rm tmp tmp2 -c > $INTOVOID +test -f tmp +test -f tmp2 +rm -f tmp3.zst +echo 'y' | zstd -v tmp tmp2 -o tmp3.zst --rm # prompt for confirmation +test -f tmp +test -f tmp2 +zstd -f tmp tmp2 -o tmp3.zst --rm # just warns, no prompt +test -f tmp +test -f tmp2 +zstd -q tmp tmp2 -o tmp3.zst --rm && die "should refuse to concatenate" + println "test : should quietly not remove non-regular file" println hello > tmp zstd tmp -f -o "$DEVDEVICE" 2>tmplog > "$INTOVOID" -grep -v "Refusing to remove non-regular file" tmplog +grep "Refusing to remove non-regular file" tmplog && die rm -f tmplog -zstd tmp -f -o "$INTOVOID" 2>&1 | grep -v "Refusing to remove non-regular file" +zstd tmp -f -o "$INTOVOID" 2>&1 | grep "Refusing to remove non-regular file" && die println "test : --rm on stdin" println a | zstd --rm > $INTOVOID # --rm should remain silent rm -f tmp @@ -385,44 +440,46 @@ println "\n===> decompression only tests " dd bs=1048576 count=1 if=/dev/zero of=tmp zstd -d -o tmp1 "$TESTDIR/golden-decompression/rle-first-block.zst" $DIFF -s tmp1 tmp -rm -f tmp* +touch tmp_empty +zstd -d -o tmp2 "$TESTDIR/golden-decompression/empty-block.zst" +$DIFF -s tmp2 tmp_empty +rm -f tmp* println "\n===> compress multiple files" println hello > tmp1 println world > tmp2 zstd tmp1 tmp2 -o "$INTOVOID" -f zstd tmp1 tmp2 -c | zstd -t -zstd tmp1 tmp2 -o tmp.zst +echo 'y' | zstd -v tmp1 tmp2 -o tmp.zst test ! -f tmp1.zst test ! -f tmp2.zst zstd tmp1 tmp2 zstd -t tmp1.zst tmp2.zst zstd -dc tmp1.zst tmp2.zst zstd tmp1.zst tmp2.zst -o "$INTOVOID" -f -zstd -d tmp1.zst tmp2.zst -o tmp +echo 'y' | zstd -v -d tmp1.zst tmp2.zst -o tmp touch tmpexists zstd tmp1 tmp2 -f -o tmpexists zstd tmp1 tmp2 -q -o tmpexists && die "should have refused to overwrite" println gooder > tmp_rm1 println boi > tmp_rm2 println worldly > tmp_rm3 -echo 'y' | zstd tmp_rm1 tmp_rm2 -o tmp_rm3.zst --rm # tests the warning prompt for --rm with multiple inputs into once source -test ! -f tmp_rm1 -test ! -f tmp_rm2 +echo 'y' | zstd -v tmp_rm1 tmp_rm2 -v -o tmp_rm3.zst +test -f tmp_rm1 +test -f tmp_rm2 cp tmp_rm3.zst tmp_rm4.zst -echo 'Y' | zstd -d tmp_rm3.zst tmp_rm4.zst -o tmp_rm_out --rm -test ! -f tmp_rm3.zst -test ! -f tmp_rm4.zst -echo 'yes' | zstd tmp_rm_out tmp_rm3 -c --rm && die "compressing multiple files to stdout with --rm should fail unless -f is specified" -echo 'yes' | zstd tmp_rm_out tmp_rm3 -c --rm -v && die "compressing multiple files to stdout with --rm should fail unless -f is specified" +echo 'Y' | zstd -v -d tmp_rm3.zst tmp_rm4.zst -v -o tmp_rm_out --rm +test -f tmp_rm3.zst +test -f tmp_rm4.zst println gooder > tmpexists1 zstd tmpexists1 tmpexists -c --rm -f > $INTOVOID - # Bug: PR #972 if [ "$?" -eq 139 ]; then die "should not have segfaulted" fi +test -f tmpexists1 +test -f tmpexists println "\n===> multiple files and shell completion " datagen -s1 > tmp1 2> $INTOVOID datagen -s2 -g100K > tmp2 2> $INTOVOID @@ -526,19 +583,9 @@ if [ "$isWindows" = false ] ; then zstd -f -d tmp1.zst -o tmp1.out assertFilePermissions tmp1.out 400 - rm -f tmp1.zst tmp1.out - umask 0666 chmod 0666 tmp1 tmp2 - println "test : respect umask when copying permissions in file -> file compression " - zstd -f tmp1 -o tmp1.zst - assertFilePermissions tmp1.zst 0 - println "test : respect umask when copying permissions in file -> file decompression " - chmod 0666 tmp1.zst - zstd -f -d tmp1.zst -o tmp1.out - assertFilePermissions tmp1.out 0 - rm -f tmp1.zst tmp1.out println "test : respect umask when compressing from stdin input " @@ -583,6 +630,17 @@ if [ -n "$READFROMBLOCKDEVICE" ] ; then rm -f tmp.img tmp.img.zst tmp.img.copy fi +println "\n===> zstd created file timestamp tests" +datagen > tmp +touch -m -t 200001010000.00 tmp +println "test : copy mtime in file -> file compression " +zstd -f tmp -o tmp.zst +assertSameMTime tmp tmp.zst +println "test : copy mtime in file -> file decompression " +zstd -f -d tmp.zst -o tmp.out +assertSameMTime tmp.zst tmp.out +rm -f tmp + println "\n===> compress multiple files into an output directory, --output-dir-flat" println henlo > tmp1 mkdir tmpInputTestDir @@ -689,9 +747,13 @@ test -f tmp2 test -f tmp3 test -f tmp4 +println "test : survive the list of files with too long filenames (--filelist=FILE)" +datagen -g5M > tmp_badList +zstd -qq -f --filelist=tmp_badList && die "should have failed : file name length is too long" # printing very long text garbage on console will cause CI failure + println "test : survive a list of files which is text garbage (--filelist=FILE)" datagen > tmp_badList -zstd -f --filelist=tmp_badList && die "should have failed : list is text garbage" +zstd -qq -f --filelist=tmp_badList && die "should have failed : list is text garbage" # printing very long text garbage on console will cause CI failure println "test : survive a list of files which is binary garbage (--filelist=FILE)" datagen -P0 -g1M > tmp_badList @@ -719,6 +781,7 @@ rm -rf tmp* println "test : show-default-cparams regular" datagen > tmp zstd --show-default-cparams -f tmp +zstd --show-default-cparams -d tmp.zst && die "error: can't use --show-default-cparams in decompression mode" rm -rf tmp* println "test : show-default-cparams recursive" @@ -729,6 +792,13 @@ datagen -g257000 > tmp_files/tmp3 zstd --show-default-cparams -f -r tmp_files rm -rf tmp* +println "test : show compression parameters in verbose mode" +datagen > tmp +zstd -vv tmp 2>&1 | \ +grep -q -E -- "--zstd=wlog=[[:digit:]]+,clog=[[:digit:]]+,hlog=[[:digit:]]+,\ +slog=[[:digit:]]+,mml=[[:digit:]]+,tlen=[[:digit:]]+,strat=[[:digit:]]+" +rm -rf tmp* + println "\n===> Advanced compression parameters " println "Hello world!" | zstd --zstd=windowLog=21, - -o tmp.zst && die "wrong parameters not detected!" println "Hello world!" | zstd --zstd=windowLo=21 - -o tmp.zst && die "wrong parameters not detected!" @@ -749,6 +819,16 @@ println "Hello world 1!" | zstd -df println "Hello world 2!" | zstd -dcf println "Hello world 3!" > tmp1 zstd -dcf tmp1 +println "" | zstd -df > tmp1 +println "" > tmp2 +$DIFF -q tmp1 tmp2 +println "1" | zstd -df > tmp1 +println "1" > tmp2 +$DIFF -q tmp1 tmp2 +println "12" | zstd -df > tmp1 +println "12" > tmp2 +$DIFF -q tmp1 tmp2 +rm -rf tmp* println "\n===> frame concatenation " @@ -757,6 +837,9 @@ println "world!" > world.tmp cat hello.tmp world.tmp > helloworld.tmp zstd -c hello.tmp > hello.zst zstd -c world.tmp > world.zst +zstd -c hello.tmp world.tmp > helloworld.zst +zstd -dc helloworld.zst > result.tmp +$DIFF helloworld.tmp result.tmp cat hello.zst world.zst > helloworld.zst zstd -dc helloworld.zst > result.tmp cat result.tmp @@ -787,7 +870,7 @@ rm -f ./*.tmp ./*.zstd println "frame concatenation tests completed" -if [ "$isWindows" = false ] && [ "$UNAME" != 'SunOS' ] && [ "$UNAME" != "OpenBSD" ] ; then +if [ "$isWindows" = false ] && [ "$UNAME" != 'SunOS' ] && [ "$UNAME" != "OpenBSD" ] && [ "$UNAME" != "AIX" ]; then println "\n**** flush write error test **** " println "println foo | zstd > /dev/full" @@ -909,11 +992,23 @@ cat tmp | zstd -14 -f --size-hint=11050 | zstd -t # slightly too high cat tmp | zstd -14 -f --size-hint=10950 | zstd -t # slightly too low cat tmp | zstd -14 -f --size-hint=22000 | zstd -t # considerably too high cat tmp | zstd -14 -f --size-hint=5500 | zstd -t # considerably too low +println "test : allows and interprets K,KB,KiB,M,MB and MiB suffix" +cat tmp | zstd -14 -f --size-hint=11K | zstd -t +cat tmp | zstd -14 -f --size-hint=11KB | zstd -t +cat tmp | zstd -14 -f --size-hint=11KiB | zstd -t +cat tmp | zstd -14 -f --size-hint=1M | zstd -t +cat tmp | zstd -14 -f --size-hint=1MB | zstd -t +cat tmp | zstd -14 -f --size-hint=1MiB | zstd -t println "\n===> dictionary tests " - -println "- test with raw dict (content only) " +println "- Test high/low compressibility corpus training" +datagen -g12M -P90 > tmpCorpusHighCompress +datagen -g12M -P5 > tmpCorpusLowCompress +zstd --train -B2K tmpCorpusHighCompress -o tmpDictHighCompress +zstd --train -B2K tmpCorpusLowCompress -o tmpDictLowCompress +rm -f tmpCorpusHighCompress tmpCorpusLowCompress tmpDictHighCompress tmpDictLowCompress +println "- Test with raw dict (content only) " datagen > tmpDict datagen -g1M | $MD5SUM > tmp1 datagen -g1M | zstd -D tmpDict | zstd -D tmpDict -dvq | $MD5SUM > tmp2 @@ -934,6 +1029,11 @@ println "- Dictionary compression with btlazy2 strategy" zstd -f tmp -D tmpDict --zstd=strategy=6 zstd -d tmp.zst -D tmpDict -fo result $DIFF "$TESTFILE" result +if [ -e /proc/self/fd/0 ]; then + println "- Test rejecting irregular dictionary file" + cat tmpDict | zstd -f tmp -D /proc/self/fd/0 && die "Piped dictionary should fail!" + cat tmpDict | zstd -d tmp.zst -D /proc/self/fd/0 -f && die "Piped dictionary should fail!" +fi if [ -n "$hasMT" ] then println "- Test dictionary compression with multithreading " @@ -982,17 +1082,20 @@ zstd -o tmpDict --train "$TESTDIR"/*.c "$PRGDIR"/*.c test -f tmpDict zstd --train "$TESTDIR"/*.c "$PRGDIR"/*.c test -f dictionary -println "- Test dictionary training fails" -echo "000000000000000000000000000000000" > tmpz -zstd --train tmpz tmpz tmpz tmpz tmpz tmpz tmpz tmpz tmpz && die "Dictionary training should fail : source is all zeros" if [ -n "$hasMT" ] then - zstd --train -T0 tmpz tmpz tmpz tmpz tmpz tmpz tmpz tmpz tmpz && die "Dictionary training should fail : source is all zeros" println "- Create dictionary with multithreading enabled" zstd --train -T0 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpDict fi rm -f tmp* dictionary +println "- Test --memory for dictionary compression" +datagen -g12M -P90 > tmpCorpusHighCompress +zstd --train -B2K tmpCorpusHighCompress -o tmpDictHighCompress --memory=10K && die "Dictionary training should fail : --memory too low (10K)" +zstd --train -B2K tmpCorpusHighCompress -o tmpDictHighCompress --memory=5MB 2> zstTrainWithMemLimitStdErr +cat zstTrainWithMemLimitStdErr | grep "setting manual memory limit for dictionary training data at 5 MB" +cat zstTrainWithMemLimitStdErr | grep "Training samples set too large (12 MB); training on 5 MB only..." +rm zstTrainWithMemLimitStdErr println "\n===> fastCover dictionary builder : advanced options " TESTFILE="$PRGDIR"/zstdcli.c @@ -1014,6 +1117,7 @@ println "- Create dictionaries with shrink-dict flag enabled" zstd --train-fastcover=steps=1,shrink "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpShrinkDict zstd --train-fastcover=steps=1,shrink=1 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpShrinkDict1 zstd --train-fastcover=steps=1,shrink=5 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpShrinkDict2 +zstd --train-fastcover=shrink=5,steps=1 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpShrinkDict3 println "- Create dictionary with size limit" zstd --train-fastcover=steps=1 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpDict2 --maxdict=4K println "- Create dictionary using all samples for both training and testing" @@ -1083,6 +1187,10 @@ zstd -t tmp3 && die "bad file not detected !" # detects 0-sized files as bad println "test --rm and --test combined " zstd -t --rm tmp1.zst test -f tmp1.zst # check file is still present +cp tmp1.zst tmp2.zst +zstd -t tmp1.zst tmp2.zst --rm +test -f tmp1.zst # check file is still present +test -f tmp2.zst # check file is still present split -b16384 tmp1.zst tmpSplit. zstd -t tmpSplit.* && die "bad file not detected !" datagen | zstd -c | zstd -t @@ -1109,7 +1217,15 @@ zstd -rqi0b1e2 tmp1 println "benchmark decompression only" zstd -f tmp1 zstd -b -d -i0 tmp1.zst +println "benchmark can fail - decompression on invalid data" +zstd -b -d -i0 tmp1 && die "invalid .zst data => benchmark should have failed" +GZIPMODE=1 +zstd --format=gzip -V || GZIPMODE=0 +if [ $GZIPMODE -eq 1 ]; then + println "benchmark mode is only compatible with zstd" + zstd --format=gzip -b tmp1 && die "-b should be incompatible with gzip format!" +fi println "\n===> zstd compatibility tests " @@ -1285,7 +1401,7 @@ println "\n===> tar extension tests " rm -f tmp tmp.tar tmp.tzst tmp.tgz tmp.txz tmp.tlz4 tmp1.zstd datagen > tmp -tar cf tmp.tar tmp +tar -cf tmp.tar tmp zstd tmp.tar -o tmp.tzst rm -f tmp.tar zstd -d tmp.tzst @@ -1293,21 +1409,21 @@ zstd -d tmp.tzst rm -f tmp.tar tmp.tzst if [ $GZIPMODE -eq 1 ]; then - tar czf tmp.tgz tmp + tar -f - -c tmp | gzip > tmp.tgz zstd -d tmp.tgz [ -e tmp.tar ] || die ".tgz failed to decompress to .tar!" rm -f tmp.tar tmp.tgz fi if [ $LZMAMODE -eq 1 ]; then - tar c tmp | zstd --format=xz > tmp.txz + tar -f - -c tmp | zstd --format=xz > tmp.txz zstd -d tmp.txz [ -e tmp.tar ] || die ".txz failed to decompress to .tar!" rm -f tmp.tar tmp.txz fi if [ $LZ4MODE -eq 1 ]; then - tar c tmp | zstd --format=lz4 > tmp.tlz4 + tar -f - -c tmp | zstd --format=lz4 > tmp.tlz4 zstd -d tmp.tlz4 [ -e tmp.tar ] || die ".tlz4 failed to decompress to .tar!" rm -f tmp.tar tmp.tlz4 @@ -1347,6 +1463,8 @@ if [ -n "$hasMT" ] then println "\n===> zstdmt round-trip tests " roundTripTest -g4M "1 -T0" + roundTripTest -g4M "1 -T0 --auto-threads=physical" + roundTripTest -g4M "1 -T0 --auto-threads=logical" roundTripTest -g8M "3 -T2" roundTripTest -g8M "19 --long" roundTripTest -g8000K "2 --threads=2" @@ -1366,6 +1484,8 @@ then ZSTD_NBTHREADS=50000000000 zstd -f mt_tmp # numeric value too large, warn and revert to default setting= ZSTD_NBTHREADS=2 zstd -f mt_tmp # correct usage ZSTD_NBTHREADS=1 zstd -f mt_tmp # correct usage: single thread + # temporary envvar changes in the above tests would actually persist in macos /bin/sh + unset ZSTD_NBTHREADS rm -f mt_tmp* println "\n===> ovLog tests " @@ -1441,7 +1561,7 @@ datagen -g0 > tmp5 zstd tmp5 zstd -l tmp5.zst zstd -l tmp5* && die "-l must fail on non-zstd file" -zstd -lv tmp5.zst | grep "Decompressed Size: 0.00 KB (0 B)" # check that 0 size is present in header +zstd -lv tmp5.zst | grep "Decompressed Size: 0 B (0 B)" # check that 0 size is present in header zstd -lv tmp5* && die "-l must fail on non-zstd file" println "\n===> zstd --list/-l test with no content size field " @@ -1500,6 +1620,44 @@ elif [ "$longCSize19wlog23" -gt "$optCSize19wlog23" ]; then exit 1 fi +println "\n===> zstd asyncio tests " + +addFrame() { + datagen -g2M -s$2 >> tmp_uncompressed + datagen -g2M -s$2 | zstd -1 --format=$1 >> tmp_compressed.zst +} + +addTwoFrames() { + addFrame $1 1 + addFrame $1 2 +} + +testAsyncIO() { + roundTripTest -g2M "3 --asyncio --format=$1" + roundTripTest -g2M "3 --no-asyncio --format=$1" +} + +rm -f tmp_compressed tmp_uncompressed +testAsyncIO zstd +addTwoFrames zstd +if [ $GZIPMODE -eq 1 ]; then + testAsyncIO gzip + addTwoFrames gzip +fi +if [ $LZMAMODE -eq 1 ]; then + testAsyncIO lzma + addTwoFrames lzma +fi +if [ $LZ4MODE -eq 1 ]; then + testAsyncIO lz4 + addTwoFrames lz4 +fi +cat tmp_uncompressed | $MD5SUM > tmp2 +zstd -d tmp_compressed.zst --asyncio -c | $MD5SUM > tmp1 +$DIFF -q tmp1 tmp2 +rm tmp1 +zstd -d tmp_compressed.zst --no-asyncio -c | $MD5SUM > tmp1 +$DIFF -q tmp1 tmp2 if [ "$1" != "--test-large-data" ]; then println "Skipping large data tests" @@ -1515,8 +1673,10 @@ then println "\n===> adaptive mode " roundTripTest -g270000000 " --adapt" roundTripTest -g27000000 " --adapt=min=1,max=4" + roundTripTest -g27000000 " --adapt=min=-2,max=-1" println "===> test: --adapt must fail on incoherent bounds " datagen > tmp + zstd --adapt= tmp && die "invalid compression parameter" zstd -f -vv --adapt=min=10,max=9 tmp && die "--adapt must fail on incoherent bounds" println "\n===> rsyncable mode " @@ -1635,6 +1795,7 @@ println "- Create first dictionary" zstd --train-cover=k=46,d=8,split=80 "$TESTDIR"/*.c "$PRGDIR"/*.c -o tmpDict cp "$TESTFILE" tmp zstd -f tmp -D tmpDict +zstd -f tmp -D tmpDict --patch-from=tmpDict && die "error: can't use -D and --patch-from=#at the same time" zstd -d tmp.zst -D tmpDict -fo result $DIFF "$TESTFILE" result zstd --train-cover=k=56,d=8 && die "Create dictionary without input file (should error)" @@ -1645,6 +1806,7 @@ println "- Create dictionary using shrink-dict flag" zstd --train-cover=steps=256,shrink "$TESTDIR"/*.c "$PRGDIR"/*.c --dictID=1 -o tmpShrinkDict zstd --train-cover=steps=256,shrink=1 "$TESTDIR"/*.c "$PRGDIR"/*.c --dictID=1 -o tmpShrinkDict1 zstd --train-cover=steps=256,shrink=5 "$TESTDIR"/*.c "$PRGDIR"/*.c --dictID=1 -o tmpShrinkDict2 +zstd --train-cover=shrink=5,steps=256 "$TESTDIR"/*.c "$PRGDIR"/*.c --dictID=1 -o tmpShrinkDict3 println "- Create dictionary with short dictID" zstd --train-cover=k=46,d=8,split=80 "$TESTDIR"/*.c "$PRGDIR"/*.c --dictID=1 -o tmpDict1 cmp tmpDict tmpDict1 && die "dictionaries should have different ID !" diff --git a/src/dependencies/zstd-1.5.0/tests/poolTests.c b/src/dependencies/zstd-1.5.4/tests/poolTests.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/poolTests.c rename to src/dependencies/zstd-1.5.4/tests/poolTests.c index 08f31c0..9e62722 100644 --- a/src/dependencies/zstd-1.5.0/tests/poolTests.c +++ b/src/dependencies/zstd-1.5.4/tests/poolTests.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/rateLimiter.py b/src/dependencies/zstd-1.5.4/tests/rateLimiter.py similarity index 95% rename from src/dependencies/zstd-1.5.0/tests/rateLimiter.py rename to src/dependencies/zstd-1.5.4/tests/rateLimiter.py index 2629372..3e65081 100755 --- a/src/dependencies/zstd-1.5.0/tests/rateLimiter.py +++ b/src/dependencies/zstd-1.5.4/tests/rateLimiter.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/.gitignore b/src/dependencies/zstd-1.5.4/tests/regression/.gitignore similarity index 88% rename from src/dependencies/zstd-1.5.0/tests/regression/.gitignore rename to src/dependencies/zstd-1.5.4/tests/regression/.gitignore index 1b2618f..3da209d 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/.gitignore +++ b/src/dependencies/zstd-1.5.4/tests/regression/.gitignore @@ -1,3 +1,4 @@ # regression test artifacts data-cache +cache test diff --git a/src/dependencies/zstd-1.5.0/tests/regression/Makefile b/src/dependencies/zstd-1.5.4/tests/regression/Makefile similarity index 91% rename from src/dependencies/zstd-1.5.0/tests/regression/Makefile rename to src/dependencies/zstd-1.5.4/tests/regression/Makefile index d0d7bcf..ba8b430 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/Makefile +++ b/src/dependencies/zstd-1.5.4/tests/regression/Makefile @@ -1,5 +1,5 @@ # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -15,7 +15,7 @@ CURL_LDFLAGS := $(shell curl-config --libs) -pthread PROGDIR := ../../programs LIBDIR := ../../lib -ZSTD_CPPFLAGS := -I$(PROGDIR) -I$(LIBDIR) -I$(LIBDIR)/common +ZSTD_CPPFLAGS := -I$(PROGDIR) -I$(LIBDIR) -I$(LIBDIR)/common -Wno-deprecated-declarations REGRESSION_CFLAGS = $(CFLAGS) $(CURL_CFLAGS) REGRESSION_CPPFLAGS = $(CPPFLAGS) $(ZSTD_CPPFLAGS) @@ -46,6 +46,7 @@ result.o: result.c result.h test.o: test.c data.h config.h method.h $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ +.PHONY: libzstd.a libzstd.a: $(MAKE) -C $(LIBDIR) libzstd.a-mt cp $(LIBDIR)/libzstd.a . diff --git a/src/dependencies/zstd-1.5.0/tests/regression/README.md b/src/dependencies/zstd-1.5.4/tests/regression/README.md similarity index 100% rename from src/dependencies/zstd-1.5.0/tests/regression/README.md rename to src/dependencies/zstd-1.5.4/tests/regression/README.md diff --git a/src/dependencies/zstd-1.5.0/tests/regression/config.c b/src/dependencies/zstd-1.5.4/tests/regression/config.c similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/regression/config.c rename to src/dependencies/zstd-1.5.4/tests/regression/config.c index 4c66dd1..1d86fff 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/config.c +++ b/src/dependencies/zstd-1.5.4/tests/regression/config.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -183,7 +183,7 @@ static config_t no_pledged_src_size_with_dict = { }; static param_value_t const ldm_param_values[] = { - {.param = ZSTD_c_enableLongDistanceMatching, .value = 1}, + {.param = ZSTD_c_enableLongDistanceMatching, .value = ZSTD_ps_enable}, }; static config_t ldm = { @@ -204,7 +204,7 @@ static config_t mt = { static param_value_t const mt_ldm_param_values[] = { {.param = ZSTD_c_nbWorkers, .value = 2}, - {.param = ZSTD_c_enableLongDistanceMatching, .value = 1}, + {.param = ZSTD_c_enableLongDistanceMatching, .value = ZSTD_ps_enable}, }; static config_t mt_ldm = { @@ -215,7 +215,7 @@ static config_t mt_ldm = { static param_value_t mt_advanced_param_values[] = { {.param = ZSTD_c_nbWorkers, .value = 2}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_uncompressed}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_disable}, }; static config_t mt_advanced = { @@ -258,7 +258,7 @@ static config_t small_clog = { static param_value_t const uncompressed_literals_param_values[] = { {.param = ZSTD_c_compressionLevel, .value = 3}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_uncompressed}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_disable}, }; static config_t uncompressed_literals = { @@ -269,7 +269,7 @@ static config_t uncompressed_literals = { static param_value_t const uncompressed_literals_opt_param_values[] = { {.param = ZSTD_c_compressionLevel, .value = 19}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_uncompressed}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_disable}, }; static config_t uncompressed_literals_opt = { @@ -280,7 +280,7 @@ static config_t uncompressed_literals_opt = { static param_value_t const huffman_literals_param_values[] = { {.param = ZSTD_c_compressionLevel, .value = -1}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_huffman}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_enable}, }; static config_t huffman_literals = { diff --git a/src/dependencies/zstd-1.5.0/tests/regression/config.h b/src/dependencies/zstd-1.5.4/tests/regression/config.h similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/regression/config.h rename to src/dependencies/zstd-1.5.4/tests/regression/config.h index dd88937..a4b542a 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/config.h +++ b/src/dependencies/zstd-1.5.4/tests/regression/config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/data.c b/src/dependencies/zstd-1.5.4/tests/regression/data.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/regression/data.c rename to src/dependencies/zstd-1.5.4/tests/regression/data.c index 341b02d..43f085f 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/data.c +++ b/src/dependencies/zstd-1.5.4/tests/regression/data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/data.h b/src/dependencies/zstd-1.5.4/tests/regression/data.h similarity index 98% rename from src/dependencies/zstd-1.5.0/tests/regression/data.h rename to src/dependencies/zstd-1.5.4/tests/regression/data.h index e54e6a1..a4ee920 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/data.h +++ b/src/dependencies/zstd-1.5.4/tests/regression/data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/levels.h b/src/dependencies/zstd-1.5.4/tests/regression/levels.h similarity index 75% rename from src/dependencies/zstd-1.5.0/tests/regression/levels.h rename to src/dependencies/zstd-1.5.4/tests/regression/levels.h index 3b211f8..d15b120 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/levels.h +++ b/src/dependencies/zstd-1.5.4/tests/regression/levels.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -35,21 +35,23 @@ LEVEL(1) LEVEL(3) LEVEL(4) /* ROW_LEVEL triggers the row hash (force enabled and disabled) with different - * dictionary strategies, and 16/32 row entries based on the level/searchLog. - * 1 == disabled, 2 == enabled. + * dictionary strategies, and 16/32/64 row entries based on the level/searchLog. + * 1 == enabled, 2 == disabled. */ ROW_LEVEL(5, 1) -ROW_LEVEL(5, 2) +ROW_LEVEL(5, 2) /* 16-entry rows */ LEVEL(5) LEVEL(6) ROW_LEVEL(7, 1) -ROW_LEVEL(7, 2) +ROW_LEVEL(7, 2) /* 16-entry rows */ LEVEL(7) LEVEL(9) +ROW_LEVEL(11, 1) +ROW_LEVEL(11, 2) /* 32-entry rows */ ROW_LEVEL(12, 1) -ROW_LEVEL(12, 2) +ROW_LEVEL(12, 2) /* 64-entry rows */ LEVEL(13) LEVEL(16) diff --git a/src/dependencies/zstd-1.5.0/tests/regression/method.c b/src/dependencies/zstd-1.5.4/tests/regression/method.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/regression/method.c rename to src/dependencies/zstd-1.5.4/tests/regression/method.c index 55b1154..f84a15e 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/method.c +++ b/src/dependencies/zstd-1.5.4/tests/regression/method.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/method.h b/src/dependencies/zstd-1.5.4/tests/regression/method.h similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/regression/method.h rename to src/dependencies/zstd-1.5.4/tests/regression/method.h index 1a36a93..8efdd33 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/method.h +++ b/src/dependencies/zstd-1.5.4/tests/regression/method.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/result.c b/src/dependencies/zstd-1.5.4/tests/regression/result.c similarity index 94% rename from src/dependencies/zstd-1.5.0/tests/regression/result.c rename to src/dependencies/zstd-1.5.4/tests/regression/result.c index 1f879c1..8ccb875 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/result.c +++ b/src/dependencies/zstd-1.5.4/tests/regression/result.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/result.h b/src/dependencies/zstd-1.5.4/tests/regression/result.h similarity index 97% rename from src/dependencies/zstd-1.5.0/tests/regression/result.h rename to src/dependencies/zstd-1.5.4/tests/regression/result.h index 197fa90..8a761ea 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/result.h +++ b/src/dependencies/zstd-1.5.4/tests/regression/result.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/regression/results.csv b/src/dependencies/zstd-1.5.4/tests/regression/results.csv similarity index 67% rename from src/dependencies/zstd-1.5.0/tests/regression/results.csv rename to src/dependencies/zstd-1.5.4/tests/regression/results.csv index b94d550..188eea9 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/results.csv +++ b/src/dependencies/zstd-1.5.4/tests/regression/results.csv @@ -1,74 +1,74 @@ Data, Config, Method, Total compressed size -silesia.tar, level -5, compress simple, 6738593 -silesia.tar, level -3, compress simple, 6446372 -silesia.tar, level -1, compress simple, 6186042 -silesia.tar, level 0, compress simple, 4861425 -silesia.tar, level 1, compress simple, 5334885 -silesia.tar, level 3, compress simple, 4861425 -silesia.tar, level 4, compress simple, 4799630 -silesia.tar, level 5, compress simple, 4719256 -silesia.tar, level 6, compress simple, 4677721 -silesia.tar, level 7, compress simple, 4613541 -silesia.tar, level 9, compress simple, 4555426 -silesia.tar, level 13, compress simple, 4491764 -silesia.tar, level 16, compress simple, 4381332 -silesia.tar, level 19, compress simple, 4281605 -silesia.tar, uncompressed literals, compress simple, 4861425 -silesia.tar, uncompressed literals optimal, compress simple, 4281605 -silesia.tar, huffman literals, compress simple, 6186042 -github.tar, level -5, compress simple, 46856 -github.tar, level -3, compress simple, 43754 -github.tar, level -1, compress simple, 42490 -github.tar, level 0, compress simple, 38441 -github.tar, level 1, compress simple, 39265 -github.tar, level 3, compress simple, 38441 -github.tar, level 4, compress simple, 38467 -github.tar, level 5, compress simple, 39693 -github.tar, level 6, compress simple, 39621 -github.tar, level 7, compress simple, 39213 -github.tar, level 9, compress simple, 36758 -github.tar, level 13, compress simple, 35621 -github.tar, level 16, compress simple, 40255 -github.tar, level 19, compress simple, 32837 -github.tar, uncompressed literals, compress simple, 38441 -github.tar, uncompressed literals optimal, compress simple, 32837 -github.tar, huffman literals, compress simple, 42490 -silesia, level -5, compress cctx, 6737607 -silesia, level -3, compress cctx, 6444677 -silesia, level -1, compress cctx, 6178460 -silesia, level 0, compress cctx, 4849552 -silesia, level 1, compress cctx, 5313204 -silesia, level 3, compress cctx, 4849552 -silesia, level 4, compress cctx, 4786970 -silesia, level 5, compress cctx, 4707794 -silesia, level 6, compress cctx, 4666383 -silesia, level 7, compress cctx, 4603381 -silesia, level 9, compress cctx, 4546001 -silesia, level 13, compress cctx, 4482135 -silesia, level 16, compress cctx, 4377465 -silesia, level 19, compress cctx, 4293330 -silesia, long distance mode, compress cctx, 4849552 -silesia, multithreaded, compress cctx, 4849552 -silesia, multithreaded long distance mode, compress cctx, 4849552 -silesia, small window log, compress cctx, 7084179 -silesia, small hash log, compress cctx, 6555021 -silesia, small chain log, compress cctx, 4931148 -silesia, explicit params, compress cctx, 4794479 -silesia, uncompressed literals, compress cctx, 4849552 -silesia, uncompressed literals optimal, compress cctx, 4293330 -silesia, huffman literals, compress cctx, 6178460 -silesia, multithreaded with advanced params, compress cctx, 4849552 -github, level -5, compress cctx, 205285 -github, level -5 with dict, compress cctx, 47294 -github, level -3, compress cctx, 190643 -github, level -3 with dict, compress cctx, 48047 -github, level -1, compress cctx, 175568 -github, level -1 with dict, compress cctx, 43527 -github, level 0, compress cctx, 136335 +silesia.tar, level -5, compress simple, 6861055 +silesia.tar, level -3, compress simple, 6505483 +silesia.tar, level -1, compress simple, 6179047 +silesia.tar, level 0, compress simple, 4854086 +silesia.tar, level 1, compress simple, 5327717 +silesia.tar, level 3, compress simple, 4854086 +silesia.tar, level 4, compress simple, 4791503 +silesia.tar, level 5, compress simple, 4677740 +silesia.tar, level 6, compress simple, 4613242 +silesia.tar, level 7, compress simple, 4576661 +silesia.tar, level 9, compress simple, 4552899 +silesia.tar, level 13, compress simple, 4502956 +silesia.tar, level 16, compress simple, 4360546 +silesia.tar, level 19, compress simple, 4265911 +silesia.tar, uncompressed literals, compress simple, 4854086 +silesia.tar, uncompressed literals optimal, compress simple, 4265911 +silesia.tar, huffman literals, compress simple, 6179047 +github.tar, level -5, compress simple, 52115 +github.tar, level -3, compress simple, 45678 +github.tar, level -1, compress simple, 42560 +github.tar, level 0, compress simple, 38831 +github.tar, level 1, compress simple, 39200 +github.tar, level 3, compress simple, 38831 +github.tar, level 4, compress simple, 38893 +github.tar, level 5, compress simple, 39651 +github.tar, level 6, compress simple, 39282 +github.tar, level 7, compress simple, 38110 +github.tar, level 9, compress simple, 36760 +github.tar, level 13, compress simple, 35501 +github.tar, level 16, compress simple, 40466 +github.tar, level 19, compress simple, 32276 +github.tar, uncompressed literals, compress simple, 38831 +github.tar, uncompressed literals optimal, compress simple, 32276 +github.tar, huffman literals, compress simple, 42560 +silesia, level -5, compress cctx, 6857372 +silesia, level -3, compress cctx, 6503412 +silesia, level -1, compress cctx, 6172202 +silesia, level 0, compress cctx, 4842075 +silesia, level 1, compress cctx, 5306632 +silesia, level 3, compress cctx, 4842075 +silesia, level 4, compress cctx, 4779186 +silesia, level 5, compress cctx, 4666323 +silesia, level 6, compress cctx, 4603066 +silesia, level 7, compress cctx, 4566984 +silesia, level 9, compress cctx, 4543018 +silesia, level 13, compress cctx, 4493990 +silesia, level 16, compress cctx, 4360041 +silesia, level 19, compress cctx, 4296055 +silesia, long distance mode, compress cctx, 4842075 +silesia, multithreaded, compress cctx, 4842075 +silesia, multithreaded long distance mode, compress cctx, 4842075 +silesia, small window log, compress cctx, 7082951 +silesia, small hash log, compress cctx, 6526141 +silesia, small chain log, compress cctx, 4912197 +silesia, explicit params, compress cctx, 4794052 +silesia, uncompressed literals, compress cctx, 4842075 +silesia, uncompressed literals optimal, compress cctx, 4296055 +silesia, huffman literals, compress cctx, 6172202 +silesia, multithreaded with advanced params, compress cctx, 4842075 +github, level -5, compress cctx, 204407 +github, level -5 with dict, compress cctx, 52059 +github, level -3, compress cctx, 193253 +github, level -3 with dict, compress cctx, 46787 +github, level -1, compress cctx, 175468 +github, level -1 with dict, compress cctx, 43585 +github, level 0, compress cctx, 136332 github, level 0 with dict, compress cctx, 41534 -github, level 1, compress cctx, 142465 -github, level 1 with dict, compress cctx, 42157 -github, level 3, compress cctx, 136335 +github, level 1, compress cctx, 142365 +github, level 1 with dict, compress cctx, 42259 +github, level 3, compress cctx, 136332 github, level 3 with dict, compress cctx, 41534 github, level 4, compress cctx, 136199 github, level 4 with dict, compress cctx, 41725 @@ -80,237 +80,241 @@ github, level 7, compress github, level 7 with dict, compress cctx, 38755 github, level 9, compress cctx, 135122 github, level 9 with dict, compress cctx, 39398 -github, level 13, compress cctx, 134064 +github, level 13, compress cctx, 132878 github, level 13 with dict, compress cctx, 39948 -github, level 16, compress cctx, 134064 +github, level 16, compress cctx, 133209 github, level 16 with dict, compress cctx, 37568 -github, level 19, compress cctx, 134064 +github, level 19, compress cctx, 132879 github, level 19 with dict, compress cctx, 37567 -github, long distance mode, compress cctx, 141102 -github, multithreaded, compress cctx, 141102 -github, multithreaded long distance mode, compress cctx, 141102 -github, small window log, compress cctx, 141102 +github, long distance mode, compress cctx, 141069 +github, multithreaded, compress cctx, 141069 +github, multithreaded long distance mode, compress cctx, 141069 +github, small window log, compress cctx, 141069 github, small hash log, compress cctx, 138949 github, small chain log, compress cctx, 139242 github, explicit params, compress cctx, 140932 -github, uncompressed literals, compress cctx, 136335 -github, uncompressed literals optimal, compress cctx, 134064 -github, huffman literals, compress cctx, 175568 -github, multithreaded with advanced params, compress cctx, 141102 -silesia, level -5, zstdcli, 6737655 -silesia, level -3, zstdcli, 6444725 -silesia, level -1, zstdcli, 6178508 -silesia, level 0, zstdcli, 4849600 -silesia, level 1, zstdcli, 5313252 -silesia, level 3, zstdcli, 4849600 -silesia, level 4, zstdcli, 4787018 -silesia, level 5, zstdcli, 4707842 -silesia, level 6, zstdcli, 4666431 -silesia, level 7, zstdcli, 4603429 -silesia, level 9, zstdcli, 4546049 -silesia, level 13, zstdcli, 4482183 -silesia, level 16, zstdcli, 4360299 -silesia, level 19, zstdcli, 4283285 -silesia, long distance mode, zstdcli, 4840806 -silesia, multithreaded, zstdcli, 4849600 -silesia, multithreaded long distance mode, zstdcli, 4840806 -silesia, small window log, zstdcli, 7095967 +github, uncompressed literals, compress cctx, 136332 +github, uncompressed literals optimal, compress cctx, 132879 +github, huffman literals, compress cctx, 175468 +github, multithreaded with advanced params, compress cctx, 141069 +silesia, level -5, zstdcli, 6857420 +silesia, level -3, zstdcli, 6503460 +silesia, level -1, zstdcli, 6172250 +silesia, level 0, zstdcli, 4842123 +silesia, level 1, zstdcli, 5306680 +silesia, level 3, zstdcli, 4842123 +silesia, level 4, zstdcli, 4779234 +silesia, level 5, zstdcli, 4666371 +silesia, level 6, zstdcli, 4603114 +silesia, level 7, zstdcli, 4567032 +silesia, level 9, zstdcli, 4543066 +silesia, level 13, zstdcli, 4494038 +silesia, level 16, zstdcli, 4360089 +silesia, level 19, zstdcli, 4296103 +silesia, long distance mode, zstdcli, 4833785 +silesia, multithreaded, zstdcli, 4842123 +silesia, multithreaded long distance mode, zstdcli, 4833785 +silesia, small window log, zstdcli, 7095048 silesia, small hash log, zstdcli, 6526189 silesia, small chain log, zstdcli, 4912245 -silesia, explicit params, zstdcli, 4795856 -silesia, uncompressed literals, zstdcli, 5128030 -silesia, uncompressed literals optimal, zstdcli, 4317944 -silesia, huffman literals, zstdcli, 5326316 -silesia, multithreaded with advanced params, zstdcli, 5128030 -silesia.tar, level -5, zstdcli, 6738934 -silesia.tar, level -3, zstdcli, 6448419 -silesia.tar, level -1, zstdcli, 6186912 -silesia.tar, level 0, zstdcli, 4861512 -silesia.tar, level 1, zstdcli, 5336318 -silesia.tar, level 3, zstdcli, 4861512 -silesia.tar, level 4, zstdcli, 4800529 -silesia.tar, level 5, zstdcli, 4720121 -silesia.tar, level 6, zstdcli, 4678661 -silesia.tar, level 7, zstdcli, 4614424 -silesia.tar, level 9, zstdcli, 4556062 -silesia.tar, level 13, zstdcli, 4491768 -silesia.tar, level 16, zstdcli, 4356831 -silesia.tar, level 19, zstdcli, 4264491 -silesia.tar, no source size, zstdcli, 4861508 -silesia.tar, long distance mode, zstdcli, 4853226 -silesia.tar, multithreaded, zstdcli, 4861512 -silesia.tar, multithreaded long distance mode, zstdcli, 4853226 -silesia.tar, small window log, zstdcli, 7101576 -silesia.tar, small hash log, zstdcli, 6529290 +silesia, explicit params, zstdcli, 4795432 +silesia, uncompressed literals, zstdcli, 5120614 +silesia, uncompressed literals optimal, zstdcli, 4319566 +silesia, huffman literals, zstdcli, 5321417 +silesia, multithreaded with advanced params, zstdcli, 5120614 +silesia.tar, level -5, zstdcli, 6862049 +silesia.tar, level -3, zstdcli, 6506509 +silesia.tar, level -1, zstdcli, 6179789 +silesia.tar, level 0, zstdcli, 4854164 +silesia.tar, level 1, zstdcli, 5329010 +silesia.tar, level 3, zstdcli, 4854164 +silesia.tar, level 4, zstdcli, 4792352 +silesia.tar, level 5, zstdcli, 4678682 +silesia.tar, level 6, zstdcli, 4614125 +silesia.tar, level 7, zstdcli, 4578719 +silesia.tar, level 9, zstdcli, 4552903 +silesia.tar, level 13, zstdcli, 4502960 +silesia.tar, level 16, zstdcli, 4360550 +silesia.tar, level 19, zstdcli, 4265915 +silesia.tar, no source size, zstdcli, 4854160 +silesia.tar, long distance mode, zstdcli, 4845745 +silesia.tar, multithreaded, zstdcli, 4854164 +silesia.tar, multithreaded long distance mode, zstdcli, 4845745 +silesia.tar, small window log, zstdcli, 7100701 +silesia.tar, small hash log, zstdcli, 6529264 silesia.tar, small chain log, zstdcli, 4917022 -silesia.tar, explicit params, zstdcli, 4821274 -silesia.tar, uncompressed literals, zstdcli, 5129559 -silesia.tar, uncompressed literals optimal, zstdcli, 4307457 -silesia.tar, huffman literals, zstdcli, 5347610 -silesia.tar, multithreaded with advanced params, zstdcli, 5129559 -github, level -5, zstdcli, 207285 +silesia.tar, explicit params, zstdcli, 4820713 +silesia.tar, uncompressed literals, zstdcli, 5122571 +silesia.tar, uncompressed literals optimal, zstdcli, 4310145 +silesia.tar, huffman literals, zstdcli, 5342074 +silesia.tar, multithreaded with advanced params, zstdcli, 5122571 +github, level -5, zstdcli, 206407 github, level -5 with dict, zstdcli, 48718 -github, level -3, zstdcli, 192643 +github, level -3, zstdcli, 195253 github, level -3 with dict, zstdcli, 47395 -github, level -1, zstdcli, 177568 +github, level -1, zstdcli, 177468 github, level -1 with dict, zstdcli, 45170 -github, level 0, zstdcli, 138335 +github, level 0, zstdcli, 138332 github, level 0 with dict, zstdcli, 43148 -github, level 1, zstdcli, 144465 +github, level 1, zstdcli, 144365 github, level 1 with dict, zstdcli, 43682 -github, level 3, zstdcli, 138335 +github, level 3, zstdcli, 138332 github, level 3 with dict, zstdcli, 43148 github, level 4, zstdcli, 138199 github, level 4 with dict, zstdcli, 43251 github, level 5, zstdcli, 137121 github, level 5 with dict, zstdcli, 40728 github, level 6, zstdcli, 137122 -github, level 6 with dict, zstdcli, 40630 +github, level 6 with dict, zstdcli, 40636 github, level 7, zstdcli, 137122 -github, level 7 with dict, zstdcli, 40747 +github, level 7 with dict, zstdcli, 40745 github, level 9, zstdcli, 137122 -github, level 9 with dict, zstdcli, 41338 -github, level 13, zstdcli, 136064 -github, level 13 with dict, zstdcli, 41743 -github, level 16, zstdcli, 136064 +github, level 9 with dict, zstdcli, 41393 +github, level 13, zstdcli, 134878 +github, level 13 with dict, zstdcli, 41900 +github, level 16, zstdcli, 135209 github, level 16 with dict, zstdcli, 39577 -github, level 19, zstdcli, 136064 +github, level 19, zstdcli, 134879 github, level 19 with dict, zstdcli, 39576 -github, long distance mode, zstdcli, 138335 -github, multithreaded, zstdcli, 138335 -github, multithreaded long distance mode, zstdcli, 138335 -github, small window log, zstdcli, 138335 +github, long distance mode, zstdcli, 138332 +github, multithreaded, zstdcli, 138332 +github, multithreaded long distance mode, zstdcli, 138332 +github, small window log, zstdcli, 138332 github, small hash log, zstdcli, 137590 github, small chain log, zstdcli, 138341 github, explicit params, zstdcli, 136197 -github, uncompressed literals, zstdcli, 167915 -github, uncompressed literals optimal, zstdcli, 159227 -github, huffman literals, zstdcli, 144465 -github, multithreaded with advanced params, zstdcli, 167915 -github.tar, level -5, zstdcli, 46860 -github.tar, level -5 with dict, zstdcli, 44575 -github.tar, level -3, zstdcli, 43758 -github.tar, level -3 with dict, zstdcli, 41451 -github.tar, level -1, zstdcli, 42494 -github.tar, level -1 with dict, zstdcli, 41135 -github.tar, level 0, zstdcli, 38445 +github, uncompressed literals, zstdcli, 167911 +github, uncompressed literals optimal, zstdcli, 154667 +github, huffman literals, zstdcli, 144365 +github, multithreaded with advanced params, zstdcli, 167911 +github.tar, level -5, zstdcli, 52119 +github.tar, level -5 with dict, zstdcli, 50978 +github.tar, level -3, zstdcli, 45682 +github.tar, level -3 with dict, zstdcli, 44660 +github.tar, level -1, zstdcli, 42564 +github.tar, level -1 with dict, zstdcli, 41155 +github.tar, level 0, zstdcli, 38835 github.tar, level 0 with dict, zstdcli, 37999 -github.tar, level 1, zstdcli, 39269 -github.tar, level 1 with dict, zstdcli, 38284 -github.tar, level 3, zstdcli, 38445 +github.tar, level 1, zstdcli, 39204 +github.tar, level 1 with dict, zstdcli, 38093 +github.tar, level 3, zstdcli, 38835 github.tar, level 3 with dict, zstdcli, 37999 -github.tar, level 4, zstdcli, 38471 +github.tar, level 4, zstdcli, 38897 github.tar, level 4 with dict, zstdcli, 37952 -github.tar, level 5, zstdcli, 39697 -github.tar, level 5 with dict, zstdcli, 39032 -github.tar, level 6, zstdcli, 39625 -github.tar, level 6 with dict, zstdcli, 38614 -github.tar, level 7, zstdcli, 39217 -github.tar, level 7 with dict, zstdcli, 37871 -github.tar, level 9, zstdcli, 36762 -github.tar, level 9 with dict, zstdcli, 36641 -github.tar, level 13, zstdcli, 35625 -github.tar, level 13 with dict, zstdcli, 38730 -github.tar, level 16, zstdcli, 40259 -github.tar, level 16 with dict, zstdcli, 33643 -github.tar, level 19, zstdcli, 32841 -github.tar, level 19 with dict, zstdcli, 32899 -github.tar, no source size, zstdcli, 38442 +github.tar, level 5, zstdcli, 39655 +github.tar, level 5 with dict, zstdcli, 39071 +github.tar, level 6, zstdcli, 39286 +github.tar, level 6 with dict, zstdcli, 38638 +github.tar, level 7, zstdcli, 38114 +github.tar, level 7 with dict, zstdcli, 37886 +github.tar, level 9, zstdcli, 36764 +github.tar, level 9 with dict, zstdcli, 36632 +github.tar, level 13, zstdcli, 35505 +github.tar, level 13 with dict, zstdcli, 37134 +github.tar, level 16, zstdcli, 40470 +github.tar, level 16 with dict, zstdcli, 33378 +github.tar, level 19, zstdcli, 32280 +github.tar, level 19 with dict, zstdcli, 32716 +github.tar, no source size, zstdcli, 38832 github.tar, no source size with dict, zstdcli, 38004 -github.tar, long distance mode, zstdcli, 39730 -github.tar, multithreaded, zstdcli, 38445 -github.tar, multithreaded long distance mode, zstdcli, 39730 +github.tar, long distance mode, zstdcli, 40236 +github.tar, multithreaded, zstdcli, 38835 +github.tar, multithreaded long distance mode, zstdcli, 40236 github.tar, small window log, zstdcli, 198544 github.tar, small hash log, zstdcli, 129874 github.tar, small chain log, zstdcli, 41673 -github.tar, explicit params, zstdcli, 41227 -github.tar, uncompressed literals, zstdcli, 41126 -github.tar, uncompressed literals optimal, zstdcli, 35392 -github.tar, huffman literals, zstdcli, 38781 -github.tar, multithreaded with advanced params, zstdcli, 41126 -silesia, level -5, advanced one pass, 6737607 -silesia, level -3, advanced one pass, 6444677 -silesia, level -1, advanced one pass, 6178460 -silesia, level 0, advanced one pass, 4849552 -silesia, level 1, advanced one pass, 5313204 -silesia, level 3, advanced one pass, 4849552 -silesia, level 4, advanced one pass, 4786970 -silesia, level 5 row 1, advanced one pass, 4710236 -silesia, level 5 row 2, advanced one pass, 4707794 -silesia, level 5, advanced one pass, 4707794 -silesia, level 6, advanced one pass, 4666383 -silesia, level 7 row 1, advanced one pass, 4596296 -silesia, level 7 row 2, advanced one pass, 4603381 -silesia, level 7, advanced one pass, 4603381 -silesia, level 9, advanced one pass, 4546001 -silesia, level 12 row 1, advanced one pass, 4519288 -silesia, level 12 row 2, advanced one pass, 4521397 -silesia, level 13, advanced one pass, 4482135 -silesia, level 16, advanced one pass, 4360251 -silesia, level 19, advanced one pass, 4283237 -silesia, no source size, advanced one pass, 4849552 -silesia, long distance mode, advanced one pass, 4840738 -silesia, multithreaded, advanced one pass, 4849552 -silesia, multithreaded long distance mode, advanced one pass, 4840758 -silesia, small window log, advanced one pass, 7095919 +github.tar, explicit params, zstdcli, 41385 +github.tar, uncompressed literals, zstdcli, 41529 +github.tar, uncompressed literals optimal, zstdcli, 35401 +github.tar, huffman literals, zstdcli, 38857 +github.tar, multithreaded with advanced params, zstdcli, 41529 +silesia, level -5, advanced one pass, 6857372 +silesia, level -3, advanced one pass, 6503412 +silesia, level -1, advanced one pass, 6172202 +silesia, level 0, advanced one pass, 4842075 +silesia, level 1, advanced one pass, 5306632 +silesia, level 3, advanced one pass, 4842075 +silesia, level 4, advanced one pass, 4779186 +silesia, level 5 row 1, advanced one pass, 4666323 +silesia, level 5 row 2, advanced one pass, 4670136 +silesia, level 5, advanced one pass, 4666323 +silesia, level 6, advanced one pass, 4603066 +silesia, level 7 row 1, advanced one pass, 4566984 +silesia, level 7 row 2, advanced one pass, 4564868 +silesia, level 7, advanced one pass, 4566984 +silesia, level 9, advanced one pass, 4543018 +silesia, level 11 row 1, advanced one pass, 4505046 +silesia, level 11 row 2, advanced one pass, 4503116 +silesia, level 12 row 1, advanced one pass, 4505046 +silesia, level 12 row 2, advanced one pass, 4503116 +silesia, level 13, advanced one pass, 4493990 +silesia, level 16, advanced one pass, 4360041 +silesia, level 19, advanced one pass, 4296055 +silesia, no source size, advanced one pass, 4842075 +silesia, long distance mode, advanced one pass, 4833710 +silesia, multithreaded, advanced one pass, 4842075 +silesia, multithreaded long distance mode, advanced one pass, 4833737 +silesia, small window log, advanced one pass, 7095000 silesia, small hash log, advanced one pass, 6526141 silesia, small chain log, advanced one pass, 4912197 -silesia, explicit params, advanced one pass, 4795856 -silesia, uncompressed literals, advanced one pass, 5127982 -silesia, uncompressed literals optimal, advanced one pass, 4317896 -silesia, huffman literals, advanced one pass, 5326268 -silesia, multithreaded with advanced params, advanced one pass, 5127982 -silesia.tar, level -5, advanced one pass, 6738593 -silesia.tar, level -3, advanced one pass, 6446372 -silesia.tar, level -1, advanced one pass, 6186042 -silesia.tar, level 0, advanced one pass, 4861425 -silesia.tar, level 1, advanced one pass, 5334885 -silesia.tar, level 3, advanced one pass, 4861425 -silesia.tar, level 4, advanced one pass, 4799630 -silesia.tar, level 5 row 1, advanced one pass, 4722324 -silesia.tar, level 5 row 2, advanced one pass, 4719256 -silesia.tar, level 5, advanced one pass, 4719256 -silesia.tar, level 6, advanced one pass, 4677721 -silesia.tar, level 7 row 1, advanced one pass, 4606715 -silesia.tar, level 7 row 2, advanced one pass, 4613541 -silesia.tar, level 7, advanced one pass, 4613541 -silesia.tar, level 9, advanced one pass, 4555426 -silesia.tar, level 12 row 1, advanced one pass, 4529459 -silesia.tar, level 12 row 2, advanced one pass, 4530256 -silesia.tar, level 13, advanced one pass, 4491764 -silesia.tar, level 16, advanced one pass, 4356827 -silesia.tar, level 19, advanced one pass, 4264487 -silesia.tar, no source size, advanced one pass, 4861425 -silesia.tar, long distance mode, advanced one pass, 4847754 -silesia.tar, multithreaded, advanced one pass, 4861508 -silesia.tar, multithreaded long distance mode, advanced one pass, 4853222 -silesia.tar, small window log, advanced one pass, 7101530 -silesia.tar, small hash log, advanced one pass, 6529232 +silesia, explicit params, advanced one pass, 4795432 +silesia, uncompressed literals, advanced one pass, 5120566 +silesia, uncompressed literals optimal, advanced one pass, 4319518 +silesia, huffman literals, advanced one pass, 5321369 +silesia, multithreaded with advanced params, advanced one pass, 5120566 +silesia.tar, level -5, advanced one pass, 6861055 +silesia.tar, level -3, advanced one pass, 6505483 +silesia.tar, level -1, advanced one pass, 6179047 +silesia.tar, level 0, advanced one pass, 4854086 +silesia.tar, level 1, advanced one pass, 5327717 +silesia.tar, level 3, advanced one pass, 4854086 +silesia.tar, level 4, advanced one pass, 4791503 +silesia.tar, level 5 row 1, advanced one pass, 4677740 +silesia.tar, level 5 row 2, advanced one pass, 4682161 +silesia.tar, level 5, advanced one pass, 4677740 +silesia.tar, level 6, advanced one pass, 4613242 +silesia.tar, level 7 row 1, advanced one pass, 4576661 +silesia.tar, level 7 row 2, advanced one pass, 4575393 +silesia.tar, level 7, advanced one pass, 4576661 +silesia.tar, level 9, advanced one pass, 4552899 +silesia.tar, level 11 row 1, advanced one pass, 4514432 +silesia.tar, level 11 row 2, advanced one pass, 4513604 +silesia.tar, level 12 row 1, advanced one pass, 4514049 +silesia.tar, level 12 row 2, advanced one pass, 4513797 +silesia.tar, level 13, advanced one pass, 4502956 +silesia.tar, level 16, advanced one pass, 4360546 +silesia.tar, level 19, advanced one pass, 4265911 +silesia.tar, no source size, advanced one pass, 4854086 +silesia.tar, long distance mode, advanced one pass, 4840452 +silesia.tar, multithreaded, advanced one pass, 4854160 +silesia.tar, multithreaded long distance mode, advanced one pass, 4845741 +silesia.tar, small window log, advanced one pass, 7100655 +silesia.tar, small hash log, advanced one pass, 6529206 silesia.tar, small chain log, advanced one pass, 4917041 -silesia.tar, explicit params, advanced one pass, 4807380 -silesia.tar, uncompressed literals, advanced one pass, 5129458 -silesia.tar, uncompressed literals optimal, advanced one pass, 4307453 -silesia.tar, huffman literals, advanced one pass, 5347335 -silesia.tar, multithreaded with advanced params, advanced one pass, 5129555 -github, level -5, advanced one pass, 205285 +silesia.tar, explicit params, advanced one pass, 4806855 +silesia.tar, uncompressed literals, advanced one pass, 5122473 +silesia.tar, uncompressed literals optimal, advanced one pass, 4310141 +silesia.tar, huffman literals, advanced one pass, 5341705 +silesia.tar, multithreaded with advanced params, advanced one pass, 5122567 +github, level -5, advanced one pass, 204407 github, level -5 with dict, advanced one pass, 46718 -github, level -3, advanced one pass, 190643 +github, level -3, advanced one pass, 193253 github, level -3 with dict, advanced one pass, 45395 -github, level -1, advanced one pass, 175568 +github, level -1, advanced one pass, 175468 github, level -1 with dict, advanced one pass, 43170 -github, level 0, advanced one pass, 136335 +github, level 0, advanced one pass, 136332 github, level 0 with dict, advanced one pass, 41148 github, level 0 with dict dms, advanced one pass, 41148 github, level 0 with dict dds, advanced one pass, 41148 github, level 0 with dict copy, advanced one pass, 41124 github, level 0 with dict load, advanced one pass, 42252 -github, level 1, advanced one pass, 142465 +github, level 1, advanced one pass, 142365 github, level 1 with dict, advanced one pass, 41682 github, level 1 with dict dms, advanced one pass, 41682 github, level 1 with dict dds, advanced one pass, 41682 -github, level 1 with dict copy, advanced one pass, 41674 -github, level 1 with dict load, advanced one pass, 43755 -github, level 3, advanced one pass, 136335 +github, level 1 with dict copy, advanced one pass, 41698 +github, level 1 with dict load, advanced one pass, 43814 +github, level 3, advanced one pass, 136332 github, level 3 with dict, advanced one pass, 41148 github, level 3 with dict dms, advanced one pass, 41148 github, level 3 with dict dds, advanced one pass, 41148 @@ -322,16 +326,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass, 41251 github, level 4 with dict copy, advanced one pass, 41216 github, level 4 with dict load, advanced one pass, 41159 -github, level 5 row 1, advanced one pass, 135121 -github, level 5 row 1 with dict dms, advanced one pass, 38938 -github, level 5 row 1 with dict dds, advanced one pass, 38732 -github, level 5 row 1 with dict copy, advanced one pass, 38934 -github, level 5 row 1 with dict load, advanced one pass, 40725 -github, level 5 row 2, advanced one pass, 134584 -github, level 5 row 2 with dict dms, advanced one pass, 38758 -github, level 5 row 2 with dict dds, advanced one pass, 38728 -github, level 5 row 2 with dict copy, advanced one pass, 38759 -github, level 5 row 2 with dict load, advanced one pass, 41518 +github, level 5 row 1, advanced one pass, 134584 +github, level 5 row 1 with dict dms, advanced one pass, 38758 +github, level 5 row 1 with dict dds, advanced one pass, 38728 +github, level 5 row 1 with dict copy, advanced one pass, 38759 +github, level 5 row 1 with dict load, advanced one pass, 41518 +github, level 5 row 2, advanced one pass, 135121 +github, level 5 row 2 with dict dms, advanced one pass, 38938 +github, level 5 row 2 with dict dds, advanced one pass, 38732 +github, level 5 row 2 with dict copy, advanced one pass, 38934 +github, level 5 row 2 with dict load, advanced one pass, 40725 github, level 5, advanced one pass, 135121 github, level 5 with dict, advanced one pass, 38758 github, level 5 with dict dms, advanced one pass, 38758 @@ -341,270 +345,294 @@ github, level 5 with dict load, advanced github, level 6, advanced one pass, 135122 github, level 6 with dict, advanced one pass, 38671 github, level 6 with dict dms, advanced one pass, 38671 -github, level 6 with dict dds, advanced one pass, 38630 +github, level 6 with dict dds, advanced one pass, 38636 github, level 6 with dict copy, advanced one pass, 38669 github, level 6 with dict load, advanced one pass, 40695 -github, level 7 row 1, advanced one pass, 135122 -github, level 7 row 1 with dict dms, advanced one pass, 38771 -github, level 7 row 1 with dict dds, advanced one pass, 38771 -github, level 7 row 1 with dict copy, advanced one pass, 38745 -github, level 7 row 1 with dict load, advanced one pass, 40695 -github, level 7 row 2, advanced one pass, 134584 -github, level 7 row 2 with dict dms, advanced one pass, 38758 -github, level 7 row 2 with dict dds, advanced one pass, 38747 -github, level 7 row 2 with dict copy, advanced one pass, 38755 -github, level 7 row 2 with dict load, advanced one pass, 41030 +github, level 7 row 1, advanced one pass, 134584 +github, level 7 row 1 with dict dms, advanced one pass, 38758 +github, level 7 row 1 with dict dds, advanced one pass, 38745 +github, level 7 row 1 with dict copy, advanced one pass, 38755 +github, level 7 row 1 with dict load, advanced one pass, 43154 +github, level 7 row 2, advanced one pass, 135122 +github, level 7 row 2 with dict dms, advanced one pass, 38860 +github, level 7 row 2 with dict dds, advanced one pass, 38766 +github, level 7 row 2 with dict copy, advanced one pass, 38834 +github, level 7 row 2 with dict load, advanced one pass, 40695 github, level 7, advanced one pass, 135122 github, level 7 with dict, advanced one pass, 38758 github, level 7 with dict dms, advanced one pass, 38758 -github, level 7 with dict dds, advanced one pass, 38747 +github, level 7 with dict dds, advanced one pass, 38745 github, level 7 with dict copy, advanced one pass, 38755 github, level 7 with dict load, advanced one pass, 40695 github, level 9, advanced one pass, 135122 github, level 9 with dict, advanced one pass, 39437 github, level 9 with dict dms, advanced one pass, 39437 -github, level 9 with dict dds, advanced one pass, 39338 +github, level 9 with dict dds, advanced one pass, 39393 github, level 9 with dict copy, advanced one pass, 39398 github, level 9 with dict load, advanced one pass, 41710 -github, level 12 row 1, advanced one pass, 134180 +github, level 11 row 1, advanced one pass, 135367 +github, level 11 row 1 with dict dms, advanced one pass, 39671 +github, level 11 row 1 with dict dds, advanced one pass, 39671 +github, level 11 row 1 with dict copy, advanced one pass, 39651 +github, level 11 row 1 with dict load, advanced one pass, 41360 +github, level 11 row 2, advanced one pass, 135367 +github, level 11 row 2 with dict dms, advanced one pass, 39671 +github, level 11 row 2 with dict dds, advanced one pass, 39671 +github, level 11 row 2 with dict copy, advanced one pass, 39651 +github, level 11 row 2 with dict load, advanced one pass, 41360 +github, level 12 row 1, advanced one pass, 134402 github, level 12 row 1 with dict dms, advanced one pass, 39677 github, level 12 row 1 with dict dds, advanced one pass, 39677 github, level 12 row 1 with dict copy, advanced one pass, 39677 github, level 12 row 1 with dict load, advanced one pass, 41166 -github, level 12 row 2, advanced one pass, 134180 +github, level 12 row 2, advanced one pass, 134402 github, level 12 row 2 with dict dms, advanced one pass, 39677 github, level 12 row 2 with dict dds, advanced one pass, 39677 github, level 12 row 2 with dict copy, advanced one pass, 39677 github, level 12 row 2 with dict load, advanced one pass, 41166 -github, level 13, advanced one pass, 134064 -github, level 13 with dict, advanced one pass, 39743 -github, level 13 with dict dms, advanced one pass, 39743 -github, level 13 with dict dds, advanced one pass, 39743 +github, level 13, advanced one pass, 132878 +github, level 13 with dict, advanced one pass, 39900 +github, level 13 with dict dms, advanced one pass, 39900 +github, level 13 with dict dds, advanced one pass, 39900 github, level 13 with dict copy, advanced one pass, 39948 -github, level 13 with dict load, advanced one pass, 42626 -github, level 16, advanced one pass, 134064 +github, level 13 with dict load, advanced one pass, 42624 +github, level 16, advanced one pass, 133209 github, level 16 with dict, advanced one pass, 37577 github, level 16 with dict dms, advanced one pass, 37577 github, level 16 with dict dds, advanced one pass, 37577 github, level 16 with dict copy, advanced one pass, 37568 -github, level 16 with dict load, advanced one pass, 42340 -github, level 19, advanced one pass, 134064 +github, level 16 with dict load, advanced one pass, 42338 +github, level 19, advanced one pass, 132879 github, level 19 with dict, advanced one pass, 37576 github, level 19 with dict dms, advanced one pass, 37576 github, level 19 with dict dds, advanced one pass, 37576 github, level 19 with dict copy, advanced one pass, 37567 github, level 19 with dict load, advanced one pass, 39613 -github, no source size, advanced one pass, 136335 +github, no source size, advanced one pass, 136332 github, no source size with dict, advanced one pass, 41148 -github, long distance mode, advanced one pass, 136335 -github, multithreaded, advanced one pass, 136335 -github, multithreaded long distance mode, advanced one pass, 136335 -github, small window log, advanced one pass, 136335 +github, long distance mode, advanced one pass, 136332 +github, multithreaded, advanced one pass, 136332 +github, multithreaded long distance mode, advanced one pass, 136332 +github, small window log, advanced one pass, 136332 github, small hash log, advanced one pass, 135590 github, small chain log, advanced one pass, 136341 github, explicit params, advanced one pass, 137727 -github, uncompressed literals, advanced one pass, 165915 -github, uncompressed literals optimal, advanced one pass, 157227 -github, huffman literals, advanced one pass, 142465 -github, multithreaded with advanced params, advanced one pass, 165915 -github.tar, level -5, advanced one pass, 46856 -github.tar, level -5 with dict, advanced one pass, 44571 -github.tar, level -3, advanced one pass, 43754 -github.tar, level -3 with dict, advanced one pass, 41447 -github.tar, level -1, advanced one pass, 42490 -github.tar, level -1 with dict, advanced one pass, 41131 -github.tar, level 0, advanced one pass, 38441 +github, uncompressed literals, advanced one pass, 165911 +github, uncompressed literals optimal, advanced one pass, 152667 +github, huffman literals, advanced one pass, 142365 +github, multithreaded with advanced params, advanced one pass, 165911 +github.tar, level -5, advanced one pass, 52115 +github.tar, level -5 with dict, advanced one pass, 50974 +github.tar, level -3, advanced one pass, 45678 +github.tar, level -3 with dict, advanced one pass, 44656 +github.tar, level -1, advanced one pass, 42560 +github.tar, level -1 with dict, advanced one pass, 41151 +github.tar, level 0, advanced one pass, 38831 github.tar, level 0 with dict, advanced one pass, 37995 github.tar, level 0 with dict dms, advanced one pass, 38003 github.tar, level 0 with dict dds, advanced one pass, 38003 github.tar, level 0 with dict copy, advanced one pass, 37995 github.tar, level 0 with dict load, advanced one pass, 37956 -github.tar, level 1, advanced one pass, 39265 -github.tar, level 1 with dict, advanced one pass, 38280 -github.tar, level 1 with dict dms, advanced one pass, 38290 -github.tar, level 1 with dict dds, advanced one pass, 38290 -github.tar, level 1 with dict copy, advanced one pass, 38280 -github.tar, level 1 with dict load, advanced one pass, 38729 -github.tar, level 3, advanced one pass, 38441 +github.tar, level 1, advanced one pass, 39200 +github.tar, level 1 with dict, advanced one pass, 38089 +github.tar, level 1 with dict dms, advanced one pass, 38294 +github.tar, level 1 with dict dds, advanced one pass, 38294 +github.tar, level 1 with dict copy, advanced one pass, 38089 +github.tar, level 1 with dict load, advanced one pass, 38364 +github.tar, level 3, advanced one pass, 38831 github.tar, level 3 with dict, advanced one pass, 37995 github.tar, level 3 with dict dms, advanced one pass, 38003 github.tar, level 3 with dict dds, advanced one pass, 38003 github.tar, level 3 with dict copy, advanced one pass, 37995 github.tar, level 3 with dict load, advanced one pass, 37956 -github.tar, level 4, advanced one pass, 38467 +github.tar, level 4, advanced one pass, 38893 github.tar, level 4 with dict, advanced one pass, 37948 github.tar, level 4 with dict dms, advanced one pass, 37954 github.tar, level 4 with dict dds, advanced one pass, 37954 github.tar, level 4 with dict copy, advanced one pass, 37948 github.tar, level 4 with dict load, advanced one pass, 37927 -github.tar, level 5 row 1, advanced one pass, 39788 -github.tar, level 5 row 1 with dict dms, advanced one pass, 39365 -github.tar, level 5 row 1 with dict dds, advanced one pass, 39233 -github.tar, level 5 row 1 with dict copy, advanced one pass, 39715 -github.tar, level 5 row 1 with dict load, advanced one pass, 39209 -github.tar, level 5 row 2, advanced one pass, 39693 -github.tar, level 5 row 2 with dict dms, advanced one pass, 39024 -github.tar, level 5 row 2 with dict dds, advanced one pass, 39028 -github.tar, level 5 row 2 with dict copy, advanced one pass, 39040 -github.tar, level 5 row 2 with dict load, advanced one pass, 39037 -github.tar, level 5, advanced one pass, 39693 -github.tar, level 5 with dict, advanced one pass, 39040 -github.tar, level 5 with dict dms, advanced one pass, 39024 -github.tar, level 5 with dict dds, advanced one pass, 39028 -github.tar, level 5 with dict copy, advanced one pass, 39040 -github.tar, level 5 with dict load, advanced one pass, 39037 -github.tar, level 6, advanced one pass, 39621 -github.tar, level 6 with dict, advanced one pass, 38622 -github.tar, level 6 with dict dms, advanced one pass, 38608 -github.tar, level 6 with dict dds, advanced one pass, 38610 -github.tar, level 6 with dict copy, advanced one pass, 38622 -github.tar, level 6 with dict load, advanced one pass, 38962 -github.tar, level 7 row 1, advanced one pass, 39206 -github.tar, level 7 row 1 with dict dms, advanced one pass, 37954 -github.tar, level 7 row 1 with dict dds, advanced one pass, 37954 -github.tar, level 7 row 1 with dict copy, advanced one pass, 38071 -github.tar, level 7 row 1 with dict load, advanced one pass, 38584 -github.tar, level 7 row 2, advanced one pass, 39213 -github.tar, level 7 row 2 with dict dms, advanced one pass, 37848 -github.tar, level 7 row 2 with dict dds, advanced one pass, 37867 -github.tar, level 7 row 2 with dict copy, advanced one pass, 37848 -github.tar, level 7 row 2 with dict load, advanced one pass, 38582 -github.tar, level 7, advanced one pass, 39213 -github.tar, level 7 with dict, advanced one pass, 37848 -github.tar, level 7 with dict dms, advanced one pass, 37848 -github.tar, level 7 with dict dds, advanced one pass, 37867 -github.tar, level 7 with dict copy, advanced one pass, 37848 -github.tar, level 7 with dict load, advanced one pass, 38582 -github.tar, level 9, advanced one pass, 36758 -github.tar, level 9 with dict, advanced one pass, 36457 -github.tar, level 9 with dict dms, advanced one pass, 36549 -github.tar, level 9 with dict dds, advanced one pass, 36637 -github.tar, level 9 with dict copy, advanced one pass, 36457 -github.tar, level 9 with dict load, advanced one pass, 36350 -github.tar, level 12 row 1, advanced one pass, 36435 +github.tar, level 5 row 1, advanced one pass, 39651 +github.tar, level 5 row 1 with dict dms, advanced one pass, 39059 +github.tar, level 5 row 1 with dict dds, advanced one pass, 39067 +github.tar, level 5 row 1 with dict copy, advanced one pass, 39082 +github.tar, level 5 row 1 with dict load, advanced one pass, 38999 +github.tar, level 5 row 2, advanced one pass, 39701 +github.tar, level 5 row 2 with dict dms, advanced one pass, 39365 +github.tar, level 5 row 2 with dict dds, advanced one pass, 39233 +github.tar, level 5 row 2 with dict copy, advanced one pass, 39715 +github.tar, level 5 row 2 with dict load, advanced one pass, 39158 +github.tar, level 5, advanced one pass, 39651 +github.tar, level 5 with dict, advanced one pass, 39082 +github.tar, level 5 with dict dms, advanced one pass, 39059 +github.tar, level 5 with dict dds, advanced one pass, 39067 +github.tar, level 5 with dict copy, advanced one pass, 39082 +github.tar, level 5 with dict load, advanced one pass, 38999 +github.tar, level 6, advanced one pass, 39282 +github.tar, level 6 with dict, advanced one pass, 38656 +github.tar, level 6 with dict dms, advanced one pass, 38636 +github.tar, level 6 with dict dds, advanced one pass, 38634 +github.tar, level 6 with dict copy, advanced one pass, 38656 +github.tar, level 6 with dict load, advanced one pass, 38648 +github.tar, level 7 row 1, advanced one pass, 38110 +github.tar, level 7 row 1 with dict dms, advanced one pass, 37858 +github.tar, level 7 row 1 with dict dds, advanced one pass, 37882 +github.tar, level 7 row 1 with dict copy, advanced one pass, 37865 +github.tar, level 7 row 1 with dict load, advanced one pass, 37436 +github.tar, level 7 row 2, advanced one pass, 38077 +github.tar, level 7 row 2 with dict dms, advanced one pass, 38012 +github.tar, level 7 row 2 with dict dds, advanced one pass, 38014 +github.tar, level 7 row 2 with dict copy, advanced one pass, 38101 +github.tar, level 7 row 2 with dict load, advanced one pass, 37402 +github.tar, level 7, advanced one pass, 38110 +github.tar, level 7 with dict, advanced one pass, 37865 +github.tar, level 7 with dict dms, advanced one pass, 37858 +github.tar, level 7 with dict dds, advanced one pass, 37882 +github.tar, level 7 with dict copy, advanced one pass, 37865 +github.tar, level 7 with dict load, advanced one pass, 37436 +github.tar, level 9, advanced one pass, 36760 +github.tar, level 9 with dict, advanced one pass, 36484 +github.tar, level 9 with dict dms, advanced one pass, 36567 +github.tar, level 9 with dict dds, advanced one pass, 36628 +github.tar, level 9 with dict copy, advanced one pass, 36484 +github.tar, level 9 with dict load, advanced one pass, 36401 +github.tar, level 11 row 1, advanced one pass, 36081 +github.tar, level 11 row 1 with dict dms, advanced one pass, 36963 +github.tar, level 11 row 1 with dict dds, advanced one pass, 36963 +github.tar, level 11 row 1 with dict copy, advanced one pass, 36557 +github.tar, level 11 row 1 with dict load, advanced one pass, 36434 +github.tar, level 11 row 2, advanced one pass, 36110 +github.tar, level 11 row 2 with dict dms, advanced one pass, 36963 +github.tar, level 11 row 2 with dict dds, advanced one pass, 36963 +github.tar, level 11 row 2 with dict copy, advanced one pass, 36557 +github.tar, level 11 row 2 with dict load, advanced one pass, 36459 +github.tar, level 12 row 1, advanced one pass, 36081 github.tar, level 12 row 1 with dict dms, advanced one pass, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass, 36419 -github.tar, level 12 row 2, advanced one pass, 36435 +github.tar, level 12 row 1 with dict load, advanced one pass, 36434 +github.tar, level 12 row 2, advanced one pass, 36110 github.tar, level 12 row 2 with dict dms, advanced one pass, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass, 36424 -github.tar, level 13, advanced one pass, 35621 -github.tar, level 13 with dict, advanced one pass, 38726 -github.tar, level 13 with dict dms, advanced one pass, 38903 -github.tar, level 13 with dict dds, advanced one pass, 38903 -github.tar, level 13 with dict copy, advanced one pass, 38726 -github.tar, level 13 with dict load, advanced one pass, 36372 -github.tar, level 16, advanced one pass, 40255 -github.tar, level 16 with dict, advanced one pass, 33639 -github.tar, level 16 with dict dms, advanced one pass, 33544 -github.tar, level 16 with dict dds, advanced one pass, 33544 -github.tar, level 16 with dict copy, advanced one pass, 33639 -github.tar, level 16 with dict load, advanced one pass, 39353 -github.tar, level 19, advanced one pass, 32837 -github.tar, level 19 with dict, advanced one pass, 32895 -github.tar, level 19 with dict dms, advanced one pass, 32672 -github.tar, level 19 with dict dds, advanced one pass, 32672 -github.tar, level 19 with dict copy, advanced one pass, 32895 -github.tar, level 19 with dict load, advanced one pass, 32676 -github.tar, no source size, advanced one pass, 38441 +github.tar, level 12 row 2 with dict load, advanced one pass, 36459 +github.tar, level 13, advanced one pass, 35501 +github.tar, level 13 with dict, advanced one pass, 37130 +github.tar, level 13 with dict dms, advanced one pass, 37220 +github.tar, level 13 with dict dds, advanced one pass, 37220 +github.tar, level 13 with dict copy, advanced one pass, 37130 +github.tar, level 13 with dict load, advanced one pass, 36010 +github.tar, level 16, advanced one pass, 40466 +github.tar, level 16 with dict, advanced one pass, 33374 +github.tar, level 16 with dict dms, advanced one pass, 33206 +github.tar, level 16 with dict dds, advanced one pass, 33206 +github.tar, level 16 with dict copy, advanced one pass, 33374 +github.tar, level 16 with dict load, advanced one pass, 39081 +github.tar, level 19, advanced one pass, 32276 +github.tar, level 19 with dict, advanced one pass, 32712 +github.tar, level 19 with dict dms, advanced one pass, 32555 +github.tar, level 19 with dict dds, advanced one pass, 32555 +github.tar, level 19 with dict copy, advanced one pass, 32712 +github.tar, level 19 with dict load, advanced one pass, 32479 +github.tar, no source size, advanced one pass, 38831 github.tar, no source size with dict, advanced one pass, 37995 -github.tar, long distance mode, advanced one pass, 39757 -github.tar, multithreaded, advanced one pass, 38441 -github.tar, multithreaded long distance mode, advanced one pass, 39726 +github.tar, long distance mode, advanced one pass, 40252 +github.tar, multithreaded, advanced one pass, 38831 +github.tar, multithreaded long distance mode, advanced one pass, 40232 github.tar, small window log, advanced one pass, 198540 github.tar, small hash log, advanced one pass, 129870 github.tar, small chain log, advanced one pass, 41669 -github.tar, explicit params, advanced one pass, 41227 -github.tar, uncompressed literals, advanced one pass, 41122 -github.tar, uncompressed literals optimal, advanced one pass, 35388 -github.tar, huffman literals, advanced one pass, 38777 -github.tar, multithreaded with advanced params, advanced one pass, 41122 -silesia, level -5, advanced one pass small out, 6737607 -silesia, level -3, advanced one pass small out, 6444677 -silesia, level -1, advanced one pass small out, 6178460 -silesia, level 0, advanced one pass small out, 4849552 -silesia, level 1, advanced one pass small out, 5313204 -silesia, level 3, advanced one pass small out, 4849552 -silesia, level 4, advanced one pass small out, 4786970 -silesia, level 5 row 1, advanced one pass small out, 4710236 -silesia, level 5 row 2, advanced one pass small out, 4707794 -silesia, level 5, advanced one pass small out, 4707794 -silesia, level 6, advanced one pass small out, 4666383 -silesia, level 7 row 1, advanced one pass small out, 4596296 -silesia, level 7 row 2, advanced one pass small out, 4603381 -silesia, level 7, advanced one pass small out, 4603381 -silesia, level 9, advanced one pass small out, 4546001 -silesia, level 12 row 1, advanced one pass small out, 4519288 -silesia, level 12 row 2, advanced one pass small out, 4521397 -silesia, level 13, advanced one pass small out, 4482135 -silesia, level 16, advanced one pass small out, 4360251 -silesia, level 19, advanced one pass small out, 4283237 -silesia, no source size, advanced one pass small out, 4849552 -silesia, long distance mode, advanced one pass small out, 4840738 -silesia, multithreaded, advanced one pass small out, 4849552 -silesia, multithreaded long distance mode, advanced one pass small out, 4840758 -silesia, small window log, advanced one pass small out, 7095919 +github.tar, explicit params, advanced one pass, 41385 +github.tar, uncompressed literals, advanced one pass, 41525 +github.tar, uncompressed literals optimal, advanced one pass, 35397 +github.tar, huffman literals, advanced one pass, 38853 +github.tar, multithreaded with advanced params, advanced one pass, 41525 +silesia, level -5, advanced one pass small out, 6857372 +silesia, level -3, advanced one pass small out, 6503412 +silesia, level -1, advanced one pass small out, 6172202 +silesia, level 0, advanced one pass small out, 4842075 +silesia, level 1, advanced one pass small out, 5306632 +silesia, level 3, advanced one pass small out, 4842075 +silesia, level 4, advanced one pass small out, 4779186 +silesia, level 5 row 1, advanced one pass small out, 4666323 +silesia, level 5 row 2, advanced one pass small out, 4670136 +silesia, level 5, advanced one pass small out, 4666323 +silesia, level 6, advanced one pass small out, 4603066 +silesia, level 7 row 1, advanced one pass small out, 4566984 +silesia, level 7 row 2, advanced one pass small out, 4564868 +silesia, level 7, advanced one pass small out, 4566984 +silesia, level 9, advanced one pass small out, 4543018 +silesia, level 11 row 1, advanced one pass small out, 4505046 +silesia, level 11 row 2, advanced one pass small out, 4503116 +silesia, level 12 row 1, advanced one pass small out, 4505046 +silesia, level 12 row 2, advanced one pass small out, 4503116 +silesia, level 13, advanced one pass small out, 4493990 +silesia, level 16, advanced one pass small out, 4360041 +silesia, level 19, advanced one pass small out, 4296055 +silesia, no source size, advanced one pass small out, 4842075 +silesia, long distance mode, advanced one pass small out, 4833710 +silesia, multithreaded, advanced one pass small out, 4842075 +silesia, multithreaded long distance mode, advanced one pass small out, 4833737 +silesia, small window log, advanced one pass small out, 7095000 silesia, small hash log, advanced one pass small out, 6526141 silesia, small chain log, advanced one pass small out, 4912197 -silesia, explicit params, advanced one pass small out, 4795856 -silesia, uncompressed literals, advanced one pass small out, 5127982 -silesia, uncompressed literals optimal, advanced one pass small out, 4317896 -silesia, huffman literals, advanced one pass small out, 5326268 -silesia, multithreaded with advanced params, advanced one pass small out, 5127982 -silesia.tar, level -5, advanced one pass small out, 6738593 -silesia.tar, level -3, advanced one pass small out, 6446372 -silesia.tar, level -1, advanced one pass small out, 6186042 -silesia.tar, level 0, advanced one pass small out, 4861425 -silesia.tar, level 1, advanced one pass small out, 5334885 -silesia.tar, level 3, advanced one pass small out, 4861425 -silesia.tar, level 4, advanced one pass small out, 4799630 -silesia.tar, level 5 row 1, advanced one pass small out, 4722324 -silesia.tar, level 5 row 2, advanced one pass small out, 4719256 -silesia.tar, level 5, advanced one pass small out, 4719256 -silesia.tar, level 6, advanced one pass small out, 4677721 -silesia.tar, level 7 row 1, advanced one pass small out, 4606715 -silesia.tar, level 7 row 2, advanced one pass small out, 4613541 -silesia.tar, level 7, advanced one pass small out, 4613541 -silesia.tar, level 9, advanced one pass small out, 4555426 -silesia.tar, level 12 row 1, advanced one pass small out, 4529459 -silesia.tar, level 12 row 2, advanced one pass small out, 4530256 -silesia.tar, level 13, advanced one pass small out, 4491764 -silesia.tar, level 16, advanced one pass small out, 4356827 -silesia.tar, level 19, advanced one pass small out, 4264487 -silesia.tar, no source size, advanced one pass small out, 4861425 -silesia.tar, long distance mode, advanced one pass small out, 4847754 -silesia.tar, multithreaded, advanced one pass small out, 4861508 -silesia.tar, multithreaded long distance mode, advanced one pass small out, 4853222 -silesia.tar, small window log, advanced one pass small out, 7101530 -silesia.tar, small hash log, advanced one pass small out, 6529232 +silesia, explicit params, advanced one pass small out, 4795432 +silesia, uncompressed literals, advanced one pass small out, 5120566 +silesia, uncompressed literals optimal, advanced one pass small out, 4319518 +silesia, huffman literals, advanced one pass small out, 5321369 +silesia, multithreaded with advanced params, advanced one pass small out, 5120566 +silesia.tar, level -5, advanced one pass small out, 6861055 +silesia.tar, level -3, advanced one pass small out, 6505483 +silesia.tar, level -1, advanced one pass small out, 6179047 +silesia.tar, level 0, advanced one pass small out, 4854086 +silesia.tar, level 1, advanced one pass small out, 5327717 +silesia.tar, level 3, advanced one pass small out, 4854086 +silesia.tar, level 4, advanced one pass small out, 4791503 +silesia.tar, level 5 row 1, advanced one pass small out, 4677740 +silesia.tar, level 5 row 2, advanced one pass small out, 4682161 +silesia.tar, level 5, advanced one pass small out, 4677740 +silesia.tar, level 6, advanced one pass small out, 4613242 +silesia.tar, level 7 row 1, advanced one pass small out, 4576661 +silesia.tar, level 7 row 2, advanced one pass small out, 4575393 +silesia.tar, level 7, advanced one pass small out, 4576661 +silesia.tar, level 9, advanced one pass small out, 4552899 +silesia.tar, level 11 row 1, advanced one pass small out, 4514432 +silesia.tar, level 11 row 2, advanced one pass small out, 4513604 +silesia.tar, level 12 row 1, advanced one pass small out, 4514049 +silesia.tar, level 12 row 2, advanced one pass small out, 4513797 +silesia.tar, level 13, advanced one pass small out, 4502956 +silesia.tar, level 16, advanced one pass small out, 4360546 +silesia.tar, level 19, advanced one pass small out, 4265911 +silesia.tar, no source size, advanced one pass small out, 4854086 +silesia.tar, long distance mode, advanced one pass small out, 4840452 +silesia.tar, multithreaded, advanced one pass small out, 4854160 +silesia.tar, multithreaded long distance mode, advanced one pass small out, 4845741 +silesia.tar, small window log, advanced one pass small out, 7100655 +silesia.tar, small hash log, advanced one pass small out, 6529206 silesia.tar, small chain log, advanced one pass small out, 4917041 -silesia.tar, explicit params, advanced one pass small out, 4807380 -silesia.tar, uncompressed literals, advanced one pass small out, 5129458 -silesia.tar, uncompressed literals optimal, advanced one pass small out, 4307453 -silesia.tar, huffman literals, advanced one pass small out, 5347335 -silesia.tar, multithreaded with advanced params, advanced one pass small out, 5129555 -github, level -5, advanced one pass small out, 205285 +silesia.tar, explicit params, advanced one pass small out, 4806855 +silesia.tar, uncompressed literals, advanced one pass small out, 5122473 +silesia.tar, uncompressed literals optimal, advanced one pass small out, 4310141 +silesia.tar, huffman literals, advanced one pass small out, 5341705 +silesia.tar, multithreaded with advanced params, advanced one pass small out, 5122567 +github, level -5, advanced one pass small out, 204407 github, level -5 with dict, advanced one pass small out, 46718 -github, level -3, advanced one pass small out, 190643 +github, level -3, advanced one pass small out, 193253 github, level -3 with dict, advanced one pass small out, 45395 -github, level -1, advanced one pass small out, 175568 +github, level -1, advanced one pass small out, 175468 github, level -1 with dict, advanced one pass small out, 43170 -github, level 0, advanced one pass small out, 136335 +github, level 0, advanced one pass small out, 136332 github, level 0 with dict, advanced one pass small out, 41148 github, level 0 with dict dms, advanced one pass small out, 41148 github, level 0 with dict dds, advanced one pass small out, 41148 github, level 0 with dict copy, advanced one pass small out, 41124 github, level 0 with dict load, advanced one pass small out, 42252 -github, level 1, advanced one pass small out, 142465 +github, level 1, advanced one pass small out, 142365 github, level 1 with dict, advanced one pass small out, 41682 github, level 1 with dict dms, advanced one pass small out, 41682 github, level 1 with dict dds, advanced one pass small out, 41682 -github, level 1 with dict copy, advanced one pass small out, 41674 -github, level 1 with dict load, advanced one pass small out, 43755 -github, level 3, advanced one pass small out, 136335 +github, level 1 with dict copy, advanced one pass small out, 41698 +github, level 1 with dict load, advanced one pass small out, 43814 +github, level 3, advanced one pass small out, 136332 github, level 3 with dict, advanced one pass small out, 41148 github, level 3 with dict dms, advanced one pass small out, 41148 github, level 3 with dict dds, advanced one pass small out, 41148 @@ -616,16 +644,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass small out, 41251 github, level 4 with dict copy, advanced one pass small out, 41216 github, level 4 with dict load, advanced one pass small out, 41159 -github, level 5 row 1, advanced one pass small out, 135121 -github, level 5 row 1 with dict dms, advanced one pass small out, 38938 -github, level 5 row 1 with dict dds, advanced one pass small out, 38732 -github, level 5 row 1 with dict copy, advanced one pass small out, 38934 -github, level 5 row 1 with dict load, advanced one pass small out, 40725 -github, level 5 row 2, advanced one pass small out, 134584 -github, level 5 row 2 with dict dms, advanced one pass small out, 38758 -github, level 5 row 2 with dict dds, advanced one pass small out, 38728 -github, level 5 row 2 with dict copy, advanced one pass small out, 38759 -github, level 5 row 2 with dict load, advanced one pass small out, 41518 +github, level 5 row 1, advanced one pass small out, 134584 +github, level 5 row 1 with dict dms, advanced one pass small out, 38758 +github, level 5 row 1 with dict dds, advanced one pass small out, 38728 +github, level 5 row 1 with dict copy, advanced one pass small out, 38759 +github, level 5 row 1 with dict load, advanced one pass small out, 41518 +github, level 5 row 2, advanced one pass small out, 135121 +github, level 5 row 2 with dict dms, advanced one pass small out, 38938 +github, level 5 row 2 with dict dds, advanced one pass small out, 38732 +github, level 5 row 2 with dict copy, advanced one pass small out, 38934 +github, level 5 row 2 with dict load, advanced one pass small out, 40725 github, level 5, advanced one pass small out, 135121 github, level 5 with dict, advanced one pass small out, 38758 github, level 5 with dict dms, advanced one pass small out, 38758 @@ -635,270 +663,294 @@ github, level 5 with dict load, advanced github, level 6, advanced one pass small out, 135122 github, level 6 with dict, advanced one pass small out, 38671 github, level 6 with dict dms, advanced one pass small out, 38671 -github, level 6 with dict dds, advanced one pass small out, 38630 +github, level 6 with dict dds, advanced one pass small out, 38636 github, level 6 with dict copy, advanced one pass small out, 38669 github, level 6 with dict load, advanced one pass small out, 40695 -github, level 7 row 1, advanced one pass small out, 135122 -github, level 7 row 1 with dict dms, advanced one pass small out, 38771 -github, level 7 row 1 with dict dds, advanced one pass small out, 38771 -github, level 7 row 1 with dict copy, advanced one pass small out, 38745 -github, level 7 row 1 with dict load, advanced one pass small out, 40695 -github, level 7 row 2, advanced one pass small out, 134584 -github, level 7 row 2 with dict dms, advanced one pass small out, 38758 -github, level 7 row 2 with dict dds, advanced one pass small out, 38747 -github, level 7 row 2 with dict copy, advanced one pass small out, 38755 -github, level 7 row 2 with dict load, advanced one pass small out, 41030 +github, level 7 row 1, advanced one pass small out, 134584 +github, level 7 row 1 with dict dms, advanced one pass small out, 38758 +github, level 7 row 1 with dict dds, advanced one pass small out, 38745 +github, level 7 row 1 with dict copy, advanced one pass small out, 38755 +github, level 7 row 1 with dict load, advanced one pass small out, 43154 +github, level 7 row 2, advanced one pass small out, 135122 +github, level 7 row 2 with dict dms, advanced one pass small out, 38860 +github, level 7 row 2 with dict dds, advanced one pass small out, 38766 +github, level 7 row 2 with dict copy, advanced one pass small out, 38834 +github, level 7 row 2 with dict load, advanced one pass small out, 40695 github, level 7, advanced one pass small out, 135122 github, level 7 with dict, advanced one pass small out, 38758 github, level 7 with dict dms, advanced one pass small out, 38758 -github, level 7 with dict dds, advanced one pass small out, 38747 +github, level 7 with dict dds, advanced one pass small out, 38745 github, level 7 with dict copy, advanced one pass small out, 38755 github, level 7 with dict load, advanced one pass small out, 40695 github, level 9, advanced one pass small out, 135122 github, level 9 with dict, advanced one pass small out, 39437 github, level 9 with dict dms, advanced one pass small out, 39437 -github, level 9 with dict dds, advanced one pass small out, 39338 +github, level 9 with dict dds, advanced one pass small out, 39393 github, level 9 with dict copy, advanced one pass small out, 39398 github, level 9 with dict load, advanced one pass small out, 41710 -github, level 12 row 1, advanced one pass small out, 134180 +github, level 11 row 1, advanced one pass small out, 135367 +github, level 11 row 1 with dict dms, advanced one pass small out, 39671 +github, level 11 row 1 with dict dds, advanced one pass small out, 39671 +github, level 11 row 1 with dict copy, advanced one pass small out, 39651 +github, level 11 row 1 with dict load, advanced one pass small out, 41360 +github, level 11 row 2, advanced one pass small out, 135367 +github, level 11 row 2 with dict dms, advanced one pass small out, 39671 +github, level 11 row 2 with dict dds, advanced one pass small out, 39671 +github, level 11 row 2 with dict copy, advanced one pass small out, 39651 +github, level 11 row 2 with dict load, advanced one pass small out, 41360 +github, level 12 row 1, advanced one pass small out, 134402 github, level 12 row 1 with dict dms, advanced one pass small out, 39677 github, level 12 row 1 with dict dds, advanced one pass small out, 39677 github, level 12 row 1 with dict copy, advanced one pass small out, 39677 github, level 12 row 1 with dict load, advanced one pass small out, 41166 -github, level 12 row 2, advanced one pass small out, 134180 +github, level 12 row 2, advanced one pass small out, 134402 github, level 12 row 2 with dict dms, advanced one pass small out, 39677 github, level 12 row 2 with dict dds, advanced one pass small out, 39677 github, level 12 row 2 with dict copy, advanced one pass small out, 39677 github, level 12 row 2 with dict load, advanced one pass small out, 41166 -github, level 13, advanced one pass small out, 134064 -github, level 13 with dict, advanced one pass small out, 39743 -github, level 13 with dict dms, advanced one pass small out, 39743 -github, level 13 with dict dds, advanced one pass small out, 39743 +github, level 13, advanced one pass small out, 132878 +github, level 13 with dict, advanced one pass small out, 39900 +github, level 13 with dict dms, advanced one pass small out, 39900 +github, level 13 with dict dds, advanced one pass small out, 39900 github, level 13 with dict copy, advanced one pass small out, 39948 -github, level 13 with dict load, advanced one pass small out, 42626 -github, level 16, advanced one pass small out, 134064 +github, level 13 with dict load, advanced one pass small out, 42624 +github, level 16, advanced one pass small out, 133209 github, level 16 with dict, advanced one pass small out, 37577 github, level 16 with dict dms, advanced one pass small out, 37577 github, level 16 with dict dds, advanced one pass small out, 37577 github, level 16 with dict copy, advanced one pass small out, 37568 -github, level 16 with dict load, advanced one pass small out, 42340 -github, level 19, advanced one pass small out, 134064 +github, level 16 with dict load, advanced one pass small out, 42338 +github, level 19, advanced one pass small out, 132879 github, level 19 with dict, advanced one pass small out, 37576 github, level 19 with dict dms, advanced one pass small out, 37576 github, level 19 with dict dds, advanced one pass small out, 37576 github, level 19 with dict copy, advanced one pass small out, 37567 github, level 19 with dict load, advanced one pass small out, 39613 -github, no source size, advanced one pass small out, 136335 +github, no source size, advanced one pass small out, 136332 github, no source size with dict, advanced one pass small out, 41148 -github, long distance mode, advanced one pass small out, 136335 -github, multithreaded, advanced one pass small out, 136335 -github, multithreaded long distance mode, advanced one pass small out, 136335 -github, small window log, advanced one pass small out, 136335 +github, long distance mode, advanced one pass small out, 136332 +github, multithreaded, advanced one pass small out, 136332 +github, multithreaded long distance mode, advanced one pass small out, 136332 +github, small window log, advanced one pass small out, 136332 github, small hash log, advanced one pass small out, 135590 github, small chain log, advanced one pass small out, 136341 github, explicit params, advanced one pass small out, 137727 -github, uncompressed literals, advanced one pass small out, 165915 -github, uncompressed literals optimal, advanced one pass small out, 157227 -github, huffman literals, advanced one pass small out, 142465 -github, multithreaded with advanced params, advanced one pass small out, 165915 -github.tar, level -5, advanced one pass small out, 46856 -github.tar, level -5 with dict, advanced one pass small out, 44571 -github.tar, level -3, advanced one pass small out, 43754 -github.tar, level -3 with dict, advanced one pass small out, 41447 -github.tar, level -1, advanced one pass small out, 42490 -github.tar, level -1 with dict, advanced one pass small out, 41131 -github.tar, level 0, advanced one pass small out, 38441 +github, uncompressed literals, advanced one pass small out, 165911 +github, uncompressed literals optimal, advanced one pass small out, 152667 +github, huffman literals, advanced one pass small out, 142365 +github, multithreaded with advanced params, advanced one pass small out, 165911 +github.tar, level -5, advanced one pass small out, 52115 +github.tar, level -5 with dict, advanced one pass small out, 50974 +github.tar, level -3, advanced one pass small out, 45678 +github.tar, level -3 with dict, advanced one pass small out, 44656 +github.tar, level -1, advanced one pass small out, 42560 +github.tar, level -1 with dict, advanced one pass small out, 41151 +github.tar, level 0, advanced one pass small out, 38831 github.tar, level 0 with dict, advanced one pass small out, 37995 github.tar, level 0 with dict dms, advanced one pass small out, 38003 github.tar, level 0 with dict dds, advanced one pass small out, 38003 github.tar, level 0 with dict copy, advanced one pass small out, 37995 github.tar, level 0 with dict load, advanced one pass small out, 37956 -github.tar, level 1, advanced one pass small out, 39265 -github.tar, level 1 with dict, advanced one pass small out, 38280 -github.tar, level 1 with dict dms, advanced one pass small out, 38290 -github.tar, level 1 with dict dds, advanced one pass small out, 38290 -github.tar, level 1 with dict copy, advanced one pass small out, 38280 -github.tar, level 1 with dict load, advanced one pass small out, 38729 -github.tar, level 3, advanced one pass small out, 38441 +github.tar, level 1, advanced one pass small out, 39200 +github.tar, level 1 with dict, advanced one pass small out, 38089 +github.tar, level 1 with dict dms, advanced one pass small out, 38294 +github.tar, level 1 with dict dds, advanced one pass small out, 38294 +github.tar, level 1 with dict copy, advanced one pass small out, 38089 +github.tar, level 1 with dict load, advanced one pass small out, 38364 +github.tar, level 3, advanced one pass small out, 38831 github.tar, level 3 with dict, advanced one pass small out, 37995 github.tar, level 3 with dict dms, advanced one pass small out, 38003 github.tar, level 3 with dict dds, advanced one pass small out, 38003 github.tar, level 3 with dict copy, advanced one pass small out, 37995 github.tar, level 3 with dict load, advanced one pass small out, 37956 -github.tar, level 4, advanced one pass small out, 38467 +github.tar, level 4, advanced one pass small out, 38893 github.tar, level 4 with dict, advanced one pass small out, 37948 github.tar, level 4 with dict dms, advanced one pass small out, 37954 github.tar, level 4 with dict dds, advanced one pass small out, 37954 github.tar, level 4 with dict copy, advanced one pass small out, 37948 github.tar, level 4 with dict load, advanced one pass small out, 37927 -github.tar, level 5 row 1, advanced one pass small out, 39788 -github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39365 -github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39233 -github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39715 -github.tar, level 5 row 1 with dict load, advanced one pass small out, 39209 -github.tar, level 5 row 2, advanced one pass small out, 39693 -github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39024 -github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39028 -github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39040 -github.tar, level 5 row 2 with dict load, advanced one pass small out, 39037 -github.tar, level 5, advanced one pass small out, 39693 -github.tar, level 5 with dict, advanced one pass small out, 39040 -github.tar, level 5 with dict dms, advanced one pass small out, 39024 -github.tar, level 5 with dict dds, advanced one pass small out, 39028 -github.tar, level 5 with dict copy, advanced one pass small out, 39040 -github.tar, level 5 with dict load, advanced one pass small out, 39037 -github.tar, level 6, advanced one pass small out, 39621 -github.tar, level 6 with dict, advanced one pass small out, 38622 -github.tar, level 6 with dict dms, advanced one pass small out, 38608 -github.tar, level 6 with dict dds, advanced one pass small out, 38610 -github.tar, level 6 with dict copy, advanced one pass small out, 38622 -github.tar, level 6 with dict load, advanced one pass small out, 38962 -github.tar, level 7 row 1, advanced one pass small out, 39206 -github.tar, level 7 row 1 with dict dms, advanced one pass small out, 37954 -github.tar, level 7 row 1 with dict dds, advanced one pass small out, 37954 -github.tar, level 7 row 1 with dict copy, advanced one pass small out, 38071 -github.tar, level 7 row 1 with dict load, advanced one pass small out, 38584 -github.tar, level 7 row 2, advanced one pass small out, 39213 -github.tar, level 7 row 2 with dict dms, advanced one pass small out, 37848 -github.tar, level 7 row 2 with dict dds, advanced one pass small out, 37867 -github.tar, level 7 row 2 with dict copy, advanced one pass small out, 37848 -github.tar, level 7 row 2 with dict load, advanced one pass small out, 38582 -github.tar, level 7, advanced one pass small out, 39213 -github.tar, level 7 with dict, advanced one pass small out, 37848 -github.tar, level 7 with dict dms, advanced one pass small out, 37848 -github.tar, level 7 with dict dds, advanced one pass small out, 37867 -github.tar, level 7 with dict copy, advanced one pass small out, 37848 -github.tar, level 7 with dict load, advanced one pass small out, 38582 -github.tar, level 9, advanced one pass small out, 36758 -github.tar, level 9 with dict, advanced one pass small out, 36457 -github.tar, level 9 with dict dms, advanced one pass small out, 36549 -github.tar, level 9 with dict dds, advanced one pass small out, 36637 -github.tar, level 9 with dict copy, advanced one pass small out, 36457 -github.tar, level 9 with dict load, advanced one pass small out, 36350 -github.tar, level 12 row 1, advanced one pass small out, 36435 +github.tar, level 5 row 1, advanced one pass small out, 39651 +github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39059 +github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39067 +github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39082 +github.tar, level 5 row 1 with dict load, advanced one pass small out, 38999 +github.tar, level 5 row 2, advanced one pass small out, 39701 +github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39365 +github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39233 +github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39715 +github.tar, level 5 row 2 with dict load, advanced one pass small out, 39158 +github.tar, level 5, advanced one pass small out, 39651 +github.tar, level 5 with dict, advanced one pass small out, 39082 +github.tar, level 5 with dict dms, advanced one pass small out, 39059 +github.tar, level 5 with dict dds, advanced one pass small out, 39067 +github.tar, level 5 with dict copy, advanced one pass small out, 39082 +github.tar, level 5 with dict load, advanced one pass small out, 38999 +github.tar, level 6, advanced one pass small out, 39282 +github.tar, level 6 with dict, advanced one pass small out, 38656 +github.tar, level 6 with dict dms, advanced one pass small out, 38636 +github.tar, level 6 with dict dds, advanced one pass small out, 38634 +github.tar, level 6 with dict copy, advanced one pass small out, 38656 +github.tar, level 6 with dict load, advanced one pass small out, 38648 +github.tar, level 7 row 1, advanced one pass small out, 38110 +github.tar, level 7 row 1 with dict dms, advanced one pass small out, 37858 +github.tar, level 7 row 1 with dict dds, advanced one pass small out, 37882 +github.tar, level 7 row 1 with dict copy, advanced one pass small out, 37865 +github.tar, level 7 row 1 with dict load, advanced one pass small out, 37436 +github.tar, level 7 row 2, advanced one pass small out, 38077 +github.tar, level 7 row 2 with dict dms, advanced one pass small out, 38012 +github.tar, level 7 row 2 with dict dds, advanced one pass small out, 38014 +github.tar, level 7 row 2 with dict copy, advanced one pass small out, 38101 +github.tar, level 7 row 2 with dict load, advanced one pass small out, 37402 +github.tar, level 7, advanced one pass small out, 38110 +github.tar, level 7 with dict, advanced one pass small out, 37865 +github.tar, level 7 with dict dms, advanced one pass small out, 37858 +github.tar, level 7 with dict dds, advanced one pass small out, 37882 +github.tar, level 7 with dict copy, advanced one pass small out, 37865 +github.tar, level 7 with dict load, advanced one pass small out, 37436 +github.tar, level 9, advanced one pass small out, 36760 +github.tar, level 9 with dict, advanced one pass small out, 36484 +github.tar, level 9 with dict dms, advanced one pass small out, 36567 +github.tar, level 9 with dict dds, advanced one pass small out, 36628 +github.tar, level 9 with dict copy, advanced one pass small out, 36484 +github.tar, level 9 with dict load, advanced one pass small out, 36401 +github.tar, level 11 row 1, advanced one pass small out, 36081 +github.tar, level 11 row 1 with dict dms, advanced one pass small out, 36963 +github.tar, level 11 row 1 with dict dds, advanced one pass small out, 36963 +github.tar, level 11 row 1 with dict copy, advanced one pass small out, 36557 +github.tar, level 11 row 1 with dict load, advanced one pass small out, 36434 +github.tar, level 11 row 2, advanced one pass small out, 36110 +github.tar, level 11 row 2 with dict dms, advanced one pass small out, 36963 +github.tar, level 11 row 2 with dict dds, advanced one pass small out, 36963 +github.tar, level 11 row 2 with dict copy, advanced one pass small out, 36557 +github.tar, level 11 row 2 with dict load, advanced one pass small out, 36459 +github.tar, level 12 row 1, advanced one pass small out, 36081 github.tar, level 12 row 1 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass small out, 36419 -github.tar, level 12 row 2, advanced one pass small out, 36435 +github.tar, level 12 row 1 with dict load, advanced one pass small out, 36434 +github.tar, level 12 row 2, advanced one pass small out, 36110 github.tar, level 12 row 2 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass small out, 36424 -github.tar, level 13, advanced one pass small out, 35621 -github.tar, level 13 with dict, advanced one pass small out, 38726 -github.tar, level 13 with dict dms, advanced one pass small out, 38903 -github.tar, level 13 with dict dds, advanced one pass small out, 38903 -github.tar, level 13 with dict copy, advanced one pass small out, 38726 -github.tar, level 13 with dict load, advanced one pass small out, 36372 -github.tar, level 16, advanced one pass small out, 40255 -github.tar, level 16 with dict, advanced one pass small out, 33639 -github.tar, level 16 with dict dms, advanced one pass small out, 33544 -github.tar, level 16 with dict dds, advanced one pass small out, 33544 -github.tar, level 16 with dict copy, advanced one pass small out, 33639 -github.tar, level 16 with dict load, advanced one pass small out, 39353 -github.tar, level 19, advanced one pass small out, 32837 -github.tar, level 19 with dict, advanced one pass small out, 32895 -github.tar, level 19 with dict dms, advanced one pass small out, 32672 -github.tar, level 19 with dict dds, advanced one pass small out, 32672 -github.tar, level 19 with dict copy, advanced one pass small out, 32895 -github.tar, level 19 with dict load, advanced one pass small out, 32676 -github.tar, no source size, advanced one pass small out, 38441 +github.tar, level 12 row 2 with dict load, advanced one pass small out, 36459 +github.tar, level 13, advanced one pass small out, 35501 +github.tar, level 13 with dict, advanced one pass small out, 37130 +github.tar, level 13 with dict dms, advanced one pass small out, 37220 +github.tar, level 13 with dict dds, advanced one pass small out, 37220 +github.tar, level 13 with dict copy, advanced one pass small out, 37130 +github.tar, level 13 with dict load, advanced one pass small out, 36010 +github.tar, level 16, advanced one pass small out, 40466 +github.tar, level 16 with dict, advanced one pass small out, 33374 +github.tar, level 16 with dict dms, advanced one pass small out, 33206 +github.tar, level 16 with dict dds, advanced one pass small out, 33206 +github.tar, level 16 with dict copy, advanced one pass small out, 33374 +github.tar, level 16 with dict load, advanced one pass small out, 39081 +github.tar, level 19, advanced one pass small out, 32276 +github.tar, level 19 with dict, advanced one pass small out, 32712 +github.tar, level 19 with dict dms, advanced one pass small out, 32555 +github.tar, level 19 with dict dds, advanced one pass small out, 32555 +github.tar, level 19 with dict copy, advanced one pass small out, 32712 +github.tar, level 19 with dict load, advanced one pass small out, 32479 +github.tar, no source size, advanced one pass small out, 38831 github.tar, no source size with dict, advanced one pass small out, 37995 -github.tar, long distance mode, advanced one pass small out, 39757 -github.tar, multithreaded, advanced one pass small out, 38441 -github.tar, multithreaded long distance mode, advanced one pass small out, 39726 +github.tar, long distance mode, advanced one pass small out, 40252 +github.tar, multithreaded, advanced one pass small out, 38831 +github.tar, multithreaded long distance mode, advanced one pass small out, 40232 github.tar, small window log, advanced one pass small out, 198540 github.tar, small hash log, advanced one pass small out, 129870 github.tar, small chain log, advanced one pass small out, 41669 -github.tar, explicit params, advanced one pass small out, 41227 -github.tar, uncompressed literals, advanced one pass small out, 41122 -github.tar, uncompressed literals optimal, advanced one pass small out, 35388 -github.tar, huffman literals, advanced one pass small out, 38777 -github.tar, multithreaded with advanced params, advanced one pass small out, 41122 -silesia, level -5, advanced streaming, 6882505 -silesia, level -3, advanced streaming, 6568376 -silesia, level -1, advanced streaming, 6183403 -silesia, level 0, advanced streaming, 4849552 -silesia, level 1, advanced streaming, 5314162 -silesia, level 3, advanced streaming, 4849552 -silesia, level 4, advanced streaming, 4786970 -silesia, level 5 row 1, advanced streaming, 4710236 -silesia, level 5 row 2, advanced streaming, 4707794 -silesia, level 5, advanced streaming, 4707794 -silesia, level 6, advanced streaming, 4666383 -silesia, level 7 row 1, advanced streaming, 4596296 -silesia, level 7 row 2, advanced streaming, 4603381 -silesia, level 7, advanced streaming, 4603381 -silesia, level 9, advanced streaming, 4546001 -silesia, level 12 row 1, advanced streaming, 4519288 -silesia, level 12 row 2, advanced streaming, 4521397 -silesia, level 13, advanced streaming, 4482135 -silesia, level 16, advanced streaming, 4360251 -silesia, level 19, advanced streaming, 4283237 -silesia, no source size, advanced streaming, 4849516 -silesia, long distance mode, advanced streaming, 4840738 -silesia, multithreaded, advanced streaming, 4849552 -silesia, multithreaded long distance mode, advanced streaming, 4840758 -silesia, small window log, advanced streaming, 7112062 +github.tar, explicit params, advanced one pass small out, 41385 +github.tar, uncompressed literals, advanced one pass small out, 41525 +github.tar, uncompressed literals optimal, advanced one pass small out, 35397 +github.tar, huffman literals, advanced one pass small out, 38853 +github.tar, multithreaded with advanced params, advanced one pass small out, 41525 +silesia, level -5, advanced streaming, 6854744 +silesia, level -3, advanced streaming, 6503319 +silesia, level -1, advanced streaming, 6172207 +silesia, level 0, advanced streaming, 4842075 +silesia, level 1, advanced streaming, 5306388 +silesia, level 3, advanced streaming, 4842075 +silesia, level 4, advanced streaming, 4779186 +silesia, level 5 row 1, advanced streaming, 4666323 +silesia, level 5 row 2, advanced streaming, 4670136 +silesia, level 5, advanced streaming, 4666323 +silesia, level 6, advanced streaming, 4603066 +silesia, level 7 row 1, advanced streaming, 4566984 +silesia, level 7 row 2, advanced streaming, 4564868 +silesia, level 7, advanced streaming, 4566984 +silesia, level 9, advanced streaming, 4543018 +silesia, level 11 row 1, advanced streaming, 4505046 +silesia, level 11 row 2, advanced streaming, 4503116 +silesia, level 12 row 1, advanced streaming, 4505046 +silesia, level 12 row 2, advanced streaming, 4503116 +silesia, level 13, advanced streaming, 4493990 +silesia, level 16, advanced streaming, 4360041 +silesia, level 19, advanced streaming, 4296055 +silesia, no source size, advanced streaming, 4842039 +silesia, long distance mode, advanced streaming, 4833710 +silesia, multithreaded, advanced streaming, 4842075 +silesia, multithreaded long distance mode, advanced streaming, 4833737 +silesia, small window log, advanced streaming, 7111103 silesia, small hash log, advanced streaming, 6526141 silesia, small chain log, advanced streaming, 4912197 -silesia, explicit params, advanced streaming, 4795887 -silesia, uncompressed literals, advanced streaming, 5127982 -silesia, uncompressed literals optimal, advanced streaming, 4317896 -silesia, huffman literals, advanced streaming, 5331168 -silesia, multithreaded with advanced params, advanced streaming, 5127982 -silesia.tar, level -5, advanced streaming, 6982759 -silesia.tar, level -3, advanced streaming, 6641283 -silesia.tar, level -1, advanced streaming, 6190795 -silesia.tar, level 0, advanced streaming, 4861427 -silesia.tar, level 1, advanced streaming, 5336939 -silesia.tar, level 3, advanced streaming, 4861427 -silesia.tar, level 4, advanced streaming, 4799630 -silesia.tar, level 5 row 1, advanced streaming, 4722329 -silesia.tar, level 5 row 2, advanced streaming, 4719261 -silesia.tar, level 5, advanced streaming, 4719261 -silesia.tar, level 6, advanced streaming, 4677729 -silesia.tar, level 7 row 1, advanced streaming, 4606715 -silesia.tar, level 7 row 2, advanced streaming, 4613544 -silesia.tar, level 7, advanced streaming, 4613544 -silesia.tar, level 9, advanced streaming, 4555432 -silesia.tar, level 12 row 1, advanced streaming, 4529459 -silesia.tar, level 12 row 2, advanced streaming, 4530258 -silesia.tar, level 13, advanced streaming, 4491765 -silesia.tar, level 16, advanced streaming, 4356834 -silesia.tar, level 19, advanced streaming, 4264392 -silesia.tar, no source size, advanced streaming, 4861423 -silesia.tar, long distance mode, advanced streaming, 4847754 -silesia.tar, multithreaded, advanced streaming, 4861508 -silesia.tar, multithreaded long distance mode, advanced streaming, 4853222 -silesia.tar, small window log, advanced streaming, 7118769 -silesia.tar, small hash log, advanced streaming, 6529235 +silesia, explicit params, advanced streaming, 4795452 +silesia, uncompressed literals, advanced streaming, 5120566 +silesia, uncompressed literals optimal, advanced streaming, 4319518 +silesia, huffman literals, advanced streaming, 5321370 +silesia, multithreaded with advanced params, advanced streaming, 5120566 +silesia.tar, level -5, advanced streaming, 6856523 +silesia.tar, level -3, advanced streaming, 6505954 +silesia.tar, level -1, advanced streaming, 6179056 +silesia.tar, level 0, advanced streaming, 4859271 +silesia.tar, level 1, advanced streaming, 5327708 +silesia.tar, level 3, advanced streaming, 4859271 +silesia.tar, level 4, advanced streaming, 4797470 +silesia.tar, level 5 row 1, advanced streaming, 4677748 +silesia.tar, level 5 row 2, advanced streaming, 4682169 +silesia.tar, level 5, advanced streaming, 4677748 +silesia.tar, level 6, advanced streaming, 4613246 +silesia.tar, level 7 row 1, advanced streaming, 4576664 +silesia.tar, level 7 row 2, advanced streaming, 4575394 +silesia.tar, level 7, advanced streaming, 4576664 +silesia.tar, level 9, advanced streaming, 4552900 +silesia.tar, level 11 row 1, advanced streaming, 4514433 +silesia.tar, level 11 row 2, advanced streaming, 4513604 +silesia.tar, level 12 row 1, advanced streaming, 4514049 +silesia.tar, level 12 row 2, advanced streaming, 4513797 +silesia.tar, level 13, advanced streaming, 4502956 +silesia.tar, level 16, advanced streaming, 4360546 +silesia.tar, level 19, advanced streaming, 4265911 +silesia.tar, no source size, advanced streaming, 4859267 +silesia.tar, long distance mode, advanced streaming, 4840452 +silesia.tar, multithreaded, advanced streaming, 4854160 +silesia.tar, multithreaded long distance mode, advanced streaming, 4845741 +silesia.tar, small window log, advanced streaming, 7117559 +silesia.tar, small hash log, advanced streaming, 6529209 silesia.tar, small chain log, advanced streaming, 4917021 -silesia.tar, explicit params, advanced streaming, 4807401 -silesia.tar, uncompressed literals, advanced streaming, 5129461 -silesia.tar, uncompressed literals optimal, advanced streaming, 4307400 -silesia.tar, huffman literals, advanced streaming, 5352360 -silesia.tar, multithreaded with advanced params, advanced streaming, 5129555 -github, level -5, advanced streaming, 205285 +silesia.tar, explicit params, advanced streaming, 4806873 +silesia.tar, uncompressed literals, advanced streaming, 5127423 +silesia.tar, uncompressed literals optimal, advanced streaming, 4310141 +silesia.tar, huffman literals, advanced streaming, 5341712 +silesia.tar, multithreaded with advanced params, advanced streaming, 5122567 +github, level -5, advanced streaming, 204407 github, level -5 with dict, advanced streaming, 46718 -github, level -3, advanced streaming, 190643 +github, level -3, advanced streaming, 193253 github, level -3 with dict, advanced streaming, 45395 -github, level -1, advanced streaming, 175568 +github, level -1, advanced streaming, 175468 github, level -1 with dict, advanced streaming, 43170 -github, level 0, advanced streaming, 136335 +github, level 0, advanced streaming, 136332 github, level 0 with dict, advanced streaming, 41148 github, level 0 with dict dms, advanced streaming, 41148 github, level 0 with dict dds, advanced streaming, 41148 github, level 0 with dict copy, advanced streaming, 41124 github, level 0 with dict load, advanced streaming, 42252 -github, level 1, advanced streaming, 142465 +github, level 1, advanced streaming, 142365 github, level 1 with dict, advanced streaming, 41682 github, level 1 with dict dms, advanced streaming, 41682 github, level 1 with dict dds, advanced streaming, 41682 -github, level 1 with dict copy, advanced streaming, 41674 -github, level 1 with dict load, advanced streaming, 43755 -github, level 3, advanced streaming, 136335 +github, level 1 with dict copy, advanced streaming, 41698 +github, level 1 with dict load, advanced streaming, 43814 +github, level 3, advanced streaming, 136332 github, level 3 with dict, advanced streaming, 41148 github, level 3 with dict dms, advanced streaming, 41148 github, level 3 with dict dds, advanced streaming, 41148 @@ -910,16 +962,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced streaming, 41251 github, level 4 with dict copy, advanced streaming, 41216 github, level 4 with dict load, advanced streaming, 41159 -github, level 5 row 1, advanced streaming, 135121 -github, level 5 row 1 with dict dms, advanced streaming, 38938 -github, level 5 row 1 with dict dds, advanced streaming, 38732 -github, level 5 row 1 with dict copy, advanced streaming, 38934 -github, level 5 row 1 with dict load, advanced streaming, 40725 -github, level 5 row 2, advanced streaming, 134584 -github, level 5 row 2 with dict dms, advanced streaming, 38758 -github, level 5 row 2 with dict dds, advanced streaming, 38728 -github, level 5 row 2 with dict copy, advanced streaming, 38759 -github, level 5 row 2 with dict load, advanced streaming, 41518 +github, level 5 row 1, advanced streaming, 134584 +github, level 5 row 1 with dict dms, advanced streaming, 38758 +github, level 5 row 1 with dict dds, advanced streaming, 38728 +github, level 5 row 1 with dict copy, advanced streaming, 38759 +github, level 5 row 1 with dict load, advanced streaming, 41518 +github, level 5 row 2, advanced streaming, 135121 +github, level 5 row 2 with dict dms, advanced streaming, 38938 +github, level 5 row 2 with dict dds, advanced streaming, 38732 +github, level 5 row 2 with dict copy, advanced streaming, 38934 +github, level 5 row 2 with dict load, advanced streaming, 40725 github, level 5, advanced streaming, 135121 github, level 5 with dict, advanced streaming, 38758 github, level 5 with dict dms, advanced streaming, 38758 @@ -929,234 +981,254 @@ github, level 5 with dict load, advanced github, level 6, advanced streaming, 135122 github, level 6 with dict, advanced streaming, 38671 github, level 6 with dict dms, advanced streaming, 38671 -github, level 6 with dict dds, advanced streaming, 38630 +github, level 6 with dict dds, advanced streaming, 38636 github, level 6 with dict copy, advanced streaming, 38669 github, level 6 with dict load, advanced streaming, 40695 -github, level 7 row 1, advanced streaming, 135122 -github, level 7 row 1 with dict dms, advanced streaming, 38771 -github, level 7 row 1 with dict dds, advanced streaming, 38771 -github, level 7 row 1 with dict copy, advanced streaming, 38745 -github, level 7 row 1 with dict load, advanced streaming, 40695 -github, level 7 row 2, advanced streaming, 134584 -github, level 7 row 2 with dict dms, advanced streaming, 38758 -github, level 7 row 2 with dict dds, advanced streaming, 38747 -github, level 7 row 2 with dict copy, advanced streaming, 38755 -github, level 7 row 2 with dict load, advanced streaming, 41030 +github, level 7 row 1, advanced streaming, 134584 +github, level 7 row 1 with dict dms, advanced streaming, 38758 +github, level 7 row 1 with dict dds, advanced streaming, 38745 +github, level 7 row 1 with dict copy, advanced streaming, 38755 +github, level 7 row 1 with dict load, advanced streaming, 43154 +github, level 7 row 2, advanced streaming, 135122 +github, level 7 row 2 with dict dms, advanced streaming, 38860 +github, level 7 row 2 with dict dds, advanced streaming, 38766 +github, level 7 row 2 with dict copy, advanced streaming, 38834 +github, level 7 row 2 with dict load, advanced streaming, 40695 github, level 7, advanced streaming, 135122 github, level 7 with dict, advanced streaming, 38758 github, level 7 with dict dms, advanced streaming, 38758 -github, level 7 with dict dds, advanced streaming, 38747 +github, level 7 with dict dds, advanced streaming, 38745 github, level 7 with dict copy, advanced streaming, 38755 github, level 7 with dict load, advanced streaming, 40695 github, level 9, advanced streaming, 135122 github, level 9 with dict, advanced streaming, 39437 github, level 9 with dict dms, advanced streaming, 39437 -github, level 9 with dict dds, advanced streaming, 39338 +github, level 9 with dict dds, advanced streaming, 39393 github, level 9 with dict copy, advanced streaming, 39398 github, level 9 with dict load, advanced streaming, 41710 -github, level 12 row 1, advanced streaming, 134180 +github, level 11 row 1, advanced streaming, 135367 +github, level 11 row 1 with dict dms, advanced streaming, 39671 +github, level 11 row 1 with dict dds, advanced streaming, 39671 +github, level 11 row 1 with dict copy, advanced streaming, 39651 +github, level 11 row 1 with dict load, advanced streaming, 41360 +github, level 11 row 2, advanced streaming, 135367 +github, level 11 row 2 with dict dms, advanced streaming, 39671 +github, level 11 row 2 with dict dds, advanced streaming, 39671 +github, level 11 row 2 with dict copy, advanced streaming, 39651 +github, level 11 row 2 with dict load, advanced streaming, 41360 +github, level 12 row 1, advanced streaming, 134402 github, level 12 row 1 with dict dms, advanced streaming, 39677 github, level 12 row 1 with dict dds, advanced streaming, 39677 github, level 12 row 1 with dict copy, advanced streaming, 39677 github, level 12 row 1 with dict load, advanced streaming, 41166 -github, level 12 row 2, advanced streaming, 134180 +github, level 12 row 2, advanced streaming, 134402 github, level 12 row 2 with dict dms, advanced streaming, 39677 github, level 12 row 2 with dict dds, advanced streaming, 39677 github, level 12 row 2 with dict copy, advanced streaming, 39677 github, level 12 row 2 with dict load, advanced streaming, 41166 -github, level 13, advanced streaming, 134064 -github, level 13 with dict, advanced streaming, 39743 -github, level 13 with dict dms, advanced streaming, 39743 -github, level 13 with dict dds, advanced streaming, 39743 +github, level 13, advanced streaming, 132878 +github, level 13 with dict, advanced streaming, 39900 +github, level 13 with dict dms, advanced streaming, 39900 +github, level 13 with dict dds, advanced streaming, 39900 github, level 13 with dict copy, advanced streaming, 39948 -github, level 13 with dict load, advanced streaming, 42626 -github, level 16, advanced streaming, 134064 +github, level 13 with dict load, advanced streaming, 42624 +github, level 16, advanced streaming, 133209 github, level 16 with dict, advanced streaming, 37577 github, level 16 with dict dms, advanced streaming, 37577 github, level 16 with dict dds, advanced streaming, 37577 github, level 16 with dict copy, advanced streaming, 37568 -github, level 16 with dict load, advanced streaming, 42340 -github, level 19, advanced streaming, 134064 +github, level 16 with dict load, advanced streaming, 42338 +github, level 19, advanced streaming, 132879 github, level 19 with dict, advanced streaming, 37576 github, level 19 with dict dms, advanced streaming, 37576 github, level 19 with dict dds, advanced streaming, 37576 github, level 19 with dict copy, advanced streaming, 37567 github, level 19 with dict load, advanced streaming, 39613 -github, no source size, advanced streaming, 136335 +github, no source size, advanced streaming, 136332 github, no source size with dict, advanced streaming, 41148 -github, long distance mode, advanced streaming, 136335 -github, multithreaded, advanced streaming, 136335 -github, multithreaded long distance mode, advanced streaming, 136335 -github, small window log, advanced streaming, 136335 +github, long distance mode, advanced streaming, 136332 +github, multithreaded, advanced streaming, 136332 +github, multithreaded long distance mode, advanced streaming, 136332 +github, small window log, advanced streaming, 136332 github, small hash log, advanced streaming, 135590 github, small chain log, advanced streaming, 136341 github, explicit params, advanced streaming, 137727 -github, uncompressed literals, advanced streaming, 165915 -github, uncompressed literals optimal, advanced streaming, 157227 -github, huffman literals, advanced streaming, 142465 -github, multithreaded with advanced params, advanced streaming, 165915 -github.tar, level -5, advanced streaming, 46747 -github.tar, level -5 with dict, advanced streaming, 44440 -github.tar, level -3, advanced streaming, 43537 -github.tar, level -3 with dict, advanced streaming, 41112 -github.tar, level -1, advanced streaming, 42465 -github.tar, level -1 with dict, advanced streaming, 41196 -github.tar, level 0, advanced streaming, 38441 +github, uncompressed literals, advanced streaming, 165911 +github, uncompressed literals optimal, advanced streaming, 152667 +github, huffman literals, advanced streaming, 142365 +github, multithreaded with advanced params, advanced streaming, 165911 +github.tar, level -5, advanced streaming, 52152 +github.tar, level -5 with dict, advanced streaming, 51045 +github.tar, level -3, advanced streaming, 45678 +github.tar, level -3 with dict, advanced streaming, 44656 +github.tar, level -1, advanced streaming, 42560 +github.tar, level -1 with dict, advanced streaming, 41151 +github.tar, level 0, advanced streaming, 38831 github.tar, level 0 with dict, advanced streaming, 37995 github.tar, level 0 with dict dms, advanced streaming, 38003 github.tar, level 0 with dict dds, advanced streaming, 38003 github.tar, level 0 with dict copy, advanced streaming, 37995 github.tar, level 0 with dict load, advanced streaming, 37956 -github.tar, level 1, advanced streaming, 39342 -github.tar, level 1 with dict, advanced streaming, 38293 -github.tar, level 1 with dict dms, advanced streaming, 38303 -github.tar, level 1 with dict dds, advanced streaming, 38303 -github.tar, level 1 with dict copy, advanced streaming, 38293 -github.tar, level 1 with dict load, advanced streaming, 38766 -github.tar, level 3, advanced streaming, 38441 +github.tar, level 1, advanced streaming, 39200 +github.tar, level 1 with dict, advanced streaming, 38089 +github.tar, level 1 with dict dms, advanced streaming, 38294 +github.tar, level 1 with dict dds, advanced streaming, 38294 +github.tar, level 1 with dict copy, advanced streaming, 38089 +github.tar, level 1 with dict load, advanced streaming, 38364 +github.tar, level 3, advanced streaming, 38831 github.tar, level 3 with dict, advanced streaming, 37995 github.tar, level 3 with dict dms, advanced streaming, 38003 github.tar, level 3 with dict dds, advanced streaming, 38003 github.tar, level 3 with dict copy, advanced streaming, 37995 github.tar, level 3 with dict load, advanced streaming, 37956 -github.tar, level 4, advanced streaming, 38467 +github.tar, level 4, advanced streaming, 38893 github.tar, level 4 with dict, advanced streaming, 37948 github.tar, level 4 with dict dms, advanced streaming, 37954 github.tar, level 4 with dict dds, advanced streaming, 37954 github.tar, level 4 with dict copy, advanced streaming, 37948 github.tar, level 4 with dict load, advanced streaming, 37927 -github.tar, level 5 row 1, advanced streaming, 39788 -github.tar, level 5 row 1 with dict dms, advanced streaming, 39365 -github.tar, level 5 row 1 with dict dds, advanced streaming, 39233 -github.tar, level 5 row 1 with dict copy, advanced streaming, 39715 -github.tar, level 5 row 1 with dict load, advanced streaming, 39209 -github.tar, level 5 row 2, advanced streaming, 39693 -github.tar, level 5 row 2 with dict dms, advanced streaming, 39024 -github.tar, level 5 row 2 with dict dds, advanced streaming, 39028 -github.tar, level 5 row 2 with dict copy, advanced streaming, 39040 -github.tar, level 5 row 2 with dict load, advanced streaming, 39037 -github.tar, level 5, advanced streaming, 39693 -github.tar, level 5 with dict, advanced streaming, 39040 -github.tar, level 5 with dict dms, advanced streaming, 39024 -github.tar, level 5 with dict dds, advanced streaming, 39028 -github.tar, level 5 with dict copy, advanced streaming, 39040 -github.tar, level 5 with dict load, advanced streaming, 39037 -github.tar, level 6, advanced streaming, 39621 -github.tar, level 6 with dict, advanced streaming, 38622 -github.tar, level 6 with dict dms, advanced streaming, 38608 -github.tar, level 6 with dict dds, advanced streaming, 38610 -github.tar, level 6 with dict copy, advanced streaming, 38622 -github.tar, level 6 with dict load, advanced streaming, 38962 -github.tar, level 7 row 1, advanced streaming, 39206 -github.tar, level 7 row 1 with dict dms, advanced streaming, 37954 -github.tar, level 7 row 1 with dict dds, advanced streaming, 37954 -github.tar, level 7 row 1 with dict copy, advanced streaming, 38071 -github.tar, level 7 row 1 with dict load, advanced streaming, 38584 -github.tar, level 7 row 2, advanced streaming, 39213 -github.tar, level 7 row 2 with dict dms, advanced streaming, 37848 -github.tar, level 7 row 2 with dict dds, advanced streaming, 37867 -github.tar, level 7 row 2 with dict copy, advanced streaming, 37848 -github.tar, level 7 row 2 with dict load, advanced streaming, 38582 -github.tar, level 7, advanced streaming, 39213 -github.tar, level 7 with dict, advanced streaming, 37848 -github.tar, level 7 with dict dms, advanced streaming, 37848 -github.tar, level 7 with dict dds, advanced streaming, 37867 -github.tar, level 7 with dict copy, advanced streaming, 37848 -github.tar, level 7 with dict load, advanced streaming, 38582 -github.tar, level 9, advanced streaming, 36758 -github.tar, level 9 with dict, advanced streaming, 36457 -github.tar, level 9 with dict dms, advanced streaming, 36549 -github.tar, level 9 with dict dds, advanced streaming, 36637 -github.tar, level 9 with dict copy, advanced streaming, 36457 -github.tar, level 9 with dict load, advanced streaming, 36350 -github.tar, level 12 row 1, advanced streaming, 36435 +github.tar, level 5 row 1, advanced streaming, 39651 +github.tar, level 5 row 1 with dict dms, advanced streaming, 39059 +github.tar, level 5 row 1 with dict dds, advanced streaming, 39067 +github.tar, level 5 row 1 with dict copy, advanced streaming, 39082 +github.tar, level 5 row 1 with dict load, advanced streaming, 38999 +github.tar, level 5 row 2, advanced streaming, 39701 +github.tar, level 5 row 2 with dict dms, advanced streaming, 39365 +github.tar, level 5 row 2 with dict dds, advanced streaming, 39233 +github.tar, level 5 row 2 with dict copy, advanced streaming, 39715 +github.tar, level 5 row 2 with dict load, advanced streaming, 39158 +github.tar, level 5, advanced streaming, 39651 +github.tar, level 5 with dict, advanced streaming, 39082 +github.tar, level 5 with dict dms, advanced streaming, 39059 +github.tar, level 5 with dict dds, advanced streaming, 39067 +github.tar, level 5 with dict copy, advanced streaming, 39082 +github.tar, level 5 with dict load, advanced streaming, 38999 +github.tar, level 6, advanced streaming, 39282 +github.tar, level 6 with dict, advanced streaming, 38656 +github.tar, level 6 with dict dms, advanced streaming, 38636 +github.tar, level 6 with dict dds, advanced streaming, 38634 +github.tar, level 6 with dict copy, advanced streaming, 38656 +github.tar, level 6 with dict load, advanced streaming, 38648 +github.tar, level 7 row 1, advanced streaming, 38110 +github.tar, level 7 row 1 with dict dms, advanced streaming, 37858 +github.tar, level 7 row 1 with dict dds, advanced streaming, 37882 +github.tar, level 7 row 1 with dict copy, advanced streaming, 37865 +github.tar, level 7 row 1 with dict load, advanced streaming, 37436 +github.tar, level 7 row 2, advanced streaming, 38077 +github.tar, level 7 row 2 with dict dms, advanced streaming, 38012 +github.tar, level 7 row 2 with dict dds, advanced streaming, 38014 +github.tar, level 7 row 2 with dict copy, advanced streaming, 38101 +github.tar, level 7 row 2 with dict load, advanced streaming, 37402 +github.tar, level 7, advanced streaming, 38110 +github.tar, level 7 with dict, advanced streaming, 37865 +github.tar, level 7 with dict dms, advanced streaming, 37858 +github.tar, level 7 with dict dds, advanced streaming, 37882 +github.tar, level 7 with dict copy, advanced streaming, 37865 +github.tar, level 7 with dict load, advanced streaming, 37436 +github.tar, level 9, advanced streaming, 36760 +github.tar, level 9 with dict, advanced streaming, 36484 +github.tar, level 9 with dict dms, advanced streaming, 36567 +github.tar, level 9 with dict dds, advanced streaming, 36628 +github.tar, level 9 with dict copy, advanced streaming, 36484 +github.tar, level 9 with dict load, advanced streaming, 36401 +github.tar, level 11 row 1, advanced streaming, 36081 +github.tar, level 11 row 1 with dict dms, advanced streaming, 36963 +github.tar, level 11 row 1 with dict dds, advanced streaming, 36963 +github.tar, level 11 row 1 with dict copy, advanced streaming, 36557 +github.tar, level 11 row 1 with dict load, advanced streaming, 36434 +github.tar, level 11 row 2, advanced streaming, 36110 +github.tar, level 11 row 2 with dict dms, advanced streaming, 36963 +github.tar, level 11 row 2 with dict dds, advanced streaming, 36963 +github.tar, level 11 row 2 with dict copy, advanced streaming, 36557 +github.tar, level 11 row 2 with dict load, advanced streaming, 36459 +github.tar, level 12 row 1, advanced streaming, 36081 github.tar, level 12 row 1 with dict dms, advanced streaming, 36986 github.tar, level 12 row 1 with dict dds, advanced streaming, 36986 github.tar, level 12 row 1 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 1 with dict load, advanced streaming, 36419 -github.tar, level 12 row 2, advanced streaming, 36435 +github.tar, level 12 row 1 with dict load, advanced streaming, 36434 +github.tar, level 12 row 2, advanced streaming, 36110 github.tar, level 12 row 2 with dict dms, advanced streaming, 36986 github.tar, level 12 row 2 with dict dds, advanced streaming, 36986 github.tar, level 12 row 2 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 2 with dict load, advanced streaming, 36424 -github.tar, level 13, advanced streaming, 35621 -github.tar, level 13 with dict, advanced streaming, 38726 -github.tar, level 13 with dict dms, advanced streaming, 38903 -github.tar, level 13 with dict dds, advanced streaming, 38903 -github.tar, level 13 with dict copy, advanced streaming, 38726 -github.tar, level 13 with dict load, advanced streaming, 36372 -github.tar, level 16, advanced streaming, 40255 -github.tar, level 16 with dict, advanced streaming, 33639 -github.tar, level 16 with dict dms, advanced streaming, 33544 -github.tar, level 16 with dict dds, advanced streaming, 33544 -github.tar, level 16 with dict copy, advanced streaming, 33639 -github.tar, level 16 with dict load, advanced streaming, 39353 -github.tar, level 19, advanced streaming, 32837 -github.tar, level 19 with dict, advanced streaming, 32895 -github.tar, level 19 with dict dms, advanced streaming, 32672 -github.tar, level 19 with dict dds, advanced streaming, 32672 -github.tar, level 19 with dict copy, advanced streaming, 32895 -github.tar, level 19 with dict load, advanced streaming, 32676 -github.tar, no source size, advanced streaming, 38438 +github.tar, level 12 row 2 with dict load, advanced streaming, 36459 +github.tar, level 13, advanced streaming, 35501 +github.tar, level 13 with dict, advanced streaming, 37130 +github.tar, level 13 with dict dms, advanced streaming, 37220 +github.tar, level 13 with dict dds, advanced streaming, 37220 +github.tar, level 13 with dict copy, advanced streaming, 37130 +github.tar, level 13 with dict load, advanced streaming, 36010 +github.tar, level 16, advanced streaming, 40466 +github.tar, level 16 with dict, advanced streaming, 33374 +github.tar, level 16 with dict dms, advanced streaming, 33206 +github.tar, level 16 with dict dds, advanced streaming, 33206 +github.tar, level 16 with dict copy, advanced streaming, 33374 +github.tar, level 16 with dict load, advanced streaming, 39081 +github.tar, level 19, advanced streaming, 32276 +github.tar, level 19 with dict, advanced streaming, 32712 +github.tar, level 19 with dict dms, advanced streaming, 32555 +github.tar, level 19 with dict dds, advanced streaming, 32555 +github.tar, level 19 with dict copy, advanced streaming, 32712 +github.tar, level 19 with dict load, advanced streaming, 32479 +github.tar, no source size, advanced streaming, 38828 github.tar, no source size with dict, advanced streaming, 38000 -github.tar, long distance mode, advanced streaming, 39757 -github.tar, multithreaded, advanced streaming, 38441 -github.tar, multithreaded long distance mode, advanced streaming, 39726 +github.tar, long distance mode, advanced streaming, 40252 +github.tar, multithreaded, advanced streaming, 38831 +github.tar, multithreaded long distance mode, advanced streaming, 40232 github.tar, small window log, advanced streaming, 199558 github.tar, small hash log, advanced streaming, 129870 github.tar, small chain log, advanced streaming, 41669 -github.tar, explicit params, advanced streaming, 41227 -github.tar, uncompressed literals, advanced streaming, 41122 -github.tar, uncompressed literals optimal, advanced streaming, 35388 -github.tar, huffman literals, advanced streaming, 38800 -github.tar, multithreaded with advanced params, advanced streaming, 41122 -silesia, level -5, old streaming, 6882505 -silesia, level -3, old streaming, 6568376 -silesia, level -1, old streaming, 6183403 -silesia, level 0, old streaming, 4849552 -silesia, level 1, old streaming, 5314162 -silesia, level 3, old streaming, 4849552 -silesia, level 4, old streaming, 4786970 -silesia, level 5, old streaming, 4707794 -silesia, level 6, old streaming, 4666383 -silesia, level 7, old streaming, 4603381 -silesia, level 9, old streaming, 4546001 -silesia, level 13, old streaming, 4482135 -silesia, level 16, old streaming, 4360251 -silesia, level 19, old streaming, 4283237 -silesia, no source size, old streaming, 4849516 -silesia, uncompressed literals, old streaming, 4849552 -silesia, uncompressed literals optimal, old streaming, 4283237 -silesia, huffman literals, old streaming, 6183403 -silesia.tar, level -5, old streaming, 6982759 -silesia.tar, level -3, old streaming, 6641283 -silesia.tar, level -1, old streaming, 6190795 -silesia.tar, level 0, old streaming, 4861427 -silesia.tar, level 1, old streaming, 5336939 -silesia.tar, level 3, old streaming, 4861427 -silesia.tar, level 4, old streaming, 4799630 -silesia.tar, level 5, old streaming, 4719261 -silesia.tar, level 6, old streaming, 4677729 -silesia.tar, level 7, old streaming, 4613544 -silesia.tar, level 9, old streaming, 4555432 -silesia.tar, level 13, old streaming, 4491765 -silesia.tar, level 16, old streaming, 4356834 -silesia.tar, level 19, old streaming, 4264392 -silesia.tar, no source size, old streaming, 4861423 -silesia.tar, uncompressed literals, old streaming, 4861427 -silesia.tar, uncompressed literals optimal, old streaming, 4264392 -silesia.tar, huffman literals, old streaming, 6190795 -github, level -5, old streaming, 205285 +github.tar, explicit params, advanced streaming, 41385 +github.tar, uncompressed literals, advanced streaming, 41525 +github.tar, uncompressed literals optimal, advanced streaming, 35397 +github.tar, huffman literals, advanced streaming, 38853 +github.tar, multithreaded with advanced params, advanced streaming, 41525 +silesia, level -5, old streaming, 6854744 +silesia, level -3, old streaming, 6503319 +silesia, level -1, old streaming, 6172207 +silesia, level 0, old streaming, 4842075 +silesia, level 1, old streaming, 5306388 +silesia, level 3, old streaming, 4842075 +silesia, level 4, old streaming, 4779186 +silesia, level 5, old streaming, 4666323 +silesia, level 6, old streaming, 4603066 +silesia, level 7, old streaming, 4566984 +silesia, level 9, old streaming, 4543018 +silesia, level 13, old streaming, 4493990 +silesia, level 16, old streaming, 4360041 +silesia, level 19, old streaming, 4296055 +silesia, no source size, old streaming, 4842039 +silesia, uncompressed literals, old streaming, 4842075 +silesia, uncompressed literals optimal, old streaming, 4296055 +silesia, huffman literals, old streaming, 6172207 +silesia.tar, level -5, old streaming, 6856523 +silesia.tar, level -3, old streaming, 6505954 +silesia.tar, level -1, old streaming, 6179056 +silesia.tar, level 0, old streaming, 4859271 +silesia.tar, level 1, old streaming, 5327708 +silesia.tar, level 3, old streaming, 4859271 +silesia.tar, level 4, old streaming, 4797470 +silesia.tar, level 5, old streaming, 4677748 +silesia.tar, level 6, old streaming, 4613246 +silesia.tar, level 7, old streaming, 4576664 +silesia.tar, level 9, old streaming, 4552900 +silesia.tar, level 13, old streaming, 4502956 +silesia.tar, level 16, old streaming, 4360546 +silesia.tar, level 19, old streaming, 4265911 +silesia.tar, no source size, old streaming, 4859267 +silesia.tar, uncompressed literals, old streaming, 4859271 +silesia.tar, uncompressed literals optimal, old streaming, 4265911 +silesia.tar, huffman literals, old streaming, 6179056 +github, level -5, old streaming, 204407 github, level -5 with dict, old streaming, 46718 -github, level -3, old streaming, 190643 +github, level -3, old streaming, 193253 github, level -3 with dict, old streaming, 45395 -github, level -1, old streaming, 175568 +github, level -1, old streaming, 175468 github, level -1 with dict, old streaming, 43170 -github, level 0, old streaming, 136335 +github, level 0, old streaming, 136332 github, level 0 with dict, old streaming, 41148 -github, level 1, old streaming, 142465 +github, level 1, old streaming, 142365 github, level 1 with dict, old streaming, 41682 -github, level 3, old streaming, 136335 +github, level 3, old streaming, 136332 github, level 3 with dict, old streaming, 41148 github, level 4, old streaming, 136199 github, level 4 with dict, old streaming, 41251 @@ -1168,131 +1240,131 @@ github, level 7, old stre github, level 7 with dict, old streaming, 38758 github, level 9, old streaming, 135122 github, level 9 with dict, old streaming, 39437 -github, level 13, old streaming, 134064 -github, level 13 with dict, old streaming, 39743 -github, level 16, old streaming, 134064 +github, level 13, old streaming, 132878 +github, level 13 with dict, old streaming, 39900 +github, level 16, old streaming, 133209 github, level 16 with dict, old streaming, 37577 -github, level 19, old streaming, 134064 +github, level 19, old streaming, 132879 github, level 19 with dict, old streaming, 37576 -github, no source size, old streaming, 140632 +github, no source size, old streaming, 140599 github, no source size with dict, old streaming, 40654 -github, uncompressed literals, old streaming, 136335 -github, uncompressed literals optimal, old streaming, 134064 -github, huffman literals, old streaming, 175568 -github.tar, level -5, old streaming, 46747 -github.tar, level -5 with dict, old streaming, 44440 -github.tar, level -3, old streaming, 43537 -github.tar, level -3 with dict, old streaming, 41112 -github.tar, level -1, old streaming, 42465 -github.tar, level -1 with dict, old streaming, 41196 -github.tar, level 0, old streaming, 38441 +github, uncompressed literals, old streaming, 136332 +github, uncompressed literals optimal, old streaming, 132879 +github, huffman literals, old streaming, 175468 +github.tar, level -5, old streaming, 52152 +github.tar, level -5 with dict, old streaming, 51045 +github.tar, level -3, old streaming, 45678 +github.tar, level -3 with dict, old streaming, 44656 +github.tar, level -1, old streaming, 42560 +github.tar, level -1 with dict, old streaming, 41151 +github.tar, level 0, old streaming, 38831 github.tar, level 0 with dict, old streaming, 37995 -github.tar, level 1, old streaming, 39342 -github.tar, level 1 with dict, old streaming, 38293 -github.tar, level 3, old streaming, 38441 +github.tar, level 1, old streaming, 39200 +github.tar, level 1 with dict, old streaming, 38089 +github.tar, level 3, old streaming, 38831 github.tar, level 3 with dict, old streaming, 37995 -github.tar, level 4, old streaming, 38467 +github.tar, level 4, old streaming, 38893 github.tar, level 4 with dict, old streaming, 37948 -github.tar, level 5, old streaming, 39693 -github.tar, level 5 with dict, old streaming, 39040 -github.tar, level 6, old streaming, 39621 -github.tar, level 6 with dict, old streaming, 38622 -github.tar, level 7, old streaming, 39213 -github.tar, level 7 with dict, old streaming, 37848 -github.tar, level 9, old streaming, 36758 -github.tar, level 9 with dict, old streaming, 36457 -github.tar, level 13, old streaming, 35621 -github.tar, level 13 with dict, old streaming, 38726 -github.tar, level 16, old streaming, 40255 -github.tar, level 16 with dict, old streaming, 33639 -github.tar, level 19, old streaming, 32837 -github.tar, level 19 with dict, old streaming, 32895 -github.tar, no source size, old streaming, 38438 +github.tar, level 5, old streaming, 39651 +github.tar, level 5 with dict, old streaming, 39082 +github.tar, level 6, old streaming, 39282 +github.tar, level 6 with dict, old streaming, 38656 +github.tar, level 7, old streaming, 38110 +github.tar, level 7 with dict, old streaming, 37865 +github.tar, level 9, old streaming, 36760 +github.tar, level 9 with dict, old streaming, 36484 +github.tar, level 13, old streaming, 35501 +github.tar, level 13 with dict, old streaming, 37130 +github.tar, level 16, old streaming, 40466 +github.tar, level 16 with dict, old streaming, 33374 +github.tar, level 19, old streaming, 32276 +github.tar, level 19 with dict, old streaming, 32712 +github.tar, no source size, old streaming, 38828 github.tar, no source size with dict, old streaming, 38000 -github.tar, uncompressed literals, old streaming, 38441 -github.tar, uncompressed literals optimal, old streaming, 32837 -github.tar, huffman literals, old streaming, 42465 -silesia, level -5, old streaming advanced, 6882505 -silesia, level -3, old streaming advanced, 6568376 -silesia, level -1, old streaming advanced, 6183403 -silesia, level 0, old streaming advanced, 4849552 -silesia, level 1, old streaming advanced, 5314162 -silesia, level 3, old streaming advanced, 4849552 -silesia, level 4, old streaming advanced, 4786970 -silesia, level 5, old streaming advanced, 4707794 -silesia, level 6, old streaming advanced, 4666383 -silesia, level 7, old streaming advanced, 4603381 -silesia, level 9, old streaming advanced, 4546001 -silesia, level 13, old streaming advanced, 4482135 -silesia, level 16, old streaming advanced, 4360251 -silesia, level 19, old streaming advanced, 4283237 -silesia, no source size, old streaming advanced, 4849516 -silesia, long distance mode, old streaming advanced, 4849552 -silesia, multithreaded, old streaming advanced, 4849552 -silesia, multithreaded long distance mode, old streaming advanced, 4849552 -silesia, small window log, old streaming advanced, 7112062 +github.tar, uncompressed literals, old streaming, 38831 +github.tar, uncompressed literals optimal, old streaming, 32276 +github.tar, huffman literals, old streaming, 42560 +silesia, level -5, old streaming advanced, 6854744 +silesia, level -3, old streaming advanced, 6503319 +silesia, level -1, old streaming advanced, 6172207 +silesia, level 0, old streaming advanced, 4842075 +silesia, level 1, old streaming advanced, 5306388 +silesia, level 3, old streaming advanced, 4842075 +silesia, level 4, old streaming advanced, 4779186 +silesia, level 5, old streaming advanced, 4666323 +silesia, level 6, old streaming advanced, 4603066 +silesia, level 7, old streaming advanced, 4566984 +silesia, level 9, old streaming advanced, 4543018 +silesia, level 13, old streaming advanced, 4493990 +silesia, level 16, old streaming advanced, 4360041 +silesia, level 19, old streaming advanced, 4296055 +silesia, no source size, old streaming advanced, 4842039 +silesia, long distance mode, old streaming advanced, 4842075 +silesia, multithreaded, old streaming advanced, 4842075 +silesia, multithreaded long distance mode, old streaming advanced, 4842075 +silesia, small window log, old streaming advanced, 7111103 silesia, small hash log, old streaming advanced, 6526141 silesia, small chain log, old streaming advanced, 4912197 -silesia, explicit params, old streaming advanced, 4795887 -silesia, uncompressed literals, old streaming advanced, 4849552 -silesia, uncompressed literals optimal, old streaming advanced, 4283237 -silesia, huffman literals, old streaming advanced, 6183403 -silesia, multithreaded with advanced params, old streaming advanced, 4849552 -silesia.tar, level -5, old streaming advanced, 6982759 -silesia.tar, level -3, old streaming advanced, 6641283 -silesia.tar, level -1, old streaming advanced, 6190795 -silesia.tar, level 0, old streaming advanced, 4861427 -silesia.tar, level 1, old streaming advanced, 5336939 -silesia.tar, level 3, old streaming advanced, 4861427 -silesia.tar, level 4, old streaming advanced, 4799630 -silesia.tar, level 5, old streaming advanced, 4719261 -silesia.tar, level 6, old streaming advanced, 4677729 -silesia.tar, level 7, old streaming advanced, 4613544 -silesia.tar, level 9, old streaming advanced, 4555432 -silesia.tar, level 13, old streaming advanced, 4491765 -silesia.tar, level 16, old streaming advanced, 4356834 -silesia.tar, level 19, old streaming advanced, 4264392 -silesia.tar, no source size, old streaming advanced, 4861423 -silesia.tar, long distance mode, old streaming advanced, 4861427 -silesia.tar, multithreaded, old streaming advanced, 4861427 -silesia.tar, multithreaded long distance mode, old streaming advanced, 4861427 -silesia.tar, small window log, old streaming advanced, 7118772 -silesia.tar, small hash log, old streaming advanced, 6529235 +silesia, explicit params, old streaming advanced, 4795452 +silesia, uncompressed literals, old streaming advanced, 4842075 +silesia, uncompressed literals optimal, old streaming advanced, 4296055 +silesia, huffman literals, old streaming advanced, 6172207 +silesia, multithreaded with advanced params, old streaming advanced, 4842075 +silesia.tar, level -5, old streaming advanced, 6856523 +silesia.tar, level -3, old streaming advanced, 6505954 +silesia.tar, level -1, old streaming advanced, 6179056 +silesia.tar, level 0, old streaming advanced, 4859271 +silesia.tar, level 1, old streaming advanced, 5327708 +silesia.tar, level 3, old streaming advanced, 4859271 +silesia.tar, level 4, old streaming advanced, 4797470 +silesia.tar, level 5, old streaming advanced, 4677748 +silesia.tar, level 6, old streaming advanced, 4613246 +silesia.tar, level 7, old streaming advanced, 4576664 +silesia.tar, level 9, old streaming advanced, 4552900 +silesia.tar, level 13, old streaming advanced, 4502956 +silesia.tar, level 16, old streaming advanced, 4360546 +silesia.tar, level 19, old streaming advanced, 4265911 +silesia.tar, no source size, old streaming advanced, 4859267 +silesia.tar, long distance mode, old streaming advanced, 4859271 +silesia.tar, multithreaded, old streaming advanced, 4859271 +silesia.tar, multithreaded long distance mode, old streaming advanced, 4859271 +silesia.tar, small window log, old streaming advanced, 7117562 +silesia.tar, small hash log, old streaming advanced, 6529209 silesia.tar, small chain log, old streaming advanced, 4917021 -silesia.tar, explicit params, old streaming advanced, 4807401 -silesia.tar, uncompressed literals, old streaming advanced, 4861427 -silesia.tar, uncompressed literals optimal, old streaming advanced, 4264392 -silesia.tar, huffman literals, old streaming advanced, 6190795 -silesia.tar, multithreaded with advanced params, old streaming advanced, 4861427 -github, level -5, old streaming advanced, 216734 +silesia.tar, explicit params, old streaming advanced, 4806873 +silesia.tar, uncompressed literals, old streaming advanced, 4859271 +silesia.tar, uncompressed literals optimal, old streaming advanced, 4265911 +silesia.tar, huffman literals, old streaming advanced, 6179056 +silesia.tar, multithreaded with advanced params, old streaming advanced, 4859271 +github, level -5, old streaming advanced, 213265 github, level -5 with dict, old streaming advanced, 49562 -github, level -3, old streaming advanced, 192160 +github, level -3, old streaming advanced, 196126 github, level -3 with dict, old streaming advanced, 44956 -github, level -1, old streaming advanced, 181108 +github, level -1, old streaming advanced, 181107 github, level -1 with dict, old streaming advanced, 42383 github, level 0, old streaming advanced, 141104 github, level 0 with dict, old streaming advanced, 41113 -github, level 1, old streaming advanced, 143692 +github, level 1, old streaming advanced, 143693 github, level 1 with dict, old streaming advanced, 42430 github, level 3, old streaming advanced, 141104 github, level 3 with dict, old streaming advanced, 41113 github, level 4, old streaming advanced, 141104 github, level 4 with dict, old streaming advanced, 41084 -github, level 5, old streaming advanced, 139399 -github, level 5 with dict, old streaming advanced, 38633 -github, level 6, old streaming advanced, 139402 -github, level 6 with dict, old streaming advanced, 38723 +github, level 5, old streaming advanced, 139402 +github, level 5 with dict, old streaming advanced, 38723 +github, level 6, old streaming advanced, 138676 +github, level 6 with dict, old streaming advanced, 38744 github, level 7, old streaming advanced, 138676 -github, level 7 with dict, old streaming advanced, 38744 +github, level 7 with dict, old streaming advanced, 38924 github, level 9, old streaming advanced, 138676 github, level 9 with dict, old streaming advanced, 38981 github, level 13, old streaming advanced, 138676 -github, level 13 with dict, old streaming advanced, 39731 -github, level 16, old streaming advanced, 138676 +github, level 13 with dict, old streaming advanced, 39725 +github, level 16, old streaming advanced, 138575 github, level 16 with dict, old streaming advanced, 40789 -github, level 19, old streaming advanced, 134064 +github, level 19, old streaming advanced, 132879 github, level 19 with dict, old streaming advanced, 37576 -github, no source size, old streaming advanced, 140632 +github, no source size, old streaming advanced, 140599 github, no source size with dict, old streaming advanced, 40608 github, long distance mode, old streaming advanced, 141104 github, multithreaded, old streaming advanced, 141104 @@ -1302,50 +1374,50 @@ github, small hash log, old stre github, small chain log, old streaming advanced, 139275 github, explicit params, old streaming advanced, 140937 github, uncompressed literals, old streaming advanced, 141104 -github, uncompressed literals optimal, old streaming advanced, 134064 -github, huffman literals, old streaming advanced, 181108 +github, uncompressed literals optimal, old streaming advanced, 132879 +github, huffman literals, old streaming advanced, 181107 github, multithreaded with advanced params, old streaming advanced, 141104 -github.tar, level -5, old streaming advanced, 46747 -github.tar, level -5 with dict, old streaming advanced, 44824 -github.tar, level -3, old streaming advanced, 43537 -github.tar, level -3 with dict, old streaming advanced, 41800 -github.tar, level -1, old streaming advanced, 42465 -github.tar, level -1 with dict, old streaming advanced, 41471 -github.tar, level 0, old streaming advanced, 38441 +github.tar, level -5, old streaming advanced, 52152 +github.tar, level -5 with dict, old streaming advanced, 50988 +github.tar, level -3, old streaming advanced, 45678 +github.tar, level -3 with dict, old streaming advanced, 44729 +github.tar, level -1, old streaming advanced, 42560 +github.tar, level -1 with dict, old streaming advanced, 41589 +github.tar, level 0, old streaming advanced, 38831 github.tar, level 0 with dict, old streaming advanced, 38013 -github.tar, level 1, old streaming advanced, 39342 -github.tar, level 1 with dict, old streaming advanced, 38940 -github.tar, level 3, old streaming advanced, 38441 +github.tar, level 1, old streaming advanced, 39200 +github.tar, level 1 with dict, old streaming advanced, 38359 +github.tar, level 3, old streaming advanced, 38831 github.tar, level 3 with dict, old streaming advanced, 38013 -github.tar, level 4, old streaming advanced, 38467 +github.tar, level 4, old streaming advanced, 38893 github.tar, level 4 with dict, old streaming advanced, 38063 -github.tar, level 5, old streaming advanced, 39693 -github.tar, level 5 with dict, old streaming advanced, 39049 -github.tar, level 6, old streaming advanced, 39621 -github.tar, level 6 with dict, old streaming advanced, 38959 -github.tar, level 7, old streaming advanced, 39213 -github.tar, level 7 with dict, old streaming advanced, 38573 -github.tar, level 9, old streaming advanced, 36758 -github.tar, level 9 with dict, old streaming advanced, 36233 -github.tar, level 13, old streaming advanced, 35621 -github.tar, level 13 with dict, old streaming advanced, 36035 -github.tar, level 16, old streaming advanced, 40255 -github.tar, level 16 with dict, old streaming advanced, 38736 -github.tar, level 19, old streaming advanced, 32837 -github.tar, level 19 with dict, old streaming advanced, 32876 -github.tar, no source size, old streaming advanced, 38438 +github.tar, level 5, old streaming advanced, 39651 +github.tar, level 5 with dict, old streaming advanced, 38997 +github.tar, level 6, old streaming advanced, 39282 +github.tar, level 6 with dict, old streaming advanced, 38640 +github.tar, level 7, old streaming advanced, 38110 +github.tar, level 7 with dict, old streaming advanced, 37387 +github.tar, level 9, old streaming advanced, 36760 +github.tar, level 9 with dict, old streaming advanced, 36312 +github.tar, level 13, old streaming advanced, 35501 +github.tar, level 13 with dict, old streaming advanced, 35807 +github.tar, level 16, old streaming advanced, 40466 +github.tar, level 16 with dict, old streaming advanced, 38578 +github.tar, level 19, old streaming advanced, 32276 +github.tar, level 19 with dict, old streaming advanced, 32704 +github.tar, no source size, old streaming advanced, 38828 github.tar, no source size with dict, old streaming advanced, 38015 -github.tar, long distance mode, old streaming advanced, 38441 -github.tar, multithreaded, old streaming advanced, 38441 -github.tar, multithreaded long distance mode, old streaming advanced, 38441 +github.tar, long distance mode, old streaming advanced, 38831 +github.tar, multithreaded, old streaming advanced, 38831 +github.tar, multithreaded long distance mode, old streaming advanced, 38831 github.tar, small window log, old streaming advanced, 199561 github.tar, small hash log, old streaming advanced, 129870 github.tar, small chain log, old streaming advanced, 41669 -github.tar, explicit params, old streaming advanced, 41227 -github.tar, uncompressed literals, old streaming advanced, 38441 -github.tar, uncompressed literals optimal, old streaming advanced, 32837 -github.tar, huffman literals, old streaming advanced, 42465 -github.tar, multithreaded with advanced params, old streaming advanced, 38441 +github.tar, explicit params, old streaming advanced, 41385 +github.tar, uncompressed literals, old streaming advanced, 38831 +github.tar, uncompressed literals optimal, old streaming advanced, 32276 +github.tar, huffman literals, old streaming advanced, 42560 +github.tar, multithreaded with advanced params, old streaming advanced, 38831 github, level -5 with dict, old streaming cdict, 46718 github, level -3 with dict, old streaming cdict, 45395 github, level -1 with dict, old streaming cdict, 43170 @@ -1357,24 +1429,24 @@ github, level 5 with dict, old stre github, level 6 with dict, old streaming cdict, 38671 github, level 7 with dict, old streaming cdict, 38758 github, level 9 with dict, old streaming cdict, 39437 -github, level 13 with dict, old streaming cdict, 39743 +github, level 13 with dict, old streaming cdict, 39900 github, level 16 with dict, old streaming cdict, 37577 github, level 19 with dict, old streaming cdict, 37576 github, no source size with dict, old streaming cdict, 40654 -github.tar, level -5 with dict, old streaming cdict, 45018 -github.tar, level -3 with dict, old streaming cdict, 41886 -github.tar, level -1 with dict, old streaming cdict, 41636 +github.tar, level -5 with dict, old streaming cdict, 51191 +github.tar, level -3 with dict, old streaming cdict, 44821 +github.tar, level -1 with dict, old streaming cdict, 41775 github.tar, level 0 with dict, old streaming cdict, 37956 -github.tar, level 1 with dict, old streaming cdict, 38766 +github.tar, level 1 with dict, old streaming cdict, 38364 github.tar, level 3 with dict, old streaming cdict, 37956 github.tar, level 4 with dict, old streaming cdict, 37927 -github.tar, level 5 with dict, old streaming cdict, 39037 -github.tar, level 6 with dict, old streaming cdict, 38962 -github.tar, level 7 with dict, old streaming cdict, 38582 -github.tar, level 9 with dict, old streaming cdict, 36350 -github.tar, level 13 with dict, old streaming cdict, 36372 -github.tar, level 16 with dict, old streaming cdict, 39353 -github.tar, level 19 with dict, old streaming cdict, 32676 +github.tar, level 5 with dict, old streaming cdict, 38999 +github.tar, level 6 with dict, old streaming cdict, 38648 +github.tar, level 7 with dict, old streaming cdict, 37436 +github.tar, level 9 with dict, old streaming cdict, 36401 +github.tar, level 13 with dict, old streaming cdict, 36010 +github.tar, level 16 with dict, old streaming cdict, 39081 +github.tar, level 19 with dict, old streaming cdict, 32479 github.tar, no source size with dict, old streaming cdict, 38000 github, level -5 with dict, old streaming advanced cdict, 49562 github, level -3 with dict, old streaming advanced cdict, 44956 @@ -1383,26 +1455,26 @@ github, level 0 with dict, old stre github, level 1 with dict, old streaming advanced cdict, 42430 github, level 3 with dict, old streaming advanced cdict, 41113 github, level 4 with dict, old streaming advanced cdict, 41084 -github, level 5 with dict, old streaming advanced cdict, 38633 -github, level 6 with dict, old streaming advanced cdict, 38723 -github, level 7 with dict, old streaming advanced cdict, 38744 +github, level 5 with dict, old streaming advanced cdict, 38723 +github, level 6 with dict, old streaming advanced cdict, 38744 +github, level 7 with dict, old streaming advanced cdict, 38924 github, level 9 with dict, old streaming advanced cdict, 38981 -github, level 13 with dict, old streaming advanced cdict, 39731 +github, level 13 with dict, old streaming advanced cdict, 39725 github, level 16 with dict, old streaming advanced cdict, 40789 github, level 19 with dict, old streaming advanced cdict, 37576 github, no source size with dict, old streaming advanced cdict, 40608 -github.tar, level -5 with dict, old streaming advanced cdict, 44307 -github.tar, level -3 with dict, old streaming advanced cdict, 41359 -github.tar, level -1 with dict, old streaming advanced cdict, 41322 +github.tar, level -5 with dict, old streaming advanced cdict, 50854 +github.tar, level -3 with dict, old streaming advanced cdict, 44571 +github.tar, level -1 with dict, old streaming advanced cdict, 41477 github.tar, level 0 with dict, old streaming advanced cdict, 38013 -github.tar, level 1 with dict, old streaming advanced cdict, 39002 +github.tar, level 1 with dict, old streaming advanced cdict, 38168 github.tar, level 3 with dict, old streaming advanced cdict, 38013 github.tar, level 4 with dict, old streaming advanced cdict, 38063 -github.tar, level 5 with dict, old streaming advanced cdict, 39049 -github.tar, level 6 with dict, old streaming advanced cdict, 38959 -github.tar, level 7 with dict, old streaming advanced cdict, 38573 -github.tar, level 9 with dict, old streaming advanced cdict, 36233 -github.tar, level 13 with dict, old streaming advanced cdict, 36035 -github.tar, level 16 with dict, old streaming advanced cdict, 38736 -github.tar, level 19 with dict, old streaming advanced cdict, 32876 +github.tar, level 5 with dict, old streaming advanced cdict, 38997 +github.tar, level 6 with dict, old streaming advanced cdict, 38640 +github.tar, level 7 with dict, old streaming advanced cdict, 37387 +github.tar, level 9 with dict, old streaming advanced cdict, 36312 +github.tar, level 13 with dict, old streaming advanced cdict, 35807 +github.tar, level 16 with dict, old streaming advanced cdict, 38578 +github.tar, level 19 with dict, old streaming advanced cdict, 32704 github.tar, no source size with dict, old streaming advanced cdict, 38015 diff --git a/src/dependencies/zstd-1.5.0/tests/regression/test.c b/src/dependencies/zstd-1.5.4/tests/regression/test.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/regression/test.c rename to src/dependencies/zstd-1.5.4/tests/regression/test.c index 1de6be8..07600be 100644 --- a/src/dependencies/zstd-1.5.0/tests/regression/test.c +++ b/src/dependencies/zstd-1.5.4/tests/regression/test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/roundTripCrash.c b/src/dependencies/zstd-1.5.4/tests/roundTripCrash.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/roundTripCrash.c rename to src/dependencies/zstd-1.5.4/tests/roundTripCrash.c index 9aa208c..77411cd 100644 --- a/src/dependencies/zstd-1.5.0/tests/roundTripCrash.c +++ b/src/dependencies/zstd-1.5.4/tests/roundTripCrash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/seqgen.c b/src/dependencies/zstd-1.5.4/tests/seqgen.c similarity index 99% rename from src/dependencies/zstd-1.5.0/tests/seqgen.c rename to src/dependencies/zstd-1.5.4/tests/seqgen.c index 1e340c8..0d8a766 100644 --- a/src/dependencies/zstd-1.5.0/tests/seqgen.c +++ b/src/dependencies/zstd-1.5.4/tests/seqgen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/seqgen.h b/src/dependencies/zstd-1.5.4/tests/seqgen.h similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/seqgen.h rename to src/dependencies/zstd-1.5.4/tests/seqgen.h index cea3f55..df17398 100644 --- a/src/dependencies/zstd-1.5.0/tests/seqgen.h +++ b/src/dependencies/zstd-1.5.4/tests/seqgen.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the diff --git a/src/dependencies/zstd-1.5.0/tests/test-license.py b/src/dependencies/zstd-1.5.4/tests/test-license.py similarity index 96% rename from src/dependencies/zstd-1.5.0/tests/test-license.py rename to src/dependencies/zstd-1.5.4/tests/test-license.py index 2247765..d54c164 100755 --- a/src/dependencies/zstd-1.5.0/tests/test-license.py +++ b/src/dependencies/zstd-1.5.4/tests/test-license.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # ################################################################ -# Copyright (c) Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -43,6 +43,7 @@ SUFFIXES = [ "Makefile", ".mk", ".py", + ".S", ] # License should certainly be in the first 10 KB. @@ -82,8 +83,8 @@ def valid_copyright(lines): continue if "present" in line: return (False, f"Copyright line '{line}' contains 'present'!") - if "Facebook, Inc" not in line: - return (False, f"Copyright line '{line}' does not contain 'Facebook, Inc'") + if "Meta Platforms, Inc" not in line: + return (False, f"Copyright line '{line}' does not contain 'Meta Platforms, Inc'") year = YEAR_REGEX.search(line) if year is not None: return (False, f"Copyright line '{line}' contains {year.group(0)}; it should be yearless") diff --git a/src/dependencies/zstd-1.5.4/tests/test-variants.sh b/src/dependencies/zstd-1.5.4/tests/test-variants.sh new file mode 100755 index 0000000..f3a9e06 --- /dev/null +++ b/src/dependencies/zstd-1.5.4/tests/test-variants.sh @@ -0,0 +1,115 @@ +#!/bin/sh +set -e +set -u +set -x + + +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) +PROG_DIR="$SCRIPT_DIR/../programs" + +ZSTD="$PROG_DIR/zstd" +ZSTD_COMPRESS="$PROG_DIR/zstd-compress" +ZSTD_DECOMPRESS="$PROG_DIR/zstd-decompress" +ZSTD_NOLEGACY="$PROG_DIR/zstd-nolegacy" +ZSTD_DICTBUILDER="$PROG_DIR/zstd-dictBuilder" +ZSTD_FRUGAL="$PROG_DIR/zstd-frugal" +ZSTD_NOMT="$PROG_DIR/zstd-nomt" + +println() { + printf '%b\n' "${*}" +} + +die() { + println "$@" 1>&2 + exit 1 +} + +symbol_present() { + (nm $1 || echo "symbol_present $@ failed") | grep $2 +} + +symbol_not_present() { + symbol_present $@ && die "Binary '$1' mistakenly contains symbol '$2'" ||: +} + +compress_not_present() { + symbol_not_present "$1" ZSTD_compress +} + +decompress_not_present() { + symbol_not_present "$1" ZSTD_decompress +} + +dict_not_present() { + symbol_not_present "$1" ZDICT_ + symbol_not_present "$1" COVER_ +} + +cliextra_not_present() { + symbol_not_present "$1" TRACE_ + symbol_not_present "$1" BMK_ +} + +legacy_not_present() { + symbol_not_present "$1" ZSTDv0 +} + +test_help() { + "$1" --help | grep -- "$2" +} + +test_no_help() { + test_help $@ && die "'$1' supports '$2' when it shouldn't" ||: +} + +extras_not_present() { + dict_not_present $@ + legacy_not_present $@ + cliextra_not_present $@ + test_no_help $@ "--train" + test_no_help $@ "-b#" +} + +test_compress() { + echo "hello" | "$1" | "$ZSTD" -t +} + +test_decompress() { + echo "hello" | "$ZSTD" | "$1" -t +} + +test_zstd() { + test_compress $@ + test_decompress $@ +} + +extras_not_present "$ZSTD_FRUGAL" +extras_not_present "$ZSTD_COMPRESS" +extras_not_present "$ZSTD_DECOMPRESS" + +compress_not_present "$ZSTD_DECOMPRESS" + +decompress_not_present "$ZSTD_COMPRESS" +decompress_not_present "$ZSTD_DICTBUILDER" + +cliextra_not_present "$ZSTD_DICTBUILDER" + +legacy_not_present "$ZSTD_DICTBUILDER" +legacy_not_present "$ZSTD_NOLEGACY" + +symbol_not_present "$ZSTD" ZSTDv01 +symbol_not_present "$ZSTD" ZSTDv02 +symbol_not_present "$ZSTD" ZSTDv03 +symbol_not_present "$ZSTD" ZSTDv04 + +test_compress "$ZSTD_COMPRESS" +test_decompress "$ZSTD_DECOMPRESS" + +test_zstd "$ZSTD_FRUGAL" +test_zstd "$ZSTD_NOLEGACY" + +test_help "$ZSTD" '-b#' +test_help "$ZSTD" --train +test_help "$ZSTD_DICTBUILDER" --train + +println "Success!" diff --git a/src/dependencies/zstd-1.5.0/tests/test-zstd-versions.py b/src/dependencies/zstd-1.5.4/tests/test-zstd-versions.py similarity index 56% rename from src/dependencies/zstd-1.5.0/tests/test-zstd-versions.py rename to src/dependencies/zstd-1.5.4/tests/test-zstd-versions.py index c86af7d..1bcf39e 100755 --- a/src/dependencies/zstd-1.5.0/tests/test-zstd-versions.py +++ b/src/dependencies/zstd-1.5.4/tests/test-zstd-versions.py @@ -2,7 +2,7 @@ """Test zstd interoperability between versions""" # ################################################################ -# Copyright (c) Yann Collet, Facebook, Inc. +# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -23,13 +23,25 @@ from subprocess import Popen, PIPE repo_url = 'https://github.com/facebook/zstd.git' tmp_dir_name = 'tests/versionsTest' make_cmd = 'make' +make_args = ['-j','CFLAGS=-O0'] git_cmd = 'git' test_dat_src = 'README.md' test_dat = 'test_dat' head = 'vdevel' dict_source = 'dict_source' -dict_files = './zstd/programs/*.c ./zstd/lib/common/*.c ./zstd/lib/compress/*.c ./zstd/lib/decompress/*.c ./zstd/lib/dictBuilder/*.c ./zstd/lib/legacy/*.c ' -dict_files += './zstd/programs/*.h ./zstd/lib/common/*.h ./zstd/lib/compress/*.h ./zstd/lib/dictBuilder/*.h ./zstd/lib/legacy/*.h' +dict_globs = [ + 'programs/*.c', + 'lib/common/*.c', + 'lib/compress/*.c', + 'lib/decompress/*.c', + 'lib/dictBuilder/*.c', + 'lib/legacy/*.c', + 'programs/*.h', + 'lib/common/*.h', + 'lib/compress/*.h', + 'lib/dictBuilder/*.h', + 'lib/legacy/*.h' +] def execute(command, print_output=False, print_error=True, param_shell=False): @@ -56,8 +68,11 @@ def proc(cmd_args, pipe=True, dummy=False): return subproc.communicate() -def make(args, pipe=True): - return proc([make_cmd] + args, pipe) +def make(targets, pipe=True): + cmd = [make_cmd] + make_args + targets + cmd_str = str(cmd) + print('compilation command : ' + cmd_str) + return proc(cmd, pipe) def git(args, pipe=True): @@ -70,59 +85,85 @@ def get_git_tags(): return tags -def create_dict(tag, dict_source_path): +def dict_ok(tag, dict_name, sample): + if not os.path.isfile(dict_name): + return False + try: + cmd = ['./zstd.' + tag, '-D', dict_name] + with open(sample, "rb") as i: + subprocess.check_call(cmd, stdin=i, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + return True + except: + return False + + +def create_dict(tag, dict_source_path, fallback_tag=None): dict_name = 'dict.' + tag if not os.path.isfile(dict_name): cFiles = glob.glob(dict_source_path + "/*.c") hFiles = glob.glob(dict_source_path + "/*.h") + # Ensure the dictionary builder is deterministic + files = sorted(cFiles + hFiles) if tag == 'v0.5.0': - result = execute('./dictBuilder.' + tag + ' ' + ' '.join(cFiles) + ' ' + ' '.join(hFiles) + ' -o ' + dict_name, print_output=False, param_shell=True) + result = execute('./dictBuilder.' + tag + ' ' + ' '.join(files) + ' -o ' + dict_name, print_output=False, param_shell=True) else: - result = execute('./zstd.' + tag + ' -f --train ' + ' '.join(cFiles) + ' ' + ' '.join(hFiles) + ' -o ' + dict_name, print_output=False, param_shell=True) - if result == 0: + result = execute('./zstd.' + tag + ' -f --train ' + ' '.join(files) + ' -o ' + dict_name, print_output=False, param_shell=True) + if result == 0 and dict_ok(tag, dict_name, files[0]): print(dict_name + ' created') + elif fallback_tag is not None: + fallback_dict_name = 'dict.' + fallback_tag + print('creating dictionary ' + dict_name + ' failed, falling back to ' + fallback_dict_name) + shutil.copy(fallback_dict_name, dict_name) else: - print('ERROR: creating of ' + dict_name + ' failed') + raise RuntimeError('ERROR: creating of ' + dict_name + ' failed') else: print(dict_name + ' already exists') +def zstd(tag, args, input_file, output_file): + """ + Zstd compress input_file to output_file. + Need this helper because 0.5.0 is broken when stdout is not a TTY. + Throws an exception if the command returns non-zero. + """ + with open(input_file, "rb") as i: + with open(output_file, "wb") as o: + cmd = ['./zstd.' + tag] + args + print("Running: '{}', input={}, output={}" .format( + ' '.join(cmd), input_file, output_file + )) + result = subprocess.run(cmd, stdin=i, stdout=o, stderr=subprocess.PIPE) + print("Stderr: {}".format(result.stderr.decode("ascii"))) + result.check_returncode() + + def dict_compress_sample(tag, sample): dict_name = 'dict.' + tag - DEVNULL = open(os.devnull, 'wb') - if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_01_64_' + tag + '_dictio.zst') - if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-5f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_05_64_' + tag + '_dictio.zst') - if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-9f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_09_64_' + tag + '_dictio.zst') - if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-15f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_15_64_' + tag + '_dictio.zst') - if subprocess.call(['./zstd.' + tag, '-D', dict_name, '-18f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_18_64_' + tag + '_dictio.zst') + verbose = ['-v', '-v', '-v'] + zstd(tag, ['-D', dict_name, '-1'] + verbose, sample, sample + '_01_64_' + tag + '_dictio.zst') + zstd(tag, ['-D', dict_name, '-3'], sample, sample + '_03_64_' + tag + '_dictio.zst') + zstd(tag, ['-D', dict_name, '-5'], sample, sample + '_05_64_' + tag + '_dictio.zst') + zstd(tag, ['-D', dict_name, '-9'], sample, sample + '_09_64_' + tag + '_dictio.zst') + zstd(tag, ['-D', dict_name, '-15'], sample, sample + '_15_64_' + tag + '_dictio.zst') + zstd(tag, ['-D', dict_name, '-18'], sample, sample + '_18_64_' + tag + '_dictio.zst') # zstdFiles = glob.glob("*.zst*") # print(zstdFiles) print(tag + " : dict compression completed") def compress_sample(tag, sample): - DEVNULL = open(os.devnull, 'wb') - if subprocess.call(['./zstd.' + tag, '-f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_01_64_' + tag + '_nodict.zst') - if subprocess.call(['./zstd.' + tag, '-5f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_05_64_' + tag + '_nodict.zst') - if subprocess.call(['./zstd.' + tag, '-9f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_09_64_' + tag + '_nodict.zst') - if subprocess.call(['./zstd.' + tag, '-15f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_15_64_' + tag + '_nodict.zst') - if subprocess.call(['./zstd.' + tag, '-18f', sample], stderr=DEVNULL) == 0: - os.rename(sample + '.zst', sample + '_18_64_' + tag + '_nodict.zst') + zstd(tag, ['-1'], sample, sample + '_01_64_' + tag + '_nodict.zst') + zstd(tag, ['-3'], sample, sample + '_03_64_' + tag + '_nodict.zst') + zstd(tag, ['-5'], sample, sample + '_05_64_' + tag + '_nodict.zst') + zstd(tag, ['-9'], sample, sample + '_09_64_' + tag + '_nodict.zst') + zstd(tag, ['-15'], sample, sample + '_15_64_' + tag + '_nodict.zst') + zstd(tag, ['-18'], sample, sample + '_18_64_' + tag + '_nodict.zst') # zstdFiles = glob.glob("*.zst*") # print(zstdFiles) print(tag + " : compression completed") -# http://stackoverflow.com/a/19711609/2132223 +# https://stackoverflow.com/a/19711609/2132223 def sha1_of_file(filepath): with open(filepath, 'rb') as f: return hashlib.sha1(f.read()).hexdigest() @@ -146,23 +187,13 @@ def decompress_zst(tag): dec_error = 0 list_zst = sorted(glob.glob('*_nodict.zst')) for file_zst in list_zst: - print(file_zst, end=' ') - print(tag, end=' ') + print(file_zst + ' ' + tag) file_dec = file_zst + '_d64_' + tag + '.dec' - if tag <= 'v0.5.0': - params = ['./zstd.' + tag, '-df', file_zst, file_dec] + zstd(tag, ['-d'], file_zst, file_dec) + if not filecmp.cmp(file_dec, test_dat): + raise RuntimeError('Decompression failed: tag={} file={}'.format(tag, file_zst)) else: - params = ['./zstd.' + tag, '-df', file_zst, '-o', file_dec] - if execute(params) == 0: - if not filecmp.cmp(file_dec, test_dat): - print('ERR !! ') - dec_error = 1 - else: - print('OK ') - else: - print('command does not work') - dec_error = 1 - return dec_error + print('OK ') def decompress_dict(tag): @@ -177,22 +208,13 @@ def decompress_dict(tag): if tag == 'v0.6.0' and dict_tag < 'v0.6.0': continue dict_name = 'dict.' + dict_tag - print(file_zst + ' ' + tag + ' dict=' + dict_tag, end=' ') + print(file_zst + ' ' + tag + ' dict=' + dict_tag) file_dec = file_zst + '_d64_' + tag + '.dec' - if tag <= 'v0.5.0': - params = ['./zstd.' + tag, '-D', dict_name, '-df', file_zst, file_dec] + zstd(tag, ['-D', dict_name, '-d'], file_zst, file_dec) + if not filecmp.cmp(file_dec, test_dat): + raise RuntimeError('Decompression failed: tag={} file={}'.format(tag, file_zst)) else: - params = ['./zstd.' + tag, '-D', dict_name, '-df', file_zst, '-o', file_dec] - if execute(params) == 0: - if not filecmp.cmp(file_dec, test_dat): - print('ERR !! ') - dec_error = 1 - else: - print('OK ') - else: - print('command does not work') - dec_error = 1 - return dec_error + print('OK ') if __name__ == '__main__': @@ -223,20 +245,28 @@ if __name__ == '__main__': dst_zstd = '{}/zstd.{}'.format(tmp_dir, tag) # /path/to/zstd/tests/versionsTest/zstd. if not os.path.isfile(dst_zstd) or tag == head: if tag != head: + print('-----------------------------------------------') + print('compiling ' + tag) + print('-----------------------------------------------') r_dir = '{}/{}'.format(tmp_dir, tag) # /path/to/zstd/tests/versionsTest/ os.makedirs(r_dir, exist_ok=True) os.chdir(clone_dir) git(['--work-tree=' + r_dir, 'checkout', tag, '--', '.'], False) if tag == 'v0.5.0': os.chdir(r_dir + '/dictBuilder') # /path/to/zstd/tests/versionsTest/v0.5.0/dictBuilder - make(['clean', 'dictBuilder'], False) + make(['clean'], False) # separate 'clean' target to allow parallel build + make(['dictBuilder'], False) shutil.copy2('dictBuilder', '{}/dictBuilder.{}'.format(tmp_dir, tag)) os.chdir(r_dir + '/programs') # /path/to/zstd/tests/versionsTest//programs - make(['clean', 'zstd'], False) + make(['clean'], False) # separate 'clean' target to allow parallel build + make(['zstd'], False) else: os.chdir(programs_dir) + print('-----------------------------------------------') + print('compiling head') + print('-----------------------------------------------') make(['zstd'], False) - shutil.copy2('zstd', dst_zstd) + shutil.copy2('zstd', dst_zstd) # remove any remaining *.zst and *.dec from previous test os.chdir(tmp_dir) @@ -248,30 +278,31 @@ if __name__ == '__main__': # copy *.c and *.h to a temporary directory ("dict_source") if not os.path.isdir(dict_source_path): os.mkdir(dict_source_path) - print('cp ' + dict_files + ' ' + dict_source_path) - execute('cp ' + dict_files + ' ' + dict_source_path, param_shell=True) + for dict_glob in dict_globs: + files = glob.glob(dict_glob, root_dir=base_dir) + for file in files: + file = os.path.join(base_dir, file) + print("copying " + file + " to " + dict_source_path) + shutil.copy(file, dict_source_path) + print('-----------------------------------------------') print('Compress test.dat by all released zstd') + print('-----------------------------------------------') - error_code = 0 + create_dict(head, dict_source_path) for tag in tags: print(tag) if tag >= 'v0.5.0': - create_dict(tag, dict_source_path) + create_dict(tag, dict_source_path, head) dict_compress_sample(tag, test_dat) remove_duplicates() - error_code += decompress_dict(tag) + decompress_dict(tag) compress_sample(tag, test_dat) remove_duplicates() - error_code += decompress_zst(tag) + decompress_zst(tag) print('') print('Enumerate different compressed files') zstds = sorted(glob.glob('*.zst')) for zstd in zstds: print(zstd + ' : ' + repr(os.path.getsize(zstd)) + ', ' + sha1_of_file(zstd)) - - if error_code != 0: - print('====== ERROR !!! =======') - - sys.exit(error_code) diff --git a/src/dependencies/zstd-1.5.0/tests/zstreamtest.c b/src/dependencies/zstd-1.5.4/tests/zstreamtest.c similarity index 78% rename from src/dependencies/zstd-1.5.0/tests/zstreamtest.c rename to src/dependencies/zstd-1.5.4/tests/zstreamtest.c index bbef903..14c4af8 100644 --- a/src/dependencies/zstd-1.5.0/tests/zstreamtest.c +++ b/src/dependencies/zstd-1.5.4/tests/zstreamtest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -25,6 +25,7 @@ #include /* free */ #include /* fgets, sscanf */ #include /* strcmp */ +#include /* time_t, time(), to randomize seed */ #include /* assert */ #include "timefn.h" /* UTIL_time_t, UTIL_getTime */ #include "mem.h" @@ -39,7 +40,7 @@ #include "seqgen.h" #include "util.h" #include "timefn.h" /* UTIL_time_t, UTIL_clockSpanMicro, UTIL_getTime */ - +#include "external_matchfinder.h" /* zstreamSequenceProducer, EMF_testCase */ /*-************************************ * Constants @@ -259,7 +260,7 @@ static U32 badParameters(ZSTD_CCtx* zc, ZSTD_parameters const savedParams) return 0; } -static int basicUnitTests(U32 seed, double compressibility) +static int basicUnitTests(U32 seed, double compressibility, int bigTests) { size_t const CNBufferSize = COMPRESSIBLE_NOISE_LENGTH; void* CNBuffer = malloc(CNBufferSize); @@ -424,6 +425,15 @@ static int basicUnitTests(U32 seed, double compressibility) } } DISPLAYLEVEL(3, "OK \n"); + /* check decompression fails early if first bytes are wrong */ + DISPLAYLEVEL(3, "test%3i : early decompression error if first bytes are incorrect : ", testNb++); + { const char buf[3] = { 0 }; /* too short, not enough to start decoding header */ + ZSTD_inBuffer inb = { buf, sizeof(buf), 0 }; + size_t const remaining = ZSTD_decompressStream(zd, &outBuff, &inb); + if (!ZSTD_isError(remaining)) goto _output_error; /* should have errored out immediately (note: this does not test the exact error code) */ + } + DISPLAYLEVEL(3, "OK \n"); + /* context size functions */ DISPLAYLEVEL(3, "test%3i : estimate DStream size : ", testNb++); { ZSTD_frameHeader fhi; @@ -513,7 +523,7 @@ static int basicUnitTests(U32 seed, double compressibility) } DISPLAYLEVEL(3, "OK \n"); - DISPLAYLEVEL(3, "test%3i : NULL buffers : ", testNb++); + DISPLAYLEVEL(3, "test%3i : NULL output and NULL input : ", testNb++); inBuff.src = NULL; inBuff.size = 0; inBuff.pos = 0; @@ -539,6 +549,36 @@ static int basicUnitTests(U32 seed, double compressibility) { size_t const ret = ZSTD_decompressStream(zd, &outBuff, &inBuff); if (ret != 0) goto _output_error; } + DISPLAYLEVEL(3, "OK\n"); + + DISPLAYLEVEL(3, "test%3i : NULL output buffer with non-NULL input : ", testNb++); + { + const char* test = "aa"; + inBuff.src = test; + inBuff.size = 2; + inBuff.pos = 0; + outBuff.dst = NULL; + outBuff.size = 0; + outBuff.pos = 0; + CHECK_Z( ZSTD_compressStream(zc, &outBuff, &inBuff) ); + CHECK(inBuff.pos != inBuff.size, "Entire input should be consumed"); + CHECK_Z( ZSTD_endStream(zc, &outBuff) ); + outBuff.dst = (char*)(compressedBuffer); + outBuff.size = compressedBufferSize; + outBuff.pos = 0; + { size_t const r = ZSTD_endStream(zc, &outBuff); + CHECK(r != 0, "Error or some data not flushed (ret=%zu)", r); + } + inBuff.src = outBuff.dst; + inBuff.size = outBuff.pos; + inBuff.pos = 0; + outBuff.dst = NULL; + outBuff.size = 0; + outBuff.pos = 0; + CHECK_Z( ZSTD_initDStream(zd) ); + CHECK_Z(ZSTD_decompressStream(zd, &outBuff, &inBuff)); + } + DISPLAYLEVEL(3, "OK\n"); /* _srcSize compression test */ DISPLAYLEVEL(3, "test%3i : compress_srcSize %u bytes : ", testNb++, COMPRESSIBLE_NOISE_LENGTH); @@ -613,7 +653,7 @@ static int basicUnitTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "OK (error detected : %s) \n", ZSTD_getErrorName(r)); } } - /* Complex context re-use scenario */ + /* Compression state re-use scenario */ DISPLAYLEVEL(3, "test%3i : context re-use : ", testNb++); ZSTD_freeCStream(zc); zc = ZSTD_createCStream(); @@ -634,8 +674,7 @@ static int basicUnitTests(U32 seed, double compressibility) CHECK_Z( ZSTD_compressStream(zc, &outBuff, &inBuff) ); if (inBuff.pos != inBuff.size) goto _output_error; /* entire input should be consumed */ DISPLAYLEVEL(5, "end1 "); - { size_t const r = ZSTD_endStream(zc, &outBuff); - if (r != 0) goto _output_error; } /* error, or some data not flushed */ + if (ZSTD_endStream(zc, &outBuff) != 0) goto _output_error; /* error, or some data not flushed */ } /* use 2 */ { size_t const inSize = 1025; /* will not continue, because tables auto-adjust and are therefore different size */ @@ -653,8 +692,7 @@ static int basicUnitTests(U32 seed, double compressibility) CHECK_Z( ZSTD_compressStream(zc, &outBuff, &inBuff) ); if (inBuff.pos != inBuff.size) goto _output_error; /* entire input should be consumed */ DISPLAYLEVEL(5, "end2 "); - { size_t const r = ZSTD_endStream(zc, &outBuff); - if (r != 0) goto _output_error; } /* error, or some data not flushed */ + if (ZSTD_endStream(zc, &outBuff) != 0) goto _output_error; /* error, or some data not flushed */ } DISPLAYLEVEL(3, "OK \n"); @@ -771,11 +809,12 @@ static int basicUnitTests(U32 seed, double compressibility) } /* Compression with ZSTD_c_stable{In,Out}Buffer */ - { ZSTD_CCtx* cctx = ZSTD_createCCtx(); + { ZSTD_CCtx* const cctx = ZSTD_createCCtx(); ZSTD_inBuffer in; ZSTD_outBuffer out; size_t cctxSize1; size_t cctxSize2; + assert(cctx != NULL); in.src = CNBuffer; in.size = CNBufferSize; out.dst = compressedBuffer; @@ -786,30 +825,33 @@ static int basicUnitTests(U32 seed, double compressibility) CHECK(!(cSize < ZSTD_compressBound(CNBufferSize)), "cSize too large for test"); CHECK_Z(cSize = ZSTD_compress2(cctx, compressedBuffer, cSize + 4, CNBuffer, CNBufferSize)); CHECK_Z(cctxSize1 = ZSTD_sizeof_CCtx(cctx)); - { ZSTD_CCtx* cctx2 = ZSTD_createCCtx(); + /* @cctxSize2 : sizeof_CCtx when doing full streaming (no stable in/out) */ + { ZSTD_CCtx* const cctx2 = ZSTD_createCCtx(); + assert(cctx2 != NULL); in.pos = out.pos = 0; CHECK_Z(ZSTD_compressStream2(cctx2, &out, &in, ZSTD_e_continue)); CHECK(!(ZSTD_compressStream2(cctx2, &out, &in, ZSTD_e_end) == 0), "Not finished"); CHECK_Z(cctxSize2 = ZSTD_sizeof_CCtx(cctx2)); ZSTD_freeCCtx(cctx2); } - { ZSTD_CCtx* cctx3 = ZSTD_createCCtx(); + /* @cctxSize1 : sizeof_CCtx when doing single-shot compression (no streaming) */ + { ZSTD_CCtx* const cctx1 = ZSTD_createCCtx(); ZSTD_parameters params = ZSTD_getParams(0, CNBufferSize, 0); size_t cSize3; + assert(cctx1 != NULL); params.fParams.checksumFlag = 1; - cSize3 = ZSTD_compress_advanced(cctx3, compressedBuffer, compressedBufferSize, CNBuffer, CNBufferSize, NULL, 0, params); + cSize3 = ZSTD_compress_advanced(cctx1, compressedBuffer, compressedBufferSize, CNBuffer, CNBufferSize, NULL, 0, params); CHECK_Z(cSize3); CHECK(!(cSize == cSize3), "Must be same compressed size"); - CHECK(!(cctxSize1 == ZSTD_sizeof_CCtx(cctx3)), "Must be same CCtx size"); - ZSTD_freeCCtx(cctx3); + CHECK(!(cctxSize1 == ZSTD_sizeof_CCtx(cctx1)), "Must be same CCtx size"); + ZSTD_freeCCtx(cctx1); } CHECK(!(cctxSize1 < cctxSize2), "Stable buffers means less allocated size"); CHECK_Z(ZSTD_decompress(decodedBuffer, CNBufferSize, compressedBuffer, cSize)); DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : ZSTD_compress2() doesn't modify user parameters : ", testNb++); - { - int stableInBuffer; + { int stableInBuffer; int stableOutBuffer; CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_stableInBuffer, &stableInBuffer)); CHECK_Z(ZSTD_CCtx_getParameter(cctx, ZSTD_c_stableOutBuffer, &stableOutBuffer)); @@ -866,30 +908,73 @@ static int basicUnitTests(U32 seed, double compressibility) in.pos = 0; { size_t const ret = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end); CHECK(!ZSTD_isError(ret), "Must error"); - CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_srcBuffer_wrong), "Must be this error"); + CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_stabilityCondition_notRespected), "Must be this error"); } DISPLAYLEVEL(3, "OK \n"); - DISPLAYLEVEL(3, "test%3i : ZSTD_compressStream2() ZSTD_c_stableInBuffer with continue and flush : ", testNb++); - in.src = CNBuffer; - in.size = CNBufferSize; - in.pos = 0; - out.pos = 0; - out.size = compressedBufferSize; - CHECK_Z(ZSTD_CCtx_reset(cctx, ZSTD_reset_session_only)); - { size_t const ret = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue); - CHECK(!ZSTD_isError(ret), "Must error"); - CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_srcBuffer_wrong), "Must be this error"); - } - CHECK_Z(ZSTD_CCtx_reset(cctx, ZSTD_reset_session_only)); - { size_t const ret = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_flush); - CHECK(!ZSTD_isError(ret), "Must error"); - CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_srcBuffer_wrong), "Must be this error"); - } + /* stableSrc + streaming */ + DISPLAYLEVEL(3, "test%3i : ZSTD_c_stableInBuffer compatibility with compressStream, flushStream and endStream : ", testNb++); + CHECK_Z( ZSTD_initCStream(cctx, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_stableInBuffer, 1) ); + { ZSTD_inBuffer inBuf; + ZSTD_outBuffer outBuf; + const size_t nonZeroStartPos = 18; + const size_t inputSize = 500; + inBuf.src = CNBuffer; + inBuf.size = 100; + inBuf.pos = nonZeroStartPos; + outBuf.dst = (char*)(compressedBuffer)+cSize; + outBuf.size = ZSTD_compressBound(inputSize); + outBuf.pos = 0; + CHECK_Z( ZSTD_compressStream(cctx, &outBuf, &inBuf) ); + inBuf.size = 200; + CHECK_Z( ZSTD_compressStream(cctx, &outBuf, &inBuf) ); + CHECK_Z( ZSTD_flushStream(cctx, &outBuf) ); + inBuf.size = nonZeroStartPos + inputSize; + CHECK_Z( ZSTD_compressStream(cctx, &outBuf, &inBuf) ); + CHECK(ZSTD_endStream(cctx, &outBuf) != 0, "compression should be successful and fully flushed"); + { const void* const realSrcStart = (const char*)inBuf.src + nonZeroStartPos; + void* const verifBuf = (char*)outBuf.dst + outBuf.pos; + const size_t decSize = ZSTD_decompress(verifBuf, inputSize, outBuf.dst, outBuf.pos); + CHECK_Z(decSize); + CHECK(decSize != inputSize, "regenerated %zu bytes, instead of %zu", decSize, inputSize); + CHECK(memcmp(realSrcStart, verifBuf, inputSize) != 0, "regenerated data different from original"); + } } DISPLAYLEVEL(3, "OK \n"); - DISPLAYLEVEL(3, "test%3i : ZSTD_compressStream2() ZSTD_c_stableInBuffer allocated size : ", testNb++); + /* stableSrc + streaming */ + DISPLAYLEVEL(3, "test%3i : ZSTD_c_stableInBuffer compatibility with compressStream2, using different end directives : ", testNb++); + CHECK_Z( ZSTD_initCStream(cctx, 1) ); + CHECK_Z( ZSTD_CCtx_setParameter(cctx, ZSTD_c_stableInBuffer, 1) ); + { ZSTD_inBuffer inBuf; + ZSTD_outBuffer outBuf; + const size_t nonZeroStartPos = 18; + const size_t inputSize = 500; + inBuf.src = CNBuffer; + inBuf.size = 100; + inBuf.pos = nonZeroStartPos; + outBuf.dst = (char*)(compressedBuffer)+cSize; + outBuf.size = ZSTD_compressBound(inputSize); + outBuf.pos = 0; + CHECK_Z( ZSTD_compressStream2(cctx, &outBuf, &inBuf, ZSTD_e_continue) ); + inBuf.size = 200; + CHECK_Z( ZSTD_compressStream2(cctx, &outBuf, &inBuf, ZSTD_e_continue) ); + CHECK_Z( ZSTD_compressStream2(cctx, &outBuf, &inBuf, ZSTD_e_flush) ); + inBuf.size = nonZeroStartPos + inputSize; + CHECK_Z( ZSTD_compressStream2(cctx, &outBuf, &inBuf, ZSTD_e_continue) ); + CHECK( ZSTD_compressStream2(cctx, &outBuf, &inBuf, ZSTD_e_end) != 0, "compression should be successful and fully flushed"); + { const void* const realSrcStart = (const char*)inBuf.src + nonZeroStartPos; + void* const verifBuf = (char*)outBuf.dst + outBuf.pos; + const size_t decSize = ZSTD_decompress(verifBuf, inputSize, outBuf.dst, outBuf.pos); + CHECK_Z(decSize); + CHECK(decSize != inputSize, "regenerated %zu bytes, instead of %zu", decSize, inputSize); + CHECK(memcmp(realSrcStart, verifBuf, inputSize) != 0, "regenerated data different from original"); + } } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : ZSTD_compressStream2() with ZSTD_c_stableInBuffer: context size : ", testNb++); { size_t const cctxSize = ZSTD_sizeof_CCtx(cctx); + DISPLAYLEVEL(4, "cctxSize1=%zu; cctxSize=%zu; cctxSize2=%zu : ", cctxSize1, cctxSize, cctxSize2); CHECK(!(cctxSize1 < cctxSize), "Must be bigger than single-pass"); CHECK(!(cctxSize < cctxSize2), "Must be smaller than streaming"); cctxSize1 = cctxSize; @@ -900,13 +985,15 @@ static int basicUnitTests(U32 seed, double compressibility) CHECK_Z(ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters)); CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, 1)); CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_stableOutBuffer, 1)); + in.src = CNBuffer; in.pos = out.pos = 0; in.size = MIN(CNBufferSize, 10); + out.size = compressedBufferSize; CHECK_Z(ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_flush)); in.pos = 0; in.size = CNBufferSize - in.size; CHECK(!(ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_end) == 0), "Not finished"); - CHECK_Z(ZSTD_decompress(decodedBuffer, CNBufferSize, compressedBuffer, cSize)); + CHECK_Z(ZSTD_decompress(decodedBuffer, CNBufferSize, compressedBuffer, out.pos)); DISPLAYLEVEL(3, "OK \n"); DISPLAYLEVEL(3, "test%3i : ZSTD_compressStream2() ZSTD_c_stableOutBuffer modify buffer : ", testNb++); @@ -916,12 +1003,13 @@ static int basicUnitTests(U32 seed, double compressibility) in.pos = out.pos = 0; { size_t const ret = ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue); CHECK(!ZSTD_isError(ret), "Must have errored"); - CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_dstBuffer_wrong), "Must be this error"); + CHECK(!(ZSTD_getErrorCode(ret) == ZSTD_error_stabilityCondition_notRespected), "Must be this error"); } DISPLAYLEVEL(3, "OK \n"); - DISPLAYLEVEL(3, "test%3i : ZSTD_compressStream2() ZSTD_c_stableOutBuffer allocated size : ", testNb++); + DISPLAYLEVEL(3, "test%3i : ZSTD_compressStream2() with ZSTD_c_stableOutBuffer: context size : ", testNb++); { size_t const cctxSize = ZSTD_sizeof_CCtx(cctx); + DISPLAYLEVEL(4, "cctxSize1=%zu; cctxSize=%zu; cctxSize2=%zu : ", cctxSize1, cctxSize, cctxSize2); CHECK(!(cctxSize1 < cctxSize), "Must be bigger than single-pass and stableInBuffer"); CHECK(!(cctxSize < cctxSize2), "Must be smaller than streaming"); } @@ -1063,7 +1151,7 @@ static int basicUnitTests(U32 seed, double compressibility) if (ZSTD_decompressStream(dctx, &out, &in) != 0) goto _output_error; if (in.pos != in.size) goto _output_error; } - /* The dictionary should presist across calls. */ + /* The dictionary should persist across calls. */ { ZSTD_outBuffer out = {decodedBuffer, decodedBufferSize, 0}; ZSTD_inBuffer in = {compressedBuffer, cSize, 0}; if (ZSTD_decompressStream(dctx, &out, &in) != 0) goto _output_error; @@ -1128,7 +1216,7 @@ static int basicUnitTests(U32 seed, double compressibility) if (ZSTD_decompressStream(dctx, &out, &in) != 0) goto _output_error; if (in.pos != in.size) goto _output_error; } - /* The ddict should presist across calls. */ + /* The ddict should persist across calls. */ { ZSTD_outBuffer out = {decodedBuffer, decodedBufferSize, 0}; ZSTD_inBuffer in = {compressedBuffer, cSize, 0}; if (ZSTD_decompressStream(dctx, &out, &in) != 0) goto _output_error; @@ -1175,12 +1263,12 @@ static int basicUnitTests(U32 seed, double compressibility) /* We should succeed to decompress with the dictionary. */ CHECK_Z( ZSTD_initDStream_usingDict(dctx, dictionary.start, dictionary.filled) ); CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, decodedBufferSize, compressedBuffer, cSize) ); - /* The dictionary should presist across calls. */ + /* The dictionary should persist across calls. */ CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, decodedBufferSize, compressedBuffer, cSize) ); /* We should succeed to decompress with the ddict. */ CHECK_Z( ZSTD_initDStream_usingDDict(dctx, ddict) ); CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, decodedBufferSize, compressedBuffer, cSize) ); - /* The ddict should presist across calls. */ + /* The ddict should persist across calls. */ CHECK_Z( ZSTD_decompressDCtx(dctx, decodedBuffer, decodedBufferSize, compressedBuffer, cSize) ); /* When we reset the context the ddict is cleared. */ CHECK_Z( ZSTD_initDStream(dctx) ); @@ -1478,6 +1566,84 @@ static int basicUnitTests(U32 seed, double compressibility) CHECK(!ZSTD_isError(ZSTD_CCtx_setParameter(zc, ZSTD_c_srcSizeHint, -1)), "Out of range doesn't error"); DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : ZSTD_lazy compress with hashLog = 29 and searchLog = 4 : ", testNb++); + if (MEM_64bits()) { + ZSTD_outBuffer out = { compressedBuffer, compressedBufferSize, 0 }; + ZSTD_inBuffer in = { CNBuffer, CNBufferSize, 0 }; + CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_strategy, ZSTD_lazy)); + /* Force enable the row based match finder */ + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_useRowMatchFinder, ZSTD_ps_enable)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_searchLog, 4)); + /* Set windowLog to 29 so the hashLog doesn't get sized down */ + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_windowLog, 29)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_hashLog, 29)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_checksumFlag, 1)); + /* Compress with continue first so the hashLog doesn't get sized down */ + CHECK_Z(ZSTD_compressStream2(zc, &out, &in, ZSTD_e_continue)); + CHECK_Z(ZSTD_compressStream2(zc, &out, &in, ZSTD_e_end)); + cSize = out.pos; + CHECK_Z(ZSTD_decompress(decodedBuffer, CNBufferSize, compressedBuffer, cSize)); + } + DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : Test offset == windowSize : ", testNb++); + { + int windowLog; + int const kMaxWindowLog = bigTests ? 29 : 26; + size_t const kNbSequences = 10000; + size_t const kMaxSrcSize = (1u << kMaxWindowLog) + 10 * kNbSequences; + char* src = calloc(kMaxSrcSize, 1); + ZSTD_Sequence* sequences = malloc(sizeof(ZSTD_Sequence) * kNbSequences); + for (windowLog = ZSTD_WINDOWLOG_MIN; windowLog <= kMaxWindowLog; ++windowLog) { + size_t const srcSize = ((size_t)1 << windowLog) + 10 * (kNbSequences - 1); + + sequences[0].offset = 32; + sequences[0].litLength = 32; + sequences[0].matchLength = (1u << windowLog) - 32; + sequences[0].rep = 0; + { + size_t i; + for (i = 1; i < kNbSequences; ++i) { + sequences[i].offset = (1u << windowLog) - (FUZ_rand(&seed) % 8); + sequences[i].litLength = FUZ_rand(&seed) & 7; + sequences[i].matchLength = 10 - sequences[i].litLength; + sequences[i].rep = 0; + } + } + + CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_checksumFlag, 1)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_minMatch, 3)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_validateSequences, 1)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_windowLog, windowLog)); + assert(srcSize <= kMaxSrcSize); + cSize = ZSTD_compressSequences(zc, compressedBuffer, compressedBufferSize, sequences, kNbSequences, src, srcSize); + CHECK_Z(cSize); + CHECK_Z(ZSTD_DCtx_reset(zd, ZSTD_reset_session_and_parameters)); + CHECK_Z(ZSTD_DCtx_setParameter(zd, ZSTD_d_windowLogMax, windowLog)) + { + ZSTD_inBuffer in = {compressedBuffer, cSize, 0}; + size_t decompressedBytes = 0; + for (;;) { + ZSTD_outBuffer out = {decodedBuffer, decodedBufferSize, 0}; + size_t const ret = ZSTD_decompressStream(zd, &out, &in); + CHECK_Z(ret); + CHECK(decompressedBytes + out.pos > srcSize, "Output too large"); + CHECK(memcmp(out.dst, src + decompressedBytes, out.pos), "Corrupted"); + decompressedBytes += out.pos; + if (ret == 0) { + break; + } + } + CHECK(decompressedBytes != srcSize, "Output wrong size"); + } + } + free(sequences); + free(src); + } + DISPLAYLEVEL(3, "OK \n"); + /* Overlen overwriting window data bug */ DISPLAYLEVEL(3, "test%3i : wildcopy doesn't overwrite potential match data : ", testNb++); { /* This test has a window size of 1024 bytes and consists of 3 blocks: @@ -1690,6 +1856,445 @@ static int basicUnitTests(U32 seed, double compressibility) } DISPLAYLEVEL(3, "OK \n"); + DISPLAYLEVEL(3, "test%3i : Block-Level External Sequence Producer API: ", testNb++); + { + size_t const dstBufSize = ZSTD_compressBound(CNBufferSize); + BYTE* const dstBuf = (BYTE*)malloc(ZSTD_compressBound(dstBufSize)); + size_t const checkBufSize = CNBufferSize; + BYTE* const checkBuf = (BYTE*)malloc(checkBufSize); + int enableFallback; + EMF_testCase sequenceProducerState; + + CHECK(dstBuf == NULL || checkBuf == NULL, "allocation failed"); + + CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters)); + + /* Reference external matchfinder outside the test loop to + * check that the reference is preserved across compressions */ + ZSTD_registerSequenceProducer(zc, &sequenceProducerState, zstreamSequenceProducer); + + for (enableFallback = 0; enableFallback <= 1; enableFallback++) { + size_t testCaseId; + size_t const numTestCases = 9; + + EMF_testCase const testCases[] = { + EMF_ONE_BIG_SEQ, + EMF_LOTS_OF_SEQS, + EMF_ZERO_SEQS, + EMF_BIG_ERROR, + EMF_SMALL_ERROR, + EMF_INVALID_OFFSET, + EMF_INVALID_MATCHLEN, + EMF_INVALID_LITLEN, + EMF_INVALID_LAST_LITS + }; + + ZSTD_ErrorCode const errorCodes[] = { + ZSTD_error_no_error, + ZSTD_error_no_error, + ZSTD_error_sequenceProducer_failed, + ZSTD_error_sequenceProducer_failed, + ZSTD_error_sequenceProducer_failed, + ZSTD_error_externalSequences_invalid, + ZSTD_error_externalSequences_invalid, + ZSTD_error_externalSequences_invalid, + ZSTD_error_externalSequences_invalid + }; + + for (testCaseId = 0; testCaseId < numTestCases; testCaseId++) { + size_t res; + + int const compressionShouldSucceed = ( + (errorCodes[testCaseId] == ZSTD_error_no_error) || + (enableFallback && errorCodes[testCaseId] == ZSTD_error_sequenceProducer_failed) + ); + + int const testWithSequenceValidation = ( + testCases[testCaseId] == EMF_INVALID_OFFSET + ); + + sequenceProducerState = testCases[testCaseId]; + + ZSTD_CCtx_reset(zc, ZSTD_reset_session_only); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_validateSequences, testWithSequenceValidation)); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableSeqProducerFallback, enableFallback)); + res = ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize); + + if (compressionShouldSucceed) { + CHECK(ZSTD_isError(res), "EMF: Compression error: %s", ZSTD_getErrorName(res)); + CHECK_Z(ZSTD_decompress(checkBuf, checkBufSize, dstBuf, res)); + CHECK(memcmp(CNBuffer, checkBuf, CNBufferSize) != 0, "EMF: Corruption!"); + } else { + CHECK(!ZSTD_isError(res), "EMF: Should have raised an error!"); + CHECK( + ZSTD_getErrorCode(res) != errorCodes[testCaseId], + "EMF: Wrong error code: %s", ZSTD_getErrorName(res) + ); + } + } + + /* Test compression with external matchfinder + empty src buffer */ + { + size_t res; + sequenceProducerState = EMF_ZERO_SEQS; + ZSTD_CCtx_reset(zc, ZSTD_reset_session_only); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableSeqProducerFallback, enableFallback)); + res = ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, 0); + CHECK(ZSTD_isError(res), "EMF: Compression error: %s", ZSTD_getErrorName(res)); + CHECK(ZSTD_decompress(checkBuf, checkBufSize, dstBuf, res) != 0, "EMF: Empty src round trip failed!"); + } + } + + /* Test that reset clears the external matchfinder */ + CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters)); + sequenceProducerState = EMF_BIG_ERROR; /* ensure zstd will fail if the matchfinder wasn't cleared */ + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableSeqProducerFallback, 0)); + CHECK_Z(ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize)); + + /* Test that registering mFinder == NULL clears the external matchfinder */ + ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters); + ZSTD_registerSequenceProducer(zc, &sequenceProducerState, zstreamSequenceProducer); + sequenceProducerState = EMF_BIG_ERROR; /* ensure zstd will fail if the matchfinder wasn't cleared */ + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableSeqProducerFallback, 0)); + ZSTD_registerSequenceProducer(zc, NULL, NULL); /* clear the external matchfinder */ + CHECK_Z(ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize)); + + /* Test that external matchfinder doesn't interact with older APIs */ + ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters); + ZSTD_registerSequenceProducer(zc, &sequenceProducerState, zstreamSequenceProducer); + sequenceProducerState = EMF_BIG_ERROR; /* ensure zstd will fail if the matchfinder is used */ + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableSeqProducerFallback, 0)); + CHECK_Z(ZSTD_compressCCtx(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize, 3)); + + /* Test that compression returns the correct error with LDM */ + CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters)); + { + size_t res; + ZSTD_registerSequenceProducer(zc, &sequenceProducerState, zstreamSequenceProducer); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_enableLongDistanceMatching, ZSTD_ps_enable)); + res = ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize); + CHECK(!ZSTD_isError(res), "EMF: Should have raised an error!"); + CHECK( + ZSTD_getErrorCode(res) != ZSTD_error_parameter_combination_unsupported, + "EMF: Wrong error code: %s", ZSTD_getErrorName(res) + ); + } + +#ifdef ZSTD_MULTITHREAD + /* Test that compression returns the correct error with nbWorkers > 0 */ + CHECK_Z(ZSTD_CCtx_reset(zc, ZSTD_reset_session_and_parameters)); + { + size_t res; + ZSTD_registerSequenceProducer(zc, &sequenceProducerState, zstreamSequenceProducer); + CHECK_Z(ZSTD_CCtx_setParameter(zc, ZSTD_c_nbWorkers, 1)); + res = ZSTD_compress2(zc, dstBuf, dstBufSize, CNBuffer, CNBufferSize); + CHECK(!ZSTD_isError(res), "EMF: Should have raised an error!"); + CHECK( + ZSTD_getErrorCode(res) != ZSTD_error_parameter_combination_unsupported, + "EMF: Wrong error code: %s", ZSTD_getErrorName(res) + ); + } +#endif + + free(dstBuf); + free(checkBuf); + } + DISPLAYLEVEL(3, "OK \n"); + + + /* Test maxBlockSize cctx param functionality */ + DISPLAYLEVEL(3, "test%3i : Testing maxBlockSize PR#3418: ", testNb++); + { + ZSTD_CCtx* cctx = ZSTD_createCCtx(); + + /* Quick test to make sure maxBlockSize bounds are enforced */ + assert(ZSTD_isError(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, ZSTD_BLOCKSIZE_MAX_MIN - 1))); + assert(ZSTD_isError(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, ZSTD_BLOCKSIZE_MAX + 1))); + + /* Test maxBlockSize < windowSize and windowSize < maxBlockSize*/ + { + size_t srcSize = 2 << 10; + void* const src = CNBuffer; + size_t dstSize = ZSTD_compressBound(srcSize); + void* const dst1 = compressedBuffer; + void* const dst2 = (BYTE*)compressedBuffer + dstSize; + size_t size1, size2; + void* const checkBuf = malloc(srcSize); + memset(src, 'x', srcSize); + + /* maxBlockSize = 1KB */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, 1u << 10)); + size1 = ZSTD_compress2(cctx, dst1, dstSize, src, srcSize); + + if (ZSTD_isError(size1)) goto _output_error; + CHECK_Z(ZSTD_decompress(checkBuf, srcSize, dst1, size1)); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + + /* maxBlockSize = 3KB */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, 3u << 10)); + size2 = ZSTD_compress2(cctx, dst2, dstSize, src, srcSize); + + if (ZSTD_isError(size2)) goto _output_error; + CHECK_Z(ZSTD_decompress(checkBuf, srcSize, dst2, size2)); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + + assert(size1 - size2 == 4); /* We add another RLE block with header + character */ + assert(memcmp(dst1, dst2, size2) != 0); /* Compressed output should not be equal */ + + /* maxBlockSize = 1KB, windowLog = 10 */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, 1u << 10)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 10)); + size1 = ZSTD_compress2(cctx, dst1, dstSize, src, srcSize); + + if (ZSTD_isError(size1)) goto _output_error; + CHECK_Z(ZSTD_decompress(checkBuf, srcSize, dst1, size1)); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + + /* maxBlockSize = 3KB, windowLog = 10 */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, 3u << 10)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_windowLog, 10)); + size2 = ZSTD_compress2(cctx, dst2, dstSize, src, srcSize); + + if (ZSTD_isError(size2)) goto _output_error; + CHECK_Z(ZSTD_decompress(checkBuf, srcSize, dst2, size2)); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + + assert(size1 == size2); + assert(memcmp(dst1, dst2, size1) == 0); /* Compressed output should be equal */ + + free(checkBuf); + } + + ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); + + /* Test maxBlockSize = 0 is valid */ + { size_t srcSize = 256 << 10; + void* const src = CNBuffer; + size_t dstSize = ZSTD_compressBound(srcSize); + void* const dst1 = compressedBuffer; + void* const dst2 = (BYTE*)compressedBuffer + dstSize; + size_t size1, size2; + void* const checkBuf = malloc(srcSize); + + /* maxBlockSize = 0 */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, 0)); + size1 = ZSTD_compress2(cctx, dst1, dstSize, src, srcSize); + + if (ZSTD_isError(size1)) goto _output_error; + CHECK_Z(ZSTD_decompress(checkBuf, srcSize, dst1, size1)); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + + /* maxBlockSize = ZSTD_BLOCKSIZE_MAX */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_maxBlockSize, ZSTD_BLOCKSIZE_MAX)); + size2 = ZSTD_compress2(cctx, dst2, dstSize, src, srcSize); + + if (ZSTD_isError(size2)) goto _output_error; + CHECK_Z(ZSTD_decompress(checkBuf, srcSize, dst2, size2)); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + + assert(size1 == size2); + assert(memcmp(dst1, dst2, size1) == 0); /* Compressed output should be equal */ + free(checkBuf); + } + ZSTD_freeCCtx(cctx); + } + DISPLAYLEVEL(3, "OK \n"); + + /* Test Sequence Validation */ + DISPLAYLEVEL(3, "test%3i : Testing sequence validation: ", testNb++); + { + ZSTD_CCtx* cctx = ZSTD_createCCtx(); + + /* Test minMatch >= 4, matchLength < 4 */ + { + size_t srcSize = 11; + void* const src = CNBuffer; + size_t dstSize = ZSTD_compressBound(srcSize); + void* const dst = compressedBuffer; + size_t const kNbSequences = 4; + ZSTD_Sequence* sequences = malloc(sizeof(ZSTD_Sequence) * kNbSequences); + + memset(src, 'x', srcSize); + + sequences[0] = (ZSTD_Sequence) {1, 1, 3, 0}; + sequences[1] = (ZSTD_Sequence) {1, 0, 3, 0}; + sequences[2] = (ZSTD_Sequence) {1, 0, 3, 0}; + sequences[3] = (ZSTD_Sequence) {0, 1, 0, 0}; + + /* Test with sequence validation */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, 5)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_explicitBlockDelimiters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_validateSequences, 1)); + + cSize = ZSTD_compressSequences(cctx, dst, dstSize, + sequences, kNbSequences, + src, srcSize); + + CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */ + CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */ + + ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); + + /* Test without sequence validation */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, 5)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_explicitBlockDelimiters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_validateSequences, 0)); + + cSize = ZSTD_compressSequences(cctx, dst, dstSize, + sequences, kNbSequences, + src, srcSize); + + CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */ + CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */ + + free(sequences); + } + + ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); + + + /* Test with no block delim */ + { + size_t srcSize = 4; + void* const src = CNBuffer; + size_t dstSize = ZSTD_compressBound(srcSize); + void* const dst = compressedBuffer; + size_t const kNbSequences = 1; + ZSTD_Sequence* sequences = malloc(sizeof(ZSTD_Sequence) * kNbSequences); + void* const checkBuf = malloc(srcSize); + + memset(src, 'x', srcSize); + + sequences[0] = (ZSTD_Sequence) {1, 1, 3, 0}; + + /* Test with sequence validation */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, 3)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_noBlockDelimiters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_validateSequences, 1)); + + cSize = ZSTD_compressSequences(cctx, dst, dstSize, + sequences, kNbSequences, + src, srcSize); + + CHECK(ZSTD_isError(cSize), "Should not throw an error"); + CHECK_Z(ZSTD_decompress(checkBuf, srcSize, dst, cSize)); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + + free(sequences); + free(checkBuf); + } + + ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); + + { /* Test case with two additional sequences */ + size_t srcSize = 19; + void* const src = CNBuffer; + size_t dstSize = ZSTD_compressBound(srcSize); + void* const dst = compressedBuffer; + size_t const kNbSequences = 7; + ZSTD_Sequence* sequences = malloc(sizeof(ZSTD_Sequence) * kNbSequences); + + memset(src, 'x', srcSize); + + sequences[0] = (ZSTD_Sequence) {1, 1, 3, 0}; + sequences[1] = (ZSTD_Sequence) {1, 0, 3, 0}; + sequences[2] = (ZSTD_Sequence) {1, 0, 3, 0}; + sequences[3] = (ZSTD_Sequence) {1, 0, 3, 0}; + sequences[4] = (ZSTD_Sequence) {1, 0, 3, 0}; + sequences[5] = (ZSTD_Sequence) {1, 0, 3, 0}; + sequences[6] = (ZSTD_Sequence) {0, 0, 0, 0}; + + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, 5)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_explicitBlockDelimiters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_validateSequences, 1)); + + cSize = ZSTD_compressSequences(cctx, dst, dstSize, + sequences, kNbSequences, + src, srcSize); + + CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */ + CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */ + + ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters); + + /* Test without sequence validation */ + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_minMatch, 5)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_blockDelimiters, ZSTD_sf_explicitBlockDelimiters)); + CHECK_Z(ZSTD_CCtx_setParameter(cctx, ZSTD_c_validateSequences, 0)); + + cSize = ZSTD_compressSequences(cctx, dst, dstSize, + sequences, kNbSequences, + src, srcSize); + + CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */ + CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */ + + free(sequences); + } + ZSTD_freeCCtx(cctx); + } + DISPLAYLEVEL(3, "OK \n"); + + + DISPLAYLEVEL(3, "test%3i : Testing large offset with small window size: ", testNb++); + { + ZSTD_CCtx* cctx = ZSTD_createCCtx(); + ZSTD_DCtx* dctx = ZSTD_createDCtx(); + + /* Test large offset, small window size*/ + { + size_t srcSize = 21; + void* const src = CNBuffer; + size_t dstSize = ZSTD_compressBound(srcSize); + void* const dst = compressedBuffer; + size_t const kNbSequences = 4; + ZSTD_Sequence* sequences = malloc(sizeof(ZSTD_Sequence) * kNbSequences); + void* const checkBuf = malloc(srcSize); + const size_t largeDictSize = 1 << 25; + ZSTD_CDict* cdict = NULL; + ZSTD_DDict* ddict = NULL; + + /* Generate large dictionary */ + void* dictBuffer = calloc(largeDictSize, 1); + ZSTD_compressionParameters cParams = ZSTD_getCParams(1, srcSize, largeDictSize); + cParams.minMatch = ZSTD_MINMATCH_MIN; + cParams.hashLog = ZSTD_HASHLOG_MIN; + cParams.chainLog = ZSTD_CHAINLOG_MIN; + + cdict = ZSTD_createCDict_advanced(dictBuffer, largeDictSize, ZSTD_dlm_byRef, ZSTD_dct_rawContent, cParams, ZSTD_defaultCMem); + ddict = ZSTD_createDDict_advanced(dictBuffer, largeDictSize, ZSTD_dlm_byRef, ZSTD_dct_rawContent, ZSTD_defaultCMem); + + ZSTD_CCtx_refCDict(cctx, cdict); + ZSTD_DCtx_refDDict(dctx, ddict); + + sequences[0] = (ZSTD_Sequence) {3, 3, 3, 0}; + sequences[1] = (ZSTD_Sequence) {1 << 25, 0, 3, 0}; + sequences[2] = (ZSTD_Sequence) {1 << 25, 0, 9, 0}; + sequences[3] = (ZSTD_Sequence) {3, 0, 3, 0}; + + cSize = ZSTD_compressSequences(cctx, dst, dstSize, + sequences, kNbSequences, + src, srcSize); + + CHECK(ZSTD_isError(cSize), "Should not throw an error"); + + { + size_t dSize = ZSTD_decompressDCtx(dctx, checkBuf, srcSize, dst, cSize); + CHECK(ZSTD_isError(dSize), "Should not throw an error"); + CHECK(memcmp(src, checkBuf, srcSize) != 0, "Corruption!"); + } + + free(sequences); + free(checkBuf); + free(dictBuffer); + ZSTD_freeCDict(cdict); + ZSTD_freeDDict(ddict); + } + ZSTD_freeCCtx(cctx); + ZSTD_freeDCtx(dctx); + } + DISPLAYLEVEL(3, "OK \n"); + _end: FUZ_freeDictionary(dictionary); ZSTD_freeCStream(zc); @@ -1855,7 +2460,7 @@ static int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double co && oldTestLog /* at least one test happened */ && resetAllowed) { maxTestSize = FUZ_randomLength(&lseed, oldTestLog+2); maxTestSize = MIN(maxTestSize, srcBufferSize-16); - { U64 const pledgedSrcSize = (FUZ_rand(&lseed) & 3) ? ZSTD_CONTENTSIZE_UNKNOWN : maxTestSize; + { U64 const pledgedSrcSize = (FUZ_rand(&lseed) & 3) ? ZSTD_CONTENTSIZE_UNKNOWN : maxTestSize; CHECK_Z( ZSTD_CCtx_reset(zc, ZSTD_reset_session_only) ); CHECK_Z( ZSTD_CCtx_setPledgedSrcSize(zc, pledgedSrcSize) ); } @@ -1887,8 +2492,9 @@ static int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double co /* multi-segments compression test */ XXH64_reset(&xxhState, 0); { ZSTD_outBuffer outBuff = { cBuffer, cBufferSize, 0 } ; - U32 n; - for (n=0, cSize=0, totalTestSize=0 ; totalTestSize < maxTestSize ; n++) { + cSize=0; + totalTestSize=0; + while(totalTestSize < maxTestSize) { /* compress random chunks into randomly sized dst buffers */ { size_t const randomSrcSize = FUZ_randomLength(&lseed, maxSampleLog); size_t const srcSize = MIN(maxTestSize-totalTestSize, randomSrcSize); @@ -2193,7 +2799,7 @@ static int fuzzerTests_newAPI(U32 seed, int nbTests, int startTest, /* mess with long distance matching parameters */ if (bigTests) { - if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_enableLongDistanceMatching, FUZ_rand(&lseed) & 63, opaqueAPI) ); + if (FUZ_rand(&lseed) & 1) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_enableLongDistanceMatching, FUZ_randomClampedLength(&lseed, ZSTD_ps_auto, ZSTD_ps_disable), opaqueAPI) ); if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_ldmHashLog, FUZ_randomClampedLength(&lseed, ZSTD_HASHLOG_MIN, 23), opaqueAPI) ); if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_ldmMinMatch, FUZ_randomClampedLength(&lseed, ZSTD_LDM_MINMATCH_MIN, ZSTD_LDM_MINMATCH_MAX), opaqueAPI) ); if (FUZ_rand(&lseed) & 3) CHECK_Z( setCCtxParameter(zc, cctxParams, ZSTD_c_ldmBucketSizeLog, FUZ_randomClampedLength(&lseed, ZSTD_LDM_BUCKETSIZELOG_MIN, ZSTD_LDM_BUCKETSIZELOG_MAX), opaqueAPI) ); @@ -2277,7 +2883,7 @@ static int fuzzerTests_newAPI(U32 seed, int nbTests, int startTest, CHECK_Z( ZSTD_CCtx_refPrefix(zc, dict, dictSize) ); } - /* Adjust number of workers occassionally - result must be deterministic independent of nbWorkers */ + /* Adjust number of workers occasionally - result must be deterministic independent of nbWorkers */ CHECK_Z(ZSTD_CCtx_getParameter(zc, ZSTD_c_nbWorkers, &nbWorkers)); if (nbWorkers > 0 && (FUZ_rand(&lseed) & 7) == 0) { DISPLAYLEVEL(6, "t%u: Modify nbWorkers: %d -> %d \n", testNb, nbWorkers, nbWorkers + iter); @@ -2356,14 +2962,20 @@ static int fuzzerTests_newAPI(U32 seed, int nbTests, int startTest, CHECK(badParameters(zc, savedParams), "CCtx params are wrong"); /* multi - fragments decompression test */ + if (FUZ_rand(&lseed) & 1) { + CHECK_Z(ZSTD_DCtx_reset(zd, ZSTD_reset_session_and_parameters)); + } if (!dictSize /* don't reset if dictionary : could be different */ && (FUZ_rand(&lseed) & 1)) { - DISPLAYLEVEL(5, "resetting DCtx (dict:%p) \n", dict); + DISPLAYLEVEL(5, "resetting DCtx (dict:%p) \n", (void const*)dict); CHECK_Z( ZSTD_resetDStream(zd) ); } else { if (dictSize) DISPLAYLEVEL(5, "using dictionary of size %zu \n", dictSize); CHECK_Z( ZSTD_initDStream_usingDict(zd, dict, dictSize) ); } + if (FUZ_rand(&lseed) & 1) { + CHECK_Z(ZSTD_DCtx_setParameter(zd, ZSTD_d_disableHuffmanAssembly, FUZ_rand(&lseed) & 1)); + } { size_t decompressionResult = 1; ZSTD_inBuffer inBuff = { cBuffer, cSize, 0 }; ZSTD_outBuffer outBuff= { dstBuffer, dstBufferSize, 0 }; @@ -2405,7 +3017,14 @@ static int fuzzerTests_newAPI(U32 seed, int nbTests, int startTest, } } /* try decompression on noisy data */ - CHECK_Z( ZSTD_initDStream(zd_noise) ); /* note : no dictionary */ + if (FUZ_rand(&lseed) & 1) { + CHECK_Z(ZSTD_DCtx_reset(zd_noise, ZSTD_reset_session_and_parameters)); + } else { + CHECK_Z(ZSTD_DCtx_reset(zd_noise, ZSTD_reset_session_only)); + } + if (FUZ_rand(&lseed) & 1) { + CHECK_Z(ZSTD_DCtx_setParameter(zd_noise, ZSTD_d_disableHuffmanAssembly, FUZ_rand(&lseed) & 1)); + } { ZSTD_inBuffer inBuff = { cBuffer, cSize, 0 }; ZSTD_outBuffer outBuff= { dstBuffer, dstBufferSize, 0 }; while (outBuff.pos < dstBufferSize) { @@ -2488,6 +3107,7 @@ int main(int argc, const char** argv) if (!strcmp(argument, "--newapi")) { selected_api=advanced_api; testNb += !testNb; continue; } if (!strcmp(argument, "--no-big-tests")) { bigTests=0; continue; } + if (!strcmp(argument, "--big-tests")) { bigTests=1; continue; } argument++; while (*argument!=0) { @@ -2589,7 +3209,7 @@ int main(int argc, const char** argv) if (nbTests<=0) nbTests=1; if (testNb==0) { - result = basicUnitTests(0, ((double)proba) / 100); /* constant seed for predictability */ + result = basicUnitTests(0, ((double)proba) / 100, bigTests); /* constant seed for predictability */ } if (!result) { diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/.gitignore b/src/dependencies/zstd-1.5.4/zlibWrapper/.gitignore similarity index 100% rename from src/dependencies/zstd-1.5.0/zlibWrapper/.gitignore rename to src/dependencies/zstd-1.5.4/zlibWrapper/.gitignore diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/BUCK b/src/dependencies/zstd-1.5.4/zlibWrapper/BUCK similarity index 100% rename from src/dependencies/zstd-1.5.0/zlibWrapper/BUCK rename to src/dependencies/zstd-1.5.4/zlibWrapper/BUCK diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/Makefile b/src/dependencies/zstd-1.5.4/zlibWrapper/Makefile similarity index 93% rename from src/dependencies/zstd-1.5.0/zlibWrapper/Makefile rename to src/dependencies/zstd-1.5.4/zlibWrapper/Makefile index 6fd5ac3..830b294 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/Makefile +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/Makefile @@ -66,9 +66,10 @@ test: example fitblk example_zstd fitblk_zstd zwrapbench minigzip minigzip_zstd ./zwrapbench -qi1b3B1K $(TEST_FILE) ./zwrapbench -rqi1b1e3 ../lib -#valgrindTest: ZSTDLIBRARY = $(ZSTDLIBDIR)/libzstd.so -valgrindTest: VALGRIND = LD_LIBRARY_PATH=$(ZSTDLIBDIR) valgrind --track-origins=yes --leak-check=full --error-exitcode=1 -valgrindTest: clean example fitblk example_zstd fitblk_zstd zwrapbench +.PHONY: test-valgrind +#test-valgrind: ZSTDLIBRARY = $(ZSTDLIBDIR)/libzstd.so +test-valgrind: VALGRIND = LD_LIBRARY_PATH=$(ZSTDLIBDIR) valgrind --track-origins=yes --leak-check=full --error-exitcode=1 +test-valgrind: clean example fitblk example_zstd fitblk_zstd zwrapbench @echo "\n ---- valgrind tests ----" $(VALGRIND) ./example $(VALGRIND) ./example_zstd diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/README.md b/src/dependencies/zstd-1.5.4/zlibWrapper/README.md similarity index 95% rename from src/dependencies/zstd-1.5.0/zlibWrapper/README.md rename to src/dependencies/zstd-1.5.4/zlibWrapper/README.md index e61767c..311e1db 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/README.md +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/README.md @@ -1,7 +1,7 @@ Zstandard wrapper for zlib ================================ -The main objective of creating a zstd wrapper for [zlib](http://zlib.net/) is to allow a quick and smooth transition to zstd for projects already using zlib. +The main objective of creating a zstd wrapper for [zlib](https://zlib.net/) is to allow a quick and smooth transition to zstd for projects already using zlib. #### Required files @@ -43,7 +43,7 @@ This behavior can be changed using `ZWRAP_setDecompressionType(ZWRAP_FORCE_ZLIB) #### Example -We have take the file `test/example.c` from [the zlib library distribution](http://zlib.net/) and copied it to [zlibWrapper/examples/example.c](examples/example.c). +We have taken the file `test/example.c` from [the zlib library distribution](https://zlib.net/) and copied it to [zlibWrapper/examples/example.c](examples/example.c). After compilation and execution it shows the following results: ``` zlib version 1.2.8 = 0x1280, compile flags = 0x65 diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/example.c b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/example.c similarity index 95% rename from src/dependencies/zstd-1.5.0/zlibWrapper/examples/example.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/examples/example.c index 9000f7a..d7590e3 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/example.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/example.c @@ -56,26 +56,26 @@ z_const char hello[] = "hello, hello! I said hello, hello!"; const char dictionary[] = "hello, hello!"; uLong dictId; /* Adler32 value of the dictionary */ -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, +void test_deflate _Z_OF((Byte *compr, uLong comprLen)); +void test_inflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, +void test_large_deflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, +void test_large_inflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, +void test_flush _Z_OF((Byte *compr, uLong *comprLen)); +void test_sync _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, +void test_dict_deflate _Z_OF((Byte *compr, uLong comprLen)); +void test_dict_inflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); +int main _Z_OF((int argc, char *argv[])); #ifdef Z_SOLO -void *myalloc OF((void *, unsigned, unsigned)); -void myfree OF((void *, void *)); +void *myalloc _Z_OF((void *, unsigned, unsigned)); +void myfree _Z_OF((void *, void *)); void *myalloc(q, n, m) void *q; @@ -102,9 +102,9 @@ static free_func zfree = myfree; static alloc_func zalloc = (alloc_func)0; static free_func zfree = (free_func)0; -void test_compress OF((Byte *compr, uLong comprLen, +void test_compress _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *fname, +void test_gzio _Z_OF((const char *fname, Byte *uncompr, uLong uncomprLen)); /* =========================================================================== diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/example_original.c b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/example_original.c similarity index 95% rename from src/dependencies/zstd-1.5.0/zlibWrapper/examples/example_original.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/examples/example_original.c index 649882b..5b4e4d1 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/example_original.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/example_original.c @@ -51,26 +51,26 @@ z_const char hello[] = "hello, hello!"; const char dictionary[] = "hello"; uLong dictId; /* Adler32 value of the dictionary */ -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, +void test_deflate _Z_OF((Byte *compr, uLong comprLen)); +void test_inflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, +void test_large_deflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, +void test_large_inflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, +void test_flush _Z_OF((Byte *compr, uLong *comprLen)); +void test_sync _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, +void test_dict_deflate _Z_OF((Byte *compr, uLong comprLen)); +void test_dict_inflate _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); +int main _Z_OF((int argc, char *argv[])); #ifdef Z_SOLO -void *myalloc OF((void *, unsigned, unsigned)); -void myfree OF((void *, void *)); +void *myalloc _Z_OF((void *, unsigned, unsigned)); +void myfree _Z_OF((void *, void *)); void *myalloc(q, n, m) void *q; @@ -94,9 +94,9 @@ static free_func zfree = myfree; static alloc_func zalloc = (alloc_func)0; static free_func zfree = (free_func)0; -void test_compress OF((Byte *compr, uLong comprLen, +void test_compress _Z_OF((Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *fname, +void test_gzio _Z_OF((const char *fname, Byte *uncompr, uLong uncomprLen)); /* =========================================================================== diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/fitblk.c b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/fitblk.c similarity index 99% rename from src/dependencies/zstd-1.5.0/zlibWrapper/examples/fitblk.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/examples/fitblk.c index 669b176..8dc7071 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/fitblk.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/fitblk.c @@ -119,7 +119,7 @@ local int recompress(z_streamp inf, z_streamp def) if (ret == Z_MEM_ERROR) return ret; - /* compress what was decompresed until done or no room */ + /* compress what was decompressed until done or no room */ def->avail_in = RAWLEN - inf->avail_out; def->next_in = raw; if (inf->avail_out != 0) diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/fitblk_original.c b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/fitblk_original.c similarity index 99% rename from src/dependencies/zstd-1.5.0/zlibWrapper/examples/fitblk_original.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/examples/fitblk_original.c index 20f351b..723dc00 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/fitblk_original.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/fitblk_original.c @@ -109,7 +109,7 @@ local int recompress(z_streamp inf, z_streamp def) if (ret == Z_MEM_ERROR) return ret; - /* compress what was decompresed until done or no room */ + /* compress what was decompressed until done or no room */ def->avail_in = RAWLEN - inf->avail_out; def->next_in = raw; if (inf->avail_out != 0) diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/minigzip.c b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/minigzip.c similarity index 94% rename from src/dependencies/zstd-1.5.0/zlibWrapper/examples/minigzip.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/examples/minigzip.c index f67be09..717a94d 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/minigzip.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/minigzip.c @@ -3,7 +3,7 @@ /* minigzip.c -- simulate gzip using the zlib compression library * Copyright (C) 1995-2006, 2010, 2011 Jean-loup Gailly. - * For conditions of distribution and use, see http://www.zlib.net/zlib_license.html + * For conditions of distribution and use, see https://www.zlib.net/zlib_license.html */ /* @@ -64,7 +64,7 @@ #if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) #ifndef WIN32 /* unlink already in stdio.h for WIN32 */ - extern int unlink OF((const char *)); + extern int unlink _Z_OF((const char *)); #endif #endif @@ -154,8 +154,8 @@ static void pwinerror (s) # include /* for unlink() */ #endif -void *myalloc OF((void *, unsigned, unsigned)); -void myfree OF((void *, void *)); +void *myalloc _Z_OF((void *, unsigned, unsigned)); +void myfree _Z_OF((void *, void *)); void *myalloc(q, n, m) void *q; @@ -180,9 +180,9 @@ typedef struct gzFile_s { z_stream strm; } *gzFile; -gzFile gzopen OF((const char *, const char *)); -gzFile gzdopen OF((int, const char *)); -gzFile gz_open OF((const char *, int, const char *)); +gzFile gzopen _Z_OF((const char *, const char *)); +gzFile gzdopen _Z_OF((int, const char *)); +gzFile gz_open _Z_OF((const char *, int, const char *)); gzFile gzopen(path, mode) const char *path; @@ -236,7 +236,7 @@ gzFile gz_open(path, fd, mode) return gz; } -int gzwrite OF((gzFile, const void *, unsigned)); +int gzwrite _Z_OF((gzFile, const void *, unsigned)); int gzwrite(gz, buf, len) gzFile gz; @@ -260,7 +260,7 @@ int gzwrite(gz, buf, len) return len; } -int gzread OF((gzFile, void *, unsigned)); +int gzread _Z_OF((gzFile, void *, unsigned)); int gzread(gz, buf, len) gzFile gz; @@ -297,7 +297,7 @@ int gzread(gz, buf, len) return len - strm->avail_out; } -int gzclose OF((gzFile)); +int gzclose _Z_OF((gzFile)); int gzclose(gz) gzFile gz; @@ -326,7 +326,7 @@ int gzclose(gz) return Z_OK; } -const char *gzerror OF((gzFile, int *)); +const char *gzerror _Z_OF((gzFile, int *)); const char *gzerror(gz, err) gzFile gz; @@ -340,15 +340,15 @@ const char *gzerror(gz, err) char *prog; -void error OF((const char *msg)); -void gz_compress OF((FILE *in, gzFile out)); +void error _Z_OF((const char *msg)); +void gz_compress _Z_OF((FILE *in, gzFile out)); #ifdef USE_MMAP -int gz_compress_mmap OF((FILE *in, gzFile out)); +int gz_compress_mmap _Z_OF((FILE *in, gzFile out)); #endif -void gz_uncompress OF((gzFile in, FILE *out)); -void file_compress OF((char *file, char *mode)); -void file_uncompress OF((char *file)); -int main OF((int argc, char *argv[])); +void gz_uncompress _Z_OF((gzFile in, FILE *out)); +void file_compress _Z_OF((char *file, char *mode)); +void file_uncompress _Z_OF((char *file)); +int main _Z_OF((int argc, char *argv[])); /* =========================================================================== * Display error message and exit diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/zwrapbench.c b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/zwrapbench.c similarity index 98% rename from src/dependencies/zstd-1.5.0/zlibWrapper/examples/zwrapbench.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/examples/zwrapbench.c index 5993e51..3bc9a1a 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/examples/zwrapbench.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/examples/zwrapbench.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -388,7 +388,7 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize, markNb = (markNb+1) % NB_MARKS; DISPLAYLEVEL(2, "%2s-%-17.17s :%10u ->%10u (%5.3f),%6.1f MB/s\r", marks[markNb], displayName, (unsigned)srcSize, (unsigned)cSize, ratio, - (double)srcSize / fastestC ); + (double)srcSize / (double)fastestC ); (void)fastestD; (void)crcOrig; /* unused when decompression disabled */ #if 1 @@ -428,8 +428,10 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize, ZSTD_DStream* zbd = ZSTD_createDStream(); size_t rSize; if (zbd == NULL) EXM_THROW(1, "ZSTD_createDStream() allocation failure"); - rSize = ZSTD_initDStream_usingDict(zbd, dictBuffer, dictBufferSize); - if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_initDStream() failed : %s", ZSTD_getErrorName(rSize)); + rSize = ZSTD_DCtx_reset(zbd, ZSTD_reset_session_only); + if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_DCtx_reset() failed : %s", ZSTD_getErrorName(rSize)); + rSize = ZSTD_DCtx_loadDictionary(zbd, dictBuffer, dictBufferSize); + if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_DCtx_loadDictionary() failed : %s", ZSTD_getErrorName(rSize)); do { U32 blockNb; for (blockNb=0; blockNb%10u (%5.3f),%6.1f MB/s ,%6.1f MB/s\r", marks[markNb], displayName, (unsigned)srcSize, (unsigned)cSize, ratio, - (double)srcSize / fastestC, - (double)srcSize / fastestD ); + (double)srcSize / (double)fastestC, + (double)srcSize / (double)fastestD ); /* CRC Checking */ { U64 const crcCheck = XXH64(resultBuffer, srcSize, 0); @@ -558,8 +560,8 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize, } /* for (testNb = 1; testNb <= (g_nbIterations + !g_nbIterations); testNb++) */ if (g_displayLevel == 1) { - double cSpeed = (double)srcSize / fastestC; - double dSpeed = (double)srcSize / fastestD; + double cSpeed = (double)srcSize / (double)fastestC; + double dSpeed = (double)srcSize / (double)fastestD; if (g_additionalParam) DISPLAY("-%-3i%11i (%5.3f) %6.2f MB/s %6.1f MB/s %s (param=%d)\n", cLevel, (int)cSize, ratio, cSpeed, dSpeed, displayName, g_additionalParam); else @@ -836,7 +838,7 @@ static int usage(const char* programName) DISPLAY( " -b# : benchmark file(s), using # compression level (default : %d) \n", ZSTDCLI_CLEVEL_DEFAULT); DISPLAY( " -e# : test all compression levels from -bX to # (default: %d)\n", ZSTDCLI_CLEVEL_DEFAULT); DISPLAY( " -i# : minimum evaluation time in seconds (default : 3s)\n"); - DISPLAY( " -B# : cut file into independent blocks of size # (default: no block)\n"); + DISPLAY( " -B# : cut file into independent chunks of size # (default: no chunking)\n"); return 0; } diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/gzclose.c b/src/dependencies/zstd-1.5.4/zlibWrapper/gzclose.c similarity index 89% rename from src/dependencies/zstd-1.5.0/zlibWrapper/gzclose.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/gzclose.c index 25d3789..ba43b8c 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/gzclose.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/gzclose.c @@ -3,7 +3,7 @@ /* gzclose.c -- zlib gzclose() function * Copyright (C) 2004, 2010 Mark Adler - * For conditions of distribution and use, see http://www.zlib.net/zlib_license.html + * For conditions of distribution and use, see https://www.zlib.net/zlib_license.html */ #include "gzguts.h" diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/gzcompatibility.h b/src/dependencies/zstd-1.5.4/zlibWrapper/gzcompatibility.h similarity index 73% rename from src/dependencies/zstd-1.5.0/zlibWrapper/gzcompatibility.h rename to src/dependencies/zstd-1.5.4/zlibWrapper/gzcompatibility.h index c1aa2b8..9d11b98 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/gzcompatibility.h +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/gzcompatibility.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -11,10 +11,10 @@ #if ZLIB_VERNUM <= 0x1240 -ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); -ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); -ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); -ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_r _Z_OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w _Z_OF((gzFile file)); +ZEXTERN int ZEXPORT gzbuffer _Z_OF((gzFile file, unsigned size)); +ZEXTERN z_off_t ZEXPORT gzoffset _Z_OF((gzFile file)); #if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t @@ -40,7 +40,7 @@ struct gzFile_s { #if ZLIB_VERNUM <= 0x1270 #if defined(_WIN32) && !defined(Z_SOLO) # include /* for wchar_t */ -ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, +ZEXTERN gzFile ZEXPORT gzopen_w _Z_OF((const wchar_t *path, const char *mode)); #endif #endif @@ -61,8 +61,8 @@ ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, # endif # undef z_longlong #endif -ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, +ZEXTERN z_size_t ZEXPORT gzfread _Z_OF((voidp buf, z_size_t size, z_size_t nitems, gzFile file)); -ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, +ZEXTERN z_size_t ZEXPORT gzfwrite _Z_OF((voidpc buf, z_size_t size, z_size_t nitems, gzFile file)); #endif diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/gzguts.h b/src/dependencies/zstd-1.5.4/zlibWrapper/gzguts.h similarity index 91% rename from src/dependencies/zstd-1.5.0/zlibWrapper/gzguts.h rename to src/dependencies/zstd-1.5.4/zlibWrapper/gzguts.h index b639b4b..70a609d 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/gzguts.h +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/gzguts.h @@ -4,7 +4,7 @@ /* gzguts.h -- zlib internal header definitions for gz* operations * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler - * For conditions of distribution and use, see http://www.zlib.net/zlib_license.html + * For conditions of distribution and use, see https://www.zlib.net/zlib_license.html */ #ifdef _LARGEFILE64_SOURCE @@ -126,8 +126,8 @@ /* gz* functions always use library allocation functions */ #ifndef STDC - extern voidp malloc OF((uInt size)); - extern void free OF((voidpf ptr)); + extern voidp malloc _Z_OF((uInt size)); + extern void free _Z_OF((voidpf ptr)); #endif /* get errno and strerror definition */ @@ -145,10 +145,10 @@ /* provide prototypes for these when building zlib without LFS */ #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN gzFile ZEXPORT gzopen64 _Z_OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 _Z_OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 _Z_OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 _Z_OF((gzFile)); #endif /* default memLevel */ @@ -213,9 +213,9 @@ typedef union { } gz_statep; /* shared functions */ -void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +void ZLIB_INTERNAL gz_error _Z_OF((gz_statep, int, const char *)); #if defined UNDER_CE -char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +char ZLIB_INTERNAL *gz_strwinerror _Z_OF((DWORD error)); #endif /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t @@ -224,6 +224,6 @@ char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); #ifdef INT_MAX # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) #else -unsigned ZLIB_INTERNAL gz_intmax OF((void)); +unsigned ZLIB_INTERNAL gz_intmax _Z_OF((void)); # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) #endif diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/gzlib.c b/src/dependencies/zstd-1.5.4/zlibWrapper/gzlib.c similarity index 98% rename from src/dependencies/zstd-1.5.0/zlibWrapper/gzlib.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/gzlib.c index b1fb985..eea480a 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/gzlib.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/gzlib.c @@ -3,7 +3,7 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files * Copyright (C) 2004-2017 Mark Adler - * For conditions of distribution and use, see http://www.zlib.net/zlib_license.html + * For conditions of distribution and use, see https://www.zlib.net/zlib_license.html */ #include "gzguts.h" @@ -19,8 +19,8 @@ #endif /* Local functions */ -local void gz_reset OF((gz_statep)); -local gzFile gz_open OF((const void *, int, const char *)); +local void gz_reset _Z_OF((gz_statep)); +local gzFile gz_open _Z_OF((const void *, int, const char *)); #if defined UNDER_CE diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/gzread.c b/src/dependencies/zstd-1.5.4/zlibWrapper/gzread.c similarity index 97% rename from src/dependencies/zstd-1.5.0/zlibWrapper/gzread.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/gzread.c index 359d178..584fad1 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/gzread.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/gzread.c @@ -3,7 +3,7 @@ /* gzread.c -- zlib functions for reading gzip files * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler - * For conditions of distribution and use, see http://www.zlib.net/zlib_license.html + * For conditions of distribution and use, see https://www.zlib.net/zlib_license.html */ #include "gzguts.h" @@ -17,13 +17,13 @@ /* Local functions */ -local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); -local int gz_avail OF((gz_statep)); -local int gz_look OF((gz_statep)); -local int gz_decomp OF((gz_statep)); -local int gz_fetch OF((gz_statep)); -local int gz_skip OF((gz_statep, z_off64_t)); -local z_size_t gz_read OF((gz_statep, voidp, z_size_t)); +local int gz_load _Z_OF((gz_statep, unsigned char *, unsigned, unsigned *)); +local int gz_avail _Z_OF((gz_statep)); +local int gz_look _Z_OF((gz_statep)); +local int gz_decomp _Z_OF((gz_statep)); +local int gz_fetch _Z_OF((gz_statep)); +local int gz_skip _Z_OF((gz_statep, z_off64_t)); +local z_size_t gz_read _Z_OF((gz_statep, voidp, z_size_t)); /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from state.state->fd, and update state.state->eof, state.state->err, and state.state->msg as appropriate. @@ -464,8 +464,8 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file) #endif #if ZLIB_VERNUM <= 0x1250 -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); +ZEXTERN int ZEXPORT gzgetc _Z_OF((gzFile file)); +ZEXTERN int ZEXPORT gzgetc_ _Z_OF((gzFile file)); #endif int ZEXPORT gzgetc(file) diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/gzwrite.c b/src/dependencies/zstd-1.5.4/zlibWrapper/gzwrite.c similarity index 98% rename from src/dependencies/zstd-1.5.0/zlibWrapper/gzwrite.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/gzwrite.c index 422ff17..ccd4f71 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/gzwrite.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/gzwrite.c @@ -3,7 +3,7 @@ /* gzwrite.c -- zlib functions for writing gzip files * Copyright (C) 2004-2017 Mark Adler - * For conditions of distribution and use, see http://www.zlib.net/zlib_license.html + * For conditions of distribution and use, see https://www.zlib.net/zlib_license.html */ #include @@ -11,10 +11,10 @@ #include "gzguts.h" /* Local functions */ -local int gz_init OF((gz_statep)); -local int gz_comp OF((gz_statep, int)); -local int gz_zero OF((gz_statep, z_off64_t)); -local z_size_t gz_write OF((gz_statep, voidpc, z_size_t)); +local int gz_init _Z_OF((gz_statep)); +local int gz_comp _Z_OF((gz_statep, int)); +local int gz_zero _Z_OF((gz_statep, z_off64_t)); +local z_size_t gz_write _Z_OF((gz_statep, voidpc, z_size_t)); /* Initialize state for writing a gzip file. Mark initialization by setting state.state->size to non-zero. Return -1 on a memory allocation failure, or 0 on diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.c b/src/dependencies/zstd-1.5.4/zlibWrapper/zstd_zlibwrapper.c similarity index 92% rename from src/dependencies/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.c rename to src/dependencies/zstd-1.5.4/zlibWrapper/zstd_zlibwrapper.c index ceb2393..479ddd4 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.c +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/zstd_zlibwrapper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -101,7 +101,7 @@ ZWRAP_decompress_type ZWRAP_getDecompressionType(void) { return g_ZWRAPdecompres const char * zstdVersion(void) { return ZSTD_VERSION_STRING; } -ZEXTERN const char * ZEXPORT z_zlibVersion OF((void)) { return zlibVersion(); } +ZEXTERN const char * ZEXPORT z_zlibVersion _Z_OF((void)) { return zlibVersion(); } static void* ZWRAP_allocFunction(void* opaque, size_t size) { @@ -260,7 +260,7 @@ static struct internal_state* convert_into_sis(void* ptr) return (struct internal_state*) ptr; } -ZEXTERN int ZEXPORT z_deflateInit_ OF((z_streamp strm, int level, +ZEXTERN int ZEXPORT z_deflateInit_ _Z_OF((z_streamp strm, int level, const char *version, int stream_size)) { ZWRAP_CCtx* zwc; @@ -287,7 +287,7 @@ ZEXTERN int ZEXPORT z_deflateInit_ OF((z_streamp strm, int level, } -ZEXTERN int ZEXPORT z_deflateInit2_ OF((z_streamp strm, int level, int method, +ZEXTERN int ZEXPORT z_deflateInit2_ _Z_OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)) @@ -319,7 +319,7 @@ int ZWRAP_deflateReset_keepDict(z_streamp strm) } -ZEXTERN int ZEXPORT z_deflateReset OF((z_streamp strm)) +ZEXTERN int ZEXPORT z_deflateReset _Z_OF((z_streamp strm)) { LOG_WRAPPERC("- deflateReset\n"); if (!g_ZWRAP_useZSTDcompression) @@ -334,7 +334,7 @@ ZEXTERN int ZEXPORT z_deflateReset OF((z_streamp strm)) } -ZEXTERN int ZEXPORT z_deflateSetDictionary OF((z_streamp strm, +ZEXTERN int ZEXPORT z_deflateSetDictionary _Z_OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)) { @@ -359,7 +359,7 @@ ZEXTERN int ZEXPORT z_deflateSetDictionary OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_deflate OF((z_streamp strm, int flush)) +ZEXTERN int ZEXPORT z_deflate _Z_OF((z_streamp strm, int flush)) { ZWRAP_CCtx* zwc; @@ -465,7 +465,7 @@ ZEXTERN int ZEXPORT z_deflate OF((z_streamp strm, int flush)) } -ZEXTERN int ZEXPORT z_deflateEnd OF((z_streamp strm)) +ZEXTERN int ZEXPORT z_deflateEnd _Z_OF((z_streamp strm)) { if (!g_ZWRAP_useZSTDcompression) { LOG_WRAPPERC("- deflateEnd\n"); @@ -483,7 +483,7 @@ ZEXTERN int ZEXPORT z_deflateEnd OF((z_streamp strm)) } -ZEXTERN uLong ZEXPORT z_deflateBound OF((z_streamp strm, +ZEXTERN uLong ZEXPORT z_deflateBound _Z_OF((z_streamp strm, uLong sourceLen)) { if (!g_ZWRAP_useZSTDcompression) @@ -493,7 +493,7 @@ ZEXTERN uLong ZEXPORT z_deflateBound OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_deflateParams OF((z_streamp strm, +ZEXTERN int ZEXPORT z_deflateParams _Z_OF((z_streamp strm, int level, int strategy)) { @@ -594,7 +594,7 @@ static int ZWRAPD_finishWithErrorMsg(z_streamp strm, char* message) } -ZEXTERN int ZEXPORT z_inflateInit_ OF((z_streamp strm, +ZEXTERN int ZEXPORT z_inflateInit_ _Z_OF((z_streamp strm, const char* version, int stream_size)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB) { @@ -623,7 +623,7 @@ ZEXTERN int ZEXPORT z_inflateInit_ OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_inflateInit2_ OF((z_streamp strm, int windowBits, +ZEXTERN int ZEXPORT z_inflateInit2_ _Z_OF((z_streamp strm, int windowBits, const char *version, int stream_size)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB) { @@ -660,7 +660,7 @@ int ZWRAP_inflateReset_keepDict(z_streamp strm) } -ZEXTERN int ZEXPORT z_inflateReset OF((z_streamp strm)) +ZEXTERN int ZEXPORT z_inflateReset _Z_OF((z_streamp strm)) { LOG_WRAPPERD("- inflateReset\n"); if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) @@ -678,7 +678,7 @@ ZEXTERN int ZEXPORT z_inflateReset OF((z_streamp strm)) #if ZLIB_VERNUM >= 0x1240 -ZEXTERN int ZEXPORT z_inflateReset2 OF((z_streamp strm, +ZEXTERN int ZEXPORT z_inflateReset2 _Z_OF((z_streamp strm, int windowBits)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) @@ -696,7 +696,7 @@ ZEXTERN int ZEXPORT z_inflateReset2 OF((z_streamp strm, #endif -ZEXTERN int ZEXPORT z_inflateSetDictionary OF((z_streamp strm, +ZEXTERN int ZEXPORT z_inflateSetDictionary _Z_OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)) { @@ -706,8 +706,10 @@ ZEXTERN int ZEXPORT z_inflateSetDictionary OF((z_streamp strm, { ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*) strm->state; if (zwd == NULL || zwd->zbd == NULL) return Z_STREAM_ERROR; - { size_t const initErr = ZSTD_initDStream_usingDict(zwd->zbd, dictionary, dictLength); - if (ZSTD_isError(initErr)) return ZWRAPD_finishWithError(zwd, strm, 0); } + { size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only); + if (ZSTD_isError(resetErr)) return ZWRAPD_finishWithError(zwd, strm, 0); } + { size_t const loadErr = ZSTD_DCtx_loadDictionary(zwd->zbd, dictionary, dictLength); + if (ZSTD_isError(loadErr)) return ZWRAPD_finishWithError(zwd, strm, 0); } zwd->decompState = ZWRAP_useReset; if (zwd->totalInBytes == ZSTD_HEADERSIZE) { @@ -730,7 +732,7 @@ ZEXTERN int ZEXPORT z_inflateSetDictionary OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush)) +ZEXTERN int ZEXPORT z_inflate _Z_OF((z_streamp strm, int flush)) { ZWRAP_DCtx* zwd; @@ -926,7 +928,7 @@ error: } -ZEXTERN int ZEXPORT z_inflateEnd OF((z_streamp strm)) +ZEXTERN int ZEXPORT z_inflateEnd _Z_OF((z_streamp strm)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) return inflateEnd(strm); @@ -943,7 +945,7 @@ ZEXTERN int ZEXPORT z_inflateEnd OF((z_streamp strm)) } -ZEXTERN int ZEXPORT z_inflateSync OF((z_streamp strm)) +ZEXTERN int ZEXPORT z_inflateSync _Z_OF((z_streamp strm)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) { return inflateSync(strm); @@ -955,7 +957,7 @@ ZEXTERN int ZEXPORT z_inflateSync OF((z_streamp strm)) /* Advanced compression functions */ -ZEXTERN int ZEXPORT z_deflateCopy OF((z_streamp dest, +ZEXTERN int ZEXPORT z_deflateCopy _Z_OF((z_streamp dest, z_streamp source)) { if (!g_ZWRAP_useZSTDcompression) @@ -964,7 +966,7 @@ ZEXTERN int ZEXPORT z_deflateCopy OF((z_streamp dest, } -ZEXTERN int ZEXPORT z_deflateTune OF((z_streamp strm, +ZEXTERN int ZEXPORT z_deflateTune _Z_OF((z_streamp strm, int good_length, int max_lazy, int nice_length, @@ -977,7 +979,7 @@ ZEXTERN int ZEXPORT z_deflateTune OF((z_streamp strm, #if ZLIB_VERNUM >= 0x1260 -ZEXTERN int ZEXPORT z_deflatePending OF((z_streamp strm, +ZEXTERN int ZEXPORT z_deflatePending _Z_OF((z_streamp strm, unsigned *pending, int *bits)) { @@ -988,7 +990,7 @@ ZEXTERN int ZEXPORT z_deflatePending OF((z_streamp strm, #endif -ZEXTERN int ZEXPORT z_deflatePrime OF((z_streamp strm, +ZEXTERN int ZEXPORT z_deflatePrime _Z_OF((z_streamp strm, int bits, int value)) { @@ -998,7 +1000,7 @@ ZEXTERN int ZEXPORT z_deflatePrime OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_deflateSetHeader OF((z_streamp strm, +ZEXTERN int ZEXPORT z_deflateSetHeader _Z_OF((z_streamp strm, gz_headerp head)) { if (!g_ZWRAP_useZSTDcompression) @@ -1011,7 +1013,7 @@ ZEXTERN int ZEXPORT z_deflateSetHeader OF((z_streamp strm, /* Advanced decompression functions */ #if ZLIB_VERNUM >= 0x1280 -ZEXTERN int ZEXPORT z_inflateGetDictionary OF((z_streamp strm, +ZEXTERN int ZEXPORT z_inflateGetDictionary _Z_OF((z_streamp strm, Bytef *dictionary, uInt *dictLength)) { @@ -1022,7 +1024,7 @@ ZEXTERN int ZEXPORT z_inflateGetDictionary OF((z_streamp strm, #endif -ZEXTERN int ZEXPORT z_inflateCopy OF((z_streamp dest, +ZEXTERN int ZEXPORT z_inflateCopy _Z_OF((z_streamp dest, z_streamp source)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !source->reserved) @@ -1032,7 +1034,7 @@ ZEXTERN int ZEXPORT z_inflateCopy OF((z_streamp dest, #if ZLIB_VERNUM >= 0x1240 -ZEXTERN long ZEXPORT z_inflateMark OF((z_streamp strm)) +ZEXTERN long ZEXPORT z_inflateMark _Z_OF((z_streamp strm)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) return inflateMark(strm); @@ -1041,7 +1043,7 @@ ZEXTERN long ZEXPORT z_inflateMark OF((z_streamp strm)) #endif -ZEXTERN int ZEXPORT z_inflatePrime OF((z_streamp strm, +ZEXTERN int ZEXPORT z_inflatePrime _Z_OF((z_streamp strm, int bits, int value)) { @@ -1051,7 +1053,7 @@ ZEXTERN int ZEXPORT z_inflatePrime OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_inflateGetHeader OF((z_streamp strm, +ZEXTERN int ZEXPORT z_inflateGetHeader _Z_OF((z_streamp strm, gz_headerp head)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) @@ -1060,7 +1062,7 @@ ZEXTERN int ZEXPORT z_inflateGetHeader OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_inflateBackInit_ OF((z_streamp strm, int windowBits, +ZEXTERN int ZEXPORT z_inflateBackInit_ _Z_OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)) @@ -1071,7 +1073,7 @@ ZEXTERN int ZEXPORT z_inflateBackInit_ OF((z_streamp strm, int windowBits, } -ZEXTERN int ZEXPORT z_inflateBack OF((z_streamp strm, +ZEXTERN int ZEXPORT z_inflateBack _Z_OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)) { @@ -1081,7 +1083,7 @@ ZEXTERN int ZEXPORT z_inflateBack OF((z_streamp strm, } -ZEXTERN int ZEXPORT z_inflateBackEnd OF((z_streamp strm)) +ZEXTERN int ZEXPORT z_inflateBackEnd _Z_OF((z_streamp strm)) { if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) return inflateBackEnd(strm); @@ -1089,14 +1091,14 @@ ZEXTERN int ZEXPORT z_inflateBackEnd OF((z_streamp strm)) } -ZEXTERN uLong ZEXPORT z_zlibCompileFlags OF((void)) { return zlibCompileFlags(); } +ZEXTERN uLong ZEXPORT z_zlibCompileFlags _Z_OF((void)) { return zlibCompileFlags(); } /* === utility functions === */ #ifndef Z_SOLO -ZEXTERN int ZEXPORT z_compress OF((Bytef *dest, uLongf *destLen, +ZEXTERN int ZEXPORT z_compress _Z_OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)) { if (!g_ZWRAP_useZSTDcompression) @@ -1115,7 +1117,7 @@ ZEXTERN int ZEXPORT z_compress OF((Bytef *dest, uLongf *destLen, } -ZEXTERN int ZEXPORT z_compress2 OF((Bytef *dest, uLongf *destLen, +ZEXTERN int ZEXPORT z_compress2 _Z_OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)) { @@ -1131,7 +1133,7 @@ ZEXTERN int ZEXPORT z_compress2 OF((Bytef *dest, uLongf *destLen, } -ZEXTERN uLong ZEXPORT z_compressBound OF((uLong sourceLen)) +ZEXTERN uLong ZEXPORT z_compressBound _Z_OF((uLong sourceLen)) { if (!g_ZWRAP_useZSTDcompression) return compressBound(sourceLen); @@ -1140,7 +1142,7 @@ ZEXTERN uLong ZEXPORT z_compressBound OF((uLong sourceLen)) } -ZEXTERN int ZEXPORT z_uncompress OF((Bytef *dest, uLongf *destLen, +ZEXTERN int ZEXPORT z_uncompress _Z_OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)) { if (!ZSTD_isFrame(source, sourceLen)) @@ -1159,24 +1161,24 @@ ZEXTERN int ZEXPORT z_uncompress OF((Bytef *dest, uLongf *destLen, /* checksum functions */ -ZEXTERN uLong ZEXPORT z_adler32 OF((uLong adler, const Bytef *buf, uInt len)) +ZEXTERN uLong ZEXPORT z_adler32 _Z_OF((uLong adler, const Bytef *buf, uInt len)) { return adler32(adler, buf, len); } -ZEXTERN uLong ZEXPORT z_crc32 OF((uLong crc, const Bytef *buf, uInt len)) +ZEXTERN uLong ZEXPORT z_crc32 _Z_OF((uLong crc, const Bytef *buf, uInt len)) { return crc32(crc, buf, len); } #if ZLIB_VERNUM >= 0x12B0 -ZEXTERN uLong ZEXPORT z_adler32_z OF((uLong adler, const Bytef *buf, z_size_t len)) +ZEXTERN uLong ZEXPORT z_adler32_z _Z_OF((uLong adler, const Bytef *buf, z_size_t len)) { return adler32_z(adler, buf, len); } -ZEXTERN uLong ZEXPORT z_crc32_z OF((uLong crc, const Bytef *buf, z_size_t len)) +ZEXTERN uLong ZEXPORT z_crc32_z _Z_OF((uLong crc, const Bytef *buf, z_size_t len)) { return crc32_z(crc, buf, len); } @@ -1184,8 +1186,15 @@ ZEXTERN uLong ZEXPORT z_crc32_z OF((uLong crc, const Bytef *buf, z_size_t len)) #if ZLIB_VERNUM >= 0x1270 -ZEXTERN const z_crc_t FAR * ZEXPORT z_get_crc_table OF((void)) +ZEXTERN const z_crc_t FAR * ZEXPORT z_get_crc_table _Z_OF((void)) { return get_crc_table(); } #endif + + /* Error function */ +ZEXTERN const char * ZEXPORT z_zError _Z_OF((int err)) +{ + /* Just use zlib Error function */ + return zError(err); +} diff --git a/src/dependencies/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.h b/src/dependencies/zstd-1.5.4/zlibWrapper/zstd_zlibwrapper.h similarity index 97% rename from src/dependencies/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.h rename to src/dependencies/zstd-1.5.4/zlibWrapper/zstd_zlibwrapper.h index 042ab9f..230bf84 100644 --- a/src/dependencies/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.h +++ b/src/dependencies/zstd-1.5.4/zlibWrapper/zstd_zlibwrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. + * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the @@ -25,6 +25,9 @@ extern "C" { #define z_const #endif +#if !defined(_Z_OF) + #define _Z_OF OF +#endif /* returns a string with version of zstd library */ const char * zstdVersion(void);